summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-14 21:29:45 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-14 21:29:45 +0000
commit2d9d2abf04f53a5a747bcd8cfe363bf0592319ae (patch)
treeab54733316bbfafa74f673eb6b6c5e7e28525075 /IntelFrameworkModulePkg
parentb98c2ab738c71c344c7f03ecf885fdd0a4545cdb (diff)
downloadedk2-platforms-2d9d2abf04f53a5a747bcd8cfe363bf0592319ae.tar.xz
Build a valid device path to an EFI driver loaded from a PCI Option ROM
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3852 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
index c76c3ebd17..99c34d5bf5 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
@@ -16,6 +16,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <IndustryStandard/Pci23.h>
+//
+// Module global for a template of the PCI option ROM Image Device Path Node
+//
+MEMMAP_DEVICE_PATH mPciOptionRomImageDevicePathNodeTemplate = {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
+ sizeof (MEMMAP_DEVICE_PATH)
+ },
+ EfiMemoryMappedIO,
+ 0,
+ 0
+};
+
EFI_STATUS
GetOpRomInfo (
IN PCI_IO_DEVICE *PciIoDevice
@@ -415,6 +429,7 @@ Returns:
EFI_DECOMPRESS_PROTOCOL *Decompress;
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
PCI_DATA_STRUCTURE *Pcir;
+ EFI_DEVICE_PATH_PROTOCOL *PciOptionRomImageDevicePath;
Indicator = 0;
@@ -505,17 +520,31 @@ Returns:
}
if (!SkipImage) {
+ //
+ // Build full device path to the PCI Option ROM Image being loaded
+ //
+ mPciOptionRomImageDevicePathNodeTemplate.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)RomBarOffset;
+ mPciOptionRomImageDevicePathNodeTemplate.EndingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(RomBarOffset + ImageSize - 1);
+ PciOptionRomImageDevicePath = AppendDevicePathNode (PciDevice->DevicePath, (const EFI_DEVICE_PATH_PROTOCOL *)&mPciOptionRomImageDevicePathNodeTemplate);
+ ASSERT (PciOptionRomImageDevicePath != NULL);
+
//
// load image and start image
//
Status = gBS->LoadImage (
FALSE,
gPciBusDriverBinding.DriverBindingHandle,
- PciDevice->Handle,
+ PciOptionRomImageDevicePath,
ImageBuffer,
ImageLength,
&ImageHandle
);
+
+ //
+ // Free the device path after it has been used by LoadImage
+ //
+ gBS->FreePool (PciOptionRomImageDevicePath);
+
if (!EFI_ERROR (Status)) {
Status = gBS->StartImage (ImageHandle, NULL, NULL);
if (!EFI_ERROR (Status)) {