diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c index f996d90df..a9482fc83 100644 --- a/sys/src/9/pc/archacpi.c +++ b/sys/src/9/pc/archacpi.c @@ -862,3 +862,29 @@ amldelay(int us) { microdelay(us); } + +/* + * reset machine by writing acpi reset register. + */ +void +acpireset(void) +{ + uchar *p; + Tbl *t; + int i; + + for(i=0; i < ntblmap; i++){ + t = tblmap[i]; + if(memcmp(t->sig, "FACP", 4) != 0) + continue; + if(get32(t->len) <= 128) + break; + p = (uchar*)t; + if((get32(p + 112) & (1<<10)) == 0) + break; + if(p[116+0] != IoSpace) + break; + outb(get32(p+116+4), p[128]); + break; + } +} diff --git a/sys/src/9/pc/fns.h b/sys/src/9/pc/fns.h index 8ecaa0f7d..93178a000 100644 --- a/sys/src/9/pc/fns.h +++ b/sys/src/9/pc/fns.h @@ -1,6 +1,7 @@ #include "../port/portfns.h" void aamloop(int); +void acpireset(void); Dirtab* addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong)); void archinit(void); int bios32call(BIOS32ci*, u16int[3]); diff --git a/sys/src/9/pc/mp.c b/sys/src/9/pc/mp.c index 765fa30b6..63fe687fa 100644 --- a/sys/src/9/pc/mp.c +++ b/sys/src/9/pc/mp.c @@ -585,6 +585,7 @@ mpshutdown(void) lapicicrw(0, 0x000C0000|ApicINIT); pcireset(); + acpireset(); i8042reset(); /* diff --git a/sys/src/9/pc64/fns.h b/sys/src/9/pc64/fns.h index fe67edded..15eb1a0f5 100644 --- a/sys/src/9/pc64/fns.h +++ b/sys/src/9/pc64/fns.h @@ -1,6 +1,7 @@ #include "../port/portfns.h" void aamloop(int); +void acpireset(void); Dirtab* addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong)); void archinit(void); int bios32call(BIOS32ci*, u16int[3]);