diff options
author | Damien Zammit <damien@zamaudio.com> | 2022-09-12 10:39:45 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-09-12 20:32:59 +0200 |
commit | 4830c981325d53f8a4372288dbf0ef77a22059da (patch) | |
tree | 892cd79901ed178e964cbfc25da90ec2bbb99fa9 /shutdown/shutdown.c | |
parent | 160fb63ee0c72f165ab131c4d725d9badaa646ab (diff) | |
download | hurd-4830c981325d53f8a4372288dbf0ef77a22059da.tar.gz hurd-4830c981325d53f8a4372288dbf0ef77a22059da.tar.bz2 hurd-4830c981325d53f8a4372288dbf0ef77a22059da.zip |
shutdown: Use new acpi RPC to halt machine, clean up
This allows clean shutdown of all modern x86 machines
(not just qemu) by using the acpi translator to call
into libacpica code.
Message-Id: <20220912103837.556815-3-damien@zamaudio.com>
Diffstat (limited to 'shutdown/shutdown.c')
-rw-r--r-- | shutdown/shutdown.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/shutdown/shutdown.c b/shutdown/shutdown.c index f821b1f2..e4247397 100644 --- a/shutdown/shutdown.c +++ b/shutdown/shutdown.c @@ -35,8 +35,10 @@ #include <sys/file.h> #include <version.h> -#include "acpi_shutdown.h" #include "shutdown_S.h" +#include "acpi_U.h" + +#define SLEEP_STATE_S5 5 /* Port bucket we service requests on. */ struct port_bucket *port_bucket; @@ -56,8 +58,16 @@ struct port_class *trivfs_control_class; kern_return_t S_shutdown_shutdown(trivfs_protid_t server) { - disappear_via_acpi(); - return 0; + kern_return_t err; + mach_port_t acpi; + + acpi = file_name_lookup (_SERVERS_ACPI, O_RDWR, 0); + if (acpi == MACH_PORT_NULL) + return EIO; + + err = acpi_sleep(acpi, SLEEP_STATE_S5); + + return err; } static int |