From patchwork Sat Dec 30 01:08:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122968 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5314280qgn; Fri, 29 Dec 2017 17:09:41 -0800 (PST) X-Google-Smtp-Source: ACJfBouOI9RCCh42dson1IPv/qw+KpOv2SaXAw4+6Uvl89Iz32EC5sSas0oqvqRTIOdgR3vOUgaj X-Received: by 10.80.216.74 with SMTP id v10mr46771949edj.258.1514596181827; Fri, 29 Dec 2017 17:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596181; cv=none; d=google.com; s=arc-20160816; b=fR1mthaMxv1JMzHTeutSXS4f5NVdfO0x04hdkusTV4O0Q37wnykVyz7XLudLnW6yOk XK5a9nnvf+eS3S1wOfndiYAUjd0FW7Np16jr2VLOKgBrgTU6bKF9viOKBtv8kU1Vu+yv zFWP/LXMBGe0hYrbz8ESSNZb9IRs7aJuB4J+HOE3ZdYM2ICJlvahT5aCpNTLxYeAJQh9 75T/+Bm9dHVmSxEmuGh3/WmAdZS3R2DGwzDI1UeylvkmQX+qshJ+/4VZTZObswE/mlMN F8RztfU/r44zpEiqVQdyUirvZ3Wtq0W3ONDClZXu71ZADwh6bYX2HTquLBcDSQjlaWzk uT6Q== 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=HS7KCmC5EP3My/+W1w4nqOM20jbfY7ICfxQOJquCBzI=; b=zwm+2bt1kGq1v10sSpGBjYk4VuPXIR5SWQXA/596EKDbnD2gE0p9gEQ1sC+ibvhwDl 6bPHSlqymmDfF8C3xSjv/quK01rWR52Ikqy+o7UI5v3QC3lSiLeU0L4wmhaafgBVMx+F EVKBX7MRTwcxRZAN3XcrZcVt3oC56GvXYcb+npxxTWDCCV3PvTq2+mN/OHbW/a7hxZrX cLgr7atzNuxswtT4kRiwLASGLayq7JjaGCyLhYXUdX1sTLbLv4sUr7kQjDEJRfPVKfoo iL/BQGtDsKKLWK/w9VNiQOZr28ZmSG2cwD8BRdoTLbvDaFTM4y3xlEu6jAQHoBK4VMRS 9u/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IMKx0+6u; 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 r49si2667796eda.331.2017.12.29.17.09.41; Fri, 29 Dec 2017 17:09: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=IMKx0+6u; 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 6D60DC21E11; Sat, 30 Dec 2017 01:09:27 +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_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 E8D85C21DB5; Sat, 30 Dec 2017 01:09:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A37CC21D56; Sat, 30 Dec 2017 01:09:05 +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 61842C21C34 for ; Sat, 30 Dec 2017 01:09:05 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id f140so50080994wmd.2 for ; Fri, 29 Dec 2017 17:09:05 -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=3YZdInYDxFuSNZyaa3f41D9mVUQyXzcYYtPmrUIIf60=; b=IMKx0+6uTPYUMjuJmiBOSoQ/twRfGXdtLC1Et86PFeL1tFjkyt7o1Y+hnuKrDK96GZ /RkkKru98I9GC6PYiZ6rzmlbZ7GBBqRxg/VDyi9ICOLsVCUfjYI4Ya53CiqSMQ1Smatv U0IIFIMNL6qXkuimWARqAcT/lLx90fNXuIfj4= 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=3YZdInYDxFuSNZyaa3f41D9mVUQyXzcYYtPmrUIIf60=; b=rZhiQVFU+abEt+vxBoWvNRi+bQjnpu/YqJ+T+KeUQa4vk/OAKKnaNtVayGrF+SxUM7 qzp6CvNR0dCc/vT4/W1kkfhoX9g70skO5O9iNfxCwxBXEtv5a0WlDVMY7IM1EwuJI1GD 0GOHzlQUNJWn005tc9+t7G+Qw1wMUCw62RAvf07KiW5egZ4RKy515taEuIodWbS/xNlK AcjLgrgPINyxk+AqNM1cwaJENtZ0gwn5gmr5Zn3k7sTM4soQRJrm/7Qw4BBaCSKUjqgI FNBNf7DFeiw7RROTj9Vn2PyAX+cCe32nhKDIK8O0lSFOFBxmaNyOXwqzrYCpuiPvMNG4 1Ydw== X-Gm-Message-State: AKGB3mJS8M/LsLda4BQgD2aDhhDHTp2+sVRrAAt3BmTcdUBPH2qRIgws gX/rtDmkpWVY7CG+Uf4ukyU3gBhPm3s= X-Received: by 10.80.140.176 with SMTP id q45mr49195607edq.186.1514596144808; Fri, 29 Dec 2017 17:09:04 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:04 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:30 +0000 Message-Id: <1514596142-22050-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 01/25] arm: imx: hab: Make authenticate_image return int 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" Both usages of authenticate_image treat the result code as a simple binary. The command line usage of authenticate_image directly returns the result code of authenticate_image as a success/failure code. Right now when calling hab_auth_img and test the result code in a shell a passing hab_auth_img will appear to the shell as a fail. The first step in fixing this behaviour is to fix-up the result code return by authenticate_image() itself, subsequent patches fix the interpretation of authenticate_image so that zero will return CMD_RET_SUCCESS and non-zero will return CMD_RET_FAILURE. The first step is fixing the return type in authenticate_image() so do that now. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 2 +- arch/arm/mach-imx/hab.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index e0ff459..1b7a5e4 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -145,6 +145,6 @@ typedef void hapi_clock_init_t(void); /* ----------- end of HAB API updates ------------*/ -uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size); +int authenticate_image(uint32_t ddr_start, uint32_t image_size); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 02c7ae4..09892a6 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -410,7 +410,7 @@ static bool is_hab_enabled(void) return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT; } -uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size) +int authenticate_image(uint32_t ddr_start, uint32_t image_size) { uint32_t load_addr = 0; size_t bytes; From patchwork Sat Dec 30 01:08:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122970 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5316211qgn; Fri, 29 Dec 2017 17:12:26 -0800 (PST) X-Google-Smtp-Source: ACJfBot+HpF9XE4oOxAAGfU8iLGRS0YL8EzaXm5oabUPqyCX0qat8MvS/tj8U9uBYdOqJEOvJ4FG X-Received: by 10.80.205.218 with SMTP id h26mr46467576edj.157.1514596346781; Fri, 29 Dec 2017 17:12:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596346; cv=none; d=google.com; s=arc-20160816; b=JrWEs7x1D9poPd2fVnXFRevzI57Pnn+7RgCzzSlKt6e9z2sFv9R/cdKxsEclmuo5eT rUxhReuXMRTpOUTj8BvR1S3+PFCmng+M37fQoJeFhzlNf4COnVS1q49PQ7nJbye984Rz u2MiGo5p35gahdOgGvxgIpjnPjrR+7//9b+ywUY8AUwX73WmOQ6/vrSFU2nSKnlFnpkc tlBiwWoYi/vyvWuUb5oC71nSOTqYcDHX136KZRpKJyrx1KExAVeiDCjxSv5qyjQEWpby Vrv5gb/tdZ5A+k5Ueo8wDgjp25UXLUy9F0A0WAHS+qJJMw7bkItIrM3/Rrx8aLDCGyJ5 k7lg== 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=rHJ9/QY5qb5XA3eZSsVELR4G9CQd39u1ezozHIDIsGQ=; b=oef0igI2stcMUSsNZOKYNKC9ksM16JU+MuMZwxddoRy0M3pT+w2knTRxw9KyGHIWAZ HQ5WRQiK02mzw2FTMH2KhNMIU6x52ZYoBt8ShqeVhHZr/pZuCU6uIA3hzy8OgEb+EO1A 3ReTqLwZO/mez4AhZ5YHLebo9UKLjNKVZ0TFbHKbdSy5ESoaMkzaLEL146QrxTjM9XQP 3WPa9lmL0ORIjNyHV9QDxJgE3l3mKMGf0UDioU/mhcPyoZKOfLfAE5FGRAwvst9uQkhk c/OOAQhn8oaWf9Oj5kVL1Tt+nmk7WatoqiQ4warF1ksrZ/N7doldM0OUP+mu5x/vFaiK HSqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=V5jJJ3D4; 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 g3si669349edi.167.2017.12.29.17.12.26; Fri, 29 Dec 2017 17:12:26 -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=V5jJJ3D4; 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 1DBE4C21D56; Sat, 30 Dec 2017 01:09:47 +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_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 7F70AC21DAB; Sat, 30 Dec 2017 01:09:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6FCD5C21DE4; Sat, 30 Dec 2017 01:09:07 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 7D378C21C34 for ; Sat, 30 Dec 2017 01:09:06 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id r78so50730146wme.5 for ; Fri, 29 Dec 2017 17:09:06 -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=TwZ+1qIB7/yAjZU3U+qR5EWeNMJDqcVtGrJ+SK9DAU4=; b=V5jJJ3D4XRdEC7xLH+5ow3PWIo15D2wSTnTJaYNczFhkUScmK1fKSOdTh7JOgQbFtN Sg4ivCsr6SGIzH61M3UhpFf33VxKVjTvlSt124FRfjmjcJE393TNq2Pozq54O3+v2hhc xCqyTSRKdGTV0qC2F/jSspRS7DJU7dDqfQBOs= 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=TwZ+1qIB7/yAjZU3U+qR5EWeNMJDqcVtGrJ+SK9DAU4=; b=R83sVHoICV4LEKRGTUd7RWWyU9dyprGe9ns4GlaM9XzoNEDSKbmcPPk7SWCS2LM3yK bvKK9ENO8L8Pc+hGo7s4HtJ2n01LXrIOUEyS2cvnHYEOb3ipAxz9WSlfvM/nV5yqEyya 6zpmlt43/JRJP7pKFHNA6zWKKn2/TEwapYnUszaoJhreZLhkv3jOwTffatHLhd4jICgk j+m0LlL57Q+In1CkZIz0MBQDHx3o2pbl+8lhGeIyf1SxaY+/taYVcCk/NDYaVhuBhY8Y j1QN0SZdEiSo/J8QMtO5Wfn7nzv3vsBPjnqBbqUR7QbHcW9AyHSgxFhXPJvM5A3Ek7Hv yywQ== X-Gm-Message-State: AKGB3mJG+LGuyiUbmj0cW3zfTLneK4ztTrU1q8grwtJ1+0mb8VtgWqob Qg320Qcl9v/pkTMzPTibXLOupg8ERM0= X-Received: by 10.80.231.151 with SMTP id b23mr47333559edn.94.1514596145899; Fri, 29 Dec 2017 17:09:05 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:05 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:31 +0000 Message-Id: <1514596142-22050-3-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 02/25] arm: imx: hab: Fix authenticate_image result code 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" authenticate_image returns 1 for success and 0 for failure. That result code is mapped directly to the result code for the command line function hab_auth_img - which means when hab_auth_img succeeds it is returning CMD_RET_FAILURE (1) instead of CMD_RET_SUCCESS (0). This patch fixes this behaviour by making authenticate_image() return 0 for success and 1 for failure. Both users of authenticate_image() as a result have some minimal churn. The upshot is once done when hab_auth_img is called from the command line we set $? in the standard way for scripting functions to act on. Fixes: 36c1ca4d46ef ("imx: Support i.MX6 High Assurance Boot authentication") Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 9 ++++++--- arch/arm/mach-imx/spl.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 09892a6..9fe6d43 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -373,7 +373,10 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, ivt_offset = simple_strtoul(argv[2], NULL, 16); rcode = authenticate_image(addr, ivt_offset); - + if (rcode == 0) + rcode = CMD_RET_SUCCESS; + else + rcode = CMD_RET_FAILURE; return rcode; } @@ -415,7 +418,7 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) uint32_t load_addr = 0; size_t bytes; ptrdiff_t ivt_offset = 0; - int result = 0; + int result = 1; ulong start; hab_rvt_authenticate_image_t *hab_rvt_authenticate_image; hab_rvt_entry_t *hab_rvt_entry; @@ -510,7 +513,7 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) } if ((!is_hab_enabled()) || (load_addr != 0)) - result = 1; + result = 0; return result; } diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index d0d1b73..6e930b3 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -163,8 +163,8 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* HAB looks for the CSF at the end of the authenticated data therefore, * we need to subtract the size of the CSF from the actual filesize */ - if (authenticate_image(spl_image->load_addr, - spl_image->size - CONFIG_CSF_SIZE)) { + if (!authenticate_image(spl_image->load_addr, + spl_image->size - CONFIG_CSF_SIZE)) { image_entry(); } else { puts("spl: ERROR: image authentication unsuccessful\n"); From patchwork Sat Dec 30 01:08:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122975 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5321013qgn; Fri, 29 Dec 2017 17:19:38 -0800 (PST) X-Google-Smtp-Source: ACJfBotNARtGQCZI270DH7SJet+fOhaSO5B0HttWRy4GMlxgb6SBXpV1W1oG5KzXu14liQYOEhiH X-Received: by 10.80.130.36 with SMTP id 33mr48204958edf.252.1514596778188; Fri, 29 Dec 2017 17:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596778; cv=none; d=google.com; s=arc-20160816; b=fHlEAhNae65kyq3mH2fVXEbNLsBCIVcdGVSfZsQWnlUUtBscjwktYXFJTI8NxMZe8q ke242x8+WK7bnWWiAa39ihP544up+UEP97vP2sNMNvA/VTMXATtgnRxSlyh9DpOxVtRm 5s5Dox0jn/QbQz707Tfn25vtZiI3QVrCK/b4VhPdQ4wq2CG25oiv2JyqLXmbzsyIw5tu 37rUmUAsZ1d9y6bXvRhtRF6aYEZeysoy4nnCKnLNJtFmZFWI/riH6wwWDKUNCKHksyA2 D4DkW71DGXecczI3L5W5UxtF2/Q9vZhHmZt4aUhq4UuNigPZ7wbxmNakUmDd/gFQPBHx xtew== 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=/WitLXfEnpiCLqcc5cbQcLmodoRowOstK7tA67Wctsk=; b=ZIAT+c2FTYrJNlj3mkNvaBYcUVs0S0/saRVgu+tDeBf9iRyXiPgYTRN9MtR2PPNVkB 1eZxA5TUiy7fcK29PpyNoYkm/HpjiYzKzzd3PfnGnHDwMwLfEkkbsRvUza8vPK1X7QCe JFRyLZheyKT5OraOkpGynM18Aa88g8zWZjQNqG7gMf0svpMB5HlXGj9VA1m9XvfrJjnx EUcgETRL0fSzJUzxpBKHVSgbC46nsDtKqc533fF2dBCaf2JJjLXIZ6yK3v/cjgvB8/C2 BrAmi5FFAZzoD0ODV0kauXD+lVrowbfFX0pnfaynYq4yEl65labB9AmSd4u+e888RFLC E9vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ipN4jLMr; 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 m1si1823361edf.99.2017.12.29.17.19.37; Fri, 29 Dec 2017 17:19:38 -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=ipN4jLMr; 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 B81B6C21DF1; Sat, 30 Dec 2017 01:10:08 +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_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 8FE14C21DA2; Sat, 30 Dec 2017 01:09:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3343DC21DBB; Sat, 30 Dec 2017 01:09:11 +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 A47CCC21DA3 for ; Sat, 30 Dec 2017 01:09:07 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id g75so50737467wme.0 for ; Fri, 29 Dec 2017 17:09:07 -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=tEb+zxvqiXfooPFKqTTt4TM4oFUuaaywnnCJUJSankY=; b=ipN4jLMr04IkMZUSQitfilUDbGUaaNjKHNIoSDUEi7SCFytuGELaNZhzbUe5tVr2w4 h/746+yDlMOeoRbzOrdNH586LVj+D+cOv8FMXwZZ2nq9Ugl5EW9O+sTYCmkflshI3dSx WNDtg0d30n59mlcotqIOSzODHjY0doZ/uuBXE= 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=tEb+zxvqiXfooPFKqTTt4TM4oFUuaaywnnCJUJSankY=; b=Nz+XlAE/wZyM4gt2sXFxtaeqSa+HqBqXKQuEk+idtijUuKkAps+7wBxvfXsKENay/O vAItFLhvY5y0PUX0S1Awb3pZlqfczPvBUEgF2FgzxjR6FP1z4R76bkkD8lOCLJVRYCwK PbcI5g5FmM7oBG6WQkutTZoJ7enj9P7evrp0b60F3UkE7qBiLyuuxqUcGtz1C/Yo5wkC BpczbhGNFD8+THxxK9gNVnrasXsVC1+6OKW7o3cujL1V7LIhM1TYe3l+3uq3tfofamfE OM6UfraHdgCeggR2iWPI9fSc/IGitoCX+iKRjGmMI6IrGCg3bNZR4LedOFhbKo01FjyK obFQ== X-Gm-Message-State: AKGB3mILmCOOKJXmrAsAm2kJhwbkumgqVw7uvUJxPBOy7ra1mN/THM72 FaIwgmkEWoXU13uyfysKLL7MG9J1Ch8= X-Received: by 10.80.218.130 with SMTP id q2mr47670142edj.212.1514596147064; Fri, 29 Dec 2017 17:09:07 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:06 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:32 +0000 Message-Id: <1514596142-22050-4-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 03/25] arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail 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" There is no need to call is_enabled() twice in authenticate_image - it does nothing but add an additional layer of indentation. We can check for is_enabled() at the start of the function and return the result code directly. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 138 ++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 9fe6d43..6f86c02 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -428,91 +428,91 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) hab_rvt_entry = hab_rvt_entry_p; hab_rvt_exit = hab_rvt_exit_p; - if (is_hab_enabled()) { - printf("\nAuthenticate image from DDR location 0x%x...\n", - ddr_start); + if (!is_hab_enabled()) { + puts("hab fuse not enabled\n"); + return result; + } - hab_caam_clock_enable(1); + printf("\nAuthenticate image from DDR location 0x%x...\n", + ddr_start); - if (hab_rvt_entry() == HAB_SUCCESS) { - /* If not already aligned, Align to ALIGN_SIZE */ - ivt_offset = (image_size + ALIGN_SIZE - 1) & - ~(ALIGN_SIZE - 1); + hab_caam_clock_enable(1); - start = ddr_start; - bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE; + if (hab_rvt_entry() == HAB_SUCCESS) { + /* If not already aligned, Align to ALIGN_SIZE */ + ivt_offset = (image_size + ALIGN_SIZE - 1) & + ~(ALIGN_SIZE - 1); + + start = ddr_start; + bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE; #ifdef DEBUG - printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", - ivt_offset, ddr_start + ivt_offset); - puts("Dumping IVT\n"); - print_buffer(ddr_start + ivt_offset, - (void *)(ddr_start + ivt_offset), - 4, 0x8, 0); - - puts("Dumping CSF Header\n"); - print_buffer(ddr_start + ivt_offset+IVT_SIZE, - (void *)(ddr_start + ivt_offset+IVT_SIZE), - 4, 0x10, 0); + printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", + ivt_offset, ddr_start + ivt_offset); + puts("Dumping IVT\n"); + print_buffer(ddr_start + ivt_offset, + (void *)(ddr_start + ivt_offset), + 4, 0x8, 0); + + puts("Dumping CSF Header\n"); + print_buffer(ddr_start + ivt_offset + IVT_SIZE, + (void *)(ddr_start + ivt_offset + IVT_SIZE), + 4, 0x10, 0); #if !defined(CONFIG_SPL_BUILD) - get_hab_status(); + get_hab_status(); #endif - puts("\nCalling authenticate_image in ROM\n"); - printf("\tivt_offset = 0x%x\n", ivt_offset); - printf("\tstart = 0x%08lx\n", start); - printf("\tbytes = 0x%x\n", bytes); + puts("\nCalling authenticate_image in ROM\n"); + printf("\tivt_offset = 0x%x\n", ivt_offset); + printf("\tstart = 0x%08lx\n", start); + printf("\tbytes = 0x%x\n", bytes); #endif - /* - * If the MMU is enabled, we have to notify the ROM - * code, or it won't flush the caches when needed. - * This is done, by setting the "pu_irom_mmu_enabled" - * word to 1. You can find its address by looking in - * the ROM map. This is critical for - * authenticate_image(). If MMU is enabled, without - * setting this bit, authentication will fail and may - * crash. - */ - /* Check MMU enabled */ - if (is_soc_type(MXC_SOC_MX6) && get_cr() & CR_M) { - if (is_mx6dq()) { - /* - * This won't work on Rev 1.0.0 of - * i.MX6Q/D, since their ROM doesn't - * do cache flushes. don't think any - * exist, so we ignore them. - */ - if (!is_mx6dqp()) - writel(1, MX6DQ_PU_IROM_MMU_EN_VAR); - } else if (is_mx6sdl()) { - writel(1, MX6DLS_PU_IROM_MMU_EN_VAR); - } else if (is_mx6sl()) { - writel(1, MX6SL_PU_IROM_MMU_EN_VAR); - } + /* + * If the MMU is enabled, we have to notify the ROM + * code, or it won't flush the caches when needed. + * This is done, by setting the "pu_irom_mmu_enabled" + * word to 1. You can find its address by looking in + * the ROM map. This is critical for + * authenticate_image(). If MMU is enabled, without + * setting this bit, authentication will fail and may + * crash. + */ + /* Check MMU enabled */ + if (is_soc_type(MXC_SOC_MX6) && get_cr() & CR_M) { + if (is_mx6dq()) { + /* + * This won't work on Rev 1.0.0 of + * i.MX6Q/D, since their ROM doesn't + * do cache flushes. don't think any + * exist, so we ignore them. + */ + if (!is_mx6dqp()) + writel(1, MX6DQ_PU_IROM_MMU_EN_VAR); + } else if (is_mx6sdl()) { + writel(1, MX6DLS_PU_IROM_MMU_EN_VAR); + } else if (is_mx6sl()) { + writel(1, MX6SL_PU_IROM_MMU_EN_VAR); } + } - load_addr = (uint32_t)hab_rvt_authenticate_image( - HAB_CID_UBOOT, - ivt_offset, (void **)&start, - (size_t *)&bytes, NULL); - if (hab_rvt_exit() != HAB_SUCCESS) { - puts("hab exit function fail\n"); - load_addr = 0; - } - } else { - puts("hab entry function fail\n"); + load_addr = (uint32_t)hab_rvt_authenticate_image( + HAB_CID_UBOOT, + ivt_offset, (void **)&start, + (size_t *)&bytes, NULL); + if (hab_rvt_exit() != HAB_SUCCESS) { + puts("hab exit function fail\n"); + load_addr = 0; } + } else { + puts("hab entry function fail\n"); + } - hab_caam_clock_enable(0); + hab_caam_clock_enable(0); #if !defined(CONFIG_SPL_BUILD) - get_hab_status(); + get_hab_status(); #endif - } else { - puts("hab fuse not enabled\n"); - } - - if ((!is_hab_enabled()) || (load_addr != 0)) + if (load_addr != 0) result = 0; return result; From patchwork Sat Dec 30 01:08:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122971 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5317564qgn; Fri, 29 Dec 2017 17:14:24 -0800 (PST) X-Google-Smtp-Source: ACJfBotTBR9S7Bsjjooq4ErMgVAUuqUgAET9Zuz6VF3vODkPUs2n6yt+EDtlph+yBpdeqRnmj9cx X-Received: by 10.80.194.74 with SMTP id t10mr47896096edf.116.1514596464159; Fri, 29 Dec 2017 17:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596464; cv=none; d=google.com; s=arc-20160816; b=VgaFfMC40Zvbm8e1MAXlJ3VJ4SXz1qw31usndpDbt3UVwBk4visqd9iPoI3x50ciGd OJXCNcWn3esnPCKrufMYf5JL5jaVRq0TRFAPZkdPwZobGe9lGbY5G95Ibpjnp5L07EIv 8mjG8fiDAkMNBoY86OHCuMCKjDa1eb33eX3IAKdPSbX5wXpcGsC5yOia2NL5cuc+Qw/2 hSCN2KFvunVomTwQe/H36D84p/AyKfA9lp+PhuCJR2OgsLbdtJPTjmIUNmgYMliKcifS TjcS/y7OYd/1Y2hCxab1Xwb+Sf9NbF3AKRYhX6zUM8f629fhW9XesVmXwn0qnB1zrl8x +MRg== 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=ltIxGxwbriNIdsJA8E5Tn2uUeswTayfs+quuAx+dYJY=; b=L898xSNVNoKG0zmkhYSXwlKBU9BAU1TB66EM7dKSpICCiuBSGMRgXLlTnZT5QHnPu0 BY7eKuxm6gZuOxJ/lZ4PXTopfLVS6lzjks3SokBrpddCh68VACfyjPje6eBr3FcSnUtn hyt7SOZbm9RKDfL6p8TB3XBgiNqL30xsMtLfja5wknNAO5ImOhn6vEuBvgODRjxU9iiw ukzJV5H1saDfu8EklMveuSnQfkOQum3DgPpGcwTNDa4hIoCak0NZ8/CN4ECoQFb1iRLD HsXwtmfS4ScIB/QU/tTQMLS0iMM240lUKgCrfsvVYTqaA+/teOCRY/InuDcoLvO2Aya7 ef2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iYNnLQOm; 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 o59si3046105edb.232.2017.12.29.17.14.23; Fri, 29 Dec 2017 17:14:24 -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=iYNnLQOm; 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 98D60C21DDA; Sat, 30 Dec 2017 01:10:30 +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_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 B3212C21DE4; Sat, 30 Dec 2017 01:09:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 88C64C21C34; Sat, 30 Dec 2017 01:09:12 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id CD1ECC21DB2 for ; Sat, 30 Dec 2017 01:09:08 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id r78so50730200wme.5 for ; Fri, 29 Dec 2017 17:09:08 -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=EH9nAsP2R6CcqdRJVaGDdlF3b/WA9xPFI4ki25Ui41g=; b=iYNnLQOmoiiz/OQUE10bNGd9x6/LyuwuFv4HLY3VZgodzXw+7ouy+lUzBPpjjLaEVk zYA4qyR199ip1iwfhGXeRM8u2ZQUTtRAj7k0sLuWSc3QAsKObxJoBYr6pz49f+6+I45A RmCZ+DJVNXU8JVvIy0GOFiD7pBsT7M7vXDBuw= 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=EH9nAsP2R6CcqdRJVaGDdlF3b/WA9xPFI4ki25Ui41g=; b=IUNTmGBD/7ycIxpMH0+dYMmvSQiNQfzL+NmlYYo13kRBp1LKey7hi59WgFUIvHO9hw kI2ZLHYMObJou2mBVs4zxiUp5lXa6zmf9YCbBvB9KoO0fY5mS27nkb47hgNgZBNGJ4Mo cP4PM8ENZBUz05PrKmHoo3E/Lw7P67bB4FfOuqa2XFL4ibwJuGimiN36RAIzzFscrGSl R4s6nHkkm9wg+Mevs9qdaHkbNMuWIUw174/yXRcq0rNzFxdSeIvrGXs3G9E4j9fTtCgr ZPrkSHzO5AKB/eQfCMEkX8h/fX3Xga1ccbH08O4ycjQxhRtmLe6OkvBdw0MULhhB8imi Uyxw== X-Gm-Message-State: AKGB3mKHVoblvfbzy372kedn6BpoJn+btlHp7Q1MI4bVyHXalil5CNhn JYRk26k81qCSufrX1d4b2YymtdPF89k= X-Received: by 10.80.182.148 with SMTP id d20mr31705513ede.63.1514596148235; Fri, 29 Dec 2017 17:09:08 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:07 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:33 +0000 Message-Id: <1514596142-22050-5-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 04/25] arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail 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" The current code disjoins an entire block of code on hab_entry pass/fail resulting in a large chunk of authenticate_image being offset to the right. Fix this by checking hab_entry() pass/failure and exiting the function directly if in an error state. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 118 ++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 6f86c02..f878b7b 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -438,75 +438,77 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) hab_caam_clock_enable(1); - if (hab_rvt_entry() == HAB_SUCCESS) { - /* If not already aligned, Align to ALIGN_SIZE */ - ivt_offset = (image_size + ALIGN_SIZE - 1) & - ~(ALIGN_SIZE - 1); + if (hab_rvt_entry() != HAB_SUCCESS) { + puts("hab entry function fail\n"); + goto hab_caam_clock_disable; + } - start = ddr_start; - bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE; + /* If not already aligned, Align to ALIGN_SIZE */ + ivt_offset = (image_size + ALIGN_SIZE - 1) & + ~(ALIGN_SIZE - 1); + + start = ddr_start; + bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE; #ifdef DEBUG - printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", - ivt_offset, ddr_start + ivt_offset); - puts("Dumping IVT\n"); - print_buffer(ddr_start + ivt_offset, - (void *)(ddr_start + ivt_offset), - 4, 0x8, 0); - - puts("Dumping CSF Header\n"); - print_buffer(ddr_start + ivt_offset + IVT_SIZE, - (void *)(ddr_start + ivt_offset + IVT_SIZE), - 4, 0x10, 0); + printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", + ivt_offset, ddr_start + ivt_offset); + puts("Dumping IVT\n"); + print_buffer(ddr_start + ivt_offset, + (void *)(ddr_start + ivt_offset), + 4, 0x8, 0); + + puts("Dumping CSF Header\n"); + print_buffer(ddr_start + ivt_offset + IVT_SIZE, + (void *)(ddr_start + ivt_offset + IVT_SIZE), + 4, 0x10, 0); #if !defined(CONFIG_SPL_BUILD) - get_hab_status(); + get_hab_status(); #endif - puts("\nCalling authenticate_image in ROM\n"); - printf("\tivt_offset = 0x%x\n", ivt_offset); - printf("\tstart = 0x%08lx\n", start); - printf("\tbytes = 0x%x\n", bytes); + puts("\nCalling authenticate_image in ROM\n"); + printf("\tivt_offset = 0x%x\n", ivt_offset); + printf("\tstart = 0x%08lx\n", start); + printf("\tbytes = 0x%x\n", bytes); #endif - /* - * If the MMU is enabled, we have to notify the ROM - * code, or it won't flush the caches when needed. - * This is done, by setting the "pu_irom_mmu_enabled" - * word to 1. You can find its address by looking in - * the ROM map. This is critical for - * authenticate_image(). If MMU is enabled, without - * setting this bit, authentication will fail and may - * crash. - */ - /* Check MMU enabled */ - if (is_soc_type(MXC_SOC_MX6) && get_cr() & CR_M) { - if (is_mx6dq()) { - /* - * This won't work on Rev 1.0.0 of - * i.MX6Q/D, since their ROM doesn't - * do cache flushes. don't think any - * exist, so we ignore them. - */ - if (!is_mx6dqp()) - writel(1, MX6DQ_PU_IROM_MMU_EN_VAR); - } else if (is_mx6sdl()) { - writel(1, MX6DLS_PU_IROM_MMU_EN_VAR); - } else if (is_mx6sl()) { - writel(1, MX6SL_PU_IROM_MMU_EN_VAR); - } + /* + * If the MMU is enabled, we have to notify the ROM + * code, or it won't flush the caches when needed. + * This is done, by setting the "pu_irom_mmu_enabled" + * word to 1. You can find its address by looking in + * the ROM map. This is critical for + * authenticate_image(). If MMU is enabled, without + * setting this bit, authentication will fail and may + * crash. + */ + /* Check MMU enabled */ + if (is_soc_type(MXC_SOC_MX6) && get_cr() & CR_M) { + if (is_mx6dq()) { + /* + * This won't work on Rev 1.0.0 of + * i.MX6Q/D, since their ROM doesn't + * do cache flushes. don't think any + * exist, so we ignore them. + */ + if (!is_mx6dqp()) + writel(1, MX6DQ_PU_IROM_MMU_EN_VAR); + } else if (is_mx6sdl()) { + writel(1, MX6DLS_PU_IROM_MMU_EN_VAR); + } else if (is_mx6sl()) { + writel(1, MX6SL_PU_IROM_MMU_EN_VAR); } + } - load_addr = (uint32_t)hab_rvt_authenticate_image( - HAB_CID_UBOOT, - ivt_offset, (void **)&start, - (size_t *)&bytes, NULL); - if (hab_rvt_exit() != HAB_SUCCESS) { - puts("hab exit function fail\n"); - load_addr = 0; - } - } else { - puts("hab entry function fail\n"); + load_addr = (uint32_t)hab_rvt_authenticate_image( + HAB_CID_UBOOT, + ivt_offset, (void **)&start, + (size_t *)&bytes, NULL); + if (hab_rvt_exit() != HAB_SUCCESS) { + puts("hab exit function fail\n"); + load_addr = 0; } +hab_caam_clock_disable: hab_caam_clock_enable(0); #if !defined(CONFIG_SPL_BUILD) From patchwork Sat Dec 30 01:08:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122969 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5315362qgn; Fri, 29 Dec 2017 17:11:19 -0800 (PST) X-Google-Smtp-Source: ACJfBotQzPPtU4a6WZKD/SQy0agsVCzO2lYh+weKYzcbheUUGvJncjQ6tHPXOINl8bGPuRmniptR X-Received: by 10.80.245.253 with SMTP id x58mr45360724edm.132.1514596278935; Fri, 29 Dec 2017 17:11:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596278; cv=none; d=google.com; s=arc-20160816; b=k73dfvSpmeIid1rCj5E6GMfzXKx1lJnE35VfBgMLM7C0jy0++2EqK56JrohOOyZeTy eBIYFpacC6dfocx241/Sg/EqZwmxrvbJl3rcJF7m/ov8kxhenh3lzgrb+uxqroR3aee0 8ze1EkvOEKLTcGa1k4S4nuU1qd1rLPotw6v7utfPAkUiNVnz6maIpSzP+6Lw2B5lbjqe wIPdh9Y/uJCRvuzZl3gePt2Ou316sWRkqTqZtHOCAk+mKd6QYuQgqY9gQUp/7LTMb/0K k1xf2C9HcpHEHASISWW/B9RP02e6om+XxBaOOs6Ub7edSeUgbP/2z2T/9+NOJ5u51KVq TgJw== 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=ikhStahDui4p/tFfHpF7zYtX8K+0lVPEu6TRgvewZ2w=; b=Z96kgWb7wZ+WNTZcVA9f8EpF5Lk0ZfNBiLUu4DEkLKoXM1VnAHQWvAWud6EtL5o9fg 9Rxgh9OAZwCktcpZWo0XBz/uzT0/V1X0N+UEiEvtECL5i2PQC/P2U+vK/q40TocwS1wA UxCLkuE2w77Q7uEB+GveyrYu/vCLKvJn1dPDDX19VceWs9bpAT/EJCgMFzNlqkb5G+Oy ND5BIWHq70qfvZ80ZdmCs202vGChWqtN1C/19KmBQaDAYzboaiT4CgfCGogbqZOLgt0A ATqAdNOtD1kmksB5Wlq/ekWO2RcUgfN4eaUZB+OVQWyi8BGMeQ9El3YvF/Wmwf3ZgDMC 5UiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MNDz1EYT; 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 v15si5276010eda.290.2017.12.29.17.11.18; Fri, 29 Dec 2017 17:11:18 -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=MNDz1EYT; 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 705D4C21E0F; Sat, 30 Dec 2017 01:10:53 +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_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 0364FC21D5D; Sat, 30 Dec 2017 01:09:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C5ADCC21E09; Sat, 30 Dec 2017 01:09:13 +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 1B8FFC21DE4 for ; Sat, 30 Dec 2017 01:09:10 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i11so50083437wmf.4 for ; Fri, 29 Dec 2017 17:09:10 -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=5osmqO6RuGeR5rNp1YmiKz2CDqY4yTY8yMk3hzOQD9k=; b=MNDz1EYTfXwKWuxowLpsDjVlVCmMaAbHJAnyhDv/S75ov70dSWyzJcKg7rZhReTh4H tx24Jv0cBnFwDn1kvsyovsW9ROg7uztUh/1q/3pKsRFctxjg2+aNqE8kcpFq+HJwJ2GC 6DncrqPuES6GbImw5iNkp4sY2AM3ritBqx7/c= 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=5osmqO6RuGeR5rNp1YmiKz2CDqY4yTY8yMk3hzOQD9k=; b=IZJWFJRGzP8t+KlxqdhK4M5P4YCeKDuP+mxk0xk+bfFGiQncko1LFAPqrOhSsqgs5U t+4ivhO+wgO+zE4PxoFgcMe9TvPmm7JSlrkV3TJwY9G8BXuzwONdKiYOb3bs76Mhzr+1 klichAVIuq6xW9MbYWv7wURZkhz154XWmDpjVeQHrtHEmE9VFxmbpyesY6TCnRMgfOAo xj7E96hsABJgRZwpwlk5sZVHCyq7hr9pq23G1kvMNTgogNVRw5KgXfHjsj80djnlI6Bm pd32Pcyp94AScGbYoSln20pRg/y3xh1DCrZVY75XZz0qKQbePFlmNiI3h1OCpsVrSVWG pJZg== X-Gm-Message-State: AKGB3mICjvL9PSRcvmsplhaQZBd02s+sr6TqKW9sSgDmco87CFmmbUja BCza8YQlZYrelsmDzQ6RhCMZNQ4iHDI= X-Received: by 10.80.130.36 with SMTP id 33mr48176655edf.252.1514596149353; Fri, 29 Dec 2017 17:09:09 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:08 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:34 +0000 Message-Id: <1514596142-22050-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 05/25] arm: imx: hab: Move IVT_SIZE to hab.h 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" The size of the IVT header should be defined in hab.h move it there now. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 2 ++ arch/arm/mach-imx/hab.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 1b7a5e4..3c19d2e 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -143,6 +143,8 @@ typedef void hapi_clock_init_t(void); #define HAB_CID_ROM 0 /**< ROM Caller ID */ #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/ +#define IVT_SIZE 0x20 + /* ----------- end of HAB API updates ------------*/ int authenticate_image(uint32_t ddr_start, uint32_t image_size); diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index f878b7b..6367562 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -70,7 +70,6 @@ ((hab_rvt_exit_t *)HAB_RVT_EXIT) \ ) -#define IVT_SIZE 0x20 #define ALIGN_SIZE 0x1000 #define CSF_PAD_SIZE 0x2000 #define MX6DQ_PU_IROM_MMU_EN_VAR 0x009024a8 From patchwork Sat Dec 30 01:08:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122974 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5320959qgn; Fri, 29 Dec 2017 17:19:34 -0800 (PST) X-Google-Smtp-Source: ACJfBouky3KUFDPasPecIvXjcOWfiLLlCStGS0HAyYMfnzCc/kQuGUZO/JOW3GR2tIOB1FTAU1q0 X-Received: by 10.80.205.88 with SMTP id d24mr48277126edj.7.1514596774835; Fri, 29 Dec 2017 17:19:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596774; cv=none; d=google.com; s=arc-20160816; b=k224ny4qWDMD0WLLNEAf5YV+tdVvVD3i99lpX6f4vwEzzVs2Lu83NwbGGUNvfyk8Go eYJLdUYTZ0szs1sHWAwb+O+34rMNqYKsv7oyMKSSOeEFAuXm3Lj6okDDDGrQIz44tuvc xWq81+Jjjwf6ihu05KisPiDR/lNtlB5bIb4psBj7Wz+uyYGXzAVzVQDOGb3Wgl82kwU/ Y9/TQp2dA/X814L0ZdRd4dmvRtkHy0cWrR83K0L1H7OD3L0rFWVx88cxHzv2faXIm1M3 FIAmlDe+v8DAIGmDujPOBlbK6q3+yfe7A51DhmkgPuJtsVYEc4pHtSxWTML/PKW/0Zf8 O79Q== 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=4A8H0JfHSw8vHNwupD9jh0knhRyZxPcxGbEsqQUu+Aw=; b=XB36xjzhYXlvJgLgPfbDw1h6cNrOMQXWwzN1rFDzUZbe+CnzAAGpqkDOzV1C+bx5qh lQ33rT+Mry/nFeAYoMwPiIN1HDGIN4dTxVd5yE/6QN658nwnqmCZKPUlpQsMr0rcGbmd MBKpdaUPPCNr346LFc+ItVLzcRfJjqoeP1h7dpNKMRQ/0gthAR2XmyDu/aP47PwVmvG1 5H++fjKSaD3bVAUVEaZPNWa6j8m8LhOLroP6iAOqjo1aBBPbIfP3HSbY5qWjgbN+e2kc jrxOB8l3l/keF7epwjO7xLpAUmLGe9TFBG9tkRKE9BEskKqNDDPuXf2tTbaRyifhvS+Y 2z3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hRzw9mCG; 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 z17si2026662eda.152.2017.12.29.17.19.34; Fri, 29 Dec 2017 17:19:34 -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=hRzw9mCG; 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 6D353C21DBA; Sat, 30 Dec 2017 01:16:07 +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_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 C95ABC21E30; Sat, 30 Dec 2017 01:10:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63FDDC21DDD; Sat, 30 Dec 2017 01:09:14 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 36475C21D9F for ; Sat, 30 Dec 2017 01:09:11 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id r78so50730279wme.5 for ; Fri, 29 Dec 2017 17:09:11 -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=3LjNZTTYyCYseZYUKjInSqJMeBXflteglLGsqlXBjII=; b=hRzw9mCGMzWlqR0cEMnNmVmA+mdEmi/3xQildEzVKyRrSpFvKrIoD+QGuvpbYnIKf1 LMAOnTrp5keXdioeUSx6OfgvSDUfMLI+CIsg9w8eY8/0b9cpMor71DOG7d1KLzP8gTLg umzSNDKAPEJ+h7RFzLSf71xlLWgwMO/oyLNdc= 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=3LjNZTTYyCYseZYUKjInSqJMeBXflteglLGsqlXBjII=; b=I/GRKEIgS1iUntP+WBndWCedK5lg5w+OIoKv0yTqJQNXHQIyzpT1dSAIhp5TfWeo8E 0I25acyB9zqAq2tcwmgm/c62JH1Z0ZP6i+jqVQrHlO8b7/ONAvlDeDk6n1ddGd3/xQGl IDtmNQc9C4npzaR/SJjWJm6/yqtqNW7NSaA/XtejMUGpj/kf31y876FMs9ntz785czRZ kzhS3U+MF8EEOxyeZ0oUHllEFsq41iHz7+jes8I/AEj0KXChf7FoQ4/kOHUscofWnqUG lPzK1xnIu+rK+0yA0IsBchwPRVP10lPO8o8ysWEOQjR8NDd0NKgu9UCf9yoezIvZomhr vwxA== X-Gm-Message-State: AKGB3mIoZ+2A98GNXZVZGOLK6kdMsXmfnwA0FE3QKPwtDSc1R/nQV2vA YB0fqxaChbU93KsCyDguBEFv3ZfKgiw= X-Received: by 10.80.212.196 with SMTP id e4mr45682931edj.97.1514596150658; Fri, 29 Dec 2017 17:09:10 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:10 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:35 +0000 Message-Id: <1514596142-22050-7-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 06/25] arm: imx: hab: Move CSF_PAD_SIZE to hab.h 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" CSF_PAD_SIZE should be defined in hab.h, move it to that location now. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 1 + arch/arm/mach-imx/hab.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 3c19d2e..91dda42 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -144,6 +144,7 @@ typedef void hapi_clock_init_t(void); #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/ #define IVT_SIZE 0x20 +#define CSF_PAD_SIZE 0x2000 /* ----------- end of HAB API updates ------------*/ diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 6367562..039a017 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -71,7 +71,6 @@ ) #define ALIGN_SIZE 0x1000 -#define CSF_PAD_SIZE 0x2000 #define MX6DQ_PU_IROM_MMU_EN_VAR 0x009024a8 #define MX6DLS_PU_IROM_MMU_EN_VAR 0x00901dd0 #define MX6SL_PU_IROM_MMU_EN_VAR 0x00900a18 From patchwork Sat Dec 30 01:08:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122979 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5321961qgn; Fri, 29 Dec 2017 17:21:00 -0800 (PST) X-Google-Smtp-Source: ACJfBotTckQamoPRnlf3XR/xE48PawFnywd8DVd/ld0SUm8if8ibceMdpapuvy2PIDqjRnKfVIDc X-Received: by 10.80.203.13 with SMTP id g13mr47645454edi.14.1514596860529; Fri, 29 Dec 2017 17:21:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596860; cv=none; d=google.com; s=arc-20160816; b=s+wnKMlpbe6UGsiVKOvq9sG2mqakbje9MBZnsbfG8ur5yJs2C3bah+jC6khyN79Eye yEQskbNCS2/zL026ri0eChtJ2OOvcOhVTIRLwgrEOUdO5FzlOjFduY1fbg77q1ICaDz4 9WyyvZYtRXDJFTFhQc3RNhNCu7EtBi40JCEEpOSdrUsByWQYX0DEqCUvdnJ+CNLOAcPv lFTpPFpZsOIF5MZIA8jNX5CkTfnWa3+TqLQLjn/OCrwG8Rk7YgASBem5B0M9jBDN19Ji HtwJpO3TXzSmHoEXUFI2XTtDzswDDquKzsz0hhU4qBivvTEU4z7BH2wtVwiWyHl1ww7b J5tw== 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=/CFeAgyZ025Ytf/Ld84XKfOkYCNCLxgLRiwGO1exCQs=; b=PHFSxGopjt2aBRcibhZL7CMvqsmOczJakWaboIAaxt/Lk8vFOrRVSSBRsCct3ksosC Mh9g71knfi9wTapvhoQzXWizMaIKS7mUX80gaUK+Uv1JONwcheWlquPe3KFPTNpuUBus v+Et4z25NBTk27ZBZ6761tZjQTgC+S+LmDKX4L5dFxwurPttwkX+4XXmeI9Ct9Xf7pPs 5TOgX8DMEJBRPsIlwcDKhJ2IDRanJzPGUIKGsek/uX9+QHkMtbD/jxWaQrEl3Z/oHZYj HLHX2NnUNdqx7FCqhVVVeiTonkAj3CuvNEXGjvFpJzh7hUpPkEPOKQzoDrCw2GjQroSM asBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DlFhresG; 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 g32si817748edb.218.2017.12.29.17.21.00; Fri, 29 Dec 2017 17:21:00 -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=DlFhresG; 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 2B262C21E2C; Sat, 30 Dec 2017 01:17:05 +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_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 DC36EC21E79; Sat, 30 Dec 2017 01:10:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E070C21E3B; Sat, 30 Dec 2017 01:09:16 +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 7326AC21DAB for ; Sat, 30 Dec 2017 01:09:12 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id t8so50410869wmc.3 for ; Fri, 29 Dec 2017 17:09:12 -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=EvOW9AnWvFja+KH57XFeHCqYmUyZa4E60vY9BoKFZBs=; b=DlFhresGYoniRJdYkxRlxyCQkzaR7VvTYrDJk57hq/p8DSaxz3WbX1UwrUHYR2MoyF EO9UZR+yTg5KAHx7vbJbGloAgIxL3+tEDtZJFxZUKuXDBZkp3nLFROO9W8XdYLaWp1OO 1Oee89r1bdmtnuQedUdhReZlr/DbgvWoAUYF8= 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=EvOW9AnWvFja+KH57XFeHCqYmUyZa4E60vY9BoKFZBs=; b=QSlq7wt2k3cqI9OIXQgNjcgltS8PLfotUtmQchDEKoa8EPRKRICKvuF3E6NHMCLFNy uRIIinDcqkLE/5iFOF1syweb2brG5m75kbRg6lCSOquyne/UqvZei4I2PSuFgHMZp3sd oPFDVQiCHnjQN3m3q/HViDxX62Kn/W68F5zofuF9RKSNbecjjbd5R/LiP+oNxre5cLXL pjlqdYc3v8z7P+pyNXlqd7xLsah8+LkUxUVdDV6f6qZk8E+MM+Q3bKbhDvcD29JQS+Vo a66l5nqqXrttmAEU/xS27XbL6gGCUkae/dqxX1+L8rD6Nrnu2YlJO2ozQdv/uq5yFByp i3aw== X-Gm-Message-State: AKGB3mJvdglA68lgdF153VXSnB45E3fIhWHYz1qnrz6e1hGvGDJhu7fM SDWMy1/KLiGW+C2Kn2G+NsXqpUSqeA4= X-Received: by 10.80.158.15 with SMTP id z15mr46000290ede.262.1514596151822; Fri, 29 Dec 2017 17:09:11 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:11 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:36 +0000 Message-Id: <1514596142-22050-8-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 07/25] arm: imx: hab: Fix authenticate_image input parameters 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" u-boot command "hab_auth_img" tells a user that it takes - addr - image hex address - offset - hex offset of IVT in the image but in fact the callback hab_auth_img makes to authenticate_image treats the second 'offset' parameter as an image length. Furthermore existing code requires the IVT header to be appended to the end of the image which is not actually a requirement of HABv4. This patch fixes this situation by 1: Adding a new parameter to hab_auth_img - addr : image hex address - length : total length of the image - offset : offset of IVT from addr 2: Updates the existing call into authenticate_image() in arch/arm/mach-imx/spl.c:jump_to_image_no_args() to pass addr, length and IVT offset respectively. This allows then hab_auth_img to actually operate the way it was specified in the help text and should still allow existing code to work. It has the added advantage that the IVT header doesn't have to be appended to an image given to HAB - it can be prepended for example. Note prepending the IVT is what u-boot will do when making an IVT for the BootROM. It should be possible for u-boot properly authenticate images made by mkimage via HAB. This patch is the first step in making that happen subsequent patches will focus on removing hard-coded offsets to the IVT, which again is not mandated to live at the end of a .imx image. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 3 +- arch/arm/mach-imx/hab.c | 73 +++++++++++-------------------------- arch/arm/mach-imx/spl.c | 35 +++++++++++++++++- 3 files changed, 57 insertions(+), 54 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 91dda42..b2a8031 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -148,6 +148,7 @@ typedef void hapi_clock_init_t(void); /* ----------- end of HAB API updates ------------*/ -int authenticate_image(uint32_t ddr_start, uint32_t image_size); +int authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 039a017..2a40d06 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -78,37 +78,6 @@ (is_soc_type(MXC_SOC_MX7ULP) ? 0x80000000 : \ (is_soc_type(MXC_SOC_MX7) ? 0x2000000 : 0x2)) -/* - * +------------+ 0x0 (DDR_UIMAGE_START) - - * | Header | | - * +------------+ 0x40 | - * | | | - * | | | - * | | | - * | | | - * | Image Data | | - * . | | - * . | > Stuff to be authenticated ----+ - * . | | | - * | | | | - * | | | | - * +------------+ | | - * | | | | - * | Fill Data | | | - * | | | | - * +------------+ Align to ALIGN_SIZE | | - * | IVT | | | - * +------------+ + IVT_SIZE - | - * | | | - * | CSF DATA | <---------------------------------------------------------+ - * | | - * +------------+ - * | | - * | Fill Data | - * | | - * +------------+ + CSF_PAD_SIZE - */ - static bool is_hab_enabled(void); #if !defined(CONFIG_SPL_BUILD) @@ -361,20 +330,22 @@ int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, ivt_offset; + ulong addr, length, ivt_offset; int rcode = 0; - if (argc < 3) + if (argc < 4) return CMD_RET_USAGE; addr = simple_strtoul(argv[1], NULL, 16); - ivt_offset = simple_strtoul(argv[2], NULL, 16); + length = simple_strtoul(argv[2], NULL, 16); + ivt_offset = simple_strtoul(argv[3], NULL, 16); - rcode = authenticate_image(addr, ivt_offset); + rcode = authenticate_image(addr, length, ivt_offset); if (rcode == 0) rcode = CMD_RET_SUCCESS; else rcode = CMD_RET_FAILURE; + return rcode; } @@ -385,10 +356,11 @@ U_BOOT_CMD( ); U_BOOT_CMD( - hab_auth_img, 3, 0, do_authenticate_image, + hab_auth_img, 4, 0, do_authenticate_image, "authenticate image via HAB", - "addr ivt_offset\n" + "addr length ivt_offset\n" "addr - image hex address\n" + "length - image hex length\n" "ivt_offset - hex offset of IVT in the image" ); @@ -411,11 +383,12 @@ static bool is_hab_enabled(void) return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT; } -int authenticate_image(uint32_t ddr_start, uint32_t image_size) +int authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset) { uint32_t load_addr = 0; size_t bytes; - ptrdiff_t ivt_offset = 0; + uint32_t ivt_addr = 0; int result = 1; ulong start; hab_rvt_authenticate_image_t *hab_rvt_authenticate_image; @@ -441,24 +414,18 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) goto hab_caam_clock_disable; } - /* If not already aligned, Align to ALIGN_SIZE */ - ivt_offset = (image_size + ALIGN_SIZE - 1) & - ~(ALIGN_SIZE - 1); - + /* Calculate IVT address header */ + ivt_addr = ddr_start + ivt_offset; start = ddr_start; - bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE; + bytes = image_size; #ifdef DEBUG - printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", - ivt_offset, ddr_start + ivt_offset); + printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); puts("Dumping IVT\n"); - print_buffer(ddr_start + ivt_offset, - (void *)(ddr_start + ivt_offset), - 4, 0x8, 0); + print_buffer(ivt_addr, (void *)(ivt_addr), 4, 0x8, 0); puts("Dumping CSF Header\n"); - print_buffer(ddr_start + ivt_offset + IVT_SIZE, - (void *)(ddr_start + ivt_offset + IVT_SIZE), - 4, 0x10, 0); + print_buffer(ivt_addr + IVT_SIZE, (void *)(ivt_addr + IVT_SIZE), 4, + 0x10, 0); #if !defined(CONFIG_SPL_BUILD) get_hab_status(); @@ -468,6 +435,8 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size) printf("\tivt_offset = 0x%x\n", ivt_offset); printf("\tstart = 0x%08lx\n", start); printf("\tbytes = 0x%x\n", bytes); +#else + (void)ivt_addr; #endif /* * If the MMU is enabled, we have to notify the ROM diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 6e930b3..e5d0c35 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -152,9 +152,41 @@ u32 spl_boot_mode(const u32 boot_device) #if defined(CONFIG_SECURE_BOOT) +/* + * +------------+ 0x0 (DDR_UIMAGE_START) - + * | Header | | + * +------------+ 0x40 | + * | | | + * | | | + * | | | + * | | | + * | Image Data | | + * . | | + * . | > Stuff to be authenticated ----+ + * . | | | + * | | | | + * | | | | + * +------------+ | | + * | | | | + * | Fill Data | | | + * | | | | + * +------------+ Align to ALIGN_SIZE | | + * | IVT | | | + * +------------+ + IVT_SIZE - | + * | | | + * | CSF DATA | <---------------------------------------------------------+ + * | | + * +------------+ + * | | + * | Fill Data | + * | | + * +------------+ + CSF_PAD_SIZE + */ + __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { typedef void __noreturn (*image_entry_noargs_t)(void); + uint32_t offset; image_entry_noargs_t image_entry = (image_entry_noargs_t)(unsigned long)spl_image->entry_point; @@ -163,8 +195,9 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* HAB looks for the CSF at the end of the authenticated data therefore, * we need to subtract the size of the CSF from the actual filesize */ + offset = spl_image->size - CONFIG_CSF_SIZE; if (!authenticate_image(spl_image->load_addr, - spl_image->size - CONFIG_CSF_SIZE)) { + offset + IVT_SIZE + CSF_PAD_SIZE, offset)) { image_entry(); } else { puts("spl: ERROR: image authentication unsuccessful\n"); From patchwork Sat Dec 30 01:08:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122986 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325285qgn; Fri, 29 Dec 2017 17:26:03 -0800 (PST) X-Google-Smtp-Source: ACJfBovOQmnysUkVVpHydeSDQc1FUJJd0U+cQi0o6aZpHvTQeh6+jHDfM8NxMFJzb41fas3vC8kZ X-Received: by 10.80.184.52 with SMTP id j49mr6035101ede.160.1514597163116; Fri, 29 Dec 2017 17:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597163; cv=none; d=google.com; s=arc-20160816; b=A7LTNmtM5da8vqG1gJW6iO1RcumWik81YXkUKV4OuK//AtvscwigRCFaoOw0mwK8fp sqMa5y4YYAbY/GbNLvNoHbo980ezI8SsfymHbiB5W9/Qtb9Bph8OTdVlfbjL8EwEYlce 6t3hiGS0fKo8CXnIPG40MWyF1R5CupWni/ON6KI20W0u47XBox5zlMs1mf7lLu78MNwF iz0D0mEr7ERqYfumOw3Ex1csqaoqoOfViSzoQPIV0a3uj/GFAqMgcbveE2XZMHsR2VHo rwlXR8/JG/NMLOVV8z1g+2sScHv31qrc6Q2jzrqPSUPBS4vXuctibyy4lW4Z3Ck/8HlH JbsA== 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=N9cjxq1JSXJ8z95cc24viTXrcEeJuNQ7EWQtfvf+sFU=; b=tNC59i4YulZ0PI7ZhDGlF5oIiqba+AmbVqFHxjaYHCDQV1A4/poZvVrMYIE1+ulADV 8zn7C3TAH4ePtKkcvIl/pcj1sjzuT4W2p3lmZPZB/c0/jyu4JR0ZkUcdMj2g3Elo5Rrr L7rmE10cTIWpnZ4vngSsF9nLAQ3kd9o69tZKs2z9WZB2Oz8Sq8nH/OZE9WAMzuVoe8Io G9JtY8qUjeWAVfwl+ftb1h8es9eCz/G/YzWi6beFqvTChwEGtcocpZhfr8i22rXrT54e y0d6cpW05K97+kyXNJBVfjDaG7aK9bA0pDqA2M1Y3YjTroIqSeoclwiLx23O7enV3BKj qCEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PNipkj1H; 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 w1si1913518edk.223.2017.12.29.17.26.02; Fri, 29 Dec 2017 17:26:03 -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=PNipkj1H; 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 89D94C21DCA; Sat, 30 Dec 2017 01:11:56 +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_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 556F4C21E0A; Sat, 30 Dec 2017 01:09:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 642C5C21DF4; Sat, 30 Dec 2017 01:09:17 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id A069AC21DA9 for ; Sat, 30 Dec 2017 01:09:13 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id y82so6987272wmg.1 for ; Fri, 29 Dec 2017 17:09:13 -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=uTnjN80vRz9KsccagZjGfzkJcvaXHUA7tSlukwiRk1s=; b=PNipkj1H0IE8Xhzlq+8TFAlR4UzPEEqesxjUXh6SKPncqEauFzsakaZafv5j5uXBkB Nq1APxy0LCiqOu9ktPCT4wG1KKLsN0zVByR4Wzla5EVTEwLnkNEbGz9wclFK258iqnN/ Z/Vy39bfA46Sw/um0Bsxym7pNq86I/uIDglIY= 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=uTnjN80vRz9KsccagZjGfzkJcvaXHUA7tSlukwiRk1s=; b=t84+vmfd6ilsJD0E0zfBCdPzAzOJpRBF6kH0oPdKAVq5GqefpBYfT61x5nYO2JFWNP HRqT8XAYkS6q4F6StxtINsVy+zsE4X3nrrqLMsyGyHkrxrRAMw5bSBdyK5kCkhjS3iQt GMWZ5aDHymvWzQivIlB6FEAiJbZghf9hWwC1C0+yLV/soGxQj827zACXay2sQPy7klzK dZ5ffEpaZ6NnLgebIcf3he6LQHpT1wcmCpL9L/vjW4LO40dY/q6LbLNRZDIMrdEn31v0 pe9HOTLTYdcP/yN/7aIIuc5qugK51HM07aGzgcQabj9Iunw1/d6BtN8yUtj2Iiwd44Jw W45Q== X-Gm-Message-State: AKGB3mKaLn+L4aYDRqBnN+l3atc3fjtBfXZddCFyip8GPnzT9+Jl9NYu VD+X9SS/PfFTHTTQRg7Hs+HBEUx3uhs= X-Received: by 10.80.241.72 with SMTP id z8mr47866841edl.35.1514596153053; Fri, 29 Dec 2017 17:09:13 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:12 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:37 +0000 Message-Id: <1514596142-22050-9-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 08/25] arm: imx: hab: Fix authenticate image lockup on MX7 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" The i.MX6 has some pretty explicit code associated with informing the IROM about flushing caches during authenticate_image(). Looking at various pieces of documentation its pretty clear the i.MX6 IROM registers are not documented and absent similar documentation on the i.MX7 the next-best fix is to disabled the dcache while making an authenticate_image() callback. This patch therefore disables dcache temporarily while doing an IROM authenticate_image() callback, thus resolving a lockup encountered in a complex set of authenticate-image calls observed. Note there is no appreciable performance impact with dcache switched off so this fix is relatively pain-free. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 2a40d06..1d7b069 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -466,10 +466,25 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, } } + /* + * FIXME: Need to disable dcache on MX7 is there an IROM + * register like on MX6 above ? Certain images called in certain + * orders with the dcache switched on will cause + * authenticate_image() to lockup. Switching off the dcache + * resolves the issue. + * https://community.nxp.com/message/953261 + */ + if (is_soc_type(MXC_SOC_MX7)) + dcache_disable(); + load_addr = (uint32_t)hab_rvt_authenticate_image( HAB_CID_UBOOT, ivt_offset, (void **)&start, (size_t *)&bytes, NULL); + + if (is_soc_type(MXC_SOC_MX7)) + dcache_enable(); + if (hab_rvt_exit() != HAB_SUCCESS) { puts("hab exit function fail\n"); load_addr = 0; From patchwork Sat Dec 30 01:08:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122993 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5327307qgn; Fri, 29 Dec 2017 17:29:15 -0800 (PST) X-Google-Smtp-Source: ACJfBouxkROmLB8ihE3Z2NSHqO5WiF7D3cCayNa+NaNCAAmKE6tH2ulDfSrtBmAD8TlLESspd5kI X-Received: by 10.80.221.130 with SMTP id w2mr46844444edk.226.1514597355064; Fri, 29 Dec 2017 17:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597355; cv=none; d=google.com; s=arc-20160816; b=Szbuj2W1f6JEvgFe/GBpVRen3PAsOcOyeOItHr5abTYrl5KqDQmUxSkGTp+Hd2gkzn cVyvzyPjis6xSiJOWB6lmTpgIeZ0PwhwWTdF/+sYxu4KwcdjMlSrh3HE05HxeEL6UXf8 abRzpUdYgJWGdUXKQLARm8GfotM3F4se6T6lf8AHPuy9sL5ICrBX2fGR88sO9UFrw/6E s+3TM4m/2OuCFDVD6cnZuJ4JNL9IhP+PliyU4DCpPQHHdtfHMJhfy64PjSU+eWSTGS6h 9zflnZH76bg0Z1mrrE+EGWfGnqGE+vSq2mEqnMsinTBdq7QEBeP1h27XedRbIHjagCML Oh5Q== 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=wMUOic2TFDmrDvyogVjf9hvh3SaCoaZsPmQv9SLgU/M=; b=gvEuggwctuflqJ9Ih8CKeaDBcnp2MxFraauMe61a/qhmgeNDAINPRsrGYNRG5wExoJ 6ba68C/tcsnmIhJ08TPOrXWC/eVH2gIRbGVrVwn/FcDFKnbyagX2rJQhFWjbaLIHneDd NoCcIX+Cr/Kp0Yn8W9/LPsPacCv5V8bnIREuNXDI4gaJFY9j78IOCMWjWjLpVO86Uuqc 4EUqNGkUOb7X7J+cWfO+QapHG7noFW1YXz04RRjz3iX3NskU4QH64dFobg/9DmsFK5C/ bLhvppYW9aHDQKCNS/Arn/3WpFw422v/dTs10gN3WMBThPRh96wNbPE5ZxFdMld7WjtH 0ziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KECaG/jQ; 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 o91si1319744eda.349.2017.12.29.17.29.14; Fri, 29 Dec 2017 17:29:15 -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=KECaG/jQ; 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 9D809C21E08; Sat, 30 Dec 2017 01:14:53 +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_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 35E38C21DA6; Sat, 30 Dec 2017 01:10:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 659F2C21E1E; Sat, 30 Dec 2017 01:09:18 +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 BAC27C21DE8 for ; Sat, 30 Dec 2017 01:09:14 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id g75so50737664wme.0 for ; Fri, 29 Dec 2017 17:09:14 -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=W3aaLbqI/MaiX5sYMhnL4aKeCAri3WIVr9Implx4W6o=; b=KECaG/jQUo4fTJQmrkscmCGVDh6bVWqkne9qE4NtFOpLoBAUy4FmVMU4RHze9KDlpR +QS/CfT3fGXa2081jaSw90d71Wy+kyWb55KVRTTTt8SIud63lozjo+BhAr7N7FHNL1NV o3bwaQbvCvc6mPb7Gxm4hoG0KQspHHIZkXc2E= 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=W3aaLbqI/MaiX5sYMhnL4aKeCAri3WIVr9Implx4W6o=; b=dxqtt9b17vF/M2KKwArWttU0ioMRnu9A3LmTM7PfU+Q56txROaV/4BF/F/yaS+P28r G/tbO4cPOvhvwBkmas5tLL+YsFyam3lG9KyMaHMvcyZCHpZAYoI0DAYX60CCt90LTg6k Y8vfOOmeo2FUwGn7XLg8+u7W/m4Zu/Tlf1J/Uel5YS8lyLNRzU0MehlD1HbVP8HH2wBx K8GdXG3eAzMcfnIbLnfbO+W6aObNmCtLUfP/xEA2cmuz083OvbJ7zXGwgU87WsCS/LVY wtztcdxhXFhznWd0Lop7jOzHwLQXD9fPXCvs9Ks6jriK7itKNk7yo1BwmwqwQiKqFkIb adbA== X-Gm-Message-State: AKGB3mKNr5/QJRHw2qgMkNHEH7zu5UQ9fDsln0N9HmCLhYp4H1rooOpM UKkq7oeJChpVtwLTyEoPeTST8IyMGYI= X-Received: by 10.80.150.70 with SMTP id y64mr46900199eda.223.1514596154184; Fri, 29 Dec 2017 17:09:14 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:13 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:38 +0000 Message-Id: <1514596142-22050-10-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 09/25] arm: imx: hab: Add IVT header definitions 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" The various i.MX BootROMs containing the High Assurance Boot (HAB) block rely on a data structure called the Image Vector Table (IVT) to describe to the BootROM where to locate various data-structures used by HAB during authentication. This patch adds a definition of the IVT header for use in later patches, where we will break the current incorrect dependence on fixed offsets in favour of an IVT described parsing of incoming binaries. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index b2a8031..28cde38 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -10,6 +10,34 @@ #include +/* + * IVT header definitions + * Security Reference Manual for i.MX 7Dual and 7Solo Applications Processors, + * Rev. 0, 03/2017 + * Section : 6.7.1.1 + */ +#define IVT_HEADER_MAGIC 0xD1 +#define IVT_TOTAL_LENGTH 0x20 +#define IVT_HEADER_V1 0x40 +#define IVT_HEADER_V2 0x41 + +struct ivt_header { + uint8_t magic; + uint16_t length; + uint8_t version; +} __attribute__((packed)); + +struct ivt { + struct ivt_header hdr; /* IVT header above */ + uint32_t entry; /* Absolute address of first instruction */ + uint32_t reserved1; /* Reserved should be zero */ + uint32_t dcd; /* Absolute address of the image DCD */ + uint32_t boot; /* Absolute address of the boot data */ + uint32_t self; /* Absolute address of the IVT */ + uint32_t csf; /* Absolute address of the CSF */ + uint32_t reserved2; /* Reserved should be zero */ +}; + /* -------- start of HAB API updates ------------*/ /* The following are taken from HAB4 SIS */ From patchwork Sat Dec 30 01:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122973 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5318417qgn; Fri, 29 Dec 2017 17:15:42 -0800 (PST) X-Google-Smtp-Source: ACJfBos4yX7OrpQIk0PX8cI6UctVohLkHBEZeetmhO287E5fOS00e8RQ5LwmgByhMxUr39LEIAYG X-Received: by 10.80.181.33 with SMTP id y30mr47690813edd.150.1514596542485; Fri, 29 Dec 2017 17:15:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596542; cv=none; d=google.com; s=arc-20160816; b=B7EX/41WYYR4ADJvEIBgyYLRgbB/2bnouB/n9ZFlIL0bJv6YFmogufPeBAo6w7ddUz 3NY63nqhyU8R2qdaECoeIW2mfNLhx67F6ynWMjZ7e0fZ0q7s5K5nd8PDdEQjy07B1Lxd /hF1s/0lQzdKtQf582/bL8A6zcav906tGB1se6ochN6+IwRErNsFlWg2K6t1XNiYaS5w ssEuf9XMGNFf9UZA4t18zC/pxDMSRRZBm4dAZRdT373MBfpNbiyPJdQefeGBj+Ut6+Jj rl6Yjbgrs5gD4Ky+ZzqJTzKyaTI+seSp32srmzzrJQ/ISm0iZe9hKyfW63h5LgkwJdoS 9FIA== 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=A6DwTfRPSiUzXqtgXzsWZpp3nihoECQ7yhUhZrQlyq8=; b=glD0FwGFPKUo/wuUTwgtD2csIcv+oBZOFW1bmfYNqHMI85shOzPg3gPhvsCVbZ1gZG iYJX/FDQCtuEXPg3TgOMRAcJsVFs1GAO2zTl+sKZ0Rj0sRahMzvo0n3SR8ORiX+rmzG2 yP21xHVef4vxXGbXhWL6WYX4dMD1k6jrA2NTynbhR4my/QouoxXY2pEUbIecCSs/P4jv uKKc2HyuV7o3nlmzrkSafcrG5F6Lwv+7hDF0ZQGDmgBsIyGtsHWuuOk9UYms2ptRqwhJ OL3TRCjZ1prPPzC5gJ0JSi0rAVdJhDQplV0+lt3xd0rq9hUZ9ykaOokGafyt3KnsHV1b 7+sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MAby3IPl; 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 h20si985524eda.203.2017.12.29.17.15.42; Fri, 29 Dec 2017 17:15:42 -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=MAby3IPl; 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 E8E25C21DF3; Sat, 30 Dec 2017 01:13:33 +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_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 50A71C21E45; Sat, 30 Dec 2017 01:10:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4DAEEC21E48; Sat, 30 Dec 2017 01:09:19 +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 D567BC21DDD for ; Sat, 30 Dec 2017 01:09:15 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 64so50092930wme.3 for ; Fri, 29 Dec 2017 17:09:15 -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=K8jGXjHJlQG52Itin0ehjRHo3P34kiVJ1OjHqtyqcC4=; b=MAby3IPl7eOjCJl+PdIrdntZBY072Ufj2WTSdYBvNo4Yd3X3w6tMlHs2gzb2+LoKb8 +qvZnDVyVLxMc560IAjFAUBGSlXYN2Nwn24xhrjdBlbP2VRTsC3nBNtahpJKP18O/lSE BCUbJ+RKO7/3UdwZwZR5tgABIvGAzOyM5Pbjk= 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=K8jGXjHJlQG52Itin0ehjRHo3P34kiVJ1OjHqtyqcC4=; b=X0qDsDdDAL4SFizkK9CyMGNQynDbLKQn2dVxFgtiZ3UNBpcUjUmcltB4LaqcZxT2cy CPbt5nHGN570JFuG0E7J+k5eNIp96wrkC5jVtgAvi9dV3YAGD9eHkC+GFCGScLvXnBJf nxqnywcy0Bigfeh5AMM4Wkw3itX+hRLA3YpMqAGsCI+ODyhnHQskI59bAhcUj2Jfxa9O FVWjV3O9Vd56v3yJhsWkWhVoBRxA8mI4mlA2iIxh2iNz1z2HE5k/dm27dytYFS+HZzNr r4kYzzGKGkLGZIfZEfkcLYJ/sjghNJk2ddh+NZDPCy2yosYODTobe7HGJVnxo9Y7s6I0 S6BA== X-Gm-Message-State: AKGB3mIS+YNXaOFzOGdeNn2/6zqf2H9Jlf4oDBXi3VLmABi4csTkoF9M AqJLB9C+STpv+h7GbCwnIVXwvY23ZdY= X-Received: by 10.80.134.18 with SMTP id o18mr47072392edo.306.1514596155306; Fri, 29 Dec 2017 17:09:15 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:14 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:39 +0000 Message-Id: <1514596142-22050-11-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 10/25] arm: imx: hab: Add IVT header verification 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" The IVT header contains a magic number, fixed length and one of two version identifiers. Validate these settings before doing anything with a putative IVT binary. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 1d7b069..cb6214d 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -80,6 +80,31 @@ static bool is_hab_enabled(void); +static int ivt_header_error(const char *err_str, struct ivt_header *ivt_hdr) +{ + printf("%s magic=0x%x length=0x%02x version=0x%x\n", err_str, + ivt_hdr->magic, ivt_hdr->length, ivt_hdr->version); + + return 1; +} + +static int verify_ivt_header(struct ivt_header *ivt_hdr) +{ + int result = 0; + + if (ivt_hdr->magic != IVT_HEADER_MAGIC) + result = ivt_header_error("bad magic", ivt_hdr); + + if (be16_to_cpu(ivt_hdr->length) != IVT_TOTAL_LENGTH) + result = ivt_header_error("bad length", ivt_hdr); + + if (ivt_hdr->version != IVT_HEADER_V1 && + ivt_hdr->version != IVT_HEADER_V2) + result = ivt_header_error("bad version", ivt_hdr); + + return result; +} + #if !defined(CONFIG_SPL_BUILD) #define MAX_RECORD_BYTES (8*1024) /* 4 kbytes */ @@ -394,6 +419,8 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, hab_rvt_authenticate_image_t *hab_rvt_authenticate_image; hab_rvt_entry_t *hab_rvt_entry; hab_rvt_exit_t *hab_rvt_exit; + struct ivt *ivt; + struct ivt_header *ivt_hdr; hab_rvt_authenticate_image = hab_rvt_authenticate_image_p; hab_rvt_entry = hab_rvt_entry_p; @@ -416,6 +443,13 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, /* Calculate IVT address header */ ivt_addr = ddr_start + ivt_offset; + ivt = (struct ivt *)ivt_addr; + ivt_hdr = &ivt->hdr; + + /* Verify IVT header bugging out on error */ + if (verify_ivt_header(ivt_hdr)) + goto hab_caam_clock_disable; + start = ddr_start; bytes = image_size; #ifdef DEBUG @@ -435,8 +469,6 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, printf("\tivt_offset = 0x%x\n", ivt_offset); printf("\tstart = 0x%08lx\n", start); printf("\tbytes = 0x%x\n", bytes); -#else - (void)ivt_addr; #endif /* * If the MMU is enabled, we have to notify the ROM From patchwork Sat Dec 30 01:08:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122991 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5327105qgn; Fri, 29 Dec 2017 17:28:56 -0800 (PST) X-Google-Smtp-Source: ACJfBovEDnDv8Xw5T3ooVcQ7GCiUFURLkf8uoQIinadBDhYFw4IWfMVCIWVf5d3FOgbXg9jVrqw5 X-Received: by 10.80.179.39 with SMTP id q36mr46516666edd.85.1514597336096; Fri, 29 Dec 2017 17:28:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597336; cv=none; d=google.com; s=arc-20160816; b=q6h2B6BKu9aOu1vdDF/RpQCJ2J8zmiSFhaJjBbXvL9fIfG7kAwse39BZaG2FWEHHEn cMuIcYihUxH1O9XCbnazuz5YJIBShSybc8+Ujzypgp98bohI7QJRThOO0veYRRp/rNJk fFZp5Ezl2WgDPvQaQCDwOa/pLSNuCCQ9shKbmDqIf9aAfN+MpjaLw9NLYqDZzN0vap93 y2L+oAH4oTKMP22pgW5YDMwurtMCX2bukHKOR9HEB3F5GqLqlNVARYs/CyK+4XddbQNj NnVvWX0THwF/8uyaDglNi12owr8HCssLe9ZAgTNNt/KZ113g+Fml7cxcuvfLE4/vhN0F 3GGQ== 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=MMozsOA+Wk4tbzbRTQ3ojzdmn5TvblgykYvZr4MNXaI=; b=BMsR9YxxHaZZRKlpuBFuSmjsHy+S1FJ2XHteoWMBD/uOmpvjA3dj3zcrtO4OTcC86P 5rXX9xK2RTd4+eC0TdkRvmrVOd24tBfaeVs1wcD2jWru8re8tDqohHaLHs/B8wiCSPXD i7A7akOg9drmkwjxiWZNk33V+Ph/7rSgP2dOymOPnfo056tE9HexMhEF1rh41J4mFNiJ zF2GcGNFhz4rBbAc3EhYKLDSXI2GGdqyYMAxfNtej25dywVZgzeS5M29O4BuAWzMOHem 2vMheYFvy548hgW4pgPlsjJk/ubIfwXtWAWn6Pkp7aOJvnRNy9T3QZ3e0lSJijO1y0rh lAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FkTrcrhg; 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 p32si287012edp.271.2017.12.29.17.28.55; Fri, 29 Dec 2017 17:28:56 -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=FkTrcrhg; 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 B654FC21DA0; Sat, 30 Dec 2017 01:12:57 +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_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 5C74DC21E2C; Sat, 30 Dec 2017 01:10:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BA095C21DCE; Sat, 30 Dec 2017 01:09:21 +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 04899C21DA6 for ; Sat, 30 Dec 2017 01:09:17 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id t8so50410998wmc.3 for ; Fri, 29 Dec 2017 17:09:17 -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=G8z/3TFmKGvjjpDslWr0bG7tKU0tOafBwtE3humwEZA=; b=FkTrcrhgc2CWLhvyOYb8FudOc3SSK8a48baM2hUlUJi/9nddNrPbgwQqW2APEhN7rQ PH5auSrAQdBvEs/bnQYAYRbDX8m9El2YjtcEkTbUYulM8giggpJhf49bOLAanaM8HmdU E9sAJ0g5w0Qkr3hAxAMuEohwJjK5oBP/sGsVU= 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=G8z/3TFmKGvjjpDslWr0bG7tKU0tOafBwtE3humwEZA=; b=rq0ljaWJCyV553h1xtWOR5V2A4fEv+bH+4W20+XM0XD7OnTdqLmMfXrKLjOUwVfLH0 kXppWEUQh1kgYTewvr6Jp5yhQth0WdBOjzaqJDxXkPQEzkA7OumO83ap6YC6Iy5r4U9n HRT4AM+2AJnp+47gDusDzoE5a6VU1APt2ZcByElhyBsWqovCxtPkUqSqcXb1VcEBHHGg 2eHNHDpIKa9K95WLMgXhfc7ot2BA55NORyexlWI2Aq6QiqSou3BhYcTSM+Cf55snAARJ nLzIz3HZnXcY/sTkmLSaOubejQVmcy6aoZLvemELUFIZoTgm5Tm1oQW2QJd3mDMHjAIS oxIg== X-Gm-Message-State: AKGB3mJqelFZps2HdWdn9hokzhj5dknXER+rkull5Vw+JYw8DaR0yfdn wILmKwHdR8feJAe3cboXcnX+meywcII= X-Received: by 10.80.186.18 with SMTP id g18mr47608572edc.206.1514596156447; Fri, 29 Dec 2017 17:09:16 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:15 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:40 +0000 Message-Id: <1514596142-22050-12-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 11/25] arm: imx: hab: Verify IVT self matches calculated 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" The IVT is a self-describing structure which contains a self field. The self field is the absolute physical base address the IVT ought to be at in memory. Use the IVT self field to validate the calculated ivt_addr bugging out if the two values differ. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index cb6214d..479ed96 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -450,6 +450,13 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, if (verify_ivt_header(ivt_hdr)) goto hab_caam_clock_disable; + /* Verify IVT body */ + if (ivt->self != ivt_addr) { + printf("ivt->self 0x%08x pointer is 0x%08x\n", + ivt->self, ivt_addr); + goto hab_caam_clock_disable; + } + start = ddr_start; bytes = image_size; #ifdef DEBUG From patchwork Sat Dec 30 01:08:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122999 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5330275qgn; Fri, 29 Dec 2017 17:33:12 -0800 (PST) X-Google-Smtp-Source: ACJfBovZsw+0dqbJmVIfJ6a9cqmYT20ZALAnYLfrOHGetYJOvB/yTIGnmugi0hjcRDyhK90uLlk7 X-Received: by 10.80.140.176 with SMTP id q45mr49260996edq.186.1514597591935; Fri, 29 Dec 2017 17:33:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597591; cv=none; d=google.com; s=arc-20160816; b=P9O5HF95N5NzTUCQrqUXhLxwOEgf8ADofqUg2QWn55zRUfswC0be9wy2cnadZJr6hM SOgkk/lWHfMNIGJsxileYons7MGvKTCNMTbR6ne0Yl8HNPz238cXuv0zzMzik82qPhRV M14dsmTfDBjjdoV9VFVpdp+7WLD8awx4Tan6pl2hQbBX9pM+vBECray94qU7VS+XLV2A ktHXpOwbcGVJehsSfCfJ1svp6vytbzYh3Y+Qr26QnOupP3UaIxBIK4Qi5zef6OntjUor UvI5JGVcS9L+7Q0F0PohUxiUO9vErJwgnJRWHduqWo3AS0aevrMgsjtScwGEWC4gQYbS 7uEw== 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=/nuRl1OWXVRLCB+e7CucV1h9jwvZTNBoRIy+/w0y9DY=; b=Z7xTxQZL3wZ4wU5tfXzrPu7oiZTNNda/uOuLRP8eGILcQ0sjC77a4IducfE5A6KINK 0WSUjFjohfHd4ZbheDA9zfxUcPGezlDqh/u6qRmkFmZjARB4vDOWIiUGPxjDpQL70qjR JjFZv1x+yeHcNXb7ypGNxjT+tIc1Epn+8QxEKlt2PE4k2Z39lvQwETgJL+YOLMNlHsNA bglAIDfz2bMcCa2g5wnrjcifID5rTv3MUWX70V+e2dIgSBi/qZRJW32OqEbL7PLsvK2e VUaIZHqM/UA+cJVGNl4A97hjFZTMjbYD26fn/8wuirXIkPMuBZeP0xdsdEalxhBRmvfm nfog== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Qu7Z1B3p; 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 r5si2524952edk.250.2017.12.29.17.33.11; Fri, 29 Dec 2017 17:33:11 -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=Qu7Z1B3p; 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 805DFC21D56; Sat, 30 Dec 2017 01:16:44 +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_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 06534C21E5D; Sat, 30 Dec 2017 01:10:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E2635C21E6C; Sat, 30 Dec 2017 01:09:21 +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 3DC1AC21D5D for ; Sat, 30 Dec 2017 01:09:18 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f206so50070730wmf.5 for ; Fri, 29 Dec 2017 17:09:18 -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=VtAGfiyk5udAW3m0qZRtOhS7+D+O3xb/XNtkhm1fVxU=; b=Qu7Z1B3p6q9Q+muWUqHXocDIYZj4Du1nLp6sb5jMaEaHI5ANdc6hsapuiIgeXNEZK3 TXn8Q0u5T9k5+2Ocx8W1g5oU1gAxEUED/v/mDaTpzxOJQI26Z2wM1EgRrKYP5bhKFnfl /RRYIRMY386qZzofoX841zD8VzLoGjBBd5Wuc= 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=VtAGfiyk5udAW3m0qZRtOhS7+D+O3xb/XNtkhm1fVxU=; b=c36r+IrcFk+C9l//Hp+1W1W+kcR7bKpeK8Fr+It3/+m8wlrUhspPaboxNyVgNXmVRn nQdtFJloOie2QhOEZbDehtJ2aEwp1XAFaaEoJsSvCeTVDfPZ11zhEEcx/jAWmVCrAOJL NgjjECPO9DX4NUw/O5Ya9RdiDu3dZSYC1gR2T0c8SNqP1zy5JcIOpaZ/U5LWnQ2G+G7A vowBEAuVa3mKOSYoddL2QEjKbfocwgjCCl7PQVU/LhTnflAszHMACN3otOY9nQxNcTDE RiHP8WSBlXZMdHUrskoJ6m5Mn4vl/GMk/IV8LuHCvMSU62YPbe0Ib0tIBTZ/O031t1YF RI5g== X-Gm-Message-State: AKGB3mI+4sry28rLYlD9WuhAH/V0icMH4hNxBeWlmNuQ0fJyyTD/LiK5 0Xhs99qgO8927lQYugCtvCHjjm18rQ0= X-Received: by 10.80.153.210 with SMTP id n18mr48378346edb.281.1514596157680; Fri, 29 Dec 2017 17:09:17 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:16 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:41 +0000 Message-Id: <1514596142-22050-13-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 12/25] arm: imx: hab: Only call ROM once headers are verified 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" Previous patches added IVT header verification steps. We shouldn't call hab_rvt_entry() until we have done the basic header verification steps. This patch changes the time we make the hab_rvt_entry() call so that it only takes place if we are happy with the IVT header sanity checks. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 479ed96..e325d1f 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -436,11 +436,6 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, hab_caam_clock_enable(1); - if (hab_rvt_entry() != HAB_SUCCESS) { - puts("hab entry function fail\n"); - goto hab_caam_clock_disable; - } - /* Calculate IVT address header */ ivt_addr = ddr_start + ivt_offset; ivt = (struct ivt *)ivt_addr; @@ -459,6 +454,12 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, start = ddr_start; bytes = image_size; + + if (hab_rvt_entry() != HAB_SUCCESS) { + puts("hab entry function fail\n"); + goto hab_caam_clock_disable; + } + #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); puts("Dumping IVT\n"); From patchwork Sat Dec 30 01:08:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122982 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5322291qgn; Fri, 29 Dec 2017 17:21:34 -0800 (PST) X-Google-Smtp-Source: ACJfBovrSKNg+hZcVOqi4Py2h/UD6xbfDrhTictvG2GvYrn7ZOWK2bramT2RtwWjLJzquvLjPODH X-Received: by 10.80.148.124 with SMTP id q57mr48153146eda.300.1514596894276; Fri, 29 Dec 2017 17:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596894; cv=none; d=google.com; s=arc-20160816; b=HXvQ6hplAFVoltdYr+o3zaNZjD3P/xnOCbUu1biOSqXUSJ/+UhB+yoJbGxQjqeImTE e9k2N9wouUdK482DCorLlfxuh75Ah1SPGyLREFl7DGgG/6U4o8DIToKg95qrNTEc6fC7 XHXkk7tGM1Akcyc3ywGh8e1kj0ZQQXAI02s/Do8k+ZOo6tLdO0tClNjvafgpFq1N0Br4 JZFl4GqIYnUbwAOyMLQwu6MLCwdIHrY3uC9xlHJQzgFUTZc+EGP7l/pOTrj2rrXsOWsf mNjjKiKXrLnR8EAOORVUpOEQVCOaEl+7UYOiQ3MBUwK/9/+Ap5UpyQUbohW2Ikb4opz0 skZQ== 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=jHtHebsiNpBRqzRYF81BeuG0MgMzhA4WgV9xEwynxzE=; b=hfQHBAjCWlnoxK4of1T4qhFP5plFBrUSUC5WyV2NPhGj2C9jp0STCDz8Rxw03d7P91 m79mCTQC3qNZAa8ehOFcHwsC7znSvIhBvz6l68cD7zXa/0D+4VINa9Qi+j4KfT4XTAhV DQ4fYvs70dZQIRgSzJHFy3545GQ2jDYDD8DkiK9XuZXDsddkuBeAwncw2ynHfKbjhais +enMeA2ECwtvMXsy//NF/6MsGf51rvfpCe5375/1gRnFJTZEverz5U5mrbS/C8r4blA3 sYlcuufM6psXIIXxhDPMY+Pr8+7XIZaVsB6OCWh/eqYnJLVZpXMme45lMe+AveuD3Ns1 6gVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=K4i+hHxR; 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 u16si5390210edb.197.2017.12.29.17.21.34; Fri, 29 Dec 2017 17:21:34 -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=K4i+hHxR; 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 E2C46C21E48; Sat, 30 Dec 2017 01:13:52 +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_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 BCEEAC21E40; Sat, 30 Dec 2017 01:10:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EFBC3C21DED; Sat, 30 Dec 2017 01:09:23 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 6B379C21E09 for ; Sat, 30 Dec 2017 01:09:19 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id b76so50406160wmg.1 for ; Fri, 29 Dec 2017 17:09:19 -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=S3SrDJNFoijmSNw7esnWrnUgt812fxI6TA50eaO4ryM=; b=K4i+hHxRyOQQbaO7weLDzO7h3F86N3MpkansVAQsTOwj1bAveMhN+4qFnPXltimOA0 4PsRuqWHERL23u6gothoa6RJZtncC8fW8UTtgrwwfC10+v6VgH7ICqFBW2+7Z31UISJi rjyTGFARLTrCcjwuPrYf1QnwvI/l0OlvvUS3c= 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=S3SrDJNFoijmSNw7esnWrnUgt812fxI6TA50eaO4ryM=; b=S+9E4hQUq44B/l2bPPaxW+L24qjzcGUxhkPnrV2e3FAKSotSDTwS6uk1vidM1qGCqE 8doYmeRiQr/BENx43gNjG6MuQVdS7bpI/IxbUMaGsOPlLj+Ie0VV5UGC00ibpgqW+/6+ E3fNwgwAKN1JEZU0kjbuyqAh1/kBUojPuZ3Z75AElS6Wd/msssZ4XjOAlj6NSQpjckk7 9cTjvuds1DN1yaI8XQT+e4ZkhemBQ5aN0VvWfj3x5gusV81hFbFw2X34cYor2ku8LpcE JXWdI01xISE5n0ZIn58anPUpOWl7HThipHh/7t62lL0qJDennIWfVcl1VbGweR+iATuY gv1A== X-Gm-Message-State: AKGB3mKalzBH19vPDe1iTHXvftI6LssSF/ES/KtUcQ0+jtS0HfdNU4Hv ObAJJl0m7IIziN85Qf+4aYem5HlqI1U= X-Received: by 10.80.177.1 with SMTP id k1mr47419463edd.41.1514596158865; Fri, 29 Dec 2017 17:09:18 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:18 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:42 +0000 Message-Id: <1514596142-22050-14-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 13/25] arm: imx: hab: Print CSF based on IVT descriptor 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" The IVT gives the absolute address of the CSF. There is no requirement for the CSF to be located adjacent to the IVT so lets use the address provided in the IVT header instead of the hard-coded fixed CSF offset currently in place. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index e325d1f..f9b8cb7 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -466,8 +466,7 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, print_buffer(ivt_addr, (void *)(ivt_addr), 4, 0x8, 0); puts("Dumping CSF Header\n"); - print_buffer(ivt_addr + IVT_SIZE, (void *)(ivt_addr + IVT_SIZE), 4, - 0x10, 0); + print_buffer(ivt->csf, (void *)(ivt->csf), 4, 0x10, 0); #if !defined(CONFIG_SPL_BUILD) get_hab_status(); From patchwork Sat Dec 30 01:08:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122981 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5322269qgn; Fri, 29 Dec 2017 17:21:32 -0800 (PST) X-Google-Smtp-Source: ACJfBov5fjPWqsFFdKEoHmGwNMxogOTBSFm4LIR4oss/7YTQfvdsYlDBB2VvKbJ/fwpjfbNiFMfb X-Received: by 10.80.204.72 with SMTP id n8mr45986570edi.64.1514596892683; Fri, 29 Dec 2017 17:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596892; cv=none; d=google.com; s=arc-20160816; b=s40HbmdW4H8MWPJZsRTzrQDVloygbuOHWGltPOEAEimPXz/ye4mM0kb8UfQNQ7lXWG omH4jahDTm7w85O7H+mcj+APvu656vy26Kv8PeyqkLB/8XR31bhVkIft5KcGS4bM9g+V kZmCP90dmjV2j0d/mX4ArLKs1UQOU6XhwxfdBc4Ff9ko0bqUHFWkjvuK/fAGPi06LUy2 Ki5T9tmdY42SoehEsISZLF7eXClk4ZyG2evvbEQ0J9CRFGAYc0kJi+cjSUFL8ivajtFx QbZUb8ggb9Bekw3mYCo8ROpBd4NNhgxJjtb+PPfluZPhKZnEV6QsVdWvBeL19svBmcTL CN1w== 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=tguWdLB+cSGljzpdwFmWcdczxxhwHRGmkclYhxVzHMo=; b=WQQwDXifBZ8tL+d8FCXZ5l1fqQOCzmhwG7u1Soc6fc94m4wVhCknbwfrMsW7m2bgm3 fsqRR+bIqsNjFEVwBzQzzvwSC9tm3iEcNP/cRPYaF2oBU+3+4OqMEMaibqnph2FDXlZD 2Pz5ujneDGjddSLuJpEG8IGKNzVINJvokjyvMnoVLWjD6pN6zqUWQlYvRDUxvqk5U6JT OhkhoSGP9vV5LaMh+LiUplWU74S1YNZkHOLfu3LFB1p9nHgh3HDNNHAR4QXqHKErg6Nm WLx7gTQIwvDWqHYrifruus43btKm3BZPJvLhpxuu1Kxh6rGvXFeeNeK9KYx+Gvf/tbak dBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WmHY4HTs; 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 s15si13129623edj.332.2017.12.29.17.21.32; Fri, 29 Dec 2017 17:21:32 -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=WmHY4HTs; 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 36CB1C21E85; Sat, 30 Dec 2017 01:15:49 +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_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 9037EC21E4B; Sat, 30 Dec 2017 01:10:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 68D2DC21DC5; Sat, 30 Dec 2017 01:09:24 +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 7C528C21DDD for ; Sat, 30 Dec 2017 01:09:20 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id t8so50411084wmc.3 for ; Fri, 29 Dec 2017 17:09:20 -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=Q5DyyaMBYNHiqW+IHw8e4o3ykhOOFXzq0W14FWG2fkQ=; b=WmHY4HTsHWDERgW3cFVzrbacKb3LpjR6gHXI0CSQ34A+Q2JNAl1k5Mrt64no2ZEsc0 A/V6kEpM1UQXWoFhUB32R3nDOpSz/7wQj2NiJEOkCoDMBR+VlU3kqrn13BnVfcgQhzuR aE/PuOvX7ex/CrLmozPAUXayjjzkwrtL5F+3A= 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=Q5DyyaMBYNHiqW+IHw8e4o3ykhOOFXzq0W14FWG2fkQ=; b=IxIZuR7Ia56aQZqWcs6LbP29X+7jONEnUJ6F2nBOBzrQkIHg8607YDXeSj1hbuKw97 QIQteexBbT20ZCmvTk+Ls2p6gJ/NiWe0Lydan+mj7koFwA37SK+oy881/EGgndS6yucF ckmCwxX1AbFAu8m/Z2amMwQ+1+PEGSXtntRoZt6/+Jdv8AShLkbW6wso5lwJG444naN2 mhW+zpImVB014WZzrwAQ3ZDEMrSIicXba84lusYFT02LJRqs6wy+3WYlxhPEePG4QpoP LIfyJCAmH+sDA6mE/YRFzB6v4x9upEAEN68vF7PiFNvaPS5Vwcmwy6j+SERHpoPQzBER xnPA== X-Gm-Message-State: AKGB3mLyUfVFXWyKa6jX4bwEKvR2WGlCfhlEOS1AP711vDl9a+uadoKP HyrArxhiOfKnD0TNFHWG1z/bZfwQZSI= X-Received: by 10.80.184.23 with SMTP id j23mr47410784ede.115.1514596159946; Fri, 29 Dec 2017 17:09:19 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:19 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:43 +0000 Message-Id: <1514596142-22050-15-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 14/25] arm: imx: hab: Print additional IVT elements during debug 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 enables printout of the IVT entry, dcd and csf data fields. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index f9b8cb7..7c3a621 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -462,6 +462,8 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); + printf("ivt entry = 0x%08x, dcd = 0x%08x, csf = 0x%08x\n", ivt->entry, + ivt->dcd, ivt->csf); puts("Dumping IVT\n"); print_buffer(ivt_addr, (void *)(ivt_addr), 4, 0x8, 0); From patchwork Sat Dec 30 01:08:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122990 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5326702qgn; Fri, 29 Dec 2017 17:28:19 -0800 (PST) X-Google-Smtp-Source: ACJfBouNFXG/pURte+Gusqw8uOPa9LseV/WziPd/sanQINpmwLguhBeaEyuOx2DjV11gw0RYr5Kp X-Received: by 10.80.205.88 with SMTP id d24mr48298674edj.7.1514597299544; Fri, 29 Dec 2017 17:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597299; cv=none; d=google.com; s=arc-20160816; b=R7L1ZQf6P5x/S7ZkgMICGZVt6Hoh+w3DFA6H2zV5xUWTJKrMYGlODI61OOM4Riiaot myWO7XzMFNFjwuG7HNHUB/KpZKHAC/E8AGcM9wIgLdqRAElLiLwuwBa35V8I6t4BXpTW QrdzFTDIxda2iPEd1KckDHiWTO0xr7/LwcnPg5O+E1F7knf3WusqXKSrMdYvDPYiBRLc hg84k+/F2AYG2hYG15Vq9ZuKoig8DWlkvRF1FNu792cNiEmxgOCoib2K15XJ2ojmVUn6 GyuWRPbiUE7ygtnHkItF8U9as6J+zaADFMDbT7M+q35IulAyTjX8cCkNmBDU306CP1MJ FuAQ== 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=k5X/ItTmKzhWMdp0uZ8EBVqBbJj/pKMrT4QgVq8r6rY=; b=pCUT505hV5tYO+HYnuLv3kxHs4ZtEDbm5u/yrT5FomG2hA8k1EQ7lP3iI+DFb/xn9a /75i106n2kqG01qfrht4a9SswuYcON6amtIbC5du+P/CZDvFYfZny3k2WUrcbxpqbks+ cyS1BRg/TmyY1VTh1OyyZLCka/JYIKuk+Dwi6kPag00897lowmkUzvsiwT3rkkByA8pg AvbfLUE10QhR1Y5+/teuSpyNRhaD2jy6s00Gys9qhglcywdh2U+2I72NNk7qPr0A3Xww tNb26X7Tl7qW7cdbPekHkL7ic3u0GoUshVkZ5WomuD0b6gTkquJanZ7JEoHckVkMwMv0 Xc8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gDyA7SZ7; 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 36si1007503edn.385.2017.12.29.17.28.19; Fri, 29 Dec 2017 17:28:19 -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=gDyA7SZ7; 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 21FA0C21D9F; Sat, 30 Dec 2017 01:12:16 +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_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 65065C21E26; Sat, 30 Dec 2017 01:09:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A610FC21DA0; Sat, 30 Dec 2017 01:09:25 +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 93ADEC21DF0 for ; Sat, 30 Dec 2017 01:09:21 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i11so50083761wmf.4 for ; Fri, 29 Dec 2017 17:09:21 -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=GOymI+l1h69sKsRpkjL0ZhctMF1/wS3/aTxVjfkswBY=; b=gDyA7SZ7LkVp+DITX4XXW88+u0zr9dXU991ZCIUkQsXA6RJpN9xhbtM8QN9KXsaFaQ 6unzQVZgDhmM05RD/xUHYBFPORNZZ1gUKOrBbCFK0IzPtH2AxGw+J5y/r6+8MOqvkDvr f1jyJc2SX5P94AcEmG6YqHgIqQPah829rUW4w= 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=GOymI+l1h69sKsRpkjL0ZhctMF1/wS3/aTxVjfkswBY=; b=aGHXoMeiTJSsL2Xxucl7S/N8t/Dz64m821no1GVBVQU7rXK8DrxE4HZ2fOE348dCem 97OtY+auzeZQYVv7JcuJ7k35I/GVlgvSsa/IQ4qibDxInMXGV8Xz0EEodcedV/VDGiln OwvgkinZ82WfrQODCbHanD0b668VTipXKQmCvQI8JCjvuUH0I21bzwaGr9oBwgRFMcwk aBzVPlWMjkJqe0G1clxYFN90iarEVyEetQkA8bfDuJrZt/G85N2t+/C634l14fFuYb2k shILRiF7fwrVfB1wG28XepDd6M6jeULTHI/gN74BmjyH/u5rT0xuttc3u+spYOmSFJIk KYUA== X-Gm-Message-State: AKGB3mLSiztKRb2P63upykcbMSa9BXsT0h24mJC9Ox2AkqwWCiwOizl4 fauqwCMQjX6LnOvJmuPQU5LGOn2f71Y= X-Received: by 10.80.135.182 with SMTP id a51mr45831275eda.98.1514596160993; Fri, 29 Dec 2017 17:09:20 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:20 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:44 +0000 Message-Id: <1514596142-22050-16-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 15/25] arm: imx: hab: Define rvt_check_target() 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" The hab_rvt_check_target() callback according to the HABv4 documentation: "This function reports whether or not a given target region is allowed for either peripheral configuration or image loading in memory. It is intended for use by post-ROM boot stage components, via the ROM Vector Table, in order to avoid configuring security-sensitive peripherals, or loading images over sensitive memory regions or outside recognized memory devices in the address map." It is a useful function to support as a precursor to calling into authenticate_image() to validate the target memory region is good. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 28cde38..14e1220 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -113,6 +113,12 @@ enum hab_context { HAB_CTX_MAX }; +enum hab_target { + HAB_TGT_MEMORY = 0x0f, + HAB_TGT_PERIPHERAL = 0xf0, + HAB_TGT_ANY = 0x55, +}; + struct imx_sec_config_fuse_t { int bank; int word; @@ -132,6 +138,8 @@ typedef enum hab_status hab_rvt_entry_t(void); typedef enum hab_status hab_rvt_exit_t(void); typedef void *hab_rvt_authenticate_image_t(uint8_t, ptrdiff_t, void **, size_t *, hab_loader_callback_f_t); +typedef enum hab_status hab_rvt_check_target_t(enum hab_target, const void *, + size_t); typedef void hapi_clock_init_t(void); #define HAB_ENG_ANY 0x00 /* Select first compatible engine */ @@ -158,6 +166,7 @@ typedef void hapi_clock_init_t(void); #define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04)) #define HAB_RVT_EXIT (*(uint32_t *)(HAB_RVT_BASE + 0x08)) +#define HAB_RVT_CHECK_TARGET (*(uint32_t *)(HAB_RVT_BASE + 0x0C)) #define HAB_RVT_AUTHENTICATE_IMAGE (*(uint32_t *)(HAB_RVT_BASE + 0x10)) #define HAB_RVT_REPORT_EVENT (*(uint32_t *)(HAB_RVT_BASE + 0x20)) #define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24)) From patchwork Sat Dec 30 01:08:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122978 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5321590qgn; Fri, 29 Dec 2017 17:20:25 -0800 (PST) X-Google-Smtp-Source: ACJfBov7BzNmWS514NoiMKNPv6zGVl8NA9ZUS61cyu+U2+Ln5UfsADiw/2PCtj4HB/4jicCVNGyN X-Received: by 10.80.226.198 with SMTP id q6mr47293653edl.290.1514596825164; Fri, 29 Dec 2017 17:20:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596825; cv=none; d=google.com; s=arc-20160816; b=lONDhwAKqef9A42U5zC62JClbB9rqtZTL9CTXTVajZ1uSYlsEfLAmSrOsKSj9W9XYS cs4/Yxj9SYCoXDpH6VyrTP1dTcDpG1E6Hg32cQcB5mH7Cw3w08KdzO5wQ57mG0AUnTBX nOxIMbWmZUE64+LWV/rRnPTgLzdyZP5FFes5erHlcu/DdzqgPwYkZ1bJOcv/hY7Uha9Y AUeDIUemxXmb/VmzYSRZAwAPp9wKMC1Dv+k96BrGbtHvr4gtxn7h8nEog96ck/FzZ677 lnbEkHHqE2l8Uw2fj5/gGK3f4a2E1rgdfZ/K91O68Pf5rjw9iGoJfAnD7k0qI1Hsf1ZB I10A== 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=mzuxfnTJjNtsJCHiP9xNDxxxKVy+wTtJHVVYWBFjUVY=; b=PakkqofUu1Merj+mrucJnuJF5Dzvq6kLmbAWJY+1zS6sxrnDzNwucADt26xXPcBcNP jF6xwh/8RnZL6Rel5Z6O4OeuIREuzcu8XhDUm43QmHWMEa8xgxCo1Fo2b3JvMCmJYTvx uj643/W0drEquM5qbPy2mfIVHcR8BCQXAIw1xCb0SSbAmZZ+2hyS3hM4QX9RgblueK4O c0LD7mjmSlur7JjEl0Pn1OHZq05Tfo0mQ6EcNWpetN8BoO7WlQyzVxzxnav58S53vJ/E iETF4lL2177PrqzO0bQK+3v/xtoFPFKJHRNYN4v+2c+ESDXpCZrkBbqU0eAUgiCtGwmF o/aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BxuLn56D; 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 f14si965741edb.205.2017.12.29.17.20.24; Fri, 29 Dec 2017 17:20:25 -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=BxuLn56D; 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 C8AEBC21E41; Sat, 30 Dec 2017 01:14:29 +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_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 EEC3BC21DF3; Sat, 30 Dec 2017 01:10:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4BC97C21DBA; Sat, 30 Dec 2017 01:09:26 +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 08781C21DA6 for ; Sat, 30 Dec 2017 01:09:23 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id b141so3827215wme.1 for ; Fri, 29 Dec 2017 17:09:23 -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=bRa4wGLzLk7I8vWO5pXf2rFEnTfCcGvQeNd+XkL9i1s=; b=BxuLn56D48e9dukchFRCUPKxEV1H9i1DgHWaQn/zC6iqlWfCZm2G81jyzfyIT6ooH9 cZwcn/YMKKwFx+HiCfXuihczQrdiu+NXMw0oc8GBZ1M9Mzwag5rmQq6DZhaRP9JAzHjv x+2eqQF7ODhssEr/wsI0BIQEDdsMqyHS5/EDk= 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=bRa4wGLzLk7I8vWO5pXf2rFEnTfCcGvQeNd+XkL9i1s=; b=uBDe8yMS4VwPD9V87RagvUzF7lVIxQbE2Xnb3bk3SVLYA8xfdOyhy3+iiXOSXevHQh b2pP51HQBKv9x9tfH65c+FcCP2MdexVg6LChCwP1IblW0Pc6dzhqWwYn7ISQS2xA4hnR VrFkRLKFwEpUkEjAq91VsInz5nPQ3qhIZkTNqrIXAZHQP8ed8EKz9iWCsP5+95S+eXCV V04b9uzH2T+amFPx3OmVowiuDqIMxQhkKTeZNAiuwWImuTlysay4aMlHhNEMtCIoOEQO 4vjCmy7Q/Efdf8AAh0Tx+aa0HXSDWJAZaSjJNyO4RtrymzjiQXOx1rfJTDAsSz/nLNDm Wx1g== X-Gm-Message-State: AKGB3mKFt12Ojg38fafIibto2ohQnp8du9DVZUwT0NO+73vSqq6bG0s1 /i0dypsfAMZSYW1Klsc7wTSU5COhMMc= X-Received: by 10.80.144.168 with SMTP id c37mr47485051eda.182.1514596162458; Fri, 29 Dec 2017 17:09:22 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:21 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:45 +0000 Message-Id: <1514596142-22050-17-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 16/25] arm: imx: hab: Implement hab_rvt_check_target 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 implements the basic callback hooks for hab_rvt_check_target() for BootROM code using the older BootROM address layout - in my test case the i.MX7. Code based on new BootROM callbacks will just have HAB_SUCCESS as a result code. Adding support for the new BootROM callbacks is a TODO. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 7c3a621..858f2a7 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -70,6 +70,24 @@ ((hab_rvt_exit_t *)HAB_RVT_EXIT) \ ) +static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, + const void *start, + size_t bytes) +{ + return HAB_SUCCESS; +} + +#define hab_rvt_check_target_p \ +( \ + (is_mx6dqp()) ? \ + ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ + (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ + ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ + (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ + ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ + ((hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET) \ +) + #define ALIGN_SIZE 0x1000 #define MX6DQ_PU_IROM_MMU_EN_VAR 0x009024a8 #define MX6DLS_PU_IROM_MMU_EN_VAR 0x00901dd0 From patchwork Sat Dec 30 01:08:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122983 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5322746qgn; Fri, 29 Dec 2017 17:22:16 -0800 (PST) X-Google-Smtp-Source: ACJfBossdAZvWm0BmAb+dUd4qUZnKrqPmfvC4BeH3W7U1TbULyackLCRx1BEYgTDXVxxJ3Bd/dxw X-Received: by 10.80.205.88 with SMTP id d24mr48283719edj.7.1514596936557; Fri, 29 Dec 2017 17:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596936; cv=none; d=google.com; s=arc-20160816; b=JpKL5QHZIWyDnxFbVl8hBDOvUi10cJb+jprcQBQv12q41hWoaWFJmNSZU6uZ4+U1Tk K99JsreDbNva+Qkf5XlxuTOtS070O/38ZPoLgKq2HLdoreXwvahRPpOKXf250ulh/Xm5 pAN5LOCkLJgd/6g8HyLOEEv9vR4UqRkeDSiW3AQmz1mQJBIICzmDRAQpeU+SXWFRvaDo kOda69pDKllh/6Pd9jymuAqB0wJycKoLGzCKiEG8WM0O9MS9YM+nkLD+VBT6T87Xx/ZL /kp9gdy5COABQqtVjS2OmotmVWt16Ig6tWkMvcPFGujo+8KH5Y/N4eBqkT8o8zCrrdV5 KqXw== 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=3XTExcfm/R4RjVYQ5snUtBTR1VaGqHb70DkOCWDVdKo=; b=v06FAFciP4V21SaquZrxCQ3tioJp8+N5yLBlYTbHzaly2DM5y6G2B9jzoWQn/ELo5C sDFvUFFGxyvkDFJ2CmqXdZxoluxc6fUYhU0oJqZHvcLjX3wWJAYkK5ehVLttc3g/R2sl lKJ0LExOkoMHaVEYX0HP/oCnHmi7Uy7o9jwPs8DHUFw4hbJG2TSe0UFyssgQsLGF4E/E HZSl3Camn5UwUpxMlncG/L8qaYs2DJRrosSvK/vSaRLzd0QCfdeFdXJIgCgF7Nn6Qvlm +rG+fJTK6aO+fkV/8CkeVSTACMEEDkZLXL/V8e1HAOnrLy7s5czFSQ1q+3/vDQ3QpoGE hvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HalsoVZM; 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 q13si541261edq.55.2017.12.29.17.22.16; Fri, 29 Dec 2017 17:22:16 -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=HalsoVZM; 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 24226C21DD0; Sat, 30 Dec 2017 01:11:37 +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_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 E7F3CC21DB0; Sat, 30 Dec 2017 01:09:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 640BCC21DE8; Sat, 30 Dec 2017 01:09:27 +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 261BCC21DDB for ; Sat, 30 Dec 2017 01:09:24 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f206so50070898wmf.5 for ; Fri, 29 Dec 2017 17:09:24 -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=PPsvQyZLH4Mt+sx5I0UYIarc4H2t9RPw5bIGqqXCotw=; b=HalsoVZM47BzBwUQwX4oCUbYKm3LbJLobc7PVzWBG/KdiPCd/xh+0H3fLH9rmB3Vf6 rV5G+OVf7U7bVjz9xwlJHZIFweP3lxtO02whgQGdieWcvzSbGCn146lR41dPmLD63uGR aLHi+08kSaSwkNGSbU1mOZ2mnYr0FfPpcOOBo= 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=PPsvQyZLH4Mt+sx5I0UYIarc4H2t9RPw5bIGqqXCotw=; b=sCstihS/3juxszHynVpJBAgNWAr/ENt8oGnFiMGNY6cXbWJH/ZzZXk4ZfF+EGLY8/c Ssoj5vXKgvP1Qk91DfnyBKKIoj75qhyOkdxZTZTmeKI6sqc+nGKIxaHuQIWdQ4dSdqet ZKtj6wzs/a5/ZTzwXL+wXmax6cfUNCx72toRI0SbhLHanrDHF01baI+HU/yYdsPzqNjc lTk3UtiW50i/bW6AV2AtCcNHNaOMZlyVJLjfygjzr5X0p6aUANnJwcCu935L4QnLizc3 W4fVeMmkPG9Mq9CyG8cG4fmjKvQRsmCY3boKEI1iNxf7g6RWLAahdcwzmplmG+HZujIV IfqA== X-Gm-Message-State: AKGB3mLnh53Sggu2jp42UquH2m8sHh2TgWMRi6IGST9cS/7/XfUpWmaW 4VUM4x2efE8/MnwwNTW2Iw4AESESQiE= X-Received: by 10.80.201.196 with SMTP id c4mr46789619edi.56.1514596163586; Fri, 29 Dec 2017 17:09:23 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:22 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:46 +0000 Message-Id: <1514596142-22050-18-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 17/25] arm: imx: hab: Add a hab_rvt_check_target to image auth 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" Add a hab_rvt_check_target() step to authenticate_image() as a sanity check for the target memory region authenticate_image() will run over, prior to making the BootROM authentication callback itself. This check is recommended by the HAB documentation so it makes sense to adhere to the guidance and perform that check as directed. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 858f2a7..92d342b 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -437,12 +437,15 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, hab_rvt_authenticate_image_t *hab_rvt_authenticate_image; hab_rvt_entry_t *hab_rvt_entry; hab_rvt_exit_t *hab_rvt_exit; + hab_rvt_check_target_t *hab_rvt_check_target; struct ivt *ivt; struct ivt_header *ivt_hdr; + enum hab_status status; hab_rvt_authenticate_image = hab_rvt_authenticate_image_p; hab_rvt_entry = hab_rvt_entry_p; hab_rvt_exit = hab_rvt_exit_p; + hab_rvt_check_target = hab_rvt_check_target_p; if (!is_hab_enabled()) { puts("hab fuse not enabled\n"); @@ -478,6 +481,12 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, goto hab_caam_clock_disable; } + status = hab_rvt_check_target(HAB_TGT_MEMORY, (void *)ddr_start, bytes); + if (status != HAB_SUCCESS) { + printf("HAB check target 0x%08x-0x%08x fail\n", + ddr_start, ddr_start + bytes); + goto hab_caam_clock_disable; + } #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); printf("ivt entry = 0x%08x, dcd = 0x%08x, csf = 0x%08x\n", ivt->entry, From patchwork Sat Dec 30 01:08:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122984 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5323106qgn; Fri, 29 Dec 2017 17:22:51 -0800 (PST) X-Google-Smtp-Source: ACJfBou9QKWs5RSWWNbnwGSWpcw6XpCdVqYmfnInwyh41cg3fxgT5CLO2kLwh2v0Aq701HRXO/uh X-Received: by 10.80.145.195 with SMTP id h3mr48633669eda.240.1514596971177; Fri, 29 Dec 2017 17:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596971; cv=none; d=google.com; s=arc-20160816; b=J4fjEnoFadrLQ2v78svYGKyGnjs4KgQUV7+VFOe2grHRkh5t+pzUqt67Cmp/ndiQob SkzxVoOS++FR8fbCSF9ZPMST8hLsNN84hcfeL8h7g+yAbC+x1yhErLFo+aMU8GEEK0xr PY2GOsXKU2z+uaxZUb5Mw80Drua6m7WUwYGf2jjqho+ovRF7207mve7LzMwDNdyxfFxk gOPjEnafdocv0VEQWJWF5Y/um3VSPk3a977V/jw+sEH7xscLi4r2KyIgR+k74hn9R1Vc LeBeADbWEnEt2IS7l2usjGb/objHm2q5Yy1/xHkeI1dv3zNkzaZZG6F+DGpkFGkCKKJq 8LEg== 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=S0JhmcHhc1e3FB+iAlVlIisarDxPw3YaYB4JP6wXzfg=; b=KOGWrC8v33mbpoOQE6Vi8fyv545GAsKRZN7OPNRtILKswOE/UgBtqKPkr4LnnBh37A Fnfsp14kDLoNT6BT4td+p4oiFejE6XCG7I++38uf69Z7DIX9JnTchvlXRIr3q8GcGg5k oQnGsQWEmwV776GE4uxVuU0jBEwN3TH0aEXq+DRzXxnymf1oadWR1oWbhGZ64ZHA/KnR yut7HKYxQMPmyPviFT1Hb2HOcQR5iQpGwjQzfloCl19oJTTq8ZT8xVH/iRDyQWVD6Qk8 UVG4mEI1gCROhcfLt5B4kWMUj1BZSWOSt3cLKvzs6YCG5BR7MtZoWik+RkaLG1qPA4X1 Rvww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ASZAqzQH; 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 o28si4068788edo.135.2017.12.29.17.22.50; Fri, 29 Dec 2017 17:22:51 -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=ASZAqzQH; 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 D47A1C21E90; Sat, 30 Dec 2017 01:14:10 +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_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 C7120C21E4C; Sat, 30 Dec 2017 01:10:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A9ACCC21DBA; Sat, 30 Dec 2017 01:09:30 +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 6C987C21D9F for ; Sat, 30 Dec 2017 01:09:26 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i11so50083866wmf.4 for ; Fri, 29 Dec 2017 17:09:26 -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=G0phrzE8QBsqEkSlDYYFjGIrOOsENIKZJkqtSyjgeQY=; b=ASZAqzQHmcDmxlFUjZo0uV+OwrlcurWVNyNg/Aq+JYUd30nbAibeFSfsS6xWy0sj0O /lrjHCxPxNx9fFijIZsQzY+gSX+BwvSl+uyXh4toP2vETsSV/fvS1qRYaYDQVycaVTUd uFIg398yYNTrcqRinhrITHEih7ax+Q7NRjqOo= 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=G0phrzE8QBsqEkSlDYYFjGIrOOsENIKZJkqtSyjgeQY=; b=PpzK/4TKr998AliuEGjc0QDg5AKx5iympjcx8bcPqeLf2w8KpvP+X/E7YBeasylIUf yvP72R3OH2cEF+qLZSS7KwyZX6f74E0dstCnWovk9j3OUdhqTy3s9kl5cLwtbPBgmN15 /HJm7jw0CtufIFE8gaM76VHSm0j+CDAg0aqFOSU/MKl9VSn0gd8XsWRA1L+0Kqi840d5 qIHXHYBeN+VN5vy/ULzVy/woO+rGMhMj0og8NYb3/nj6rZvDbLdTrD+MGKGnUg51CDBc JWCQQnoqVY732FGknZYnaHmO8OIri8gKIDfxD22nnoM83648goLh/NQX42HV4WaW7VTf +IBQ== X-Gm-Message-State: AKGB3mKBV3uYYZDK//vMRBn7OiJaYXG4giXeewOVaWRbV/Gmufdc4eJK AD/z8+7n6Q1pxgEfrTWTgMvBHWIe4xc= X-Received: by 10.80.148.112 with SMTP id q45mr46450588eda.161.1514596165871; Fri, 29 Dec 2017 17:09:25 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:25 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:48 +0000 Message-Id: <1514596142-22050-20-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 18/25] arm: imx: hab: Print HAB event log only after calling ROM 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" The current flow of authenticate_image() will print the HAB event log even if we reject an element of the IVT header before ever calling into the ROM. This can be confusing. This patch changes the flow of the code so that the HAB event log is only printed out if we have called into the ROM and received some sort of status code. Signed-off-by: Bryan O'Donoghue Suggested-by: Cc: Breno Matheus Lima Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister --- arch/arm/mach-imx/hab.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 92d342b..d574f2e 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -478,14 +478,14 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, if (hab_rvt_entry() != HAB_SUCCESS) { puts("hab entry function fail\n"); - goto hab_caam_clock_disable; + goto hab_exit_failure_print_status; } status = hab_rvt_check_target(HAB_TGT_MEMORY, (void *)ddr_start, bytes); if (status != HAB_SUCCESS) { printf("HAB check target 0x%08x-0x%08x fail\n", ddr_start, ddr_start + bytes); - goto hab_caam_clock_disable; + goto hab_exit_failure_print_status; } #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); @@ -558,12 +558,14 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, load_addr = 0; } -hab_caam_clock_disable: - hab_caam_clock_enable(0); - +hab_exit_failure_print_status: #if !defined(CONFIG_SPL_BUILD) get_hab_status(); #endif + +hab_caam_clock_disable: + hab_caam_clock_enable(0); + if (load_addr != 0) result = 0; From patchwork Sat Dec 30 01:08:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122972 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5318058qgn; Fri, 29 Dec 2017 17:15:08 -0800 (PST) X-Google-Smtp-Source: ACJfBotFv34B8hWhhd5GyfGPVcg1s0QWlQkrpb9CfiVLIcyf9pa83hhzdE5u63XQxTSMTRAeB1hG X-Received: by 10.80.176.194 with SMTP id j60mr47922710edd.254.1514596508062; Fri, 29 Dec 2017 17:15:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596508; cv=none; d=google.com; s=arc-20160816; b=ykQEYGTcXuZPgq34Gxuvgt4GHzD85IiPOija+bwpDrOk8LYsBBkryGHro2hQ59ISdv TdG6DirmNXaxZxwKpqd2DVptX0s8hk/Ea6g9m7aYQ/T1+QtNgqfvhwno9vH7Jfw/bfl5 DMzrylELKv8+ZqbEx+NWFzxTWoh/ZZtyetaTNcWNeIYF7Bc3Z82J73YVwF5LSv3BqoU3 ahgft58t4i7B+yc3zibO8RGZLwFS/gdRLwgKEPVAxx5DhrMEXQYLzwtQG5bBPZcvH70F sjdWkws5/gwxhVUzkr/H3lXyZWaRVAF3naGgcgN8wmjsRiMxHBzSMZ+mgo5PE+OzSTyt 6GwA== 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=dD3zPQquy7W3k6xQTL5tAyyr3ofV2invR217CjouUEI=; b=isy04IiD0D5JUQlhNYmC0JLba+hDYgAmBj57UVuZAzuTBnCeuuvVhcsaM8NTm76So4 g2FJX5LsGxlCrOUgMjUC0Bjrz4OTGqlnb95ZLw30YWKoQLOm/qIf0rTLn49BLeXh6zYU QEHO16cOgY5NrQEoX7dahUoQ86DFXB5rWEO5Ov1i8npAh55NZQXxjkQDD7cXX0cyt1zL W7sw/M20PpYJx01p1KBrN6Z1V08Wc5kuCNq3d3Vt8/CF+/kvyET9hijgBL063/l8MAbp GVS93qWq7Oj6eNoiqMaZNJaO2U7JYkQvhCMyu/gtAcdumRgfezBERK4GBYvpzvikFBso 5paw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jIOMS7CJ; 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 f24si4252746edc.398.2017.12.29.17.15.07; Fri, 29 Dec 2017 17:15:08 -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=jIOMS7CJ; 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 ADBCEC21E31; Sat, 30 Dec 2017 01:11: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_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 8CE5BC21E0E; Sat, 30 Dec 2017 01:09:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5921AC21DC1; Sat, 30 Dec 2017 01:09:31 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 9DA43C21DBB for ; Sat, 30 Dec 2017 01:09:27 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id n138so50413864wmg.2 for ; Fri, 29 Dec 2017 17:09:27 -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=4ULRCNL6bNYyowzyRqmcK5GE/zoy4zTakoCDtkbwUmM=; b=jIOMS7CJdZe9FVz4ghRPygK9B34gVJbAXOuNIL2oejgrRG3lhJk/x7s21wjRgOHLM1 oCOmir0nQH0xWDDLZhSYEUTsOjTUAA0sMRKJl04xTe6UFlXKKJfN5MIiaHLecV/pvOPa GEHVq8Y1JX3VXZEAuHGXmSscvuYIEsjSdc5ms= 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=4ULRCNL6bNYyowzyRqmcK5GE/zoy4zTakoCDtkbwUmM=; b=RCBmond54bTskVIk+2WEOjQ/PsprcLAXd7p13YVqYuR5RTUXSbHcGmd7kj2uhqjZcb 2dyjxungeMIPiAEyoJ1Auu2RMyblRJhk1nlOCJMiKQfgy4m1rsQaR+4wrnZc61oJ17BC 4KWFiyHyoUzpkjiRkI7Uesuq9hr/xyoOD4x4IBkNcaH2uZe7A2TzlZTbowK9dmexb2bt VQwPUr+5CUWViMjIz8ZV9C5hWyosA4Vq+gJ7gK4BV+ybe0aD+gOTe428Wvq7aKbo7xRG Z5aURUkNhUEX4xWysGN/YtI4ksfLCB3ezYtP1kpnVvh1qr3TNLJde/mwAxRyoLVyK/wU /P3w== X-Gm-Message-State: AKGB3mKv+8QThH1r1TwMsR24klc4E9xYw3VuCdHeTURQfwO2FVAbqvcG khI/BeJ+ti1c/A7dTRhiz5uhqXlujjk= X-Received: by 10.80.142.17 with SMTP id 17mr48936691edw.147.1514596166987; Fri, 29 Dec 2017 17:09:26 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:26 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:49 +0000 Message-Id: <1514596142-22050-21-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 19/25] arm: imx: hab: Make internal functions and data static 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" There is no need to export these functions and data structures externally. Make them all static now. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 159 +++++++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 75 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index d574f2e..b2c3875 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -135,73 +135,81 @@ struct record { bool any_rec_flag; }; -char *rsn_str[] = {"RSN = HAB_RSN_ANY (0x00)\n", - "RSN = HAB_ENG_FAIL (0x30)\n", - "RSN = HAB_INV_ADDRESS (0x22)\n", - "RSN = HAB_INV_ASSERTION (0x0C)\n", - "RSN = HAB_INV_CALL (0x28)\n", - "RSN = HAB_INV_CERTIFICATE (0x21)\n", - "RSN = HAB_INV_COMMAND (0x06)\n", - "RSN = HAB_INV_CSF (0x11)\n", - "RSN = HAB_INV_DCD (0x27)\n", - "RSN = HAB_INV_INDEX (0x0F)\n", - "RSN = HAB_INV_IVT (0x05)\n", - "RSN = HAB_INV_KEY (0x1D)\n", - "RSN = HAB_INV_RETURN (0x1E)\n", - "RSN = HAB_INV_SIGNATURE (0x18)\n", - "RSN = HAB_INV_SIZE (0x17)\n", - "RSN = HAB_MEM_FAIL (0x2E)\n", - "RSN = HAB_OVR_COUNT (0x2B)\n", - "RSN = HAB_OVR_STORAGE (0x2D)\n", - "RSN = HAB_UNS_ALGORITHM (0x12)\n", - "RSN = HAB_UNS_COMMAND (0x03)\n", - "RSN = HAB_UNS_ENGINE (0x0A)\n", - "RSN = HAB_UNS_ITEM (0x24)\n", - "RSN = HAB_UNS_KEY (0x1B)\n", - "RSN = HAB_UNS_PROTOCOL (0x14)\n", - "RSN = HAB_UNS_STATE (0x09)\n", - "RSN = INVALID\n", - NULL}; - -char *sts_str[] = {"STS = HAB_SUCCESS (0xF0)\n", - "STS = HAB_FAILURE (0x33)\n", - "STS = HAB_WARNING (0x69)\n", - "STS = INVALID\n", - NULL}; - -char *eng_str[] = {"ENG = HAB_ENG_ANY (0x00)\n", - "ENG = HAB_ENG_SCC (0x03)\n", - "ENG = HAB_ENG_RTIC (0x05)\n", - "ENG = HAB_ENG_SAHARA (0x06)\n", - "ENG = HAB_ENG_CSU (0x0A)\n", - "ENG = HAB_ENG_SRTC (0x0C)\n", - "ENG = HAB_ENG_DCP (0x1B)\n", - "ENG = HAB_ENG_CAAM (0x1D)\n", - "ENG = HAB_ENG_SNVS (0x1E)\n", - "ENG = HAB_ENG_OCOTP (0x21)\n", - "ENG = HAB_ENG_DTCP (0x22)\n", - "ENG = HAB_ENG_ROM (0x36)\n", - "ENG = HAB_ENG_HDCP (0x24)\n", - "ENG = HAB_ENG_RTL (0x77)\n", - "ENG = HAB_ENG_SW (0xFF)\n", - "ENG = INVALID\n", - NULL}; - -char *ctx_str[] = {"CTX = HAB_CTX_ANY(0x00)\n", - "CTX = HAB_CTX_FAB (0xFF)\n", - "CTX = HAB_CTX_ENTRY (0xE1)\n", - "CTX = HAB_CTX_TARGET (0x33)\n", - "CTX = HAB_CTX_AUTHENTICATE (0x0A)\n", - "CTX = HAB_CTX_DCD (0xDD)\n", - "CTX = HAB_CTX_CSF (0xCF)\n", - "CTX = HAB_CTX_COMMAND (0xC0)\n", - "CTX = HAB_CTX_AUT_DAT (0xDB)\n", - "CTX = HAB_CTX_ASSERT (0xA0)\n", - "CTX = HAB_CTX_EXIT (0xEE)\n", - "CTX = INVALID\n", - NULL}; - -uint8_t hab_statuses[5] = { +static char *rsn_str[] = { + "RSN = HAB_RSN_ANY (0x00)\n", + "RSN = HAB_ENG_FAIL (0x30)\n", + "RSN = HAB_INV_ADDRESS (0x22)\n", + "RSN = HAB_INV_ASSERTION (0x0C)\n", + "RSN = HAB_INV_CALL (0x28)\n", + "RSN = HAB_INV_CERTIFICATE (0x21)\n", + "RSN = HAB_INV_COMMAND (0x06)\n", + "RSN = HAB_INV_CSF (0x11)\n", + "RSN = HAB_INV_DCD (0x27)\n", + "RSN = HAB_INV_INDEX (0x0F)\n", + "RSN = HAB_INV_IVT (0x05)\n", + "RSN = HAB_INV_KEY (0x1D)\n", + "RSN = HAB_INV_RETURN (0x1E)\n", + "RSN = HAB_INV_SIGNATURE (0x18)\n", + "RSN = HAB_INV_SIZE (0x17)\n", + "RSN = HAB_MEM_FAIL (0x2E)\n", + "RSN = HAB_OVR_COUNT (0x2B)\n", + "RSN = HAB_OVR_STORAGE (0x2D)\n", + "RSN = HAB_UNS_ALGORITHM (0x12)\n", + "RSN = HAB_UNS_COMMAND (0x03)\n", + "RSN = HAB_UNS_ENGINE (0x0A)\n", + "RSN = HAB_UNS_ITEM (0x24)\n", + "RSN = HAB_UNS_KEY (0x1B)\n", + "RSN = HAB_UNS_PROTOCOL (0x14)\n", + "RSN = HAB_UNS_STATE (0x09)\n", + "RSN = INVALID\n", + NULL +}; + +static char *sts_str[] = { + "STS = HAB_SUCCESS (0xF0)\n", + "STS = HAB_FAILURE (0x33)\n", + "STS = HAB_WARNING (0x69)\n", + "STS = INVALID\n", + NULL +}; + +static char *eng_str[] = { + "ENG = HAB_ENG_ANY (0x00)\n", + "ENG = HAB_ENG_SCC (0x03)\n", + "ENG = HAB_ENG_RTIC (0x05)\n", + "ENG = HAB_ENG_SAHARA (0x06)\n", + "ENG = HAB_ENG_CSU (0x0A)\n", + "ENG = HAB_ENG_SRTC (0x0C)\n", + "ENG = HAB_ENG_DCP (0x1B)\n", + "ENG = HAB_ENG_CAAM (0x1D)\n", + "ENG = HAB_ENG_SNVS (0x1E)\n", + "ENG = HAB_ENG_OCOTP (0x21)\n", + "ENG = HAB_ENG_DTCP (0x22)\n", + "ENG = HAB_ENG_ROM (0x36)\n", + "ENG = HAB_ENG_HDCP (0x24)\n", + "ENG = HAB_ENG_RTL (0x77)\n", + "ENG = HAB_ENG_SW (0xFF)\n", + "ENG = INVALID\n", + NULL +}; + +static char *ctx_str[] = { + "CTX = HAB_CTX_ANY(0x00)\n", + "CTX = HAB_CTX_FAB (0xFF)\n", + "CTX = HAB_CTX_ENTRY (0xE1)\n", + "CTX = HAB_CTX_TARGET (0x33)\n", + "CTX = HAB_CTX_AUTHENTICATE (0x0A)\n", + "CTX = HAB_CTX_DCD (0xDD)\n", + "CTX = HAB_CTX_CSF (0xCF)\n", + "CTX = HAB_CTX_COMMAND (0xC0)\n", + "CTX = HAB_CTX_AUT_DAT (0xDB)\n", + "CTX = HAB_CTX_ASSERT (0xA0)\n", + "CTX = HAB_CTX_EXIT (0xEE)\n", + "CTX = INVALID\n", + NULL +}; + +static uint8_t hab_statuses[5] = { HAB_STS_ANY, HAB_FAILURE, HAB_WARNING, @@ -209,7 +217,7 @@ uint8_t hab_statuses[5] = { -1 }; -uint8_t hab_reasons[26] = { +static uint8_t hab_reasons[26] = { HAB_RSN_ANY, HAB_ENG_FAIL, HAB_INV_ADDRESS, @@ -238,7 +246,7 @@ uint8_t hab_reasons[26] = { -1 }; -uint8_t hab_contexts[12] = { +static uint8_t hab_contexts[12] = { HAB_CTX_ANY, HAB_CTX_FAB, HAB_CTX_ENTRY, @@ -253,7 +261,7 @@ uint8_t hab_contexts[12] = { -1 }; -uint8_t hab_engines[16] = { +static uint8_t hab_engines[16] = { HAB_ENG_ANY, HAB_ENG_SCC, HAB_ENG_RTIC, @@ -284,7 +292,7 @@ static inline uint8_t get_idx(uint8_t *list, uint8_t tgt) return -1; } -void process_event_record(uint8_t *event_data, size_t bytes) +static void process_event_record(uint8_t *event_data, size_t bytes) { struct record *rec = (struct record *)event_data; @@ -294,7 +302,7 @@ void process_event_record(uint8_t *event_data, size_t bytes) printf("%s", eng_str[get_idx(hab_engines, rec->contents[3])]); } -void display_event(uint8_t *event_data, size_t bytes) +static void display_event(uint8_t *event_data, size_t bytes) { uint32_t i; @@ -313,7 +321,7 @@ void display_event(uint8_t *event_data, size_t bytes) process_event_record(event_data, bytes); } -int get_hab_status(void) +static int get_hab_status(void) { uint32_t index = 0; /* Loop index */ uint8_t event_data[128]; /* Event data buffer */ @@ -358,7 +366,8 @@ int get_hab_status(void) return 0; } -int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +static int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) { if ((argc != 1)) { cmd_usage(cmdtp); @@ -371,7 +380,7 @@ int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) + char * const argv[]) { ulong addr, length, ivt_offset; int rcode = 0; From patchwork Sat Dec 30 01:08:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122995 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5327828qgn; Fri, 29 Dec 2017 17:30:04 -0800 (PST) X-Google-Smtp-Source: ACJfBoty9QxUXHzKiRtKOOPj3LHWly5fUXuk9seYTQdnXJsx98uqaaTsh6R8kwfarwF7bbpQb7Du X-Received: by 10.80.219.69 with SMTP id b5mr47244186edl.218.1514597403995; Fri, 29 Dec 2017 17:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597403; cv=none; d=google.com; s=arc-20160816; b=cNLyYZ6K1+xj6+/Sxw3cNNSWzhQYE/BQqYRT3///Q753TATOEdFikef4WZPDaK5KQD Kl0tldZgLunP9t58AyIFp23d5VlY1f1B6uLyX6nqHJ0+DrjJ8kUJyJhL5wR9eY1yo5AY PN187QQjXMyTOsbYM8RQLqOxx70NSL6IyIC8MWV70B8PiXQmbePSaK5cB6asxTDpEdYN +8VX1H/F1RmPM+gO6Gg2LXhzwZOsOlePbY/144Y9bev7RS8UJRrhHkCs39DWLn/6nCrE p6cTPd4FAG8kC4LR+SQDKg/rz/2XayBPXNBg+da8KE4HJbPWJ8xr1/OcTnb4+NZjJZuv inJg== 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=22dF+e3huFLZmIRbjIwf+ehsrCbjE0AcINiAj07HYgI=; b=xNuxLgCZ2l6yj+nEZ2WVztVysGZDVgmGzMgTiNIuV4lDPg5h5aPDkWRMywmLi0AH38 +UbP4VmJGiXRu8svYNvSWoacvePWGqYw86YlVOhIExQxF63y/ePrMbtFKg3YNfA5yIFJ Qc6d0F+wHRX+SDNLRHTkh6eZNIQFCsjTmjae6+EQjnU8PqnjbmB1FRy+DISwehnIq/2P 2a9HYN5ikS12zsE+8LtFKD+yk+uWw5MUjvWx5gag6GFmro+FWU7BieHlCWAm8A7ePvfk 6B8VHt5Ckw9LKaDqE91bxcNbv/1E2BFeZxH/29XNpwxeEFgjwds6rTQY3kUbvP/TIwM3 qgZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DwXnIUJY; 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 90si1161865edp.541.2017.12.29.17.30.03; Fri, 29 Dec 2017 17:30:03 -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=DwXnIUJY; 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 8956EC21D56; Sat, 30 Dec 2017 01:16:23 +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_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 AB835C21E66; Sat, 30 Dec 2017 01:10:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BAFF6C21E30; Sat, 30 Dec 2017 01:09:33 +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 D8263C21DB0 for ; Sat, 30 Dec 2017 01:09:29 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id a79so11259527wma.0 for ; Fri, 29 Dec 2017 17:09:29 -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=UqVqhCaIeOzN2MgQXJr9c+L5sychqrTpuh+6MMjPlEs=; b=DwXnIUJYlNfpSpjCk6kfM5bRYb/gLOY8lR3bkgoUMUr+7uqmPEOnA/j/zpOToIYVm0 KQezvS4b6ulDvc+RXJVdrvYCKnEMCcV+bNCaz9IAgPWOf2vk2HFPGNvwa/UwI/XWX0hq s/oOZUuTfwCCq6eS/6Ozn85v1ukq4QFtBoDvM= 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=UqVqhCaIeOzN2MgQXJr9c+L5sychqrTpuh+6MMjPlEs=; b=Xq+PFcJOWRZPuOLBCdOBid89Xt4DUDSXaJ8lXWZUEHQ3NnjgWFGVtgBHgmxCsnpruY qj/Nl4mYjB6NNYFtBLGk1wou47HQbwAWOpDJAunkTlbEtLKHNH3yVmVjvbxaKUxmV9B1 cE0bxUS287wB8FsNz188lHKYjMXeob0gV6bsVoxrDmPefl0R6foW22C2kKb4ivtxwmhW FzEh2gzN7qjSvtqhvF5RVQj6lrDNrcB0gifxLP5EUIUxajCKHyeGgqzb+v6urSQSvAOZ f9CgzoW+xdEMwu7lyEmwham1inVI9pJcE39XFc+rvBPkzUG5J9TGI6+gmhHsfab1D8+M sCzg== X-Gm-Message-State: AKGB3mLUNGgPkJ2LInlgILqMBAu2ulXDmuv3FWrnmh//a2i5g9ONxMxg jr1TogQ3rrzPYSaOAPYrYD841phJ8sM= X-Received: by 10.80.202.72 with SMTP id e8mr47545380edi.60.1514596169302; Fri, 29 Dec 2017 17:09:29 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:28 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:51 +0000 Message-Id: <1514596142-22050-23-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 20/25] arm: imx: hab: Prefix authenticate_image with imx_hab 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" Tidy up the HAB namespace a bit by prefixing external functions with imx_hab. All external facing functions past this point will be prefixed in the same way to make the fact we are doing IMX HAB activities clear from reading the code. authenticate_image() could mean anything imx_hab_authenticate_image() is on the other hand very explicit. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 4 ++-- arch/arm/mach-imx/hab.c | 6 +++--- arch/arm/mach-imx/spl.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 14e1220..98bc1bd 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -185,7 +185,7 @@ typedef void hapi_clock_init_t(void); /* ----------- end of HAB API updates ------------*/ -int authenticate_image(uint32_t ddr_start, uint32_t image_size, - uint32_t ivt_offset); +int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index b2c3875..c72508b 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -392,7 +392,7 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, length = simple_strtoul(argv[2], NULL, 16); ivt_offset = simple_strtoul(argv[3], NULL, 16); - rcode = authenticate_image(addr, length, ivt_offset); + rcode = imx_hab_authenticate_image(addr, length, ivt_offset); if (rcode == 0) rcode = CMD_RET_SUCCESS; else @@ -435,8 +435,8 @@ static bool is_hab_enabled(void) return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT; } -int authenticate_image(uint32_t ddr_start, uint32_t image_size, - uint32_t ivt_offset) +int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset) { uint32_t load_addr = 0; size_t bytes; diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index e5d0c35..a5478ce 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -196,8 +196,9 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* HAB looks for the CSF at the end of the authenticated data therefore, * we need to subtract the size of the CSF from the actual filesize */ offset = spl_image->size - CONFIG_CSF_SIZE; - if (!authenticate_image(spl_image->load_addr, - offset + IVT_SIZE + CSF_PAD_SIZE, offset)) { + if (!imx_hab_authenticate_image(spl_image->load_addr, + offset + IVT_SIZE + CSF_PAD_SIZE, + offset)) { image_entry(); } else { puts("spl: ERROR: image authentication unsuccessful\n"); From patchwork Sat Dec 30 01:08:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122980 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5322106qgn; Fri, 29 Dec 2017 17:21:15 -0800 (PST) X-Google-Smtp-Source: ACJfBovHelcEqsyZHepKKTDcXvQ7fa/O3owdnCTLGCuXdt7tDlpMMkr5zDN6yycPkSCmEPkVfXor X-Received: by 10.80.177.188 with SMTP id m57mr47711937edd.178.1514596875482; Fri, 29 Dec 2017 17:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596875; cv=none; d=google.com; s=arc-20160816; b=JzOWuuw4osMJ9hlw/ea6yAFNyaKNdUssUpXm3uj39lE2O5jg4ICRibcgt0HnKP1AAM aDeEwk1TC1zrPzkcVuwfzmxFYiXWVJd8a3lgUiYkJsH6yl6tdUZA5Pnj70Vwgj+toZu+ JK+qB++O+ilDcQYLFFLbbbnwy5qk75T23XwyDKVLfP+mWHMtDKvftiOJch+g68hVdgBr gvnL1HEbi2VNicPB4SByK2KFwsoRMjLsiykJJhW/+Ki855BdIJJLxe9mkGtfPH5d3Pdk KHymQKDZ9FSfPZwpPgIKOYKRJcxIOQxpuuUHpEC0U4sg9GW7dCArPLceYcNcdSl0526T JdEg== 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=m98eucAUHRiyPP24zsfkU+IH0wmj3VMRm7hT4pxYyqM=; b=eaiyfVGpF34ejOcb/0qoX81QlPQuEKDFp9G/caPzI9jG6NIpUcK/bP+9OnwDL8GMPU KdMS5lA58A3lSkbfjiGMhQ5AdOHd+gJLmVKvXpYHQTl/q4ML5xNOwT2/pAu7t2RX0Hr0 mqkTYpzqkPpmGiUmOh492On3yTBwCw2aezvfCxyehg0kPhLdKXpr4g2eAciuGfo8GtBv YZoMzQJfZPiWhLYfPN3NOlI7EgCQJYkbC8t6v0dxf6a8e5Ti0Inri8ZosmFL1GmMzTnC JUICDpVdA2VAMY23OaochAvv75+QrkdOrh6VLI9/qlTSjcbZGYdpq5ncmyi3hoTXTCO7 oLUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dI2Ef96E; 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 u92si920841edc.43.2017.12.29.17.21.15; Fri, 29 Dec 2017 17:21:15 -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=dI2Ef96E; 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 2B077C21E55; Sat, 30 Dec 2017 01:18:46 +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_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 047C8C21E85; Sat, 30 Dec 2017 01:12:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9963EC21DA3; Sat, 30 Dec 2017 01:09:36 +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 4B69FC21DF1 for ; Sat, 30 Dec 2017 01:09:32 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id g130so7017988wme.0 for ; Fri, 29 Dec 2017 17:09:32 -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=NyKnQdFxcTIiKS/iN/TWVLhycjC4fKN7qKNqGeJI2jU=; b=dI2Ef96EJxwZk2YQ/7yntzUCOjwwI3a9AeyldrwDS05mtGaJkdkwXieMNBhEzE1WAT AZsFH+t+Rz8QgcZ70FAb2RwhmNA/k8Xwi0NnE+l1Ywg5s7LMJRR0uMvHagUouwoNoOJu +op7mMkTTL/cbqv33XZaGlzChA506ab0aK18A= 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=NyKnQdFxcTIiKS/iN/TWVLhycjC4fKN7qKNqGeJI2jU=; b=K5g3uTElyab8Pe/wutpOFP+Hx8jOnp+qIp3m02jKD1gS9QSN499UFcPbZa1TdfjCCe IIpKmO/VvRIHPUO8WqzLXxLIm81bjaXYOze6U/fVS7hzgQYuYg+lx1r89lisbHyoUY/p aaOPQzEuKXFVVluOLQCAhCL2dhCuPF7n6MWmb4wxmlp5eDN4vYzKWdGk8lG/7Tn5xC02 kcX/GXYMPGix9znujJ9Jeurar/vl4baNEZ7qKANPrceXZMrFUPmReqPvXjLpusaQGfHX EhgWTQaYsrBGGlocp3fx3/B/dpPaR5MDW08QdQYnZrmQseL1AskIdGeQxtg6tR9UAVT6 AF8g== X-Gm-Message-State: AKGB3mIGhHuz4pmpLquCotkeCv5+hJ82pcqAB/bZqgV7rIuRi2pqLGJC ZRsvC3eXjLNBR6a/iKAEzGVUnl9nlVs= X-Received: by 10.80.231.151 with SMTP id b23mr47334749edn.94.1514596171715; Fri, 29 Dec 2017 17:09:31 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:31 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:53 +0000 Message-Id: <1514596142-22050-25-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 21/25] arm: imx: hab: Make imx_hab_is_enabled global 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" It will be helpful to boot commands to know if the HAB is enabled. Export imx_hab_is_enabled() now to facilitate further work with this data-point in a secure-boot context. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 1 + arch/arm/mach-imx/hab.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 98bc1bd..5c13aff 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -187,5 +187,6 @@ typedef void hapi_clock_init_t(void); int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, uint32_t ivt_offset); +bool imx_hab_is_enabled(void); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index fc15254..1f3253e 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -96,8 +96,6 @@ static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, (is_soc_type(MXC_SOC_MX7ULP) ? 0x80000000 : \ (is_soc_type(MXC_SOC_MX7) ? 0x2000000 : 0x2)) -static bool imx_hab_is_enabled(void); - static int ivt_header_error(const char *err_str, struct ivt_header *ivt_hdr) { printf("%s magic=0x%x length=0x%02x version=0x%x\n", err_str, @@ -419,7 +417,7 @@ U_BOOT_CMD( #endif /* !defined(CONFIG_SPL_BUILD) */ -static bool imx_hab_is_enabled(void) +bool imx_hab_is_enabled(void) { struct imx_sec_config_fuse_t *fuse = (struct imx_sec_config_fuse_t *)&imx_sec_config_fuse; From patchwork Sat Dec 30 01:08:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122977 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5321521qgn; Fri, 29 Dec 2017 17:20:19 -0800 (PST) X-Google-Smtp-Source: ACJfBou6gwfXNmFHXXFqwM14C5JILnUVlzsc9oFxtBFfAnqIrsTMxl6+mW9rxnT4vt0PSiMUIIs9 X-Received: by 10.80.137.106 with SMTP id f39mr48688003edf.148.1514596819628; Fri, 29 Dec 2017 17:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596819; cv=none; d=google.com; s=arc-20160816; b=QG5zBE8kgI0PQMVN7l8jUkkrGbtGYz5e6mes/ZeIHQuHnVAawkZzVqJ79R5lFleGx+ x0KmUNuZTBS3XzwTrooNspIY4LUWgjTo3y9v+We/YXui6Vy+YYgjY9KdrjQ/lPIVd1Qt p0VGgkLnJTm851jIuNEg1gUMazSccd7Al26CZV8qxg3U4EGnxY73t30+Za5HvhWWDmvB O/AjodxoleJEu6VLlGj8TattmnUdbNVmAYavvUbQHTG0ufRCxUJyLaGYWJT2U78oNS7U txe5jD+Xm8Q0jzKBrTLMr496+F5VUTr4TVWDc71xurOM2zfsg89t/mvYl5JTI3E+Jgj2 BNrA== 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=R9avwgqFddUomNIB7aDnWBoO8/toFIyRAvBryJEn3oQ=; b=ods2pVmJ8Q4ttxfbNwHzyhyLUHC+yxbvvcWpcU0kTAukUVtX8SqS3zaCW7Z28rPplC 7kiibjXwhKUt7tmCz6r4mlCVLO94ylzhjpAaKDtO5uUaJJjveQ/BkjXE8OUZFw3o7rWq oH7DA6TQLsKdHt9XQNUSqDWAxzSgzVZgKgegTudWhxXce4240kmGtFCELf8q+Xb7K3Te TqkOrabpgGPJt+yT4ZmAIHlkL9bBhMgjaDMq/VrqNERKgi08RlXhdELylEW1FCa6B70x RKet00lQkfMt3Lfr/JtU82T9BipCBlGR8fyk4sMKG2jKQnRQIycvn02oN7UjOTJxkc/U U0jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gRW40mjy; 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 g32si2325876ede.546.2017.12.29.17.20.19; Fri, 29 Dec 2017 17:20:19 -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=gRW40mjy; 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 37E30C21E39; Sat, 30 Dec 2017 01:17:51 +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_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 E0158C21E8A; Sat, 30 Dec 2017 01:11:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F504C21E63; Sat, 30 Dec 2017 01:09:39 +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 979ACC21DCE for ; Sat, 30 Dec 2017 01:09:35 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id a79so11259689wma.0 for ; Fri, 29 Dec 2017 17:09:35 -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=ktW14LjkBOmNYdKs8hyHshup1gAU1RkLhU0pGCF1UXI=; b=gRW40mjygIpX4gb/jxoJfGOw4vK7AfOKl/ksHt9GbYQUsunGpnVDGCa7a8WZylUtOM sLp02E77dvKAXmtHsglbiMZlCfJrcPqrwwKDMmguXhGL+WH+oBkEjwVzVntzni1JNMAs 2U6n/o60HQ2XRfyHRu67U3A3VV3Z29aBjWqA0= 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=ktW14LjkBOmNYdKs8hyHshup1gAU1RkLhU0pGCF1UXI=; b=Co9ba39m7JdckYjKXQLyJXWz6xh0gRta/GFqsozpafAPIfqclkqg07AUOAWmHXMgl4 aNvUc7g7EqhS0toB0hqazLYlb4ZxhjIC8QMH9mOZmYnZ7eEeB2ymcPE4yAM4fg61CJSb qis31LCKJi7XqMvi7PJJFoXBpQ0kCZTFx7odlDB05yLpD3fWAE9tMrWkS5MVqt8V8BOv r2w3flnbrfAg/cOKHWs2u7a6dSUMqwQvevNiyNqzq99G5b8QHd44nPdXywImL3jOZT7y Vqs6HxveIV0IwGioP5RYW0nq0rIFjYy6V9xYWcULxw/K6wK3BlRaIX7i81TGRgJC/TgZ 4hUg== X-Gm-Message-State: AKGB3mKzt64IZXbP395bS1/9dgEiy0W8i09mhmfFBEvmvVuoO/Glmxax 3APVeQIdGpj4nfXwCnCCgixgvRLg304= X-Received: by 10.80.182.148 with SMTP id d20mr31706734ede.63.1514596175062; Fri, 29 Dec 2017 17:09:35 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:34 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:56 +0000 Message-Id: <1514596142-22050-28-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 22/25] arm: imx: hab: Make imx_hab_is_enabled global 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" It will be helpful to boot commands to know if the HAB is enabled. Export imx_hab_is_enabled() now to facilitate further work with this data-point in a secure-boot context. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/include/asm/mach-imx/hab.h | 1 + arch/arm/mach-imx/hab.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 98bc1bd..5c13aff 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -187,5 +187,6 @@ typedef void hapi_clock_init_t(void); int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, uint32_t ivt_offset); +bool imx_hab_is_enabled(void); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index f39174d..99834c5 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -96,8 +96,6 @@ static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, (is_soc_type(MXC_SOC_MX7ULP) ? 0x80000000 : \ (is_soc_type(MXC_SOC_MX7) ? 0x2000000 : 0x2)) -static bool imx_hab_is_enabled(void); - static int ivt_header_error(const char *err_str, struct ivt_header *ivt_hdr) { printf("%s magic=0x%x length=0x%02x version=0x%x\n", err_str, @@ -419,7 +417,7 @@ U_BOOT_CMD( #endif /* !defined(CONFIG_SPL_BUILD) */ -static bool imx_hab_is_enabled(void) +bool imx_hab_is_enabled(void) { struct imx_sec_config_fuse_t *fuse = (struct imx_sec_config_fuse_t *)&imx_sec_config_fuse; From patchwork Sat Dec 30 01:08:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122987 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325543qgn; Fri, 29 Dec 2017 17:26:23 -0800 (PST) X-Google-Smtp-Source: ACJfBovMkLi0KjqpjoIvLX8lvNKp0pVduIjXXGszcPHo4GpVPkvt+0B+WjMAnglmWZwGJ1eQ1qtB X-Received: by 10.80.186.18 with SMTP id g18mr47652666edc.206.1514597183288; Fri, 29 Dec 2017 17:26:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597183; cv=none; d=google.com; s=arc-20160816; b=vniPV462ja2No2xffYM6NjL4olezI06MNyLv2VHNn3o93C+UMesGw9/I5KslKure18 ruyvHM7v65447DvRM46LlCSVTuWZmc5Sat/tSA5xRo4UgVGKNfVhmm40Co38UfQ5sxmW RrXRU76zRBDpvDMcRJLqgGVDDVcluBqz+7ykqqKxj4tZjPWF1C6gkqImPYDMI+lglYeA Am/cT4m4wPwjOqLPEY7P4iu+4DdkIOhXMthr8ZvIJqpDgKTw/U3OpASBw77dBbmoQpBQ 8aT2iLzy49FTEiTxhsdrTxTcj/+BirRCChe3P01UjjnMB8its0qBP2heFFV7VLHVxVW0 ffhg== 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=H6ga+5CwTPab/65/Vz2+zUTrUKayAVSZWaS5IH+5bMY=; b=lmm8C/AJw9YdU+FxNeLIK6g2bXpR+UmyCKJkJNGtKGtoLBsJjfLSv6mfg+h76AZnpN 6XNM6964kTYPtjYInPodipxilJbU3myFuooD3MFFcAuT/xHKeHMxJe31LPGp08eaJeR7 acOMOi7YJ0JPiPsFFSQAXVCIpcbfREjjVW9hQVDJsAZaVoTQenR1/kAqieC+JQYKpmAy +h8BXr+N15z3RhW8f/k4Bv2YsO5j76f/uyhv8FN55yfjSj4L1GFH4uSV38WN7OypjUCC Tigwit3tBV70L6RwYvFGUX0DquagNZi1kMubg0CVVYoc1mEKNzwo7KPmApVJ0U3eBzVs LQ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=F6XcvDso; 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 p34si6103651edb.413.2017.12.29.17.26.23; Fri, 29 Dec 2017 17:26:23 -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=F6XcvDso; 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 CB85CC21C34; Sat, 30 Dec 2017 01:19:23 +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_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 40E42C21DDA; Sat, 30 Dec 2017 01:14:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D55A5C21DE7; Sat, 30 Dec 2017 01:09:42 +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 E0FDDC21E10 for ; Sat, 30 Dec 2017 01:09:37 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id t8so50411693wmc.3 for ; Fri, 29 Dec 2017 17:09:37 -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=0OzNtKKW8eA9QTNCUSmAY08tn5EebGtHydctN68CMdM=; b=F6XcvDsodq6fQm10E4Dyw6X0VceEvFZntG1OdlV76iFelFBTXBAKLIhyJiHf+TZ2oy 3lyyRU/ZAfV/cNBizNilNH3rnoRXZk5cdF4C4CaH+jvhqxPb/sak+tulhvnnYvy0boxC IfXIi1qGxHXYSzfqbiZyyxNpbUw5X9wObzUoc= 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=0OzNtKKW8eA9QTNCUSmAY08tn5EebGtHydctN68CMdM=; b=ZLO4pEoLdQtElsM1eQFwgMHQ97LrLBt6nAQ5Q2Ha65FDHqirEsKkc7EncLA2IA6mSi dpjx3FuN4yv1f/c5Hu/xBguMlPRNZ/xZmY28eE/S5mTgPsM1X+op+TamlUeVdb0Xp11f PrUGvnv8r2fLxicf5GKCQcNHUYmjIbUB6WCQkjt2DFA6t5+6zNx7eAeS30H8UhbOhbeJ PiPzQ8iKKBVHKetQTAfRf+s+POegsHoh++RN4y1v5xiqGoy1QdVt3lYggF9GymQzKauo B4q0VmDJjOwJ4eU2HpIReZSLtKnUqXj2ElKaeVTWBaE+r6LU8WcryVe+jkH74JgMa2TQ BjcQ== X-Gm-Message-State: AKGB3mKQxOc6u8PBwJVHgasic6rHsYC8X6Uo8xu5RLp2HsMGlfqwPVN1 2hziuzIMDAFU94L17GzYtIcKAo5W5sU= X-Received: by 10.80.168.162 with SMTP id k31mr48705062edc.253.1514596177346; Fri, 29 Dec 2017 17:09:37 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:36 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:58 +0000 Message-Id: <1514596142-22050-30-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 23/25] arm: imx: hab: Implement hab_rvt_failsafe 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 implements the basic callback hooks for hab_rvt_check_failsafe for BootROM code using the older BootROM address layout - in my test case the i.MX7. Code based on new BootROM callbacks will just do nothing and there's definitely a TODO to implement that extra functionality on the alternative BootROM API. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 1f3253e..8d04917 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -70,6 +70,21 @@ ((hab_rvt_exit_t *)HAB_RVT_EXIT) \ ) +static inline void hab_rvt_failsafe_new(void) +{ +} + +#define hab_rvt_failsafe_p \ +( \ + (is_mx6dqp()) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + ((hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE) \ +) + static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, const void *start, size_t bytes) From patchwork Sat Dec 30 01:09:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122976 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5321348qgn; Fri, 29 Dec 2017 17:20:05 -0800 (PST) X-Google-Smtp-Source: ACJfBovL0EcR5U7/tiBa/jlRz5g/V3R8CX5Cd7F8m6mgGfT6Yj1fSgYOvdNN1TAY22r2Qp/YLuuO X-Received: by 10.80.174.201 with SMTP id f9mr47371918edd.139.1514596805737; Fri, 29 Dec 2017 17:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514596805; cv=none; d=google.com; s=arc-20160816; b=FKCXRwC849+L//phbA0b3ZNOqZe6wPrfjn3p4zNLpAbsuMegIDHt1T8VJkZlwjiBFQ WpqbO1JVnGqixCDYsukLdUJ0LiyTtnIU5VVv3gWkcNm8M0Om2/enzFv0y8qYB23ykkts 44jO2zm9+FVR4fT5iTASNbU9A8QTvOUOWeXVOGMUl5TE4YEWO6urwvqvZn9LuY2xA0KH RFWTdZq3p0Glpcu3ZtrbHQg150FFB6HdffCZ91ICcGK2+a1Xm5lCisCiSCVot14MUEpE WYEtOo7BuzfCRDhcbJQjkNzUO26vkw98/pch0TDKOFofJPKR40FTrs8NhzPdhlVql5d2 F4xw== 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=5aAhBf9TQl8mzvVoKIHOndg3Rfe271NtQ7Tokz3atAY=; b=W0r2sqg1tnSJhAr6hMT1XL4HoWS7SsK/wqlVGbB9N6iiGDCuScle5xsgrm6bw5BzlV WCrL+mtPsLmuoky4NFV248CvLsmneC0GtU4qjBRc4junzFL2q6PovRIsdlLXoh2qFaVp SPUjwrrc1L+rNC8gU7/u8wlbMzUfWfk4Maqx5HxOME3W5xoMw0RLoGkw4/M9wPRaldi3 +SO17OkAYkJfuC2gZX0WE6CPG7md7mypmcClMp8wOrPBDBVF9hvaX7sEyA1CUCafFtAB aVnvFjMYUYXaeaEql6SVM3RRinBYhvSM00ds2t9B/NhF3rTeB7sX5vUNxH7RJ1KpQw2r HvrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZP7adtb4; 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 s7si42200edi.372.2017.12.29.17.20.05; Fri, 29 Dec 2017 17:20:05 -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=ZP7adtb4; 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 30A82C21E1D; Sat, 30 Dec 2017 01:17:33 +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_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 87322C21C34; Sat, 30 Dec 2017 01:11:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BEEA1C21DDD; Sat, 30 Dec 2017 01:09:44 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 2C09BC21DCE for ; Sat, 30 Dec 2017 01:09:40 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id 64so50093667wme.3 for ; Fri, 29 Dec 2017 17:09:40 -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=bIDBs87SIUyzKGvj+1kHHmbQp6H0l/o+wbf/3o2tIOo=; b=ZP7adtb458YHTtbU3bSJHA67hzjxx8SDETWB9G1ouiucSbUpgwbmvO4sSxRgYwQzpD FGEV3zOB0yjRBz2NgqPcaVpo6GIYCbviW7jzkFO3qS8PgfYxPyetxhXmzRZALQ25AZ4p cSu3YLrrp+OK0r2NScKy0B+UYRZKXGTZ3sJr8= 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=bIDBs87SIUyzKGvj+1kHHmbQp6H0l/o+wbf/3o2tIOo=; b=ESRI3y+LbjXy0NP00DDhk6Lko8nopbc2LU8vt49CKtu84awsCdyE+Twmqkn15004Br uIlgoLqJQBpf5ZEzta3O8SFHmiPRBdabGy2LcfYcz2jvrYcFKZOtptJdEhfaYYb+3wV9 2uh+CbK7+uDNVfVYMAeIz8l4Xan5KG4QQZG2BDYc4Wd9blcPbHrva/4kJGWPISDPNXZ+ B6nKE+j23v4A780xQowSFLoZbSiUZxXkCeD15/xhlWZJNRp/9zvkDn6SqTXRDnfFcpFL AsiK0eu8E4VJX/83OGVX1tF15cXIt77kayoxJfoJ2AieQhpXKTYw6Az6rDuK8ctRTLhy D06w== X-Gm-Message-State: AKGB3mLy09eBsW7HpBQiq9K/FQNJhqTS1XmsQMFzA6JgLroYSEdgKwT6 2fVUKvqi1XV0narb8whVEyY+XyDEe/0= X-Received: by 10.80.245.237 with SMTP id x42mr46840539edm.80.1514596179591; Fri, 29 Dec 2017 17:09:39 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:39 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:09:00 +0000 Message-Id: <1514596142-22050-32-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 24/25] arm: imx: hab: Implement hab_rvt_failsafe 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 implements the basic callback hooks for hab_rvt_check_failsafe for BootROM code using the older BootROM address layout - in my test case the i.MX7. Code based on new BootROM callbacks will just do nothing and there's definitely a TODO to implement that extra functionality on the alternative BootROM API. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 99834c5..17dac16 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -70,6 +70,21 @@ ((hab_rvt_exit_t *)HAB_RVT_EXIT) \ ) +static inline void hab_rvt_failsafe_new(void) +{ +} + +#define hab_rvt_failsafe_p \ +( \ + (is_mx6dqp()) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ + ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ + ((hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE) \ +) + static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, const void *start, size_t bytes) From patchwork Sat Dec 30 01:09:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122985 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5324199qgn; Fri, 29 Dec 2017 17:24:27 -0800 (PST) X-Google-Smtp-Source: ACJfBovbGYuJIVkEJZtMlptfRBG0JwLGv+2cLB/7SpVyubL1cAUF0fLpL/BXmxTl6CWwO0mLBftr X-Received: by 10.80.182.5 with SMTP id b5mr46874025ede.227.1514597067163; Fri, 29 Dec 2017 17:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597067; cv=none; d=google.com; s=arc-20160816; b=q751lg0/5KwiTKZbUGHtjD/uUgDIV9sNVMFPhnutLHlxk2FjRAPtU9ynApKaKUJ4KA N8DhuMpQjy7hrB79EAHiID4loYlBMI4riN4ur0n0ACaElvpA1wnNPGDWiEegHmhzn2U/ QkXhWfE56UKM7puc3GWYtystyB6IRsU5yqyzL0Tg5Qd3F0O1DhHWPolEgK0Ov3tdcKhY 7eHjlyIoyzIHJwS4cEkVy1hdSgIBu01p4OMgvg8SPNbi0E8qVQoYIwqNpgv8yp65UX4e GW1WS50e+T0GQGmIbZbGbQiD2XOx07DPbSp8pVMiDnSla+pptmbcqIPCv8yAp0tKjXeo 7DoA== 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=GP1lfaSNRWT1Z7xYm1hpfq/e9ft3MV/KXcVJdpqm8p8=; b=FgIQT0Pg1fSxWb6ytOLsuaAObYcbLzc7gtpLTTGoQZfrp6q33PDQbKvDX68NIaDaF7 6ejtrEBLGgqvsgXNo3jfJflmCUg8Hzf6kjZ+bDTPlKAVKxHUyWzV8i1LQ7jjJ6A9t66Y o9c2prs/JomOkS8USZxA+xhMicpwsQ6aRcg3lreG51b7eyFnpE8YwVKkQ8KZmTINBDQE XsF+OgD/Bn+2l5WJSK0jyjA3LwLaLkwZP0+z1OS603beiEUBOcWI/CVlypdt12iuLl53 gxRrWW5/cbfNOhVDow3ZGQoDXYGjve+5a3g93pe8aGhqH3q7Nwa5/6B6g82Tmn/qz6JI 3Vdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fMMUCEZE; 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 o63si6188793edd.266.2017.12.29.17.24.26; Fri, 29 Dec 2017 17:24:27 -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=fMMUCEZE; 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 B138EC21D56; Sat, 30 Dec 2017 01:19:04 +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_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 ECFBEC21DDF; Sat, 30 Dec 2017 01:14:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C4090C21DCE; Sat, 30 Dec 2017 01:09:45 +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 3A1A6C21DBA for ; Sat, 30 Dec 2017 01:09:41 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id b76so50406855wmg.1 for ; Fri, 29 Dec 2017 17:09:41 -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=MgvIrmfm1jMCPovnavZF+skWhR7Gxc7ZMQGz5yUrGgM=; b=fMMUCEZEtp//Qu26Odzkv55jCcBl8+Hi8wr2iMXjFvgSTSKFst8L9Qliks8ZyPpU+e +f5Ubkhl3lhFy3jbluV71Pz2mQYTc+IDWo1RvqqFiS78GaHXKUzr3g2sl/XNGch/i/Bq qzdmpz3qXyODwWbVbCmCScCihHO10G65yBZnQ= 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=MgvIrmfm1jMCPovnavZF+skWhR7Gxc7ZMQGz5yUrGgM=; b=QIVhZASr6LPalErCq17kOwJ0wW9AgFcfru6nlQK5sFb7MOzImp3l2sOG4Wb1GT5UX+ jKjZHgUVI/nVlLhLDg/Ng/KnZqrkFMx5qo9JYpjCSf7Ns36XdZU1YfpUMTM9LEv4JYns QsZGJUgT+OWCZMxEsPJyDAwuXKurnEwUWVBj5eNIHjOJS3V2TzoPKQheqV3omtcrQev2 9+vrLJbFxehMAt8E5H6G1ALNU+Mr0qCAoLL/U3lgOKj0IVZprxfp0mnkiZHPlvigIRDa BwG/ECINpEm7x0PUGqbgQ3mcMZjYEf0d6+U2d8sw97iIWjCRjvNvATgMPUaGCoTd/PYm myeg== X-Gm-Message-State: AKGB3mLWXWfy5H8B+JSLRYMjuHxHz2dotO8GGSotSr1nXApxSO7ETeYk JRl3oDz03ZkjikzgO2mGt2PraojPFAE= X-Received: by 10.80.158.15 with SMTP id z15mr46001574ede.262.1514596180667; Fri, 29 Dec 2017 17:09:40 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:40 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:09:01 +0000 Message-Id: <1514596142-22050-33-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 25/25] arm: imx: hab: Add hab_failsafe console 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" hab_failsafe when called puts the part into BootROM recovery mode. This will allow u-boot scripts to script the dropping down into recovery mode. => hab_failsafe Shows the i.MX7 appear as "hiddev0,hidraw5: USB HID v1.10 Device [Freescale SemiConductor Inc SP Blank ULT1] " in a Linux dmesg thus allowing download of a new image via the BootROM USB download protocol routine. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 17dac16..79ee4d5 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -414,6 +414,22 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, return rcode; } +static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + hab_rvt_failsafe_t *hab_rvt_failsafe; + + if (argc != 1) { + cmd_usage(cmdtp); + return 1; + } + + hab_rvt_failsafe = hab_rvt_failsafe_p; + hab_rvt_failsafe(); + + return 0; +} + U_BOOT_CMD( hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status, "display HAB status", @@ -429,6 +445,11 @@ U_BOOT_CMD( "ivt_offset - hex offset of IVT in the image" ); +U_BOOT_CMD( + hab_failsafe, CONFIG_SYS_MAXARGS, 1, do_hab_failsafe, + "run BootROM failsafe routine", + "" + ); #endif /* !defined(CONFIG_SPL_BUILD) */