diff options
author | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-14 21:29:45 +0000 |
---|---|---|
committer | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-14 21:29:45 +0000 |
commit | 2d9d2abf04f53a5a747bcd8cfe363bf0592319ae (patch) | |
tree | ab54733316bbfafa74f673eb6b6c5e7e28525075 /IntelFrameworkModulePkg | |
parent | b98c2ab738c71c344c7f03ecf885fdd0a4545cdb (diff) | |
download | edk2-2d9d2abf04f53a5a747bcd8cfe363bf0592319ae.zip edk2-2d9d2abf04f53a5a747bcd8cfe363bf0592319ae.tar.gz edk2-2d9d2abf04f53a5a747bcd8cfe363bf0592319ae.tar.bz2 |
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.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c index c76c3eb..99c34d5 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)) {
|