summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-28 10:10:10 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-28 10:10:10 +0000
commite0ee9d9314c7c2816b89908a1fac871c911f1cb0 (patch)
treea0cec322d6f0f306d0752c80327d0be180ec6b0e /MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
parente25fb2c06c6a2fd628b7c308d80fe0b6117ec771 (diff)
downloadedk2-platforms-e0ee9d9314c7c2816b89908a1fac871c911f1cb0.tar.xz
Clean ISA_IO/ISA_IO_16 and VGA_IO/VGA_IO_16 attribute usage in PCI bus driver/PCI host bridge drivers/LPC/VGA device drivers.
1. Fix the incorrect definition of EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 (does not conform to the UEFI spec) in PciIo.h. 2. Add missing definitions of ISA and VGA IO attributes in PCI Root Bridge IO protocol. 3. Improve the algorithm in the PCI bus driver to get PCI platform policy from PCI Platform Protocol and PCI Override Protocol. 4. Update the PCI bus driver to use the PCI platform policy to determine the supported attributes that are returned by the EFI_PCI_IO_PROTOCOL.Attributes() function. This is required by the PI spec. 5. Add a backward compatibility workaround for PCI VGA drivers in Option ROM, which typically sets VGA_IO without checking supported attributes. 6. Update the PCI host bridge driver in PcAtChipsetPkg to report VGA_IO_16 and ISA_IO_16 instead of VGA_IO/ISA_IO attributes. Modern chipsets don’t have hardware capability to control 10-bit or 16-bit decoding for ISA/VGA aliases. 7. Update LPC/VGA device drivers to check supported attributes of VGA_IO/VGA_IO_16 or ISA_IO/ISA_IO_16. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11204 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
index c39de9dd7e..5f6d3763e9 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
@@ -1530,6 +1530,38 @@ PciIoAttributes (
}
//
+ // Check VGA and VGA16, they can not be set at the same time
+ //
+ if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) != 0 &&
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16) != 0) ||
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) != 0 &&
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16) != 0) ||
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) != 0 &&
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16) != 0) ||
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) != 0 &&
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16) != 0) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // workaround for PCI drivers which always set ISA_IO or VGA_IO attribute without detecting support of
+ // ISA_IO/ISA_IO_16 or VGA_IO/VGA_IO_16 to maintain backward-compatibility.
+ //
+ if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) != 0) &&
+ ((PciIoDevice->Supports & (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) \
+ == EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {
+ Attributes &= ~(UINT64)EFI_PCI_IO_ATTRIBUTE_VGA_IO;
+ Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_IO_16;
+ }
+
+ if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) != 0) &&
+ ((PciIoDevice->Supports & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) \
+ == EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) {
+ Attributes &= ~(UINT64)EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;
+ Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16;
+ }
+
+ //
// If no attributes can be supported, then return.
// Otherwise, set the attributes that it can support.
//
@@ -1550,20 +1582,6 @@ PciIoAttributes (
BridgeControl = 0;
//
- // Check VGA and VGA16, they can not be set at the same time
- //
- if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) != 0 &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16) != 0) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) != 0 &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16) != 0) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) != 0 &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16) != 0) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) != 0 &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16) != 0) ) {
- return EFI_UNSUPPORTED;
- }
-
- //
// For PPB & P2C, set relevant attribute bits
//
if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {