From patchwork Thu Feb 2 09:24:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 649658 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp135847pva; Thu, 2 Feb 2023 01:26:58 -0800 (PST) X-Google-Smtp-Source: AK7set89vGtetnNbdevPBVsi9xkR1GBrPbQoN5MBmPHJGVsqNtrGYjVG1N45ygZ68H0IIueVVXA7 X-Received: by 2002:a05:6870:c110:b0:169:c54d:f069 with SMTP id f16-20020a056870c11000b00169c54df069mr1958829oad.26.1675330018519; Thu, 02 Feb 2023 01:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675330018; cv=none; d=google.com; s=arc-20160816; b=aD8q3L9yLWF7gkwzLwkkcW7oNiCgWG9CL5wKxuxtpMOQXIFCzlsidiN0+R498ZB6vM hZ1k9N8s5+ZJls0Bwyi532c3Hp/tj/dNteTrCUOxDXyumk5aDUTuncU1mwGG8fpTKp46 QfQ7NTVcIgtc4mAVk0DzE/zaIoaq8ME0OGRB5ZANJI1kA2bPa8ycGcXZSy4yU3t5gZvT gDNIZuFLasd1wXdJlEB6f6ZE5rjP53Jb9woloU5UXdyHnD2fJ25+p0SURlItk+YpoXPS W+X7YytESt5BuiEdXVJanhQLwgfhzszYPUmLmadcSdZBG4cAFBqc/estDJIKTS5ZejaR 4r4A== 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=YkdVmec8Fl4UESa3kEEinVuit1sXPSFVThoYSZy1S6E=; b=iE1KoNgDRUY2jK8d0XYEpgqQhUS1p2DFNBnPVv3lXL4DzWLXfC1D2nxo2GRamzi5A6 oOGZz2o7KPP6k1Y0VtRuf5VAv4T6qIq2ngfnK51l5Lb2LLlqFgORU9UQlCl0BV4mxf+2 hgVsffksDLMnkAhhP1MQxcl8BP1Nsh9zE+1c/uQ32D++/NDqr+OOaV1a9L3Jd1zWPbfl 5od4yWRU9TeDqgaay783p8hkPF74uTWrC1SE0S0MTNXUdyYTRMRb06yrHUgTtFjWB2hw 5gz74hIelP4HK3CtjOM44O8GrI8Jek8DdmKF5k/Hpq/lKB2seyz+7zUgXHrHDiC2lnGl vAfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gk4UBhBP; 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 lb5-20020a056871414500b001375188e083si18669044oab.47.2023.02.02.01.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 01:26:58 -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=gk4UBhBP; 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 A892685EFC; Thu, 2 Feb 2023 10:26:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gk4UBhBP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 04B6585F01; Thu, 2 Feb 2023 10:25:44 +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-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 A30DC85ED6 for ; Thu, 2 Feb 2023 10:25:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pl1-x62f.google.com with SMTP id b5so1232889plz.5 for ; Thu, 02 Feb 2023 01:25:19 -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=YkdVmec8Fl4UESa3kEEinVuit1sXPSFVThoYSZy1S6E=; b=gk4UBhBPTNuhORIfxTgJmOy5wm+d+dI7LogyIAGJweSMuSSigDzNBOF4amcpVKiKF/ cxvOqHdOm8blVekTH9LGX4z9EhcRrJMe22Pf9yW6umEobQ7gjlrV/EJFdvvgZ5gthVCK e/oBkNMMzUgxECfvdOgY6c3zKZ5d7RR+vm+cI7xmFHFns9aGj/A63yeDEQBrpTaGhsHJ hxsDF0iGjcc9N10TCLcmm/eRVyvASokmq8gAsSutswYfDIUqUENcBUdyoidAU+3P1SUW P3xcCpBU7f8jVUT93X0kQjin8RibC3ObdqHLa5FDLXFioA614k+6B39PFn8utQdUw8Vl bNgQ== 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=YkdVmec8Fl4UESa3kEEinVuit1sXPSFVThoYSZy1S6E=; b=AGzop75dOhZGbn8MnEtVFtbV5Qz4KD7jHEKuB72uvH7o072xbfMnvg3lltk1K8jER0 foP+t8TOdcs80PA8bynXriL69Ji8oyuDnYoR24d1ia66lcRuEmFenKH47z7N9kPc5+In e2aJtHLYuKb/Hek7JYyoK8aCh6C2QT+fRkz3SZI3f6BsdNu7Fi6gHI0ZMR9SUTmH22QG whSnT4SrlRfzxaaDP2EliDaVdBsIUcIh7c/fa+hR8VNxstJagGelsf0ZK5GE8xM9Rf4T skFkkB+mrwyn3ygQBu1LsENdGuYI+/z4spZsMalkx/wWthoN3IXfHxKu/SDKYrDxvQTm 9LCg== X-Gm-Message-State: AO0yUKWo0pVCvhYirNTZTgRkC7xeyapE0bdtoJDhzUB2VjzbUOl19v7n KwpR5H3Uj36B3L0FeMy8R7qSico6kZOWrnJo7V8= X-Received: by 2002:a17:902:f202:b0:194:3fa4:3f46 with SMTP id m2-20020a170902f20200b001943fa43f46mr4380808plc.29.1675329917674; Thu, 02 Feb 2023 01:25:17 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id w4-20020a170902a70400b0019619f27525sm13120349plq.302.2023.02.02.01.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 01:25:17 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima Subject: [PATCH 5/5] eficonfig: add error message of SetVariable Date: Thu, 2 Feb 2023 18:24:47 +0900 Message-Id: <20230202092447.28590-6-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230202092447.28590-1-masahisa.kojima@linaro.org> References: <20230202092447.28590-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 commits add the error message when EFI Runtime Service SetVariable() failed. Signed-off-by: Masahisa Kojima --- cmd/eficonfig.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index b0c8637676..c5cbf27631 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -30,6 +30,8 @@ static const char *eficonfig_change_boot_order_desc = " Press SPACE to activate or deactivate the entry\n" " CTRL+S to save, ESC to quit"; +static const char *set_variable_fail_str = "SetVariable failed!"; + static struct efi_simple_text_output_protocol *cout; static int avail_row; @@ -1274,6 +1276,9 @@ static efi_status_t eficonfig_set_boot_option(u16 *varname, struct efi_device_pa EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, size, p, false); + if (ret != EFI_SUCCESS) + eficonfig_print_msg(set_variable_fail_str, ret); + free(p); return ret; @@ -1309,8 +1314,10 @@ efi_status_t eficonfig_append_bootorder(u16 index) EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, new_size, new_bootorder, false); - if (ret != EFI_SUCCESS) + if (ret != EFI_SUCCESS) { + eficonfig_print_msg(set_variable_fail_str, ret); goto out; + } out: free(bootorder); @@ -2155,6 +2162,8 @@ static efi_status_t eficonfig_process_save_boot_order(void *data) EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, size, new_bootorder, false); + if (ret != EFI_SUCCESS) + eficonfig_print_msg(set_variable_fail_str, ret); save_data->selected = true; out: @@ -2394,7 +2403,7 @@ static efi_status_t delete_boot_option(u16 boot_index) ret = efi_set_variable_int(varname, &efi_global_variable_guid, 0, 0, NULL, false); if (ret != EFI_SUCCESS) { - log_err("delete boot option(%ls) failed\n", varname); + eficonfig_print_msg("Delete boot option(%ls) failed!", ret); return ret; } @@ -2415,6 +2424,8 @@ static efi_status_t delete_boot_option(u16 boot_index) EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, size, bootorder, false); + if (ret != EFI_SUCCESS) + eficonfig_print_msg(set_variable_fail_str, ret); return ret; } @@ -2672,13 +2683,18 @@ efi_status_t eficonfig_generate_media_device_boot_option(void) EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, opt[i].size, opt[i].lo, false); - if (ret != EFI_SUCCESS) + if (ret != EFI_SUCCESS) { + eficonfig_print_msg(set_variable_fail_str, ret); goto out; + } ret = eficonfig_append_bootorder(boot_index); if (ret != EFI_SUCCESS) { efi_set_variable_int(var_name, &efi_global_variable_guid, 0, 0, NULL, false); + if (ret != EFI_SUCCESS) + eficonfig_print_msg(set_variable_fail_str, ret); + goto out; } }