summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-06-05 14:57:38 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-06-05 14:57:38 +0200
commitbc2a5d9b1e1db8927f7c10725eec5a073968c9d5 (patch)
tree3cb88a9a26c51286f99daea3acb968cb69a3e717
parent3ccc8224be30ed01a30a4d92ca868df4e98a13fd (diff)
aml: define amlintmask and set it according to DSDT revision (64bit / 32bit)
-rw-r--r--sys/include/aml.h1
-rw-r--r--sys/src/9/pc/archacpi.c1
-rw-r--r--sys/src/cmd/scram.c4
-rw-r--r--sys/src/libaml/aml.c5
4 files changed, 9 insertions, 2 deletions
diff --git a/sys/include/aml.h b/sys/include/aml.h
index d1864a60c..27c31d003 100644
--- a/sys/include/aml.h
+++ b/sys/include/aml.h
@@ -36,6 +36,7 @@ void amldrop(void *);
void* amlroot;
int amldebug;
+uvlong amlintmask;
#pragma varargck type "V" void*
#pragma varargck type "N" void*
diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c
index 644df59b9..c2ed1580f 100644
--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -495,6 +495,7 @@ acpiinit(void)
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;
}
diff --git a/sys/src/cmd/scram.c b/sys/src/cmd/scram.c
index d35d48235..be5f2de40 100644
--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -69,8 +69,10 @@ loadacpi(void)
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){
diff --git a/sys/src/libaml/aml.c b/sys/src/libaml/aml.c
index 7c513f89b..64b17bf12 100644
--- a/sys/src/libaml/aml.c
+++ b/sys/src/libaml/aml.c
@@ -296,7 +296,7 @@ mki(uvlong i)
uvlong *v;
v = mk('i', sizeof(uvlong));
- *v = i;
+ *v = i & amlintmask;
return v;
}
@@ -2139,6 +2139,9 @@ amlinit(void)
fmtinstall('V', Vfmt);
fmtinstall('N', Nfmt);
+ if(!amlintmask)
+ amlintmask = ~0ULL;
+
n = mk('N', sizeof(Name));
n->up = n;