]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg: Add APIs to FmpDeviceLib
authorEric Jin <eric.jin@intel.com>
Sun, 11 Aug 2019 02:55:13 +0000 (10:55 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 14 Aug 2019 04:29:28 +0000 (12:29 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525
Add new APIs to FmpDevideLib to support multiple controllers
* RegisterFmpUninstaller()
* FmpDeviceSetContext()
* FmpDeviceGetHardwareInstance()

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
FmpDevicePkg/Include/Library/FmpDeviceLib.h

index c435b2303072863b9053e474872e03054f4426b5..1e498c13ce0b9edf128bad49f3f72d5716467ac8 100644 (file)
@@ -3,7 +3,7 @@
   image stored in a firmware device.\r
 \r
   Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
-  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -34,6 +34,26 @@ EFI_STATUS
   IN  EFI_HANDLE      Handle\r
   );\r
 \r
+/**\r
+  Callback function that uninstalls a Firmware Management Protocol instance from\r
+  a handle.\r
+\r
+  @param[in]  Handle  The device handle to uninstall a Firmware Management\r
+                      Protocol instance.\r
+\r
+  @retval  EFI_SUCCESS            A Firmware Management Protocol instance was\r
+                                  uninstalled from Handle.\r
+  @retval  EFI_INVALID_PARAMETER  Handle is invalid\r
+  @retval  other                  A Firmware Management Protocol instance could\r
+                                  not be uninstalled from Handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER)(\r
+  IN  EFI_HANDLE      Handle\r
+  );\r
+\r
 /**\r
   Provide a function to install the Firmware Management Protocol instance onto a\r
   device handle when the device is managed by a driver that follows the UEFI\r
@@ -59,6 +79,62 @@ RegisterFmpInstaller (
   IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER  FmpInstaller\r
   );\r
 \r
+/**\r
+  Provide a function to uninstall the Firmware Management Protocol instance from a\r
+  device handle when the device is managed by a driver that follows the UEFI\r
+  Driver Model.  If the device is not managed by a driver that follows the UEFI\r
+  Driver Model, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param[in] FmpUninstaller  Function that installs the Firmware Management\r
+                             Protocol.\r
+\r
+  @retval EFI_SUCCESS      The device is managed by a driver that follows the\r
+                           UEFI Driver Model.  FmpUinstaller must be called on\r
+                           each Driver Binding Stop().\r
+  @retval EFI_UNSUPPORTED  The device is not managed by a driver that follows\r
+                           the UEFI Driver Model.\r
+  @retval other            The Firmware Management Protocol for this firmware\r
+                           device is not installed.  The firmware device is\r
+                           still locked using FmpDeviceLock().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterFmpUninstaller (\r
+  IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER  FmpUninstaller\r
+  );\r
+\r
+/**\r
+  Set the device context for the FmpDeviceLib services when the device is\r
+  managed by a driver that follows the UEFI Driver Model.  If the device is not\r
+  managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPORTED\r
+  is returned.  Once a device context is set, the FmpDeviceLib services\r
+  operate on the currently set device context.\r
+\r
+  @param[in]      Handle   Device handle for the FmpDeviceLib services.\r
+                           If Handle is NULL, then Context is freed.\r
+  @param[in, out] Context  Device context for the FmpDeviceLib services.\r
+                           If Context is NULL, then a new context is allocated\r
+                           for Handle and the current device context is set and\r
+                           returned in Context.  If Context is not NULL, then\r
+                           the current device context is set.\r
+\r
+  @retval EFI_SUCCESS      The device is managed by a driver that follows the\r
+                           UEFI Driver Model.\r
+  @retval EFI_UNSUPPORTED  The device is not managed by a driver that follows\r
+                           the UEFI Driver Model.\r
+  @retval other            The Firmware Management Protocol for this firmware\r
+                           device is not installed.  The firmware device is\r
+                           still locked using FmpDeviceLock().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceSetContext (\r
+  IN EFI_HANDLE  Handle,\r
+  IN OUT VOID    **Context\r
+  );\r
+\r
 /**\r
   Returns the size, in bytes, of the firmware image currently stored in the\r
   firmware device.  This function is used to by the GetImage() and\r
@@ -232,6 +308,32 @@ FmpDeviceGetVersion (
   OUT UINT32  *Version\r
   );\r
 \r
+/**\r
+  Returns the value used to fill in the HardwareInstance field of the\r
+  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
+  service of the Firmware Management Protocol.  If EFI_SUCCESS is returned, then\r
+  the firmware device supports a method to report the HardwareInstance value.\r
+  If the value can not be reported for the firmware device, then EFI_UNSUPPORTED\r
+  must be returned.  EFI_DEVICE_ERROR is returned if an error occurs attempting\r
+  to retrieve the HardwareInstance value for the firmware device.\r
+\r
+  @param[out] HardwareInstance  The hardware instance value for the firmware\r
+                                device.\r
+\r
+  @retval EFI_SUCCESS       The hardware instance for the current firmware\r
+                            devide is returned in HardwareInstance.\r
+  @retval EFI_UNSUPPORTED   The firmware device does not support a method to\r
+                            report the hardware instance value.\r
+  @retval EFI_DEVICE_ERROR  An error occurred attempting to retrieve the hardware\r
+                            instance value.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetHardwareInstance (\r
+  OUT UINT64  *HardwareInstance\r
+  );\r
+\r
 /**\r
   Returns a copy of the firmware image currently stored in the firmware device.\r
 \r