[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] plat/common: perform ACPI poweroff on shutdown for x86



Note that this is hypervisor/emulator-specific and currently only
supports QEMU (and whoever is compatible with QEMU).

Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 plat/common/x86/cpu_native.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/plat/common/x86/cpu_native.c b/plat/common/x86/cpu_native.c
index 57ea3a21..b3f13dff 100644
--- a/plat/common/x86/cpu_native.c
+++ b/plat/common/x86/cpu_native.c
@@ -57,4 +57,13 @@ void system_off(void)
         * be 83 ('S', 41 << 1 | 1).
         */
        outw(0x501, 41);
+
+       /*
+        * Otherwise, perform an ACPI shutdown by writing (SLP_TYPa | SLP_EN)
+        * to PM1a_CNT. Generally speaking, we'd have to jump through a lot
+        * hoops to collect those values, however, for QEMU, those are static.
+        * Should be harmless if we're not running on QEMU, especially
+        * considering we're already shutting down, so who cares if we crash.
+        */
+       outw(0x604, 0x2000);
 }
-- 
2.21.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.