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: 122996 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5328391qgn; Fri, 29 Dec 2017 17:30:42 -0800 (PST) X-Google-Smtp-Source: ACJfBotuWzNCtVqcykMBlnbK8TbJIMX/2n2vIhyHz79aahg5++llw4dpgZ7jEZBX2QbMqpx6quri X-Received: by 10.80.159.3 with SMTP id b3mr45433565edf.163.1514597442458; Fri, 29 Dec 2017 17:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597442; cv=none; d=google.com; s=arc-20160816; b=Zim2Eybj8CUqjbo3qLoOnNDpZtWjywXAy7WEkxwL579ipT5+JLF9Io4Pw65X2YKPPg MTQ9D/vSkqzvxumweyKZa1hxb2rvdGE8/qKWtetJSB8tPVFHTtujqpZd50su/opztLVr cb2StlgIKLC7NnWb93e1dbaRj1huA1JC2JDFal7lrtcLs5DExtqZj7PgYbLzsqsyQEnL NciOoxe8kkv9p9L+j9OKMTUDl2BxLQHA+yfV+JrQUKqpp3fs9NmKE47xdUcw9Q/gc/H4 zZbECh1fdmJAcz9gQWBGnMDod8pOopbeY1hUakQ/6kugVMDzKy+9l2bT+J8GyDY1I/TX M8qg== 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=tqJu2FXTh8gifzZiAvtE0svtukeMd3F1lwh5Zn5xI/Q=; b=VOnuXsqGNLEhvtub70AnBEt4BONYvt20a1R5ebqpsvb9NQpU7lr0luKu5XnosStGbt dZ/xZEzu53/S0vOlP8kdep/1WOgrdh0lC+HB5L5zfdLlewH9D54zPG1xmMiNE3HrPHVi +boxsru+5dpi/2lx8lNjkP56rnR7Yno0SOAylKPRfLeXO1Jt+xMw+69PhZXMdP3n/R4f lK+xmNrFbwMmxDoEAIloOBC7S5VpDsz0Z5IJIPrMoOIJtdNO6QGQjCYgU34BigAQ4WwJ UF0CrnA8rZg6PNbxZsbG3QNnmXnU8h+1mN8IsxpwsCb4m2NQedQcXp1EbGeKJMnvKdsw B6Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ji+evGHi; 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 b15si7627590edf.329.2017.12.29.17.30.42; Fri, 29 Dec 2017 17:30: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=ji+evGHi; 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 1AD84C21DA6; Sat, 30 Dec 2017 01:23:25 +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-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;