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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 199AFC6FA8E for ; Thu, 2 Mar 2023 05:17:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3D2285B16; Thu, 2 Mar 2023 06:16:59 +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="qZonGKlr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7ADAE85B2A; Thu, 2 Mar 2023 06:16:58 +0100 (CET) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (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 5390D85AF7 for ; Thu, 2 Mar 2023 06:16:54 +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=takahiro.akashi@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id y10so9369370pfi.8 for ; Wed, 01 Mar 2023 21:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677734212; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=JOjgKttmj3dtFIGL3hqtYnjt8Hntu/o7nMFdXRCSUEk=; b=qZonGKlr1yYwgsGjZjAR0IqoGcVpq1Qc9MPqsUhTO1nwdOggvskhC0lFihei5nSMp0 22s3b9Drc5ar5PfJNWBroP9pEFjbAkql1dC3ITc4AJKjRgBhk73T8o+sVDFdylrTIWP2 K6LpaQxpmeM34pe/ESCe41kW5JL1RmASm+uJlxzCO+u03A3ZNsJ5tqKIbV7cH60l4b+U V+JbSVq2QdRbibDiHWFQnXb/ix3Yom5uWs9SL+fU7fAHqTCsHM6J8GF+1Jhdg/YEjDDb uq6K+V0jPQ0B35fDH2CmAxIzSfo+3rg+Sa049NmhJ9QIVx0FLnbeq1grQg34xGTwpIps P+iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677734212; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JOjgKttmj3dtFIGL3hqtYnjt8Hntu/o7nMFdXRCSUEk=; b=to4elvZ5pEzLsK5xOcX/E9Jtc+7lrZl9yBF4MISICoMD45MZ/chsGdiSgCCttRiMZo U1CaM9TgpJ+a/MA2CHLr9Vyvm+fEGjo4rET/1rXiMFjQlXVZhuFeE1y8w4oT3VZjZlcf w02hgkdPGgNkzaPRVx9OK4fmT7CqDT5TVWSXYHEYwfED92kYxQC6dY91cL4lD4ogHY4t bDYTi5BSnwjtzH/eP+j66xeVaV8SrFHMtIoGx1VMfKrqVDUe1Akng+gisODMtYFbm6Ow BfeVR2o3DnhdSkIz4B8NFXzZVIwlNAT+yNrEylYnoyKKmxJ07zaEKK4lr06/gSvpiuTO klWQ== X-Gm-Message-State: AO0yUKXjqzDq6YBsv2HwYLM+425657MZpnpTr1CtOjHBIcthPKCsv/e3 1i9+KYGD5WHhv+Cw+78hbtWRpQ== X-Google-Smtp-Source: AK7set86c0A0pGy3+qJ0z46Svlqi6Ww8/L2yl7FRhzXktbiF/K9iE8PU4F7acJAzBCOQ4dVDBajjdg== X-Received: by 2002:a05:6a00:4087:b0:5ef:8b7f:f69b with SMTP id bw7-20020a056a00408700b005ef8b7ff69bmr8278438pfb.0.1677734212623; Wed, 01 Mar 2023 21:16:52 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:91c7:d373:91a1:d173]) by smtp.gmail.com with ESMTPSA id n18-20020a637212000000b004cd2eebc551sm8136220pgc.62.2023.03.01.21.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 21:16:51 -0800 (PST) Date: Thu, 2 Mar 2023 14:16:48 +0900 From: Takahiro Akashi To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas Subject: Re: [PATCH v2 2/4] efi_loader: versioning support in GetImageInfo Message-ID: <20230302051648.GB44192@laputa> Mail-Followup-To: Takahiro Akashi , Masahisa Kojima , u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas References: <20230301091523.18384-1-masahisa.kojima@linaro.org> <20230301091523.18384-3-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230301091523.18384-3-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 On Wed, Mar 01, 2023 at 06:15:20PM +0900, Masahisa Kojima wrote: > Current FMP->GetImageInfo() always return 0 for the firmware > version, user can not identify which firmware version is currently > running through the EFI interface. > > This commit reads the "FmpStateXXXX" EFI variable, then fills the > firmware version, lowest supported version, last attempt version > and last attempt status in FMP->GetImageInfo(). > > Now FMP->GetImageInfo() and ESRT have the meaningful version number. > > Signed-off-by: Masahisa Kojima > --- > No update since v1 > > lib/efi_loader/efi_firmware.c | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > index d1afafb052..ead20fa914 100644 > --- a/lib/efi_loader/efi_firmware.c > +++ b/lib/efi_loader/efi_firmware.c > @@ -173,13 +173,38 @@ static efi_status_t efi_fill_image_desc_array( > *package_version_name = NULL; /* not supported */ > > for (i = 0; i < num_image_type_guids; i++) { > + u16 varname[13]; /* u"FmpStateXXXX" */ > + efi_status_t ret; > + efi_uintn_t size; > + struct fmp_state var_state = { 0 }; > + > image_info[i].image_index = fw_array[i].image_index; > image_info[i].image_type_id = fw_array[i].image_type_id; > image_info[i].image_id = fw_array[i].image_index; > > image_info[i].image_id_name = fw_array[i].fw_name; > > - image_info[i].version = 0; /* not supported */ > + efi_create_indexed_name(varname, sizeof(varname), "FmpState", > + fw_array[i].image_index); Don't we have to think of the systems where multiple FMP drivers are used? In those cases, 'image_index' doesn't work as an unique ID. It is unlikely under the current code, but we should consider any future extension. -Takahiro Akashi > + size = sizeof(var_state); > + ret = efi_get_variable_int(varname, &efi_guid_fmp_state, NULL, > + &size, &var_state, NULL); > + if (ret == EFI_SUCCESS) { > + image_info[i].version = var_state.fw_version; > + image_info[i].lowest_supported_image_version = > + var_state.lowest_supported_version; > + image_info[i].last_attempt_version = > + var_state.last_attempt_version; > + image_info[i].last_attempt_status = > + var_state.last_attempt_status; > + } else { > + image_info[i].version = 0; > + image_info[i].lowest_supported_image_version = 0; > + image_info[i].last_attempt_version = 0; > + image_info[i].last_attempt_status = > + LAST_ATTEMPT_STATUS_SUCCESS; > + } > + > image_info[i].version_name = NULL; /* not supported */ > image_info[i].size = 0; > image_info[i].attributes_supported = > @@ -193,9 +218,6 @@ static efi_status_t efi_fill_image_desc_array( > image_info[0].attributes_setting |= > IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED; > > - image_info[i].lowest_supported_image_version = 0; > - image_info[i].last_attempt_version = 0; > - image_info[i].last_attempt_status = LAST_ATTEMPT_STATUS_SUCCESS; > image_info[i].hardware_instance = 1; > image_info[i].dependencies = NULL; > } > -- > 2.17.1 >