From patchwork Mon Jan 8 17:36:34 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: 856976 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="f9KHRAA5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zFjQn03C6z9s72 for ; Tue, 9 Jan 2018 04:47:28 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 720B8C21FEB; Mon, 8 Jan 2018 17:42:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1229DC21FAE; Mon, 8 Jan 2018 17:38:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E8E07C21FE6; Mon, 8 Jan 2018 17:37:10 +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 9AA09C21FAD for ; Mon, 8 Jan 2018 17:37:06 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id 9so15582756wme.4 for ; Mon, 08 Jan 2018 09:37: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=Crzcl5vGLNTooJvTdxZP5MJU1CXxtX02gxTf9jN3CPc=; b=f9KHRAA5UpiuxnPQV4XBXrIFhxNORbduWh1/vjDZjJ8cd4/QA+HG/BTgluou/qrHjQ eMsCT8uwSzqI6sg3KEccz3uiF1gtQNPhXdRcDKZfzlurB8DXVefGenMuYTNLOJJdYaLC 7pQLbrpiCpbe80eu8aRw0i4e2ljVh9hif18qQ= 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=Crzcl5vGLNTooJvTdxZP5MJU1CXxtX02gxTf9jN3CPc=; b=a86bFN31qAiFD81jYGutjkKIlDAlXYtTfspwEODzc0/iNzcaeEMnMo8vaTZlWkgetK LPdEzY5slHI3FkVtZaEglwP69VMBuqc983E/S7WLgA6pwF+3tO5C1q1jT/crczVbo4Pf nJU3wiNXQQhAYwghoCMVfaZ4xsXRP52eWdQWgNRmlJao2pQivon4k7qf+mnp8oh2rBPS Izf7ih4yw8eAwLJ1iM2mX7D1wWRpFuR+Pu/Wic7OK8MwYX0riQj4aYbZce4wZpCLJRPy lZWFRiiWFyt61vov6xLnMTG90/8EgIOpojUrRXjG2D2X5U/FXcSxMDWVieJwrqpbnSnz fqNg== X-Gm-Message-State: AKGB3mJTw08YKsmg7i+eGswNYDcLxElHAOI0GLmVYkngKPFmrrlQEhBN VI5VVtUpyiX3KWoIIfKEXsKYFuqUF+U= X-Google-Smtp-Source: ACJfBouMDZPbnd2N8K8NVSf8sA+5uPVbs+MgYVar8qUd8BQURNFCW9WgCTy3hC5Iqj8cvMwJViOrsw== X-Received: by 10.80.153.93 with SMTP id l29mr17300699edb.245.1515433026006; Mon, 08 Jan 2018 09:37:06 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:37:05 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:34 +0000 Message-Id: <1515433001-13857-18-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v5 17/24] 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 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;