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

[Minios-devel] [UNIKRAFT PATCHv6 28/37] plat/common: Implement system off for arm64



From: Wei Chen <Wei.Chen@xxxxxxx>

Using PSCI despatch function to call PSCI_SYSTEM_OFF
function to shutdown system.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 plat/common/arm/cpu_native.c        | 15 +++++++++++++++
 plat/common/include/arm/arm64/cpu.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/plat/common/arm/cpu_native.c b/plat/common/arm/cpu_native.c
index 1d632a4..f041db6 100644
--- a/plat/common/arm/cpu_native.c
+++ b/plat/common/arm/cpu_native.c
@@ -59,3 +59,18 @@ void reset(void)
 
        smcc_psci_call(PSCI_FNID_SYSTEM_RESET, 0, 0, 0);
 }
+
+/* Systems support PSCI >= 0.2 can do system off from PSCI */
+void system_off(void)
+{
+       /*
+        * NO PSCI or invalid PSCI method, we can't do shutdown, just
+        * halt the CPU.
+        */
+       if (!smcc_psci_call) {
+               uk_printd(DLVL_CRIT, "Couldn't shutdown system, HALT!\n");
+               __CPU_HALT();
+       }
+
+       smcc_psci_call(PSCI_FNID_SYSTEM_OFF, 0, 0, 0);
+}
diff --git a/plat/common/include/arm/arm64/cpu.h 
b/plat/common/include/arm/arm64/cpu.h
index ccbe21d..bfea461 100644
--- a/plat/common/include/arm/arm64/cpu.h
+++ b/plat/common/include/arm/arm64/cpu.h
@@ -117,3 +117,4 @@ int32_t smcc_psci_smc_call(uint32_t, uint64_t, uint64_t, 
uint64_t);
 /* CPU native APIs */
 void halt(void);
 void reset(void);
+void system_off(void);
-- 
2.17.1


_______________________________________________
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®.