summaryrefslogtreecommitdiff
path: root/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.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 /PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
parente25fb2c06c6a2fd628b7c308d80fe0b6117ec771 (diff)
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/IsaAcpiDxe/PcatIsaAcpi.c')
-rw-r--r--PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
index 8e6d8b7f8..ea1180f3a 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
);