From: rsun3 Date: Tue, 14 Dec 2010 02:33:15 +0000 (+0000) Subject: Update the PCI bus driver to correctly set the EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM... X-Git-Tag: edk2-stable201903~15316 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4ed4e19c084e03fcb8cfdcb159145136093d4180 Update the PCI bus driver to correctly set the EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM attribute of PCI IO. Per UEFI spec, this attribute is used to determine if the ROM image is from the ROM BAR or from a platform specific location. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11159 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h index 8517c60f72..e268014d34 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h @@ -223,6 +223,11 @@ struct _PCI_IO_DEVICE { // UINT32 Decodes; + // + // TRUE if the ROM image is from the PCI Option ROM BAR + // + BOOLEAN EmbeddedRom; + // // The OptionRom Size // diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index d0b17250e0..8ba5fc57ea 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -268,6 +268,7 @@ RegisterPciDevice ( &PlatformOpRomSize ); if (!EFI_ERROR (Status)) { + PciIoDevice->EmbeddedRom = FALSE; PciIoDevice->RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomImage = PlatformOpRomBuffer; @@ -293,6 +294,7 @@ RegisterPciDevice ( &PlatformOpRomSize ); if (!EFI_ERROR (Status)) { + PciIoDevice->EmbeddedRom = FALSE; PciIoDevice->RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomImage = PlatformOpRomBuffer; diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index f2108284d3..2a399c2ec2 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -940,6 +940,15 @@ PciSetDeviceAttribute ( EFI_PCI_IO_ATTRIBUTE_BUS_MASTER ); } else { + // + // When this attribute is clear, the RomImage and RomSize fields in the PCI IO were + // initialized based on the PCI option ROM found through the ROM BAR of the PCI controller. + // When this attribute is set, the PCI option ROM described by the RomImage and RomSize + // fields is not from the the ROM BAR of the PCI controller. + // + if (!PciIoDevice->EmbeddedRom) { + Attributes |= EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM; + } PciIoDevice->Attributes = Attributes; } } diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c index 5f8ffe2c05..eb02112d9a 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c @@ -500,6 +500,7 @@ LoadOpRomImage ( RomDecode (PciDevice, RomBarIndex, RomBar, FALSE); + PciDevice->EmbeddedRom = TRUE; PciDevice->PciIo.RomSize = RomImageSize; PciDevice->PciIo.RomImage = RomInMemory;