From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Star Zeng <star.zeng@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/PciBus: Restrict one VGA per HostBridge not Segment
Date: Thu, 23 Aug 2018 10:53:53 +0800 [thread overview]
Message-ID: <20180823025353.137924-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20180823025353.137924-1-ruiyu.ni@intel.com>
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>
Cc: Star Zeng <star.zeng@intel.com>
---
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 22 +++++++++++-----------
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h | 10 +++++-----
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 4 ++--
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index fdec0bcd53..fbcc53e41a 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -979,33 +979,33 @@ PciDeviceExisted (
}
/**
- Get the active VGA device on the same segment.
+ Get the active VGA device on the specified Host Bridge.
- @param VgaDevice PCI IO instance for the VGA device.
+ @param HostBridgeHandle Host Bridge handle.
- @return The active VGA device on the same segment.
+ @return The active VGA device on the specified Host Bridge.
**/
PCI_IO_DEVICE *
-ActiveVGADeviceOnTheSameSegment (
- IN PCI_IO_DEVICE *VgaDevice
+LocateVgaDeviceOnHostBridge (
+ IN EFI_HANDLE HostBridgeHandle
)
{
LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
+ PCI_IO_DEVICE *PciIo;
CurrentLink = mPciDevicePool.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
+ PciIo = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (Temp->PciRootBridgeIo->SegmentNumber == VgaDevice->PciRootBridgeIo->SegmentNumber) {
+ if (PciIo->PciRootBridgeIo->ParentHandle== HostBridgeHandle) {
- Temp = LocateVgaDevice (Temp);
+ PciIo = LocateVgaDevice (PciIo);
- if (Temp != NULL) {
- return Temp;
+ if (PciIo != NULL) {
+ return PciIo;
}
}
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
index 1ec2178a21..b45d2a5d77 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
@@ -230,16 +230,16 @@ PciDeviceExisted (
);
/**
- Get the active VGA device on the same segment.
+ Get the active VGA device on the specified Host Bridge.
- @param VgaDevice PCI IO instance for the VGA device.
+ @param HostBridgeHandle Host Bridge handle.
- @return The active VGA device on the same segment.
+ @return The active VGA device on the specified Host Bridge.
**/
PCI_IO_DEVICE *
-ActiveVGADeviceOnTheSameSegment (
- IN PCI_IO_DEVICE *VgaDevice
+LocateVgaDeviceOnHostBridge (
+ IN EFI_HANDLE HostBridgeHandle
);
/**
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
index 291578c63c..333b875ff0 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
@@ -1415,7 +1415,7 @@ SupportPaletteSnoopAttributes (
//
// Get the boot VGA on the same segement
//
- Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);
+ Temp = LocateVgaDeviceOnHostBridge (PciIoDevice->PciRootBridgeIo->ParentHandle);
if (Temp == NULL) {
//
@@ -1670,7 +1670,7 @@ PciIoAttributes (
//
// Check if there have been an active VGA device on the same segment
//
- Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);
+ Temp = LocateVgaDeviceOnHostBridge (PciIoDevice->PciRootBridgeIo->ParentHandle);
if (Temp != NULL && Temp != PciIoDevice) {
//
// An active VGA has been detected, so can not enable another
--
2.16.1.windows.1
next prev parent reply other threads:[~2018-08-23 2:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 2:53 [PATCH 0/2] MdeModulePkg/PciBus: Restrict one VGA per HostBridge not Segment Ruiyu Ni
2018-08-23 2:53 ` [PATCH 1/2] MdeModulePkg/PciBus: Refine ActiveVGADeviceOnTheRootBridge Ruiyu Ni
2018-08-24 8:13 ` Zeng, Star
2018-08-23 2:53 ` Ruiyu Ni [this message]
2018-08-24 8:16 ` [PATCH 2/2] MdeModulePkg/PciBus: Restrict one VGA per HostBridge not Segment Zeng, Star
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180823025353.137924-3-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox