acpi: _ADR and _BBN might be methods, so use amleval() to evaluate the value

This commit is contained in:
cinap_lenrek 2016-06-30 19:11:06 +02:00
parent 3ec84c5d73
commit 1edd8d28a5

View file

@ -260,7 +260,10 @@ pcibusno(void *dot)
if((x = amlwalk(dot, "^_BBN")) == nil) if((x = amlwalk(dot, "^_BBN")) == nil)
if((x = amlwalk(dot, "^_ADR")) == nil) if((x = amlwalk(dot, "^_ADR")) == nil)
return -1; return -1;
adr = amlint(amlval(x)); p = nil;
if(amleval(x, "", &p) < 0)
return -1;
adr = amlint(p);
/* if root bridge, then we are done here */ /* if root bridge, then we are done here */
if(id != nil && (strcmp(id, "PNP0A03")==0 || strcmp(id, "PNP0A08")==0)) if(id != nil && (strcmp(id, "PNP0A03")==0 || strcmp(id, "PNP0A08")==0))
return adr; return adr;
@ -282,7 +285,7 @@ static int
pciaddr(void *dot) pciaddr(void *dot)
{ {
int adr, bno; int adr, bno;
void *x; void *x, *p;
for(;;){ for(;;){
if((x = amlwalk(dot, "_ADR")) == nil){ if((x = amlwalk(dot, "_ADR")) == nil){
@ -294,9 +297,10 @@ pciaddr(void *dot)
} }
if((bno = pcibusno(x)) < 0) if((bno = pcibusno(x)) < 0)
break; break;
if((x = amlval(x)) == nil) p = nil;
if(amleval(x, "", &p) < 0)
break; break;
adr = amlint(x); adr = amlint(p);
return MKBUS(BusPCI, bno, adr>>16, adr&0xFFFF); return MKBUS(BusPCI, bno, adr>>16, adr&0xFFFF);
} }
return -1; return -1;