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 C7BF1C678D4 for ; Fri, 3 Mar 2023 00:10:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA99985C99; Fri, 3 Mar 2023 01:10:42 +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="YkEWiSXq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9948685CA5; Fri, 3 Mar 2023 01:10:40 +0100 (CET) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 A859B85C75 for ; Fri, 3 Mar 2023 01:10:37 +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-pj1-x1035.google.com with SMTP id x34so892302pjj.0 for ; Thu, 02 Mar 2023 16:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677802236; 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=g/sD1w1/B5sXptQ87cEonP8Y9Bny/nBwShMs1SddgV8=; b=YkEWiSXqexxCF0hpbWblB4iI69l4yNjo9Jvp6We3YEaBc7iEiQv6QOKsQ6o2qB3OqI BXRr7+RktdKg5qS7pusSPa01PR45Of2n3YQwSM6v+t1msg5xsvQgSReq86pL1YuNqJ09 Se7ad0LIUBt75kGovfUtN1320Nm7S+iMrfnP/bav9pEEUUuIjx3GpNhZXGjGc7zSpHWv 3wju7YtVzBRizfOCKv9GMaDdUchg2wFzd+EMc+EDx8C5AnbtsRLf4ImjWnzXeYjLDExk b4VY7qBCmfhd8iyGJ3iLpqLSBjZ1QCsCvbJjrSQECjaU6i9LKKGCOd+7mMkrKBd0gx0F wFiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677802236; 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=g/sD1w1/B5sXptQ87cEonP8Y9Bny/nBwShMs1SddgV8=; b=4ueYtcz0PpFdP2npv95V0HaXAmv6wqS/KU5azne3wDUytoyar9jzlAlMOJzHwDRO5T BUcX5tUH1PnlIbCfPyCpaM4RHBpx05C7z2IQOe2R/FwpH+PGXdH/YQ0pw1bhZo7717bA tDhjd8DOjAsrIIy81tV7Gzy4kV8MCv1MiEB/bSc2az63/o8lSwRipw5zSdaRf+Fki3Iv 9jIKIAFcOYgH0IheO4pId56hUof0HhKkb3Q4oq19e3XYwvy9b9neNhIrwBl/pO+aaKHC hd+OwEi0LZeNMEnfnL/t7HgL00yQV97t5K46gZSmJSXwnuiDzCPTm6L22fODj9O9Uzhz yC0w== X-Gm-Message-State: AO0yUKUWaISETdY9rYgOq4LQyRcIkmj/mFeuXpyPeRFvLNsOsuwX5BEw atq8pj9m22ltYUQVGFd2JO7T+Q== X-Google-Smtp-Source: AK7set81+0K2Lr15Fdo88kYS9nil+NZu5ZgUJm65WBXnQFxq7G+x/v3eq7T6/5h2nEJSch1dvPgxLw== X-Received: by 2002:a17:902:e749:b0:19a:a2e7:64de with SMTP id p9-20020a170902e74900b0019aa2e764demr207507plf.0.1677802235935; Thu, 02 Mar 2023 16:10:35 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:ea0d:9c45:8107:54f7]) by smtp.gmail.com with ESMTPSA id c13-20020a170902c1cd00b0019e88453492sm248305plc.4.2023.03.02.16.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 16:10:35 -0800 (PST) Date: Fri, 3 Mar 2023 09:10:32 +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: <20230303001032.GA28528@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> <20230302051648.GB44192@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Mar 02, 2023 at 07:05:50PM +0900, Masahisa Kojima wrote: > On Thu, 2 Mar 2023 at 14:16, Takahiro Akashi wrote: > > > > 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. > > I assume that other FMP drivers implement their own version management. I don't have a strong opinion, but my idea about a variable name is to use 'image_type_id' as a 'vendor' field which allows for making the variable globally unique. -Takahiro Akashi > Thanks, > Masahisa Kojima > > > > > -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 > > >