summaryrefslogtreecommitdiff
path: root/PcAtChipsetPkg
diff options
context:
space:
mode:
Diffstat (limited to 'PcAtChipsetPkg')
-rw-r--r--PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c50
-rw-r--r--PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c118
-rw-r--r--PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c7
3 files changed, 59 insertions, 116 deletions
diff --git a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
index 8e6d8b7f82..ea1180f3ab 100644
--- a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
+++ b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
@@ -171,7 +171,11 @@ PcatIsaAcpiDriverBindingStart (
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
PCAT_ISA_ACPI_DEV *PcatIsaAcpiDev;
-
+ UINT64 Supports;
+ BOOLEAN Enabled;
+
+ Enabled = FALSE;
+ Supports = 0;
PcatIsaAcpiDev = NULL;
//
// Open the PCI I/O Protocol Interface
@@ -189,10 +193,30 @@ PcatIsaAcpiDriverBindingStart (
goto Done;
}
+ //
+ // Get supported PCI attributes
+ //
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationSupported,
+ 0,
+ &Supports
+ );
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ Supports &= (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16);
+ if (Supports == 0 || Supports == (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16)) {
+ Status = EFI_UNSUPPORTED;
+ goto Done;
+ }
+
+ Enabled = TRUE;
Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
NULL
);
if (EFI_ERROR (Status)) {
@@ -242,11 +266,11 @@ PcatIsaAcpiDriverBindingStart (
Done:
if (EFI_ERROR (Status)) {
- if (PciIo != NULL) {
+ if (PciIo != NULL && Enabled) {
PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationDisable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
NULL
);
}
@@ -292,6 +316,7 @@ PcatIsaAcpiDriverBindingStop (
EFI_STATUS Status;
EFI_ISA_ACPI_PROTOCOL *IsaAcpi;
PCAT_ISA_ACPI_DEV *PcatIsaAcpiDev;
+ UINT64 Supports;
//
// Get the ISA ACPI Protocol Interface
@@ -313,10 +338,25 @@ PcatIsaAcpiDriverBindingStop (
//
PcatIsaAcpiDev = PCAT_ISA_ACPI_DEV_FROM_THIS (IsaAcpi);
+ //
+ // Get supported PCI attributes
+ //
+ Status = PcatIsaAcpiDev->PciIo->Attributes (
+ PcatIsaAcpiDev->PciIo,
+ EfiPciIoAttributeOperationSupported,
+ 0,
+ &Supports
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Supports &= (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16);
+
PcatIsaAcpiDev->PciIo->Attributes (
PcatIsaAcpiDev->PciIo,
EfiPciIoAttributeOperationDisable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,
NULL
);
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;
}
diff --git a/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c b/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c
index cd39f2bbf7..512a5049c1 100644
--- a/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c
+++ b/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c
@@ -674,8 +674,11 @@ RootBridgeConstructor (
PrivateData->RootBridgeAttrib = Attri;
- PrivateData->Attributes = 0;
- PrivateData->Supports = 0;
+ PrivateData->Supports = EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO | \
+ EFI_PCI_ATTRIBUTE_ISA_IO_16 | EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO | \
+ EFI_PCI_ATTRIBUTE_VGA_MEMORY | \
+ EFI_PCI_ATTRIBUTE_VGA_IO_16 | EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
+ PrivateData->Attributes = PrivateData->Supports;
Protocol->ParentHandle = HostBridgeHandle;