From 23d64dda6b61f86cdeac40b465144845f60406f4 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Tue, 8 Apr 2008 09:34:21 +0000 Subject: 1.Port Platform driver override protocol utility application in MdeModulePkg.dsc. 2.Update PlatDriOverLib library to use EFI Loaded Image Device Path Protocol to avoid "reconnect -r" issue for Platform driver override utility application. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5006 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DxePlatDriOverLib/DxePlatDriOverLib.inf | 2 +- .../Library/DxePlatDriOverLib/PlatDriOverLib.c | 35 +++++++--------------- 2 files changed, 12 insertions(+), 25 deletions(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf b/MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf index 1ba2d78..cb0eb29 100644 --- a/MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf +++ b/MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf @@ -62,4 +62,4 @@ gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED - + gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED diff --git a/MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOverLib.c b/MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOverLib.c index 0ba63fc..497446b 100644 --- a/MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOverLib.c +++ b/MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOverLib.c @@ -666,7 +666,6 @@ GetDriverFromMapping ( EFI_HANDLE *ImageHandleBuffer; UINTN ImageHandleCount; UINTN Index; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; EFI_HANDLE DriverBindingHandle; BOOLEAN FoundLastReturned; @@ -677,8 +676,7 @@ GetDriverFromMapping ( EFI_DEVICE_PATH_PROTOCOL *TempDriverImagePath; EFI_HANDLE ImageHandle; EFI_HANDLE Handle; - EFI_DEVICE_PATH_PROTOCOL *LoadedImageHandleDevicePath; - EFI_DEVICE_PATH_PROTOCOL *TatalFilePath; + EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride; UINTN DevicePathSize; @@ -786,39 +784,28 @@ GetDriverFromMapping ( } for(Index = 0; Index < ImageHandleCount; Index ++) { - Status = gBS->HandleProtocol ( - ImageHandleBuffer[Index], - &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImage - ); - if (EFI_ERROR (Status)) { - continue; - } - // - // Get the driver image total file path + // Get the EFI Loaded Image Device Path Protocol // - LoadedImageHandleDevicePath = NULL; + LoadedImageDevicePath = NULL; Status = gBS->HandleProtocol ( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID **) &LoadedImageHandleDevicePath + ImageHandleBuffer[Index], + &gEfiLoadedImageDevicePathProtocolGuid, + (VOID **) &LoadedImageDevicePath ); if (EFI_ERROR (Status)) { // - // Maybe Not all LoadedImage->DeviceHandle has valid value. Skip the invalid image. + // Maybe Not all EFI Loaded Image Device Path Protocol existed. // continue; } - TatalFilePath = AppendDevicePath (LoadedImageHandleDevicePath, LoadedImage->FilePath); - DevicePathSize = GetDevicePathSize (DriverImageInfo->DriverImagePath); - if (DevicePathSize == GetDevicePathSize (TatalFilePath)) { + if (DevicePathSize == GetDevicePathSize (LoadedImageDevicePath)) { if (CompareMem ( DriverImageInfo->DriverImagePath, - TatalFilePath, - GetDevicePathSize (TatalFilePath) + LoadedImageDevicePath, + GetDevicePathSize (LoadedImageDevicePath) ) == 0 ) { ImageFound = TRUE; @@ -1881,7 +1868,7 @@ ConnectDevicePath ( // change, so next time will do the dispatch, then dispatch's status // will take effect // 2. If the connect success, the RemainingDevicepath and handle will - // change, then avoid the dispatch, we have chance to continue the + // change, then avoid the dispatch, we have chance to continue the // next connection // gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); -- cgit v1.1