From 25a91f300578d5905029d5f44799ef71a755ff02 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Wed, 13 Oct 2021 19:04:47 +0200 Subject: [PATCH] arm64: zynqmp: Print the secure boot status information Output the secure boot configuration to the console. Signed-off-by: Jorge Ramirez-Ortiz Link: https://lore.kernel.org/r/20211013170447.10414-1-jorge@foundries.io Signed-off-by: Michal Simek --- 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 e6a3ee4a57..a70d6d611b 100644 --- a/arch/arm/mach-zynqmp/include/mach/hardware.h +++ b/arch/arm/mach-zynqmp/include/mach/hardware.h @@ -152,8 +152,12 @@ struct apu_regs { #define CSU_JTAG_CHAIN_WR_SETUP GENMASK(1, 0) #define CSU_PCAP_PROG_RELEASE_PL BIT(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[7]; u32 jtag_chain_status_wr; diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 2b5239ccb4..242e143cbf 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -373,6 +373,18 @@ static void restore_jtag(void) } #endif +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 @@ -413,6 +425,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.39.5