From patchwork Sun Nov 20 00:21:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627127 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp964755pvb; Sat, 19 Nov 2022 16:22:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf65sU4J+G9uTsktcfa0JVITxCF40rmuDFXZqQM3f2cgJ0d/8q+sG2NAnEASVaT1gXVK85Sw X-Received: by 2002:ab0:1547:0:b0:414:40d1:f39d with SMTP id p7-20020ab01547000000b0041440d1f39dmr6915314uae.98.1668903732174; Sat, 19 Nov 2022 16:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903732; cv=none; d=google.com; s=arc-20160816; b=AJxOsuuDGQlA5LQZz5qoQ9XildUGGQDDI/PIahFqCepyAzfCLGLNhxkllic4Ctueql agqaVeUkP/G/S+4mU8CThkCOEKrdKpBPR58NoOMMUIhl76vGOdUI0OPYGdsefLyRTf9Q ATDoW9//IIfNra44gdXfQJQV8XxNTpaVRA82QNHEAOoGQJATHWmTxg1afnt0AfdK/RnO zaJQj/AqPRsQFUUou7Gjmnh0J4PMnKPLiMHbMf4E7cHYSd+iO8lnI8u0IVKtDn+X0xXS Kp+dfq8iodQrL+WgmWGG1mDNvc7AU/H9uSUPqhQJ6wBXkFAhKc/xEUspyH9t1G8QjacE 2znA== 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=hR9bGrO+zYvfLdWABU8jdk1REtDhHq9ZaStcbcnoXgk=; b=K7aLsvwYngTqEuAoiLXYb9Kyt5fBaPt74UukhyMMOBOu3BOviowOJ9zEzj/btdO9Ez yMah55EhtPlPKzaHWj+u2SfECXOIYmqc0uJqpBKpXC9qgsEOiYfkus1XxJoHeaoC/9Rd ZXraiIdkqx0Z9s1z20b6V4pmbLs9xorSPk49o0oXTV8day+16zYgomH9W0QP/Dch2AtE hPTSt6o28RYAVSYtx1+OsJhOmoy7P8AW0M+5C3Cm1BlmBdda10ZxHoz38BhcSdcunVg/ e2E2i8XwEy1WhcgbmPHQq3fNoc4S0WlX/j/YcOqDik2Dxfj4SA7GWtGx5dF9ROE1yzcT 3S2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nT2nM0o7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id l5-20020a1f2505000000b003b81fdcf242si1196028vkl.226.2022.11.19.16.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:12 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nT2nM0o7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 8146E850EA; Sun, 20 Nov 2022 01:22:02 +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="nT2nM0o7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E01D8504C; Sun, 20 Nov 2022 01:21:56 +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-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (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 45EF7830E2 for ; Sun, 20 Nov 2022 01:21:52 +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-x633.google.com with SMTP id 4so7663997pli.0 for ; Sat, 19 Nov 2022 16:21:52 -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=hR9bGrO+zYvfLdWABU8jdk1REtDhHq9ZaStcbcnoXgk=; b=nT2nM0o7lN8UD+PejCeJckCQU1qJ7sKquHN+N+i0fwW/hNLPOBtl4OJPJYHuCY9fqj xOO+wHlTYILezrx98GrzJOlb9f86NSwt8jL/LN2Qe3ewHX49vxG9f6NI12gYeIi/+vtF vdFrmfx53RAL7fkPN0HnTT21FrKJP4BXd6XpaYDZqcdk1oDCbCVyVn8RAxawFBxvVhex YUEIRpm3ubuvkrAhTanaxUBSRKSMsFrxZ64IMGUNxqAxGz4Jt/0Jf6V4u4ainyg3RhPF wWzTuxdy+VGzAvvEGO+Se/JuEyQIcJORQXVv0nT5x8RkueGaIJH48pvQWomW592nD0fn v4Cw== 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=hR9bGrO+zYvfLdWABU8jdk1REtDhHq9ZaStcbcnoXgk=; b=IyJH32wJvC1BnZenkSE5fSuuRz/1JoMtoyDFl451iRvg0ZCEd42tEQq7aiAn0x4hcd KRai1zRxYgvtfMMYO3G3phU3E8qFka95Hn7EHx0/Bv9aVKFRyBektZiNgTg8icGco82A cs4N7vGnVBJbC9U+NNlLDXfRZQpPMrxoEJHI70lmQCxHV0vPJx0kBCi8yVtwQNE0AHfG m0PdPRiv5v+KgggZOrJ5I3zoUAGAuCSBIGBgVVEHpzgshIuOFVJaFkambojpT/oczV7+ YgqnQGsrIygTmL8kuA/LMTAw1ZQSWcl/I9vn4n9HbquYWlrRfVX2pob1h6ZS//FbeT+0 x6mg== X-Gm-Message-State: ANoB5pn1F+brJTUfHkzklczUpfhyjtj5+T4//3NLmST0phxoGkH5Xs0T 2vbv1KbYpNEtfW1+H3g/Z9Mztmb1IrYylg== X-Received: by 2002:a17:902:e849:b0:188:ff96:a7df with SMTP id t9-20020a170902e84900b00188ff96a7dfmr5939665plg.38.1668903710289; Sat, 19 Nov 2022 16:21:50 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:21:49 -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 1/7] eficonfig: refactor file selection handling Date: Sun, 20 Nov 2022 09:21:13 +0900 Message-Id: <20221120002119.23683-2-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 eficonfig_select_file_handler() is commonly used to select the file. eficonfig_display_select_file_option() adds an additional menu to clear the selected file. eficonfig_display_select_file_option() is not always necessary for the file selection process, so it must be outside of eficonfig_select_file_handler(). This commit also renames the following functions to avoid confusion. eficonfig_select_file_handler() -> eficonfig_process_select_file() eficonfig_select_file() -> eficonfig_show_file_selection() eficonfig_display_select_file_option() -> eficonfig_process_show_file_option() Finally, test_eficonfig.py need to be updated to get aligned with the above modification. Signed-off-by: Masahisa Kojima Reviewed-by: Ilias Apalodimas --- No update since v7 Changes in v7: - rename functio name to avoid confusion - remove unused function - update commit message newly created in v2 cmd/eficonfig.c | 37 ++++++------------- include/efi_config.h | 2 +- .../py/tests/test_eficonfig/test_eficonfig.py | 1 + 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 2595dd9563..571e2b9ac0 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -756,14 +756,14 @@ out: } /** - * eficonfig_select_file() - construct the file selection menu + * eficonfig_show_file_selection() - construct the file selection menu * * @file_info: pointer to the file selection structure * @root: pointer to the file handle * Return: status code */ -static efi_status_t eficonfig_select_file(struct eficonfig_select_file_info *file_info, - struct efi_file_handle *root) +static efi_status_t eficonfig_show_file_selection(struct eficonfig_select_file_info *file_info, + struct efi_file_handle *root) { u32 count = 0, i; efi_uintn_t len; @@ -938,17 +938,6 @@ static efi_status_t eficonfig_boot_edit_save(void *data) return EFI_SUCCESS; } -/** - * eficonfig_process_select_file() - callback function for "Select File" entry - * - * @data: pointer to the data - * Return: status code - */ -efi_status_t eficonfig_process_select_file(void *data) -{ - return EFI_SUCCESS; -} - /** * eficonfig_process_clear_file_selection() - callback function for "Clear" entry * @@ -973,19 +962,19 @@ static struct eficonfig_item select_file_menu_items[] = { {"Quit", eficonfig_process_quit}, }; - /** - * eficonfig_display_select_file_option() - display select file option + * eficonfig_process_show_file_option() - display select file option * * @file_info: pointer to the file information structure * Return: status code */ -efi_status_t eficonfig_display_select_file_option(struct eficonfig_select_file_info *file_info) +efi_status_t eficonfig_process_show_file_option(void *data) { efi_status_t ret; struct efimenu *efi_menu; - select_file_menu_items[1].data = file_info; + select_file_menu_items[0].data = data; + select_file_menu_items[1].data = data; efi_menu = eficonfig_create_fixed_menu(select_file_menu_items, ARRAY_SIZE(select_file_menu_items)); if (!efi_menu) @@ -1001,12 +990,12 @@ efi_status_t eficonfig_display_select_file_option(struct eficonfig_select_file_i } /** - * eficonfig_select_file_handler() - handle user file selection + * eficonfig_process_select_file() - handle user file selection * * @data: pointer to the data * Return: status code */ -efi_status_t eficonfig_select_file_handler(void *data) +efi_status_t eficonfig_process_select_file(void *data) { size_t len; efi_status_t ret; @@ -1016,10 +1005,6 @@ efi_status_t eficonfig_select_file_handler(void *data) struct eficonfig_select_file_info *tmp = NULL; struct eficonfig_select_file_info *file_info = data; - ret = eficonfig_display_select_file_option(file_info); - if (ret != EFI_SUCCESS) - return ret; - tmp = calloc(1, sizeof(struct eficonfig_select_file_info)); if (!tmp) return EFI_OUT_OF_RESOURCES; @@ -1046,7 +1031,7 @@ efi_status_t eficonfig_select_file_handler(void *data) if (ret != EFI_SUCCESS) goto out; - ret = eficonfig_select_file(tmp, root); + ret = eficonfig_show_file_selection(tmp, root); if (ret == EFI_ABORTED) continue; if (ret != EFI_SUCCESS) @@ -1284,7 +1269,7 @@ static efi_status_t prepare_file_selection_entry(struct efimenu *efi_menu, char utf8_utf16_strcpy(&p, devname); u16_strlcat(file_name, file_info->current_path, len); ret = create_boot_option_entry(efi_menu, title, file_name, - eficonfig_select_file_handler, file_info); + eficonfig_process_show_file_option, file_info); out: free(devname); free(file_name); diff --git a/include/efi_config.h b/include/efi_config.h index 098cac2115..cc6aa51393 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -89,7 +89,7 @@ void eficonfig_print_msg(char *msg); void eficonfig_destroy(struct efimenu *efi_menu); efi_status_t eficonfig_process_quit(void *data); efi_status_t eficonfig_process_common(struct efimenu *efi_menu, char *menu_header); -efi_status_t eficonfig_select_file_handler(void *data); +efi_status_t eficonfig_process_select_file(void *data); efi_status_t eficonfig_get_unused_bootoption(u16 *buf, efi_uintn_t buf_size, u32 *index); efi_status_t eficonfig_append_bootorder(u16 index); diff --git a/test/py/tests/test_eficonfig/test_eficonfig.py b/test/py/tests/test_eficonfig/test_eficonfig.py index 99606d9c4b..102bfd7541 100644 --- a/test/py/tests/test_eficonfig/test_eficonfig.py +++ b/test/py/tests/test_eficonfig/test_eficonfig.py @@ -349,6 +349,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data): press_up_down_enter_and_wait(0, 1, True, 'Quit') press_up_down_enter_and_wait(0, 0, True, 'No block device found!') press_escape_key(False) + press_escape_key(False) check_current_is_maintenance_menu() # Return to U-Boot console press_escape_key(True) 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 From patchwork Sun Nov 20 00:21:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627129 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp964905pvb; Sat, 19 Nov 2022 16:22:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf733QZwBPHXS5ba+Y+/8vxwtQkj3y4Zrq/GjPMCADOl+Uma8KFQ0Hrdq/w46MQ5QTHjMAI4 X-Received: by 2002:a67:c792:0:b0:3aa:9c4:a9a9 with SMTP id t18-20020a67c792000000b003aa09c4a9a9mr6573796vsk.75.1668903765408; Sat, 19 Nov 2022 16:22:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903765; cv=none; d=google.com; s=arc-20160816; b=UIzMPS8LepaxMQoVDQ83Vv5VUWLMVFfy8gDOxy6tgSxWKL/O1ixye5MReCoNQ+wr65 Ve617AFhVpJfmvdNHhzhQCVco/4r6CdfFPBebXy2gFNnR3BiCbDFMZO7JR4pBS77cowm DMNyIgOYQi19zlxkudtZuk38FSTuO5vNJANRy5pR4YV4E/y3ykvM6C7qnCGSWcoiQ3Yy A8gdSkfZHWyt+tWZA6sC4UleE1eI+Meocsd1ZNmtoN4oNMjptA1JGPSE6qU9XaTZwYcO 2SheeAcWduUn7tYqkCt9JFwu4ChyWM11Q0pZgF+DpXO39HOeW/Ad5SLwdzE+Nidq4AaC sW7A== 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=BYvxt/ZidMfJTg7RwUi53Gs2uw4Q/+WowTeRPeGjgSU=; b=lK5adqoi7856wLLE5nOjqxb8wvDVU20Mb5pi+ixSdnTGrvRXV+2dEtP4kOOkwfgvZo jJwXd1quZixnOm9ktHUcLZfqIdtvid2U5ITkhL9w7d+uxgFX+YbTeUM6j31qqEjCaAQX W5ZqSEXWa67Dk1ixxO2kqHKt58mnTXlUCZD+nQKgB8vp1/GrA/wIFZ0W6maqbwOm3VgC 6lQ7gtTXpYdptTWMEJPt6pCJ/cjIyaKROZ7nfxCO14sH4BFIkgQefUkev7VuucJMsJjb ahhKFY7BnY6Cbz9/DR5EuiiKw1P6BZQxyDL/KEG2yn6yrqyBSusw4p0tgwbkn1qieMaw /asA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t3ejklxY; 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 n21-20020a9f3155000000b00418ba50993asi1034314uab.74.2022.11.19.16.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:45 -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=t3ejklxY; 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 171CB849C0; Sun, 20 Nov 2022 01:22:20 +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="t3ejklxY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 576D585129; Sun, 20 Nov 2022 01:22: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.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-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 EC25E830E2 for ; Sun, 20 Nov 2022 01:21:58 +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-x431.google.com with SMTP id v28so8227889pfi.12 for ; Sat, 19 Nov 2022 16:21:58 -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=BYvxt/ZidMfJTg7RwUi53Gs2uw4Q/+WowTeRPeGjgSU=; b=t3ejklxYflZ63ObNKu+6oFebwjI6sbGSdVbdGLk+0V8ZZmcu8t/vGd3hi0PXBcSwzr +sqdAKsUhjbDpypmyoBGuapcXXyZKLv94kzhf3l2Ou4kJVqwTicSNBDgqRtyQX0C+sEH v8ANZEPPGq0xjBqmIgng2yK9sXyiQUdWmNGcshTFjXX8fcl3euIKXh1cL4gYH2xQ84F8 rw5O3QjutbXVjqvrX4WihND07DxDDGeuHQcQfBaKAZj3icKuA6CvLzjKQDMxDZCfB96n Bd8Oiw0bnO45gol582Pf5MUsZCQJcvdeVjBHYxFY52WCazc90MUEMVoxukLw7FuyfD+z +hWQ== 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=BYvxt/ZidMfJTg7RwUi53Gs2uw4Q/+WowTeRPeGjgSU=; b=VEdGkOlpcTGxr3AMz5w+cLrOX5DdhB80sC5o7xp9DtbajvTgWloxOJzfu28K7dvS2q kQR4wiNBefZlUXOIdocjYAN9vvXT1xhm6cMAebZgyxFBv9BAKP4h0QC/fUohJKIX1r6F T8G63Xd0ZLC9JAQ59KVfa2aoeLZBk2E0pUnf92LQxS/CA+i8AgCy5g7TXAP4yfP2n3t1 XMvV5osDFHguP4pF4P7yEuNdcdB/iN+vQILq33Dn6sF3Gb1gauDTPEJGQvZ/pB+2aRtl 8bYC8TqzsKwjAu9gEsNxdadbUJuE1x1MLbyrZR85+H9pFk/u/wbDMKZQjszS+aKJOdrg r9GQ== X-Gm-Message-State: ANoB5pl9VqzjBMDOGsgow74qwksgMf0HnoNFHvo1qgxPkgiBNBbm9jqL 1Q5/2CcTfe0/fpSZsU886QW7ShXlPoMQ4g== X-Received: by 2002:a63:5f41:0:b0:41d:c892:2e9 with SMTP id t62-20020a635f41000000b0041dc89202e9mr2771081pgb.457.1668903716892; Sat, 19 Nov 2022 16:21:56 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:21:56 -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 3/7] eficonfig: refactor change boot order implementation Date: Sun, 20 Nov 2022 09:21:15 +0900 Message-Id: <20221120002119.23683-4-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 All the eficonfig menus other than "Change Boot Order" use 'eficonfig_entry' structure for each menu entry. This commit refactors change boot order implementation to use 'eficonfig_entry' structure same as other menus to have consistent menu handling. This commit also simplifies the data->active handling when KEY_SPACE is pressed, and sizeof() parameter. Signed-off-by: Masahisa Kojima Acked-by: Ilias Apalodimas --- No update since v7 Changes in v7: - simplify the data->active handling - update sizeof() parameter - update commit message Changes in v5: - remove direct access mode cmd/eficonfig.c | 129 +++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index b392de7954..12babb76c2 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -93,20 +93,14 @@ struct eficonfig_boot_selection_data { }; /** - * struct eficonfig_boot_order - structure to be used to update BootOrder variable + * struct eficonfig_boot_order_data - structure to be used to update BootOrder variable * - * @num: index in the menu entry - * @description: pointer to the description string * @boot_index: boot option index * @active: flag to include the boot option into BootOrder variable - * @list: list structure */ -struct eficonfig_boot_order { - u32 num; - u16 *description; +struct eficonfig_boot_order_data { u32 boot_index; bool active; - struct list_head list; }; /** @@ -1802,7 +1796,7 @@ static void eficonfig_display_change_boot_order(struct efimenu *efi_menu) { bool reverse; struct list_head *pos, *n; - struct eficonfig_boot_order *entry; + struct eficonfig_entry *entry; printf(ANSI_CLEAR_CONSOLE ANSI_CURSOR_POSITION "\n ** Change Boot Order **\n" @@ -1818,7 +1812,7 @@ static void eficonfig_display_change_boot_order(struct efimenu *efi_menu) /* draw boot option list */ list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); + entry = list_entry(pos, struct eficonfig_entry, list); reverse = (entry->num == efi_menu->active); printf(ANSI_CURSOR_POSITION, entry->num + 4, 7); @@ -1827,13 +1821,13 @@ static void eficonfig_display_change_boot_order(struct efimenu *efi_menu) puts(ANSI_COLOR_REVERSE); if (entry->num < efi_menu->count - 2) { - if (entry->active) + if (((struct eficonfig_boot_order_data *)entry->data)->active) printf("[*] "); else printf("[ ] "); } - printf("%ls", entry->description); + printf("%s", entry->title); if (reverse) puts(ANSI_COLOR_RESET); @@ -1850,9 +1844,8 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) { int esc = 0; struct list_head *pos, *n; - struct eficonfig_boot_order *tmp; enum bootmenu_key key = KEY_NONE; - struct eficonfig_boot_order *entry; + struct eficonfig_entry *entry, *tmp; while (1) { bootmenu_loop(NULL, &key, &esc); @@ -1861,11 +1854,11 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) case KEY_PLUS: if (efi_menu->active > 0) { list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); + entry = list_entry(pos, struct eficonfig_entry, list); if (entry->num == efi_menu->active) break; } - tmp = list_entry(pos->prev, struct eficonfig_boot_order, list); + tmp = list_entry(pos->prev, struct eficonfig_entry, list); entry->num--; tmp->num++; list_del(&tmp->list); @@ -1879,11 +1872,11 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) case KEY_MINUS: if (efi_menu->active < efi_menu->count - 3) { list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); + entry = list_entry(pos, struct eficonfig_entry, list); if (entry->num == efi_menu->active) break; } - tmp = list_entry(pos->next, struct eficonfig_boot_order, list); + tmp = list_entry(pos->next, struct eficonfig_entry, list); entry->num++; tmp->num--; list_del(&entry->list); @@ -1909,9 +1902,11 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) case KEY_SPACE: if (efi_menu->active < efi_menu->count - 2) { list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); + entry = list_entry(pos, struct eficonfig_entry, list); if (entry->num == efi_menu->active) { - entry->active = entry->active ? false : true; + struct eficonfig_boot_order_data *data = entry->data; + + data->active = !data->active; return EFI_NOT_READY; } } @@ -1937,12 +1932,13 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) static efi_status_t eficonfig_add_change_boot_order_entry(struct efimenu *efi_menu, u32 boot_index, bool active) { + char *title, *p; efi_status_t ret; efi_uintn_t size; void *load_option; struct efi_load_option lo; u16 varname[] = u"Boot####"; - struct eficonfig_boot_order *entry; + struct eficonfig_boot_order_data *data; efi_create_indexed_name(varname, sizeof(varname), "Boot", boot_index); load_option = efi_get_var(varname, &efi_global_variable_guid, &size); @@ -1950,31 +1946,38 @@ static efi_status_t eficonfig_add_change_boot_order_entry(struct efimenu *efi_me return EFI_SUCCESS; ret = efi_deserialize_load_option(&lo, load_option, &size); - if (ret != EFI_SUCCESS) { - free(load_option); - return ret; + if (ret != EFI_SUCCESS) + goto out; + + data = calloc(1, sizeof(*data)); + if (!data) { + ret = EFI_OUT_OF_RESOURCES; + goto out; } - entry = calloc(1, sizeof(struct eficonfig_boot_order)); - if (!entry) { - free(load_option); - return EFI_OUT_OF_RESOURCES; + title = calloc(1, utf16_utf8_strlen(lo.label) + 1); + if (!title) { + free(data); + ret = EFI_OUT_OF_RESOURCES; + goto out; } + p = title; + utf16_utf8_strcpy(&p, lo.label); - entry->description = u16_strdup(lo.label); - if (!entry->description) { - free(load_option); - free(entry); - return EFI_OUT_OF_RESOURCES; + data->boot_index = boot_index; + data->active = active; + + ret = eficonfig_append_menu_entry(efi_menu, title, NULL, data); + if (ret != EFI_SUCCESS) { + free(data); + free(title); + goto out; } - entry->num = efi_menu->count++; - entry->boot_index = boot_index; - entry->active = active; - list_add_tail(&entry->list, &efi_menu->list); +out: free(load_option); - return EFI_SUCCESS; + return ret; } /** @@ -1989,8 +1992,8 @@ static efi_status_t eficonfig_create_change_boot_order_entry(struct efimenu *efi u16 *bootorder, efi_uintn_t num) { u32 i; + char *title; efi_status_t ret; - struct eficonfig_boot_order *entry; /* list the load option in the order of BootOrder variable */ for (i = 0; i < num; i++) { @@ -2017,27 +2020,25 @@ static efi_status_t eficonfig_create_change_boot_order_entry(struct efimenu *efi } /* add "Save" and "Quit" entries */ - entry = calloc(1, sizeof(struct eficonfig_boot_order)); - if (!entry) + title = strdup("Save"); + if (!title) { + ret = EFI_OUT_OF_RESOURCES; goto out; + } - entry->num = efi_menu->count++; - entry->description = u16_strdup(u"Save"); - list_add_tail(&entry->list, &efi_menu->list); - - entry = calloc(1, sizeof(struct eficonfig_boot_order)); - if (!entry) + ret = eficonfig_append_menu_entry(efi_menu, title, NULL, NULL); + if (ret != EFI_SUCCESS) goto out; - entry->num = efi_menu->count++; - entry->description = u16_strdup(u"Quit"); - list_add_tail(&entry->list, &efi_menu->list); + ret = eficonfig_append_quit_entry(efi_menu); + if (ret != EFI_SUCCESS) + goto out; efi_menu->active = 0; return EFI_SUCCESS; out: - return EFI_OUT_OF_RESOURCES; + return ret; } /** @@ -2053,7 +2054,7 @@ static efi_status_t eficonfig_process_change_boot_order(void *data) efi_status_t ret; efi_uintn_t num, size; struct list_head *pos, *n; - struct eficonfig_boot_order *entry; + struct eficonfig_entry *entry; struct efimenu *efi_menu; efi_menu = calloc(1, sizeof(struct efimenu)); @@ -2084,9 +2085,16 @@ static efi_status_t eficonfig_process_change_boot_order(void *data) /* create new BootOrder */ count = 0; list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); - if (entry->active) - new_bootorder[count++] = entry->boot_index; + struct eficonfig_boot_order_data *data; + + entry = list_entry(pos, struct eficonfig_entry, list); + /* exit the loop when iteration reaches "Save" */ + if (!strncmp(entry->title, "Save", strlen("Save"))) + break; + + data = entry->data; + if (data->active) + new_bootorder[count++] = data->boot_index; } size = count * sizeof(u16); @@ -2105,15 +2113,12 @@ static efi_status_t eficonfig_process_change_boot_order(void *data) } } out: + free(bootorder); list_for_each_safe(pos, n, &efi_menu->list) { - entry = list_entry(pos, struct eficonfig_boot_order, list); - list_del(&entry->list); - free(entry->description); - free(entry); + entry = list_entry(pos, struct eficonfig_entry, list); + free(entry->data); } - - free(bootorder); - free(efi_menu); + eficonfig_destroy(efi_menu); /* to stay the parent menu */ ret = (ret == EFI_ABORTED) ? EFI_NOT_READY : ret; From patchwork Sun Nov 20 00:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627130 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp964976pvb; Sat, 19 Nov 2022 16:22:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zw8YOjMNsJN25R39QMHx7D4JbabpSVmjn7id7xLXtOshvICt+OCQOKoZbtaAyxi6EO1YG X-Received: by 2002:a67:c792:0:b0:3aa:9c4:a9a9 with SMTP id t18-20020a67c792000000b003aa09c4a9a9mr6573926vsk.75.1668903777185; Sat, 19 Nov 2022 16:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903777; cv=none; d=google.com; s=arc-20160816; b=ovIqG9lnQAZcmNWFiJriuFwssWXGLok9DuuE7L9v7mFuTUN0+/2wB56mS2Y/TqE/+J /xVBzogamiYq46XvyywComp2Y0+RtjUQ23EGbVBLjEtq+GiEbjlSsqfsd7WwKGJYDFoI we9A0hpvLIS6Tz9oGwEmoJXWVHO5jxiu9M6Nb92UDyoK0RvjX5GjrEa35zFhqo1CN1Yk 3mgqnCFQRlaB4eSUB+wGOwTrI+vpPPEghTIHPr6eMW3df0aFWK5/c5rvmfz+4MsEGeXs 3xQlAO3m5J+0QqG/E57vgjBBUlXjIgbSCm2eQoUtmSeYpPd1ZzDmIXVVbpCEXH4zFmfq GrXQ== 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=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=K9sEtQGAU0NyD1CDWKxxn4/zMQbFiZkCuFZVH+/VzYGM0ihD302b0cVH0RidZfNLk8 mZGUSFFV0WkB20WsNn7mCuOI2iVJSYjiL9ekB5jXBH3GlCBSQpdTnrWQUQ96dguf9J1E U28ryUBIeA4AU6a676z5IPum2GWZY1JTiYYvAourNCHk7+EHvPgt5FBW5hU6d+Z/GgCp gOm5xF1ERqhy15OHfaqtUw/VkrdclNNtWQkqRij9XzeYmnKsf9SJ6Y6IUhZJqOGkaD6+ qY5MR5AY/Jc5ASFzSC9CggMvs2pxzrbCIxpKqS6jkLaiyLho/G4PVBgWHPK02IatAecB Skew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZFFMbXh; 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 f185-20020a676ac2000000b003a79b937aaasi1278319vsc.329.2022.11.19.16.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:57 -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=SZFFMbXh; 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 64256851EF; Sun, 20 Nov 2022 01:22:23 +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="SZFFMbXh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94EA08504C; Sun, 20 Nov 2022 01:22:08 +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-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 7C09F85071 for ; Sun, 20 Nov 2022 01:22:02 +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-x430.google.com with SMTP id y13so8240350pfp.7 for ; Sat, 19 Nov 2022 16:22:02 -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=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=SZFFMbXhPYxkGldKdsMd876i39x2n/CyEjE4oIDky0ivVMjhRXzRBBMEQ3VnnnCqec 7NlScaKd6cLLmvdt2w/Ti+H0eDdkbAZEeCHy7pLmr0LfgMRzjtxvGOak2g1pe2k1Mofp 5KnkSq+rFGdPdmQxJL+xNWipeVeNI5vffe/QNy7UOIRE7fIjplP7ab86oq4c8xGnDOP3 nZVh9Q7Pa52YqWvpoe6LKz/OjADOFN+F3G5kpbUnBCOZsw35okuuLOpevY8Kn8OXygwY XCO5GUWNEYR6zuM757YjksZgwCRSEterR/h+o30GiZCn2aLuBekiu0SXnyyFrqzrs/ry zhhg== 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=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=JPhdUr3AmjD/sniz8OzPutOaJOdtZYYQbbOMwhIWq3yNH96bybwT66vgBktb89EEfI uQMZ+qfumH8MacU322gEfMf0h5jlzW+KeLFN7BoO/9Nq5SRJZWyxQDsTgQ9HejWGniNQ 7DAXdaqcq56vchGR/jlcXtADX/LmxY2M/pX/3VqNLxf2BpFOzs7xAYP7oE8zihOtsRkm yIYffcjyD4yYcreqn+VAS1U2H3PxCTpAP7tJl5XJRB6FLXD4MOiJQT2T0XQlz7yfzj5p frAY0g2CS3CG/pm3D1oNXhymAy3goz1S83f6PGZWlbfYVcGjy3RLJgz+Qun5mxecbgA4 A+HA== X-Gm-Message-State: ANoB5pmXP+j55spedrzhPU0hiou7tUs5ycPXPZtq1g3RwGh2aOzkqHMB rMb0rmVzl9cWm+xmAKPd2sprU0l+O+gDDQ== X-Received: by 2002:a05:6a00:4286:b0:56d:3de3:c525 with SMTP id bx6-20020a056a00428600b0056d3de3c525mr2301781pfb.41.1668903720470; Sat, 19 Nov 2022 16:22:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:21:59 -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 4/7] eficonfig: expose eficonfig_create_device_path() Date: Sun, 20 Nov 2022 09:21:16 +0900 Message-Id: <20221120002119.23683-5-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 eficonfig_create_device_path() to construct the full device path from device path of the volume and file path, so move it out of their static declarations. Signed-off-by: Masahisa Kojima --- Newly created in v10 cmd/eficonfig.c | 20 +++++++++++--------- include/efi_config.h | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 12babb76c2..58a6856666 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -436,14 +436,15 @@ static efi_status_t eficonfig_volume_selected(void *data) } /** - * create_selected_device_path() - create device path + * eficonfig_create_device_path() - create device path * - * @file_info: pointer to the selected file information + * @dp_volume: pointer to the volume + * @current_path: pointer to the file path u16 string * Return: * device path or NULL. Caller must free the returned value */ -static -struct efi_device_path *create_selected_device_path(struct eficonfig_select_file_info *file_info) +struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_volume, + u16 *current_path) { char *p; void *buf; @@ -452,7 +453,7 @@ struct efi_device_path *create_selected_device_path(struct eficonfig_select_file struct efi_device_path_file_path *fp; fp_size = sizeof(struct efi_device_path) + - ((u16_strlen(file_info->current_path) + 1) * sizeof(u16)); + ((u16_strlen(current_path) + 1) * sizeof(u16)); buf = calloc(1, fp_size + sizeof(END)); if (!buf) return NULL; @@ -461,13 +462,13 @@ struct efi_device_path *create_selected_device_path(struct eficonfig_select_file fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE, fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH, fp->dp.length = (u16)fp_size; - u16_strcpy(fp->str, file_info->current_path); + u16_strcpy(fp->str, current_path); p = buf; p += fp_size; *((struct efi_device_path *)p) = END; - dp = efi_dp_append(file_info->dp_volume, (struct efi_device_path *)buf); + dp = efi_dp_append(dp_volume, (struct efi_device_path *)buf); free(buf); return dp; @@ -1472,7 +1473,8 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo } if (bo->initrd_info.dp_volume) { - dp = create_selected_device_path(&bo->initrd_info); + dp = eficonfig_create_device_path(bo->initrd_info.dp_volume, + bo->initrd_info.current_path); if (!dp) { ret = EFI_OUT_OF_RESOURCES; goto out; @@ -1481,7 +1483,7 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo efi_free_pool(dp); } - dp = create_selected_device_path(&bo->file_info); + dp = eficonfig_create_device_path(bo->file_info.dp_volume, bo->file_info.current_path); if (!dp) { ret = EFI_OUT_OF_RESOURCES; goto out; diff --git a/include/efi_config.h b/include/efi_config.h index 064f2efe3f..934de41e85 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -99,5 +99,7 @@ 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); +struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_volume, + u16 *current_path); #endif From patchwork Sun Nov 20 00:21: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: 627131 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp965051pvb; Sat, 19 Nov 2022 16:23:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4iEjgWkuhI8d0eR6ya9GLjc9FR2nX3sCdtCChZk7lun7KWKUayfhFlQ+Z3QVD0VbLTnrjq X-Received: by 2002:a05:6102:41a5:b0:3aa:3de6:fb96 with SMTP id cd37-20020a05610241a500b003aa3de6fb96mr7091774vsb.32.1668903788383; Sat, 19 Nov 2022 16:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903788; cv=none; d=google.com; s=arc-20160816; b=sRdARUzn2o5FuTgKP1mfUC2Hs08YRdaPSb9I64a6kK1J8IifnTdonmqT6GMaorVPqG 47zqU8vlQQa4Ypc94g2RWJ5rNI8ySgAFlCITp8I0aOPMtzITAImqM65uz5X7NFKB5v7V iaXiFms9b+TO1VZqj6r0hxficQdynMVs0ZFt3igYXLo0SsjPTlvC0dd8OgtPts98WwKb 52PGD2l5IhF08ggbEdHctW0d5AFqoH4HNMSfWarJEhBghEVaIL5CCBeWWwzR2hA96Z6j xhwfDVJsArLbFAPyAw2NgmDzhI3Nis8BlWw5A8nmH3UlLWPLbkNLMCtypW4H5CggJQxx ao0g== 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=8ZUSUMWGXhjZ4QcuBL/EqMRefVmnA5oofCWdDmsDgS4=; b=BfLciXW3ik/jz9fOaze4Yw28pD3zZl+inAldR3z0ckYwaY14UFoUpPviya53fqVRH2 JErIYgNo5B6LtAEJBcUUfeH3m/4Vzw7qTn/COER8JdKUUl1+VsoTqu60aIWZnJ6gU56W 6XtdmoIsPE/GLgfZly8DXxYFUppwBb+YOOj91agUU8mldfWeQNq5r2Ir3dsR0tvHUKJM BkbHpfJANh74xySHLutZa42UT3XaME3IrvjB/deYRMJs+TZxfKKLUMJG1SfBkrZG244O H9SuiMdZjTWCffiu5MKE+9X6MW2s78dJRe41zLGdnW8tc1EoKvlisszzeTz6SFPM/A// ofAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rJVjLFct; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id p15-20020a1fa60f000000b003a37d629d49si1249280vke.296.2022.11.19.16.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:23:08 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rJVjLFct; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 C8679851EA; Sun, 20 Nov 2022 01:22:27 +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="rJVjLFct"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 89441851EA; Sun, 20 Nov 2022 01:22:13 +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-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 D044484956 for ; Sun, 20 Nov 2022 01:22:05 +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-x42c.google.com with SMTP id q9so8256164pfg.5 for ; Sat, 19 Nov 2022 16:22:05 -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=8ZUSUMWGXhjZ4QcuBL/EqMRefVmnA5oofCWdDmsDgS4=; b=rJVjLFctwaJjkBt7Bu87mQ/tK4sEwrPAGoKaSSblcNhIOFoQrttnOc7/ylVtfl00Uz yuCRW3hBWcIRyoANS0XlXNTXC9kB9TOadZitbsfQ7Aw8c0emb2z7gpayDRG2tjbgGohy zVef1eP3CU/TV2Nui2WiWUtL9CyW4GFjxFQyJlmVHcFOqrw3WxyDU3sLpkMSdx9E40U9 7jqouGQ5/uAo0Yx2BQKb3fJm0mhe3JVFegApHNNpbWXiOiUNkQjcuDhjAdr3kvhJcR7n R05g3wtSSjRYzQdi45Ch/ek2tGi4RY2lfk6D1Sk1l721R3v/3r3Gz0LsUXXNL232ckGS SfTg== 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=8ZUSUMWGXhjZ4QcuBL/EqMRefVmnA5oofCWdDmsDgS4=; b=7s3STX90D3Zh5UBoKmkArOEvWJw3tcDl+DRHjX60Xc6ddMFmeGeJasn0qT41zv9xPM UgSkIutjiDC27lkDskjVxq7e73B+yzBYfNWD8N02g2PhP2wcR7N0YWEsVfTgZeP7MRXn 5ZkbG7J/Oo8ymtkn5t5v5rDWqPJY/59aO7CVmP0e9VuMcm/zLXUPzHKCaRikz3Osu7F3 SfMm0zq04gH0ykjN5owMqtwsLoZaFOXfppHr9yJ+orlA4E6Dv9tCXq0HRVFRmT532Mi4 Pj4/9mifmQjdpx5ViWWNR9Y4Zv+i9uPFqaBc/lPw9Huq3ltDTwOipUOOwX0Mj++pRMrT dQxg== X-Gm-Message-State: ANoB5pmZ7v523UxMOYq5u6N1HENjMjeRahQQLpV7Fn4ydZSFEBaIb7c1 nu7iF5tpI5tzg/xGh/XSt3yBPlz1WChz7g== X-Received: by 2002:aa7:9d0b:0:b0:572:6da6:de4f with SMTP id k11-20020aa79d0b000000b005726da6de4fmr13965738pfp.26.1668903723825; Sat, 19 Nov 2022 16:22:03 -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.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:03 -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 5/7] eficonfig: use protocol interface for file selection Date: Sun, 20 Nov 2022 09:21:17 +0900 Message-Id: <20221120002119.23683-6-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 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is not always provided by U-Boot. Use protocol interface functions instead of U-Boot internal functions. Signed-off-by: Masahisa Kojima --- Newly created in v10 cmd/eficonfig.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 58a6856666..6779b1792e 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -696,14 +696,14 @@ eficonfig_create_file_entry(struct efimenu *efi_menu, u32 count, u32 i, entry_num = 0; struct eficonfig_file_entry_data *info; - efi_file_setpos_int(f, 0); + EFI_CALL(f->setpos(f, 0)); /* Read directory and construct menu structure */ for (i = 0; i < count; i++) { if (entry_num >= EFICONFIG_ENTRY_NUM_MAX - 1) break; len = sizeof(struct efi_file_info) + EFICONFIG_FILE_PATH_BUF_SIZE; - ret = efi_file_read_int(f, &len, buf); + ret = EFI_CALL(f->read(f, &len, buf)); if (ret != EFI_SUCCESS || len == 0) break; @@ -782,7 +782,8 @@ static efi_status_t eficonfig_show_file_selection(struct eficonfig_select_file_i } INIT_LIST_HEAD(&efi_menu->list); - ret = efi_file_open_int(root, &f, file_info->current_path, EFI_FILE_MODE_READ, 0); + ret = EFI_CALL(root->open(root, &f, file_info->current_path, + EFI_FILE_MODE_READ, 0)); if (ret != EFI_SUCCESS) { eficonfig_print_msg("Reading volume failed!"); free(efi_menu); @@ -793,7 +794,7 @@ static efi_status_t eficonfig_show_file_selection(struct eficonfig_select_file_i /* Count the number of directory entries */ for (;;) { len = sizeof(struct efi_file_info) + EFICONFIG_FILE_PATH_BUF_SIZE; - ret = efi_file_read_int(f, &len, buf); + ret = EFI_CALL(f->read(f, &len, buf)); if (ret != EFI_SUCCESS || len == 0) break; @@ -818,7 +819,7 @@ static efi_status_t eficonfig_show_file_selection(struct eficonfig_select_file_i ret = eficonfig_process_common(efi_menu, " ** Select File **"); err: - efi_file_close_int(f); + EFI_CALL(f->close(f)); eficonfig_destroy(efi_menu); if (tmp_infos) { @@ -1024,7 +1025,7 @@ efi_status_t eficonfig_process_select_file(void *data) if (!tmp->current_volume) return EFI_INVALID_PARAMETER; - ret = efi_open_volume_int(tmp->current_volume, &root); + ret = EFI_CALL(tmp->current_volume->open_volume(tmp->current_volume, &root)); if (ret != EFI_SUCCESS) goto out; From patchwork Sun Nov 20 00:21:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627132 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp965095pvb; Sat, 19 Nov 2022 16:23:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4985R93ihMEYeVCuMJP47MINqzca2BmNh2Dt5hVebyuyeiLmNuxhGBckT7yTkOg8cIuNpR X-Received: by 2002:ab0:2855:0:b0:411:9a0:602e with SMTP id c21-20020ab02855000000b0041109a0602emr6963886uaq.35.1668903799816; Sat, 19 Nov 2022 16:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903799; cv=none; d=google.com; s=arc-20160816; b=Z2hVD9tLiFw8GUIymIGIxa+w2n+jO+zaZrKh6mFIfXxDRN6oVC0q8MAMd/7oN+TIEJ mM9PckTK+n0oNSxkHgk2MoHqWnDSdkQtWZHNSyDcvp6jZ0XJPtqLvBsNww2IR+7BItjO bL6AxK9yOS2OHDRHKKTb8TmZUJI54pSzabAQ69lP5jbPV+t5r007xeHcY+xSj5PB+nBT gYdrwRfw7OPT8T/l7wgYEvgDfO4HiGWboJ6UGAWR0JOaQN0yJGIFjsvMgWTyP6kPCdRu VCPmzui1QRc4fvhJ/Ce36tAs9fDpFKSBvGpS0du5kLEqmrcLbet8311Lr07afgKBbEEn BYww== 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=ZoTzl+0LdLuWobiSCtSPo8FOeQVxpTG8qquic22ND54=; b=ICbmaixnlKEx/qPtbA9L5v8iO/ySUmCT2pV4poGNNsRpNancZr1nBbJLpbT0Hl0n9T Ll3/LE+Y38+VUp6lJY771It04VUvC/nO09uzfgV47bUxomFqQf4pu+BFRhzkIuysWlbi 0lRdNg7k7eOjKBSgrkSBggX05VcOKVmCWYUs1U2EaaXBTZsOtL6gRHysdS44uq7W65g5 IUwLdVKlOiVGOQoVZWkKomQWi+FoRsxmzLHmsFbBuGxmYcZ1XJunSO+zjZAyBpTAhz66 jmCvb2N6Jiuwapx+m6YSiDitdibULWe2RG39HVkwUdugIZ6yEY75DM6URfJHfvvdF0XH Q9LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wO7m8l6d; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id p24-20020ab02a58000000b00418b7661e2dsi1214990uar.152.2022.11.19.16.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:23:19 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wO7m8l6d; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 39CBD8514A; Sun, 20 Nov 2022 01:22:31 +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="wO7m8l6d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3838D80F1E; Sun, 20 Nov 2022 01:22:16 +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 87DCF830E2 for ; Sun, 20 Nov 2022 01:22:10 +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 c203so8231101pfc.11 for ; Sat, 19 Nov 2022 16:22:10 -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=ZoTzl+0LdLuWobiSCtSPo8FOeQVxpTG8qquic22ND54=; b=wO7m8l6dz8dNLp98A1jMm4WCPh5x4XiEnpa3g8ue9UEO4vSO0NbBZwzHlwDxyJaNQY 8YtLDx+Nv555bueUlXTni7wF78U3oFZvdpaeArtmHzbDAtfv/EUOTUNAeEMr2HpGhVWx bi6S3An9N+4atQGg3wEU7u5btqqFDZzI6SlXAjmrjWR/lLbsLuuE4bQANOK6wrTOJhJG LS9pBBB/JOqAqvDNxyQjwq+Ye2cp4moett4uPPo7WxVzvmtJMz51aF0OBUhyXRRx3aGd S0J1VGiMPPYkWS/xSEZnYuTHNaKwydbIbeYzb93acriRcQmrelQZZ+n4w0qdh9qEjhCe 7wrQ== 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=ZoTzl+0LdLuWobiSCtSPo8FOeQVxpTG8qquic22ND54=; b=2Rb/qWIlCPPwlWiJa+51ESLK7DaltHhlLlZRero2nCaVoOpYzSVqOI5gRjf7rr/EO6 p1s/zCVWy90k9d7DF2VPMZPCeWRT9hF+RlI0074WTBPOg7oQkupTcBnkvmHhEZ/zSniT VBCWTkxb1plbDkhwc5GN2+HkZFVyT62tGWhx0965Ce26csI2g8xiTC+/b8cdhxKTmUOG XksuXiCWNtHP7pA/JqPdtapIowM/lOzpLF/ZKzjc15h8j0wwJ2g9Jyfw6VLxRjThb5Gl D58048ryBIai7qyWfT+OkLJP6BoLAFaeSxfknne+FHpCMqurKaciyhbSsM0MiGNAVeHl ML/A== X-Gm-Message-State: ANoB5pnmpg1/+2u5jO8i/f697/tY+5gIDw71bmZPnIfbgZ904WMLnKGQ YpMzx7T6NjxQiUyHYyLCsMmunDu7bbIGew== X-Received: by 2002:aa7:942f:0:b0:56b:a149:1d89 with SMTP id y15-20020aa7942f000000b0056ba1491d89mr13981243pfo.83.1668903728381; Sat, 19 Nov 2022 16:22:08 -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.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:07 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Etienne Carriere , Masahisa Kojima , Roger Knecht , Ovidiu Panait , Ashok Reddy Soma Subject: [PATCH v10 6/7] eficonfig: add UEFI Secure Boot Key enrollment interface Date: Sun, 20 Nov 2022 09:21:18 +0900 Message-Id: <20221120002119.23683-7-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 This commit adds the menu-driven UEFI Secure Boot Key enrollment interface. User can enroll PK, KEK, db and dbx by selecting file. Only the signed EFI Signature List(s) with an authenticated header, typically '.auth' file, is accepted. To clear the PK, KEK, db and dbx, user needs to enroll the null key signed by PK or KEK. Signed-off-by: Masahisa Kojima Reviewed-by: Ilias Apalodimas --- Changes in v10: - use protocol interface - use efi_file_from_path() - use malloc instead of calloc Changes in v9: - move file size check, set ret = EFI_INVALID_PARAMETER Changes in v8: - fix missing efi_file_close_int() call Changes in v7: - only accept .auth file. - remove creating time based authenticated variable - update commit message - use efi_file_size() Changes in v6: - use efi_secure_boot_enabled() - replace with WIN_CERT_REVISION_2_0 from pe.h - call efi_build_signature_store() to check the valid EFI Signature List - update comment Changes in v4: - add CONFIG_EFI_MM_COMM_TEE dependency - fix error handling Changes in v3: - fix error handling Changes in v2: - allow to enroll .esl file - fix typos - add function comments cmd/Makefile | 5 + cmd/eficonfig.c | 3 + cmd/eficonfig_sbkey.c | 263 ++++++++++++++++++++++++++++++++++++++++++ include/efi_config.h | 4 + 4 files changed, 275 insertions(+) create mode 100644 cmd/eficonfig_sbkey.c diff --git a/cmd/Makefile b/cmd/Makefile index 2444d116c0..0b6a96c1d9 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -66,6 +66,11 @@ obj-$(CONFIG_CMD_EEPROM) += eeprom.o obj-$(CONFIG_EFI) += efi.o obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o +ifdef CONFIG_CMD_EFICONFIG +ifdef CONFIG_EFI_MM_COMM_TEE +obj-$(CONFIG_EFI_SECURE_BOOT) += eficonfig_sbkey.o +endif +endif obj-$(CONFIG_CMD_ELF) += elf.o obj-$(CONFIG_CMD_EROFS) += erofs.o obj-$(CONFIG_HUSH_PARSER) += exit.o diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 6779b1792e..44eb82c3c1 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -2438,6 +2438,9 @@ static const struct eficonfig_item maintenance_menu_items[] = { {"Edit Boot Option", eficonfig_process_edit_boot_option}, {"Change Boot Order", eficonfig_process_change_boot_order}, {"Delete Boot Option", eficonfig_process_delete_boot_option}, +#if (CONFIG_IS_ENABLED(EFI_SECURE_BOOT) && CONFIG_IS_ENABLED(EFI_MM_COMM_TEE)) + {"Secure Boot Configuration", eficonfig_process_secure_boot_config}, +#endif {"Quit", eficonfig_process_quit}, }; diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c new file mode 100644 index 0000000000..5130848dd9 --- /dev/null +++ b/cmd/eficonfig_sbkey.c @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Menu-driven UEFI Secure Boot Key Maintenance + * + * Copyright (c) 2022 Masahisa Kojima, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +enum efi_sbkey_signature_type { + SIG_TYPE_X509 = 0, + SIG_TYPE_HASH, + SIG_TYPE_CRL, + SIG_TYPE_RSA2048, +}; + +struct eficonfig_sigtype_to_str { + efi_guid_t sig_type; + char *str; + enum efi_sbkey_signature_type type; +}; + +static const struct eficonfig_sigtype_to_str sigtype_to_str[] = { + {EFI_CERT_X509_GUID, "X509", SIG_TYPE_X509}, + {EFI_CERT_SHA256_GUID, "SHA256", SIG_TYPE_HASH}, + {EFI_CERT_X509_SHA256_GUID, "X509_SHA256 CRL", SIG_TYPE_CRL}, + {EFI_CERT_X509_SHA384_GUID, "X509_SHA384 CRL", SIG_TYPE_CRL}, + {EFI_CERT_X509_SHA512_GUID, "X509_SHA512 CRL", SIG_TYPE_CRL}, + /* U-Boot does not support the following signature types */ +/* {EFI_CERT_RSA2048_GUID, "RSA2048", SIG_TYPE_RSA2048}, */ +/* {EFI_CERT_RSA2048_SHA256_GUID, "RSA2048_SHA256", SIG_TYPE_RSA2048}, */ +/* {EFI_CERT_SHA1_GUID, "SHA1", SIG_TYPE_HASH}, */ +/* {EFI_CERT_RSA2048_SHA_GUID, "RSA2048_SHA", SIG_TYPE_RSA2048 }, */ +/* {EFI_CERT_SHA224_GUID, "SHA224", SIG_TYPE_HASH}, */ +/* {EFI_CERT_SHA384_GUID, "SHA384", SIG_TYPE_HASH}, */ +/* {EFI_CERT_SHA512_GUID, "SHA512", SIG_TYPE_HASH}, */ +}; + +/** + * file_have_auth_header() - check file has EFI_VARIABLE_AUTHENTICATION_2 header + * @buf: pointer to file + * @size: file size + * Return: true if file has auth header, false otherwise + */ +static bool file_have_auth_header(void *buf, efi_uintn_t size) +{ + struct efi_variable_authentication_2 *auth = buf; + + if (auth->auth_info.hdr.wCertificateType != WIN_CERT_TYPE_EFI_GUID) + return false; + + if (guidcmp(&auth->auth_info.cert_type, &efi_guid_cert_type_pkcs7)) + return false; + + return true; +} + +/** + * eficonfig_process_enroll_key() - enroll key into signature database + * + * @data: pointer to the data for each entry + * Return: status code + */ +static efi_status_t eficonfig_process_enroll_key(void *data) +{ + u32 attr; + char *buf = NULL; + efi_uintn_t size; + efi_status_t ret; + struct efi_file_handle *f = NULL; + struct efi_device_path *full_dp = NULL; + struct eficonfig_select_file_info file_info; + + file_info.current_path = calloc(1, EFICONFIG_FILE_PATH_BUF_SIZE); + if (!file_info.current_path) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + + ret = eficonfig_process_select_file(&file_info); + if (ret != EFI_SUCCESS) + goto out; + + full_dp = eficonfig_create_device_path(file_info.dp_volume, file_info.current_path); + if (!full_dp) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + f = efi_file_from_path(full_dp); + if (!f) { + ret = EFI_NOT_FOUND; + goto out; + } + + size = 0; + ret = EFI_CALL(f->getinfo(f, &efi_file_info_guid, &size, NULL)); + if (ret != EFI_BUFFER_TOO_SMALL) + goto out; + + buf = malloc(size); + if (!buf) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + ret = EFI_CALL(f->getinfo(f, &efi_file_info_guid, &size, buf)); + if (ret != EFI_SUCCESS) + goto out; + + size = ((struct efi_file_info *)buf)->file_size; + free(buf); + + if (!size) { + eficonfig_print_msg("ERROR! File is empty."); + ret = EFI_INVALID_PARAMETER; + goto out; + } + + buf = malloc(size); + if (!buf) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + + ret = EFI_CALL(f->read(f, &size, buf)); + if (ret != EFI_SUCCESS) { + eficonfig_print_msg("ERROR! Failed to read file."); + goto out; + } + if (!file_have_auth_header(buf, size)) { + eficonfig_print_msg("ERROR! Invalid file format. Only .auth variables is allowed."); + ret = EFI_INVALID_PARAMETER; + goto out; + } + + attr = EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS | + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; + + /* PK can enroll only one certificate */ + if (u16_strcmp(data, u"PK")) { + efi_uintn_t db_size = 0; + + /* check the variable exists. If exists, add APPEND_WRITE attribute */ + ret = efi_get_variable_int(data, efi_auth_var_get_guid(data), NULL, + &db_size, NULL, NULL); + if (ret == EFI_BUFFER_TOO_SMALL) + attr |= EFI_VARIABLE_APPEND_WRITE; + } + + ret = efi_set_variable_int((u16 *)data, efi_auth_var_get_guid((u16 *)data), + attr, size, buf, false); + if (ret != EFI_SUCCESS) + eficonfig_print_msg("ERROR! Failed to update signature database"); + +out: + free(file_info.current_path); + free(buf); + efi_free_pool(full_dp); + if (f) + EFI_CALL(f->close(f)); + + /* return to the parent menu */ + ret = (ret == EFI_ABORTED) ? EFI_NOT_READY : ret; + + return ret; +} + +static struct eficonfig_item key_config_menu_items[] = { + {"Enroll New Key", eficonfig_process_enroll_key}, + {"Quit", eficonfig_process_quit}, +}; + +/** + * eficonfig_process_set_secure_boot_key() - display the key configuration menu + * + * @data: pointer to the data for each entry + * Return: status code + */ +static efi_status_t eficonfig_process_set_secure_boot_key(void *data) +{ + u32 i; + efi_status_t ret; + char header_str[32]; + struct efimenu *efi_menu; + + for (i = 0; i < ARRAY_SIZE(key_config_menu_items); i++) + key_config_menu_items[i].data = data; + + snprintf(header_str, sizeof(header_str), " ** Configure %ls **", (u16 *)data); + + while (1) { + efi_menu = eficonfig_create_fixed_menu(key_config_menu_items, + ARRAY_SIZE(key_config_menu_items)); + + ret = eficonfig_process_common(efi_menu, header_str); + eficonfig_destroy(efi_menu); + + if (ret == EFI_ABORTED) + break; + } + + /* return to the parent menu */ + ret = (ret == EFI_ABORTED) ? EFI_NOT_READY : ret; + + return ret; +} + +static const struct eficonfig_item secure_boot_menu_items[] = { + {"PK", eficonfig_process_set_secure_boot_key, u"PK"}, + {"KEK", eficonfig_process_set_secure_boot_key, u"KEK"}, + {"db", eficonfig_process_set_secure_boot_key, u"db"}, + {"dbx", eficonfig_process_set_secure_boot_key, u"dbx"}, + {"Quit", eficonfig_process_quit}, +}; + +/** + * eficonfig_process_secure_boot_config() - display the key list menu + * + * @data: pointer to the data for each entry + * Return: status code + */ +efi_status_t eficonfig_process_secure_boot_config(void *data) +{ + efi_status_t ret; + struct efimenu *efi_menu; + + while (1) { + char header_str[64]; + + snprintf(header_str, sizeof(header_str), + " ** UEFI Secure Boot Key Configuration (SecureBoot : %s) **", + (efi_secure_boot_enabled() ? "ON" : "OFF")); + + efi_menu = eficonfig_create_fixed_menu(secure_boot_menu_items, + ARRAY_SIZE(secure_boot_menu_items)); + if (!efi_menu) { + ret = EFI_OUT_OF_RESOURCES; + break; + } + + ret = eficonfig_process_common(efi_menu, header_str); + eficonfig_destroy(efi_menu); + + if (ret == EFI_ABORTED) + break; + } + + /* return to the parent menu */ + ret = (ret == EFI_ABORTED) ? EFI_NOT_READY : ret; + + return ret; +} diff --git a/include/efi_config.h b/include/efi_config.h index 934de41e85..fd69926343 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -101,5 +101,9 @@ efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu); struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_volume, u16 *current_path); +void *eficonfig_create_fixed_menu(const struct eficonfig_item *items, int count); +#ifdef CONFIG_EFI_SECURE_BOOT +efi_status_t eficonfig_process_secure_boot_config(void *data); +#endif #endif From patchwork Sun Nov 20 00:21:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627133 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp965147pvb; Sat, 19 Nov 2022 16:23:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf79IL+wClULeueMnt31w5oHWaznh5+DkG7N+Dnkb9SeZyestf8+DSJLudgsT0M98a3Exyh2 X-Received: by 2002:ab0:1547:0:b0:414:40d1:f39d with SMTP id p7-20020ab01547000000b0041440d1f39dmr6916391uae.98.1668903811246; Sat, 19 Nov 2022 16:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903811; cv=none; d=google.com; s=arc-20160816; b=Bkd7Mi2k4DA6AUuACE8ODPJqdCqKUxUvhhTum8olweifxpd4ph0QUS3LtsLXtxfCm+ DOz+Z7liMFT8lNDP0I59xIiGyedoHPJzA8/5KcsokG+cHPQfWKhqScUjCZ2wnxVVY66J OmP+sglNrV89hQTW18TxIuOAg4Nz2VLPV0BRfdm0vwYMePsspNlJOoiVeUfrBMmODun5 wYCBuMlPmbCegKQwgdTwo4Pi84+zkhGL8bAlHPqUYStg45hmkR8hqaEsPsp91oqyTqB8 VeLJ/s6wZXkStZ2CLZurJD57NFQlpkeANeQAjPiRpNsHLzso7b+BZGd76u/f79BHNYzA 3Fjg== 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=d75uSlHisjPgecWpamMXm97iNxvYW1HLSot48w4Zduo=; b=kc2sTcxsyH2UOPHFXDM/J/fIX2fbvYuHz8T02+raDnyWz+zCDD5TZ6quZbudDtE2Ta jxyySF3Yz0g7RP7fkObc/rVmIFprtApvQjE9PZjd31cvigkFRStMV4f2A2n5ZsI4sur0 QtusHVJffhD5l6ocefsjnx9PmQR0TCjPpAVqk+nQPP0MW5LlI7UHpF+qwhybltkUX+vq D4aQQvwfZFmFUce2xE+JYjMd9yGWYzZInaSi9R8s02XneKjdEC5zbavwRUqnO9bJ7RDH zg0bUIDGw02b+nLu+dHUw2GVpQ2iNDRG/OSYGrcluyN6LxD4L/5y9/wsPi5ENGxwBMUD kybQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Awae6N4S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id d188-20020a671dc5000000b003acfaf8d2f3si1263644vsd.89.2022.11.19.16.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Awae6N4S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 A4CA38524F; Sun, 20 Nov 2022 01:22:33 +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="Awae6N4S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 509E9830E2; Sun, 20 Nov 2022 01:22:17 +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-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (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 5BE978504C for ; Sun, 20 Nov 2022 01:22:12 +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-x633.google.com with SMTP id 4so7664343pli.0 for ; Sat, 19 Nov 2022 16:22:12 -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=d75uSlHisjPgecWpamMXm97iNxvYW1HLSot48w4Zduo=; b=Awae6N4S07/1XfZkNche9ruxvYVfKdRJgbsCWU8NrEoZV1OD2raUSoIeJkXJ36cF4A M1ehb8/dZaI68MG78eyITaL5BdUikZQ9qmQEF3zYYyM+G/r/9lDoQYE5WPNNuUedAA/I JsGwGS5SJLcl620E68mnI2qeWSZM0b76RQb5EEHk1pFfoc9sds/5kUlridbjg5xM5Lo0 +veVSmvWYAicPO9pvpSK9Av9Z8vkWk023QvRyVC9qo0tGulsLxMZjJtE9v6HT1gz8Cy7 mLJujMJO9k0bD/Ao72F7DY6UR5sq5HMvIUtN7mWyqqE3xaeHkQ+71ueKZnxiQvPldW3d SZKg== 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=d75uSlHisjPgecWpamMXm97iNxvYW1HLSot48w4Zduo=; b=e2Ot+srMsVIzSB+xmuBrqlbdfNO0awNc4MIiEQmlNCwsBrm9Cy6+MJR5RRflspYj3h remDc9/RWGWCfUYSqUmE7v9qZd0VSroryIwWFlV5lt3Hu2r9/xWgJjU7vgkoaYlrNb8N umnHIIcP+dZFuT3VdQ5ixz/T0MYWe/hEIT2qRBZivmF1OsKQDCj3GySoISyEyHCIjI+s 5DEJ08XMLcJkUzViCSTwveRADJgAmOdr/gbLreupAFH/cw5JxkjnQrLtSj5YXY8eGKxU B4CB0xsIn2Aqp03u5/BySNhkXPCyzLOYrZtz6+Z8E6m4O/haOmYwNUnVt4gBJSy5VjKp g2bg== X-Gm-Message-State: ANoB5plo3IEjHc/uY1vbslR5Py0jkeG9qEh3Sg2F5aBoGGN3vMFCOcKq ep47NGIjc036XUoM4zVwtRVwkPQ9x6pwEA== X-Received: by 2002:a17:902:f313:b0:186:8518:6c97 with SMTP id c19-20020a170902f31300b0018685186c97mr5793949ple.94.1668903731578; Sat, 19 Nov 2022 16:22:11 -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.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:10 -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 7/7] eficonfig: add "Show Signature Database" menu entry Date: Sun, 20 Nov 2022 09:21:19 +0900 Message-Id: <20221120002119.23683-8-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 This commit adds the menu-driven interface to show the signature list content. Signed-off-by: Masahisa Kojima Acked-by: Ilias Apalodimas --- Changes in v10: - change buffer size to appropriate value(37) - use strdup() No update since v7 Changes in v7: - remove delete signature list feature user can clear the signature database with signed null key - rename function name to avoid confusion - update commit message Changes in v6: - update comment Changes in v2: - integrate show and delete signature database menu - add confirmation message before delete - add function comment cmd/eficonfig_sbkey.c | 235 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c index 5130848dd9..6e0bebf1d4 100644 --- a/cmd/eficonfig_sbkey.c +++ b/cmd/eficonfig_sbkey.c @@ -17,6 +17,13 @@ #include #include +struct eficonfig_sig_data { + struct efi_signature_list *esl; + struct efi_signature_data *esd; + struct list_head list; + u16 *varname; +}; + enum efi_sbkey_signature_type { SIG_TYPE_X509 = 0, SIG_TYPE_HASH, @@ -176,8 +183,236 @@ out: return ret; } +/** + * eficonfig_process_show_siglist() - show signature list content + * + * @data: pointer to the data for each entry + * Return: status code + */ +static efi_status_t eficonfig_process_show_siglist(void *data) +{ + u32 i; + struct eficonfig_sig_data *sg = data; + + puts(ANSI_CURSOR_HIDE); + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + + printf("\n ** Show Signature Database (%ls) **\n\n" + " Owner GUID:\n" + " %pUL\n", + sg->varname, sg->esd->signature_owner.b); + + for (i = 0; i < ARRAY_SIZE(sigtype_to_str); i++) { + if (!guidcmp(&sg->esl->signature_type, &sigtype_to_str[i].sig_type)) { + printf(" Signature Type:\n" + " %s\n", sigtype_to_str[i].str); + + switch (sigtype_to_str[i].type) { + case SIG_TYPE_X509: + { + struct x509_certificate *cert_tmp; + + cert_tmp = x509_cert_parse(sg->esd->signature_data, + sg->esl->signature_size); + printf(" Subject:\n" + " %s\n" + " Issuer:\n" + " %s\n", + cert_tmp->subject, cert_tmp->issuer); + break; + } + case SIG_TYPE_CRL: + { + u32 hash_size = sg->esl->signature_size - sizeof(efi_guid_t) - + sizeof(struct efi_time); + struct efi_time *time = + (struct efi_time *)((u8 *)sg->esd->signature_data + + hash_size); + + printf(" ToBeSignedHash:\n"); + print_hex_dump(" ", DUMP_PREFIX_NONE, 16, 1, + sg->esd->signature_data, hash_size, false); + printf(" TimeOfRevocation:\n" + " %d-%d-%d %02d:%02d:%02d\n", + time->year, time->month, time->day, + time->hour, time->minute, time->second); + break; + } + case SIG_TYPE_HASH: + { + u32 hash_size = sg->esl->signature_size - sizeof(efi_guid_t); + + printf(" Hash:\n"); + print_hex_dump(" ", DUMP_PREFIX_NONE, 16, 1, + sg->esd->signature_data, hash_size, false); + break; + } + default: + eficonfig_print_msg("ERROR! Unsupported format."); + return EFI_INVALID_PARAMETER; + } + } + } + + while (tstc()) + getchar(); + + printf("\n\n Press any key to continue"); + getchar(); + + return EFI_SUCCESS; +} + +/** + * prepare_signature_list_menu() - create the signature list menu entry + * + * @efimenu: pointer to the efimenu structure + * @varname: pointer to the variable name + * @db: pointer to the variable raw data + * @db_size: variable data size + * @func: callback of each entry + * Return: status code + */ +static efi_status_t prepare_signature_list_menu(struct efimenu *efi_menu, void *varname, + void *db, efi_uintn_t db_size, + eficonfig_entry_func func) +{ + u32 num = 0; + efi_uintn_t size; + struct eficonfig_sig_data *sg; + struct efi_signature_list *esl; + struct efi_signature_data *esd; + efi_status_t ret = EFI_SUCCESS; + + INIT_LIST_HEAD(&efi_menu->list); + + esl = db; + size = db_size; + while (size > 0) { + u32 remain; + + esd = (struct efi_signature_data *)((u8 *)esl + + (sizeof(struct efi_signature_list) + + esl->signature_header_size)); + remain = esl->signature_list_size - sizeof(struct efi_signature_list) - + esl->signature_header_size; + for (; remain > 0; remain -= esl->signature_size) { + char buf[37]; + char *title; + + if (num >= EFICONFIG_ENTRY_NUM_MAX - 1) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + + sg = calloc(1, sizeof(struct eficonfig_sig_data)); + if (!sg) { + ret = EFI_OUT_OF_RESOURCES; + goto err; + } + + snprintf(buf, sizeof(buf), "%pUL", &esd->signature_owner); + title = strdup(buf); + if (!title) { + free(sg); + ret = EFI_OUT_OF_RESOURCES; + goto err; + } + + sg->esl = esl; + sg->esd = esd; + sg->varname = varname; + ret = eficonfig_append_menu_entry(efi_menu, title, func, sg); + if (ret != EFI_SUCCESS) { + free(sg); + free(title); + goto err; + } + esd = (struct efi_signature_data *)((u8 *)esd + esl->signature_size); + num++; + } + + size -= esl->signature_list_size; + esl = (struct efi_signature_list *)((u8 *)esl + esl->signature_list_size); + } +out: + ret = eficonfig_append_quit_entry(efi_menu); +err: + return ret; +} + +/** + * enumerate_and_show_signature_database() - enumerate and show the signature database + * + * @data: pointer to the data for each entry + * Return: status code + */ +static efi_status_t enumerate_and_show_signature_database(void *varname) +{ + void *db; + char buf[50]; + efi_status_t ret; + efi_uintn_t db_size; + struct efimenu *efi_menu; + struct list_head *pos, *n; + struct eficonfig_entry *entry; + + db = efi_get_var(varname, efi_auth_var_get_guid(varname), &db_size); + if (!db) { + eficonfig_print_msg("There is no entry in the signature database."); + return EFI_NOT_FOUND; + } + + efi_menu = calloc(1, sizeof(struct efimenu)); + if (!efi_menu) { + free(db); + return EFI_OUT_OF_RESOURCES; + } + + ret = prepare_signature_list_menu(efi_menu, varname, db, db_size, + eficonfig_process_show_siglist); + if (ret != EFI_SUCCESS) + goto out; + + snprintf(buf, sizeof(buf), " ** Show Signature Database (%ls) **", (u16 *)varname); + ret = eficonfig_process_common(efi_menu, buf); +out: + list_for_each_safe(pos, n, &efi_menu->list) { + entry = list_entry(pos, struct eficonfig_entry, list); + free(entry->data); + } + eficonfig_destroy(efi_menu); + free(db); + + return ret; +} + +/** + * eficonfig_process_show_signature_database() - process show signature database + * + * @data: pointer to the data for each entry + * Return: status code + */ +static efi_status_t eficonfig_process_show_signature_database(void *data) +{ + efi_status_t ret; + + while (1) { + ret = enumerate_and_show_signature_database(data); + if (ret != EFI_SUCCESS && ret != EFI_NOT_READY) + break; + } + + /* return to the parent menu */ + ret = (ret == EFI_ABORTED) ? EFI_NOT_READY : ret; + + return ret; +} + static struct eficonfig_item key_config_menu_items[] = { {"Enroll New Key", eficonfig_process_enroll_key}, + {"Show Signature Database", eficonfig_process_show_signature_database}, {"Quit", eficonfig_process_quit}, };