From patchwork Sun Nov 20 00:21:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627128 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp964816pvb; Sat, 19 Nov 2022 16:22:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf6QRRaxmXA4YjzQdzexgH4RrjYEgzi1GnQABDgTnf4DAvpYH0Z9VGyIB90Q/aEWAk4+drQ7 X-Received: by 2002:a67:e04f:0:b0:3aa:48a2:304e with SMTP id n15-20020a67e04f000000b003aa48a2304emr1326413vsl.73.1668903746664; Sat, 19 Nov 2022 16:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903746; cv=none; d=google.com; s=arc-20160816; b=NRFzUCDEMehFpSdNrXkAX5R/xFr0yTOXSVKK9McH0cJ897adPaKrzVo3COqDJ6zy0T OU7MhJbTNAmQob/Y2sCSALHob1s58nsNw8uVuErxZN7Rw14uNCIpTwk7jPIp3Y0u5WAj PpJPne7nnDOKenHjDYY53mwM44IjCoYmfUiM7kl8t1N2hdaf8kajdaELkiJ30dLjLK7l 2DYtMrdJErfEtpcm1nXaNAZzWphVwVmZ+G+um5DcexGHw0yjLw/GDgC12IOTQaLksdNu p/iLMf2/UZqGowrsDPwi3OV1ly412X4XN/9gBYEUmVt75XmqN0vMUcVj/1IQBaloJ5B1 JVtA== 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=xOYeBJrpWrZ9C9n8En/bcvO3nGSRzspI+daPEqyZcDk=; b=KnlldL2lzqrq/V4B8LTNLRHS0/RKTyUt1Juny+KDAI8ztaqbemtQgq2gN+If99pwlR vXMwJF0NCKA8ZSstdDHNJBColj22GEgCvNIzZSrOZmHTlykaNlEqaBfqb0NqxaEaq0ss zYvXt9pbVFeMpUHXDsg4oTQ2JxKgSz5UEebJ62snQfWGDAIL5oq9+UM0LCguoAdedNWv UPDIIFVYyeW6/hAOYkkTKGnIDpIUHGzlYucdlGXtLpGcQHPLPU2sjvQ8sEKeCYghwdEM xJ0n6YRBLqC0Y8ufzLygFX8hmP2BnKhvMAdqlnifaXbSPsboyFnHw3yJYk5gd+1I9g27 K9pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nn1vMVTq; 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 i2-20020a1f2202000000b003b7841ea2fdsi1263217vki.11.2022.11.19.16.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:26 -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=nn1vMVTq; 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 4C0D285155; Sun, 20 Nov 2022 01:22:06 +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="nn1vMVTq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AEF06849C0; Sun, 20 Nov 2022 01:22:02 +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-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 97EE184EDC for ; Sun, 20 Nov 2022 01:21:55 +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-x632.google.com with SMTP id v17so7639775plo.1 for ; Sat, 19 Nov 2022 16:21:55 -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=xOYeBJrpWrZ9C9n8En/bcvO3nGSRzspI+daPEqyZcDk=; b=nn1vMVTq3wKjCMS2KXX+KpS1JJoBsy2LEgR902aBBGQgf6LFuE4bHs6rfVhjXG7OYp 5k8Sq/yDv6dwuTzJrlLEV82b7eTM5oXODqeUj6FDax6SeL+2TYrHM7N/E4MfuC0MMkt8 dLlszM8Z0xEGfxlI8QVd1JIsfn3fhz7W1zpLPxDwJRUjjA54bJLnyjfPeJWBiOzN9CAa YpEG7hmyPkT0yn86aNnbYrjP6wo5WOOpwqJDK2rInv/YiCf2+BYEgeNdidRtdigiA9bz E9RNsLDjBaG3dHt705GLm9dDym+s9hDritIRb/MfORf+flWuJ7cJl2aQ4LfJzpA222pl W2Fw== 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=xOYeBJrpWrZ9C9n8En/bcvO3nGSRzspI+daPEqyZcDk=; b=LvcXHRaTE06e8a8cgrUhLThWiJ1avjUwe+jJ73LRSgGPtSq8xM11k5pFqWCoJOxNbj wAwR3z7fH2F10HwMLKxmfvqD6RJ/5QIwfrE9gv5zYD4BUUOTYbqJeRcfPEeTV7WFTuqU XYPqJAWbBXiPV35YFlHhxiL0ZbqQpkQevo74ND0GPUGgBUMAQDx3zp1iQiGZR++WLAns ti0riy8RkauqaFj8jRrUi3EHxzsBUldt0libkOuiXTuAonXMM21faSECt5WX692qt1dj wTDt0M/CWT3/OZ9C2giwPlCTQyzUU13pojQhw5YAO5RPIw3pZJOnw7R0AvqLF5a4tFFT WxhA== X-Gm-Message-State: ANoB5pmXp9N+biGkpFydE4032FHumdO8y9+TH0etl0ND4s6lD1WLwRZr 1NuPiTv2lEeEhnGxtgJZc6aKJaLMiaE03Q== X-Received: by 2002:a17:902:b692:b0:188:fc5f:84f2 with SMTP id c18-20020a170902b69200b00188fc5f84f2mr1307093pls.137.1668903713572; Sat, 19 Nov 2022 16:21:53 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id d12-20020a170902654c00b00168dadc7354sm1859431pln.78.2022.11.19.16.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:21:52 -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 v10 2/7] eficonfig: expose append entry function Date: Sun, 20 Nov 2022 09:21:14 +0900 Message-Id: <20221120002119.23683-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221120002119.23683-1-masahisa.kojima@linaro.org> References: <20221120002119.23683-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