public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] arm: Add PSCI shutdown function
Date: Tue, 16 Aug 2016 21:08:47 +0200	[thread overview]
Message-ID: <1471374529-61610-4-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1471374529-61610-1-git-send-email-agraf@suse.de>

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(+)

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__ */
 
-- 
1.8.5.6

  parent reply	other threads:[~2016-08-16 19:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 19:08 [U-Boot] [PATCH 0/5] armv8: Add generic PSCI client support Alexander Graf
2016-08-16 19:08 ` [U-Boot] [PATCH 1/5] efi_loader: Allow boards to implement get_time and reset_system Alexander Graf
2016-08-18  3:44   ` Simon Glass
2016-08-18  4:49     ` Alexander Graf
2016-08-18 12:43       ` Simon Glass
2016-08-18 21:02         ` Alexander Graf
2016-08-20 23:54           ` Simon Glass
2016-10-13 14:35   ` [U-Boot] [U-Boot, " Alexander Graf
2016-08-16 19:08 ` [U-Boot] [PATCH 2/5] arm: Disable HVC PSCI calls by default Alexander Graf
2016-08-18  3:44   ` Simon Glass
2016-10-13 14:34   ` [U-Boot] [U-Boot,2/5] " Alexander Graf
2016-08-16 19:08 ` Alexander Graf [this message]
2016-08-18  3:45   ` [U-Boot] [PATCH 3/5] arm: Add PSCI shutdown function Simon Glass
2016-10-13 14:35   ` [U-Boot] [U-Boot,3/5] " Alexander Graf
2016-08-16 19:08 ` [U-Boot] [PATCH 4/5] arm: Provide common PSCI based reset handler Alexander Graf
2016-08-18  3:44   ` Simon Glass
2016-08-18  4:00     ` Alexander Graf
2016-08-18 17:58       ` Simon Glass
2016-08-19  6:36   ` Michal Simek
2016-10-13 14:34   ` [U-Boot] [U-Boot, " Alexander Graf
2016-08-16 19:08 ` [U-Boot] [PATCH 5/5] efi_loader: Add generic PSCI RTS Alexander Graf
2016-08-18  3:44   ` Simon Glass
2016-08-18  4:01     ` Alexander Graf
2016-08-18 17:58       ` Simon Glass
2016-10-13 14:35   ` [U-Boot] [U-Boot,5/5] " Alexander Graf
2016-08-19  6:42 ` [U-Boot] [PATCH 0/5] armv8: Add generic PSCI client support Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471374529-61610-4-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox