From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.92.20.50]) by mx.groups.io with SMTP id smtpd.web12.7127.1603759850915417855 for ; Mon, 26 Oct 2020 17:50:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=mPaJvlH+; spf=pass (domain: outlook.com, ip: 40.92.20.50, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8waUfD7kdh/XTLOZtjiiPC1Oizk0k73Xu46nQu8lZ29OyGVUFJxXd7V95ogrE2rm6W6LxSfnYeHqOxEh8ZNTCwXMELmFQ18uSeg6eQ0NDUxNzvu9bCilkpFtk6Pd2z0glGLPZBvKX3/IqNw/lvqo7WfogU4G7PiD1PZLJdonEy8VCtvfOWRN1t/rzfZ3FuMhuCoKdnUqHNNdS0TPldIPr9Uyc7X5UFhkcutKSi+fa8nV+Ohvc+XrMmn2Owe1jTfaOJLnEQAyEYJ7FChsd3o1o0nMOXAaxwob3xQTwZu987VknjBrXFr41ftBC2eF77aW8QP0RXyB/A9V08FBL48kg== 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=dHOwazD0XQqdNEVFyDcKilFGRLkFzIxBaVsMsP5yRHQ=; b=ECl8TcarFv3CQqiZDHJJPmUwCYkIVudMueqswkTb2bV7zEj4ZIq3B7Uyo9SyGg/4XmQKzbO4wj3QE0B4h0tSo2c5S+Ou9vpUheEZE91Mdmc+tauaZ2Lko4zP9q4VE0il8yaO6ZkSzP2jTv76UwjigWvan5CRSc6F/Zs0kNntjxJq8sRSMpgE1nR0O5vABP8i3f3wZjzEgx9Kz84N+feDlgch5UF23NvgMwr5iMzNHoMLcXoBqf5NzJGIwHcTsHLC7lrofCV/s5WN5Ny6nN1qEapa9SsFbHV5OPNS7VNC3KkNHmFK9UNvoBQIJeTQVo+c2N8NJfaMIkKvT8KPk3cffw== 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=dHOwazD0XQqdNEVFyDcKilFGRLkFzIxBaVsMsP5yRHQ=; b=mPaJvlH+MGlpiuWCH3BwfxxECcixIMHchMpNc9iwbiYNCXm7WHrcDdks68Q9BhPTufrvm4sSXoesS4skrE+APGbtnaWdKkB0e37cVfQ4NGZyn3oSSqeCCh/qhlMP6Prwz/1uHAPreozFLp3qqhZnqInhWqim3NKFOGYwO7FePXiABA8044O3L21nHNKg7wDTcXjtujTpvuwHTCARWRjmXvhpfWgJ9f1COFJyfH0is+ffWUsWIqfQP6AbsXq1gdZCRwhx+NLHFSlX37QBPIoFOznleGYwz104N7fTbggyofV3chke7dv9uJXvuVgNKrlW5lQdPc5RfrfjGkUOXNXfIQ== Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4d) by BN8NAM11HT201.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Tue, 27 Oct 2020 00:50:49 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc4b::45) by BN8NAM11FT049.mail.protection.outlook.com (2a01:111:e400:fc4b::413) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 27 Oct 2020 00:50:49 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4C795187B57F9106E0E6D1CA40F6AF64619CDD91CB02F6F729BEBBEAA6A9CA13;UpperCasedChecksum:CD9FAF9A2C2697D773B9BD4DBF1CD92B20A1A4FF6D53FC2264CD09F6B23463F8;SizeAsReceived:9048;Count:49 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::858f:bd50:1b65:e803]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::858f:bd50:1b65:e803%7]) with mapi id 15.20.3477.029; Tue, 27 Oct 2020 00:50:49 +0000 Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility From: "Michael Kubacki" To: devel@edk2.groups.io CC: Michael D Kinney , Yi Qian , Zailiang Sun Reply-To: devel@edk2.groups.io, michael.kubacki@outlook.com References: <1639FD37CA1FD9A2.6392@groups.io> Message-ID: Date: Mon, 26 Oct 2020 17:50:49 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 In-Reply-To: X-TMN: [kR/cSHQQFrM41j2WevhPVtP6qos9L+Bx0bxgCaFBPRvP6c9cAcJzb+W1cC5vBW05] X-ClientProxiedBy: CO1PR15CA0094.namprd15.prod.outlook.com (2603:10b6:101:21::14) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <8289c113-3afd-5b3f-6fc0-58194d41a6f4@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4898:d8:39:f055:b004:eb42:dbed] (2001:4898:80e8:7:7077:b004:eb42:dbed) by CO1PR15CA0094.namprd15.prod.outlook.com (2603:10b6:101:21::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 27 Oct 2020 00:50:48 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a1383584-5fa6-43dd-ced5-08d87a1258bf X-MS-TrafficTypeDiagnostic: BN8NAM11HT201: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hCyDnGmalDD44X7g3KlAx/c4cdxItOyJ+JRTB7VCM7wUfVVu6c0dbypkn+4o6tFjfXioggUOZNYJPzfdMhVEHTiYrYt2zSj0hUBQSLEn+kL+c0k8f/k//oO/WQsa4pxXsT5HgkNEmOr0RE7p5HkfzhW7V8Waf9Ie8RMnDh0E3sKg4QopG+nHIeIbLswp77N4Sd4oyiqFSwVaT3BKpY2ZUA== X-MS-Exchange-AntiSpam-MessageData: HOnOSZguQ+k4n1pa6A8d8y+Hj1XWi6P+y8+q6P03QyKiLQOKRslKDjTaIYE1Sr2b+HHW5SRb+9Bz+880T179M5gacMFGWmdf8N+HfMxURKWmRVcC9l3dnKUoLLoyg8GAQItN9vrzhpD07ExhdFC+tjeTr9CcXCTxgIRmCzI3QC1fgUI25vFpdWhoLshu07c4molLFD65/PCTSEDheBVI3g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1383584-5fa6-43dd-ced5-08d87a1258bf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2020 00:50:49.4228 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT201 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable I still haven't seen any feedback on this patch. Can you please review it? Thanks, Michael On 10/15/2020 2:27 PM, Michael Kubacki wrote: > Hi, >=20 > It's been two weeks with no feedback. >=20 > A review would be appreciated. >=20 > Thanks, > Michael >=20 > On 10/1/2020 2:58 PM, Michael Kubacki wrote: >> 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: >> =C2=A0=C2=A0 1. FmpDeviceCheckImageWithStatus ( ) >> =C2=A0=C2=A0 2. FmpDeviceSetImageWithStatus ( ) >> >> FmpDxe (in FmpDevicePkg) will begin calling these new functions >> instead of the previous functions. Therefore, this change: >> =C2=A0=C2=A0 1. Adds these functions to Vlv2TbltDevicePkg implementation= s >> =C2=A0=C2=A0 2. Moves the main functionality to these new functions >> =C2=A0=C2=A0 3. Updates the old functions to call the new functions >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (for backward compatibility) >> >> Note: As of this commit, the Vlv2TbltDevicePkg build is broken >> due to: >> =C2=A0=C2=A0 1. A required RngLib library instance not defined by the pl= atform >> =C2=A0=C2=A0 2. Other FMP libraries not being defined by the platform >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (e.g. FmpDependencyLib, FmpDependencyChec= kLib, 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: >> =C2=A0=C2=A0=C2=A0=C2=A0 Only build was checked, I do not have access to= a >> =C2=A0=C2=A0=C2=A0=C2=A0 VLV2 device for testing. >> >> =20 >> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/Fm= pDeviceLib.c =20 >> | 299 +++++++++++++++----- >> =20 >> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSam= ple/FmpDeviceLib.c=20 >> | 284 ++++++++++++++----- >> =C2=A0 2 files changed, 446 insertions(+), 137 deletions(-) >> >> diff --git=20 >> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c=20 >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c=20 >> >> index d8c9036012ad..df8a36d9854c 100644 >> ---=20 >> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c=20 >> >> +++=20 >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c=20 >> >> @@ -1,6 +1,6 @@ >> =C2=A0 /** >> -Copyright (c) 2016, Microsoft Corporation.=C2=A0 All rights reserved. >> +Copyright (c) Microsoft Corporation.
>> =C2=A0 Copyright (c) 2019, Intel Corporation.=C2=A0 All rights reserved. >> =C2=A0 SPDX-License-Identifier: BSD-2-Clause-Patent >> @@ -8,7 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >> =C2=A0 **/ >> =C2=A0 #include >> - >> +#include >> +#include >> =C2=A0 #include >> =C2=A0 #include >> @@ -444,20 +445,17 @@ FmpDeviceGetImage ( >> =C2=A0 } >> =C2=A0 /** >> -=C2=A0 Updates the firmware image of the device. >> - >> -=C2=A0 This function updates the hardware with the new firmware image. = =20 >> This function >> -=C2=A0 returns EFI_UNSUPPORTED if the firmware image is not updatable.= =C2=A0 If=20 >> the >> -=C2=A0 firmware image is updatable, the function should perform the=20 >> following minimal >> -=C2=A0 validations before proceeding to do the firmware image update. >> -=C2=A0=C2=A0=C2=A0 - Validate the image is a supported image for this d= evice.=C2=A0 The=20 >> function >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 returns EFI_ABORTED if the image is unsu= pported.=C2=A0 The function can >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 optionally provide more detailed informa= tion on why the image=20 >> is not a >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 supported image. >> -=C2=A0=C2=A0=C2=A0 - Validate the data from VendorCode if not null.=C2= =A0 Image=20 >> validation must be >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 performed before VendorCode data validat= ion.=C2=A0 VendorCode data=20 >> is ignored >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 or considered invalid if image validatio= n failed.=C2=A0 The function=20 >> returns >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_ABORTED if the data is invalid. >> +=C2=A0 Updates a firmware device with a new firmware image.=C2=A0 This = function=20 >> returns >> +=C2=A0 EFI_UNSUPPORTED if the firmware image is not updatable.=C2=A0 If= the=20 >> firmware image >> +=C2=A0 is updatable, the function should perform the following minimal= =20 >> validations >> +=C2=A0 before proceeding to do the firmware image update. >> +=C2=A0=C2=A0=C2=A0 - Validate that the image is a supported image for t= his firmware=20 >> device. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Return EFI_ABORTED if the image is not s= upported.=C2=A0 Additional=20 >> details >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 on why the image is not a supported imag= e may be returned in=20 >> AbortReason. >> +=C2=A0=C2=A0=C2=A0 - Validate the data from VendorCode if is not NULL.= =C2=A0 Firmware image >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 validation must be performed before Vend= orCode data validation. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VendorCode data is ignored or considered= invalid if image=20 >> validation >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fails.=C2=A0 Return EFI_ABORTED if the V= endorCode data is invalid. >> =C2=A0=C2=A0=C2=A0 VendorCode enables vendor to implement vendor-specifi= c firmware=20 >> image update >> =C2=A0=C2=A0=C2=A0 policy.=C2=A0 Null if the caller did not specify the = policy or use the=20 >> default >> @@ -470,38 +468,56 @@ FmpDeviceGetImage ( >> =C2=A0=C2=A0=C2=A0 have the option to provide a more detailed descriptio= n of the=20 >> abort reason to >> =C2=A0=C2=A0=C2=A0 the caller. >> -=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to the new image. >> -=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Size of the new image in bytes. >> +=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to the new firmware image. >> +=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Size, in bytes, of the new firmware=20 >> image. >> =C2=A0=C2=A0=C2=A0 @param[in]=C2=A0 VendorCode=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 This enables vendor to implement=20 >> vendor-specific >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image update policy. Nu= ll=20 >> indicates the >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller did not specify the polic= y or=20 >> use the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image update policy.=C2= =A0 NULL=20 >> indicates >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 the caller did not specify the p= olicy=20 >> or use the >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default policy. >> -=C2=A0 @param[in]=C2=A0 Progress=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 A function used by the driver to=20 >> report the >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 progress of the firmware update. >> -=C2=A0 @param[in]=C2=A0 CapsuleFwVersion=C2=A0 FMP Payload Header versi= on of the image. >> -=C2=A0 @param[out] AbortReason=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A po= inter to a pointer to a=20 >> null-terminated >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string providing more details fo= r the=20 >> aborted >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 operation. The buffer is allocat= ed by=20 >> this >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function with AllocatePool(), an= d it=20 >> is the >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller's responsibility to free = it=20 >> with a call >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to FreePool(). >> +=C2=A0 @param[in]=C2=A0 Progress=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 A function used to report the=20 >> progress of >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 updating the firmware device wit= h the=20 >> new >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image. >> +=C2=A0 @param[in]=C2=A0 CapsuleFwVersion=C2=A0 The version of the new f= irmware image=20 >> from the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 update capsule that provided the= new=20 >> firmware >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 image. >> +=C2=A0 @param[out] AbortReason=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A po= inter to a pointer to a=20 >> Null-terminated >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Unicode string providing more de= tails=20 >> on an >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 aborted operation. The buffer is= =20 >> allocated by >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 this function with >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_BOOT_SERVICES.AllocatePool()= .=C2=A0 It=20 >> is the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller's responsibility to free = this=20 >> buffer with >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_BOOT_SERVICES.FreePool(). >> +=C2=A0 @param[out] LastAttemptStatus A pointer to a UINT32 that holds t= he=20 >> last attempt >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status to report back to the ESR= T=20 >> table in case >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of error. This value will only b= e=20 >> checked when this >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function returns an error. >> -=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The device was successfully updated=20 >> with the >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 new image. >> -=C2=A0 @retval EFI_ABORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The operation is aborted. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 The return status code must fall= in=20 >> the range of >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If the value falls outside this= =20 >> range, it will be converted >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to=20 >> LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. >> + >> +=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The firmware device was successfully=20 >> updated >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 with the new firmware imag= e. >> +=C2=A0 @retval EFI_ABORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The operation is aborted. =20 >> Additional details >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 are provided in AbortReaso= n. >> =C2=A0=C2=A0=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 The Image was NUL= L. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 LastAttemptStatus was NULL. >> =C2=A0=C2=A0=C2=A0 @retval EFI_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 The operation is not supported. >> =C2=A0 **/ >> =C2=A0 EFI_STATUS >> =C2=A0 EFIAPI >> -FmpDeviceSetImage ( >> +FmpDe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0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus >> =C2=A0=C2=A0=C2=A0 ) >> =C2=A0 { >> =C2=A0=C2=A0=C2=A0 EFI_STATUS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Status; >> @@ -513,25 +529,27 @@ FmpDeviceSetImage ( >> =C2=A0=C2=A0=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 BytesWritten; >> =C2=A0=C2=A0=C2=A0 Updateable =3D 0; >> -=C2=A0 Status =3D FmpDeviceCheckImage (Image, ImageSize, &Updateable); >> +=C2=A0 Status =3D FmpDeviceCheckImageWithStatus (Image, ImageSize,=20 >> &Updateable, LastAttemptStatus); >> =C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image= failed with=20 >> %r.\n", Status)); >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - C= heck Image=20 >> failed with %r.\n", Status)); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return Status; >> =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image= returned=20 >> that the Image was not valid for update.=C2=A0 Updatable value =3D 0x%X.= \n",=20 >> Updateable)); >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - C= heck Image=20 >> returned that the Image was not valid for update.=C2=A0 Updatable value = =3D=20 >> 0x%X.\n", Updateable)); >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return EFI_ABORTED; >> =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 if (Progress =3D=3D NULL) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Invalid pro= gress=20 >> callback\n")); >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - I= nvalid=20 >> progress callback\n")); >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 Status =3D Progress (15); >> =C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Ca= llback failed=20 >> with Status %r.\n", Status)); >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - P= rogress=20 >> Callback failed with Status %r.\n", Status)); >> =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 // >> @@ -539,7 +557,7 @@ FmpDeviceSetImage ( >> =C2=A0=C2=A0=C2=A0 // >> =C2=A0=C2=A0=C2=A0 Progress (20); >> =C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Ca= llback failed=20 >> with Status %r.\n", Status)); >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - P= rogress=20 >> Callback failed with Status %r.\n", Status)); >> =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 // >> @@ -553,11 +571,11 @@ FmpDeviceSetImage ( >> =C2=A0 //=C2=A0=C2=A0=C2=A0 Progress (Percentage); >> =C2=A0 //=C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> -//=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage= - Progress Callback=20 >> failed with Status %r.\n", Status)); >> +//=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage= WithStatus - Progress=20 >> Callback failed with Status %r.\n", Status)); >> =C2=A0 //=C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0 } >> -=C2=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %d Images ...\n",=20 >> ARRAY_SIZE (mUpdateConfigData))); >> +=C2=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %d Images=20 >> ...\n", ARRAY_SIZE (mUpdateConfigData))); >> =C2=A0=C2=A0=C2=A0 if (ARRAY_SIZE (mUpdateConfigData) =3D=3D 0) { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_INFO, "PlatformUpdate: BaseA= ddress - 0x%lx=20 >> ImageOffset - 0x%x Length - 0x%x\n", 0, 0, ImageSize)); >> @@ -605,11 +623,173 @@ FmpDeviceSetImage ( >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 BytesWritten +=3D ConfigData->Length; >> =C2=A0=C2=A0=C2=A0 } >> -=C2=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %r\n", Status)); >> +=C2=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %r\n", Status= )); >> + >> +=C2=A0 if (EFI_ERROR (Status)) { >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0 } >> =C2=A0=C2=A0=C2=A0 return Status; >> =C2=A0 } >> +/** >> +=C2=A0 Updates the firmware image of the device. >> + >> +=C2=A0 This function updates the hardware with the new firmware image. = =20 >> This function >> +=C2=A0 returns EFI_UNSUPPORTED if the firmware image is not updatable.= =C2=A0 If=20 >> the >> +=C2=A0 firmware image is updatable, the function should perform the=20 >> following minimal >> +=C2=A0 validations before proceeding to do the firmware image update. >> +=C2=A0=C2=A0=C2=A0 - Validate the image is a supported image for this d= evice.=C2=A0 The=20 >> function >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 returns EFI_ABORTED if the image is unsu= pported.=C2=A0 The function can >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 optionally provide more detailed informa= tion on why the image=20 >> is not a >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 supported image. >> +=C2=A0=C2=A0=C2=A0 - Validate the data from VendorCode if not null.=C2= =A0 Image=20 >> validation must be >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 performed before VendorCode data validat= ion.=C2=A0 VendorCode data=20 >> is ignored >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 or considered invalid if image validatio= n failed.=C2=A0 The function=20 >> returns >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_ABORTED if the data is invalid. >> + >> +=C2=A0 VendorCode enables vendor to implement vendor-specific firmware= =20 >> image update >> +=C2=A0 policy.=C2=A0 Null if the caller did not specify the policy or u= se the=20 >> default >> +=C2=A0 policy.=C2=A0 As an example, vendor can implement a policy to al= low an=20 >> option to >> +=C2=A0 force a firmware image update when the abort reason is due to th= e=20 >> new firmware >> +=C2=A0 image version is older than the current firmware image version o= r=20 >> bad image >> +=C2=A0 checksum.=C2=A0 Sensitive operations such as those wiping the en= tire=20 >> firmware image >> +=C2=A0 and render the device to be non-functional should be encoded in = the=20 >> image >> +=C2=A0 itself rather than passed with the VendorCode.=C2=A0 AbortReason= enables=20 >> vendor to >> +=C2=A0 have the option to provide a more detailed description of the ab= ort=20 >> reason to >> +=C2=A0 the caller. >> + >> +=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to the new image. >> +=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Size of the new image in bytes. >> +=C2=A0 @param[in]=C2=A0 VendorCode=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 This enables vendor to implement=20 >> vendor-specific >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image update policy. Nu= ll=20 >> indicates the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller did not specify the polic= y or=20 >> use the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default policy. >> +=C2=A0 @param[in]=C2=A0 Progress=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 A function used by the driver to=20 >> report the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 progress of the firmware update. >> +=C2=A0 @param[in]=C2=A0 CapsuleFwVersion=C2=A0 FMP Payload Header versi= on of the image. >> +=C2=A0 @param[out] AbortReason=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A po= inter to a pointer to a=20 >> null-terminated >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string providing more details fo= r the=20 >> aborted >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 operation. The buffer is allocat= ed by=20 >> this >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function with AllocatePool(), an= d it=20 >> is the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller's responsibility to free = it=20 >> with a call >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to FreePool(). >> + >> +=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The device was successfully updated=20 >> with the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 new image. >> +=C2=A0 @retval EFI_ABORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The operation is aborted. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 The Image was NULL. >> +=C2=A0 @retval EFI_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=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A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &Las= tAttemptStatus >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ); >> +} >> + >> +/** >> +=C2=A0 Checks if a new firmware image is valid for the firmware device.= =C2=A0 This >> +=C2=A0 function allows firmware update operation to validate the firmwa= re=20 >> image >> +=C2=A0 before FmpDeviceSetImage() is called. >> + >> +=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to a new firmware image. >> +=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 Size, in bytes, of a new firmware=20 >> image. >> +=C2=A0 @param[out] ImageUpdatable=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Indicat= es if a new firmware image=20 >> is valid for >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a firmware update to= the firmware=20 >> device.=C2=A0 The >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 following values fro= m the Firmware=20 >> Management >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=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0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IMAGE_UP= DATABLE_INVALID_OLD >> + =20 >> IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE >> +=C2=A0 @param[out] LastAttemptStatus=C2=A0=C2=A0 A pointer to a UINT32 = that holds=20 >> the last attempt >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status to report bac= k to the ESRT=20 >> table in case >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of error. This value= will only be=20 >> checked when this >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function returns an = error. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 The return status co= de must fall in=20 >> the range of >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If the value falls o= utside this=20 >> range, it will be converted >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to=20 >> LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. >> + >> +=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The image was successfully checked. =20 >> Additional >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status information is retu= rned in >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ImageUpdatable. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 Image is NULL. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 ImageUpdatable is NULL. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 LastAttemptStatus is NULL. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +FmpDeviceCheckImageWithStatus ( >> +=C2=A0 IN=C2=A0 CONST VOID=C2=A0 *Image, >> +=C2=A0 IN=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ImageSize, >> +=C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdatable, >> +=C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus >> +=C2=A0 ) >> +{ >> +=C2=A0 if (LastAttemptStatus =3D=3D NULL) { >> +=C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_ERROR, "CheckImageWithStatus - LastAtt= emptStatus=20 >> Pointer Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> +=C2=A0 } >> +=C2=A0 *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; >> + >> +=C2=A0 if (ImageUpdatable =3D=3D NULL) { >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus - ImageUpd= atable=20 >> Pointer Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> +=C2=A0 } >> + >> +=C2=A0 // >> +=C2=A0 //Set to valid and then if any tests fail it will update this fl= ag. >> +=C2=A0 // >> +=C2=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; >> + >> +=C2=A0 if (Image =3D=3D NULL) { >> +=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus - Image Po= inter=20 >> Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0 // >> +=C2=A0=C2=A0=C2=A0 // Not sure if this is needed >> +=C2=A0=C2=A0=C2=A0 // >> +=C2=A0=C2=A0=C2=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> +=C2=A0 } >> + >> +=C2=A0 // >> +=C2=A0 // Make sure the image size is correct >> +=C2=A0 // >> +=C2=A0 if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { >> +=C2=A0=C2=A0=C2=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> +=C2=A0 } >> + >> +=C2=A0 return EFI_SUCCESS; >> +} >> + >> =C2=A0 /** >> =C2=A0 Checks if the firmware image is valid for the device. >> @@ -633,34 +813,9 @@ FmpDeviceCheckImage ( >> =C2=A0=C2=A0=C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdate= able >> =C2=A0=C2=A0=C2=A0 ) >> =C2=A0 { >> -=C2=A0 if (ImageUpdateable =3D=3D NULL) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckImage - ImageUpdateable Po= inter=20 >> Parameter is NULL.\n")); >> -=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> -=C2=A0 } >> +=C2=A0 UINT32=C2=A0 LastAttemptStatus; >> -=C2=A0 // >> -=C2=A0 //Set to valid and then if any tests fail it will update this fl= ag. >> -=C2=A0 // >> -=C2=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; >> - >> -=C2=A0 if (Image =3D=3D NULL) { >> -=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckImage - Image Pointer Para= meter is=20 >> NULL.\n")); >> -=C2=A0=C2=A0=C2=A0 // >> -=C2=A0=C2=A0=C2=A0 // Not sure if this is needed >> -=C2=A0=C2=A0=C2=A0 // >> -=C2=A0=C2=A0=C2=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; >> -=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> -=C2=A0 } >> - >> -=C2=A0 // >> -=C2=A0 // Make sure the image size is correct >> -=C2=A0 // >> -=C2=A0 if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { >> -=C2=A0=C2=A0=C2=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; >> -=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> -=C2=A0 } >> - >> -=C2=A0 return EFI_SUCCESS; >> +=C2=A0 return FmpDeviceCheckImageWithStatus (Image, ImageSize,=20 >> ImageUpdateable, &LastAttemptStatus); >> =C2=A0 } >> =C2=A0 /** >> diff --git=20 >> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c=20 >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c=20 >> >> index db0f238ea534..132b60844ad4 100644 >> ---=20 >> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c=20 >> >> +++=20 >> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c=20 >> >> @@ -1,6 +1,6 @@ >> =C2=A0 /** >> -Copyright (c) 2016, Microsoft Corporation. All rights reserved.
>> +Copyright (c) Microsoft Corporation.
>> =C2=A0 Copyright (c) 2019, Intel Corporation. All rights reserved.
>> =C2=A0 SPDX-License-Identifier: BSD-2-Clause-Patent >> @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >> =C2=A0 #include >> +#include >> +#include >> =C2=A0 #include >> =C2=A0 #include >> =C2=A0 #include >> @@ -345,6 +347,131 @@ Return Value: >> =C2=A0 }//GetImage() >> +/** >> +=C2=A0 Updates a firmware device with a new firmware image.=C2=A0 This = function=20 >> returns >> +=C2=A0 EFI_UNSUPPORTED if the firmware image is not updatable.=C2=A0 If= the=20 >> firmware image >> +=C2=A0 is updatable, the function should perform the following minimal= =20 >> validations >> +=C2=A0 before proceeding to do the firmware image update. >> +=C2=A0=C2=A0=C2=A0 - Validate that the image is a supported image for t= his firmware=20 >> device. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Return EFI_ABORTED if the image is not s= upported.=C2=A0 Additional=20 >> details >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 on why the image is not a supported imag= e may be returned in=20 >> AbortReason. >> +=C2=A0=C2=A0=C2=A0 - Validate the data from VendorCode if is not NULL.= =C2=A0 Firmware image >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 validation must be performed before Vend= orCode data validation. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VendorCode data is ignored or considered= invalid if image=20 >> validation >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fails.=C2=A0 Return EFI_ABORTED if the V= endorCode data is invalid. >> + >> +=C2=A0 VendorCode enables vendor to implement vendor-specific firmware= =20 >> image update >> +=C2=A0 policy.=C2=A0 Null if the caller did not specify the policy or u= se the=20 >> default >> +=C2=A0 policy.=C2=A0 As an example, vendor can implement a policy to al= low an=20 >> option to >> +=C2=A0 force a firmware image update when the abort reason is due to th= e=20 >> new firmware >> +=C2=A0 image version is older than the current firmware image version o= r=20 >> bad image >> +=C2=A0 checksum.=C2=A0 Sensitive operations such as those wiping the en= tire=20 >> firmware image >> +=C2=A0 and render the device to be non-functional should be encoded in = the=20 >> image >> +=C2=A0 itself rather than passed with the VendorCode.=C2=A0 AbortReason= enables=20 >> vendor to >> +=C2=A0 have the option to provide a more detailed description of the ab= ort=20 >> reason to >> +=C2=A0 the caller. >> + >> +=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to the new firmware image. >> +=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Size, in bytes, of the new firmware=20 >> image. >> +=C2=A0 @param[in]=C2=A0 VendorCode=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 This enables vendor to implement=20 >> vendor-specific >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image update policy.=C2= =A0 NULL=20 >> indicates >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 the caller did not specify the p= olicy=20 >> or use the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default policy. >> +=C2=A0 @param[in]=C2=A0 Progress=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 A function used to report the=20 >> progress of >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 updating the firmware device wit= h the=20 >> new >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firmware image. >> +=C2=A0 @param[in]=C2=A0 CapsuleFwVersion=C2=A0 The version of the new f= irmware image=20 >> from the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 update capsule that provided the= new=20 >> firmware >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 image. >> +=C2=A0 @param[out] AbortReason=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A po= inter to a pointer to a=20 >> Null-terminated >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Unicode string providing more de= tails=20 >> on an >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 aborted operation. The buffer is= =20 >> allocated by >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 this function with >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_BOOT_SERVICES.AllocatePool()= .=C2=A0 It=20 >> is the >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 caller's responsibility to free = this=20 >> buffer with >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EFI_BOOT_SERVICES.FreePool(). >> +=C2=A0 @param[out] LastAttemptStatus A pointer to a UINT32 that holds t= he=20 >> last attempt >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status to report back to the ESR= T=20 >> table in case >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of error. This value will only b= e=20 >> checked when this >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function returns an error. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 The return status code must fall= in=20 >> the range of >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If the value falls outside this= =20 >> range, it will be converted >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to=20 >> LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. >> + >> +=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The firmware device was successfully=20 >> updated >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 with the new firmware imag= e. >> +=C2=A0 @retval EFI_ABORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The operation is aborted. =20 >> Additional details >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 are provided in AbortReaso= n. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 The Image was NULL. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 LastAttemptStatus was NULL. >> +=C2=A0 @retval EFI_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 The operation is not supported. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +FmpDeviceSetImageWithStatus ( >> +=C2=A0 IN=C2=A0 CONST VOID=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 *Image, >> +=C2=A0 IN=C2=A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2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus >> +=C2=A0 ) >> +{ >> +=C2=A0=C2=A0=C2=A0 EFI_STATUS Status=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D EFI_SUCCESS; >> +=C2=A0=C2=A0=C2=A0 UINT32 Updateable=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 0; >> + >> +=C2=A0=C2=A0=C2=A0 Status =3D FmpDeviceCheckImageWithStatus (Image, Ima= geSize,=20 >> &Updateable, LastAttemptStatus); >> +=C2=A0=C2=A0=C2=A0 if (EFI_ERROR(Status)) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= eWithStatus=C2=A0 - Check Image failed=20 >> with %r.\n", Status)); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= eWithStatus=C2=A0 - Check Image=20 >> returned that the Image was not valid for update.=C2=A0 Updatable value = =3D=20 >> 0x%X.\n", Updateable)); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status =3D EFI_ABORTED; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 if (Progress =3D=3D NULL) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= eWithStatus=C2=A0 - Invalid progress=20 >> callback\n")); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status =3D EFI_INVALID_PARAM= ETER; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 Status =3D Progress(15); >> +=C2=A0=C2=A0=C2=A0 if (EFI_ERROR(Status)) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= eWithStatus=C2=A0 - Progress Callback=20 >> failed with Status %r.\n", Status)); >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 UINTN=C2=A0 p; >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (p =3D 20; p < 100; p++) { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gBS->Stall (100000);=C2=A0 /= /us=C2=A0 =3D 0.1 seconds >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Progress (p); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 //TODO: add support for VendorCode, and AbortReason >> +cleanup: >> +=C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 return Status; >> +}// SetImageWithStatus() >> + >> + >> =C2=A0 /** >> =C2=A0 Updates the firmware image of the device. >> @@ -396,51 +523,98 @@ IN =20 >> UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CapsuleFwVersion, >> =C2=A0 OUT CHAR16=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 **AbortReason >> =C2=A0 ) >> =C2=A0 { >> -=C2=A0=C2=A0=C2=A0 EFI_STATUS Status=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D EFI_SUCCESS; >> -=C2=A0=C2=A0=C2=A0 UINT32 Updateable=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 0; >> - >> -=C2=A0=C2=A0=C2=A0 Status =3D FmpDeviceCheckImage(Image, ImageSize, &Up= dateable); >> -=C2=A0=C2=A0=C2=A0 if (EFI_ERROR(Status)) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= e - Check Image failed with=20 >> %r.\n", Status)); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= e - Check Image returned that the=20 >> Image was not valid for update.=C2=A0 Updatable value =3D 0x%X.\n",=20 >> Updateable)); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status =3D EFI_ABORTED; >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 if (Progress =3D=3D NULL) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= e - Invalid progress callback\n")); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status =3D EFI_INVALID_PARAM= ETER; >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 Status =3D Progress(15); >> -=C2=A0=C2=A0=C2=A0 if (EFI_ERROR(Status)) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "SetImag= e - Progress Callback failed with=20 >> Status %r.\n", Status)); >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 UINTN=C2=A0 p; >> - >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (p =3D 20; p < 100; p++) { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gBS->Stall (100000);=C2=A0 /= /us=C2=A0 =3D 0.1 seconds >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Progress (p); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 //TODO: add support for VendorCode, and AbortReason >> -cleanup: >> -=C2=A0=C2=A0=C2=A0 return Status; >> +=C2=A0 UINT32=C2=A0 LastAttemptStatus; >> + >> +=C2=A0 return=C2=A0 FmpDeviceSetImageWithStatus ( >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Imag= e, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Imag= eSize, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Vend= orCode, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Prog= ress, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Caps= uleFwVersion, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Abor= tReason, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &Las= tAttemptStatus >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ); >> =C2=A0 }// SetImage() >> +/** >> +=C2=A0 Checks if a new firmware image is valid for the firmware device.= =C2=A0 This >> +=C2=A0 function allows firmware update operation to validate the firmwa= re=20 >> image >> +=C2=A0 before FmpDeviceSetImage() is called. >> + >> +=C2=A0 @param[in]=C2=A0 Image=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Points to a new firmware image. >> +=C2=A0 @param[in]=C2=A0 ImageSize=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 Size, in bytes, of a new firmware=20 >> image. >> +=C2=A0 @param[out] ImageUpdatable=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Indicat= es if a new firmware image=20 >> is valid for >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a firmware update to= the firmware=20 >> device.=C2=A0 The >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 following values fro= m the Firmware=20 >> Management >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Protocol are support= ed: >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IMAGE_UP= DATABLE_VALID >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IMAGE_UP= DATABLE_INVALID >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IMAGE_UP= DATABLE_INVALID_TYPE >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IMAGE_UP= DATABLE_INVALID_OLD >> + =20 >> IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE >> +=C2=A0 @param[out] LastAttemptStatus=C2=A0=C2=A0 A pointer to a UINT32 = that holds=20 >> the last attempt >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status to report bac= k to the ESRT=20 >> table in case >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of error. This value= will only be=20 >> checked when this >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 function returns an = error. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 The return status co= de must fall in=20 >> the range of >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to >> + =20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If the value falls o= utside this=20 >> range, it will be converted >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to=20 >> LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. >> + >> +=C2=A0 @retval EFI_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 The image was successfully checked. =20 >> Additional >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status information is retu= rned in >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ImageUpdatable. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 Image is NULL. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 ImageUpdatable is NULL. >> +=C2=A0 @retval EFI_INVALID_PARAMETER=C2=A0 LastAttemptStatus is NULL. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +FmpDeviceCheckImageWithStatus ( >> +=C2=A0 IN=C2=A0 CONST VOID=C2=A0 *Image, >> +=C2=A0 IN=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ImageSize, >> +=C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdatable, >> +=C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus >> +=C2=A0 ) >> +{ >> +=C2=A0=C2=A0=C2=A0 EFI_STATUS status =3D EFI_SUCCESS; >> + >> +=C2=A0=C2=A0=C2=A0 if (LastAttemptStatus =3D=3D NULL) { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_ERROR, "CheckImageWithStat= us - LastAttemptStatus=20 >> Pointer Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER; >> +=C2=A0=C2=A0=C2=A0 } >> +=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; >> + >> +=C2=A0=C2=A0=C2=A0 if (ImageUpdatable =3D=3D NULL) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckIm= ageWithStatus - ImageUpdatable=20 >> Pointer Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status =3D EFI_INVALID_PARAM= ETER; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +=C2=A0=C2=A0=C2=A0 // >> +=C2=A0=C2=A0=C2=A0 //Set to valid and then if any tests fail it will up= date this flag. >> +=C2=A0=C2=A0=C2=A0 // >> +=C2=A0=C2=A0=C2=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; >> + >> +=C2=A0=C2=A0=C2=A0 if (Image =3D=3D NULL) >> +=C2=A0=C2=A0=C2=A0 { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckIm= ageWithStatus - Image Pointer=20 >> Parameter is NULL.\n")); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdatable =3D IMAGE_UP= DATABLE_INVALID; //not sure if this=20 >> is needed >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *LastAttemptStatus =3D=20 >> LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER= ; >> +=C2=A0=C2=A0=C2=A0 } >> + >> +cleanup: >> +=C2=A0=C2=A0=C2=A0 return status; >> +}// CheckImageWithStatus() >> + >> =C2=A0 /** >> =C2=A0 Checks if the firmware image is valid for the device. >> @@ -465,29 +639,9 @@ IN=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ImageSize, >> =C2=A0 OUT UINT32=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdateable >> =C2=A0 ) >> =C2=A0 { >> -=C2=A0=C2=A0=C2=A0 EFI_STATUS status =3D EFI_SUCCESS; >> +=C2=A0 UINT32=C2=A0 LastAttemptStatus; >> -=C2=A0=C2=A0=C2=A0 if (ImageUpdateable =3D=3D NULL) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckIm= age - ImageUpdateable Pointer=20 >> Parameter is NULL.\n")); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 status =3D EFI_INVALID_PARAM= ETER; >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto cleanup; >> -=C2=A0=C2=A0=C2=A0 } >> - >> -=C2=A0=C2=A0=C2=A0 // >> -=C2=A0=C2=A0=C2=A0 //Set to valid and then if any tests fail it will up= date this flag. >> -=C2=A0=C2=A0=C2=A0 // >> -=C2=A0=C2=A0=C2=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; >> - >> -=C2=A0=C2=A0=C2=A0 if (Image =3D=3D NULL) >> -=C2=A0=C2=A0=C2=A0 { >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG((DEBUG_ERROR, "CheckIm= age - Image Pointer Parameter is=20 >> NULL.\n")); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *ImageUpdateable =3D IMAGE_U= PDATABLE_INVALID; //not sure if=20 >> this is needed >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return EFI_INVALID_PARAMETER= ; >> -=C2=A0=C2=A0=C2=A0 } >> - >> -cleanup: >> -=C2=A0=C2=A0=C2=A0 return status; >> +=C2=A0 return FmpDeviceCheckImageWithStatus (Image, ImageSize,=20 >> ImageUpdateable, &LastAttemptStatus); >> =C2=A0 }// CheckImage() >> =C2=A0 /** >>