/** @file\r
EFI PCAT ISA ACPI Driver for a Generic PC Platform\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
EFI_STATUS Status;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
PCAT_ISA_ACPI_DEV *PcatIsaAcpiDev;\r
- \r
+ UINT64 Supports;\r
+ BOOLEAN Enabled;\r
+\r
+ Enabled = FALSE;\r
+ Supports = 0;\r
PcatIsaAcpiDev = NULL;\r
//\r
// Open the PCI I/O Protocol Interface\r
goto Done;\r
}\r
\r
+ //\r
+ // Get supported PCI attributes\r
+ //\r
+ Status = PciIo->Attributes (\r
+ PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16);\r
+ if (Supports == 0 || Supports == (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16)) {\r
+ Status = EFI_UNSUPPORTED;\r
+ goto Done;\r
+ } \r
+\r
+ Enabled = TRUE;\r
Status = PciIo->Attributes (\r
PciIo, \r
EfiPciIoAttributeOperationEnable, \r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO, \r
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO, \r
NULL \r
);\r
if (EFI_ERROR (Status)) {\r
PcatIsaAcpiDev->Signature = PCAT_ISA_ACPI_DEV_SIGNATURE;\r
PcatIsaAcpiDev->Handle = Controller;\r
PcatIsaAcpiDev->PciIo = PciIo;\r
+\r
+ //\r
+ // Initialize PcatIsaAcpiDeviceList\r
+ //\r
+ InitializePcatIsaAcpiDeviceList ();\r
\r
//\r
// IsaAcpi interface\r
\r
Done:\r
if (EFI_ERROR (Status)) {\r
- if (PciIo != NULL) {\r
+ if (PciIo != NULL && Enabled) {\r
PciIo->Attributes (\r
PciIo, \r
EfiPciIoAttributeOperationDisable, \r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,\r
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,\r
NULL \r
);\r
}\r
EFI_STATUS Status;\r
EFI_ISA_ACPI_PROTOCOL *IsaAcpi;\r
PCAT_ISA_ACPI_DEV *PcatIsaAcpiDev;\r
+ UINT64 Supports;\r
\r
//\r
// Get the ISA ACPI Protocol Interface\r
//\r
PcatIsaAcpiDev = PCAT_ISA_ACPI_DEV_FROM_THIS (IsaAcpi);\r
\r
+ //\r
+ // Get supported PCI attributes\r
+ //\r
+ Status = PcatIsaAcpiDev->PciIo->Attributes (\r
+ PcatIsaAcpiDev->PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &Supports\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_IO_16);\r
+\r
PcatIsaAcpiDev->PciIo->Attributes (\r
PcatIsaAcpiDev->PciIo, \r
EfiPciIoAttributeOperationDisable, \r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_ISA_IO | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,\r
+ EFI_PCI_DEVICE_ENABLE | Supports | EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO,\r
NULL \r
);\r
\r