2009-10-12 12:15:18 +02:00
|
|
|
From 35540106538b24ca1765e752fe9d6efc968a88fa Mon Sep 17 00:00:00 2001
|
|
|
|
From: Egbert Eich <eich@linux-p1mv.site>
|
|
|
|
Date: Wed, 7 Oct 2009 16:31:44 +0200
|
|
|
|
Subject: [PATCH] Check harder for primary PCI device.
|
|
|
|
|
|
|
|
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.
|
2010-03-20 03:42:15 +01:00
|
|
|
================================================================================
|
2012-04-20 11:32:05 +02:00
|
|
|
Index: xorg-server-1.12.1/hw/xfree86/common/xf86pciBus.c
|
|
|
|
===================================================================
|
|
|
|
--- xorg-server-1.12.1.orig/hw/xfree86/common/xf86pciBus.c
|
|
|
|
+++ xorg-server-1.12.1/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.
|
|
|
|
+ */
|
2009-10-12 12:15:18 +02:00
|
|
|
+ int j;
|
2012-04-20 11:32:05 +02:00
|
|
|
+
|
|
|
|
+ primaryBus.type = BUS_NONE;
|
2009-10-12 12:15:18 +02:00
|
|
|
+ for (j = 0; j < num; j++) {
|
2012-04-20 11:32:05 +02:00
|
|
|
+ info = xf86PciVideoInfo[j];
|
|
|
|
+ pci_device_cfg_read_u16(info, & command, 4);
|
2009-10-12 12:15:18 +02:00
|
|
|
+
|
2012-04-20 11:32:05 +02:00
|
|
|
+ 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;
|
2009-10-12 12:15:18 +02:00
|
|
|
+ primaryBus.id.pci = info;
|
2012-04-20 11:32:05 +02:00
|
|
|
+ } 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
2009-10-12 12:15:18 +02:00
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
2012-04-20 11:32:05 +02:00
|
|
|
+
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|