All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhiqiang Hou <Zhiqiang.Hou@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 4/7] ARMv8: add the sec_firmware header file
Date: Wed, 27 Apr 2016 21:39:24 +0800	[thread overview]
Message-ID: <1461764367-7760-4-git-send-email-Zhiqiang.Hou@nxp.com> (raw)
In-Reply-To: <1461764367-7760-1-git-send-email-Zhiqiang.Hou@nxp.com>

From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

The sec_firmware.h is a common header file for secure monitor
firmware under ARMv8. The common API can be added to this file,
and added APIs for secure firmware validation and getting
supported PSCI version.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V3:
 - new patch

 arch/arm/cpu/armv8/fsl-layerscape/ppa.c        | 27 +++++++++++++++++++++++++-
 arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S  | 11 +++++++++++
 arch/arm/include/asm/arch-fsl-layerscape/ppa.h |  1 +
 arch/arm/include/asm/armv8/sec_firmware.h      | 19 ++++++++++++++++++
 4 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/armv8/sec_firmware.h

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
index aa71212..3cd4d00 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
@@ -17,7 +17,7 @@
 #elif defined(CONFIG_FSL_LSCH2)
 #include <asm/arch/immap_lsch2.h>
 #endif
-#include <asm/arch/ppa.h>
+#include <asm/armv8/sec_firmware.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -161,6 +161,31 @@ static int ppa_copy_image(const char *title,
 	return 0;
 }
 
+int sec_firmware_validate(void)
+{
+	void *ppa_addr;
+
+#ifdef CONFIG_SYS_LS_PPA_FW_IN_NOR
+	ppa_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
+#else
+#error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
+#endif
+
+	return ppa_firmware_validate(ppa_addr);
+}
+
+#ifdef CONFIG_ARMV8_PSCI
+unsigned int sec_firmware_support_psci_version(void)
+{
+	unsigned int psci_ver = 0;
+
+	if (!sec_firmware_validate())
+		psci_ver = ppa_support_psci_version();
+
+	return psci_ver;
+}
+#endif
+
 int ppa_init_pre(u64 *entry)
 {
 	u64 ppa_ram_addr;
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S b/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
index 3a3bb64..1f5577b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
@@ -40,3 +40,14 @@ ENTRY(ppa_init)
         mov	x0, #0
         ret
 ENDPROC(ppa_init)
+
+#ifdef CONFIG_ARMV8_PSCI
+ENTRY(ppa_support_psci_version)
+	mov	x0, 0x84000000
+	mov	x1, 0x0
+	mov	x2, 0x0
+	mov	x3, 0x0
+	smc	#0
+	ret
+ENDPROC(ppa_support_psci_version)
+#endif
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/ppa.h b/arch/arm/include/asm/arch-fsl-layerscape/ppa.h
index f0f0d10..7b13d56 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/ppa.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/ppa.h
@@ -11,5 +11,6 @@ int ppa_init_pre(u64 *);
 int ppa_init_entry(void *);
 int ppa_init(void *, u32*, u32*);
 unsigned long ppa_get_dram_block_size(void);
+unsigned int ppa_support_psci_version(void);
 
 #endif
diff --git a/arch/arm/include/asm/armv8/sec_firmware.h b/arch/arm/include/asm/armv8/sec_firmware.h
new file mode 100644
index 0000000..a54a599
--- /dev/null
+++ b/arch/arm/include/asm/armv8/sec_firmware.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __SEC_FIRMWARE_H_
+#define __SEC_FIRMWARE_H_
+
+#ifdef CONFIG_FSL_LS_PPA
+#include <asm/arch/ppa.h>
+#endif
+
+#ifdef CONFIG_ARMV8_PSCI
+unsigned int sec_firmware_support_psci_version(void);
+#endif
+int sec_firmware_validate(void);
+
+#endif /* __SEC_FIRMWARE_H_ */
-- 
2.1.0.27.g96db324

  parent reply	other threads:[~2016-04-27 13:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 13:39 [U-Boot] [PATCH v3 1/7] armv8: fsl-layerscape: add i/d-cache enable function to enable_caches Zhiqiang Hou
2016-04-27 13:39 ` [U-Boot] [PATCH v3 2/7] ARMv8/layerscape: Add FSL PPA support Zhiqiang Hou
2016-04-27 13:39 ` [U-Boot] [PATCH v3 3/7] ARMv8/ls1043ardb: Integrate FSL PPA Zhiqiang Hou
2016-05-10 19:48   ` York Sun
2016-05-18  7:37     ` Zhiqiang Hou
2016-05-18 15:16       ` York Sun
2016-05-24  2:22         ` Zhiqiang Hou
2016-04-27 13:39 ` Zhiqiang Hou [this message]
2016-04-27 13:39 ` [U-Boot] [PATCH v3 5/7] ARMv8/PSCI: Fixup the device tree for PSCI Zhiqiang Hou
2016-04-27 13:39 ` [U-Boot] [PATCH v3 6/7] ARMv8/Layerscape: switch SMP method to spin-table when the PSCI isn't available Zhiqiang Hou
2016-05-10 19:58   ` York Sun
2016-05-19  2:35     ` Zhiqiang Hou
2016-04-27 13:39 ` [U-Boot] [PATCH v3 7/7] ARMv8/ls1043ardb: add the CONFIG_ARMV8_PSCI when PPA is enabled Zhiqiang Hou

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=1461764367-7760-4-git-send-email-Zhiqiang.Hou@nxp.com \
    --to=zhiqiang.hou@nxp.com \
    --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.