]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/PlatDriOverLib.h
Code scrube for MdeModule Definitions.
[mirror_edk2.git] / MdeModulePkg / Include / Library / PlatDriOverLib.h
index e6a6faf101ccecf03c5d033c1439b6615bdd0fc3..43d48a4a44fe858128d02b747bec96452d3b038e 100644 (file)
@@ -1,34 +1,29 @@
-/** @file
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-    PlatDriOverLib.h
-
-Abstract:
-
-
-**/
-
-#ifndef _PLAT_DRI_OVER_LIB_H_
-#define _PLAT_DRI_OVER_LIB_H_
-
-#include <PiDxe.h>
-#include <Protocol/PlatformDriverOverride.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/DriverBinding.h>
-#include <Library/BaseLib.h>
-
-#include <VariableFormat.h>
-
+/** @file\r
+\r
+  This library provides basic platform driver override functions.\r
+\r
+Copyright (c) 2007 - 2008, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _PLAT_DRI_OVER_LIB_H_\r
+#define _PLAT_DRI_OVER_LIB_H_\r
+\r
+#include <PiDxe.h>\r
+#include <Protocol/PlatformDriverOverride.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Library/BaseLib.h>\r
+\r
+#include <VariableFormat.h>\r
+\r
 /**\r
   Install the Platform Driver Override Protocol, and ensure there is only one Platform Driver Override Protocol\r
   in the system.\r
@@ -38,111 +33,67 @@ Abstract:
 \r
   @retval EFI_ALREADY_STARTED      There has been a Platform Driver Override\r
                                    Protocol in the system, cannot install it again.\r
-  @retval Other                    Returned by InstallProtocolInterface\r
-\r
-**/
-EFI_STATUS
-EFIAPI
-InstallPlatformDriverOverrideProtocol (
-  EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *gPlatformDriverOverride
-  );
-
+  @retval EFI_SUCCESS              The protocol is installed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InstallPlatformDriverOverrideProtocol (\r
+  EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *gPlatformDriverOverride\r
+  );\r
+\r
 /**\r
-  Free all the mapping database memory resource and initialize the mapping list entry\r
+  Free all the mapping database memory resource and initialize the mapping list entry.\r
 \r
   @param  MappingDataBase          Mapping database list entry pointer\r
 \r
   @retval EFI_INVALID_PARAMETER    mapping database list entry is NULL\r
   @retval EFI_SUCCESS              Free success\r
 \r
-**/
-EFI_STATUS
-EFIAPI
-FreeMappingDatabase (
-  IN  OUT  LIST_ENTRY            *MappingDataBase
-  );
-
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FreeMappingDatabase (\r
+  IN  OUT  LIST_ENTRY            *MappingDataBase\r
+  );\r
+\r
 /**\r
   Read the environment variable(s) that contain the override mappings from Controller Device Path to\r
   a set of Driver Device Paths, and create the mapping database in memory with those variable info.\r
-  VariableLayout{\r
-  //\r
-  // NotEnd indicate whether the variable is the last one, and has no subsequent variable need to load.\r
-  // Each variable has MaximumVariableSize limitation, so  we maybe need multi variables to store\r
-  // large mapping infos.\r
-  // The variable(s) name rule is PlatDriOver, PlatDriOver1, PlatDriOver2, ....\r
-  //\r
-  UINT32                         NotEnd;\r
-  //\r
-  // The entry which contains the mapping that Controller Device Path to a set of Driver Device Paths\r
-  // There are often multi mapping entries in a variable.\r
-  //\r
-  UINT32                         SIGNATURE;            //EFI_SIGNATURE_32('p','d','o','i')\r
-  UINT32                         DriverNum;\r
-  EFI_DEVICE_PATH_PROTOCOL       ControllerDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  ......\r
-  UINT32                         SIGNATURE;\r
-  UINT32                         DriverNum;\r
-  EFI_DEVICE_PATH_PROTOCOL       ControllerDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  EFI_DEVICE_PATH_PROTOCOL       DriverDevicePath[];\r
-  ......\r
-  }\r
-  typedef struct _PLATFORM_OVERRIDE_ITEM{\r
-  UINTN                          Signature;                  //EFI_SIGNATURE_32('p','d','o','i')\r
-  LIST_ENTRY                     Link;\r
-  UINT32                         DriverInfoNum;\r
-  EFI_DEVICE_PATH_PROTOCOL       *ControllerDevicePath;\r
-  LIST_ENTRY                     DriverInfoList;         //DRIVER_IMAGE_INFO List\r
-  } PLATFORM_OVERRIDE_ITEM;\r
-  typedef struct _DRIVER_IMAGE_INFO{\r
-  UINTN                          Signature;                  //EFI_SIGNATURE_32('p','d','i','i')\r
-  LIST_ENTRY                     Link;\r
-  EFI_HANDLE                     ImageHandle;\r
-  EFI_DEVICE_PATH_PROTOCOL       *DriverImagePath;\r
-  BOOLEAN                        UnLoadable;\r
-  BOOLEAN                        UnStartable;\r
-  } DRIVER_IMAGE_INFO;\r
 \r
   @param  MappingDataBase          Mapping database list entry pointer\r
 \r
   @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
   @retval EFI_NOT_FOUND            Cannot find the 'PlatDriOver' NV variable\r
   @retval EFI_VOLUME_CORRUPTED     The found NV variable is corrupted\r
-  @retval EFI_SUCCESS              Create the mapping database in memory\r
-                                   successfully\r
-\r
-**/
-EFI_STATUS
-EFIAPI
-InitOverridesMapping (
-  OUT  LIST_ENTRY            *MappingDataBase
-  );
-
+  @retval EFI_SUCCESS              Create the mapping database in memory successfully\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitOverridesMapping (\r
+  OUT  LIST_ENTRY            *MappingDataBase\r
+  );\r
+\r
 /**\r
-  Save the memory mapping database into NV environment variable(s)\r
+  Save the memory mapping database into NV environment variable(s).\r
 \r
   @param  MappingDataBase          Mapping database list entry pointer\r
 \r
   @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
   @retval EFI_SUCCESS              Save memory mapping database successfully\r
 \r
-**/
-EFI_STATUS
-EFIAPI
-SaveOverridesMapping (
-  IN  LIST_ENTRY              *MappingDataBase
-  );
-
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SaveOverridesMapping (\r
+  IN  LIST_ENTRY              *MappingDataBase\r
+  );\r
+\r
 /**\r
   Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.\r
 \r
-  @param  This                     A pointer to the\r
-                                   EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.\r
+  @param  This                     A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.\r
   @param  ControllerHandle         The device handle of the controller to check if\r
                                    a driver override exists.\r
   @param  DriverImageHandle        On output, a pointer to the next driver handle.\r
@@ -163,50 +114,56 @@ SaveOverridesMapping (
   @retval EFI_SUCCESS              The driver override for ControllerHandle was\r
                                    returned in DriverImagePath.\r
 \r
-**/
-EFI_STATUS
-EFIAPI
-GetDriverFromMapping (
-  IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL              * This,
-  IN     EFI_HANDLE                                     ControllerHandle,
-  IN OUT EFI_HANDLE                                     * DriverImageHandle,
-  IN     LIST_ENTRY                                     * MappingDataBase,
-  IN     EFI_HANDLE                                     CallerImageHandle
-  );
-
-EFI_STATUS
-EFIAPI
-DeleteOverridesVariables (
-  VOID
-  );
-
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetDriverFromMapping (\r
+  IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL              * This,\r
+  IN     EFI_HANDLE                                     ControllerHandle,\r
+  IN OUT EFI_HANDLE                                     * DriverImageHandle,\r
+  IN     LIST_ENTRY                                     * MappingDataBase,\r
+  IN     EFI_HANDLE                                     CallerImageHandle\r
+  );\r
+\r
+/**\r
+  Deletes all environment variable(s) that contain the override mappings from Controller Device Path to\r
+  a set of Driver Device Paths.\r
+\r
+  @retval EFI_SUCCESS  Delete all variable(s) successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeleteOverridesVariables (\r
+  VOID\r
+  );\r
+\r
 /**\r
   Check mapping database whether already has the  mapping info which\r
   records the input Controller to input DriverImage.\r
-  If has, the controller's total override driver number and input DriverImage's order number is return.\r
 \r
-  @param  ControllerDevicePath     The controller device path need to add a\r
-                                   override driver image item\r
-  @param  DriverImageDevicePath    The driver image device path need to be insert\r
+  @param  ControllerDevicePath     The controller device path is to be check.\r
+  @param  DriverImageDevicePath    The driver image device path is to be check.\r
   @param  MappingDataBase          Mapping database list entry pointer\r
   @param  DriverInfoNum            the controller's total override driver number\r
-  @param  DriverImageNO            The inserted order number\r
-\r
-  @return EFI_INVALID_PARAMETER\r
-  @return EFI_NOT_FOUND\r
-  @return EFI_SUCCESS\r
-\r
-**/
-EFI_STATUS
-EFIAPI
-CheckMapping (
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,
-  IN     LIST_ENTRY                                     * MappingDataBase,
-  OUT    UINT32                                         *DriverInfoNum,
-  OUT    UINT32                                         *DriverImageNO
-  );
-
+  @param  DriverImageNO            The driver order number for the input DriverImage.\r
+                                   If the DriverImageDevicePath is NULL, DriverImageNO is not set.\r
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath or MappingDataBase is NULL.\r
+  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
+                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
+  @retval EFI_SUCCESS              The controller's total override driver number and \r
+                                   input DriverImage's order number is correctly return.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CheckMapping (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
+  IN     LIST_ENTRY                                     * MappingDataBase,\r
+  OUT    UINT32                                         *DriverInfoNum,\r
+  OUT    UINT32                                         *DriverImageNO\r
+  );\r
+\r
 /**\r
   Insert a driver image as a controller's override driver into the mapping database.\r
   The driver image's order number is indicated by DriverImageNO.\r
@@ -215,50 +172,58 @@ CheckMapping (
                                    override driver image item\r
   @param  DriverImageDevicePath    The driver image device path need to be insert\r
   @param  MappingDataBase          Mapping database list entry pointer\r
-  @param  DriverImageNO            The inserted order number\r
-\r
-  @return EFI_INVALID_PARAMETER\r
-  @return EFI_ALREADY_STARTED\r
-  @return EFI_SUCCESS\r
-\r
-**/
-EFI_STATUS
-EFIAPI
-InsertDriverImage (
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,
-  IN     LIST_ENTRY                                     *MappingDataBase,
-  IN     UINT32                                         DriverImageNO
-  );
-
+  @param  DriverImageNO            The inserted order number. If this number is taken, \r
+                                   the larger available number will be used.\r
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or DriverImageDevicePath is NULL\r
+                                   or MappingDataBase is NULL\r
+  @retval EFI_ALREADY_STARTED      The input Controller to input DriverImage has been \r
+                                   recorded into the mapping database.\r
+  @retval EFI_SUCCESS              The Controller and DriverImage are inserted into \r
+                                   the mapping database successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InsertDriverImage (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
+  IN     LIST_ENTRY                                     *MappingDataBase,\r
+  IN     UINT32                                         DriverImageNO\r
+  );\r
+\r
 /**\r
   Delete a controller's override driver from the mapping database.\r
 \r
-  @param  ControllerDevicePath     The controller device path need to add a\r
-                                   override driver image item\r
-  @param  DriverImageDevicePath    The driver image device path need to be insert\r
+  @param  ControllerDevicePath     The controller device path will be deleted \r
+                                   when all drivers images on it are removed.\r
+  @param  DriverImageDevicePath    The driver image device path will be delete.\r
+                                   If NULL, all driver image will be delete.\r
   @param  MappingDataBase          Mapping database list entry pointer\r
-  @param  DriverImageNO            The inserted order number\r
-\r
-  @return EFI_INVALID_PARAMETER\r
-  @return EFI_NOT_FOUND\r
-  @return EFI_SUCCESS\r
-\r
-**/
-EFI_STATUS
-EFIAPI
-DeleteDriverImage (
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,
-  IN     LIST_ENTRY                                     *MappingDataBase
-  );
-
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or MappingDataBase is NULL\r
+  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
+                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
+  @retval EFI_SUCCESS              Delete the specified driver successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeleteDriverImage (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
+  IN     LIST_ENTRY                                     *MappingDataBase\r
+  );\r
+\r
 /**\r
   Get the first Binding protocol which has the specific image handle\r
 \r
-  @param  Image          Image handle\r
+  @param  ImageHandle          The Image handle\r
+  @param  BindingHandle        The BindingHandle of the found Driver Binding protocol.\r
+                               If Binding protocol is not found, it is set to NULL. \r
 \r
-  @return Pointer into the Binding Protocol interface\r
+  @return                      Pointer into the Binding Protocol interface\r
+  @retval NULL                 The paramter is not valid or the binding protocol is not found.\r
 \r
 **/\r
 EFI_DRIVER_BINDING_PROTOCOL *\r
@@ -266,6 +231,6 @@ EFIAPI
 GetBindingProtocolFromImageHandle (\r
   IN  EFI_HANDLE   ImageHandle,\r
   OUT EFI_HANDLE   *BindingHandle\r
-  );
-
-#endif
+  );\r
+\r
+#endif\r