git: 9front

Download patch

ref: 7f9966cae40e60fd72059540e0c4165e1d07a643
parent: b57d16222b0ddbcb1bc16f1083e82f8a211648fa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jun 30 15:11:06 EDT 2016

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

--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -260,7 +260,10 @@
 	if((x = amlwalk(dot, "^_BBN")) == nil)
 		if((x = amlwalk(dot, "^_ADR")) == nil)
 			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(id != nil && (strcmp(id, "PNP0A03")==0 || strcmp(id, "PNP0A08")==0))
 		return adr;
@@ -282,7 +285,7 @@
 pciaddr(void *dot)
 {
 	int adr, bno;
-	void *x;
+	void *x, *p;
 
 	for(;;){
 		if((x = amlwalk(dot, "_ADR")) == nil){
@@ -294,9 +297,10 @@
 		}
 		if((bno = pcibusno(x)) < 0)
 			break;
-		if((x = amlval(x)) == nil)
+		p = nil;
+		if(amleval(x, "", &p) < 0)
 			break;
-		adr = amlint(x);
+		adr = amlint(p);
 		return MKBUS(BusPCI, bno, adr>>16, adr&0xFFFF);
 	}
 	return -1;
--