diff mbox

[U-Boot,3/5] arm: Add PSCI shutdown function

Message ID 1471374529-61610-4-git-send-email-agraf@suse.de
State Accepted
Commit 3ee655ed83ada67912cbbd14b6685bc0c7102553
Delegated to: Alexander Graf
Headers show

Commit Message

Alexander Graf Aug. 16, 2016, 7:08 p.m. UTC
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>
---
 arch/arm/cpu/armv8/fwcall.c   | 15 +++++++++++++++
 arch/arm/include/asm/system.h |  1 +
 2 files changed, 16 insertions(+)

Comments

Simon Glass Aug. 18, 2016, 3:45 a.m. UTC | #1
On 16 August 2016 at 13:08, Alexander Graf <agraf@suse.de> wrote:
> 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>
> ---
>  arch/arm/cpu/armv8/fwcall.c   | 15 +++++++++++++++
>  arch/arm/include/asm/system.h |  1 +
>  2 files changed, 16 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Alexander Graf Oct. 13, 2016, 2:35 p.m. UTC | #2
> 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>

Thanks, applied to
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
index 6bb68f2..b3ef7c0 100644
--- a/arch/arm/cpu/armv8/fwcall.c
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -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)
+		;
+}
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 96f3912..211b1e7 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -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__ */