From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.92.67.75]) by mx.groups.io with SMTP id smtpd.web09.2340.1605068205620767733 for ; Tue, 10 Nov 2020 20:16:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=c+XXTFeV; spf=pass (domain: outlook.com, ip: 40.92.67.75, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVVYtHo44Fb98fRt9vYZ8pjBYMfLZc2GQ4DfpxRJvqD7KXdIUsGNlgoip9d2VyGSUjl07e6GxtqcLVrr4XT0728dotwW0Y13ZD4drg6xxagJpjGJZDhWAInWkBfikhUUOf7Ix7/7Cfup1xn702Raq+Qa71VuEk9LTTJGqV41WCwW0TTz1qrDQ1aL/K/7gMBbx91U3n53bRbSdE29i2JClIC1e45KcsNA4wbF1KA/W8rWA8na1uzJMuH7amNpwpKGZ6zlerF8IcEcw0v7bRZIqvFMDDQKnss6hJedTUo985ZBy4I89JZZU8yt+WZCZl5DcgkDqftqGhc4WknbePk69w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kT3OK/w6x8X5q7Z0bmc/E5co/+PK/i+ufJdBY/NlwC8=; b=BxFTUiUTy1+XMeeY6T8NYse4DkuZmMcU04Xj0eUl8mtDmfujwIRyoO6sGarJ9QNbpehK9Ob4eQW059qu7ZoFwS6I7hBm4J2lSnLXYkapGs3ROaaqXOYLvAmfqGz4e4EilvEs7VLbakc0cjDRXOJj2O3eSzaFeJFvA/OfhAPz2CBLOLnKCipf7n4M4NZGe2OWPwpk34Cj74WfsYdAH8heCLGBBs+Zl2Lf+2jPnpaVhV2qmHF3vrE8XHWiXEphN3ZdJPPW30dGpuP4j8EHqRqPtHLNavWZOyFulcYcBWWThJX7cjPoSIXFD+lPLsYZM+BEepgyd2qedVmuCkn8VE5F8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kT3OK/w6x8X5q7Z0bmc/E5co/+PK/i+ufJdBY/NlwC8=; b=c+XXTFeV3dubpDEE5A8Ipzz+4nbE4ebPz2xbMRN5MmXKPQFG4oqeeLjHlNTaN/ND8cSoCpSPkat071IRCTWio15aQHrD0py9Hw8wdNYTPwqEkjxCuqFQnUgC2sairX8WbVTS6hwp9cA34qX2mHf08DqpAlBVPFPOvaJvTtd7/a8epvtH9huCwM32ohKMNDXlD8ipkcbY6SnVYZajrKA2UtSans0wR81REpbJ+y8IwJSBCG7V5gXtmqANR1r0EemUYzpg/5pdkYP/9+0B8MlkP0Q1WjSFC05sV/Erx08pussBlTFFZcTGIKNCgBzPgH4Nq0KO8PfIA+3XGoX577FMVg== Received: from AM5EUR02FT041.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::48) by AM5EUR02HT109.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.22; Wed, 11 Nov 2020 04:16:41 +0000 Received: from AM8P190MB0945.EURP190.PROD.OUTLOOK.COM (2a01:111:e400:7e1c::4c) by AM5EUR02FT041.mail.protection.outlook.com (2a01:111:e400:7e1c::356) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.22 via Frontend Transport; Wed, 11 Nov 2020 04:16:41 +0000 Received: from AM8P190MB0945.EURP190.PROD.OUTLOOK.COM ([fe80::5c34:cb72:d8e6:d049]) by AM8P190MB0945.EURP190.PROD.OUTLOOK.COM ([fe80::5c34:cb72:d8e6:d049%7]) with mapi id 15.20.3541.025; Wed, 11 Nov 2020 04:16:40 +0000 From: "Kilian Kegel" To: "devel@edk2.groups.io" , "michael.d.kinney@intel.com" , Michael Kubacki CC: "Qian, Yi" , "Sun, Zailiang" Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility Thread-Topic: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility Thread-Index: AQHWmD4eOse+VsqnFUiKYW6IN5b4Sqmt8IuAgAxFlYCACEfSgIAAE+jk Date: Wed, 11 Nov 2020 04:16:40 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:573F2BC4CED8E6E09F40682342CF53117598C9D3C03638CB8CC91FF20F5CAEFC;UpperCasedChecksum:7578C6EF62887FF745E644D694F218AAC94AD6D9AF719A3E3B61F24547AB60A1;SizeAsReceived:7412;Count:44 x-tmn: [WVUtJAhHNq4hR7G4/0qMLR7A+/6WdqMA] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 376bcec4-42d5-4a88-8484-08d885f89701 x-ms-exchange-slblob-mailprops: =?us-ascii?Q?bRphOwC17+Bb8GFbzyQlXkgmJVV2CVs4MhaiGwHlADtGX8tf0NHF1FutUSTJ?= =?us-ascii?Q?pkYoXrqvL2F/oUDLZkyQYe51o3ZqMybGehSgAegCja8RVL8FkFT2W8S3wAQ6?= =?us-ascii?Q?IeL+/CIOKDhQ1MGjskMgh+zhOaSw4iNqWSfG96RYGK5+qXMzBCxv9cFVxsQL?= =?us-ascii?Q?b2JzxeC/mIxJMEqW9U4SMuSZmqNfSPHHnyWA33jzouejlVKZgRRlMt0QbDnQ?= =?us-ascii?Q?QqNqYwPnbitw8b5hMRCv8qt7qCQEZ0Ff+Yjwt3rf3/7sbqjND7eEJHabZD/P?= =?us-ascii?Q?FqqUr3cstxGUbVSAMZlMIWBdb3G79kDYMtRC8VbJwMelJjw6XSnPihSgmO0z?= =?us-ascii?Q?NB5Z2sVfAXzJ/J30Yeal0q7q/95pzEhJeWD8HarMbVHRlKWWw2iJXOQxlRz6?= =?us-ascii?Q?Drp6/Svb9nQsHFDW7TAbes45sErxxfmGk8L/zW1XqR1i353AYJ0V2SJA5171?= =?us-ascii?Q?ValAf9/du9ydFki0ziGFkHJB71EHRvQ9/pQM//aueLiMHTNrV1SWHI0L91wd?= =?us-ascii?Q?SQx9wbXz+cEUBlR0OM4kZ8FZNtLftx7K+hdPxtLU3zEA1uydCwwmjNobUYFA?= =?us-ascii?Q?uVhUmCssqMkqIJZRA9B4TgF1RFWHHYx2sqK1HpBugw5ZT9x9qz6GreyA8XG8?= =?us-ascii?Q?QKhFKOIvB0bKvo/BMaOjE7yoqlzsajfgQcNVzVzTPtMGtHrz0+Hx0Em5Dg3B?= =?us-ascii?Q?ShRfC1pWfLfSTy4h5q0wDOupagWuIcyy94EU1ZhA05AJYdrOInaRuhrYExuu?= =?us-ascii?Q?fYgNzckahFQ9ktqDFdHj85rZVnGA9pDQBEKE+THEuhrALI1UU3lUOszuawtP?= =?us-ascii?Q?kWuY0PdQSJ69J8A90JhDzekRS1ivwWmL5HZvQTfu85H2P7zy0F76mPjS2H4h?= =?us-ascii?Q?yt26dXTogl1zQt4quNLEnaDC4RY6+dsjWHAenSlV8G3RCXl2uiluo5kelEhK?= =?us-ascii?Q?HpWNNzb48boiv4uRUGkKK+7hHV+OPsA6/HrL1hRcHzM+zTMBWJq1zBFCr4wR?= =?us-ascii?Q?cLMLDBIZCjg3HYeqIgwsTw899FfREK8SM4g32biB3RroCt404Aeh5weVaSvC?= =?us-ascii?Q?Br7sHbagkzVmGAyFq88=3D?= x-ms-traffictypediagnostic: AM5EUR02HT109: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0Flst3bbiAmOKJ6RFQFGeWXTzVdvY3ONR7+gbk+2Or47TPE9eynI/28wlfAuTfoW4jSFpR0Ibj2q3VfEdn3i9ZCaXM2rGragaNei5VRPVBqFBld5j8Im5swfKfWRvB7LbYhytzfz/FzL0Mbly9TZOL6qa9mp6I4Itvz4VpywitAlcHiH0hRlhKY8ba3Pq6pKZLvuFMQaTAI+9acWLtT5C0xsz5YAQpfNdK5n+xhyNieYEz2t1rrTfJkyd2AbzU1o x-ms-exchange-antispam-messagedata: XmxBtcTsMzZy5tHZQNUnk7MpA11voFkFE9SeE2ncnkGcpdt9BdP4i6+VO+UFIoBHpsiOZZZlIr1g0+yYy0NBQcf/1lV9InWkY75cIX8bTzUGGnU5dmt1+235HRzKopyLBFCNsqHxN3VygXU9gIBz4Q== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT041.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 376bcec4-42d5-4a88-8484-08d885f89701 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2020 04:16:40.4220 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT109 Content-Language: de-DE Content-Type: multipart/alternative; boundary="_000_AM8P190MB0945C933392BA5D8C68F213EEBE80AM8P190MB0945EURP_" --_000_AM8P190MB0945C933392BA5D8C68F213EEBE80AM8P190MB0945EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, if this patch also affects https://bugzilla.tianocore.org/show_bug.cgi?id= =3D2983, please close it. Thanks, Kilian Von: Michael D Kinney Gesendet: Wednesday, November 11, 2020 4:03 AM An: Michael Kubacki; devel@edk2.groups= .io; Kinney, Michael D Cc: Qian, Yi; Sun, Zailiang Betreff: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg= /FmpDeviceLib: Add LastAttemptStatus compatibility Hi Michael, This patch has been merged. Thanks, Mike > -----Original Message----- > From: Michael Kubacki > Sent: Thursday, November 5, 2020 12:36 PM > To: Kinney, Michael D ; devel@edk2.groups.io > Cc: Qian, Yi ; Sun, Zailiang > Subject: Re: [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceL= ib: Add LastAttemptStatus compatibility > > Hi Mike, > > I saw other Vlv2TbltDevicePkg patches were merged yesterday. Do you know > when this patch will be merged? > > Thanks, > Michael > > On 10/28/2020 6:12 PM, Kinney, Michael D wrote: > > Reviewed-by: Michael D Kinney > > > > I also verified build and boot and FMP based capsule updates work as e= xpected. > > > > Tested-by: Michael D Kinney > > > > Thanks, > > > > Mike > > > > > >> -----Original Message----- > >> From: michael.kubacki@outlook.com > >> Sent: Thursday, October 1, 2020 2:59 PM > >> To: devel@edk2.groups.io > >> Cc: Kinney, Michael D ; Qian, Yi ; Sun, Zailiang > > >> Subject: [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceLi= b: Add LastAttemptStatus compatibility > >> > >> From: Michael Kubacki > >> > >> Makes the changes necessary for these library instances of > >> FmpDeviceLib to be compatible with new functions added recently > >> to FmpDeviceLib. > >> > >> Two new functions were introduced in FmpDeviceLib to allow a > >> library instance to return a Last Attempt Status code during > >> check image and set image operations: > >> 1. FmpDeviceCheckImageWithStatus ( ) > >> 2. FmpDeviceSetImageWithStatus ( ) > >> > >> FmpDxe (in FmpDevicePkg) will begin calling these new functions > >> instead of the previous functions. Therefore, this change: > >> 1. Adds these functions to Vlv2TbltDevicePkg implementations > >> 2. Moves the main functionality to these new functions > >> 3. Updates the old functions to call the new functions > >> (for backward compatibility) > >> > >> Note: As of this commit, the Vlv2TbltDevicePkg build is broken > >> due to: > >> 1. A required RngLib library instance not defined by the platform > >> 2. Other FMP libraries not being defined by the platform > >> (e.g. FmpDependencyLib, FmpDependencyCheckLib, etc.) > >> > >> Those changes were fixed locally to test the changes in this commit > >> but maintainers should make the proper changes for those issues. > >> > >> Cc: Michael D Kinney > >> Cc: Yi Qian > >> Cc: Zailiang Sun > >> Signed-off-by: Michael Kubacki > >> --- > >> > >> Notes: > >> Only build was checked, I do not have access to a > >> VLV2 device for testing. > >> > >> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceL= ib/FmpDeviceLib.c | 299 +++++++++++++++----- > >> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceL= ibSample/FmpDeviceLib.c | 284 ++++++++++++++----- > >> 2 files changed, 446 insertions(+), 137 deletions(-) > >> > >> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library= /FmpDeviceLib/FmpDeviceLib.c > >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceL= ib/FmpDeviceLib.c > >> index d8c9036012ad..df8a36d9854c 100644 > >> --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDev= iceLib/FmpDeviceLib.c > >> +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDev= iceLib/FmpDeviceLib.c > >> @@ -1,6 +1,6 @@ > >> /** > >> > >> -Copyright (c) 2016, Microsoft Corporation. All rights reserved. > >> +Copyright (c) Microsoft Corporation.
> >> Copyright (c) 2019, Intel Corporation. All rights reserved. > >> > >> SPDX-License-Identifier: BSD-2-Clause-Patent > >> @@ -8,7 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > >> **/ > >> > >> #include > >> - > >> +#include > >> +#include > >> #include > >> > >> #include > >> @@ -444,20 +445,17 @@ FmpDeviceGetImage ( > >> } > >> > >> /** > >> - Updates the firmware image of the device. > >> - > >> - This function updates the hardware with the new firmware image. T= his function > >> - returns EFI_UNSUPPORTED if the firmware image is not updatable. I= f the > >> - firmware image is updatable, the function should perform the follo= wing minimal > >> - validations before proceeding to do the firmware image update. > >> - - Validate the image is a supported image for this device. The = function > >> - returns EFI_ABORTED if the image is unsupported. The function= can > >> - optionally provide more detailed information on why the image = is not a > >> - supported image. > >> - - Validate the data from VendorCode if not null. Image validati= on must be > >> - performed before VendorCode data validation. VendorCode data = is ignored > >> - or considered invalid if image validation failed. The functio= n returns > >> - EFI_ABORTED if the data is invalid. > >> + Updates a firmware device with a new firmware image. This functio= n returns > >> + EFI_UNSUPPORTED if the firmware image is not updatable. If the fi= rmware image > >> + is updatable, the function should perform the following minimal va= lidations > >> + before proceeding to do the firmware image update. > >> + - Validate that the image is a supported image for this firmware= device. > >> + Return EFI_ABORTED if the image is not supported. Additional = details > >> + on why the image is not a supported image may be returned in A= bortReason. > >> + - Validate the data from VendorCode if is not NULL. Firmware im= age > >> + validation must be performed before VendorCode data validation= . > >> + VendorCode data is ignored or considered invalid if image vali= dation > >> + fails. Return EFI_ABORTED if the VendorCode data is invalid. > >> > >> VendorCode enables vendor to implement vendor-specific firmware i= mage update > >> policy. Null if the caller did not specify the policy or use the= default > >> @@ -470,38 +468,56 @@ FmpDeviceGetImage ( > >> have the option to provide a more detailed description of the abo= rt reason to > >> the caller. > >> > >> - @param[in] Image Points to the new image. > >> - @param[in] ImageSize Size of the new image in bytes. > >> + @param[in] Image Points to the new firmware image. > >> + @param[in] ImageSize Size, in bytes, of the new firmware = image. > >> @param[in] VendorCode This enables vendor to implement ve= ndor-specific > >> - firmware image update policy. Null i= ndicates the > >> - caller did not specify the policy or= use the > >> + firmware image update policy. NULL = indicates > >> + the caller did not specify the polic= y or use the > >> default policy. > >> - @param[in] Progress A function used by the driver to rep= ort the > >> - progress of the firmware update. > >> - @param[in] CapsuleFwVersion FMP Payload Header version of the im= age. > >> - @param[out] AbortReason A pointer to a pointer to a null-ter= minated > >> - string providing more details for th= e aborted > >> - operation. The buffer is allocated b= y this > >> - function with AllocatePool(), and it= is the > >> - caller's responsibility to free it w= ith a call > >> - to FreePool(). > >> + @param[in] Progress A function used to report the progre= ss of > >> + updating the firmware device with th= e new > >> + firmware image. > >> + @param[in] CapsuleFwVersion The version of the new firmware imag= e from the > >> + update capsule that provided the new= firmware > >> + image. > >> + @param[out] AbortReason A pointer to a pointer to a Null-ter= minated > >> + Unicode string providing more detail= s on an > >> + aborted operation. The buffer is all= ocated by > >> + this function with > >> + EFI_BOOT_SERVICES.AllocatePool(). I= t is the > >> + caller's responsibility to free this= buffer with > >> + EFI_BOOT_SERVICES.FreePool(). > >> + @param[out] LastAttemptStatus A pointer to a UINT32 that holds the= last attempt > >> + status to report back to the ESRT ta= ble in case > >> + of error. This value will only be ch= ecked when this > >> + function returns an error. > >> > >> - @retval EFI_SUCCESS The device was successfully updated= with the > >> - new image. > >> - @retval EFI_ABORTED The operation is aborted. > >> + The return status code must fall in = the range of > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_M= IN_ERROR_CODE_VALUE to > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_M= AX_ERROR_CODE_VALUE. > >> + > >> + If the value falls outside this rang= e, it will be converted > >> + to LAST_ATTEMPT_STATUS_ERROR_UNSUCCE= SSFUL. > >> + > >> + @retval EFI_SUCCESS The firmware device was successfull= y updated > >> + with the new firmware image. > >> + @retval EFI_ABORTED The operation is aborted. Addition= al details > >> + are provided in AbortReason. > >> @retval EFI_INVALID_PARAMETER The Image was NULL. > >> + @retval EFI_INVALID_PARAMETER LastAttemptStatus was NULL. > >> @retval EFI_UNSUPPORTED The operation is not supported. > >> > >> **/ > >> EFI_STATUS > >> EFIAPI > >> -FmpDeviceSetImage ( > >> +FmpDeviceSetImageWithStatus ( > >> IN CONST VOID *Image, > >> IN UINTN ImageSize, > >> - IN CONST VOID *VendorCode, > >> - IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, > >> + IN CONST VOID *VendorCode, = OPTIONAL > >> + IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, = OPTIONAL > >> IN UINT32 CapsuleFwVersi= on, > >> - OUT CHAR16 **AbortReason > >> + OUT CHAR16 **AbortReason, > >> + OUT UINT32 *LastAttemptSta= tus > >> ) > >> { > >> EFI_STATUS Status; > >> @@ -513,25 +529,27 @@ FmpDeviceSetImage ( > >> UINTN BytesWritten; > >> > >> Updateable =3D 0; > >> - Status =3D FmpDeviceCheckImage (Image, ImageSize, &Updateable); > >> + Status =3D FmpDeviceCheckImageWithStatus (Image, ImageSize, &Updat= eable, LastAttemptStatus); > >> if (EFI_ERROR (Status)) { > >> - DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image failed with= %r.\n", Status)); > >> + DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Check Image f= ailed with %r.\n", Status)); > >> return Status; > >> } > >> > >> if (Updateable !=3D IMAGE_UPDATABLE_VALID) { > >> - DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image returned th= at the Image was not valid for update. Updatable > >> value =3D 0x%X.\n", Updateable)); > >> + DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Check Image r= eturned that the Image was not valid for update. > >> Updatable value =3D 0x%X.\n", Updateable)); > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> return EFI_ABORTED; > >> } > >> > >> if (Progress =3D=3D NULL) { > >> - DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Invalid progress callba= ck\n")); > >> + DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Invalid progr= ess callback\n")); > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> return EFI_INVALID_PARAMETER; > >> } > >> > >> Status =3D Progress (15); > >> if (EFI_ERROR (Status)) { > >> - DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Callback faile= d with Status %r.\n", Status)); > >> + DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Progress Call= back failed with Status %r.\n", Status)); > >> } > >> > >> // > >> @@ -539,7 +557,7 @@ FmpDeviceSetImage ( > >> // > >> Progress (20); > >> if (EFI_ERROR (Status)) { > >> - DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Callback faile= d with Status %r.\n", Status)); > >> + DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Progress Call= back failed with Status %r.\n", Status)); > >> } > >> > >> // > >> @@ -553,11 +571,11 @@ FmpDeviceSetImage ( > >> > >> // Progress (Percentage); > >> // if (EFI_ERROR (Status)) { > >> -// DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Callback f= ailed with Status %r.\n", Status)); > >> +// DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Progress = Callback failed with Status %r.\n", Status)); > >> // } > >> } > >> > >> - DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %d Images ...\n", ARRAY_S= IZE (mUpdateConfigData))); > >> + DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %d Images ...\n= ", ARRAY_SIZE (mUpdateConfigData))); > >> > >> if (ARRAY_SIZE (mUpdateConfigData) =3D=3D 0) { > >> DEBUG((DEBUG_INFO, "PlatformUpdate: BaseAddress - 0x%lx ImageOf= fset - 0x%x Length - 0x%x\n", 0, 0, ImageSize)); > >> @@ -605,11 +623,173 @@ FmpDeviceSetImage ( > >> BytesWritten +=3D ConfigData->Length; > >> } > >> > >> - DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %r\n", Status)); > >> + DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %r\n", Status))= ; > >> + > >> + if (EFI_ERROR (Status)) { > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> + } > >> > >> return Status; > >> } > >> > >> +/** > >> + Updates the firmware image of the device. > >> + > >> + This function updates the hardware with the new firmware image. T= his function > >> + returns EFI_UNSUPPORTED if the firmware image is not updatable. I= f the > >> + firmware image is updatable, the function should perform the follo= wing minimal > >> + validations before proceeding to do the firmware image update. > >> + - Validate the image is a supported image for this device. The = function > >> + returns EFI_ABORTED if the image is unsupported. The function= can > >> + optionally provide more detailed information on why the image = is not a > >> + supported image. > >> + - Validate the data from VendorCode if not null. Image validati= on must be > >> + performed before VendorCode data validation. VendorCode data = is ignored > >> + or considered invalid if image validation failed. The functio= n returns > >> + EFI_ABORTED if the data is invalid. > >> + > >> + VendorCode enables vendor to implement vendor-specific firmware im= age update > >> + policy. Null if the caller did not specify the policy or use the = default > >> + policy. As an example, vendor can implement a policy to allow an = option to > >> + force a firmware image update when the abort reason is due to the = new firmware > >> + image version is older than the current firmware image version or = bad image > >> + checksum. Sensitive operations such as those wiping the entire fi= rmware image > >> + and render the device to be non-functional should be encoded in th= e image > >> + itself rather than passed with the VendorCode. AbortReason enable= s vendor to > >> + have the option to provide a more detailed description of the abor= t reason to > >> + the caller. > >> + > >> + @param[in] Image Points to the new image. > >> + @param[in] ImageSize Size of the new image in bytes. > >> + @param[in] VendorCode This enables vendor to implement ven= dor-specific > >> + firmware image update policy. Null i= ndicates the > >> + caller did not specify the policy or= use the > >> + default policy. > >> + @param[in] Progress A function used by the driver to rep= ort the > >> + progress of the firmware update. > >> + @param[in] CapsuleFwVersion FMP Payload Header version of the im= age. > >> + @param[out] AbortReason A pointer to a pointer to a null-ter= minated > >> + string providing more details for th= e aborted > >> + operation. The buffer is allocated b= y this > >> + function with AllocatePool(), and it= is the > >> + caller's responsibility to free it w= ith a call > >> + to FreePool(). > >> + > >> + @retval EFI_SUCCESS The device was successfully updated= with the > >> + new image. > >> + @retval EFI_ABORTED The operation is aborted. > >> + @retval EFI_INVALID_PARAMETER The Image was NULL. > >> + @retval EFI_UNSUPPORTED The operation is not supported. > >> + > >> +**/ > >> +EFI_STATUS > >> +EFIAPI > >> +FmpDeviceSetImage ( > >> + IN CONST VOID *Image, > >> + IN UINTN ImageSize, > >> + IN CONST VOID *VendorCode, > >> + IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, > >> + IN UINT32 CapsuleFwVersio= n, > >> + OUT CHAR16 **AbortReason > >> + ) > >> +{ > >> + UINT32 LastAttemptStatus; > >> + > >> + return FmpDeviceSetImageWithStatus ( > >> + Image, > >> + ImageSize, > >> + VendorCode, > >> + Progress, > >> + CapsuleFwVersion, > >> + AbortReason, > >> + &LastAttemptStatus > >> + ); > >> +} > >> + > >> +/** > >> + Checks if a new firmware image is valid for the firmware device. = This > >> + function allows firmware update operation to validate the firmware= image > >> + before FmpDeviceSetImage() is called. > >> + > >> + @param[in] Image Points to a new firmware image. > >> + @param[in] ImageSize Size, in bytes, of a new firmware = image. > >> + @param[out] ImageUpdatable Indicates if a new firmware image = is valid for > >> + a firmware update to the firmware = device. The > >> + following values from the Firmware= Management > >> + Protocol are supported: > >> + IMAGE_UPDATABLE_VALID > >> + IMAGE_UPDATABLE_INVALID > >> + IMAGE_UPDATABLE_INVALID_TYPE > >> + IMAGE_UPDATABLE_INVALID_OLD > >> + IMAGE_UPDATABLE_VALID_WITH_VENDO= R_CODE > >> + @param[out] LastAttemptStatus A pointer to a UINT32 that holds t= he last attempt > >> + status to report back to the ESRT = table in case > >> + of error. This value will only be = checked when this > >> + function returns an error. > >> + > >> + The return status code must fall i= n the range of > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY= _MIN_ERROR_CODE_VALUE to > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY= _MAX_ERROR_CODE_VALUE. > >> + > >> + If the value falls outside this ra= nge, it will be converted > >> + to LAST_ATTEMPT_STATUS_ERROR_UNSUC= CESSFUL. > >> + > >> + @retval EFI_SUCCESS The image was successfully checked.= Additional > >> + status information is returned in > >> + ImageUpdatable. > >> + @retval EFI_INVALID_PARAMETER Image is NULL. > >> + @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL. > >> + @retval EFI_INVALID_PARAMETER LastAttemptStatus is NULL. > >> + > >> +**/ > >> +EFI_STATUS > >> +EFIAPI > >> +FmpDeviceCheckImageWithStatus ( > >> + IN CONST VOID *Image, > >> + IN UINTN ImageSize, > >> + OUT UINT32 *ImageUpdatable, > >> + OUT UINT32 *LastAttemptStatus > >> + ) > >> +{ > >> + if (LastAttemptStatus =3D=3D NULL) { > >> + DEBUG ((DEBUG_ERROR, "CheckImageWithStatus - LastAttemptStatus P= ointer Parameter is NULL.\n")); > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; > >> + > >> + if (ImageUpdatable =3D=3D NULL) { > >> + DEBUG((DEBUG_ERROR, "CheckImageWithStatus - ImageUpdatable Point= er Parameter is NULL.\n")); > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + > >> + // > >> + //Set to valid and then if any tests fail it will update this flag= . > >> + // > >> + *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; > >> + > >> + if (Image =3D=3D NULL) { > >> + DEBUG((DEBUG_ERROR, "CheckImageWithStatus - Image Pointer Parame= ter is NULL.\n")); > >> + // > >> + // Not sure if this is needed > >> + // > >> + *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + > >> + // > >> + // Make sure the image size is correct > >> + // > >> + if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { > >> + *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ER= ROR_CODE_VALUE; > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + > >> + return EFI_SUCCESS; > >> +} > >> + > >> /** > >> Checks if the firmware image is valid for the device. > >> > >> @@ -633,34 +813,9 @@ FmpDeviceCheckImage ( > >> OUT UINT32 *ImageUpdateable > >> ) > >> { > >> - if (ImageUpdateable =3D=3D NULL) { > >> - DEBUG((DEBUG_ERROR, "CheckImage - ImageUpdateable Pointer Parame= ter is NULL.\n")); > >> - return EFI_INVALID_PARAMETER; > >> - } > >> + UINT32 LastAttemptStatus; > >> > >> - // > >> - //Set to valid and then if any tests fail it will update this flag= . > >> - // > >> - *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; > >> - > >> - if (Image =3D=3D NULL) { > >> - DEBUG((DEBUG_ERROR, "CheckImage - Image Pointer Parameter is NUL= L.\n")); > >> - // > >> - // Not sure if this is needed > >> - // > >> - *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; > >> - return EFI_INVALID_PARAMETER; > >> - } > >> - > >> - // > >> - // Make sure the image size is correct > >> - // > >> - if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { > >> - *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; > >> - return EFI_INVALID_PARAMETER; > >> - } > >> - > >> - return EFI_SUCCESS; > >> + return FmpDeviceCheckImageWithStatus (Image, ImageSize, ImageUpdat= eable, &LastAttemptStatus); > >> } > >> > >> /** > >> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library= /FmpDeviceLibSample/FmpDeviceLib.c > >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceL= ibSample/FmpDeviceLib.c > >> index db0f238ea534..132b60844ad4 100644 > >> --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDev= iceLibSample/FmpDeviceLib.c > >> +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDev= iceLibSample/FmpDeviceLib.c > >> @@ -1,6 +1,6 @@ > >> /** > >> > >> -Copyright (c) 2016, Microsoft Corporation. All rights reserved.
> >> +Copyright (c) Microsoft Corporation.
> >> Copyright (c) 2019, Intel Corporation. All rights reserved.
> >> > >> SPDX-License-Identifier: BSD-2-Clause-Patent > >> @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > >> > >> > >> #include > >> +#include > >> +#include > >> #include > >> #include > >> #include > >> @@ -345,6 +347,131 @@ Return Value: > >> }//GetImage() > >> > >> > >> +/** > >> + Updates a firmware device with a new firmware image. This functio= n returns > >> + EFI_UNSUPPORTED if the firmware image is not updatable. If the fi= rmware image > >> + is updatable, the function should perform the following minimal va= lidations > >> + before proceeding to do the firmware image update. > >> + - Validate that the image is a supported image for this firmware= device. > >> + Return EFI_ABORTED if the image is not supported. Additional = details > >> + on why the image is not a supported image may be returned in A= bortReason. > >> + - Validate the data from VendorCode if is not NULL. Firmware im= age > >> + validation must be performed before VendorCode data validation= . > >> + VendorCode data is ignored or considered invalid if image vali= dation > >> + fails. Return EFI_ABORTED if the VendorCode data is invalid. > >> + > >> + VendorCode enables vendor to implement vendor-specific firmware im= age update > >> + policy. Null if the caller did not specify the policy or use the = default > >> + policy. As an example, vendor can implement a policy to allow an = option to > >> + force a firmware image update when the abort reason is due to the = new firmware > >> + image version is older than the current firmware image version or = bad image > >> + checksum. Sensitive operations such as those wiping the entire fi= rmware image > >> + and render the device to be non-functional should be encoded in th= e image > >> + itself rather than passed with the VendorCode. AbortReason enable= s vendor to > >> + have the option to provide a more detailed description of the abor= t reason to > >> + the caller. > >> + > >> + @param[in] Image Points to the new firmware image. > >> + @param[in] ImageSize Size, in bytes, of the new firmware = image. > >> + @param[in] VendorCode This enables vendor to implement ven= dor-specific > >> + firmware image update policy. NULL = indicates > >> + the caller did not specify the polic= y or use the > >> + default policy. > >> + @param[in] Progress A function used to report the progre= ss of > >> + updating the firmware device with th= e new > >> + firmware image. > >> + @param[in] CapsuleFwVersion The version of the new firmware imag= e from the > >> + update capsule that provided the new= firmware > >> + image. > >> + @param[out] AbortReason A pointer to a pointer to a Null-ter= minated > >> + Unicode string providing more detail= s on an > >> + aborted operation. The buffer is all= ocated by > >> + this function with > >> + EFI_BOOT_SERVICES.AllocatePool(). I= t is the > >> + caller's responsibility to free this= buffer with > >> + EFI_BOOT_SERVICES.FreePool(). > >> + @param[out] LastAttemptStatus A pointer to a UINT32 that holds the= last attempt > >> + status to report back to the ESRT ta= ble in case > >> + of error. This value will only be ch= ecked when this > >> + function returns an error. > >> + > >> + The return status code must fall in = the range of > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_M= IN_ERROR_CODE_VALUE to > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_M= AX_ERROR_CODE_VALUE. > >> + > >> + If the value falls outside this rang= e, it will be converted > >> + to LAST_ATTEMPT_STATUS_ERROR_UNSUCCE= SSFUL. > >> + > >> + @retval EFI_SUCCESS The firmware device was successfull= y updated > >> + with the new firmware image. > >> + @retval EFI_ABORTED The operation is aborted. Addition= al details > >> + are provided in AbortReason. > >> + @retval EFI_INVALID_PARAMETER The Image was NULL. > >> + @retval EFI_INVALID_PARAMETER LastAttemptStatus was NULL. > >> + @retval EFI_UNSUPPORTED The operation is not supported. > >> + > >> +**/ > >> +EFI_STATUS > >> +EFIAPI > >> +FmpDeviceSetImageWithStatus ( > >> + IN CONST VOID *Image, > >> + IN UINTN ImageSize, > >> + IN CONST VOID *VendorCode, = OPTIONAL > >> + IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, = OPTIONAL > >> + IN UINT32 CapsuleFwVersio= n, > >> + OUT CHAR16 **AbortReason, > >> + OUT UINT32 *LastAttemptSta= tus > >> + ) > >> +{ > >> + EFI_STATUS Status =3D EFI_SUCCESS; > >> + UINT32 Updateable =3D 0; > >> + > >> + Status =3D FmpDeviceCheckImageWithStatus (Image, ImageSize, &Upd= ateable, LastAttemptStatus); > >> + if (EFI_ERROR(Status)) > >> + { > >> + DEBUG((DEBUG_ERROR, "SetImageWithStatus - Check Image faile= d with %r.\n", Status)); > >> + goto cleanup; > >> + } > >> + > >> + if (Updateable !=3D IMAGE_UPDATABLE_VALID) > >> + { > >> + DEBUG((DEBUG_ERROR, "SetImageWithStatus - Check Image retur= ned that the Image was not valid for update. > >> Updatable value =3D 0x%X.\n", Updateable)); > >> + Status =3D EFI_ABORTED; > >> + goto cleanup; > >> + } > >> + > >> + if (Progress =3D=3D NULL) > >> + { > >> + DEBUG((DEBUG_ERROR, "SetImageWithStatus - Invalid progress = callback\n")); > >> + Status =3D EFI_INVALID_PARAMETER; > >> + goto cleanup; > >> + } > >> + > >> + Status =3D Progress(15); > >> + if (EFI_ERROR(Status)) > >> + { > >> + DEBUG((DEBUG_ERROR, "SetImageWithStatus - Progress Callback= failed with Status %r.\n", Status)); > >> + } > >> + > >> + { > >> + UINTN p; > >> + > >> + for (p =3D 20; p < 100; p++) { > >> + gBS->Stall (100000); //us =3D 0.1 seconds > >> + Progress (p); > >> + } > >> + } > >> + > >> + //TODO: add support for VendorCode, and AbortReason > >> +cleanup: > >> + if (EFI_ERROR (Status)) { > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_= ERROR_CODE_VALUE; > >> + } > >> + > >> + return Status; > >> +}// SetImageWithStatus() > >> + > >> + > >> /** > >> Updates the firmware image of the device. > >> > >> @@ -396,51 +523,98 @@ IN UINT32 = CapsuleFwVersion, > >> OUT CHAR16 **AbortReason > >> ) > >> { > >> - EFI_STATUS Status =3D EFI_SUCCESS; > >> - UINT32 Updateable =3D 0; > >> - > >> - Status =3D FmpDeviceCheckImage(Image, ImageSize, &Updateable); > >> - if (EFI_ERROR(Status)) > >> - { > >> - DEBUG((DEBUG_ERROR, "SetImage - Check Image failed with %r.\= n", Status)); > >> - goto cleanup; > >> - } > >> - > >> - if (Updateable !=3D IMAGE_UPDATABLE_VALID) > >> - { > >> - DEBUG((DEBUG_ERROR, "SetImage - Check Image returned that th= e Image was not valid for update. Updatable value > =3D > >> 0x%X.\n", Updateable)); > >> - Status =3D EFI_ABORTED; > >> - goto cleanup; > >> - } > >> - > >> - if (Progress =3D=3D NULL) > >> - { > >> - DEBUG((DEBUG_ERROR, "SetImage - Invalid progress callback\n"= )); > >> - Status =3D EFI_INVALID_PARAMETER; > >> - goto cleanup; > >> - } > >> - > >> - Status =3D Progress(15); > >> - if (EFI_ERROR(Status)) > >> - { > >> - DEBUG((DEBUG_ERROR, "SetImage - Progress Callback failed wit= h Status %r.\n", Status)); > >> - } > >> - > >> - { > >> - UINTN p; > >> - > >> - for (p =3D 20; p < 100; p++) { > >> - gBS->Stall (100000); //us =3D 0.1 seconds > >> - Progress (p); > >> - } > >> - } > >> - > >> - //TODO: add support for VendorCode, and AbortReason > >> -cleanup: > >> - return Status; > >> + UINT32 LastAttemptStatus; > >> + > >> + return FmpDeviceSetImageWithStatus ( > >> + Image, > >> + ImageSize, > >> + VendorCode, > >> + Progress, > >> + CapsuleFwVersion, > >> + AbortReason, > >> + &LastAttemptStatus > >> + ); > >> }// SetImage() > >> > >> > >> +/** > >> + Checks if a new firmware image is valid for the firmware device. = This > >> + function allows firmware update operation to validate the firmware= image > >> + before FmpDeviceSetImage() is called. > >> + > >> + @param[in] Image Points to a new firmware image. > >> + @param[in] ImageSize Size, in bytes, of a new firmware = image. > >> + @param[out] ImageUpdatable Indicates if a new firmware image = is valid for > >> + a firmware update to the firmware = device. The > >> + following values from the Firmware= Management > >> + Protocol are supported: > >> + IMAGE_UPDATABLE_VALID > >> + IMAGE_UPDATABLE_INVALID > >> + IMAGE_UPDATABLE_INVALID_TYPE > >> + IMAGE_UPDATABLE_INVALID_OLD > >> + IMAGE_UPDATABLE_VALID_WITH_VENDO= R_CODE > >> + @param[out] LastAttemptStatus A pointer to a UINT32 that holds t= he last attempt > >> + status to report back to the ESRT = table in case > >> + of error. This value will only be = checked when this > >> + function returns an error. > >> + > >> + The return status code must fall i= n the range of > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY= _MIN_ERROR_CODE_VALUE to > >> + LAST_ATTEMPT_STATUS_DEVICE_LIBRARY= _MAX_ERROR_CODE_VALUE. > >> + > >> + If the value falls outside this ra= nge, it will be converted > >> + to LAST_ATTEMPT_STATUS_ERROR_UNSUC= CESSFUL. > >> + > >> + @retval EFI_SUCCESS The image was successfully checked.= Additional > >> + status information is returned in > >> + ImageUpdatable. > >> + @retval EFI_INVALID_PARAMETER Image is NULL. > >> + @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL. > >> + @retval EFI_INVALID_PARAMETER LastAttemptStatus is NULL. > >> + > >> +**/ > >> +EFI_STATUS > >> +EFIAPI > >> +FmpDeviceCheckImageWithStatus ( > >> + IN CONST VOID *Image, > >> + IN UINTN ImageSize, > >> + OUT UINT32 *ImageUpdatable, > >> + OUT UINT32 *LastAttemptStatus > >> + ) > >> +{ > >> + EFI_STATUS status =3D EFI_SUCCESS; > >> + > >> + if (LastAttemptStatus =3D=3D NULL) { > >> + DEBUG ((DEBUG_ERROR, "CheckImageWithStatus - LastAttemptStatus= Pointer Parameter is NULL.\n")); > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; > >> + > >> + if (ImageUpdatable =3D=3D NULL) > >> + { > >> + DEBUG((DEBUG_ERROR, "CheckImageWithStatus - ImageUpdatable P= ointer Parameter is NULL.\n")); > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MI= N_ERROR_CODE_VALUE; > >> + status =3D EFI_INVALID_PARAMETER; > >> + goto cleanup; > >> + } > >> + > >> + // > >> + //Set to valid and then if any tests fail it will update this fl= ag. > >> + // > >> + *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; > >> + > >> + if (Image =3D=3D NULL) > >> + { > >> + DEBUG((DEBUG_ERROR, "CheckImageWithStatus - Image Pointer Pa= rameter is NULL.\n")); > >> + *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; //not sure if t= his is needed > >> + *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MI= N_ERROR_CODE_VALUE; > >> + return EFI_INVALID_PARAMETER; > >> + } > >> + > >> +cleanup: > >> + return status; > >> +}// CheckImageWithStatus() > >> + > >> > >> /** > >> Checks if the firmware image is valid for the device. > >> @@ -465,29 +639,9 @@ IN UINTN ImageSize, > >> OUT UINT32 *ImageUpdateable > >> ) > >> { > >> - EFI_STATUS status =3D EFI_SUCCESS; > >> + UINT32 LastAttemptStatus; > >> > >> - if (ImageUpdateable =3D=3D NULL) > >> - { > >> - DEBUG((DEBUG_ERROR, "CheckImage - ImageUpdateable Pointer Pa= rameter is NULL.\n")); > >> - status =3D EFI_INVALID_PARAMETER; > >> - goto cleanup; > >> - } > >> - > >> - // > >> - //Set to valid and then if any tests fail it will update this fl= ag. > >> - // > >> - *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; > >> - > >> - if (Image =3D=3D NULL) > >> - { > >> - DEBUG((DEBUG_ERROR, "CheckImage - Image Pointer Parameter is= NULL.\n")); > >> - *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; //not sure if = this is needed > >> - return EFI_INVALID_PARAMETER; > >> - } > >> - > >> -cleanup: > >> - return status; > >> + return FmpDeviceCheckImageWithStatus (Image, ImageSize, ImageUpdat= eable, &LastAttemptStatus); > >> }// CheckImage() > >> > >> /** > >> -- > >> 2.28.0.windows.1 > > --_000_AM8P190MB0945C933392BA5D8C68F213EEBE80AM8P190MB0945EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all,

 

if this patch also affects https://bugzilla.tianocore.org/show_bug.cgi?id=3D2983, please close it= .

 

Thanks,

Kilian

 

Von: Michael D Kinney
Gesendet: Wednesday, November 11, 2020 4:03 AM
An: Michael Kubacki<= /a>; devel@edk2.groups.io; Ki= nney, Michael D
Cc: Qian, Yi; Sun, Zailiang
Betreff: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDe= vicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility

 

Hi Michael,

This patch has been merged.

Thanks,

Mike

> -----Original Message-----
> From: Michael Kubacki <michael.kubacki@outlook.com>
> Sent: Thursday, November 5, 2020 12:36 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.= groups.io
> Cc: Qian, Yi <yi.qian@intel.com>; Sun, Zailiang <zailiang.su= n@intel.com>
> Subject: Re: [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDevi= ceLib: Add LastAttemptStatus compatibility
>
> Hi Mike,
>
> I saw other Vlv2TbltDevicePkg patches were merged yesterday. Do you k= now
> when this patch will be merged?
>
> Thanks,
> Michael
>
> On 10/28/2020 6:12 PM, Kinney, Michael D wrote:
> > Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>=
> >
> > I also verified build and boot and FMP based capsule updates wor= k as expected.
> >
> > Tested-by: Michael D Kinney <Michael.d.kinney@intel.com> > >
> > Thanks,
> >
> > Mike
> >
> >
> >> -----Original Message-----
> >> From: michael.kubacki@outlook.com <michael.kubacki@outloo= k.com>
> >> Sent: Thursday, October 1, 2020 2:59 PM
> >> To: devel@edk2.groups.io
> >> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Qi= an, Yi <yi.qian@intel.com>; Sun, Zailiang
> <zailiang.sun@intel.com>
> >> Subject: [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/Fm= pDeviceLib: Add LastAttemptStatus compatibility
> >>
> >> From: Michael Kubacki <michael.kubacki@microsoft.com><= br> > >>
> >> Makes the changes necessary for these library instances of > >> FmpDeviceLib to be compatible with new functions added recen= tly
> >> to FmpDeviceLib.
> >>
> >> Two new functions were introduced in FmpDeviceLib to allow a=
> >> library instance to return a Last Attempt Status code during=
> >> check image and set image operations:
> >>    1. FmpDeviceCheckImageWithStatus ( )
> >>    2. FmpDeviceSetImageWithStatus ( )
> >>
> >> FmpDxe (in FmpDevicePkg) will begin calling these new functi= ons
> >> instead of the previous functions. Therefore, this change: > >>    1. Adds these functions to Vlv2TbltDeviceP= kg implementations
> >>    2. Moves the main functionality to these n= ew functions
> >>    3. Updates the old functions to call the n= ew functions
> >>       (for backward compatibil= ity)
> >>
> >> Note: As of this commit, the Vlv2TbltDevicePkg build is brok= en
> >> due to:
> >>    1. A required RngLib library instance not = defined by the platform
> >>    2. Other FMP libraries not being defined b= y the platform
> >>       (e.g. FmpDependencyLib, = FmpDependencyCheckLib, etc.)
> >>
> >> Those changes were fixed locally to test the changes in this= commit
> >> but maintainers should make the proper changes for those iss= ues.
> >>
> >> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> >> Cc: Yi Qian <yi.qian@intel.com>
> >> Cc: Zailiang Sun <zailiang.sun@intel.com>
> >> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft= .com>
> >> ---
> >>
> >> Notes:
> >>      Only build was checked, I do n= ot have access to a
> >>      VLV2 device for testing.
> >>
> >>   Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule= /Library/FmpDeviceLib/FmpDeviceLib.c       | = 299 +++++++++++++++-----
> >>   Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule= /Library/FmpDeviceLibSample/FmpDeviceLib.c | 284 ++++++++++++++-----
> >>   2 files changed, 446 insertions(+), 137 deletion= s(-)
> >>
> >> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsul= e/Library/FmpDeviceLib/FmpDeviceLib.c
> >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/F= mpDeviceLib/FmpDeviceLib.c
> >> index d8c9036012ad..df8a36d9854c 100644
> >> --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Libra= ry/FmpDeviceLib/FmpDeviceLib.c
> >> +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Libra= ry/FmpDeviceLib/FmpDeviceLib.c
> >> @@ -1,6 +1,6 @@
> >>   /**
> >>
> >> -Copyright (c) 2016, Microsoft Corporation.  All rights= reserved.
> >> +Copyright (c) Microsoft Corporation.<BR>
> >>   Copyright (c) 2019, Intel Corporation.  All= rights reserved.
> >>
> >>   SPDX-License-Identifier: BSD-2-Clause-Patent
> >> @@ -8,7 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent=
> >>   **/
> >>
> >>   #include <PiDxe.h>
> >> -
> >> +#include <LastAttemptStatus.h>
> >> +#include <Guid/SystemResourceTable.h>
> >>   #include <Library/FmpDeviceLib.h>
> >>
> >>   #include <Library/DebugLib.h>
> >> @@ -444,20 +445,17 @@ FmpDeviceGetImage (
> >>   }
> >>
> >>   /**
> >> -  Updates the firmware image of the device.
> >> -
> >> -  This function updates the hardware with the new firm= ware image.  This function
> >> -  returns EFI_UNSUPPORTED if the firmware image is not= updatable.  If the
> >> -  firmware image is updatable, the function should per= form the following minimal
> >> -  validations before proceeding to do the firmware ima= ge update.
> >> -    - Validate the image is a supported imag= e for this device.  The function
> >> -      returns EFI_ABORTED if the i= mage is unsupported.  The function can
> >> -      optionally provide more deta= iled information on why the image is not a
> >> -      supported image.
> >> -    - Validate the data from VendorCode if n= ot null.  Image validation must be
> >> -      performed before VendorCode = data validation.  VendorCode data is ignored
> >> -      or considered invalid if ima= ge validation failed.  The function returns
> >> -      EFI_ABORTED if the data is i= nvalid.
> >> +  Updates a firmware device with a new firmware image.=   This function returns
> >> +  EFI_UNSUPPORTED if the firmware image is not updatab= le.  If the firmware image
> >> +  is updatable, the function should perform the follow= ing minimal validations
> >> +  before proceeding to do the firmware image update. > >> +    - Validate that the image is a supported= image for this firmware device.
> >> +      Return EFI_ABORTED if the im= age is not supported.  Additional details
> >> +      on why the image is not a su= pported image may be returned in AbortReason.
> >> +    - Validate the data from VendorCode if i= s not NULL.  Firmware image
> >> +      validation must be performed= before VendorCode data validation.
> >> +      VendorCode data is ignored o= r considered invalid if image validation
> >> +      fails.  Return EFI_ABOR= TED if the VendorCode data is invalid.
> >>
> >>     VendorCode enables vendor to impleme= nt vendor-specific firmware image update
> >>     policy.  Null if the caller did= not specify the policy or use the default
> >> @@ -470,38 +468,56 @@ FmpDeviceGetImage (
> >>     have the option to provide a more de= tailed description of the abort reason to
> >>     the caller.
> >>
> >> -  @param[in]  Image     =         Points to the new image.
> >> -  @param[in]  ImageSize    &n= bsp;    Size of the new image in bytes.
> >> +  @param[in]  Image     =         Points to the new firmware image= .
> >> +  @param[in]  ImageSize    &n= bsp;    Size, in bytes, of the new firmware image.
> >>     @param[in]  VendorCode &nb= sp;      This enables vendor to implement vendor-s= pecific
> >> -          = ;            &n= bsp;         firmware image update = policy. Null indicates the
> >> -          = ;            &n= bsp;         caller did not specify= the policy or use the
> >> +          = ;            &n= bsp;         firmware image update = policy.  NULL indicates
> >> +          = ;            &n= bsp;         the caller did not spe= cify the policy or use the
> >>          &= nbsp;           &nbs= p;            defaul= t policy.
> >> -  @param[in]  Progress    &nb= sp;     A function used by the driver to report the
> >> -          = ;            &n= bsp;         progress of the firmwa= re update.
> >> -  @param[in]  CapsuleFwVersion  FMP Payload = Header version of the image.
> >> -  @param[out] AbortReason     = ;  A pointer to a pointer to a null-terminated
> >> -          = ;            &n= bsp;         string providing more = details for the aborted
> >> -          = ;            &n= bsp;         operation. The buffer = is allocated by this
> >> -          = ;            &n= bsp;         function with Allocate= Pool(), and it is the
> >> -          = ;            &n= bsp;         caller's responsibilit= y to free it with a call
> >> -          = ;            &n= bsp;         to FreePool().
> >> +  @param[in]  Progress    &nb= sp;     A function used to report the progress of
> >> +          = ;            &n= bsp;         updating the firmware = device with the new
> >> +          = ;            &n= bsp;         firmware image.
> >> +  @param[in]  CapsuleFwVersion  The version = of the new firmware image from the
> >> +          = ;            &n= bsp;         update capsule that pr= ovided the new firmware
> >> +          = ;            &n= bsp;         image.
> >> +  @param[out] AbortReason     = ;  A pointer to a pointer to a Null-terminated
> >> +          = ;            &n= bsp;         Unicode string providi= ng more details on an
> >> +          = ;            &n= bsp;         aborted operation. The= buffer is allocated by
> >> +          = ;            &n= bsp;         this function with
> >> +          = ;            &n= bsp;         EFI_BOOT_SERVICES.Allo= catePool().  It is the
> >> +          = ;            &n= bsp;         caller's responsibilit= y to free this buffer with
> >> +          = ;            &n= bsp;         EFI_BOOT_SERVICES.Free= Pool().
> >> +  @param[out] LastAttemptStatus A pointer to a UINT32 = that holds the last attempt
> >> +          = ;            &n= bsp;         status to report back = to the ESRT table in case
> >> +          = ;            &n= bsp;         of error. This value w= ill only be checked when this
> >> +          = ;            &n= bsp;         function returns an er= ror.
> >>
> >> -  @retval EFI_SUCCESS     &nb= sp;      The device was successfully updated with = the
> >> -          = ;            &n= bsp;          new image.
> >> -  @retval EFI_ABORTED     &nb= sp;      The operation is aborted.
> >> +          = ;            &n= bsp;         The return status code= must fall in the range of
> >> +          = ;            &n= bsp;         LAST_ATTEMPT_STATUS_DE= VICE_LIBRARY_MIN_ERROR_CODE_VALUE to
> >> +          = ;            &n= bsp;         LAST_ATTEMPT_STATUS_DE= VICE_LIBRARY_MAX_ERROR_CODE_VALUE.
> >> +
> >> +          = ;            &n= bsp;         If the value falls out= side this range, it will be converted
> >> +          = ;            &n= bsp;         to LAST_ATTEMPT_STATUS= _ERROR_UNSUCCESSFUL.
> >> +
> >> +  @retval EFI_SUCCESS     &nb= sp;      The firmware device was successfully upda= ted
> >> +          = ;            &n= bsp;          with the new fir= mware image.
> >> +  @retval EFI_ABORTED     &nb= sp;      The operation is aborted.  Additiona= l details
> >> +          = ;            &n= bsp;          are provided in = AbortReason.
> >>     @retval EFI_INVALID_PARAMETER  = The Image was NULL.
> >> +  @retval EFI_INVALID_PARAMETER  LastAttemptStatu= s was NULL.
> >>     @retval EFI_UNSUPPORTED  &= nbsp;     The operation is not supported.
> >>
> >>   **/
> >>   EFI_STATUS
> >>   EFIAPI
> >> -FmpDeviceSetImage (
> >> +FmpDeviceSetImageWithStatus (
> >>     IN  CONST VOID   = ;            &n= bsp;            = ;         *Image,
> >>     IN  UINTN   &nbs= p;            &= nbsp;           &nbs= p;             = ImageSize,
> >> -  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *VendorCode,
> >> -  IN  EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRE= SS  Progress,
> >> +  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *VendorCode,     = ;  OPTIONAL
> >> +  IN  EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRE= SS  Progress,          OP= TIONAL
> >>     IN  UINT32   &nb= sp;            =             &nb= sp;            Capsu= leFwVersion,
> >> -  OUT CHAR16       =             &nb= sp;            =          **AbortReason
> >> +  OUT CHAR16       =             &nb= sp;            =          **AbortReason,
> >> +  OUT UINT32       =             &nb= sp;            =          *LastAttemptStatus
> >>     )
> >>   {
> >>     EFI_STATUS    &n= bsp;     Status;
> >> @@ -513,25 +529,27 @@ FmpDeviceSetImage (
> >>     UINTN     &= nbsp;         BytesWritten;
> >>
> >>     Updateable =3D 0;
> >> -  Status =3D FmpDeviceCheckImage (Image, ImageSize, &a= mp;Updateable);
> >> +  Status =3D FmpDeviceCheckImageWithStatus (Image, Ima= geSize, &Updateable, LastAttemptStatus);
> >>     if (EFI_ERROR (Status)) {
> >> -    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= age - Check Image failed with %r.\n", Status));
> >> +    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= ageWithStatus - Check Image failed with %r.\n", Status));
> >>       return Status;
> >>     }
> >>
> >>     if (Updateable !=3D IMAGE_UPDATABLE_= VALID) {
> >> -    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= age - Check Image returned that the Image was not valid for update.  U= pdatable
> >> value =3D 0x%X.\n", Updateable));
> >> +    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= ageWithStatus - Check Image returned that the Image was not valid for updat= e.
> >> Updatable value =3D 0x%X.\n", Updateable));
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >>       return EFI_ABORTED;
> >>     }
> >>
> >>     if (Progress =3D=3D NULL) {
> >> -    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= age - Invalid progress callback\n"));
> >> +    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= ageWithStatus - Invalid progress callback\n"));
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >>       return EFI_INVALID_PARAM= ETER;
> >>     }
> >>
> >>     Status =3D Progress (15);
> >>     if (EFI_ERROR (Status)) {
> >> -    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= age - Progress Callback failed with Status %r.\n", Status));
> >> +    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= ageWithStatus - Progress Callback failed with Status %r.\n", Status));=
> >>     }
> >>
> >>     //
> >> @@ -539,7 +557,7 @@ FmpDeviceSetImage (
> >>     //
> >>     Progress (20);
> >>     if (EFI_ERROR (Status)) {
> >> -    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= age - Progress Callback failed with Status %r.\n", Status));
> >> +    DEBUG((DEBUG_ERROR, "FmpDeviceSetIm= ageWithStatus - Progress Callback failed with Status %r.\n", Status));=
> >>     }
> >>
> >>     //
> >> @@ -553,11 +571,11 @@ FmpDeviceSetImage (
> >>
> >>   //    Progress (Percentage);
> >>   //    if (EFI_ERROR (Status)) { > >> -//      DEBUG((DEBUG_ERROR, "= FmpDeviceSetImage - Progress Callback failed with Status %r.\n", Statu= s));
> >> +//      DEBUG((DEBUG_ERROR, "= FmpDeviceSetImageWithStatus - Progress Callback failed with Status %r.\n&qu= ot;, Status));
> >>   //    }
> >>     }
> >>
> >> -  DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %d Ima= ges ...\n", ARRAY_SIZE (mUpdateConfigData)));
> >> +  DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatu= s - %d Images ...\n", ARRAY_SIZE (mUpdateConfigData)));
> >>
> >>     if (ARRAY_SIZE (mUpdateConfigData) = =3D=3D 0) {
> >>       DEBUG((DEBUG_INFO, "= ;PlatformUpdate: BaseAddress - 0x%lx ImageOffset - 0x%x Length - 0x%x\n&quo= t;, 0, 0, ImageSize));
> >> @@ -605,11 +623,173 @@ FmpDeviceSetImage (
> >>       BytesWritten +=3D Config= Data->Length;
> >>     }
> >>
> >> -  DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %r\n&q= uot;, Status));
> >> +  DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatu= s - %r\n", Status));
> >> +
> >> +  if (EFI_ERROR (Status)) {
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +  }
> >>
> >>     return Status;
> >>   }
> >>
> >> +/**
> >> +  Updates the firmware image of the device.
> >> +
> >> +  This function updates the hardware with the new firm= ware image.  This function
> >> +  returns EFI_UNSUPPORTED if the firmware image is not= updatable.  If the
> >> +  firmware image is updatable, the function should per= form the following minimal
> >> +  validations before proceeding to do the firmware ima= ge update.
> >> +    - Validate the image is a supported imag= e for this device.  The function
> >> +      returns EFI_ABORTED if the i= mage is unsupported.  The function can
> >> +      optionally provide more deta= iled information on why the image is not a
> >> +      supported image.
> >> +    - Validate the data from VendorCode if n= ot null.  Image validation must be
> >> +      performed before VendorCode = data validation.  VendorCode data is ignored
> >> +      or considered invalid if ima= ge validation failed.  The function returns
> >> +      EFI_ABORTED if the data is i= nvalid.
> >> +
> >> +  VendorCode enables vendor to implement vendor-specif= ic firmware image update
> >> +  policy.  Null if the caller did not specify the= policy or use the default
> >> +  policy.  As an example, vendor can implement a = policy to allow an option to
> >> +  force a firmware image update when the abort reason = is due to the new firmware
> >> +  image version is older than the current firmware ima= ge version or bad image
> >> +  checksum.  Sensitive operations such as those w= iping the entire firmware image
> >> +  and render the device to be non-functional should be= encoded in the image
> >> +  itself rather than passed with the VendorCode. = AbortReason enables vendor to
> >> +  have the option to provide a more detailed descripti= on of the abort reason to
> >> +  the caller.
> >> +
> >> +  @param[in]  Image     =         Points to the new image.
> >> +  @param[in]  ImageSize    &n= bsp;    Size of the new image in bytes.
> >> +  @param[in]  VendorCode    &= nbsp;   This enables vendor to implement vendor-specific
> >> +          = ;            &n= bsp;         firmware image update = policy. Null indicates the
> >> +          = ;            &n= bsp;         caller did not specify= the policy or use the
> >> +          = ;            &n= bsp;         default policy.
> >> +  @param[in]  Progress    &nb= sp;     A function used by the driver to report the
> >> +          = ;            &n= bsp;         progress of the firmwa= re update.
> >> +  @param[in]  CapsuleFwVersion  FMP Payload = Header version of the image.
> >> +  @param[out] AbortReason     = ;  A pointer to a pointer to a null-terminated
> >> +          = ;            &n= bsp;         string providing more = details for the aborted
> >> +          = ;            &n= bsp;         operation. The buffer = is allocated by this
> >> +          = ;            &n= bsp;         function with Allocate= Pool(), and it is the
> >> +          = ;            &n= bsp;         caller's responsibilit= y to free it with a call
> >> +          = ;            &n= bsp;         to FreePool().
> >> +
> >> +  @retval EFI_SUCCESS     &nb= sp;      The device was successfully updated with = the
> >> +          = ;            &n= bsp;          new image.
> >> +  @retval EFI_ABORTED     &nb= sp;      The operation is aborted.
> >> +  @retval EFI_INVALID_PARAMETER  The Image was NU= LL.
> >> +  @retval EFI_UNSUPPORTED     = ;   The operation is not supported.
> >> +
> >> +**/
> >> +EFI_STATUS
> >> +EFIAPI
> >> +FmpDeviceSetImage (
> >> +  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *Image,
> >> +  IN  UINTN      &n= bsp;            = ;            &n= bsp;          ImageSize,
> >> +  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *VendorCode,
> >> +  IN  EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRE= SS  Progress,
> >> +  IN  UINT32      &= nbsp;           &nbs= p;            &= nbsp;         CapsuleFwVersion,
> >> +  OUT CHAR16       =             &nb= sp;            =          **AbortReason
> >> +  )
> >> +{
> >> +  UINT32  LastAttemptStatus;
> >> +
> >> +  return  FmpDeviceSetImageWithStatus (
> >> +          = ;  Image,
> >> +          = ;  ImageSize,
> >> +          = ;  VendorCode,
> >> +          = ;  Progress,
> >> +          = ;  CapsuleFwVersion,
> >> +          = ;  AbortReason,
> >> +          = ;  &LastAttemptStatus
> >> +          = ;  );
> >> +}
> >> +
> >> +/**
> >> +  Checks if a new firmware image is valid for the firm= ware device.  This
> >> +  function allows firmware update operation to validat= e the firmware image
> >> +  before FmpDeviceSetImage() is called.
> >> +
> >> +  @param[in]  Image     =           Points to a new firm= ware image.
> >> +  @param[in]  ImageSize    &n= bsp;      Size, in bytes, of a new firmware image.=
> >> +  @param[out] ImageUpdatable    &n= bsp; Indicates if a new firmware image is valid for
> >> +          = ;            &n= bsp;           a firmware= update to the firmware device.  The
> >> +          = ;            &n= bsp;           following = values from the Firmware Management
> >> +          = ;            &n= bsp;           Protocol a= re supported:
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_VALID
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID_TYPE
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID_OLD
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE
> >> +  @param[out] LastAttemptStatus   A pointer = to a UINT32 that holds the last attempt
> >> +          = ;            &n= bsp;           status to = report back to the ESRT table in case
> >> +          = ;            &n= bsp;           of error. = This value will only be checked when this
> >> +          = ;            &n= bsp;           function r= eturns an error.
> >> +
> >> +          = ;            &n= bsp;           The return= status code must fall in the range of
> >> +          = ;            &n= bsp;           LAST_ATTEM= PT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to
> >> +          = ;            &n= bsp;           LAST_ATTEM= PT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE.
> >> +
> >> +          = ;            &n= bsp;           If the val= ue falls outside this range, it will be converted
> >> +          = ;            &n= bsp;           to LAST_AT= TEMPT_STATUS_ERROR_UNSUCCESSFUL.
> >> +
> >> +  @retval EFI_SUCCESS     &nb= sp;      The image was successfully checked. = Additional
> >> +          = ;            &n= bsp;          status informati= on is returned in
> >> +          = ;            &n= bsp;          ImageUpdatable.<= br> > >> +  @retval EFI_INVALID_PARAMETER  Image is NULL. > >> +  @retval EFI_INVALID_PARAMETER  ImageUpdatable i= s NULL.
> >> +  @retval EFI_INVALID_PARAMETER  LastAttemptStatu= s is NULL.
> >> +
> >> +**/
> >> +EFI_STATUS
> >> +EFIAPI
> >> +FmpDeviceCheckImageWithStatus (
> >> +  IN  CONST VOID  *Image,
> >> +  IN  UINTN       I= mageSize,
> >> +  OUT UINT32      *ImageUpdat= able,
> >> +  OUT UINT32      *LastAttemp= tStatus
> >> +  )
> >> +{
> >> +  if (LastAttemptStatus =3D=3D NULL) {
> >> +    DEBUG ((DEBUG_ERROR, "CheckImageWit= hStatus - LastAttemptStatus Pointer Parameter is NULL.\n"));
> >> +    return EFI_INVALID_PARAMETER;
> >> +  }
> >> +  *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS;<= br> > >> +
> >> +  if (ImageUpdatable =3D=3D NULL) {
> >> +    DEBUG((DEBUG_ERROR, "CheckImageWith= Status - ImageUpdatable Pointer Parameter is NULL.\n"));
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +    return EFI_INVALID_PARAMETER;
> >> +  }
> >> +
> >> +  //
> >> +  //Set to valid and then if any tests fail it will up= date this flag.
> >> +  //
> >> +  *ImageUpdatable =3D IMAGE_UPDATABLE_VALID;
> >> +
> >> +  if (Image =3D=3D NULL) {
> >> +    DEBUG((DEBUG_ERROR, "CheckImageWith= Status - Image Pointer Parameter is NULL.\n"));
> >> +    //
> >> +    // Not sure if this is needed
> >> +    //
> >> +    *ImageUpdatable =3D IMAGE_UPDATABLE_INVA= LID;
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +    return EFI_INVALID_PARAMETER;
> >> +  }
> >> +
> >> +  //
> >> +  // Make sure the image size is correct
> >> +  //
> >> +  if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) {
> >> +    *ImageUpdatable =3D IMAGE_UPDATABLE_INVA= LID;
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +    return EFI_INVALID_PARAMETER;
> >> +  }
> >> +
> >> +  return EFI_SUCCESS;
> >> +}
> >> +
> >>   /**
> >>   Checks if the firmware image is valid for the de= vice.
> >>
> >> @@ -633,34 +813,9 @@ FmpDeviceCheckImage (
> >>     OUT UINT32    &n= bsp; *ImageUpdateable
> >>     )
> >>   {
> >> -  if (ImageUpdateable =3D=3D NULL) {
> >> -    DEBUG((DEBUG_ERROR, "CheckImage - I= mageUpdateable Pointer Parameter is NULL.\n"));
> >> -    return EFI_INVALID_PARAMETER;
> >> -  }
> >> +  UINT32  LastAttemptStatus;
> >>
> >> -  //
> >> -  //Set to valid and then if any tests fail it will up= date this flag.
> >> -  //
> >> -  *ImageUpdateable =3D IMAGE_UPDATABLE_VALID;
> >> -
> >> -  if (Image =3D=3D NULL) {
> >> -    DEBUG((DEBUG_ERROR, "CheckImage - I= mage Pointer Parameter is NULL.\n"));
> >> -    //
> >> -    // Not sure if this is needed
> >> -    //
> >> -    *ImageUpdateable =3D IMAGE_UPDATABLE_INV= ALID;
> >> -    return EFI_INVALID_PARAMETER;
> >> -  }
> >> -
> >> -  //
> >> -  // Make sure the image size is correct
> >> -  //
> >> -  if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) {
> >> -    *ImageUpdateable =3D IMAGE_UPDATABLE_INV= ALID;
> >> -    return EFI_INVALID_PARAMETER;
> >> -  }
> >> -
> >> -  return EFI_SUCCESS;
> >> +  return FmpDeviceCheckImageWithStatus (Image, ImageSi= ze, ImageUpdateable, &LastAttemptStatus);
> >>   }
> >>
> >>   /**
> >> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsul= e/Library/FmpDeviceLibSample/FmpDeviceLib.c
> >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/F= mpDeviceLibSample/FmpDeviceLib.c
> >> index db0f238ea534..132b60844ad4 100644
> >> --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Libra= ry/FmpDeviceLibSample/FmpDeviceLib.c
> >> +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Libra= ry/FmpDeviceLibSample/FmpDeviceLib.c
> >> @@ -1,6 +1,6 @@
> >>   /**
> >>
> >> -Copyright (c) 2016, Microsoft Corporation. All rights reser= ved.<BR>
> >> +Copyright (c) Microsoft Corporation.<BR>
> >>   Copyright (c) 2019, Intel Corporation. All right= s reserved.<BR>
> >>
> >>   SPDX-License-Identifier: BSD-2-Clause-Patent
> >> @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent=
> >>
> >>
> >>   #include <PiDxe.h>
> >> +#include <LastAttemptStatus.h>
> >> +#include <Guid/SystemResourceTable.h>
> >>   #include <Library/DebugLib.h>
> >>   #include <Protocol/FirmwareManagement.h> > >>   #include <Library/BaseLib.h>
> >> @@ -345,6 +347,131 @@ Return Value:
> >>   }//GetImage()
> >>
> >>
> >> +/**
> >> +  Updates a firmware device with a new firmware image.=   This function returns
> >> +  EFI_UNSUPPORTED if the firmware image is not updatab= le.  If the firmware image
> >> +  is updatable, the function should perform the follow= ing minimal validations
> >> +  before proceeding to do the firmware image update. > >> +    - Validate that the image is a supported= image for this firmware device.
> >> +      Return EFI_ABORTED if the im= age is not supported.  Additional details
> >> +      on why the image is not a su= pported image may be returned in AbortReason.
> >> +    - Validate the data from VendorCode if i= s not NULL.  Firmware image
> >> +      validation must be performed= before VendorCode data validation.
> >> +      VendorCode data is ignored o= r considered invalid if image validation
> >> +      fails.  Return EFI_ABOR= TED if the VendorCode data is invalid.
> >> +
> >> +  VendorCode enables vendor to implement vendor-specif= ic firmware image update
> >> +  policy.  Null if the caller did not specify the= policy or use the default
> >> +  policy.  As an example, vendor can implement a = policy to allow an option to
> >> +  force a firmware image update when the abort reason = is due to the new firmware
> >> +  image version is older than the current firmware ima= ge version or bad image
> >> +  checksum.  Sensitive operations such as those w= iping the entire firmware image
> >> +  and render the device to be non-functional should be= encoded in the image
> >> +  itself rather than passed with the VendorCode. = AbortReason enables vendor to
> >> +  have the option to provide a more detailed descripti= on of the abort reason to
> >> +  the caller.
> >> +
> >> +  @param[in]  Image     =         Points to the new firmware image= .
> >> +  @param[in]  ImageSize    &n= bsp;    Size, in bytes, of the new firmware image.
> >> +  @param[in]  VendorCode    &= nbsp;   This enables vendor to implement vendor-specific
> >> +          = ;            &n= bsp;         firmware image update = policy.  NULL indicates
> >> +          = ;            &n= bsp;         the caller did not spe= cify the policy or use the
> >> +          = ;            &n= bsp;         default policy.
> >> +  @param[in]  Progress    &nb= sp;     A function used to report the progress of
> >> +          = ;            &n= bsp;         updating the firmware = device with the new
> >> +          = ;            &n= bsp;         firmware image.
> >> +  @param[in]  CapsuleFwVersion  The version = of the new firmware image from the
> >> +          = ;            &n= bsp;         update capsule that pr= ovided the new firmware
> >> +          = ;            &n= bsp;         image.
> >> +  @param[out] AbortReason     = ;  A pointer to a pointer to a Null-terminated
> >> +          = ;            &n= bsp;         Unicode string providi= ng more details on an
> >> +          = ;            &n= bsp;         aborted operation. The= buffer is allocated by
> >> +          = ;            &n= bsp;         this function with
> >> +          = ;            &n= bsp;         EFI_BOOT_SERVICES.Allo= catePool().  It is the
> >> +          = ;            &n= bsp;         caller's responsibilit= y to free this buffer with
> >> +          = ;            &n= bsp;         EFI_BOOT_SERVICES.Free= Pool().
> >> +  @param[out] LastAttemptStatus A pointer to a UINT32 = that holds the last attempt
> >> +          = ;            &n= bsp;         status to report back = to the ESRT table in case
> >> +          = ;            &n= bsp;         of error. This value w= ill only be checked when this
> >> +          = ;            &n= bsp;         function returns an er= ror.
> >> +
> >> +          = ;            &n= bsp;         The return status code= must fall in the range of
> >> +          = ;            &n= bsp;         LAST_ATTEMPT_STATUS_DE= VICE_LIBRARY_MIN_ERROR_CODE_VALUE to
> >> +          = ;            &n= bsp;         LAST_ATTEMPT_STATUS_DE= VICE_LIBRARY_MAX_ERROR_CODE_VALUE.
> >> +
> >> +          = ;            &n= bsp;         If the value falls out= side this range, it will be converted
> >> +          = ;            &n= bsp;         to LAST_ATTEMPT_STATUS= _ERROR_UNSUCCESSFUL.
> >> +
> >> +  @retval EFI_SUCCESS     &nb= sp;      The firmware device was successfully upda= ted
> >> +          = ;            &n= bsp;          with the new fir= mware image.
> >> +  @retval EFI_ABORTED     &nb= sp;      The operation is aborted.  Additiona= l details
> >> +          = ;            &n= bsp;          are provided in = AbortReason.
> >> +  @retval EFI_INVALID_PARAMETER  The Image was NU= LL.
> >> +  @retval EFI_INVALID_PARAMETER  LastAttemptStatu= s was NULL.
> >> +  @retval EFI_UNSUPPORTED     = ;   The operation is not supported.
> >> +
> >> +**/
> >> +EFI_STATUS
> >> +EFIAPI
> >> +FmpDeviceSetImageWithStatus (
> >> +  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *Image,
> >> +  IN  UINTN      &n= bsp;            = ;            &n= bsp;          ImageSize,
> >> +  IN  CONST VOID     &nb= sp;            =             &nb= sp;      *VendorCode,     = ;  OPTIONAL
> >> +  IN  EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRE= SS  Progress,          OP= TIONAL
> >> +  IN  UINT32      &= nbsp;           &nbs= p;            &= nbsp;         CapsuleFwVersion,
> >> +  OUT CHAR16       =             &nb= sp;            =          **AbortReason,
> >> +  OUT UINT32       =             &nb= sp;            =          *LastAttemptStatus
> >> +  )
> >> +{
> >> +    EFI_STATUS Status    = ;            &n= bsp;        =3D EFI_SUCCESS;
> >> +    UINT32 Updateable    = ;            &n= bsp;        =3D 0;
> >> +
> >> +    Status =3D FmpDeviceCheckImageWithStatus= (Image, ImageSize, &Updateable, LastAttemptStatus);
> >> +    if (EFI_ERROR(Status))
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "SetImageWithStatus  - Check Image failed with %r.\n", S= tatus));
> >> +        goto cleanup; > >> +    }
> >> +
> >> +    if (Updateable !=3D IMAGE_UPDATABLE_VALI= D)
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "SetImageWithStatus  - Check Image returned that the Image wa= s not valid for update.
> >> Updatable value =3D 0x%X.\n", Updateable));
> >> +        Status =3D EFI_A= BORTED;
> >> +        goto cleanup; > >> +    }
> >> +
> >> +    if (Progress =3D=3D NULL)
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "SetImageWithStatus  - Invalid progress callback\n")); > >> +        Status =3D EFI_I= NVALID_PARAMETER;
> >> +        goto cleanup; > >> +    }
> >> +
> >> +    Status =3D Progress(15);
> >> +    if (EFI_ERROR(Status))
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "SetImageWithStatus  - Progress Callback failed with Status %= r.\n", Status));
> >> +    }
> >> +
> >> +    {
> >> +      UINTN  p;
> >> +
> >> +      for (p =3D 20; p < 100; p= ++) {
> >> +        gBS->Stall (1= 00000);  //us  =3D 0.1 seconds
> >> +        Progress (p); > >> +      }
> >> +    }
> >> +
> >> +    //TODO: add support for VendorCode, and = AbortReason
> >> +cleanup:
> >> +    if (EFI_ERROR (Status)) {
> >> +      *LastAttemptStatus =3D LAST_= ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +    }
> >> +
> >> +    return Status;
> >> +}// SetImageWithStatus()
> >> +
> >> +
> >>   /**
> >>   Updates the firmware image of the device.
> >>
> >> @@ -396,51 +523,98 @@ IN  UINT32    = ;            &n= bsp;            = ;            &n= bsp; CapsuleFwVersion,
> >>   OUT CHAR16      &n= bsp;            = ;            &n= bsp;           **AbortRea= son
> >>   )
> >>   {
> >> -    EFI_STATUS Status    = ;            &n= bsp;        =3D EFI_SUCCESS;
> >> -    UINT32 Updateable    = ;            &n= bsp;        =3D 0;
> >> -
> >> -    Status =3D FmpDeviceCheckImage(Image, Im= ageSize, &Updateable);
> >> -    if (EFI_ERROR(Status))
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "SetImage - Check Image failed with %r.\n", Status));
> >> -        goto cleanup; > >> -    }
> >> -
> >> -    if (Updateable !=3D IMAGE_UPDATABLE_VALI= D)
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "SetImage - Check Image returned that the Image was not valid for = update.  Updatable value
> =3D
> >> 0x%X.\n", Updateable));
> >> -        Status =3D EFI_A= BORTED;
> >> -        goto cleanup; > >> -    }
> >> -
> >> -    if (Progress =3D=3D NULL)
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "SetImage - Invalid progress callback\n"));
> >> -        Status =3D EFI_I= NVALID_PARAMETER;
> >> -        goto cleanup; > >> -    }
> >> -
> >> -    Status =3D Progress(15);
> >> -    if (EFI_ERROR(Status))
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "SetImage - Progress Callback failed with Status %r.\n", Stat= us));
> >> -    }
> >> -
> >> -    {
> >> -      UINTN  p;
> >> -
> >> -      for (p =3D 20; p < 100; p= ++) {
> >> -        gBS->Stall (1= 00000);  //us  =3D 0.1 seconds
> >> -        Progress (p); > >> -      }
> >> -    }
> >> -
> >> -    //TODO: add support for VendorCode, and = AbortReason
> >> -cleanup:
> >> -    return Status;
> >> +  UINT32  LastAttemptStatus;
> >> +
> >> +  return  FmpDeviceSetImageWithStatus (
> >> +          = ;  Image,
> >> +          = ;  ImageSize,
> >> +          = ;  VendorCode,
> >> +          = ;  Progress,
> >> +          = ;  CapsuleFwVersion,
> >> +          = ;  AbortReason,
> >> +          = ;  &LastAttemptStatus
> >> +          = ;  );
> >>   }// SetImage()
> >>
> >>
> >> +/**
> >> +  Checks if a new firmware image is valid for the firm= ware device.  This
> >> +  function allows firmware update operation to validat= e the firmware image
> >> +  before FmpDeviceSetImage() is called.
> >> +
> >> +  @param[in]  Image     =           Points to a new firm= ware image.
> >> +  @param[in]  ImageSize    &n= bsp;      Size, in bytes, of a new firmware image.=
> >> +  @param[out] ImageUpdatable    &n= bsp; Indicates if a new firmware image is valid for
> >> +          = ;            &n= bsp;           a firmware= update to the firmware device.  The
> >> +          = ;            &n= bsp;           following = values from the Firmware Management
> >> +          = ;            &n= bsp;           Protocol a= re supported:
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_VALID
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID_TYPE
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_INVALID_OLD
> >> +          = ;            &n= bsp;            = ; IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE
> >> +  @param[out] LastAttemptStatus   A pointer = to a UINT32 that holds the last attempt
> >> +          = ;            &n= bsp;           status to = report back to the ESRT table in case
> >> +          = ;            &n= bsp;           of error. = This value will only be checked when this
> >> +          = ;            &n= bsp;           function r= eturns an error.
> >> +
> >> +          = ;            &n= bsp;           The return= status code must fall in the range of
> >> +          = ;            &n= bsp;           LAST_ATTEM= PT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to
> >> +          = ;            &n= bsp;           LAST_ATTEM= PT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE.
> >> +
> >> +          = ;            &n= bsp;           If the val= ue falls outside this range, it will be converted
> >> +          = ;            &n= bsp;           to LAST_AT= TEMPT_STATUS_ERROR_UNSUCCESSFUL.
> >> +
> >> +  @retval EFI_SUCCESS     &nb= sp;      The image was successfully checked. = Additional
> >> +          = ;            &n= bsp;          status informati= on is returned in
> >> +          = ;            &n= bsp;          ImageUpdatable.<= br> > >> +  @retval EFI_INVALID_PARAMETER  Image is NULL. > >> +  @retval EFI_INVALID_PARAMETER  ImageUpdatable i= s NULL.
> >> +  @retval EFI_INVALID_PARAMETER  LastAttemptStatu= s is NULL.
> >> +
> >> +**/
> >> +EFI_STATUS
> >> +EFIAPI
> >> +FmpDeviceCheckImageWithStatus (
> >> +  IN  CONST VOID  *Image,
> >> +  IN  UINTN       I= mageSize,
> >> +  OUT UINT32      *ImageUpdat= able,
> >> +  OUT UINT32      *LastAttemp= tStatus
> >> +  )
> >> +{
> >> +    EFI_STATUS status =3D EFI_SUCCESS;
> >> +
> >> +    if (LastAttemptStatus =3D=3D NULL) {
> >> +      DEBUG ((DEBUG_ERROR, "C= heckImageWithStatus - LastAttemptStatus Pointer Parameter is NULL.\n")= );
> >> +      return EFI_INVALID_PARAMETER= ;
> >> +    }
> >> +    *LastAttemptStatus =3D LAST_ATTEMPT_STAT= US_SUCCESS;
> >> +
> >> +    if (ImageUpdatable =3D=3D NULL)
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "CheckImageWithStatus - ImageUpdatable Pointer Parameter is NULL.\= n"));
> >> +        *LastAttemptStat= us =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +        status =3D EFI_I= NVALID_PARAMETER;
> >> +        goto cleanup; > >> +    }
> >> +
> >> +    //
> >> +    //Set to valid and then if any tests fai= l it will update this flag.
> >> +    //
> >> +    *ImageUpdatable =3D IMAGE_UPDATABLE_VALI= D;
> >> +
> >> +    if (Image =3D=3D NULL)
> >> +    {
> >> +        DEBUG((DEBUG_ERR= OR, "CheckImageWithStatus - Image Pointer Parameter is NULL.\n"))= ;
> >> +        *ImageUpdatable = = =3D IMAGE_UPDATABLE_INVALID; //not sure if this is needed
> >> +        *LastAttemptStat= us =3D LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE;
> >> +        return EFI_INVAL= ID_PARAMETER;
> >> +    }
> >> +
> >> +cleanup:
> >> +    return status;
> >> +}// CheckImageWithStatus()
> >> +
> >>
> >>   /**
> >>   Checks if the firmware image is valid for the de= vice.
> >> @@ -465,29 +639,9 @@ IN  UINTN    &= nbsp;           &nbs= p;            ImageS= ize,
> >>   OUT UINT32      &n= bsp;            = ;         *ImageUpdateable
> >>   )
> >>   {
> >> -    EFI_STATUS status =3D EFI_SUCCESS;
> >> +  UINT32  LastAttemptStatus;
> >>
> >> -    if (ImageUpdateable =3D=3D NULL)
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "CheckImage - ImageUpdateable Pointer Parameter is NULL.\n"))= ;
> >> -        status =3D EFI_I= NVALID_PARAMETER;
> >> -        goto cleanup; > >> -    }
> >> -
> >> -    //
> >> -    //Set to valid and then if any tests fai= l it will update this flag.
> >> -    //
> >> -    *ImageUpdateable =3D IMAGE_UPDATABLE_VAL= ID;
> >> -
> >> -    if (Image =3D=3D NULL)
> >> -    {
> >> -        DEBUG((DEBUG_ERR= OR, "CheckImage - Image Pointer Parameter is NULL.\n"));
> >> -        *ImageUpdateable= =3D IMAGE_UPDATABLE_INVALID; //not sure if this is needed
> >> -        return EFI_INVAL= ID_PARAMETER;
> >> -    }
> >> -
> >> -cleanup:
> >> -    return status;
> >> +  return FmpDeviceCheckImageWithStatus (Image, ImageSi= ze, ImageUpdateable, &LastAttemptStatus);
> >>   }// CheckImage()
> >>
> >>   /**
> >> --
> >> 2.28.0.windows.1
> >




 

--_000_AM8P190MB0945C933392BA5D8C68F213EEBE80AM8P190MB0945EURP_--