All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v6 5/6] armv8: fsl-layerscape: Add support for efi_loader RTS reset
Date: Wed, 19 Oct 2016 16:31:16 +0200	[thread overview]
Message-ID: <1476887477-189387-6-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1476887477-189387-1-git-send-email-agraf@suse.de>

When implementing efi loader support, we can expose runtime services
for payloads. One such service is CPU reset.

This patch implements RTS CPU reset support for layerscape systems.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: York Sun <york.sun@nxp.com>

---

v4 -> v5:

  - Use __efi_runtime tags
---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index b7a2e0c..0b516e3 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -17,6 +17,7 @@
 #ifdef CONFIG_MP
 #include <asm/arch/mp.h>
 #endif
+#include <efi_loader.h>
 #include <fm_eth.h>
 #include <fsl-mc/fsl_mc.h>
 #ifdef CONFIG_FSL_ESDHC
@@ -462,9 +463,10 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_cpu(ulong addr)
+__efi_runtime_data u32 __iomem *rstcr = (u32 *)CONFIG_SYS_FSL_RST_ADDR;
+
+void __efi_runtime reset_cpu(ulong addr)
 {
-	u32 __iomem *rstcr = (u32 *)CONFIG_SYS_FSL_RST_ADDR;
 	u32 val;
 
 	/* Raise RESET_REQ_B */
@@ -473,6 +475,33 @@ void reset_cpu(ulong addr)
 	scfg_out32(rstcr, val);
 }
 
+#ifdef CONFIG_EFI_LOADER
+
+void __efi_runtime EFIAPI efi_reset_system(
+		       enum efi_reset_type reset_type,
+		       efi_status_t reset_status,
+		       unsigned long data_size, void *reset_data)
+{
+	switch (reset_type) {
+	case EFI_RESET_COLD:
+	case EFI_RESET_WARM:
+		reset_cpu(0);
+		break;
+	case EFI_RESET_SHUTDOWN:
+		/* Nothing we can do */
+		break;
+	}
+
+	while (1) { }
+}
+
+void efi_reset_system_init(void)
+{
+       efi_add_runtime_mmio(&rstcr, sizeof(*rstcr));
+}
+
+#endif
+
 phys_size_t board_reserve_ram_top(phys_size_t ram_size)
 {
 	phys_size_t ram_top = ram_size;
-- 
1.8.5.6

  parent reply	other threads:[~2016-10-19 14:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 14:31 [U-Boot] [PATCH v6 0/6] LS2080ARDB: Enable EFI boot support Alexander Graf
2016-10-19 14:31 ` [U-Boot] [PATCH v6 1/6] ls2080: Exit dpaa only right before exiting U-Boot Alexander Graf
2016-10-19 14:31 ` [U-Boot] [PATCH v6 2/6] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
2016-10-19 14:31 ` [U-Boot] [PATCH v6 3/6] ls2080ardb: Reserve DP-DDR RAM Alexander Graf
2016-10-19 14:31 ` [U-Boot] [PATCH v6 4/6] armv8: ls2080a: Declare spin tables as reserved for efi loader Alexander Graf
2016-10-19 22:41   ` york sun
2016-10-19 14:31 ` Alexander Graf [this message]
2016-10-19 14:31 ` [U-Boot] [PATCH v6 6/6] ls2080ardb: Convert to distro boot Alexander Graf
2016-10-19 22:44   ` york sun
2016-10-20  8:36     ` Alexander Graf
2016-11-15 20:36 ` [U-Boot] [PATCH v6 0/6] LS2080ARDB: Enable EFI boot support Alexander Graf
2016-11-15 22:11   ` york sun
2016-11-15 22:20     ` Alexander Graf
2016-11-16 21:57       ` york sun
2016-11-16 22:04         ` Alexander Graf
2016-11-16 22:22         ` Alexander Graf
2016-11-16 22:29           ` york sun
2016-11-17 10:46     ` Alexander Graf
2016-11-17 16:38       ` york sun

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=1476887477-189387-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.