diff options
author | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-28 10:10:10 +0000 |
---|---|---|
committer | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-28 10:10:10 +0000 |
commit | e0ee9d9314c7c2816b89908a1fac871c911f1cb0 (patch) | |
tree | a0cec322d6f0f306d0752c80327d0be180ec6b0e /PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c | |
parent | e25fb2c06c6a2fd628b7c308d80fe0b6117ec771 (diff) | |
download | edk2-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 'PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c')
-rw-r--r-- | PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c | 118 |
1 files changed, 9 insertions, 109 deletions
diff --git a/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c b/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c index 27a54461cd..6403a0723c 100644 --- a/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c +++ b/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c @@ -1124,109 +1124,6 @@ GetProposedResources( }
/**
- Update attribute for PCI root bridge for specifc device.
-
- @param RootBridge Point to PCI root bridge.
- @param PciAddress The specific device PCI address
-**/
-VOID
-UpdateRootBridgeAttributes (
- IN PCI_ROOT_BRIDGE_INSTANCE *RootBridge,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress
- )
-{
- EFI_STATUS Status;
- PCI_TYPE01 PciConfigurationHeader;
- UINT64 Attributes;
-
- //
- // Read the PCI Configuration Header for the device
- //
- Status = RootBridge->Io.Pci.Read (
- &RootBridge->Io,
- EfiPciWidthUint16,
- EFI_PCI_ADDRESS(
- PciAddress.Bus,
- PciAddress.Device,
- PciAddress.Function,
- 0
- ),
- sizeof (PciConfigurationHeader) / sizeof (UINT16),
- &PciConfigurationHeader
- );
- if (EFI_ERROR (Status)) {
- return;
- }
-
- Attributes = RootBridge->Attributes;
-
- //
- // Look for devices with the VGA Palette Snoop enabled in the COMMAND register of the PCI Config Header
- //
- if (PciConfigurationHeader.Hdr.Command & 0x20) {
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
- }
-
- //
- // If the device is a PCI-PCI Bridge, then look at the Subordinate Bus Number
- //
- if (IS_PCI_BRIDGE(&PciConfigurationHeader)) {
- //
- // Look at the PPB Configuration for legacy decoding attributes
- //
- if (PciConfigurationHeader.Bridge.BridgeControl & 0x04) {
- Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO;
- Attributes |= EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO;
- }
- if (PciConfigurationHeader.Bridge.BridgeControl & 0x08) {
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;
- }
- } else {
- //
- // See if the PCI device is an IDE controller
- //
- if (PciConfigurationHeader.Hdr.ClassCode[2] == 0x01 &&
- PciConfigurationHeader.Hdr.ClassCode[1] == 0x01 ) {
- if (PciConfigurationHeader.Hdr.ClassCode[0] & 0x80) {
- Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;
- Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;
- }
- if (PciConfigurationHeader.Hdr.ClassCode[0] & 0x01) {
- Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;
- }
- if (PciConfigurationHeader.Hdr.ClassCode[0] & 0x04) {
- Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;
- }
- }
-
- //
- // See if the PCI device is a legacy VGA controller
- //
- if (PciConfigurationHeader.Hdr.ClassCode[2] == 0x00 &&
- PciConfigurationHeader.Hdr.ClassCode[1] == 0x01 ) {
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;
- }
-
- //
- // See if the PCI device is a standard VGA controller
- //
- if (PciConfigurationHeader.Hdr.ClassCode[2] == 0x03 &&
- PciConfigurationHeader.Hdr.ClassCode[1] == 0x00 ) {
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;
- Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;
- }
- }
-
- RootBridge->Attributes = Attributes;
- RootBridge->Supports = Attributes;
-}
-
-/**
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
PCI controllers before enumeration.
@@ -1275,14 +1172,17 @@ PreprocessController ( while (List != &HostBridgeInstance->Head) {
RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
if (RootBridgeHandle == RootBridgeInstance->Handle) {
- UpdateRootBridgeAttributes (
- RootBridgeInstance,
- PciAddress
- );
- return EFI_SUCCESS;
+ break;
}
List = List->ForwardLink;
}
+ if (List == &HostBridgeInstance->Head) {
+ return EFI_INVALID_PARAMETER;
+ }
- return EFI_INVALID_PARAMETER;
+ if (Phase < EfiPciBeforeChildBusEnumeration || Phase > EfiMaxPciHostBridgeEnumerationPhase) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return EFI_SUCCESS;
}
|