1.Port Platform driver override protocol utility application in MdeModulePkg.dsc.
[people/mcb30/edk2.git] / edk2 / MdeModulePkg / Library / DxePlatDriOverLib / PlatDriOverLib.c
index 0ba63fc..497446b 100644 (file)
@@ -666,7 +666,6 @@ GetDriverFromMapping (
   EFI_HANDLE                  *ImageHandleBuffer;\r
   UINTN                       ImageHandleCount;\r
   UINTN                       Index;\r
   EFI_HANDLE                  *ImageHandleBuffer;\r
   UINTN                       ImageHandleCount;\r
   UINTN                       Index;\r
-  EFI_LOADED_IMAGE_PROTOCOL   *LoadedImage;\r
   EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
   EFI_HANDLE                  DriverBindingHandle;\r
   BOOLEAN                     FoundLastReturned;\r
   EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
   EFI_HANDLE                  DriverBindingHandle;\r
   BOOLEAN                     FoundLastReturned;\r
@@ -677,8 +676,7 @@ GetDriverFromMapping (
   EFI_DEVICE_PATH_PROTOCOL    *TempDriverImagePath;\r
   EFI_HANDLE                  ImageHandle;\r
   EFI_HANDLE                  Handle;\r
   EFI_DEVICE_PATH_PROTOCOL    *TempDriverImagePath;\r
   EFI_HANDLE                  ImageHandle;\r
   EFI_HANDLE                  Handle;\r
-  EFI_DEVICE_PATH_PROTOCOL    *LoadedImageHandleDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL    *TatalFilePath;\r
+  EFI_DEVICE_PATH_PROTOCOL    *LoadedImageDevicePath;\r
   EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  *BusSpecificDriverOverride;\r
   UINTN                       DevicePathSize;\r
 \r
   EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  *BusSpecificDriverOverride;\r
   UINTN                       DevicePathSize;\r
 \r
@@ -786,39 +784,28 @@ GetDriverFromMapping (
         }\r
 \r
         for(Index = 0; Index < ImageHandleCount; Index ++) {\r
         }\r
 \r
         for(Index = 0; Index < ImageHandleCount; Index ++) {\r
-          Status = gBS->HandleProtocol (\r
-                          ImageHandleBuffer[Index],\r
-                          &gEfiLoadedImageProtocolGuid,\r
-                          (VOID **) &LoadedImage\r
-                          );\r
-          if (EFI_ERROR (Status)) {\r
-            continue;\r
-          }\r
-\r
           //\r
           //\r
-          // Get the driver image total file path\r
+          // Get the EFI Loaded Image Device Path Protocol\r
           //\r
           //\r
-          LoadedImageHandleDevicePath = NULL;\r
+          LoadedImageDevicePath = NULL;\r
           Status = gBS->HandleProtocol (\r
           Status = gBS->HandleProtocol (\r
-                              LoadedImage->DeviceHandle,\r
-                              &gEfiDevicePathProtocolGuid,\r
-                              (VOID **) &LoadedImageHandleDevicePath\r
+                              ImageHandleBuffer[Index],\r
+                              &gEfiLoadedImageDevicePathProtocolGuid,\r
+                              (VOID **) &LoadedImageDevicePath\r
                               );\r
           if (EFI_ERROR (Status)) {\r
             //\r
                               );\r
           if (EFI_ERROR (Status)) {\r
             //\r
-            // Maybe Not all  LoadedImage->DeviceHandle has valid value.  Skip the invalid image.\r
+            // Maybe Not all EFI Loaded Image Device Path Protocol existed.\r
             //\r
             continue;\r
           }\r
 \r
             //\r
             continue;\r
           }\r
 \r
-          TatalFilePath = AppendDevicePath (LoadedImageHandleDevicePath, LoadedImage->FilePath);\r
-\r
           DevicePathSize = GetDevicePathSize (DriverImageInfo->DriverImagePath);\r
           DevicePathSize = GetDevicePathSize (DriverImageInfo->DriverImagePath);\r
-          if (DevicePathSize == GetDevicePathSize (TatalFilePath)) {\r
+          if (DevicePathSize == GetDevicePathSize (LoadedImageDevicePath)) {\r
             if (CompareMem (\r
                   DriverImageInfo->DriverImagePath,\r
             if (CompareMem (\r
                   DriverImageInfo->DriverImagePath,\r
-                  TatalFilePath,\r
-                  GetDevicePathSize (TatalFilePath)\r
+                  LoadedImageDevicePath,\r
+                  GetDevicePathSize (LoadedImageDevicePath)\r
                   ) == 0\r
                 ) {\r
               ImageFound = TRUE;\r
                   ) == 0\r
                 ) {\r
               ImageFound = TRUE;\r
@@ -1881,7 +1868,7 @@ ConnectDevicePath (
           //    change, so next time will do the dispatch, then dispatch's status\r
           //    will take effect\r
           // 2. If the connect success, the RemainingDevicepath and handle will\r
           //    change, so next time will do the dispatch, then dispatch's status\r
           //    will take effect\r
           // 2. If the connect success, the RemainingDevicepath and handle will\r
-         //    change, then avoid the dispatch, we have chance to continue the\r
+          //    change, then avoid the dispatch, we have chance to continue the\r
           //    next connection\r
           //\r
           gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);\r
           //    next connection\r
           //\r
           gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);\r