public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jorge Ramirez-Ortiz <jorge@foundries.io>
To: jorge@foundries.io, monstr@monstr.eu
Cc: adrian.fiergolski@fastree3d.com, sjg@chromium.org,
	ibai.erkiaga-elorza@xilinx.com, t.karthik.reddy@xilinx.com,
	u-boot@lists.denx.de, ricardo@foundries.io
Subject: [PATCHv2] arm64: zynqmp: Print the secure boot status information
Date: Wed, 13 Oct 2021 19:04:47 +0200	[thread overview]
Message-ID: <20211013170447.10414-1-jorge@foundries.io> (raw)

Output the secure boot configuration to the console.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---

 v2:
   Michal review 12 Aug 2021
     print information on SPL and UBOOT
     improve the print command
     add macros to mask the status
   
 arch/arm/mach-zynqmp/include/mach/hardware.h |  6 +++++-
 board/xilinx/zynqmp/zynqmp.c                 | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-zynqmp/include/mach/hardware.h b/arch/arm/mach-zynqmp/include/mach/hardware.h
index eebf38551c..c6b1464a9f 100644
--- a/arch/arm/mach-zynqmp/include/mach/hardware.h
+++ b/arch/arm/mach-zynqmp/include/mach/hardware.h
@@ -141,8 +141,12 @@ struct apu_regs {
 #define ZYNQMP_SILICON_VER_MASK		0xF
 #define ZYNQMP_SILICON_VER_SHIFT	0
 
+#define ZYNQMP_CSU_STATUS_AUTHENTICATED	BIT(0)
+#define ZYNQMP_CSU_STATUS_ENCRYPTED	BIT(1)
+
 struct csu_regs {
-	u32 reserved0[4];
+	u32 status;
+	u32 reserved0[3];
 	u32 multi_boot;
 	u32 reserved1[11];
 	u32 idcode;
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 000a7cde8d..3e7ca2e9c6 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -358,6 +358,18 @@ static int multi_boot(void)
 	return multiboot;
 }
 
+static void print_secure_boot(void)
+{
+	u32 status = 0;
+
+	if (zynqmp_mmio_read((ulong)&csu_base->status, &status))
+		return;
+
+	printf("Secure Boot:\t%sauthenticated, %sencrypted\n",
+	       status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ",
+	       status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not ");
+}
+
 #define PS_SYSMON_ANALOG_BUS_VAL	0x3210
 #define PS_SYSMON_ANALOG_BUS_REG	0xFFA50914
 
@@ -394,6 +406,8 @@ int board_init(void)
 	fpga_add(fpga_xilinx, &zynqmppl);
 #endif
 
+	/* display secure boot information */
+	print_secure_boot();
 	if (current_el() == 3)
 		printf("Multiboot:\t%d\n", multi_boot());
 
-- 
2.31.1


             reply	other threads:[~2021-10-13 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 17:04 Jorge Ramirez-Ortiz [this message]
2022-02-04  7:47 ` [PATCHv2] arm64: zynqmp: Print the secure boot status information Jorge Ramirez-Ortiz, Foundries
2022-02-04 12:19   ` Michal Simek
2022-02-04 22:15     ` Jorge Ramirez-Ortiz, Foundries
2022-02-04 12:18 ` 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=20211013170447.10414-1-jorge@foundries.io \
    --to=jorge@foundries.io \
    --cc=adrian.fiergolski@fastree3d.com \
    --cc=ibai.erkiaga-elorza@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=ricardo@foundries.io \
    --cc=sjg@chromium.org \
    --cc=t.karthik.reddy@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox