From patchwork Mon Dec 28 12:24:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 352616 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9706330jai; Mon, 28 Dec 2020 04:25:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJVCD1tjZ2LHdMotaa0NNW44PE0SJsLWmOeajaJj82evHvJj4EssIjv6c6O5JbUj/Fd6e8 X-Received: by 2002:a17:906:add7:: with SMTP id lb23mr43510703ejb.352.1609158358656; Mon, 28 Dec 2020 04:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609158358; cv=none; d=google.com; s=arc-20160816; b=nt420MjMxh7f94B5A5Y8tor798IOX1zsKLzu7x7jPr7QPb0ATFMaD0Vm60YRewDrlc seWSWAZZG0baum8bInWoLZejTSjZgRagjABcUV3DugbuHb1ChLoCwWp5NHdSrLOKTx99 EfIs1r0w+1coWIk+FESCzttXE82k3O8e+vUrbD5KHF57gfCo3k4qrg4Y/8lhhHaHUDTt Fhjnj40+40Tu4LKb7mW2hkKOszcfwFIFF6XjUXmPBjmPomQqpJlco+ojEof+atzmn/SL KluZPJ1K3hu8WaG7d3RVxI8K8ggOIKSjFZVLiI8IaaEmELbVRYo/2FPlC5RxnEwpvdue VTGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yV7N0Ok1zSV8fDFf6PB/WUDGRTJRez5FG/AXMRuxEEc=; b=cKlWmx8vbpDvoZTMPZDvx4fLcc3Nyf4c8h9Inj5knIQG77QczHjj+xwyMYDG46cz7A EsNgLEgPXSBaVy2E06fObz7V1jNlZMoQmLSpGO/SBWt87JgEJHmVJNhJcDA1avxJo83i 1ikgKoCms0NlGWgKGTMYoPaULMYiLwmDb2tn3SLfm7EaYTGEIyBJb3Hf24lQcvIE6i4d sG16NTs8qQf5khKU87TfjkDFXzcXssMYPArW4dcCqm11QVNDPizRy8uwCvYy6fRId/ae vVk4lMo5hUZYr7i9z+Ikyd+MQkfpfgWobO3J6p8BK/n2DUpd2x7ZCKAd8BKsIdHodbXZ WtmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zvczVNbV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id cq3si20245382edb.72.2020.12.28.04.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 04:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zvczVNbV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BB8FE8257F; Mon, 28 Dec 2020 13:25:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zvczVNbV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF803824C4; Mon, 28 Dec 2020 13:25:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9D356823D3 for ; Mon, 28 Dec 2020 13:24:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x32b.google.com with SMTP id c133so10236270wme.4 for ; Mon, 28 Dec 2020 04:24:59 -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 :mime-version:content-transfer-encoding; bh=yV7N0Ok1zSV8fDFf6PB/WUDGRTJRez5FG/AXMRuxEEc=; b=zvczVNbVBskd5q9UG++mRUa68AkssOo6rSSZLdLXryeBY2kTjeX7aAIVMy1Eg80I+9 GcHUm1ci/NBDzWUzKhi8sSy6UNnWSJ5G+zGnfa5IvrO8avnzajbDre5oExPfCgzWwZL/ ouLBZrcMAfmtVXIKN9PiEoFoNqiKJTFG+fBL7YN2E2Anlzsdof1Rpe53W79DZXQU5psO bRLP3vTp3GCWcmW8HVQPtXKu5eq03s13hk3PQ5/QHRxtA2vl1ovHJF1Ja+AZODb9fpmN WZkqwJtBw5csBx8KGfkKD7teEQzavuIi99SdTFRIQYAebN6fwiVjI4qhbOuQHkxxL6NC j7lQ== 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:mime-version:content-transfer-encoding; bh=yV7N0Ok1zSV8fDFf6PB/WUDGRTJRez5FG/AXMRuxEEc=; b=lWDniSCxpJevHptUtc/+Ep5LQqgCbkzUFrYAXyBZz+gIiUeeAgXclf95KiWmK1pW3w /MX2P5Lne6XYmboSY/kCu6qhFfdDF7bIL0j2RJhxV3txf6U+KkNDHmjFBAaokI1B9uhe vihDpO4yf/KRGs1x3Bm92BRnPy2EgzU5rnE58wERNVZleIzGJvqnbnb0To3BoVO5oDD5 pvB3Kmb4BonK3o5tZ8KiB3N7eorloo7YpQFgZYuSJfWy+cSa5WXaupuwjcLpCju5/S+5 +hJDXr8wg/jBRlZyELkpE+dtgjcWoywKAPSNPaDm2DNTvaFxP/GnwxWNPT6Oa3P/GmH7 4TKQ== X-Gm-Message-State: AOAM530QfxKNOuIInEHdkiJ5d8o1sRazAKsFPzIYFis1UB78RnZIsQdF RFNGw/s5lnKJyO1pFfsb42Ol+lePXqZsmZXh X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr20613781wmk.31.1609158299180; Mon, 28 Dec 2020 04:24:59 -0800 (PST) Received: from localhost.localdomain (athedsl-4484548.home.otenet.gr. [94.71.57.204]) by smtp.gmail.com with ESMTPSA id w21sm18710321wmi.45.2020.12.28.04.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 04:24:58 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: takahiro.akashi@linaro.org, ard.biesheuvel@arm.com, Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [PATCH 6/6] efi_loader: bootmgr: use get_var from efi_helper file Date: Mon, 28 Dec 2020 14:24:38 +0200 Message-Id: <20201228122440.316403-7-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0.rc2 In-Reply-To: <20201228122440.316403-1-ilias.apalodimas@linaro.org> References: <20201228122440.316403-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean A few patches before we introduced a file which includes the get_var() function defined in the efi bootmanager. So let's replace it here and use the common function as much as we can. Signed-off-by: Ilias Apalodimas --- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_bootmgr.c | 33 +-------------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) -- 2.30.0.rc2 diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 793e5b7f8730..d21d57d5811e 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -21,7 +21,7 @@ targets += helloworld.o endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o -obj-y += efi_bootmgr.o +obj-y += efi_helper.o efi_bootmgr.o obj-y += efi_boottime.o obj-y += efi_console.o obj-y += efi_device_path.o diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index ceca5c5b1bf3..a175842ae053 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -166,38 +167,6 @@ unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data) return size; } -/** - * get_var() - get UEFI variable - * - * It is the caller's duty to free the returned buffer. - * - * @name: name of variable - * @vendor: vendor GUID of variable - * @size: size of allocated buffer - * Return: buffer with variable data or NULL - */ -static void *get_var(u16 *name, const efi_guid_t *vendor, - efi_uintn_t *size) -{ - efi_status_t ret; - void *buf = NULL; - - *size = 0; - ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL); - if (ret == EFI_BUFFER_TOO_SMALL) { - buf = malloc(*size); - ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL); - } - - if (ret != EFI_SUCCESS) { - free(buf); - *size = 0; - return NULL; - } - - return buf; -} - /** * try_load_entry() - try to load image for boot option *