From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06C25C11F66 for ; Tue, 29 Jun 2021 12:26:19 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 494A561D94 for ; Tue, 29 Jun 2021 12:26:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 494A561D94 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B0DA82E41; Tue, 29 Jun 2021 14:26:16 +0200 (CEST) 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="HKInON22"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE65282EB5; Tue, 29 Jun 2021 14:26:14 +0200 (CEST) Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 428F782E17 for ; Tue, 29 Jun 2021 14:26:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x629.google.com with SMTP id o3so5711797plg.4 for ; Tue, 29 Jun 2021 05:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=/8+qOYvINxdq6K9PqIyuSNOLdAbspzbMoomjHvCYcRM=; b=HKInON22XHXZjDcYqhPSv8NVCjZBqdMZU0QB0nrNN+WyzEYkI2cADNOv9/aP/QUQBE i3KB0DduOTuRUxPlh6i6J6Zp9ibucTCkY8xB+pu7Qnf3uLl1JdYu1ZamosLY8H5HXnum A8qVopk+2hrSEh/dD3IjXf/snu/CHKplIo7DGE8hF8i4c/Qdt79HW3fBFj3eppCXKXoy Fu5QiJJecjywGCDBAwuPhj6wUoJcPN0ZoCAv5oEo8+VtefwJd2Z2pq3YgObDwLFsFXIy UzQvbYFSg4BrJHUUyKqn9qcrajzdbcuMh5f+1WAwLYYOUecalB2h2uMuBagO5cEfh96a 1waw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=/8+qOYvINxdq6K9PqIyuSNOLdAbspzbMoomjHvCYcRM=; b=pheLodYNPWAGTs8gY1Qbmv1OU0clJgMYNz4/sG4BwAqWdbhn2xezaS27Z+4ijef01J C9O4fqKYReVlPsBMugNxpRURmmVzoxvwPyqwV38qCOOwuKBIo8sZ8BYxBXXuIlyoRWKF Iwo2dDyd8lW+L0krdpE2qX1al62zNAkRBHPselFzmukaXBpa5/VCzfDHHdl9022Yob8Z r0soY2dC950QnazlmZdsnJD0S9rCKsNBscb7BH8ZuP7y+5eyQrKYsPoR52q01qRZPRA6 +mhdTEdx4yTUvtUd7PZygIlQRBErXoSK2bf03dYSsa1YuP0knkHSItqP88JXOpWTkmAL wnOA== X-Gm-Message-State: AOAM530EBAGIlrJsHrVyVV4VLRQckxdDq6EHBXzHNLpF/CUX6c99+wni wWyV9ZjnCcpGpg4Ri1n5qssd7g== X-Google-Smtp-Source: ABdhPJzzsyq6D32CX/3R+NfQn86Q32vnHyZw72RcIOjg40MFTx63PIkOhMODIfgGTX+61Y6YtEjmRw== X-Received: by 2002:a17:902:d101:b029:121:9fa2:969e with SMTP id w1-20020a170902d101b02901219fa2969emr27534393plw.23.1624969565684; Tue, 29 Jun 2021 05:26:05 -0700 (PDT) Received: from laputa (p3dd30534.tkyea130.ap.so-net.ne.jp. [61.211.5.52]) by smtp.gmail.com with ESMTPSA id n127sm7538659pga.58.2021.06.29.05.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 05:26:05 -0700 (PDT) Date: Tue, 29 Jun 2021 21:26:01 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas , Sughosh Ganu Subject: Re: [PATCH 1/1] efi_loader: fix set_capsule_result() Message-ID: <20210629122601.GA47632@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas , Sughosh Ganu References: <20210629074021.63612-1-xypron.glpk@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210629074021.63612-1-xypron.glpk@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Tue, Jun 29, 2021 at 09:40:21AM +0200, Heinrich Schuchardt wrote: > The log category must be LOG_CATEGORY LOGC_EFI. > > efi_set_variable() should be called with EFI_CALL(). Use > efi_set_variable_int() instead. > > A log text "Updating ..." if SetVariable() fails does not make sense for a > variable that is not required to be preexisting. > > Flag EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED must be reset in > variable OsIndications. You are trying to fix several irrelevant issues here. Please split them into separate patches as you have always asked me before. -Takahiro Akashi > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_loader/efi_capsule.c | 38 +++++++++++++++++++++++++++++------- > 1 file changed, 31 insertions(+), 7 deletions(-) > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 60309d4a07..f7c0c5725f 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -6,6 +6,8 @@ > * Author: AKASHI Takahiro > */ > > +#define LOG_CATEGORY LOGC_EFI > + > #include > #include > #include > @@ -84,6 +86,8 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, > struct efi_capsule_result_variable_header result; > struct efi_time time; > efi_status_t ret; > + efi_uintn_t size; > + u64 os_indications; > > efi_create_indexed_name(variable_name16, sizeof(variable_name16), > "Capsule", index); > @@ -95,13 +99,33 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, > else > memset(&result.capsule_processed, 0, sizeof(time)); > result.capsule_status = return_status; > - ret = efi_set_variable(variable_name16, &efi_guid_capsule_report, > - EFI_VARIABLE_NON_VOLATILE | > - EFI_VARIABLE_BOOTSERVICE_ACCESS | > - EFI_VARIABLE_RUNTIME_ACCESS, > - sizeof(result), &result); > - if (ret) > - log_err("EFI: creating %ls failed\n", variable_name16); > + ret = efi_set_variable_int(variable_name16, &efi_guid_capsule_report, > + EFI_VARIABLE_NON_VOLATILE | > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > + EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof(result), &result, false); > + if (ret != EFI_SUCCESS) > + log_err("Setting %ls failed\n", variable_name16); > + > + if (return_status != EFI_SUCCESS) > + return; > + > + size = sizeof(os_indications); > + ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid, > + NULL, &size, &os_indications, NULL); > + if (ret != EFI_SUCCESS) > + os_indications = 0; > + else > + os_indications &= > + ~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED; > + ret = efi_set_variable_int(L"OsIndications", &efi_global_variable_guid, > + EFI_VARIABLE_NON_VOLATILE | > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > + EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof(os_indications), &os_indications, > + false); > + if (ret != EFI_SUCCESS) > + log_err("Setting %ls failed\n", L"OsIndications"); > } > > #ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT > -- > 2.30.2 >