pc, pc64: implement acpi reset (for efi)

x230 booted in efi only (no csp) mode hangs
when traditional i8042reset() keyboard reset
is tried.

so we try acpireset() first which discoveres
and writes the acpi reset register.
This commit is contained in:
cinap_lenrek 2014-11-02 03:52:53 +01:00
parent 670493fe5e
commit bb95002c2d
4 changed files with 29 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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]);

View file

@ -585,6 +585,7 @@ mpshutdown(void)
lapicicrw(0, 0x000C0000|ApicINIT);
pcireset();
acpireset();
i8042reset();
/*

View file

@ -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]);