]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
1. used PciPlatfromProtocolGuid to get VgaIo and IsaIo supported capability.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciResourceSupport.c
index e7e40012c3b5dd9237c7c70ec704227edd93542b..da0cfa0cae86121ce5282d044a6cf87a51dde964 100644 (file)
@@ -196,13 +196,15 @@ CalculateApertureIo16 (
   IN PCI_RESOURCE_NODE *Bridge\r
   )\r
 {\r
-\r
-  UINT64            Aperture;\r
-  LIST_ENTRY        *CurrentLink;\r
-  PCI_RESOURCE_NODE *Node;\r
-  UINT64            Offset;\r
-  BOOLEAN           IsaEnable;\r
-  BOOLEAN           VGAEnable;\r
+  EFI_STATUS              Status;\r
+  UINT64                  Aperture;\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
   //\r
   // Always assume there is ISA device and VGA device on the platform\r
@@ -211,12 +213,22 @@ CalculateApertureIo16 (
   IsaEnable = FALSE;\r
   VGAEnable = FALSE;\r
 \r
-  if (FeaturePcdGet (PcdPciIsaEnable)){\r
-    IsaEnable = TRUE;\r
-  }\r
-\r
-  if (FeaturePcdGet (PcdPciVgaEnable)){\r
-    VGAEnable = TRUE;\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) {\r
+        IsaEnable = TRUE;\r
+      }\r
+      if (PciPolicy & EFI_RESERVE_VGA_IO_ALIAS) {\r
+        VGAEnable = TRUE;\r
+      }\r
+    }\r
   }\r
 \r
   Aperture = 0;\r
@@ -1386,10 +1398,10 @@ ProgrameUpstreamBridgeForRom (
     //\r
     if (Enable) {\r
       ProgramPpbApperture (OptionRomBase, &Node);\r
-      PciEnableCommandRegister (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);\r
+      PCI_ENABLE_COMMAND_REGISTER (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);\r
     } else {\r
       InitializePpb (Parent);\r
-      PciDisableCommandRegister (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);\r
+      PCI_DISABLE_COMMAND_REGISTER (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);\r
     }\r
 \r
     Parent = Parent->Parent;\r