From patchwork Fri Mar 9 17:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 883867 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 (mailfrom) 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=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PyAwneNG"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zyZLG0WfNz9scC for ; Sat, 10 Mar 2018 04:36:21 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AD338C21E1B; Fri, 9 Mar 2018 17:36:13 +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=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 5E34AC21DE8; Fri, 9 Mar 2018 17:35:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11E68C21C27; Fri, 9 Mar 2018 17:35:53 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 811C3C21BE5 for ; Fri, 9 Mar 2018 17:35:52 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id e194so5295123wmd.3 for ; Fri, 09 Mar 2018 09:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=trIXgtjLMKKsSzWW8w2hJ4KDentc55md6Q93PnFEE5w=; b=PyAwneNG0g9JAKqsfESpUCzsm1SLXMRb7EmGyMhdI4tpMTuFR/3mmne10BKWvhDZMW l9MqIN7NH7J+1djq7iaNqu81lktjkvytFsVFJu7o0waIuVm4rxdZId7r0/oAUqDA9dXt RxG9iQssDi+SbiSeNFrSNYoevu/h1Pr/ek0ns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=trIXgtjLMKKsSzWW8w2hJ4KDentc55md6Q93PnFEE5w=; b=BixofuYilwQhoRT03i9M0OoiOftQA2BhRiICDJMLHwP0DaCoxGK8u/ZJ6k9GLIIf2y Jznod4SqwjS6IyxlapzJJ+onGxvJK1NJ2brYhiAOt55MdrseTi3Fq8yxtHw3KgGjZut9 a0Bx1hy2K1Blyoohor+d9keTcfxa6ApM+KO1LNWAqSZlO5pAjbBadcYB7WIUDY08ZlwA zikmyHUBNL3GRT+V7Nv9ls0d4QWNxSPTHUuRypkJheox8PtYlcoxxGo+0BGjzjbpkews 1AnLAIyhN86FS+abs4wspk0lxMf3HDQX/4WLn6wPBtAVg/SvHnJohfy5Kp/GSxgV1t1b 7ITg== X-Gm-Message-State: APf1xPCQ5Xn7+KbxKmp2WbHsMZIsqwJ7ctm+lyRjBug/ZxT6IzMakRdg OmUzx4pgU1Yj7xpgcjeCj1qyCLTFC6k= X-Google-Smtp-Source: AG47ELvDuqe2fKiwj6ZXhcMdaL36GkmWJfIaoE3Z/AjiKj2EaBvs794Khe4doBARlgvG2k/VpiJ5wg== X-Received: by 10.80.169.116 with SMTP id m49mr38259002edc.172.1520616951838; Fri, 09 Mar 2018 09:35:51 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a43sm1210126edd.6.2018.03.09.09.35.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 09:35:51 -0800 (PST) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Fri, 9 Mar 2018 17:35:46 +0000 Message-Id: <1520616949-11879-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520616949-11879-1-git-send-email-bryan.odonoghue@linaro.org> References: <1520616949-11879-1-git-send-email-bryan.odonoghue@linaro.org> Cc: breno.lima@nxp.com, fabio.estevam@nxp.com, utkarsh.gupta@nxp.com Subject: [U-Boot] [PATCH 1/4] imx: hab: Add routine to set HAB IVT address 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" This patch takes a given address applies a plus or minus offset to locate the putative address of an IVT given a non-IVT link location. It then sets hab_ivt_address to allow for further logic/scripting based on the calculated address. This routine is useful when scripting hab_auth_img calls from boot.scr. Subsequent patches will illustrate its utility in a board-port. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam Tested-by: --- arch/arm/mach-imx/hab.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index c730c8f..0c18b2e 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -341,6 +341,31 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } +/* + * This routine takes a given address and applies a plus or minus offset to that + * address. + */ +static int do_hab_get_ivt_addr(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + ulong addr; + long ivt_offset; + + if (argc < 3) + return CMD_RET_USAGE; + + if (!imx_hab_is_enabled()) + return CMD_RET_FAILURE; + + addr = simple_strtoul(argv[1], NULL, 16); + ivt_offset = simple_strtol(argv[2], NULL, 16); + addr += ivt_offset; + + env_set_hex("hab_ivt_addr", addr); + + return CMD_RET_SUCCESS; +} + U_BOOT_CMD( hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status, "display HAB status", @@ -362,6 +387,14 @@ U_BOOT_CMD( "" ); +U_BOOT_CMD( + hab_get_ivt_addr, 3, 0, do_hab_get_ivt_addr, + "determine IVT header location and store in $hab_ivt_addr", + "addr ivt_offset\n" + "addr - image hex address\n" + "ivt_offset - hex offset of IVT in the image" + ); + #endif /* !defined(CONFIG_SPL_BUILD) */ /* Get CSF Header length */