From patchwork Thu Nov 10 08:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 623323 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp761251pvb; Thu, 10 Nov 2022 00:29:39 -0800 (PST) X-Google-Smtp-Source: AMsMyM5nHdAjGv36l4jrXr7ToQbogAPai6jKrHsfiwMXdntEWcTEBJABfhy9J4wghfe9Suh3GD1f X-Received: by 2002:aa7:d282:0:b0:462:1d0f:b172 with SMTP id w2-20020aa7d282000000b004621d0fb172mr61633318edq.211.1668068979171; Thu, 10 Nov 2022 00:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668068979; cv=none; d=google.com; s=arc-20160816; b=ucRkdM2q92nVYXGxcJgsMNG98cE9VKvKErLPcevlpbmgyT5PC9SoIPwLI9xfJv65gb 0/+C7SXTGUWIoU9nAGT7YpGf2ZZL/NT4AMKtODVHJIzMAuW0Hebez8kQ0uA6SvF3pz4d I7Fsw6dSr5iL5PkSZBwiHWPXSfLT/d6YeyabL7xAp8pKqwbh9k0jWcVnOFKHZPDyVomL NnQK7JghAvstbeJkZzTnO6JbTPekg+wkLPba8BnpsOcC5cS+OFDfePdga+yhPm9Rqaaq 0RXL/sIo1ikD5qhnMW6oPHXQE/XSWjN1IX/jQgQqjhrs0809vt7W4jKnvJ0cQST5BdMQ QSzA== 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=h7I6ozeO2JUqUtps5L5l5zZlWj2+UkgWHH0B68kJ4ArHienHlcHpKPWTCK4Q2K10gK vlL399PJf3V5RJgbvU5i7Be7tYfKvZIsTUuoVXzVlv5KTOH3ISSh+VHnY7Tz+VWf8VYF svYMjz6g5ma/dIqV0SSqYgI3bd6OT52Fze+EEo3On6OLrhXA/ixRl8OMslgquALFxrJi AF0SwVdDZUONimpaFDyJRUcqGGg2E1dR0LpaFtp9Nqqr/E0XqScwE+wDtnmea7SytQ1F YFuRyPYS57lwZABQsxYzrRjkeaqpwIk8LVhqTPd3BP9tAPq+LTjp3QlaTQzG0Z0PEg5e Nq9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aNRWrf1d; 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 hd13-20020a170907968d00b007ae61d89b3esi18464755ejc.356.2022.11.10.00.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:29:39 -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=aNRWrf1d; 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 E830785120; Thu, 10 Nov 2022 09:29:26 +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="aNRWrf1d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98D9F85106; Thu, 10 Nov 2022 09:29:22 +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-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (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 1E745850C5 for ; Thu, 10 Nov 2022 09:29:19 +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-pf1-x42d.google.com with SMTP id k22so1316859pfd.3 for ; Thu, 10 Nov 2022 00:29:18 -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=aNRWrf1doPAsOEd2hXPylqlMKQnG4+VuVi7dStK+X1GdJuV9EpaQO3U53guRGUgcfJ pmHtq8Vf3Ou7AVaeSO4/I+9YU/4m1E8KpbPyr+RlWuBpVE3FIkY4GdAX2XE9QNGCfhGx AFUoRZEmiJ4tqAsPX4tKCgjdCY03KYW3+3B8OOznx9PrPRaComyGHThPEZAzkXaNrqqK IyPMkdc2W2MTTiepJLhI0dmcdCL8VvfT4r6zvEw/mp8kXM7hk8GbmblmW6N/yqjhs1rd xnJVGBp9Vor5MaMdfVp18SutruCC4WAw5jNHpHk2mBcRCjlNFACts+oSJngXc2rQYvuW AnQw== 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=20tUR4P3Iw87ogDKSMEG6tw9l8hQ1HmcgqXHgoJ/HoORbTON/r0ZQdW/3PM9GfpBn/ Y5bIbZWzm9xnlNLzGA9Cf9gVdHfp/63kELjTyM6FumKmwC7XhfiunJfOd+bDCAVZAue7 HGpXAuguFXLwrLAYG1rj8Qv5Wi8SxUbZErpQP+lMkq19QAaBdTVDw9ekqsjj0Am/egzJ m1ftVl7uXX9xIG4/GeM0vVwQ6iohnXjaZgcmyzSKB/Gr9sdm+XAj/mStOLbBU6mlAtoD UO/Rtar3Zkw9NH4Yt0jyr6A4M262DdMdHAN3P4VB89LussiERvNBFTF1Y/d4bLXzvUmq wA8A== X-Gm-Message-State: ACrzQf1AgtlQC2fA92ok6G/hGUZpcSq/H9jWa10G4oo3RRpZOFn0vJPC HWOo9/mOFFKni3ROfazFEwBnSdWqFxRD5g== X-Received: by 2002:a63:5459:0:b0:43c:7da:e64b with SMTP id e25-20020a635459000000b0043c07dae64bmr2095480pgm.231.1668068956784; Thu, 10 Nov 2022 00:29:16 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id b1-20020a170903228100b00176ba091cd3sm10638194plh.196.2022.11.10.00.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:29:15 -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 v8 2/5] eficonfig: expose append entry function Date: Thu, 10 Nov 2022 17:30:51 +0900 Message-Id: <20221110083054.11950-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221110083054.11950-1-masahisa.kojima@linaro.org> References: <20221110083054.11950-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