]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBus: Restrict one VGA per HostBridge not Segment
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 23 Aug 2018 02:50:16 +0000 (10:50 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 27 Aug 2018 01:40:22 +0000 (09:40 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1109

Today's restriction of VGA device is to have only one VGA device
enabled per PCI segment. It's not correct because several segments
may share one IO / MMIO address space.
We should restrict to have one VGA per Host Bridge because each
Host Bridge has its only IO / MMIO address space.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c

index 5a4b83060445e2fcbc035c6c2d308dfc18a6889b..ab791541c34d4054a933d7fab98f68d3194cc8b5 100644 (file)
@@ -979,33 +979,33 @@ PciDeviceExisted (
 }\r
 \r
 /**\r
-  Get the active VGA device on the same segment.\r
+  Get the active VGA device on the specified Host Bridge.\r
 \r
-  @param VgaDevice    PCI IO instance for the VGA device.\r
+  @param HostBridgeHandle    Host Bridge handle.\r
 \r
-  @return The active VGA device on the same segment.\r
+  @return The active VGA device on the specified Host Bridge.\r
 \r
 **/\r
 PCI_IO_DEVICE *\r
-ActiveVGADeviceOnTheSameSegment (\r
-  IN PCI_IO_DEVICE        *VgaDevice\r
+LocateVgaDeviceOnHostBridge (\r
+  IN EFI_HANDLE           HostBridgeHandle\r
   )\r
 {\r
   LIST_ENTRY      *CurrentLink;\r
-  PCI_IO_DEVICE   *Temp;\r
+  PCI_IO_DEVICE   *PciIoDevice;\r
 \r
   CurrentLink = mPciDevicePool.ForwardLink;\r
 \r
   while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {\r
 \r
-    Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
+    PciIoDevice = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
 \r
-    if (Temp->PciRootBridgeIo->SegmentNumber == VgaDevice->PciRootBridgeIo->SegmentNumber) {\r
+    if (PciIoDevice->PciRootBridgeIo->ParentHandle== HostBridgeHandle) {\r
 \r
-      Temp = LocateVgaDevice (Temp);\r
+      PciIoDevice = LocateVgaDevice (PciIoDevice);\r
 \r
-      if (Temp != NULL) {\r
-        return Temp;\r
+      if (PciIoDevice != NULL) {\r
+        return PciIoDevice;\r
       }\r
     }\r
 \r
index 1ec2178a21ca870423e8f0463378453578244086..b45d2a5d7756298449750d1783beb34817df6741 100644 (file)
@@ -230,16 +230,16 @@ PciDeviceExisted (
   );\r
 \r
 /**\r
-  Get the active VGA device on the same segment.\r
+  Get the active VGA device on the specified Host Bridge.\r
 \r
-  @param VgaDevice    PCI IO instance for the VGA device.\r
+  @param HostBridgeHandle    Host Bridge handle.\r
 \r
-  @return The active VGA device on the same segment.\r
+  @return The active VGA device on the specified Host Bridge.\r
 \r
 **/\r
 PCI_IO_DEVICE *\r
-ActiveVGADeviceOnTheSameSegment (\r
-  IN PCI_IO_DEVICE        *VgaDevice\r
+LocateVgaDeviceOnHostBridge (\r
+  IN EFI_HANDLE           HostBridgeHandle\r
   );\r
 \r
 /**\r
index 291578c63cb9c06a2aff45706469edcc6aa02460..2a4f66a01a1eb0a63d04258751d883c83dbc7973 100644 (file)
@@ -1413,9 +1413,9 @@ SupportPaletteSnoopAttributes (
   }\r
 \r
   //\r
-  // Get the boot VGA on the same segement\r
+  // Get the boot VGA on the same Host Bridge\r
   //\r
-  Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);\r
+  Temp = LocateVgaDeviceOnHostBridge (PciIoDevice->PciRootBridgeIo->ParentHandle);\r
 \r
   if (Temp == NULL) {\r
     //\r
@@ -1668,9 +1668,9 @@ PciIoAttributes (
       //\r
       if (Operation == EfiPciIoAttributeOperationEnable) {\r
         //\r
-        // Check if there have been an active VGA device on the same segment\r
+        // Check if there have been an active VGA device on the same Host Bridge\r
         //\r
-        Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);\r
+        Temp = LocateVgaDeviceOnHostBridge (PciIoDevice->PciRootBridgeIo->ParentHandle);\r
         if (Temp != NULL && Temp != PciIoDevice) {\r
           //\r
           // An active VGA has been detected, so can not enable another\r