summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-04-08 19:35:29 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-04-08 19:35:29 +0200
commitaec3d8022ae0aa2f7209970df0399c1242af20c9 (patch)
tree7a5bb4a45641fdca918690b802deefbc2fd09594
parentae3afb12a05aca507b313c2ff61c27f015688e6e (diff)
downloadplan9front-aec3d8022ae0aa2f7209970df0399c1242af20c9.tar.xz
process acpi interrupt source override entries in a 2nd pass over the madt (APIC) table (thanks erik)
according to erik, virtualbox puts the source overrides before the ioapic entries so the addirq() call fails as no ioapics have been declared yet. use a second pass over the table after we processed the apic entries.
-rw-r--r--sys/src/9/pc/archacpi.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c
index 3a5cc3506..0b6e7ea48 100644
--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -461,7 +461,7 @@ acpiinit(void)
Tbl *t;
Apic *a;
void *va;
- uchar *p, *e;
+ uchar *s, *p, *e;
ulong lapicbase;
int machno, i, c;
@@ -497,16 +497,16 @@ acpiinit(void)
return;
Foundapic:
- p = t->data;
- e = p + tbldlen(t);
- lapicbase = get32(p); p += 8;
+ s = t->data;
+ e = s + tbldlen(t);
+ lapicbase = get32(s); s += 8;
va = vmap(lapicbase, 1024);
print("LAPIC: %.8lux %#p\n", lapicbase, va);
if(va == nil)
panic("acpiinit: cannot map lapic %.8lux", lapicbase);
machno = 0;
- for(; p < e; p += c){
+ for(p = s; p < e; p += c){
c = p[1];
if(c < 2 || (p+c) > e)
break;
@@ -555,6 +555,18 @@ Foundapic:
mpioapic[a->apicno] = a;
ioapicinit(a, a->apicno);
break;
+ }
+ }
+
+ /*
+ * need 2nd pass as vbox puts interrupt overrides
+ * *before* the ioapic entries (!)
+ */
+ for(p = s; 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;