From patchwork Sat Dec 30 01:09:02 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: 854063 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ji+evGHi"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3z7mJQ1GSZz9sBZ for ; Sat, 30 Dec 2017 12:36:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C46BFC21DBB; Sat, 30 Dec 2017 01:23: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 DE897C21DC1; Sat, 30 Dec 2017 01:16:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 93E90C21D9F; Sat, 30 Dec 2017 01:09:46 +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 5474FC21DE6 for ; Sat, 30 Dec 2017 01:09:42 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id 9so50426254wme.4 for ; Fri, 29 Dec 2017 17:09:42 -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=FiTl+PDSv2E3GEbzMfn5XeLb/LmhN/RjJtnJZDm6YPk=; b=ji+evGHirCST10GpFszmej4f0/dIoZh63mwGzSX+yW76nTZkYlv0NskgFCTRXkugS4 yLd9EepGVr8I1F/q2zVIrJXp9WjX3w/xLWINfjvh+1JXu42niTLEPZ00b6r4SSIn/OfP YbLU9nV8CJo1r3EuZGd33wckSOSVS4WRX3JnA= 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=FiTl+PDSv2E3GEbzMfn5XeLb/LmhN/RjJtnJZDm6YPk=; b=hJy9xGSuX1u6Gf8P2tRA6K/4OwKqG2AX3K59VLJjDGUwBQyDtvMZw7wmu90aQ1sk4d JSDLyp8ntm7ipx7xeTSsck6uwua6c2xZ+xmCBb2OIyzl8BFBAxK7Ezf6y0MrPmOxAOBS n3NXka6Z8eYmuqhNa3opKFmMLPw5jlda22Ix2oql4h/0Et7o3Rh2kIziffJC2r5tZ5+D /r6vc2PCsB2WGt/4OQKwHqoalxhjkw/eEXwQ+J30BqvL4m+VWpOOoYYmJLY6C0CjqWnn vzcfQc9RPBoHgZtgdHBT5pBA1FjWPK5+QVTXoCMGe5lGlMUBb//1NGj4zyiKUaqCdh33 GZEQ== X-Gm-Message-State: AKGB3mLC9okpAKxZ6OUB/yN6YfKFXQrKi7V/DScAsDqnh+p5BQtu7UIx J0fCdPVpHcOALT+Zq4v6WB4xAx0mgGw= X-Google-Smtp-Source: ACJfBotP32PbyoqjZX8ovLSy4rzhcqYRCmvictUoZ8rWFgB6R8q6+vLH1MBp5t35jFkFsA9UyGdEZw== X-Received: by 10.80.241.72 with SMTP id z8mr47868162edl.35.1514596181779; Fri, 29 Dec 2017 17:09:41 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:41 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:09:02 +0000 Message-Id: <1514596142-22050-34-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: 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 5da09d5..79ee4d5 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -521,14 +521,14 @@ int imx_hab_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); @@ -601,12 +601,14 @@ int imx_hab_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;