From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: zailiang.sun@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Sun, 11 Aug 2019 19:33:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Aug 2019 19:33:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,375,1559545200"; d="scan'208";a="259647791" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 11 Aug 2019 19:33:28 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 11 Aug 2019 19:33:28 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.62]) with mapi id 14.03.0439.000; Mon, 12 Aug 2019 10:33:26 +0800 From: "Sun, Zailiang" To: "devel@edk2.groups.io" , "Jin, Eric" CC: "Qian, Yi" , "Kinney, Michael D" , "Gao, Liming" Subject: Re: [edk2-devel] [edk2-platforms][PATCH] Vlv2TbltDevicePkg/FmpDeviceLib: Implement new APIs Thread-Topic: [edk2-devel] [edk2-platforms][PATCH] Vlv2TbltDevicePkg/FmpDeviceLib: Implement new APIs Thread-Index: AQHVUK+a5HL+y404L0SDw6FWA2Rrbqb2yxCQ Date: Mon, 12 Aug 2019 02:33:25 +0000 Message-ID: <7CB7EF03E15B5D48981329A508747A9850CAA826@SHSMSX104.ccr.corp.intel.com> References: <20190812014454.44628-1-eric.jin@intel.com> In-Reply-To: <20190812014454.44628-1-eric.jin@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zailiang.sun@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zailiang Sun > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Eric Jin > Sent: Monday, August 12, 2019 9:45 AM > To: devel@edk2.groups.io > Cc: Sun, Zailiang ; Qian, Yi = ; > Kinney, Michael D ; Gao, Liming > > Subject: [edk2-devel] [edk2-platforms][PATCH] > Vlv2TbltDevicePkg/FmpDeviceLib: Implement new APIs >=20 > Implement new APIs defined in FmpDeviceLib > * RegisterFmpUninstaller() > * FmpDeviceSetContext() > * FmpDeviceGetHardwareInstance() >=20 > Cc: Zailiang Sun > Cc: Yi Qian > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: Eric Jin > --- > .../Library/FmpDeviceLib/FmpDeviceLib.c | 95 ++++++++++++++++++ > .../Library/FmpDeviceLibSample/FmpDeviceLib.c | 99 > ++++++++++++++++++- > 2 files changed, 192 insertions(+), 2 deletions(-) >=20 > diff --git > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/ > FmpDeviceLib.c > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib > /FmpDeviceLib.c > index 57185d8d09..d8c9036012 100644 > --- > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/ > FmpDeviceLib.c > +++ > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDevice > +++ Lib/FmpDeviceLib.c > @@ -66,6 +66,73 @@ RegisterFmpInstaller ( > return EFI_UNSUPPORTED; > } >=20 > +/** > + Provide a function to uninstall the Firmware Management Protocol > +instance from a > + device handle when the device is managed by a driver that follows the > +UEFI > + Driver Model. If the device is not managed by a driver that follows > +the UEFI > + Driver Model, then EFI_UNSUPPORTED is returned. > + > + @param[in] FmpUninstaller Function that installs the Firmware > Management > + Protocol. > + > + @retval EFI_SUCCESS The device is managed by a driver that follo= ws the > + UEFI Driver Model. FmpUinstaller must be ca= lled on > + each Driver Binding Stop(). > + @retval EFI_UNSUPPORTED The device is not managed by a driver that > follows > + the UEFI Driver Model. > + @retval other The Firmware Management Protocol for this fi= rmware > + device is not installed. The firmware devic= e is > + still locked using FmpDeviceLock(). > + > +**/ > +EFI_STATUS > +EFIAPI > +RegisterFmpUninstaller ( > + IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller > + ) > +{ > + // > + // This is a system firmware update that does not use Driver Binding > +Protocol > + // > + return EFI_UNSUPPORTED; > +} > + > +/** > + Set the device context for the FmpDeviceLib services when the device > +is > + managed by a driver that follows the UEFI Driver Model. If the > +device is not > + managed by a driver that follows the UEFI Driver Model, then > +EFI_UNSUPPORTED > + is returned. Once a device context is set, the FmpDeviceLib services > + operate on the currently set device context. > + > + @param[in] Handle Device handle for the FmpDeviceLib services. > + If Handle is NULL, then Context is freed. > + @param[in, out] Context Device context for the FmpDeviceLib services= . > + If Context is NULL, then a new context is al= located > + for Handle and the current device context is= set and > + returned in Context. If Context is not NULL= , then > + the current device context is set. > + > + @retval EFI_SUCCESS The device is managed by a driver that follo= ws the > + UEFI Driver Model. > + @retval EFI_UNSUPPORTED The device is not managed by a driver that > follows > + the UEFI Driver Model. > + @retval other The Firmware Management Protocol for this fi= rmware > + device is not installed. The firmware devic= e is > + still locked using FmpDeviceLock(). > + > +**/ > +EFI_STATUS > +EFIAPI > +FmpDeviceSetContext ( > + IN EFI_HANDLE Handle, > + IN OUT VOID **Context > + ) > +{ > + // > + // This is a system firmware update that does not use Driver Binding > +Protocol > + // > + return EFI_UNSUPPORTED; > +} >=20 > /** > Returns the size, in bytes, of the firmware image currently stored in= the > @@ -289,6 +356,34 @@ FmpDeviceGetVersion ( > return EFI_SUCCESS; > } >=20 > +/** > + Returns the value used to fill in the HardwareInstance field of the > + EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the > +GetImageInfo() > + service of the Firmware Management Protocol. If EFI_SUCCESS is > +returned, then > + the firmware device supports a method to report the HardwareInstance > value. > + If the value can not be reported for the firmware device, then > +EFI_UNSUPPORTED > + must be returned. EFI_DEVICE_ERROR is returned if an error occurs > +attempting > + to retrieve the HardwareInstance value for the firmware device. > + > + @param[out] HardwareInstance The hardware instance value for the > firmware > + device. > + > + @retval EFI_SUCCESS The hardware instance for the current firmw= are > + devide is returned in HardwareInstance. > + @retval EFI_UNSUPPORTED The firmware device does not support a > method to > + report the hardware instance value. > + @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve th= e > hardware > + instance value. > + > +**/ > +EFI_STATUS > +EFIAPI > +FmpDeviceGetHardwareInstance ( > + OUT UINT64 *HardwareInstance > + ) > +{ > + return EFI_UNSUPPORTED; > +} >=20 > /** > Retrieves a copy of the current firmware image of the device. > diff --git > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib > Sample/FmpDeviceLib.c > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib > Sample/FmpDeviceLib.c > index 80ce83a14b..db0f238ea5 100644 > --- > a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib > Sample/FmpDeviceLib.c > +++ > b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDevice > +++ LibSample/FmpDeviceLib.c > @@ -1,8 +1,8 @@ > /** >=20 > -Copyright (c) 2016, Microsoft Corporation > +Copyright (c) 2016, Microsoft Corporation. All rights reserved.
> +Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -All rights reserved. > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -43,6 +43,73 @@ IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func > return EFI_UNSUPPORTED; > } >=20 > +/** > + Provide a function to uninstall the Firmware Management Protocol > +instance from a > + device handle when the device is managed by a driver that follows the > +UEFI > + Driver Model. If the device is not managed by a driver that follows > +the UEFI > + Driver Model, then EFI_UNSUPPORTED is returned. > + > + @param[in] FmpUninstaller Function that installs the Firmware > Management > + Protocol. > + > + @retval EFI_SUCCESS The device is managed by a driver that follo= ws the > + UEFI Driver Model. FmpUinstaller must be ca= lled on > + each Driver Binding Stop(). > + @retval EFI_UNSUPPORTED The device is not managed by a driver that > follows > + the UEFI Driver Model. > + @retval other The Firmware Management Protocol for this fi= rmware > + device is not installed. The firmware devic= e is > + still locked using FmpDeviceLock(). > + > +**/ > +EFI_STATUS > +EFIAPI > +RegisterFmpUninstaller ( > + IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller > + ) > +{ > + // > + // This is a system firmware update that does not use Driver Binding > +Protocol > + // > + return EFI_UNSUPPORTED; > +} > + > +/** > + Set the device context for the FmpDeviceLib services when the device > +is > + managed by a driver that follows the UEFI Driver Model. If the > +device is not > + managed by a driver that follows the UEFI Driver Model, then > +EFI_UNSUPPORTED > + is returned. Once a device context is set, the FmpDeviceLib services > + operate on the currently set device context. > + > + @param[in] Handle Device handle for the FmpDeviceLib services. > + If Handle is NULL, then Context is freed. > + @param[in, out] Context Device context for the FmpDeviceLib services= . > + If Context is NULL, then a new context is al= located > + for Handle and the current device context is= set and > + returned in Context. If Context is not NULL= , then > + the current device context is set. > + > + @retval EFI_SUCCESS The device is managed by a driver that follo= ws the > + UEFI Driver Model. > + @retval EFI_UNSUPPORTED The device is not managed by a driver that > follows > + the UEFI Driver Model. > + @retval other The Firmware Management Protocol for this fi= rmware > + device is not installed. The firmware devic= e is > + still locked using FmpDeviceLock(). > + > +**/ > +EFI_STATUS > +EFIAPI > +FmpDeviceSetContext ( > + IN EFI_HANDLE Handle, > + OUT VOID **Context > + ) > +{ > + // > + // This is a system firmware update that does not use Driver Binding > +Protocol > + // > + return EFI_UNSUPPORTED; > +} >=20 > /** > Used to get the size of the image in bytes. > @@ -201,6 +268,34 @@ IN OUT UINT32* Version > return EFI_UNSUPPORTED; > } >=20 > +/** > + Returns the value used to fill in the HardwareInstance field of the > + EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the > +GetImageInfo() > + service of the Firmware Management Protocol. If EFI_SUCCESS is > +returned, then > + the firmware device supports a method to report the HardwareInstance > value. > + If the value can not be reported for the firmware device, then > +EFI_UNSUPPORTED > + must be returned. EFI_DEVICE_ERROR is returned if an error occurs > +attempting > + to retrieve the HardwareInstance value for the firmware device. > + > + @param[out] HardwareInstance The hardware instance value for the > firmware > + device. > + > + @retval EFI_SUCCESS The hardware instance for the current firmw= are > + devide is returned in HardwareInstance. > + @retval EFI_UNSUPPORTED The firmware device does not support a > method to > + report the hardware instance value. > + @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve th= e > hardware > + instance value. > + > +**/ > +EFI_STATUS > +EFIAPI > +FmpDeviceGetHardwareInstance ( > + OUT UINT64 *HardwareInstance > + ) > +{ > + return EFI_UNSUPPORTED; > +} >=20 > /** > Retrieves a copy of the current firmware image of the device. > -- > 2.20.1.windows.1 >=20 >=20 >=20