From patchwork Wed Nov 16 10:28:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 625087 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp187098pvb; Wed, 16 Nov 2022 02:27:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7oMyBZE9zhSS0yaoD2I4/3vbRIhzr7FOVJvZAPKUMS0geZjlvTR4iNui4Sul07EF8cZbYf X-Received: by 2002:aa7:d74a:0:b0:461:5b75:d3df with SMTP id a10-20020aa7d74a000000b004615b75d3dfmr19081341eds.367.1668594423529; Wed, 16 Nov 2022 02:27:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668594423; cv=none; d=google.com; s=arc-20160816; b=QkCfZmyCQwRORMkdykcJcBuyQ/BLyci70ojcXw/ShlnsJj/B3dZ/EosA+KCPsZ4/38 vB9wPmE1EkMxOVRX738qQu7mHEFmr535u9eC0WjJXIGKeyAQGgNqBNe1cqF3nCDLOHwh PKewHPNwOqzsv6BegcdXT5x27AV/MNnmi9OD1TgwqGly7C1KP4s9Ayvkc8lO0l5LIV7b Aw9Jr7zrH1l3L+jAZ7pGj136AzwKOgWN3WvleNiYV9ecNFblKnIvReBXCJuajryk0QVe nVSvfAabLkupdARA4/a1ibP6GEg+0nWJ7f9lsKgiv/2GaQrGfQG7sZVhSSymcT3A3cgy tFqA== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=AfrTGOVjXZk5Emcdb7DI4v7ehidkIRPMu1VV3ahU+RI=; b=dvjVBgWDoto1lTeWKcS3v0rubMRUU2SKIUljywKwHpHSJBkDcK2rV0VXvepX40Nnc1 815xaKtr2c+qPXBy9iY96k32NzFWWuMURfW4tv/qkxvao7DtJXKAqeSCGWwt6J0DHX8T bhbPddDBQy5CYorJ2cOPyfcvPbC94hap23u5eTYeILKFfK+vtUjXNDfeOU7MLPo7wXFE EsvD/zoDNYVovJJTSek5Izrbqfe332OPWI6axJqyos4zGJVy9Jldi3KqrhaXXW1yItYg SCMHQUZccFuYVdWo0/EAAxOQ0X3QwtLBX5fye+OKcx0sjNwqMZWhTzc/leh1VaCdBo+j TZRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hqJUG35t; 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 t26-20020a50ab5a000000b0045cafc51fbfsi13720639edc.525.2022.11.16.02.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:27:03 -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=hqJUG35t; 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 AEC31851D4; Wed, 16 Nov 2022 11:26:47 +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="hqJUG35t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F2B01851BC; Wed, 16 Nov 2022 11:26:45 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (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 0EA38851BC for ; Wed, 16 Nov 2022 11:26:43 +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=masahisa.kojima@linaro.org Received: by mail-pl1-x636.google.com with SMTP id p21so16013027plr.7 for ; Wed, 16 Nov 2022 02:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=AfrTGOVjXZk5Emcdb7DI4v7ehidkIRPMu1VV3ahU+RI=; b=hqJUG35t6kihe37OYZla0Qqgs0af+RGIJxQHoB7TSuGVWsrEnWbuQWgzqkWpbkELwI Io3lZ7zN49vKNYs9aNGAz99eWOBndaEnIcpZ4+piz1TLQIVQsR1rBKKhH+He+K1NaCTz LNHlWip7sYj5ExVP4aqxV5yhLoMieYcaXGhLP0YxObR8mZrzPVyDSjBt5I1Zc/RDMgAZ wD9PXFVSn+GfMizhwi5LVgOjFiN82AYYJcuZV2WYR4HW0P9zZddiUWtqtaM8U49nRCce o7DO1cl6KGf2bml2G1DDm0SK4vQzrehjUTJgvnGujdOOhFmJqEuaN8IFSHapTo5OUKHl Lwgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AfrTGOVjXZk5Emcdb7DI4v7ehidkIRPMu1VV3ahU+RI=; b=JYQtLzcxAcjR0Yn7gvcPvlh40ovxJRqE4fCgj6BDmKJNYk78BNnVxm5fnlIZNWFgPx zRCWGUqmTGye8/zGD2nIqDYUvO3YLD+sz7UUYYmw+wjMfb2Dngdfv9bgBx4h8mwXtt3N 9Gfh8EjrSomzXsPqx+F1XMPHRJa3AKti2AIGBuST1LJdR8uwnGV4Rt6amoOFbMm45lcS ZAcZ04JXZq/DUD7UALzmq0MLhqTg2nQMMy2VbscseGVJbAUowvKgn5fBCg+u5yu5ofro VB2LO3iR5bFaYctmF3m49RG37utX4Dpb/DfDjeZ3BbbQ/tGhIAbLWa1hSQFGiRYQNX8E OiZg== X-Gm-Message-State: ANoB5pk0TbasgVRLYTu5ugD0qIGX7Y7Ze87y6fdNPpym62gYhvOZG66G 0fiAf8e8GdZEA2DYQyNIqz+XDWwx3xpX5Q== X-Received: by 2002:a17:902:b201:b0:184:e4db:e3e with SMTP id t1-20020a170902b20100b00184e4db0e3emr8290570plr.47.1668594401039; Wed, 16 Nov 2022 02:26:41 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id h7-20020a170902f7c700b00186b945c0d1sm11763994plw.2.2022.11.16.02.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:26:40 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Etienne Carriere , Masahisa Kojima Subject: [PATCH v9 2/5] eficonfig: expose append entry function Date: Wed, 16 Nov 2022 19:28:17 +0900 Message-Id: <20221116102820.21021-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221116102820.21021-1-masahisa.kojima@linaro.org> References: <20221116102820.21021-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean Following commits are adding support for UEFI variable management via the eficonfig menu. Those functions needs to use append_entry() and append_quit_entry() to construct the menu, so move them out of their static declarations. Signed-off-by: Masahisa Kojima Reviewed-by: Ilias Apalodimas --- No update since v7 Changes in v7: - update commit message newly created in v2 cmd/eficonfig.c | 32 +++++++++++++++++--------------- include/efi_config.h | 5 +++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 571e2b9ac0..b392de7954 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -263,7 +263,7 @@ efi_status_t eficonfig_process_quit(void *data) } /** - * append_entry() - append menu item + * eficonfig_append_menu_entry() - append menu item * * @efi_menu: pointer to the efimenu structure * @title: pointer to the entry title @@ -271,8 +271,9 @@ efi_status_t eficonfig_process_quit(void *data) * @data: pointer to the data to be passed to each entry callback * Return: status code */ -static efi_status_t append_entry(struct efimenu *efi_menu, - char *title, eficonfig_entry_func func, void *data) +efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, + char *title, eficonfig_entry_func func, + void *data) { struct eficonfig_entry *entry; @@ -295,12 +296,12 @@ static efi_status_t append_entry(struct efimenu *efi_menu, } /** - * append_quit_entry() - append quit entry + * eficonfig_append_quit_entry() - append quit entry * * @efi_menu: pointer to the efimenu structure * Return: status code */ -static efi_status_t append_quit_entry(struct efimenu *efi_menu) +efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu) { char *title; efi_status_t ret; @@ -309,7 +310,7 @@ static efi_status_t append_quit_entry(struct efimenu *efi_menu) if (!title) return EFI_OUT_OF_RESOURCES; - ret = append_entry(efi_menu, title, eficonfig_process_quit, NULL); + ret = eficonfig_append_menu_entry(efi_menu, title, eficonfig_process_quit, NULL); if (ret != EFI_SUCCESS) free(title); @@ -341,7 +342,7 @@ void *eficonfig_create_fixed_menu(const struct eficonfig_item *items, int count) if (!title) goto out; - ret = append_entry(efi_menu, title, iter->func, iter->data); + ret = eficonfig_append_menu_entry(efi_menu, title, iter->func, iter->data); if (ret != EFI_SUCCESS) { free(title); goto out; @@ -634,14 +635,15 @@ static efi_status_t eficonfig_select_volume(struct eficonfig_select_file_info *f info->v = v; info->dp = device_path; info->file_info = file_info; - ret = append_entry(efi_menu, devname, eficonfig_volume_selected, info); + ret = eficonfig_append_menu_entry(efi_menu, devname, eficonfig_volume_selected, + info); if (ret != EFI_SUCCESS) { free(info); goto out; } } - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto out; @@ -745,8 +747,8 @@ eficonfig_create_file_entry(struct efimenu *efi_menu, u32 count, (int (*)(const void *, const void *))sort_file); for (i = 0; i < entry_num; i++) { - ret = append_entry(efi_menu, tmp_infos[i]->file_name, - eficonfig_file_selected, tmp_infos[i]); + ret = eficonfig_append_menu_entry(efi_menu, tmp_infos[i]->file_name, + eficonfig_file_selected, tmp_infos[i]); if (ret != EFI_SUCCESS) goto out; } @@ -815,7 +817,7 @@ static efi_status_t eficonfig_show_file_selection(struct eficonfig_select_file_i if (ret != EFI_SUCCESS) goto err; - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto err; @@ -1206,7 +1208,7 @@ static efi_status_t create_boot_option_entry(struct efimenu *efi_menu, char *tit utf16_utf8_strcpy(&p, val); } - return append_entry(efi_menu, buf, func, data); + return eficonfig_append_menu_entry(efi_menu, buf, func, data); } /** @@ -1665,7 +1667,7 @@ static efi_status_t eficonfig_add_boot_selection_entry(struct efimenu *efi_menu, utf16_utf8_strcpy(&p, lo.label); info->boot_index = boot_index; info->selected = selected; - ret = append_entry(efi_menu, buf, eficonfig_process_boot_selected, info); + ret = eficonfig_append_menu_entry(efi_menu, buf, eficonfig_process_boot_selected, info); if (ret != EFI_SUCCESS) { free(load_option); free(info); @@ -1724,7 +1726,7 @@ static efi_status_t eficonfig_show_boot_selection(unsigned int *selected) break; } - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto out; diff --git a/include/efi_config.h b/include/efi_config.h index cc6aa51393..064f2efe3f 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -95,4 +95,9 @@ efi_status_t eficonfig_get_unused_bootoption(u16 *buf, efi_status_t eficonfig_append_bootorder(u16 index); efi_status_t eficonfig_generate_media_device_boot_option(void); +efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, + char *title, eficonfig_entry_func func, + void *data); +efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu); + #endif