arm: Add PSCI shutdown function
authorAlexander Graf <agraf@suse.de>
Tue, 16 Aug 2016 19:08:47 +0000 (21:08 +0200)
committerAlexander Graf <agraf@suse.de>
Tue, 18 Oct 2016 07:08:08 +0000 (09:08 +0200)
Using PSCI you can not only reset the system, you can also shut it down!
This patch exposes a function to do exactly that to whatever code wants
to make use of it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/cpu/armv8/fwcall.c
arch/arm/include/asm/system.h

index 6bb68f2ed3368453b48b64743fb616c807227574..b3ef7c0f73ad44319f3b9a44983d694e719e13c9 100644 (file)
@@ -97,3 +97,18 @@ void __noreturn psci_system_reset(void)
        while (1)
                ;
 }
+
+void __noreturn psci_system_off(void)
+{
+       struct pt_regs regs;
+
+       regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_OFF;
+
+       if (use_smc_for_psci)
+               smc_call(&regs);
+       else
+               hvc_call(&regs);
+
+       while (1)
+               ;
+}
index 5166c653f342500515ea037d3369b6db869aa729..b928bd8d174c77a87593d7e47a5373542ed96f79 100644 (file)
@@ -116,6 +116,7 @@ void flush_l3_cache(void);
 void smc_call(struct pt_regs *args);
 
 void __noreturn psci_system_reset(void);
+void __noreturn psci_system_off(void);
 
 #endif /* __ASSEMBLY__ */