\r
#include "PciBus.h"\r
\r
+//\r
+// The default policy for the PCI bus driver is NOT to reserve I/O ranges for both ISA aliases and VGA aliases.\r
+//\r
+BOOLEAN mReserveIsaAliases = FALSE;\r
+BOOLEAN mReserveVgaAliases = FALSE;\r
+BOOLEAN mPolicyDetermined = FALSE;\r
+\r
/**\r
The function is used to skip VGA range.\r
\r
LIST_ENTRY *CurrentLink;\r
PCI_RESOURCE_NODE *Node;\r
UINT64 Offset;\r
- BOOLEAN IsaEnable;\r
- BOOLEAN VGAEnable;\r
EFI_PCI_PLATFORM_POLICY PciPolicy;\r
\r
- //\r
- // Always assume there is ISA device and VGA device on the platform\r
- // will be customized later\r
- //\r
- IsaEnable = FALSE;\r
- VGAEnable = FALSE;\r
+ if (!mPolicyDetermined) {\r
+ //\r
+ // Check PciPlatform policy\r
+ //\r
+ Status = EFI_NOT_FOUND;\r
+ PciPolicy = 0;\r
+ if (gPciPlatformProtocol != NULL) {\r
+ Status = gPciPlatformProtocol->GetPlatformPolicy (\r
+ gPciPlatformProtocol,\r
+ &PciPolicy\r
+ );\r
+ }\r
\r
- //\r
- // Check PciPlatform policy\r
- //\r
- if (gPciPlatformProtocol != NULL) {\r
- Status = gPciPlatformProtocol->GetPlatformPolicy (\r
- gPciPlatformProtocol,\r
- &PciPolicy\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- if ((PciPolicy & EFI_RESERVE_ISA_IO_ALIAS) != 0) {\r
- IsaEnable = TRUE;\r
- }\r
- if ((PciPolicy & EFI_RESERVE_VGA_IO_ALIAS) != 0) {\r
- VGAEnable = TRUE;\r
- }\r
+ if (EFI_ERROR (Status) && gPciOverrideProtocol != NULL) {\r
+ Status = gPciOverrideProtocol->GetPlatformPolicy (\r
+ gPciOverrideProtocol,\r
+ &PciPolicy\r
+ );\r
}\r
- } else if (gPciOverrideProtocol != NULL) {\r
- Status = gPciOverrideProtocol->GetPlatformPolicy (\r
- gPciOverrideProtocol,\r
- &PciPolicy\r
- );\r
+\r
if (!EFI_ERROR (Status)) {\r
if ((PciPolicy & EFI_RESERVE_ISA_IO_ALIAS) != 0) {\r
- IsaEnable = TRUE;\r
+ mReserveIsaAliases = TRUE;\r
}\r
if ((PciPolicy & EFI_RESERVE_VGA_IO_ALIAS) != 0) {\r
- VGAEnable = TRUE;\r
+ mReserveVgaAliases = TRUE;\r
}\r
}\r
+ mPolicyDetermined = TRUE;\r
}\r
\r
Aperture = 0;\r
// If both of them are enabled, then the IO resource would\r
// become too limited to meet the requirement of most of devices.\r
//\r
- if (IsaEnable || VGAEnable) {\r
+ if (mReserveIsaAliases || mReserveVgaAliases) {\r
if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci)) && !IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {\r
//\r
// Check if there is need to support ISA/VGA decoding\r
// If so, we need to avoid isa/vga aliasing range\r
//\r
- if (IsaEnable) {\r
+ if (mReserveIsaAliases) {\r
SkipIsaAliasAperture (\r
&Aperture,\r
Node->Length\r
if (Offset != 0) {\r
Aperture = Aperture + (Node->Alignment + 1) - Offset;\r
}\r
- } else if (VGAEnable) {\r
+ } else if (mReserveVgaAliases) {\r
SkipVGAAperture (\r
&Aperture,\r
Node->Length\r