From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id CC8F67803CC for ; Mon, 18 Mar 2024 23:16:33 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=xv2wQGtkEIIPweGp6ia6l0ZN1QrjZ4sV+AUqdPjZ67I=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710803792; v=1; b=IHywlQdNC0KDKWh8XdIRI/v55UrHw/6cb1f8AvTiAez7VDYNmx4vw41lUymJsdv83Hoe2TxF hv41haVf4yYQO+2f7ZU/VIqxffJs0FuaLfn3akrEI2ELEE9lStc3HPHOvtO38Grhk0KQPLxYT99 GD9xKQgDzlLle+llR5VnLiSkTE68LZaSYeledLIWhgwmq7i5hfrtztgm0ruiFtpeVcMslJxLdHU OlYUj/uKQWbKeUXbrLQM4dLfxaRgu3BVCDnU2CrMyr5HWlttiG2WpvILyLI9pbbkkukcxpZ6bNY P4zmkGknqV2OqkVCCTACMxFlYYKIEnH9NcGpnvj+pAwpQ== X-Received: by 127.0.0.2 with SMTP id oZLvYY7687511xXq41lfONsc; Mon, 18 Mar 2024 16:16:32 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mx.groups.io with SMTP id smtpd.web11.7524.1710403910735721854 for ; Thu, 14 Mar 2024 01:11:51 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,11012"; a="16657648" X-IronPort-AV: E=Sophos;i="6.07,124,1708416000"; d="scan'208";a="16657648" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 01:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,124,1708416000"; d="scan'208";a="43129837" X-Received: from basatg01.gar.corp.intel.com ([10.66.253.28]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 01:11:46 -0700 From: Pethaiyan Madhan To: devel@edk2.groups.io Cc: Pethaiyan Madhan , Michael D Kinney , Liming Gao , Zhiguang Liu , Yi Li , GuoX Xu Subject: [edk2-devel] [PATCH V1 1/3] FmpDevicePkg: GetImageInfo Add missing conditions Date: Thu, 14 Mar 2024 13:41:31 +0530 Message-Id: <20240314081133.1134-1-madhan.pethaiyan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 18 Mar 2024 16:16:31 -0700 Reply-To: devel@edk2.groups.io,madhan.pethaiyan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JfSAxyYsddWfcTe8bCu9I8INx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=IHywlQdN; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 1.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage(): Add the following sentence at the end of the Image parameter description. "May be NULL with a zero ImageSize in order to determine the size of the buffer needed". Modify the description of "EFI_INVALID_PARAMETER" return code as "The ImageSize is not too small and Image is NULL." 2.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo(): Add the following sentence at the end of the ImageInfo parameter description."May be NULL with a zero ImageInfoSize in order to determine the size of the buffer needed". Modify the description of "EFI_INVALID_PARAMETER" return code as "The ImageInfoSize is not too small and Image is NULL." and add new descriptions for "EFI_INVALID_PARAMETER" return code. REF: UEFI spec v2.10 23.1.2 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4660 Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Yi Li Cc: GuoX Xu Signed-off-by: Pethaiyan Madhan --- FmpDevicePkg/FmpDxe/FmpDxe.c | 52 +++++++++++++++++++++--------------- FmpDevicePkg/FmpDxe/FmpDxe.h | 15 ++++++++--- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index 1e7ec4a09e..4111b7cb8e 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -43,20 +43,20 @@ const FIRMWARE_MANAGEMENT_PRIVATE_DATA mFirmwareManagementPrivateDataTemplate = FIRMWARE_MANAGEMENT_PRIVATE_DATA_SIGNATURE, // Signature NULL, // Handle { // Fmp - GetTheImageInfo, + GetImageInfo, GetTheImage, SetTheImage, CheckTheImage, GetPackageInfo, SetPackageInfo }, - FALSE, // DescriptorPopulated - { // Desc - 1, // ImageIndex + FALSE, // DescriptorPopulated + { // Desc + 1, // ImageIndex // // ImageTypeId // - { 0x00000000, 0x0000,0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + { 0x00000000, 0x0000,0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, 1, // ImageId NULL, // ImageIdName @@ -71,18 +71,18 @@ const FIRMWARE_MANAGEMENT_PRIVATE_DATA mFirmwareManagementPrivateDataTemplate = 0, // LastAttemptStatus 0 // HardwareInstance }, - NULL, // ImageIdName - NULL, // VersionName - TRUE, // RuntimeVersionSupported - NULL, // FmpDeviceLockEvent - FALSE, // FmpDeviceLocked - NULL, // FmpDeviceContext - NULL, // VersionVariableName - NULL, // LsvVariableName - NULL, // LastAttemptStatusVariableName - NULL, // LastAttemptVersionVariableName - NULL, // FmpStateVariableName - TRUE // DependenciesSatisfied + NULL, // ImageIdName + NULL, // VersionName + TRUE, // RuntimeVersionSupported + NULL, // FmpDeviceLockEvent + FALSE, // FmpDeviceLocked + NULL, // FmpDeviceContext + NULL, // VersionVariableName + NULL, // LsvVariableName + NULL, // LastAttemptStatusVariableName + NULL, // LastAttemptVersionVariableName + NULL, // FmpStateVariableName + TRUE // DependenciesSatisfied }; /// @@ -417,6 +417,8 @@ PopulateDescriptor ( to contain the image(s) information if the buffer was too small. @param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s) information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs. + May be NULL with a zero ImageInfoSize in order to determine the size of the + buffer needed. @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR. @param[out] DescriptorCount A pointer to the location in which firmware returns the number of @@ -437,13 +439,18 @@ PopulateDescriptor ( @retval EFI_SUCCESS The device was successfully updated with the new image. @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size needed to hold the image(s) information is returned in ImageInfoSize. - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL. @retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image. **/ EFI_STATUS EFIAPI -GetTheImageInfo ( +GetImageInfo ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN OUT UINTN *ImageInfoSize, IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, @@ -495,7 +502,7 @@ GetTheImageInfo ( // Confirm that buffer isn't null // if ( (ImageInfo == NULL) || (DescriptorVersion == NULL) || (DescriptorCount == NULL) || (DescriptorSize == NULL) - || (PackageVersion == NULL)) + || (PackageVersion == NULL) || (PackageVersionName == NULL)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): GetImageInfo() - Pointer Parameter is NULL.\n", mImageIdName)); Status = EFI_INVALID_PARAMETER; @@ -544,6 +551,9 @@ cleanup: @param[in] ImageIndex A unique number identifying the firmware image(s) within the device. The number is between 1 and DescriptorCount. @param[in, out] Image Points to the buffer where the current image is copied to. + May be NULL with a zero ImageSize in order to determine the size of the + buffer needed. + @param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes. On return, points to the length of the image, in bytes. @@ -551,7 +561,7 @@ cleanup: @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the image. The current buffer size needed to hold the image is returned in ImageSize. - @retval EFI_INVALID_PARAMETER The Image was NULL. + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL @retval EFI_NOT_FOUND The current image is not copied to the buffer. @retval EFI_UNSUPPORTED The operation is not supported. @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure. diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.h b/FmpDevicePkg/FmpDxe/FmpDxe.h index 7baf730e69..d2ade143bd 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.h +++ b/FmpDevicePkg/FmpDxe/FmpDxe.h @@ -114,6 +114,8 @@ DetectTestKey ( to contain the image(s) information if the buffer was too small. @param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s) information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs. + May be NULL with a zero ImageInfoSize in order to determine the size of the + buffer needed. @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR. @param[out] DescriptorCount A pointer to the location in which firmware returns the number of @@ -134,13 +136,18 @@ DetectTestKey ( @retval EFI_SUCCESS The device was successfully updated with the new image. @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size needed to hold the image(s) information is returned in ImageInfoSize. - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL. + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL. @retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image. **/ EFI_STATUS EFIAPI -GetTheImageInfo ( +GetImageInfo ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN OUT UINTN *ImageInfoSize, IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, @@ -161,6 +168,8 @@ GetTheImageInfo ( @param[in] ImageIndex A unique number identifying the firmware image(s) within the device. The number is between 1 and DescriptorCount. @param[in, out] Image Points to the buffer where the current image is copied to. + May be NULL with a zero ImageSize in order to determine the size of the + buffer needed. @param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes. On return, points to the length of the image, in bytes. @@ -168,7 +177,7 @@ GetTheImageInfo ( @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the image. The current buffer size needed to hold the image is returned in ImageSize. - @retval EFI_INVALID_PARAMETER The Image was NULL. + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL @retval EFI_NOT_FOUND The current image is not copied to the buffer. @retval EFI_UNSUPPORTED The operation is not supported. @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure. -- 2.38.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116852): https://edk2.groups.io/g/devel/message/116852 Mute This Topic: https://groups.io/mt/105014729/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-