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 */ From patchwork Fri Mar 9 17:35:47 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: 131181 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1290869edf; Fri, 9 Mar 2018 09:37:52 -0800 (PST) X-Google-Smtp-Source: AG47ELuq0XehFoSd7xGWDhXICBIxy9irF4NqrEQEN3GMcfc0hI4jHHvVagqF8w4ubKkfyBckTKmU X-Received: by 10.80.196.4 with SMTP id v4mr37508856edf.293.1520617072858; Fri, 09 Mar 2018 09:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520617072; cv=none; d=google.com; s=arc-20160816; b=tKPvmVQ3KEN2tKbUld/qVzgN2t5hNO5LKhCKnD7T7Fmoopl+Cml/grNugaJplJCoia UznVNJp97/Lpv+Ra/ZnRxMjlhxvnobZvIL5Ra3rmKf8XJW2MN3xxA8ycjGTqvunjzUAW v8bvBu3+Hrx9Y3UPRjIk8UjPh0tkh+SXjan/IbOHMUXBmZcmfztef43gw47sbNwu+CnV VXLLa0Mzhqq1XdzuZzJo5nmF5VRoiyuBEKIHviqaxZgFFCU+s3NyQqnVYF2LNMjF3dxS nR3y27+MB+7CwyWSeBtOBZS87Y51bqIjvS6UjLLl01cGuZ+ZIzEWmR2IuosHEVu3SpaF li7w== 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=R67ApW8awKKFrsBCxLSiyfmvTY1NuQQW8VlbWL8R9+o=; b=JGLKJtQFkHG1Pkcz+ITwsaKAti6BgUFnA83VUqlNkuF6ak6XerAA2q3h0YnXw9kTEZ LofRgcM6qwmSyNgNINdh9jFl7MZFKh4xM+arnfYeXqli+F4AysPbPdyWj3Pelq0cVWGq iAQ5s9UrMqC6d2AHUqIx85Yi6X3qOseaRAqT9WISfsTSO8AhFOToutzAhb4fsnSmkM+M PhBw+iPECTJmUh77qxaHIQyI8prMbcmjx3blvDamrDavYhAHAOzEJE5mmK6TRD0dtcTt wL1VDG8n0diAGCcGcSHdQus0XHlEIEjH/PBTfmCDHxOTitEMP5GlOxH0oC+dYC1Ke4Lz G3lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RfPNhcny; 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 a30si1467545ede.391.2018.03.09.09.37.52; Fri, 09 Mar 2018 09:37:52 -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=RfPNhcny; 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 59F93C21DFF; Fri, 9 Mar 2018 17:36:31 +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_BLOCKED, 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 46C19C21E12; Fri, 9 Mar 2018 17:36:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C120AC21DED; Fri, 9 Mar 2018 17:35:56 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 75420C21D72 for ; Fri, 9 Mar 2018 17:35:53 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id z81so5291314wmb.4 for ; Fri, 09 Mar 2018 09:35:53 -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=xm9C/hqLPuimiZeWgFS0uuGQcvu/c0lsoy/61pZVcRA=; b=RfPNhcnyz7/sR2yJWnWmCHh68sDTYJ4LN8PS+EHllo8HTsw21rNziQwcB5vSiJ7WBA BQpkIYUtGAG0eRCTz/Bm2VKCHQdlVnBrgdsHq0IfosLJMBZaKG60u38ycmWXFdAcCbfu OkOqAG7zLb1xjIxI7x1P2BkCGgg7pTVn1cJxQ= 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=xm9C/hqLPuimiZeWgFS0uuGQcvu/c0lsoy/61pZVcRA=; b=JEyE9IBYLXw9PSaIM0ZfsAZaCYk6VARY6hKuXun6/zegwivkZlsVnUEKbKci5wxIJO KOJEX3h7/czCGDZLvzJMNjlyzSsZgIzT066bUEZ++ynOraBHhb7iwXmxeY7wiXskagqa igrfO1Z0IIMEh9mI7iHToTxRWDh6GvTg6mEkGVpujorSj+ZOj6QwC0bJ3DPm9v5r88MF rqZQY4WiG/P3xMCclVsWs6takIsG0Th7K7bjTlSbv02v7nW7Y55lt7967BAF92sdXvtJ tZc3RQqu/rkHhVR/SoAJfboAsslFzLcNP6doyroYI82/sPmqpynn5en36vrFp3Pl/cIS dEtQ== X-Gm-Message-State: APf1xPDPaTvDrsuf4n2viqDcv9UuxltwsB1MLCkJEI36YgdPLwSEqVy2 H4o4FqQ16I1BFIpG+JHI44T9tesWCxk= X-Received: by 10.80.150.2 with SMTP id y2mr36772517eda.114.1520616952811; Fri, 09 Mar 2018 09:35:52 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a43sm1210126edd.6.2018.03.09.09.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 09:35:52 -0800 (PST) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Fri, 9 Mar 2018 17:35:47 +0000 Message-Id: <1520616949-11879-3-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 2/4] imx: hab: Encase majority of header in __ASSEMBLY__ declaration 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" Subsequent patches will want to include hab.h but in doing so include it on an assembly compile path causing a range of compile errors. Fix the errors pre-emptively by encasing the majority of the declarations in hab.h inside an ifdef __ASSEMBLY__ block. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam Tested-by: --- arch/arm/include/asm/mach-imx/hab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index ce9a44d..1bebdbe 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -8,6 +8,7 @@ #ifndef __SECURE_MX6Q_H__ #define __SECURE_MX6Q_H__ +#ifndef __ASSEMBLY__ #include #include @@ -196,13 +197,14 @@ typedef void hapi_clock_init_t(void); #define HAB_CMD_SET 0xB1 /* Set command tag */ #define HAB_PAR_MID 0x01 /* MID parameter value */ -#define IVT_SIZE 0x20 -#define CSF_PAD_SIZE 0x2000 - /* ----------- end of HAB API updates ------------*/ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, uint32_t ivt_offset); bool imx_hab_is_enabled(void); +#endif /* __ASSEMBLY__ */ + +#define IVT_SIZE 0x20 +#define CSF_PAD_SIZE 0x2000 #endif From patchwork Fri Mar 9 17:35:48 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: 131184 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1291937edf; Fri, 9 Mar 2018 09:38:53 -0800 (PST) X-Google-Smtp-Source: AG47ELtSPJq4SXM6UKJxE9efSkRRT/FTmmxTM1DkwVoigZpHbTJADalqFTRF5U+tll3eHBtomBm8 X-Received: by 10.80.128.230 with SMTP id 93mr38598142edb.34.1520617133233; Fri, 09 Mar 2018 09:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520617133; cv=none; d=google.com; s=arc-20160816; b=yfn7CDNx9JR+wLZIR9ylYmHAjh3IQjG+451/peDECIw+8o/snAbcSPnHRXmj9iUa4n PB6u46Vvm1poqVoPWxH1Mo3AmSFyspRPybilHx0nS4R9i2ksuUhF8mw0JIGixNbk5/to /Pulv3XR0zijK8xMd+qhqEGiMWfAQ63Ess9GSj5PSI/9WQwb/p1XiBJr52ibMmWB1oOf eVcjBw5RhGpUBrAIvZDKOtiJJyzoBVbpEUrlw4BqbJvBqiqWXgU/2ZfLss1oEHXtEEJL 8OCLnZ9xXOY9FVj8mf7ZvI9boO9V0VMSVxdPIIOFbdXzt4+DZNsBTtXqnimlxTPKJ1+X 6yYg== 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=xw+zKAlEz9wnlZ5Pf91enb64jmByETx6ggDxyLBZzgY=; b=lSw9bp4dpbMNXCJ2sq0x4bjUz/zYWNDS2q7e52MKDXc3u3pPXzoa/E6jFeD7H380Vh xHaVzCH8biZnE1jF10QRlIrWe7ka4LgDzNzPRa2QQ2+opWYb6MwpnBIzqc1mcTskD5Wo Hqr3zpubz6vr8qIMZ01dd5jtRx5gHec7mCykIp5QV3d2U3jZp1mhQMICZdrFE993V7d8 y6s1qnhXISF+an9RYeGRDKnsWLX/NjImSLuFXEWKV4mCdUa07fexaaxj3cP7xo1Msv69 IHORDfXTRfGoYJAhgGdOCzbUNBIMJq/PZYkTD5AwS60B5TZjI542k0yQ+eVo3QhrSbJE BKew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z3s3ONw8; 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 j90si1582236edb.77.2018.03.09.09.38.52; Fri, 09 Mar 2018 09:38:53 -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=Z3s3ONw8; 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 C1826C21DD4; Fri, 9 Mar 2018 17:37:06 +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_BLOCKED, 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 2A659C21DDC; Fri, 9 Mar 2018 17:36:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D35AFC21C93; Fri, 9 Mar 2018 17:35:57 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 685D6C21DA6 for ; Fri, 9 Mar 2018 17:35:54 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id h21so5310519wmd.1 for ; Fri, 09 Mar 2018 09:35:54 -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=w23afTFoThvuSnE2sI8fbOGrI1fbdXB+VFzky0Uy0T4=; b=Z3s3ONw8mEBNXZHVsfzwJtWMOlH+xe7zbXi9QeXKuPrJkW0TISF006c27D0r0mwPtn BhYraCGyMknod8koHLLztObowwve3SUzlxVq0A3D4PXkn1yGd8pfBcPlX4ta6JsfAAeO hDAb7bljyYh9+IiinNqLZwoosqcDdK7eBicqM= 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=w23afTFoThvuSnE2sI8fbOGrI1fbdXB+VFzky0Uy0T4=; b=deCrF9PzECQ75/sh+JWrB11YWVaT1ljFishoTkXuLjeJAPuCbr2fwGVtvbf1QnavzC LAsa3BrFpVHAaLpZrTVkgFsx3an0GNh8mwGW7TrNrpt6ZHrUBQBUCEUPQMDi3Vqzs6QB ymaOuIT8wpQ11cSx9vPI7C0DF9OHhNaAZZI7kOLlWmxQ0LZmWSkafWTqu+tzhq+U5vKk C5myYqC/csdLyw0GZ6Q2TG6DGtAWKPpQuV44M+Qt22J3EjRUn/vauixshevGwOnUQVZE kzyKvRGIVgfUyCwXwbNGRRUe1mATDpPVM+vm3dJ9fmmxWjxINtr4n0boxZkuhNyYzzOe kCdQ== X-Gm-Message-State: APf1xPDssxlTkvxCdjhkk/MbAZ/9OHLWjnLEbYdW0Wj3uRAH+FySjASU Y28ByMaboom0M2YG+YeNHdAQiYgipBs= X-Received: by 10.80.152.105 with SMTP id h38mr38237277edb.150.1520616953799; Fri, 09 Mar 2018 09:35:53 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a43sm1210126edd.6.2018.03.09.09.35.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 09:35:53 -0800 (PST) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Fri, 9 Mar 2018 17:35:48 +0000 Message-Id: <1520616949-11879-4-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 3/4] imx: hab: Specify IVT padding size 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 adds IVT_PAD_SIZE at 0xC00. The IVT header is padded to this size. Defining the size explicitly makes it possible to use the define to locate the start/end of an IVT header without using magic numbers in code. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam --- arch/arm/include/asm/mach-imx/hab.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 1bebdbe..f903e3e 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -205,6 +205,7 @@ bool imx_hab_is_enabled(void); #endif /* __ASSEMBLY__ */ #define IVT_SIZE 0x20 +#define IVT_PAD_SIZE 0xC00 #define CSF_PAD_SIZE 0x2000 #endif From patchwork Fri Mar 9 17:35:49 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: 131183 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1291758edf; Fri, 9 Mar 2018 09:38:42 -0800 (PST) X-Google-Smtp-Source: AG47ELvt0xQXRh80SKgtwdAutOTrrjVNvMIraUEvuaV+2RAkpEQBR/4LhYsoDNw8+TgZNN5vJt5X X-Received: by 10.80.179.74 with SMTP id r10mr36652213edd.228.1520617121979; Fri, 09 Mar 2018 09:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520617121; cv=none; d=google.com; s=arc-20160816; b=uA2zogcFn3cDnY20QVHDMWymkGIm5rpi753OAn71K0k9FHoDLJF/gEHDS+Fcy5LVgX uUJT5xGq2vlgM6rGFK8BMwYi8c6G/QejGy+AdT/nSZbTPR8KR3SWZS1ZWDPJGU5nw7Rh qBulpuMJ8JGZZZ4zEoPTSREO+Y0lzx9AsZcxTi02E771jgkZWObpnMwGdKplwZRi0ttT /HJLK/ic0J3ky2pvo3UKE67WpPaAsaSxDdGmGIbklRv0PN078aLMLyzBkvW13f4h5PI3 37ANmlgZVE6IILp/zfvCxuLs8LMSJeokbCcSCC2yHFGh9ZiGqX4DPc8CGVCdEO/VS79N IH/g== 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=xn53AiE71pZYwQ3SKoVXBY3Zlr9xA/qMn1GqnI6qs+I=; b=P/SLRVRukMsY0J6g0Gm3Q6Lu/qcH+buXIArF3VfN1NtHWcafUb4oZBX4xDpD9QHOrS gtN5GXy8JZRLKTcvM8HCTNSbyt4ltfYR1F2LiL8or1+/CSXnnIPsCy5NYJPeHbdIXuqz vs3itzvQmwSQyq4JvUbVfWAddHkpcqoL5Q+6Tpi6qLfUmF9RV/K+244VOWFBy2asYw/T ajOR0Ju/lRLiD5FN1JgMeDFDnYJs6TjgMukocwt5odM3mtSyIGzRSqq1MOKaKdF2dy9l GrIPIGKaAwzVitxFKLPWkGxT4gKKem0X04fpYzwbxWiZpGs39N7WnSc2yDoYuoHcz44K KsqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TmslY8Xr; 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 g9si269204edn.156.2018.03.09.09.38.41; Fri, 09 Mar 2018 09:38:41 -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=TmslY8Xr; 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 9866EC21D9A; Fri, 9 Mar 2018 17:36:48 +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_BLOCKED, 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 21AB2C21BE5; Fri, 9 Mar 2018 17:36:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B9077C21E0F; Fri, 9 Mar 2018 17:35:59 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 5E356C21DEC for ; Fri, 9 Mar 2018 17:35:55 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id t6so5260418wmt.5 for ; Fri, 09 Mar 2018 09:35:55 -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=bHkg1K51w19Y1xdJqvlOpv9YPxa5QkGLS84yYqjcTsg=; b=TmslY8XrbmazZWgs/i9Ul5Z8c0iN+NKk3UgULuylLnlj9KvqCtx4fCeq157qieuyw6 m9VQfXjjzR/pvAwsnHiLPWjvcGhvl2Wr49kaD3/o6nSANxpIKfQyZvViKE7kwPn49+Xo bndJ21hY1vhq35FCxKJHD5I/o9sWHkT4QeZUQ= 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=bHkg1K51w19Y1xdJqvlOpv9YPxa5QkGLS84yYqjcTsg=; b=XEM1Wn8k+Bobk+aXUSktlGoNvMapjHYDg15MYycgLlP9vC0QzPb/Gcgkbf5DMzVqs1 /DQChpBvUj/S3FD4F86BEIFNPnPy2DVrefKGYyNKQ1f1U+NrTlbpCGH4h2Mhf3aK23kn p/JwDYXXUuYi0aDmflwet8Og4O2kI+PMi53LN1MNM37g/Mz6D+12mLwlJmYi1w1ZaqUr KUtw+VVp3lap/vh6jgd+Aids9bu2wt4s95eu6h/LO8HVIF+Sh29OVjjvP1pYv38M4p53 KuW6xaxVW4jpdtPoMCwv28ihqHz9Gzbxgb7rHW4o1QEaFM9fUoWRBKy8AZGV6m+llWah fF7g== X-Gm-Message-State: APf1xPAwK3HhTDBsK8OREQrLJLq8iUHb2FN8t/T4JvfZeapOhUZH70aV 0IKQFHvp05hPlr1LQ2PXC0c0ZWch+vY= X-Received: by 10.80.212.218 with SMTP id e26mr37917566edj.205.1520616954770; Fri, 09 Mar 2018 09:35:54 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a43sm1210126edd.6.2018.03.09.09.35.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 09:35:54 -0800 (PST) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Fri, 9 Mar 2018 17:35:49 +0000 Message-Id: <1520616949-11879-5-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 4/4] imx: hab: Provide hab_auth_img_or_fail command 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 adds hab_auth_img_or_fail() a command line function that encapsulates a common usage of authenticate and failover, namely if authenticate image fails, then drop to BootROM USB recovery mode. For secure-boot systems, this type of locked down behavior is important to ensure no unsigned images can be run. It's possible to script this logic but, when done over and over again the environment starts get very complex and repetitive, reducing that script repetition down to a command line function makes sense. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam --- arch/arm/mach-imx/hab.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 0c18b2e..61ccdeb 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -366,6 +366,22 @@ static int do_hab_get_ivt_addr(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } +static int do_authenticate_image_or_failover(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + if (!imx_hab_is_enabled()) + goto done; + + if (do_authenticate_image(NULL, flag, argc, argv) != CMD_RET_SUCCESS) { + fprintf(stderr, "authentication fail -> %s %s %s %s\n", + argv[0], argv[1], argv[2], argv[3]); + do_hab_failsafe(0, 0, 1, NULL); + }; + +done: + return CMD_RET_SUCCESS; +} + U_BOOT_CMD( hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status, "display HAB status", @@ -395,6 +411,16 @@ U_BOOT_CMD( "ivt_offset - hex offset of IVT in the image" ); +U_BOOT_CMD( + hab_auth_img_or_fail, 4, 0, + do_authenticate_image_or_failover, + "authenticate image via HAB on failure drop to USB BootROM mode", + "addr length ivt_offset\n" + "addr - image hex address\n" + "length - image hex length\n" + "ivt_offset - hex offset of IVT in the image" + ); + #endif /* !defined(CONFIG_SPL_BUILD) */ /* Get CSF Header length */