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: 131178 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1289674edf; Fri, 9 Mar 2018 09:36:43 -0800 (PST) X-Google-Smtp-Source: AG47ELuyVCwMQ69G5DUf3oYOBcLL2tK+pYAqBPVNpibDocG+QwWo9/D5YRFntoDIAzd1ZHTX8L9I X-Received: by 10.80.218.75 with SMTP id a11mr29122018edk.74.1520617003375; Fri, 09 Mar 2018 09:36:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520617003; cv=none; d=google.com; s=arc-20160816; b=cyf16Pziw0zsuAEu6PCUXpwfVn357JiZLW4DsYHCjPvq5yIi8vqalB+VpKDny5j2IE Maes1c7bNAkg8KVNMEa7GT+D/zKR0sza5Qc1epmAWQVMmQrSplbqPw5HowkI4j7uyuWL QWMO8PiYKVx5UKkBUaB0t/VikZCJM7tJDh1NFoUMHTdHOjPJTm+nHMvmksjsf21UQZ0F h50t7PgF/o5DvcnJZwgCNdTA+ehDfDg7s0tUQml8CQc2lCc0v5rWgS3kx2C1hEYO6vfv iN8u5NKtLu01q3NknhxmvApT/2rD9qBvChdHfplkZPPfGUb68Xxs8ivE3eOsu65pE/1H 6XUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=V6rKVEoBUvRpxXqeb5UBR9xbmPlcn4Y1LuIa1jctxYo=; b=jQDo04DBcxe+mIyVP/IYfBJDDHof/FPOGiY2GyJ/gk9hdslEMMs6SUXRZdzVzXPnOS c8fetZ7ebJHRtTDZQtK0hmCfGPRZWm5Hpy1zQDB3DQ4sIi+0er48SpemCVYbWj5Mt60O DgrNo/RZ1x/8wpZBfdfqpv3N4MZQIl5b762187mE7wA8/7MP0dY9l6kp+arnXGU3+ly/ M1+GmbEABhr6Qk0vO+SET72sa1gEAdLA/KH6JCIre+pQY+oUN0Qo/iflhuPeizi9dZVb Wswu0zOFf4Y2M1mEDelgpEhb6kWBESZdxi5S46gCts9CqJ5ES5ucz2URzB/fcYQw5f2q TgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PyAwneNG; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id x9si1547357edk.118.2018.03.09.09.36.42; Fri, 09 Mar 2018 09:36:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PyAwneNG; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 446BFC21DED; Fri, 9 Mar 2018 17:36:12 +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-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 */