From patchwork Fri Jan 12 12:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 124328 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2024374qgn; Fri, 12 Jan 2018 04:53:04 -0800 (PST) X-Google-Smtp-Source: ACJfBotilZzSQ/LQZLoYRYsVG2Xme+pmgEQs8mUqSZtnZZI/gRgbD+cYcdGoFGiDGkmD2JDcjSkg X-Received: by 10.80.134.132 with SMTP id r4mr8537520eda.250.1515761584342; Fri, 12 Jan 2018 04:53:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515761584; cv=none; d=google.com; s=arc-20160816; b=joOTXu0UbKI0z0PaMKk5zM8amS7p+Duas3uOOMsF6c1ZU2ouFAaskoJvqhgKw/9Hyf vQvnGG34KFmzpMMqJSa7PwI5I7ngVBZLDNnfzkbftfzWfCc2X6IMjfQjI5DTW9GV6zLm uCFKXKdGHlolLyxhohuCWMHbhKfzIvI7ZPXufp43re4hRwCZUFWkjo4wYzSn/MlrAWiV kU3HSVhYjb7F0VBMPHsWXnQm50+JdVK1XB/iM3s7samufzKknl/IgTi7glgRizGWONSn +ykovAP/b8BtWNnYoJeHLUVJo4hqi3t1WI9A/oPjOPGv0QfjZO6hcCD8KFpOMGtnt5kz PeEw== 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=ukF0jHBIPDm1jpWdJoR6NhTohFbNH7w04wTMVqP2S5A=; b=0rHLV7W3ZITE8BsTlX7s8KB0RqXrOJoFTo2F/sgv6gLtmmomDaxYKe1XndjC7pDkCj kqPUHw1EubLUdp8Mh/3JAGp6f/786h+Kqv/EeCe7zlk2m0PfdCo7Y56T2J8ikOBa2BUj JCXrRxMGKu4HDlT1Hm9n8Nim7pZzCzoLUhpezvkfTpQm2dVhqW0dOJN33EuO0OS+QLKp CqFmabcsbnm7f8XJt9Mm7ooxR7132JCdx2Zx4/NpeO4ToMQ6kJi6Pkk2beR8F/BUn567 SQJP/XNe33V0Xh6gqmFxw7PIB9f2QubMrI3chm8PEyCT8ODjqLJM8jwPmKLBUIUGS6X0 AbsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LnPU+kj4; 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 m57si2592467edc.116.2018.01.12.04.53.04; Fri, 12 Jan 2018 04:53:04 -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=LnPU+kj4; 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 E04C8C221B7; Fri, 12 Jan 2018 12:44: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 81574C221A1; Fri, 12 Jan 2018 12:41:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D2828C2219C; Fri, 12 Jan 2018 12:40:48 +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 0F503C22167 for ; Fri, 12 Jan 2018 12:40:44 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id b76so11630126wmg.1 for ; Fri, 12 Jan 2018 04:40:44 -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=QgK0hPCAOdChljl9zgGFLZ7VnJmBSqKIFVuJg6jNtjE=; b=LnPU+kj4rBR1dRfeQxWUj6RPvUEpi/1o6SJNNmG6vyvmXrS7m/7qaxFWzD/liPJI0D cFNt0EFYzGtNDmDXdoYhGxX6rhJo12HT/Pf7OkZj+bDmBQxon6IKTnaY0pZv30kybaaO rcZnFVND66suwlrmoyJeLWVn0nVxsJNO3N9po= 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=QgK0hPCAOdChljl9zgGFLZ7VnJmBSqKIFVuJg6jNtjE=; b=o8juBJ8DVXynbbNZ5h3GBRibZNXbZFEQVHrLh3Wrohqsj1syszpGxulci2b2O8UO+J VWJXqTw6VETyEcbtul6Ym8hphkFl/JdZvR+0n+Auo5g2FEjjPdeiqmrzIiMZT2BBRsOc c71jGkZD/LTKEBKC1oINpXtUa9eY3GZ25okbuOayJIrnNDdPB2CTreueo4Pif6XNXHyS F+0QQAGO79gAFleYgVKwW/+eSPsmkheR/p3UNmqZSArzC7AiggIHvpAUcrihv/L2iax9 IAUatYpzK8uMrHL1HwAU8Nxi0Q++jtsqcdDUAWYdyVt/UhlBYbWDp14UXkd2B+kGxRgm ISCg== X-Gm-Message-State: AKwxytcSFj+zo4ANuM6Av7iekzu2lZrpGwClIePRMEaLF4O2yxIAhjvF OfWbKlRq/6TamO/oaGoieePnmWQoGvc= X-Received: by 10.80.245.172 with SMTP id u41mr16883965edm.163.1515760843570; Fri, 12 Jan 2018 04:40:43 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w2sm13893585edb.4.2018.01.12.04.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:40:43 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Fri, 12 Jan 2018 12:40:11 +0000 Message-Id: <1515760819-15116-18-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v6 17/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 Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- 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 079423a..3ae88a4 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); @@ -543,12 +543,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;