From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.92.21.59]) by mx.groups.io with SMTP id smtpd.web09.2751.1605071841974891398 for ; Tue, 10 Nov 2020 21:17:22 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=bJfSd0H8; spf=pass (domain: outlook.com, ip: 40.92.21.59, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTVEsow0Pyfn5sKhKrS8W1fCZBjiUMAkbUWKurSCIpNy0KjHMGWtQ3DFCtAK6JjiRlV/J9cl+nCBAdofHq//FfQZzXnfqb18EHPLy6mu8HDtoDdygIS9EgOYf3MJRu6ebgLGwAMZ7lMvDA260prsHuqod7nuSnlF9FV7vqFZLCZNfHFIxsmoR/MWlmPFgVQotmLKgwQQcGUITTQTXK9Y+2NQ9j9gaL3LcwtDAliYVmRCXeInzu2FlWnM51aaQHYVI+ZivkR3SGC3drWUjD3IUvPOoR1BwtLNpGhdo/I/s7cmXWgg2Dr8hrRvsYuqwptDqIRjjf2IYl7KnJgczisa/Q== 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=mKe/ybXGQRyhhUzSKTVh8JSG+bqQvBrgPM035NKWXXA=; b=WA5y+6AtFjUGOdhxxlhRhfKmFybAE6sF0td+q5spqWf60FE86BmW/6iIATBY9p9cAv3C4NrrH1Tdh5RSrQGx9EUEFWfqIvciCY7q0vtOqrjWI8Lpw8KD/Zi5dqCVnJu0LcstL75NWOmO0nbYO/QOCYXBZPC8Q1z0AnHmGMSfB2fSX2EjehOQIQRDe6mL+YbxG+b3ONAPVR8zGYFQQWR2E7HzIrnGOAjbcJQeOr9IiiM10cEyLgROlm/3HkyNksn56hKelH3JKtzeWKPuLkzhYE+XvCKsshk/zhsZZ8aFPodZMSNR6W7qDkEKY+3J/Q3k0507Su4QK9H2S7G2BKqdsQ== 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=mKe/ybXGQRyhhUzSKTVh8JSG+bqQvBrgPM035NKWXXA=; b=bJfSd0H8pop17CbTAYVz9alaooVINVBGha2XC+MLoujgHwYqezBdJd5SBVaCJaYvxJBO2QPHSrv+H4qr/9CcgZAxgmyqzeh44WIdojsDiyHxYv5tO3lB4nj9VdmholOnQkJimi373+belhkLoILxDd8ZinJfmvf6gAQCYhJ37gzmBfN3zMZRQUkB21jaqZRlA7rf3zs3DCC0CNqW+QYmf773Q0dr4m0/WV6zx80LOqctKIMsnOxi5KDAKXErTm4C5/QW+4n/iDG+I3E/M8U1SYn3FBOjwj56R5NqSV4OT82wQMMRdA0H95olKh1vZFafi+X6T7Opu2+pt7qNjf8xKQ== Received: from DM6NAM12FT035.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::49) by DM6NAM12HT120.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::279) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.19; Wed, 11 Nov 2020 05:17:20 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc64::52) by DM6NAM12FT035.mail.protection.outlook.com (2a01:111:e400:fc64::285) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.19 via Frontend Transport; Wed, 11 Nov 2020 05:17:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:48DD6BACCF33FCBFC7EAE9030B4698F8AC931D014DD921822DD09C37EFE1A5D3;UpperCasedChecksum:43B556B9A882A300D58474938B97594A5F5E117224A6B6C8247F07669BF9962B;SizeAsReceived:8579;Count:48 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.3541.025; Wed, 11 Nov 2020 05:17:20 +0000 Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Vlv2TbltDevicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility To: Kilian Kegel , "devel@edk2.groups.io" , "michael.d.kinney@intel.com" CC: "Qian, Yi" , "Sun, Zailiang" References: From: "Michael Kubacki" Message-ID: Date: Tue, 10 Nov 2020 21:17:19 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 In-Reply-To: X-TMN: [MdUJjqkOuF9gqaJY8xt+m6W5UtT2WnC0Jr/Oonj/+/QI+Nyx8exRp7GvcjpKxt6w] X-ClientProxiedBy: MWHPR19CA0024.namprd19.prod.outlook.com (2603:10b6:300:d4::34) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4898:d8:39:a4a1:2c82:d801:1326] (2001:4898:80e8:2:24c8:2c82:d801:1326) by MWHPR19CA0024.namprd19.prod.outlook.com (2603:10b6:300:d4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25 via Frontend Transport; Wed, 11 Nov 2020 05:17:19 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: efe60591-3ee4-435e-a6f9-08d886011055 X-MS-Exchange-SLBlob-MailProps: =?us-ascii?Q?bRphOwC17+Bb8GFbzyQlXkgmJVV2CVs4R+Uu6HEFeYu7XrIWtEnnjMbpKUpB?= =?us-ascii?Q?bpDq+u1fxaVQ9l+EDGnYqn7ZGa9CmE7+CwQOv4ZFSRtCQqXFxRIH4rv7hosQ?= =?us-ascii?Q?aaBd+SuicLezaj/BMh4pwpZao5rFUq/YlONus3Um/Nz2ZwsPVQJ2NlHanZJw?= =?us-ascii?Q?M86652/dQw2Ue0eiM4y8y27rhu0WIMw9vyMr2DOWHNqB3BafqLjTIQEPcb+U?= =?us-ascii?Q?2/wx4QMLQoYC6yNiuPs+1m8nIlSugMvQdd32Ad1KT3Si5/cZBy4dkSC90O7K?= =?us-ascii?Q?z8sm1mVf/CTxSdJbDvLuDoXfLDHpPu5WHEDo/stXZlM0SV1/PmXERQJPXlva?= =?us-ascii?Q?KfCYhzC+6JXhw47BigTK71x8u8uTJAFdlFmm89Zlywgtjg5pysfHOdcUrxEq?= =?us-ascii?Q?6lJS4UlkL5v2Q0QKYJhTDtGPjDkgAlA6PVHUXACO06duP0yYNNHoHgSnhBFl?= =?us-ascii?Q?BS5IrQOnH1QbDB3kBN64Ry3Zc5Auji1I58HVjTeBeErebk3c7P2JvV2ZhUjQ?= =?us-ascii?Q?gkRApp70zIEU+pcb+JRS0MXjBrUlx7sWRIArJJtwSVpmHx5BWXUGIwWGMmzL?= =?us-ascii?Q?W/mCTNEytoXnNc/g3UOSwjm6yHEefFljxjkoSZ+2ZLNcqqzY9C/oFFQ53NP5?= =?us-ascii?Q?HZix6WU20fH9lBeTXv06sfA9AkFpEcmfsYM76nK7CvDzJU8aR5qaRwkLRUWG?= =?us-ascii?Q?EUZr45JLpxhGFZL7XArtGfmmHO6dIQbTIdBuia9N/EjKmU8Iaw5Cd1nxUnaE?= =?us-ascii?Q?itKQ1cdIsnUVne+QmY6i9R/8LUqVcl+xIEQMtWDLvGMaWJct8MYPIMGNAGSQ?= =?us-ascii?Q?wZ6dIP+sEJ2N7FXw6gBDs3Jzg5vy2lEvwDEU0p0VuHGalCcgjpF3zEX2vo7t?= =?us-ascii?Q?cUk1T03R2e68Us4dFTzsXa6unL3AycFK/l75oHCd6LBQL7z4TDj0JBwDq85B?= =?us-ascii?Q?w5pr8S2nWjLTo+dpn8fODapV1aYYT3k4EOlGQvP5tw+LhrKYbNkif+GQozSZ?= =?us-ascii?Q?JeK7+Gjh3g+tlN99s2hJJF4GFb1VAMNeU1I7ANlliVeU2DBJD/vgHne2wJ43?= =?us-ascii?Q?bN7NvDfAg9LERq4d+tM=3D?= X-MS-TrafficTypeDiagnostic: DM6NAM12HT120: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PIwZY2OyOwThmuPvl9PpPJgaE8EPB7Gcdqe1lsOLK8Q5XDhDar0WsCa67Z9exJAINwhohXwVh6mJiIptnkz6Kh5d4aOHvT2TpTsgms8OHaPiofad58SWbILFqeyiypE7cqvc8JsiHOD5GyddlI5xYdH9lV87LlSMYC3wPJ91owqB4DIoV8CS07AbaqEHF5l3BHz+j+yw5/Rb7BzrlUPAmGJw27PTzT8xLTUk84quzqkTaEieoeJWTUYv2O/tR7S/ X-MS-Exchange-AntiSpam-MessageData: AlElRBSeP2BukoUbmKOIC1MRnfU7ztKw2xkGYWIYozn5+AvOoKYCRG0p9JQQHxuqmZCN99rmbhplKQQrZVyouPBgMU9lvHdP3bagPYmfsp7kuWRMyhww7vJNHyohcfm6oFh4nFGAL3WCoyPKY8SarFQCEEXhqs+VnghViltKlf07kiU2zIpBM6VscBuPUZTDOOw7lZ1+0yDbrmw7B/Nlkg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: efe60591-3ee4-435e-a6f9-08d886011055 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2020 05:17:20.3731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT035.eop-nam12.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: DM6NAM12HT120 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Kilian, That was broken due to FmpDevicePkg changes unrelated to these Last=20 Attempt Status changes. I ran into the same isues as you when attempting= =20 to test this. I believe Mike made those fixes in the following two commits: 1. 2fcfe4763022c1665be8e6a11f80aa69f0a58dce 2. b0de06c7d8494d05b315fb4a2574664f151e108d Thanks, Michael On 11/10/2020 8:16 PM, Kilian Kegel wrote: > Hi all, >=20 > if this patch also affects=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2983=20 > , please close it= . >=20 > Thanks, >=20 > Kilian >=20 > *Von: *Michael D Kinney > *Gesendet: *Wednesday, November 11, 2020 4:03 AM > *An: *Michael Kubacki ;=20 > devel@edk2.groups.io ; Kinney, Michael D=20 > > *Cc: *Qian, Yi ; Sun, Zailiang=20 > > *Betreff: *Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1]=20 > Vlv2TbltDevicePkg/FmpDeviceLib: Add LastAttemptStatus compatibility >=20 > Hi Michael, >=20 > This patch has been merged. >=20 > Thanks, >=20 > Mike >=20 > > -----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]=20 > Vlv2TbltDevicePkg/FmpDeviceLib: 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 > > > > > > I also verified build and boot and FMP based capsule updates work= =20 > as expected. > > > > > > 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=20 > ; Sun, Zailiang > > > > >> Subject: [edk2-platforms][PATCH v1 1/1]=20 > Vlv2TbltDevicePkg/FmpDeviceLib: 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: > > >>=A0=A0=A0 1. FmpDeviceCheckImageWithStatus ( ) > > >>=A0=A0=A0 2. FmpDeviceSetImageWithStatus ( ) > > >> > > >> FmpDxe (in FmpDevicePkg) will begin calling these new functions > > >> instead of the previous functions. Therefore, this change: > > >>=A0=A0=A0 1. Adds these functions to Vlv2TbltDevicePkg implementati= ons > > >>=A0=A0=A0 2. Moves the main functionality to these new functions > > >>=A0=A0=A0 3. Updates the old functions to call the new functions > > >>=A0=A0=A0=A0=A0=A0 (for backward compatibility) > > >> > > >> Note: As of this commit, the Vlv2TbltDevicePkg build is broken > > >> due to: > > >>=A0=A0=A0 1. A required RngLib library instance not defined by the = platform > > >>=A0=A0=A0 2. Other FMP libraries not being defined by the platform > > >>=A0=A0=A0=A0=A0=A0 (e.g. FmpDependencyLib, FmpDependencyCheckLib, e= tc.) > > >> > > >> Those changes were fixed locally to test the changes in this commi= t > > >> 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: > > >>=A0=A0=A0=A0=A0 Only build was checked, I do not have access to a > > >>=A0=A0=A0=A0=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 ++++++++++++++----- > > >>=A0=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 > > >> index d8c9036012ad..df8a36d9854c 100644 > > >> ---=20 > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c > > >> +++=20 > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/= FmpDeviceLib.c > > >> @@ -1,6 +1,6 @@ > > >>=A0=A0 /** > > >> > > >> -Copyright (c) 2016, Microsoft Corporation.=A0 All rights reserved= . > > >> +Copyright (c) Microsoft Corporation.
> > >>=A0=A0 Copyright (c) 2019, Intel Corporation.=A0 All rights reserve= d. > > >> > > >>=A0=A0 SPDX-License-Identifier: BSD-2-Clause-Patent > > >> @@ -8,7 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > >>=A0=A0 **/ > > >> > > >>=A0=A0 #include > > >> - > > >> +#include > > >> +#include > > >>=A0=A0 #include > > >> > > >>=A0=A0 #include > > >> @@ -444,20 +445,17 @@ FmpDeviceGetImage ( > > >>=A0=A0 } > > >> > > >>=A0=A0 /** > > >> -=A0 Updates the firmware image of the device. > > >> - > > >> -=A0 This function updates the hardware with the new firmware=20 > image.=A0 This function > > >> -=A0 returns EFI_UNSUPPORTED if the firmware image is not=20 > updatable.=A0 If the > > >> -=A0 firmware image is updatable, the function should perform the= =20 > following minimal > > >> -=A0 validations before proceeding to do the firmware image update= . > > >> -=A0=A0=A0 - Validate the image is a supported image for this devi= ce. > The function > > >> -=A0=A0=A0=A0=A0 returns EFI_ABORTED if the image is unsupported.= =A0 The=20 > function can > > >> -=A0=A0=A0=A0=A0 optionally provide more detailed information on w= hy the=20 > image is not a > > >> -=A0=A0=A0=A0=A0 supported image. > > >> -=A0=A0=A0 - Validate the data from VendorCode if not null.=A0 Ima= ge=20 > validation must be > > >> -=A0=A0=A0=A0=A0 performed before VendorCode data validation.=A0 V= endorCode=20 > data is ignored > > >> -=A0=A0=A0=A0=A0 or considered invalid if image validation failed.= = =A0 The=20 > function returns > > >> -=A0=A0=A0=A0=A0 EFI_ABORTED if the data is invalid. > > >> +=A0 Updates a firmware device with a new firmware image.=A0 This= =20 > function returns > > >> +=A0 EFI_UNSUPPORTED if the firmware image is not updatable.=A0 If= the=20 > firmware image > > >> +=A0 is updatable, the function should perform the following minim= al=20 > validations > > >> +=A0 before proceeding to do the firmware image update. > > >> +=A0=A0=A0 - Validate that the image is a supported image for this= = =20 > firmware device. > > >> +=A0=A0=A0=A0=A0 Return EFI_ABORTED if the image is not supported.= > Additional details > > >> +=A0=A0=A0=A0=A0 on why the image is not a supported image may be = returned=20 > in AbortReason. > > >> +=A0=A0=A0 - Validate the data from VendorCode if is not NULL.=A0 = Firmware=20 > image > > >> +=A0=A0=A0=A0=A0 validation must be performed before VendorCode da= ta validation. > > >> +=A0=A0=A0=A0=A0 VendorCode data is ignored or considered invalid = if image=20 > validation > > >> +=A0=A0=A0=A0=A0 fails.=A0 Return EFI_ABORTED if the VendorCode da= ta is invalid. > > >> > > >>=A0=A0=A0=A0 VendorCode enables vendor to implement vendor-specific= = =20 > firmware image update > > >>=A0=A0=A0=A0 policy.=A0 Null if the caller did not specify the poli= cy or use=20 > the default > > >> @@ -470,38 +468,56 @@ FmpDeviceGetImage ( > > >>=A0=A0=A0=A0 have the option to provide a more detailed description= of the=20 > abort reason to > > >>=A0=A0=A0=A0 the caller. > > >> > > >> -=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Point= s to the new image. > > >> -=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0 Size of the n= ew image in bytes. > > >> +=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Point= s to the new firmware image. > > >> +=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0 Size, in byte= s, of the new=20 > firmware image. > > >>=A0=A0=A0=A0 @param[in]=A0 VendorCode=A0=A0=A0=A0=A0=A0=A0 This ena= bles vendor to implement=20 > vendor-specific > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image update policy.=20 > Null indicates the > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller did not specify the policy=20 > or use the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image update policy. > NULL indicates > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 the caller did not specify the=20 > policy or use the > > >>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 default policy. > > >> -=A0 @param[in]=A0 Progress=A0=A0=A0=A0=A0=A0=A0=A0=A0 A function = used by the driver to=20 > report the > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 progress of the firmware update. > > >> -=A0 @param[in]=A0 CapsuleFwVersion=A0 FMP Payload Header version = of the=20 > image. > > >> -=A0 @param[out] AbortReason=A0=A0=A0=A0=A0=A0 A pointer to a poin= ter to a=20 > null-terminated > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 string providing more details for=20 > the aborted > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 operation. The buffer is=20 > allocated by this > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function with AllocatePool(), and=20 > it is the > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller's responsibility to free=20 > it with a call > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to FreePool(). > > >> +=A0 @param[in]=A0 Progress=A0=A0=A0=A0=A0=A0=A0=A0=A0 A function = used to report the=20 > progress of > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 updating the firmware device with=20 > the new > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image. > > >> +=A0 @param[in]=A0 CapsuleFwVersion=A0 The version of the new firm= ware=20 > image from the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 update capsule that provided the=20 > new firmware > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 image. > > >> +=A0 @param[out] AbortReason=A0=A0=A0=A0=A0=A0 A pointer to a poin= ter to a=20 > Null-terminated > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Unicode string providing more=20 > details on an > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 aborted operation. The buffer is=20 > allocated by > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 this function with > > >> + > EFI_BOOT_SERVICES.AllocatePool().=A0 It is the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller's responsibility to free=20 > this buffer with > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 EFI_BOOT_SERVICES.FreePool(). > > >> +=A0 @param[out] LastAttemptStatus A pointer to a UINT32 that hold= s=20 > the last attempt > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status to report back to the ESRT=20 > table in case > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 of error. This value will only be=20 > checked when this > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function returns an error. > > >> > > >> -=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The devi= ce was successfully=20 > updated with the > > >> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 new image. > > >> -=A0 @retval EFI_ABORTED=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The oper= ation is aborted. > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The return status code must fall=20 > in the range of > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 If the value falls outside this=20 > range, it will be converted > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to=20 > LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. > > >> + > > >> +=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The firm= ware device was=20 > successfully updated > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 with the new firmware image. > > >> +=A0 @retval EFI_ABORTED=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The oper= ation is aborted. > Additional details > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 are provided in AbortReason. > > >>=A0=A0=A0=A0 @retval EFI_INVALID_PARAMETER=A0 The Image was NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 LastAttemptStatus was NULL. > > >>=A0=A0=A0=A0 @retval EFI_UNSUPPORTED=A0=A0=A0=A0=A0=A0=A0 The opera= tion is not supported. > > >> > > >>=A0=A0 **/ > > >>=A0=A0 EFI_STATUS > > >>=A0=A0 EFIAPI > > >> -FmpDeviceSetImage ( > > >> +FmpDeviceSetImageWithStatus ( > > >>=A0=A0=A0=A0 IN=A0 CONST VOID=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *= Image, > > >>=A0=A0=A0=A0 IN=A0 UINTN=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 ImageSize, > > >> -=A0 IN=A0 CONST VOID=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *VendorCod= e, > > >> -=A0 IN=A0 EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS=A0 Progre= ss, > > >> +=A0 IN=A0 CONST VOID =20 > *VendorCode,=A0=A0=A0=A0=A0=A0 OPTIONAL > > >> +=A0 IN=A0 EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS > Progress,=A0=A0=A0=A0=A0=A0=A0=A0=A0 OPTIONAL > > >>=A0=A0=A0=A0 IN=A0 UINT32 = =20 > CapsuleFwVersion, > > >> -=A0 OUT CHAR16=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 **Ab= ortReason > > >> +=A0 OUT CHAR16=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 **Ab= ortReason, > > >> +=A0 OUT UINT32 =20 > *LastAttemptStatus > > >>=A0=A0=A0=A0 ) > > >>=A0=A0 { > > >>=A0=A0=A0=A0 EFI_STATUS=A0=A0=A0=A0=A0=A0=A0=A0=A0 Status; > > >> @@ -513,25 +529,27 @@ FmpDeviceSetImage ( > > >>=A0=A0=A0=A0 UINTN=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 BytesW= ritten; > > >> > > >>=A0=A0=A0=A0 Updateable =3D 0; > > >> -=A0 Status =3D FmpDeviceCheckImage (Image, ImageSize, &Updateable= ); > > >> +=A0 Status =3D FmpDeviceCheckImageWithStatus (Image, ImageSize,= =20 > &Updateable, LastAttemptStatus); > > >>=A0=A0=A0=A0 if (EFI_ERROR (Status)) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image fa= iled=20 > with %r.\n", Status)); > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Chec= k=20 > Image failed with %r.\n", Status)); > > >>=A0=A0=A0=A0=A0=A0 return Status; > > >>=A0=A0=A0=A0 } > > >> > > >>=A0=A0=A0=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Check Image re= turned=20 > that the Image was not valid for update.=A0 Updatable > > >> value =3D 0x%X.\n", Updateable)); > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Chec= k=20 > Image returned that the Image was not valid for update. > > >> Updatable value =3D 0x%X.\n", Updateable)); > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >>=A0=A0=A0=A0=A0=A0 return EFI_ABORTED; > > >>=A0=A0=A0=A0 } > > >> > > >>=A0=A0=A0=A0 if (Progress =3D=3D NULL) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Invalid progre= ss=20 > callback\n")); > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Inva= lid=20 > progress callback\n")); > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >>=A0=A0=A0=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >>=A0=A0=A0=A0 } > > >> > > >>=A0=A0=A0=A0 Status =3D Progress (15); > > >>=A0=A0=A0=A0 if (EFI_ERROR (Status)) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Callb= ack=20 > failed with Status %r.\n", Status)); > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Prog= ress=20 > Callback failed with Status %r.\n", Status)); > > >>=A0=A0=A0=A0 } > > >> > > >>=A0=A0=A0=A0 // > > >> @@ -539,7 +557,7 @@ FmpDeviceSetImage ( > > >>=A0=A0=A0=A0 // > > >>=A0=A0=A0=A0 Progress (20); > > >>=A0=A0=A0=A0 if (EFI_ERROR (Status)) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progress Callb= ack=20 > failed with Status %r.\n", Status)); > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatus - Prog= ress=20 > Callback failed with Status %r.\n", Status)); > > >>=A0=A0=A0=A0 } > > >> > > >>=A0=A0=A0=A0 // > > >> @@ -553,11 +571,11 @@ FmpDeviceSetImage ( > > >> > > >>=A0=A0 //=A0=A0=A0 Progress (Percentage); > > >>=A0=A0 //=A0=A0=A0 if (EFI_ERROR (Status)) { > > >> -//=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImage - Progre= ss=20 > Callback failed with Status %r.\n", Status)); > > >> +//=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "FmpDeviceSetImageWithStatu= s -=20 > Progress Callback failed with Status %r.\n", Status)); > > >>=A0=A0 //=A0=A0=A0 } > > >>=A0=A0=A0=A0 } > > >> > > >> -=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %d Images ...\n",=20 > ARRAY_SIZE (mUpdateConfigData))); > > >> +=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %d Images= =20 > ...\n", ARRAY_SIZE (mUpdateConfigData))); > > >> > > >>=A0=A0=A0=A0 if (ARRAY_SIZE (mUpdateConfigData) =3D=3D 0) { > > >>=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_INFO, "PlatformUpdate: BaseAddress = - 0x%lx=20 > ImageOffset - 0x%x Length - 0x%x\n", 0, 0, ImageSize)); > > >> @@ -605,11 +623,173 @@ FmpDeviceSetImage ( > > >>=A0=A0=A0=A0=A0=A0 BytesWritten +=3D ConfigData->Length; > > >>=A0=A0=A0=A0 } > > >> > > >> -=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImage - %r\n", Status)); > > >> +=A0 DEBUG ((DEBUG_INFO, "FmpDeviceSetImageWithStatus - %r\n", Sta= tus)); > > >> + > > >> +=A0 if (EFI_ERROR (Status)) { > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0 } > > >> > > >>=A0=A0=A0=A0 return Status; > > >>=A0=A0 } > > >> > > >> +/** > > >> +=A0 Updates the firmware image of the device. > > >> + > > >> +=A0 This function updates the hardware with the new firmware=20 > image.=A0 This function > > >> +=A0 returns EFI_UNSUPPORTED if the firmware image is not=20 > updatable.=A0 If the > > >> +=A0 firmware image is updatable, the function should perform the= =20 > following minimal > > >> +=A0 validations before proceeding to do the firmware image update= . > > >> +=A0=A0=A0 - Validate the image is a supported image for this devi= ce. > The function > > >> +=A0=A0=A0=A0=A0 returns EFI_ABORTED if the image is unsupported.= =A0 The=20 > function can > > >> +=A0=A0=A0=A0=A0 optionally provide more detailed information on w= hy the=20 > image is not a > > >> +=A0=A0=A0=A0=A0 supported image. > > >> +=A0=A0=A0 - Validate the data from VendorCode if not null.=A0 Ima= ge=20 > validation must be > > >> +=A0=A0=A0=A0=A0 performed before VendorCode data validation.=A0 V= endorCode=20 > data is ignored > > >> +=A0=A0=A0=A0=A0 or considered invalid if image validation failed.= = =A0 The=20 > function returns > > >> +=A0=A0=A0=A0=A0 EFI_ABORTED if the data is invalid. > > >> + > > >> +=A0 VendorCode enables vendor to implement vendor-specific firmwa= re=20 > image update > > >> +=A0 policy.=A0 Null if the caller did not specify the policy or u= se=20 > the default > > >> +=A0 policy.=A0 As an example, vendor can implement a policy to al= low=20 > an option to > > >> +=A0 force a firmware image update when the abort reason is due to= = =20 > the new firmware > > >> +=A0 image version is older than the current firmware image versio= n=20 > or bad image > > >> +=A0 checksum.=A0 Sensitive operations such as those wiping the en= tire=20 > firmware image > > >> +=A0 and render the device to be non-functional should be encoded = in=20 > the image > > >> +=A0 itself rather than passed with the VendorCode.=A0 AbortReason= = =20 > enables vendor to > > >> +=A0 have the option to provide a more detailed description of the= = =20 > abort reason to > > >> +=A0 the caller. > > >> + > > >> +=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Point= s to the new image. > > >> +=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0 Size of the n= ew image in bytes. > > >> +=A0 @param[in]=A0 VendorCode=A0=A0=A0=A0=A0=A0=A0 This enables ve= ndor to implement=20 > vendor-specific > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image update policy.=20 > Null indicates the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller did not specify the policy=20 > or use the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 default policy. > > >> +=A0 @param[in]=A0 Progress=A0=A0=A0=A0=A0=A0=A0=A0=A0 A function = used by the driver to=20 > report the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 progress of the firmware update. > > >> +=A0 @param[in]=A0 CapsuleFwVersion=A0 FMP Payload Header version = of the=20 > image. > > >> +=A0 @param[out] AbortReason=A0=A0=A0=A0=A0=A0 A pointer to a poin= ter to a=20 > null-terminated > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 string providing more details for=20 > the aborted > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 operation. The buffer is=20 > allocated by this > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function with AllocatePool(), and=20 > it is the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller's responsibility to free=20 > it with a call > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to FreePool(). > > >> + > > >> +=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The devi= ce was successfully=20 > updated with the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 new image. > > >> +=A0 @retval EFI_ABORTED=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The oper= ation is aborted. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 The Image was NULL. > > >> +=A0 @retval EFI_UNSUPPORTED=A0=A0=A0=A0=A0=A0=A0 The operation is= not supported. > > >> + > > >> +**/ > > >> +EFI_STATUS > > >> +EFIAPI > > >> +FmpDeviceSetImage ( > > >> +=A0 IN=A0 CONST VOID=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *Image, > > >> +=A0 IN=A0 UINTN=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ImageSize, > > >> +=A0 IN=A0 CONST VOID=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *VendorCod= e, > > >> +=A0 IN=A0 EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS=A0 Progre= ss, > > >> +=A0 IN=A0 UINT32 =20 > CapsuleFwVersion, > > >> +=A0 OUT CHAR16=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 **Ab= ortReason > > >> +=A0 ) > > >> +{ > > >> +=A0 UINT32=A0 LastAttemptStatus; > > >> + > > >> +=A0 return=A0 FmpDeviceSetImageWithStatus ( > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Image, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageSize, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 VendorCode, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Progress, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 CapsuleFwVersion, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 AbortReason, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &LastAttemptStatus > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ); > > >> +} > > >> + > > >> +/** > > >> +=A0 Checks if a new firmware image is valid for the firmware=20 > device.=A0 This > > >> +=A0 function allows firmware update operation to validate the=20 > firmware image > > >> +=A0 before FmpDeviceSetImage() is called. > > >> + > > >> +=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= Points to a new firmware image. > > >> +=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Size, i= n bytes, of a new=20 > firmware image. > > >> +=A0 @param[out] ImageUpdatable=A0=A0=A0=A0=A0 Indicates if a new = firmware=20 > image is valid for > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 a firmware update to the=20 > firmware device.=A0 The > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 following values from the=20 > Firmware Management > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Protocol are supported: > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_VALID > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID_TYPE > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID_OLD > > >> + > IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE > > >> +=A0 @param[out] LastAttemptStatus=A0=A0 A pointer to a UINT32 tha= t=20 > holds the last attempt > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status to report back to the=20 > ESRT table in case > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 of error. This value will only=20 > be checked when this > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function returns an error. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The return status code must=20 > fall in the range of > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 If the value falls outside this=20 > range, it will be converted > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to=20 > LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. > > >> + > > >> +=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The imag= e was successfully=20 > checked.=A0 Additional > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status information is returned in > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageUpdatable. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 Image is NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 ImageUpdatable is NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 LastAttemptStatus is NULL. > > >> + > > >> +**/ > > >> +EFI_STATUS > > >> +EFIAPI > > >> +FmpDeviceCheckImageWithStatus ( > > >> +=A0 IN=A0 CONST VOID=A0 *Image, > > >> +=A0 IN=A0 UINTN=A0=A0=A0=A0=A0=A0 ImageSize, > > >> +=A0 OUT UINT32=A0=A0=A0=A0=A0 *ImageUpdatable, > > >> +=A0 OUT UINT32=A0=A0=A0=A0=A0 *LastAttemptStatus > > >> +=A0 ) > > >> +{ > > >> +=A0 if (LastAttemptStatus =3D=3D NULL) { > > >> +=A0=A0=A0 DEBUG ((DEBUG_ERROR, "CheckImageWithStatus -=20 > LastAttemptStatus Pointer Parameter is NULL.\n")); > > >> +=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0 } > > >> +=A0 *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; > > >> + > > >> +=A0 if (ImageUpdatable =3D=3D NULL) { > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus - ImageUpdata= ble=20 > Pointer Parameter is NULL.\n")); > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0 } > > >> + > > >> +=A0 // > > >> +=A0 //Set to valid and then if any tests fail it will update this= flag. > > >> +=A0 // > > >> +=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; > > >> + > > >> +=A0 if (Image =3D=3D NULL) { > > >> +=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus - Image Point= er=20 > Parameter is NULL.\n")); > > >> +=A0=A0=A0 // > > >> +=A0=A0=A0 // Not sure if this is needed > > >> +=A0=A0=A0 // > > >> +=A0=A0=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0 } > > >> + > > >> +=A0 // > > >> +=A0 // Make sure the image size is correct > > >> +=A0 // > > >> +=A0 if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { > > >> +=A0=A0=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID; > > >> +=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0 } > > >> + > > >> +=A0 return EFI_SUCCESS; > > >> +} > > >> + > > >>=A0=A0 /** > > >>=A0=A0 Checks if the firmware image is valid for the device. > > >> > > >> @@ -633,34 +813,9 @@ FmpDeviceCheckImage ( > > >>=A0=A0=A0=A0 OUT UINT32=A0=A0=A0=A0=A0 *ImageUpdateable > > >>=A0=A0=A0=A0 ) > > >>=A0=A0 { > > >> -=A0 if (ImageUpdateable =3D=3D NULL) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImage - ImageUpdateable Point= er=20 > Parameter is NULL.\n")); > > >> -=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> -=A0 } > > >> +=A0 UINT32=A0 LastAttemptStatus; > > >> > > >> -=A0 // > > >> -=A0 //Set to valid and then if any tests fail it will update this= flag. > > >> -=A0 // > > >> -=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; > > >> - > > >> -=A0 if (Image =3D=3D NULL) { > > >> -=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImage - Image Pointer Paramet= er is=20 > NULL.\n")); > > >> -=A0=A0=A0 // > > >> -=A0=A0=A0 // Not sure if this is needed > > >> -=A0=A0=A0 // > > >> -=A0=A0=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; > > >> -=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> -=A0 } > > >> - > > >> -=A0 // > > >> -=A0 // Make sure the image size is correct > > >> -=A0 // > > >> -=A0 if (ImageSize !=3D PcdGet32 (PcdBiosRomSize)) { > > >> -=A0=A0=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_INVALID; > > >> -=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> -=A0 } > > >> - > > >> -=A0 return EFI_SUCCESS; > > >> +=A0 return FmpDeviceCheckImageWithStatus (Image, ImageSize,=20 > ImageUpdateable, &LastAttemptStatus); > > >>=A0=A0 } > > >> > > >>=A0=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 > > >> index db0f238ea534..132b60844ad4 100644 > > >> ---=20 > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c > > >> +++=20 > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibS= ample/FmpDeviceLib.c > > >> @@ -1,6 +1,6 @@ > > >>=A0=A0 /** > > >> > > >> -Copyright (c) 2016, Microsoft Corporation. All rights reserved. > > >> +Copyright (c) Microsoft Corporation.
> > >>=A0=A0 Copyright (c) 2019, Intel Corporation. All rights reserved.<= BR> > > >> > > >>=A0=A0 SPDX-License-Identifier: BSD-2-Clause-Patent > > >> @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > >> > > >> > > >>=A0=A0 #include > > >> +#include > > >> +#include > > >>=A0=A0 #include > > >>=A0=A0 #include > > >>=A0=A0 #include > > >> @@ -345,6 +347,131 @@ Return Value: > > >>=A0=A0 }//GetImage() > > >> > > >> > > >> +/** > > >> +=A0 Updates a firmware device with a new firmware image.=A0 This= =20 > function returns > > >> +=A0 EFI_UNSUPPORTED if the firmware image is not updatable.=A0 If= the=20 > firmware image > > >> +=A0 is updatable, the function should perform the following minim= al=20 > validations > > >> +=A0 before proceeding to do the firmware image update. > > >> +=A0=A0=A0 - Validate that the image is a supported image for this= = =20 > firmware device. > > >> +=A0=A0=A0=A0=A0 Return EFI_ABORTED if the image is not supported.= > Additional details > > >> +=A0=A0=A0=A0=A0 on why the image is not a supported image may be = returned=20 > in AbortReason. > > >> +=A0=A0=A0 - Validate the data from VendorCode if is not NULL.=A0 = Firmware=20 > image > > >> +=A0=A0=A0=A0=A0 validation must be performed before VendorCode da= ta validation. > > >> +=A0=A0=A0=A0=A0 VendorCode data is ignored or considered invalid = if image=20 > validation > > >> +=A0=A0=A0=A0=A0 fails.=A0 Return EFI_ABORTED if the VendorCode da= ta is invalid. > > >> + > > >> +=A0 VendorCode enables vendor to implement vendor-specific firmwa= re=20 > image update > > >> +=A0 policy.=A0 Null if the caller did not specify the policy or u= se=20 > the default > > >> +=A0 policy.=A0 As an example, vendor can implement a policy to al= low=20 > an option to > > >> +=A0 force a firmware image update when the abort reason is due to= = =20 > the new firmware > > >> +=A0 image version is older than the current firmware image versio= n=20 > or bad image > > >> +=A0 checksum.=A0 Sensitive operations such as those wiping the en= tire=20 > firmware image > > >> +=A0 and render the device to be non-functional should be encoded = in=20 > the image > > >> +=A0 itself rather than passed with the VendorCode.=A0 AbortReason= = =20 > enables vendor to > > >> +=A0 have the option to provide a more detailed description of the= = =20 > abort reason to > > >> +=A0 the caller. > > >> + > > >> +=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Point= s to the new firmware image. > > >> +=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0 Size, in byte= s, of the new=20 > firmware image. > > >> +=A0 @param[in]=A0 VendorCode=A0=A0=A0=A0=A0=A0=A0 This enables ve= ndor to implement=20 > vendor-specific > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image update policy. > NULL indicates > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 the caller did not specify the=20 > policy or use the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 default policy. > > >> +=A0 @param[in]=A0 Progress=A0=A0=A0=A0=A0=A0=A0=A0=A0 A function = used to report the=20 > progress of > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 updating the firmware device with=20 > the new > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 firmware image. > > >> +=A0 @param[in]=A0 CapsuleFwVersion=A0 The version of the new firm= ware=20 > image from the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 update capsule that provided the=20 > new firmware > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 image. > > >> +=A0 @param[out] AbortReason=A0=A0=A0=A0=A0=A0 A pointer to a poin= ter to a=20 > Null-terminated > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Unicode string providing more=20 > details on an > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 aborted operation. The buffer is=20 > allocated by > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 this function with > > >> + > EFI_BOOT_SERVICES.AllocatePool().=A0 It is the > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 caller's responsibility to free=20 > this buffer with > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 EFI_BOOT_SERVICES.FreePool(). > > >> +=A0 @param[out] LastAttemptStatus A pointer to a UINT32 that hold= s=20 > the last attempt > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status to report back to the ESRT=20 > table in case > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 of error. This value will only be=20 > checked when this > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function returns an error. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The return status code must fall=20 > in the range of > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 If the value falls outside this=20 > range, it will be converted > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to=20 > LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. > > >> + > > >> +=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The firm= ware device was=20 > successfully updated > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 with the new firmware image. > > >> +=A0 @retval EFI_ABORTED=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The oper= ation is aborted. > Additional details > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 are provided in AbortReason. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 The Image was NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 LastAttemptStatus was NULL. > > >> +=A0 @retval EFI_UNSUPPORTED=A0=A0=A0=A0=A0=A0=A0 The operation is= not supported. > > >> + > > >> +**/ > > >> +EFI_STATUS > > >> +EFIAPI > > >> +FmpDeviceSetImageWithStatus ( > > >> +=A0 IN=A0 CONST VOID=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *Image, > > >> +=A0 IN=A0 UINTN=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ImageSize, > > >> +=A0 IN=A0 CONST VOID =20 > *VendorCode,=A0=A0=A0=A0=A0=A0 OPTIONAL > > >> +=A0 IN=A0 EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS > Progress,=A0=A0=A0=A0=A0=A0=A0=A0=A0 OPTIONAL > > >> +=A0 IN=A0 UINT32 =20 > CapsuleFwVersion, > > >> +=A0 OUT CHAR16=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 **Ab= ortReason, > > >> +=A0 OUT UINT32 =20 > *LastAttemptStatus > > >> +=A0 ) > > >> +{ > > >> +=A0=A0=A0 EFI_STATUS Status=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D EFI_SUCCESS; > > >> +=A0=A0=A0 UINT32 Updateable=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0; > > >> + > > >> +=A0=A0=A0 Status =3D FmpDeviceCheckImageWithStatus (Image, ImageS= ize,=20 > &Updateable, LastAttemptStatus); > > >> +=A0=A0=A0 if (EFI_ERROR(Status)) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImageWithStatus=A0 = - Check Image=20 > failed with %r.\n", Status)); > > >> +=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImageWithStatus=A0 = - Check Image=20 > returned that the Image was not valid for update. > > >> Updatable value =3D 0x%X.\n", Updateable)); > > >> +=A0=A0=A0=A0=A0=A0=A0 Status =3D EFI_ABORTED; > > >> +=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 if (Progress =3D=3D NULL) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImageWithStatus=A0 = - Invalid=20 > progress callback\n")); > > >> +=A0=A0=A0=A0=A0=A0=A0 Status =3D EFI_INVALID_PARAMETER; > > >> +=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 Status =3D Progress(15); > > >> +=A0=A0=A0 if (EFI_ERROR(Status)) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImageWithStatus=A0 = - Progress=20 > Callback failed with Status %r.\n", Status)); > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0 UINTN=A0 p; > > >> + > > >> +=A0=A0=A0=A0=A0 for (p =3D 20; p < 100; p++) { > > >> +=A0=A0=A0=A0=A0=A0=A0 gBS->Stall (100000);=A0 //us=A0 =3D 0.1 sec= onds > > >> +=A0=A0=A0=A0=A0=A0=A0 Progress (p); > > >> +=A0=A0=A0=A0=A0 } > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 //TODO: add support for VendorCode, and AbortReason > > >> +cleanup: > > >> +=A0=A0=A0 if (EFI_ERROR (Status)) { > > >> +=A0=A0=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 return Status; > > >> +}// SetImageWithStatus() > > >> + > > >> + > > >>=A0=A0 /** > > >>=A0=A0 Updates the firmware image of the device. > > >> > > >> @@ -396,51 +523,98 @@ IN > UINT32=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 CapsuleFwVers= ion, > > >>=A0=A0 OUT CHAR16=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 **AbortReason > > >>=A0=A0 ) > > >>=A0=A0 { > > >> -=A0=A0=A0 EFI_STATUS Status=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D EFI_SUCCESS; > > >> -=A0=A0=A0 UINT32 Updateable=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0; > > >> - > > >> -=A0=A0=A0 Status =3D FmpDeviceCheckImage(Image, ImageSize, &Updat= eable); > > >> -=A0=A0=A0 if (EFI_ERROR(Status)) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImage - Check Image= failed with=20 > %r.\n", Status)); > > >> -=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 if (Updateable !=3D IMAGE_UPDATABLE_VALID) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImage - Check Image= returned that=20 > the Image was not valid for update.=A0 Updatable value > > =3D > > >> 0x%X.\n", Updateable)); > > >> -=A0=A0=A0=A0=A0=A0=A0 Status =3D EFI_ABORTED; > > >> -=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 if (Progress =3D=3D NULL) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImage - Invalid pro= gress=20 > callback\n")); > > >> -=A0=A0=A0=A0=A0=A0=A0 Status =3D EFI_INVALID_PARAMETER; > > >> -=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 Status =3D Progress(15); > > >> -=A0=A0=A0 if (EFI_ERROR(Status)) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "SetImage - Progress Ca= llback failed=20 > with Status %r.\n", Status)); > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0 UINTN=A0 p; > > >> - > > >> -=A0=A0=A0=A0=A0 for (p =3D 20; p < 100; p++) { > > >> -=A0=A0=A0=A0=A0=A0=A0 gBS->Stall (100000);=A0 //us=A0 =3D 0.1 sec= onds > > >> -=A0=A0=A0=A0=A0=A0=A0 Progress (p); > > >> -=A0=A0=A0=A0=A0 } > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 //TODO: add support for VendorCode, and AbortReason > > >> -cleanup: > > >> -=A0=A0=A0 return Status; > > >> +=A0 UINT32=A0 LastAttemptStatus; > > >> + > > >> +=A0 return=A0 FmpDeviceSetImageWithStatus ( > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Image, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageSize, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 VendorCode, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Progress, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 CapsuleFwVersion, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 AbortReason, > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &LastAttemptStatus > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ); > > >>=A0=A0 }// SetImage() > > >> > > >> > > >> +/** > > >> +=A0 Checks if a new firmware image is valid for the firmware=20 > device.=A0 This > > >> +=A0 function allows firmware update operation to validate the=20 > firmware image > > >> +=A0 before FmpDeviceSetImage() is called. > > >> + > > >> +=A0 @param[in]=A0 Image=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= Points to a new firmware image. > > >> +=A0 @param[in]=A0 ImageSize=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Size, i= n bytes, of a new=20 > firmware image. > > >> +=A0 @param[out] ImageUpdatable=A0=A0=A0=A0=A0 Indicates if a new = firmware=20 > image is valid for > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 a firmware update to the=20 > firmware device.=A0 The > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 following values from the=20 > Firmware Management > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Protocol are supported: > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_VALID > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID_TYPE > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 IMAGE_UPDATABLE_INVALID_OLD > > >> + > IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE > > >> +=A0 @param[out] LastAttemptStatus=A0=A0 A pointer to a UINT32 tha= t=20 > holds the last attempt > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status to report back to the=20 > ESRT table in case > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 of error. This value will only=20 > be checked when this > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 function returns an error. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The return status code must=20 > fall in the range of > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to > > >> + > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. > > >> + > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 If the value falls outside this=20 > range, it will be converted > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to=20 > LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. > > >> + > > >> +=A0 @retval EFI_SUCCESS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The imag= e was successfully=20 > checked.=A0 Additional > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 status information is returned in > > >> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageUpdatable. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 Image is NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 ImageUpdatable is NULL. > > >> +=A0 @retval EFI_INVALID_PARAMETER=A0 LastAttemptStatus is NULL. > > >> + > > >> +**/ > > >> +EFI_STATUS > > >> +EFIAPI > > >> +FmpDeviceCheckImageWithStatus ( > > >> +=A0 IN=A0 CONST VOID=A0 *Image, > > >> +=A0 IN=A0 UINTN=A0=A0=A0=A0=A0=A0 ImageSize, > > >> +=A0 OUT UINT32=A0=A0=A0=A0=A0 *ImageUpdatable, > > >> +=A0 OUT UINT32=A0=A0=A0=A0=A0 *LastAttemptStatus > > >> +=A0 ) > > >> +{ > > >> +=A0=A0=A0 EFI_STATUS status =3D EFI_SUCCESS; > > >> + > > >> +=A0=A0=A0 if (LastAttemptStatus =3D=3D NULL) { > > >> +=A0=A0=A0=A0=A0 DEBUG ((DEBUG_ERROR, "CheckImageWithStatus -=20 > LastAttemptStatus Pointer Parameter is NULL.\n")); > > >> +=A0=A0=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0=A0=A0 } > > >> +=A0=A0=A0 *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_SUCCESS; > > >> + > > >> +=A0=A0=A0 if (ImageUpdatable =3D=3D NULL) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus -= = =20 > ImageUpdatable Pointer Parameter is NULL.\n")); > > >> +=A0=A0=A0=A0=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0=A0=A0=A0=A0 status =3D EFI_INVALID_PARAMETER; > > >> +=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> +=A0=A0=A0 } > > >> + > > >> +=A0=A0=A0 // > > >> +=A0=A0=A0 //Set to valid and then if any tests fail it will updat= e this=20 > flag. > > >> +=A0=A0=A0 // > > >> +=A0=A0=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_VALID; > > >> + > > >> +=A0=A0=A0 if (Image =3D=3D NULL) > > >> +=A0=A0=A0 { > > >> +=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImageWithStatus -= Image Pointer=20 > Parameter is NULL.\n")); > > >> +=A0=A0=A0=A0=A0=A0=A0 *ImageUpdatable =3D IMAGE_UPDATABLE_INVALID= ; //not sure if=20 > this is needed > > >> +=A0=A0=A0=A0=A0=A0=A0 *LastAttemptStatus =3D=20 > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE; > > >> +=A0=A0=A0=A0=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> +=A0=A0=A0 } > > >> + > > >> +cleanup: > > >> +=A0=A0=A0 return status; > > >> +}// CheckImageWithStatus() > > >> + > > >> > > >>=A0=A0 /** > > >>=A0=A0 Checks if the firmware image is valid for the device. > > >> @@ -465,29 +639,9 @@ IN=A0 UINTN=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageSize, > > >>=A0=A0 OUT UINT32=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *ImageUpdateable > > >>=A0=A0 ) > > >>=A0=A0 { > > >> -=A0=A0=A0 EFI_STATUS status =3D EFI_SUCCESS; > > >> +=A0 UINT32=A0 LastAttemptStatus; > > >> > > >> -=A0=A0=A0 if (ImageUpdateable =3D=3D NULL) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImage - ImageUpda= teable Pointer=20 > Parameter is NULL.\n")); > > >> -=A0=A0=A0=A0=A0=A0=A0 status =3D EFI_INVALID_PARAMETER; > > >> -=A0=A0=A0=A0=A0=A0=A0 goto cleanup; > > >> -=A0=A0=A0 } > > >> - > > >> -=A0=A0=A0 // > > >> -=A0=A0=A0 //Set to valid and then if any tests fail it will updat= e this=20 > flag. > > >> -=A0=A0=A0 // > > >> -=A0=A0=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_VALID; > > >> - > > >> -=A0=A0=A0 if (Image =3D=3D NULL) > > >> -=A0=A0=A0 { > > >> -=A0=A0=A0=A0=A0=A0=A0 DEBUG((DEBUG_ERROR, "CheckImage - Image Poi= nter Parameter=20 > is NULL.\n")); > > >> -=A0=A0=A0=A0=A0=A0=A0 *ImageUpdateable =3D IMAGE_UPDATABLE_INVALI= D; //not sure if=20 > this is needed > > >> -=A0=A0=A0=A0=A0=A0=A0 return EFI_INVALID_PARAMETER; > > >> -=A0=A0=A0 } > > >> - > > >> -cleanup: > > >> -=A0=A0=A0 return status; > > >> +=A0 return FmpDeviceCheckImageWithStatus (Image, ImageSize,=20 > ImageUpdateable, &LastAttemptStatus); > > >>=A0=A0 }// CheckImage() > > >> > > >>=A0=A0 /** > > >> -- > > >> 2.28.0.windows.1 > > > >=20 >=20 >=20 >=20