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:
Ruiyu Ni
2017-10-23 13:52:15 +08:00
parent 84ed8edff1
commit b5cbef4eff
5 changed files with 124 additions and 62 deletions

View File

@ -1,7 +1,7 @@
/** @file
Functions declaration for Bus Specific Driver Override protoocl.
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
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
@ -22,9 +22,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// PCI driver override driver image list
//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
EFI_HANDLE DriverImageHandle;
UINT32 Signature;
LIST_ENTRY Link;
EFI_HANDLE DriverImageHandle;
EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;
} PCI_DRIVER_OVERRIDE_LIST;
@ -46,7 +47,8 @@ InitializePciDriverOverrideInstance (
Add an overriding driver image.
@param PciIoDevice Instance of PciIo device.
@param DriverImageHandle new added driver image.
@param DriverImageHandle Image handle of newly added driver image.
@param DriverImagePath Device path of newly added driver image.
@retval EFI_SUCCESS Successfully added driver.
@retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
@ -55,8 +57,9 @@ InitializePciDriverOverrideInstance (
**/
EFI_STATUS
AddDriver (
IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_HANDLE DriverImageHandle
IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_HANDLE DriverImageHandle,
IN EFI_DEVICE_PATH_PROTOCOL *DriverImagePath
);