From patchwork Tue Jan 2 16:44:04 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: 123166 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9177380qgn; Tue, 2 Jan 2018 08:53:58 -0800 (PST) X-Google-Smtp-Source: ACJfBov+wTmDyN7X63N5Fbsdoxu+rJyn4KJQIx7wK8AyR7d5eWUnoQQjXpYlEfyJKa6DjjSYs+ha X-Received: by 10.80.172.29 with SMTP id v29mr65548564edc.143.1514912038132; Tue, 02 Jan 2018 08:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514912038; cv=none; d=google.com; s=arc-20160816; b=wYkppXzhIv8Wnkl4ojMGHuryABjt3PshK7A7WE4GTv6KHeYZBgPFW7uIONQlgf3IYf dtL+FTHKe4o4b1SepOCShx+vCkdAKVuLMGtJC8tJB1DDaL2p6f9rEGkP5CVsHCAHBbhX Ni2SV2MCdYbaNeKSvQlr9tMpyoWpiZhS1vDIDl5CYg4drZe/UNIkb//PS2ZPG9BQSgfU agfx2hodL0Ng1w6a1U674WsruV1X1vNwJPcNyJZHNQI6LbUcy243GrCC3C9llj0ZnYof FvtAem4fmYER2qOB6zq/a8zkLuUTbcgWaA0k3F4cff9B0yJeC+95MhUKSogQIh4/DUDu Ae2w== 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=ItI2tIqlQLEAhVyr1czhJ1LoO79Etrz9dRko+AxlCJMEm1/hvIWOBLJ9NKPnxufjGK BEhycB1jVh/ZWnEjT4WEiLCOiv2MmkGAe60AbJOu/fd11fLc7VQ0sUgva8PQ7TVrWYvw 1qBvQZn2UeGLlcNpTvm4UnkvHxU7Ewqg3KIK/TmcYt5dbaKc33RzokxWXVP87lk0Zp5/ shoRM0wxdhgkCbStB6Y2uAvuHovA1WcgMv/4hFXd/RJyQY/hwDgHBSF1pfCdrEEOaj+t G90GhfWpMDPKrIwudydscwgrJ/wqrIck5fFXBo7KYseCL3ZlUvAvLORkvqkLSyQy4dly tW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Yy+huwBY; 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 7si116305edh.195.2018.01.02.08.53.57; Tue, 02 Jan 2018 08:53:58 -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=Yy+huwBY; 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 71729C21DF3; Tue, 2 Jan 2018 16:48: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 391C1C21E39; Tue, 2 Jan 2018 16:45:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 88786C21DC1; Tue, 2 Jan 2018 16:44:51 +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 60FB3C21DE4 for ; Tue, 2 Jan 2018 16:44:47 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id f140so61721879wmd.2 for ; Tue, 02 Jan 2018 08:44:47 -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=Yy+huwBYKgpJSRBEC3ddt5Mm0v8Fp6hX0xUvClyv8N9vTP9rQPpzOuLCdj4ybBxn42 +x/dhwdt5cNuyl30qlH6KlsNGKjLbS9mgYZYN8ri5iCEWSboDnaCzTeS1D7Tl6/+fl0O 9OLwpNoPDuMmWGQmnlwXnp92JKPU2xVFkAsZc= 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=XONQk5Ih4LRDjyidLOfPV0JXuxIowmwGwHx4YfSqJEn8z9Iw/r/78PLWV+MRjNn1VB Jw4qEpp1jFTdiG5wv7rmUjWITFz1ZBuK93iSm8J+yAPMk/QE3GnsDrl2QyboXYG4mWgO fER8Il0PE+h57dJZTLczFQuKZR6WKnrZMjXojqvkDTgcf8u9xrk8r8glLoQMtSvRVFRU SbH/7I9tKiRJsib5E2YzUtWeTRRJxDkW+nZfRdXRcwxykiJkkoQq1HvcHIS0/vw5D6pH m6HGKm5OEicVfSfZscs8e39Y1W80GgAFkisl3Bl04dMaLRS8aoVpnLzlgFkjXT6DR1JA bE2Q== X-Gm-Message-State: AKGB3mKb2kWXka5zbLMra3wNP1hKdw2wEeXTYnWwnzLGcpnSZoFzAyZa D/FiP+hCmi3YEARdVcMs6iRVm9TQzRY= X-Received: by 10.80.166.222 with SMTP id f30mr63288360edc.278.1514911486656; Tue, 02 Jan 2018 08:44:46 -0800 (PST) Received: from localhost.localdomain (D4CCACC7.cm-2.dynamic.ziggo.nl. [212.204.172.199]) by smtp.gmail.com with ESMTPSA id z5sm29850584edh.76.2018.01.02.08.44.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:46 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:44:04 +0000 Message-Id: <1514911451-4520-19-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v4 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;