xorg-x11-server/u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch
2016-02-10 15:09:02 +00:00

68 lines
2.6 KiB
Diff

From: Egbert Eich <eich@suse.de>
Date: Wed Feb 10 15:55:51 2016 +0100
Subject: [PATCH]pci/primary: Fix up primary PCI device detection for the platfrom bus
Patch-mainline: to be upstreamed
Git-commit: 85d81d3ec321572aea31d34a87632442687a54f5
References: boo#835975
Signed-off-by: Egbert Eich <eich@suse.com>
The detection wheter a device is the primary PCI device currently
relies on libciaccess. This checks of the PCI device is a VGA boot
device. On some systems however, the primary card is not flagged
like that - this it is not discovered.
The subsequent PCI probing has a fallback heuristic designed for this
situation. This however causes the primary device to be flagged as a
PCI bus device, not a 'platform bus' device.
To fix this, we check in the subsequent xf86platformPrimary() wheter
the primary device is flagged as a PCI bus device. If this is the
case and the same device is in the list of the 'platform bus' devices,
we reflag it as such.
This fixes the detection of the primary device on older iMacs.
Signed-off-by: Egbert Eich <eich@suse.de>
---
hw/xfree86/common/xf86platformBus.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 8b3a862..efa6d1a 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -622,6 +622,35 @@ void xf86platformPrimary(void)
xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
}
+ } else if (xf86_num_platform_devices > 0 && primaryBus.type == BUS_PCI) {
+ /*
+ * FIXUP: platform_find_pci_info() may not always find the primary
+ * platform device. If a primary device is a platform device but was
+ * identified as PCI device, let's fix this up here.
+ */
+ int i;
+
+ for (i = 0; i < xf86_num_platform_devices; i++) {
+ char *busid = xf86_platform_odev_attributes(i)->busid;
+ int domain, bus, dev, func;
+ int ret;
+
+ if (strncmp(busid, "pci:", 4) != 0)
+ continue;
+
+ ret = sscanf(busid, "pci:%04x:%02x:%02x.%u",
+ &domain, &bus, &dev, &func);
+ if (ret != 4)
+ continue;
+
+ if (domain == primaryBus.id.pci->domain &&
+ bus == primaryBus.id.pci->bus &&
+ dev == primaryBus.id.pci->dev &&
+ func == primaryBus.id.pci->func) {
+ primaryBus.id.plat = &xf86_platform_devices[i];
+ primaryBus.type = BUS_PLATFORM;
+ }
+ }
}
}
#endif