MdeModulePkg/PciBus: Fix bug that doesn't produce BusOverride
It's a regression of below commit:
SHA-1: 8be37a5cee
* MdeModulePkg/SecurityStubDxe: Defer 3rd party image before EndOfDxe
When PciBus driver fails to load the Option ROM, it doesn't produce
BusOverride protocol. It was a correct behavior before the above
commit. But due to the above commit, BusOverride protocol never is
produced by PciBus driver.
The patch fixes this issue using the following solution:
1. PciBus records the image device path when LoadImage fails.
2. Override.GetDriver() tries to look for the image handle using
the stored image device path.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
@@ -753,13 +753,19 @@ ProcessOpRomImage (
|
||||
BufferSize,
|
||||
&ImageHandle
|
||||
);
|
||||
|
||||
FreePool (PciOptionRomImageDevicePath);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Record the Option ROM Image device path when LoadImage fails.
|
||||
// PciOverride.GetDriver() will try to look for the Image Handle using the device path later.
|
||||
//
|
||||
AddDriver (PciDevice, NULL, PciOptionRomImageDevicePath);
|
||||
} else {
|
||||
Status = gBS->StartImage (ImageHandle, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
AddDriver (PciDevice, ImageHandle);
|
||||
//
|
||||
// Record the Option ROM Image Handle
|
||||
//
|
||||
AddDriver (PciDevice, ImageHandle, NULL);
|
||||
PciRomAddImageMapping (
|
||||
ImageHandle,
|
||||
PciDevice->PciRootBridgeIo->SegmentNumber,
|
||||
@@ -772,6 +778,7 @@ ProcessOpRomImage (
|
||||
RetStatus = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
FreePool (PciOptionRomImageDevicePath);
|
||||
|
||||
NextImage:
|
||||
RomBarOffset += ImageSize;
|
||||
|
Reference in New Issue
Block a user