]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c
Code scrub for PCI Bus module and PciIncompatibleDeviceSupportLib module.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciDriverOverride.c
index d8faf8f7e45083d86213ac146a702b66fb884260..119866b3c167c0743e3a112a2e6a1e7575f63877 100644 (file)
@@ -1,41 +1,49 @@
 /** @file\r
+  Functions implementation for Bus Specific Driver Override protoocl.\r
 \r
-Copyright (c) 2006, 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
+Copyright (c) 2006 - 2009, 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
-**/\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
 #include "PciBus.h"\r
 \r
 /**\r
   Initializes a PCI Driver Override Instance.\r
 \r
-  @param  PciIoDevice   Device instance.\r
+  @param  PciIoDevice   PCI Device instance.\r
 \r
 **/\r
 VOID\r
 InitializePciDriverOverrideInstance (\r
-  PCI_IO_DEVICE  *PciIoDevice\r
+  IN OUT PCI_IO_DEVICE          *PciIoDevice\r
   )\r
 {\r
   PciIoDevice->PciDriverOverride.GetDriver = GetDriver;\r
 }\r
 \r
+\r
 /**\r
-  Get a overriding driver image.\r
-  @param  This                Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL.\r
-  @param  DriverImageHandle   Override driver image.\r
-  \r
-  @retval EFI_SUCCESS                 Success to get driver image handle.\r
-  @retval EFI_NOT_FOUND               can not find override driver image.\r
-  @retval EFI_INVALID_PARAMETER       Invalid parameter.\r
+  Uses a bus specific algorithm to retrieve a driver image handle for a controller.\r
+\r
+  @param  This                  A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.\r
+  @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned\r
+                                by GetDriver(). On output, a pointer to the next driver\r
+                                image handle. Passing in a NULL, will return the first driver\r
+                                image handle.\r
+\r
+  @retval EFI_SUCCESS           A bus specific override driver is returned in DriverImageHandle.\r
+  @retval EFI_NOT_FOUND         The end of the list of override drivers was reached.\r
+                                A bus specific override driver is not returned in DriverImageHandle.\r
+  @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a\r
+                                previous call to GetDriver().\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -84,13 +92,15 @@ GetDriver (
 }\r
 \r
 /**\r
-  Add an overriding driver image\r
-  \r
+  Add an overriding driver image.\r
+\r
   @param PciIoDevice        Instance of PciIo device.\r
   @param DriverImageHandle  new added driver image.\r
-  \r
-  @retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance.\r
-  @retval EFI_SUCCESS       Success add driver.\r
+\r
+  @retval EFI_SUCCESS          Successfully added driver.\r
+  @retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.\r
+  @retval other                Some error occurred when locating gEfiLoadedImageProtocolGuid.\r
+\r
 **/\r
 EFI_STATUS\r
 AddDriver (\r
@@ -124,16 +134,9 @@ AddDriver (
   ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;\r
 \r
   //\r
-  // Get information about the image \r
+  // Get information about the image\r
   //\r
-  Status = PeCoffLoaderGetImageInfo (&ImageContext);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  if (ImageContext.Machine != EFI_IMAGE_MACHINE_EBC) {\r
-    return EFI_SUCCESS;\r
-  }\r
+  PeCoffLoaderGetImageInfo (&ImageContext);\r
 \r
   return EFI_SUCCESS;\r
 }\r