]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
This check-in fixed the following bugs:
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / PciBus / Dxe / PciResourceSupport.c
index 8919b422a7474c5d5b8d509da11a6d7139ab7901..58dbc9fd4c3f0cd3c3bc90dd749d05b8cc9d8d98 100644 (file)
@@ -241,11 +241,24 @@ Returns:
   LIST_ENTRY        *CurrentLink;\r
   PCI_RESOURCE_NODE *Node;\r
   UINT64            offset;\r
+  BOOLEAN           IsaEnable;\r
+  BOOLEAN           VGAEnable;\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
+\r
+  if (FeaturePcdGet (PcdPciIsaEnable)){\r
+    IsaEnable = TRUE;\r
+  }\r
+\r
+  if (FeaturePcdGet (PcdPciVgaEnable)){\r
+    VGAEnable = TRUE;\r
+  }\r
+\r
   Aperture = 0;\r
 \r
   if (!Bridge) {\r
@@ -278,6 +291,34 @@ Returns:
     // become too limited to meet the requirement of most of devices.\r
     //\r
 \r
+    if (IsaEnable || VGAEnable) {\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
+          SkipIsaAliasAperture (\r
+            &Aperture,\r
+            Node->Length               \r
+            );\r
+          offset = Aperture & (Node->Alignment);\r
+          if (offset) {\r
+            Aperture = Aperture + (Node->Alignment + 1) - offset;\r
+          }\r
+        } else if (VGAEnable) {\r
+          SkipVGAAperture (\r
+            &Aperture,\r
+            Node->Length\r
+            );\r
+          offset = Aperture & (Node->Alignment);\r
+          if (offset) {\r
+            Aperture = Aperture + (Node->Alignment + 1) - offset;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
     Node->Offset = Aperture;\r
 \r
     //\r