From patchwork Mon Dec 4 21:28:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 844466 X-Patchwork-Delegate: agraf@suse.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" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="q8jf5c5F"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yrJ4w3R8Cz9s7f for ; Tue, 5 Dec 2017 08:32:48 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CEC6FC21DB1; Mon, 4 Dec 2017 21:29:20 +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 23A76C2205D; Mon, 4 Dec 2017 21:28:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E6B72C21DB2; Mon, 4 Dec 2017 21:28:41 +0000 (UTC) Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by lists.denx.de (Postfix) with ESMTPS id 407D5C21D79 for ; Mon, 4 Dec 2017 21:28:41 +0000 (UTC) Received: by mail-it0-f66.google.com with SMTP id d16so10235041itj.1 for ; Mon, 04 Dec 2017 13:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=13Dn5HxIfUmNtPoTSshZVbibHzzn3gDo/Hvbf12p9n0=; b=q8jf5c5FIur/Ju0K0IsmkBGxo7ZeleNjL264ZTjqhvXma5DyErWxyhP1TGvT7MrNGp U1jPrPD+LcFbnmiiKBaouR8nJotqCY/orzF6aPj367A2k++58EmMR/6INoJV2H6GTV3L kiFSA4gdqLOwtAK6qt71pJRNnKcENcrdUD/ZCGaKFWW3gzvVkGYAbxyU5v15lnoXf2A8 pqCQlgLmR1ClELfVqmESYaOxy57jHN61WkR3fAtuZYvSq+CAsKZxdp8GJqTYjX0ebOif fA/YJ7mHoP38v78nl3SaQWA+oFnPPRipD8G5eJIRU20ZcSSh6uT/FE3j6BOX8nJEJB6V Q2oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=13Dn5HxIfUmNtPoTSshZVbibHzzn3gDo/Hvbf12p9n0=; b=WPOeZG/IfMHNYtBqFYNIkQgPGoNsk6wrV0lOA4UOzB5IhhitUxRbK5SpU0xJc+XyBP pkLEOncnKW+p/ZgnvXXzWaedZRWbNFATTtyMFtteCnRXZIa0LV+E40naNHJShkjZfGI/ CunkyITBBuykuXi3ilmIZs5xsEIMCog5iY3o15GnP4M60DzgDgc9CENxECZo0BD+rw+j rM6HLh1ZNRFTx+po7K8o/DJW9ZRehmu2eQOJ/dnEaIEPMvYv7pV5sQ9A4gKPjGqNBafr 72wNaAeh587390IuFWdLeESYs6Qu1WgBeyXa9UqVuEuF1YHSN5K7mTDrfpePHtKu9shV sYmw== X-Gm-Message-State: AJaThX42VLEQvNrgnrryrVHa1zdVyoZg0H9GiatYkhU64XJWMPT4ex80 OXyQ0waxB6Ogvg4woRLeCO2P9g== X-Google-Smtp-Source: AGs4zMYnp6YVaE6oV93UweVuRdtTq8lB6zX/NkxRMxZdqehtMDllB7o9Oxdp4EzR3WzcIfuDSX2d/g== X-Received: by 10.36.79.75 with SMTP id c72mr14682190itb.146.1512422919763; Mon, 04 Dec 2017 13:28:39 -0800 (PST) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id b195sm6703295ioa.43.2017.12.04.13.28.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 13:28:39 -0800 (PST) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 28E20143C43; Mon, 4 Dec 2017 14:28:38 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 4 Dec 2017 14:28:18 -0700 Message-Id: <20171204212832.130100-3-sjg@chromium.org> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171204212832.130100-1-sjg@chromium.org> References: <20171204212832.130100-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v2 02/16] efi: Move the init check inside efi_init_obj_list() 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" Rather than having the caller check this variable and the callee set it, move all access to the variable inside the function. This reduces the logic needed to call efi_init_obj_list(). Signed-off-by: Simon Glass Reviewed: Heinrich Schuchardt --- Changes in v2: None cmd/bootefi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 478bc116e2..17b26e6f4e 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -28,6 +28,8 @@ static struct efi_device_path *bootefi_device_path; /* Initialize and populate EFI object list */ static void efi_init_obj_list(void) { + if (efi_obj_list_initalized) + return; efi_obj_list_initalized = 1; efi_console_register(); @@ -208,6 +210,9 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported", "{ro,boot}(blob)0000000000000000"); + /* Initialize and populate EFI object list */ + efi_init_obj_list(); + /* Call our payload! */ debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry); @@ -310,6 +315,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Initialize and populate EFI object list */ if (!efi_obj_list_initalized) efi_init_obj_list(); + loaded_image_info.device_handle = bootefi_device_path; + loaded_image_info.file_path = bootefi_image_path; return efi_selftest(&loaded_image_info, &systab); } else #endif