[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [UNIKRAFT PATCH v2] plat/common: perform ACPI poweroff on shutdown for x86
Please ignore this one, I just spotted a typo. :)
On 3/29/19 3:51 PM, Florian Schmidt wrote:
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 | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/plat/common/x86/cpu_native.c b/plat/common/x86/cpu_native.c
index 57ea3a21..2f49c9d5 100644
--- a/plat/common/x86/cpu_native.c
+++ b/plat/common/x86/cpu_native.c
@@ -51,10 +51,19 @@ unsigned long read_cr2(void)
void system_off(void)
{
/*
- * Poke the QEMU "isa-debug-exit" device to "shutdown". Should be
- * harmless if it is not present. This is used to enable automated
- * tests on virtio. Note that the actual QEMU exit() status will
- * be 83 ('S', 41 << 1 | 1).
+ * 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);
+
+ /*
+ * If that didn't work for whatever reason, try poking the QEMU
+ * "isa-debug-exit" device to "shutdown". Should be harmless if it is
+ * not present. This is used to enable automated tests on virtio. Note
+ * that the actual QEMU exit() status will be 83 ('S', 41 << 1 | 1).
*/
outw(0x501, 41);
}
--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel. +49 (0)6221 4342-265
Fax: +49 (0)6221 4342-155
e-mail: florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|