[PATCH] DDX/PCI: Check harder for primary PCI device
Egbert Eich
eich at freedesktop.org
Wed Aug 14 11:15:43 PDT 2013
On Wed, Aug 14, 2013 at 07:50:50PM +0200, Mark Kettenis wrote:
> > From: Egbert Eich <eich at freedesktop.org>
> > Date: Wed, 14 Aug 2013 18:17:02 +0200
> >
> > Primary PCI devices are identified by checking for an 'PCIINFOCLASSES'
> > device which is VGA and has access to the memory bars enabled.
> > If there should be more than one device for which this is true
> > redo the check and also check if IO resoures are also enabled,
> > if this still doesn't turn up a unique result also check for
> > the presence of a BIOS rom.
>
> Assuming this is a patch carried by SuSE, I'm a little bit surprised
> this is needed. These days the primary VGA device should be detected
> by libpciaccess through the pci_device_is_boot_vga() call, and I
> believe the detection code in xf86pciBus.c should only be hit if that
> method isn't implemented in libpciaccess. But for Linux
> pci_device_is_boot_vga() is implemented.
>
Like the two patches for ACPI support I've sent today, it is not
needed for the Xserver we ship today. However for an enterprise
product with long term support this patch was needed and still is
to fix a real problem that has been observed out in the field.
Since the code that's being fixed still exists I believe there
is still some value in integrating this - unless we decide to
drop this code entirely. (Same is true for the ACPI support fixes).
I know - this should have done a long time ago but I don't always
find the time to clean up fixes we have and port them to current
upstream.
I know it would be even better to check the heuristics used by
libpciaccess and see if it already covers the case which this
patch is trying to fix - but hey.
Cheers,
Egbert.
> > Signed-off-by: Egbert Eich <eich at freedesktop.org>
> > ---
> > hw/xfree86/common/xf86pciBus.c | 47 +++++++++++++++++++++++++++++++++++++++---
> > 1 file changed, 44 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
> > index 258988a..2303f90 100644
> > --- a/hw/xfree86/common/xf86pciBus.c
> > +++ b/hw/xfree86/common/xf86pciBus.c
> > @@ -134,9 +134,50 @@ xf86PciProbe(void)
> > primaryBus.id.pci = info;
> > }
> > else {
> > - xf86Msg(X_NOTICE,
> > - "More than one possible primary device found\n");
> > - primaryBus.type ^= (BusType) (-1);
> > + /*
> > + * Ok, we found more than one possible primary device
> > + * with this heuristic. Now also check if IO is enabled.
> > + */
> > + int j;
> > +
> > + primaryBus.type = BUS_NONE;
> > + for (j = 0; j < num; j++) {
> > + info = xf86PciVideoInfo[j];
> > + pci_device_cfg_read_u16(info, & command, 4);
> > +
> > + if ((command & PCI_CMD_MEM_ENABLE)
> > + && (command & PCI_CMD_IO_ENABLE)
> > + && (IS_VGA(info->device_class))) {
> > + if (primaryBus.type == BUS_NONE) {
> > + primaryBus.type = BUS_PCI;
> > + primaryBus.id.pci = info;
> > + } else {
> > + primaryBus.type = BUS_NONE;
> > + for (j = 0; j < num; j++) {
> > + info = xf86PciVideoInfo[j];
> > + pci_device_cfg_read_u16(info, &command, 4);
> > +
> > + if ((command & PCI_CMD_MEM_ENABLE)
> > + && (command & PCI_CMD_IO_ENABLE)
> > + && (IS_VGA(info->device_class))
> > + && info->rom_size) {
> > + if (primaryBus.type == BUS_NONE) {
> > + primaryBus.type = BUS_PCI;
> > + primaryBus.id.pci = info;
> > + } else {
> > + xf86Msg(X_NOTICE,
> > + "More than one possible "
> > + "primary device found\n");
> > + primaryBus.type ^= (BusType)(-1);
> > + break;
> > + }
> > + }
> > + }
> > + break;
> > + }
> > + }
> > + }
> > + break;
> > }
> > }
> > }
> > --
> > 1.8.1.4
> >
> > _______________________________________________
> > xorg-devel at lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> >
More information about the xorg-devel
mailing list