a few little wiggles discovered when trying to get things going under vbox. we've got to scan the table twice, because vbox is liberal in its interpreation of dependencies is, and it allows isa exceptions before any i/o apics have been declared. we also have to look out for objects that exist in aml, but have no value. Reference: /n/atom/patch/applied/vboxacpi Date: Tue Apr 8 10:24:57 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/acpi.c Tue Apr 8 10:22:57 2014 +++ /sys/src/nix/k10/acpi.c Tue Apr 8 10:22:58 2014 @@ -356,6 +356,16 @@ return id; } +static void* +walkval(void *dot, char *tag) +{ + void *x; + + if((x = amlwalk(dot, tag)) == nil) + return nil; + return amlval(x); +} + /*static*/ int pcibusno(void *dot) { @@ -368,11 +378,10 @@ if((x = amlwalk(dot, "^_HID")) != nil) if((p = amlval(x)) != nil) id = eisaid(p); - if((x = amlwalk(dot, "^_BBN")) == nil) - if((x = amlwalk(dot, "^_ADR")) == nil) - return -1; - if((p = amlval(x)) == nil) + if((p = walkval(dot, "^_BBN")) == nil) + if((p = walkval(dot, "^_ADR")) == nil) return -1; + adr = amlint(p); /* if root bridge, then we are done here */ if(id != nil && (strcmp(id, "PNP0A03")==0 || strcmp(id, "PNP0A08")==0)) @@ -591,7 +600,7 @@ static void parseapic(Tbl *t, Parsedat *dat) { - uchar *p, *e; + uchar *p0, *p, *e; int i, c, nmach, maxmach; uintmem lapicbase; @@ -606,6 +615,7 @@ p += 8; nmach = 0; + p0 = p; for(; p < e; p += c){ c = p[1]; if(c < 2 || (p+c) > e) @@ -621,7 +631,7 @@ ioapicinit(p[2], get32(p+8), get32(p+4)); break; case 0x02: /* Interrupt Source Override */ - addirq(get32(p+4), BusISA, 0, p[3], get16(p+8)); +// addirq(get32(p+4), BusISA, 0, p[3], get16(p+8)); break; case 0x03: /* NMI Source */ print("acpi: ignoring nmi source\n"); @@ -643,6 +653,18 @@ } } + /* vbox can put these before i/o apics (!) */ + for(p = p0; p < e; p += c){ + c = p[1]; + if(c < 2 || (p+c) > e) + break; + switch(*p){ + case 0x02: /* Interrupt Source Override */ + addirq(get32(p+4), BusISA, 0, p[3], get16(p+8)); + break; + } + } + /* look for PCI interrupt mappings */ amlenum(amlroot, "_PRT", enumprt, nil); @@ -925,6 +947,7 @@ sys->noi8042kbd = !(i&B8042kbd); sys->novga = i&Bnovga; sys->nomsi = i&Bnomsi; + sys->nomsix = sys->nomsi; sys->nocmos = i&Bnocmos; }