From patchwork Mon Oct 21 15:58:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1180715 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xhDF70bjz9sPL for ; Tue, 22 Oct 2019 02:59:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 86F5FC21D8A; Mon, 21 Oct 2019 15:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3DC68C21DF9; Mon, 21 Oct 2019 15:59:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D762CC21D74; Mon, 21 Oct 2019 15:58:59 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 495DDC21E1E for ; Mon, 21 Oct 2019 15:58:56 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46xhC40pvzz1rGSM; Mon, 21 Oct 2019 17:58:56 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46xhC40HnLz1qqkC; Mon, 21 Oct 2019 17:58:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id IWQn4OZqyPmT; Mon, 21 Oct 2019 17:58:54 +0200 (CEST) X-Auth-Info: +tAU7aOoZGdZ4VogWiIGIGo60g35KR7HttZ96aR1g1U= Received: from crub.agik.hopto.org (p54833695.dip0.t-ipconnect.de [84.131.54.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 21 Oct 2019 17:58:54 +0200 (CEST) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Mon, 21 Oct 2019 17:58:51 +0200 Message-Id: <20191021155851.16483-3-agust@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191021155851.16483-1-agust@denx.de> References: <20191021155851.16483-1-agust@denx.de> Cc: uboot-imx@nxp.com Subject: [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617) and add the commit IDs to the environment. Signed-off-by: Anatolij Gustschin --- arch/arm/mach-imx/imx8/misc.c | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c index fe73e29eee..b0693358e7 100644 --- a/arch/arm/mach-imx/imx8/misc.c +++ b/arch/arm/mach-imx/imx8/misc.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate) { @@ -25,9 +28,28 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate) return 0; } +#define FSL_SIP_BUILDINFO 0xC2000003 +#define FSL_SIP_BUILDINFO_GET_COMMITHASH 0x00 +extern uint32_t _end_ofs; + +static void set_buildinfo_to_env(uint32_t scfw, uint32_t secofw, + char *mkimage, char *atf) +{ + if (!mkimage || !atf) + return; + + env_set("commit_mkimage", mkimage); + env_set("commit_atf", atf); + env_set_hex("commit_scfw", (ulong)scfw); + env_set_hex("commit_secofw", (ulong)secofw); +} + void build_info(void) { + u32 seco_build = 0, seco_commit = 0; u32 sc_build = 0, sc_commit = 0; + ulong atf_commit = 0; + char *mkimage_commit, *temp; /* Get SCFW build and commit id */ sc_misc_build_info(-1, &sc_build, &sc_commit); @@ -35,5 +57,42 @@ void build_info(void) printf("SCFW does not support build info\n"); sc_commit = 0; /* Display 0 if build info not supported */ } - printf("Build: SCFW %x\n", sc_commit); + + /* Get SECO FW build and commit id */ + sc_misc_seco_build_info(-1, &seco_build, &seco_commit); + if (!seco_build) { + debug("SECO FW does not support build info\n"); + /* Display 0 when the build info is not supported */ + seco_commit = 0; + } + + /* + * Get imx-mkimage commit id. + * The imx-mkimage puts the commit hash behind the end of u-boot.bin + */ + mkimage_commit = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs + + fdt_totalsize(gd->fdt_blob)); + temp = mkimage_commit + 8; + *temp = '\0'; + + if (strlen(mkimage_commit) == 0) { + debug("IMX-MKIMAGE does not support build info\n"); + mkimage_commit = "0"; /* Display 0 */ + } + + /* Get ARM Trusted Firmware commit id */ + atf_commit = call_imx_sip(FSL_SIP_BUILDINFO, + FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0); + if (atf_commit == 0xffffffff) { + debug("ATF does not support build info\n"); + atf_commit = 0x30; /* Display 0 */ + } + + printf("Build: SCFW %08x, SECO-FW %08x\n" + " IMX-MKIMAGE %s, ATF %s\n", + sc_commit, seco_commit, mkimage_commit, (char *)&atf_commit); + + /* Set all to env */ + set_buildinfo_to_env(sc_commit, seco_commit, mkimage_commit, + (char *)&atf_commit); }