diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-12-19 23:34:43 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-12-19 23:34:43 +0100 |
commit | 7523131e78a0974154cc90272b41991435b1ec19 (patch) | |
tree | 11cfb7ed5a1d1d41d0fbd0452a9791ff4370a5ef /sys/src/9/pc/archacpi.c | |
parent | d94dc3314dc2431cafb49b394ac84123dd7b25d8 (diff) |
pc, pc64: untangle acpireset() from mpshutdown()
mpshutdown() used to call acpireset() making it impossible to build
a kernel without archacpi. now, mpshutdown() is a helper function
that only shuts down the application processors that gets used from
mpreset() and acpireset().
the generic machine reset code in exported by devarch's archreset()
function that is called by mpreset() and from acpireset() as a fallback.
so the code duplication that was in mpshutdown() is avoided.
Diffstat (limited to 'sys/src/9/pc/archacpi.c')
-rw-r--r-- | sys/src/9/pc/archacpi.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c index 6805f5c87..644df59b9 100644 --- a/sys/src/9/pc/archacpi.c +++ b/sys/src/9/pc/archacpi.c @@ -625,12 +625,42 @@ Foundapic: mpinit(); } +static void +acpireset(void) +{ + uchar *p; + Tbl *t; + int i; + + /* stop application processors */ + mpshutdown(); + + /* locate and write platform reset register */ + 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; + } + + /* acpi shutdown failed, try generic reset */ + archreset(); +} + static int identify(void); PCArch archacpi = { .id= "ACPI", .ident= identify, -.reset= mpshutdown, +.reset= acpireset, .intrinit= acpiinit, .intrenable= mpintrenable, .intron= lapicintron, @@ -887,29 +917,3 @@ 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; - } -} |