cleaned up Reference: /n/patches.lsub.org/patch/acpifixes Date: Mon May 21 12:16:04 CES 2012 Signed-off-by: paurea@lsub.org --- /sys/src/nix/k10/devacpi.c Thu Apr 12 12:26:27 2012 +++ /sys/src/nix/k10/devacpi.c Mon May 21 11:54:40 2012 @@ -17,7 +17,6 @@ * for the user-level interpreter. */ - #define l16get(p) (((p)[1]<<8)|(p)[0]) #define l32get(p) (((u32int)l16get(p+2)<<16)|l16get(p)) static Atable* acpifadt(uchar*, int); @@ -558,6 +557,7 @@ Fadt *fp; fp = &fadt; + DBG("acpifadt %p\n", p); fp->facs = l32get(p + 36); fp->dsdt = l32get(p + 40); fp->pmprofile = p[45]; @@ -595,6 +595,7 @@ fp->iapcbootarch = l16get(p+109); fp->flags = l32get(p+112); gasget(&fp->resetreg, p+116); + fp->resetval = p[128]; fp->xfacs = l64get(p+132); fp->xdsdt = l64get(p+140); @@ -608,15 +609,24 @@ gasget(&fp->xgpe1blk, p+232); dumpfadt(fp); - if(fp->xfacs != 0) + + /* If xfacs or xdsdt are either nil + * or different from their 32-bit + * counter-parts, then go with + * the 32-bit addresses (as the + * ACPICA does), since those are + * tested by BIOS manufacturers. + */ + + if(fp->xfacs != 0 && fp->xfacs == fp->facs) loadfacs(fp->xfacs); else loadfacs(fp->facs); - if(fp->xdsdt == ((u64int)fp->dsdt)) /* acpica */ - loaddsdt(fp->xdsdt); + if(fp->xdsdt != 0 && fp->xdsdt == fp->dsdt) + loadfacs(fp->xdsdt); else - loaddsdt(fp->dsdt); + loadfacs(fp->dsdt); return nil; /* can be unmapped once parsed */ }