From patchwork Wed Oct 13 17:04:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Foundries" X-Patchwork-Id: 1540537 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=OUp5gXf2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HTzRg35M3z9sPf for ; Thu, 14 Oct 2021 04:05:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CB7148356F; Wed, 13 Oct 2021 19:04:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="OUp5gXf2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B227583763; Wed, 13 Oct 2021 19:04:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 04F918356F for ; Wed, 13 Oct 2021 19:04:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wr1-x42b.google.com with SMTP id g25so10664849wrb.2 for ; Wed, 13 Oct 2021 10:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AVSvHuVbJKN6yDz4ANdb+c7I1qD+/VHHTvjS7D+IetY=; b=OUp5gXf2vKHSZvRKizeOLQGoGkEyk0hfzpfWNyUaHxS39ojFH46SRbRx4jctLeuGzU nnYZswJx4nFi5mPvTGPR699RCtidyWZnuxkcXiKT8qRgAmMpiFWQLTDvd8rPSIt3A/Tg qrmTXRJ/32A9QrmiEsK1Kj1PVygoR0rLNzldsWERaMj5h6mGfQwbeaEFgitEzyabOAKX KePsFsu8EdNS1z8yqQ7kl5zXMsXZN1q9Q0i9QYQgu1b4EYhLZrkSbO9Y2Ak739qf0r+7 q/KINISAHFjpWTAiIUuSugObXSl2XfJByJH7rEipXsEt+vIq45XWuPnrL8KAAroZaMjo df6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AVSvHuVbJKN6yDz4ANdb+c7I1qD+/VHHTvjS7D+IetY=; b=DW0N0zW+n/2v4IieJx3OUSwFmQgDNoGiapNoQiFRyoyv3A4fVECG9f32+OwLhuuVOx OVK+mU3IPD7I6xaZkitD5PF1VbKAawvoW//YgutZvVHVMUkU/jyXBHnh2fbIURb9FCRY bs0/GUiN+ztobAkGqF4UXV5Y5ssrs2DTlJTjrTN9nhMX+WtXv7xQ5Byg+n3WusyU2/cK RLNTFDb3z/LQiBp4Fq+dLcZcADlOGA3VsYVAJjV7M9Nf98W1sHSmYlPa0NeHuHCj5hH/ +4mvkPuQJxMzPNGcerk8xRYj+iIks0g9VQfTlyv+6488XdnhozeJtxnU9UKKkuxpAfiW /ugA== X-Gm-Message-State: AOAM533C3fwGFNn0UpiA6PKoCF+fmjALok/DEzH283L8oTOosJ3E0VJt QwwpYGn6To6US4ThLCyT0by5Fg== X-Google-Smtp-Source: ABdhPJzStL83NklPpeu3rK1t5umHkKL1JiVPPfO1AuDA7HCo6Km+vpbuLrmfhe8lPwrZygAdFlkTmg== X-Received: by 2002:a1c:9892:: with SMTP id a140mr415315wme.187.1634144691604; Wed, 13 Oct 2021 10:04:51 -0700 (PDT) Received: from localhost.localdomain (60.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.60]) by smtp.gmail.com with ESMTPSA id k17sm6347962wmj.0.2021.10.13.10.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 10:04:51 -0700 (PDT) From: Jorge Ramirez-Ortiz 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 Message-Id: <20211013170447.10414-1-jorge@foundries.io> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Output the secure boot configuration to the console. Signed-off-by: Jorge Ramirez-Ortiz --- 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());