shithub: riscv

Download patch

ref: bc2a5d9b1e1db8927f7c10725eec5a073968c9d5
parent: 3ccc8224be30ed01a30a4d92ca868df4e98a13fd
author: cinap_lenrek <[email protected]>
date: Sun Jun 5 10:57:38 EDT 2016

aml: define amlintmask and set it according to DSDT revision (64bit / 32bit)

--- a/sys/include/aml.h
+++ b/sys/include/aml.h
@@ -36,6 +36,7 @@
 
 void*		amlroot;
 int		amldebug;
+uvlong		amlintmask;
 
 #pragma	varargck	type	"V"	void*
 #pragma	varargck	type	"N"	void*
--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -495,6 +495,7 @@
 	for(i=0; i<ntblmap; i++){
 		t = tblmap[i];
 		if(memcmp(t->sig, "DSDT", 4) == 0){
+			amlintmask = (~0ULL) >> (t->rev <= 1)*32;
 			amlload(t->data, tbldlen(t));
 			break;
 		}
--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -69,8 +69,10 @@
 		t = realloc(t, sizeof(*t) + l);
 		if(readn(fd, t->data, l) != l)
 			return -1;
-		if(memcmp("DSDT", t->sig, 4) == 0)
+		if(memcmp("DSDT", t->sig, 4) == 0){
+			amlintmask = (~0ULL) >> (t->rev <= 1)*32;
 			amlload(t->data, l);
+		}
 		else if(memcmp("SSDT", t->sig, 4) == 0)
 			amlload(t->data, l);
 		else if(memcmp("FACP", t->sig, 4) == 0){
--- a/sys/src/libaml/aml.c
+++ b/sys/src/libaml/aml.c
@@ -296,7 +296,7 @@
 	uvlong *v;
 
 	v = mk('i', sizeof(uvlong));
-	*v = i;
+	*v = i & amlintmask;
 	return v;
 }
 
@@ -2138,6 +2138,9 @@
 
 	fmtinstall('V', Vfmt);
 	fmtinstall('N', Nfmt);
+
+	if(!amlintmask)
+		amlintmask = ~0ULL;
 
 	n = mk('N', sizeof(Name));
 	n->up = n;