Bug#207543: xserver-xfree86: prefBusID patch to select prefered PCI bus id
diff -ruN xc-old/programs/Xserver/hw/xfree86/common/xf86Config.c xc/programs/Xserver/hw/xfree86/common/xf86Config.c
--- xc-old/programs/Xserver/hw/xfree86/common/xf86Config.c 2003-02-20 05:36:07.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2004-03-12 22:02:54.000000000 +0100
@@ -1416,6 +1416,20 @@
return TRUE;
}
+typedef enum {
+ LAYOUT_ISOLATEDBUS,
+ LAYOUT_SINGLECARD
+} LayoutValues;
+
+static OptionInfoRec LayoutOptions[] = {
+ { LAYOUT_ISOLATEDBUS, "Isolatebus", OPTV_STRING,
+ {0}, FALSE },
+ { LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
+};
+
/*
* figure out which layout is active, which screens are used in that layout,
* which drivers and monitors are used in these screens
@@ -2213,6 +2227,8 @@
const char *filename;
char *searchpath;
MessageType from = X_DEFAULT;
+ char *scanptr;
+ Bool singlecard = 0;
if (getuid() == 0)
searchpath = ROOT_CONFIGPATH;
@@ -2283,6 +2299,28 @@
}
}
+ xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions);
+
+ if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDBUS))) {
+ ; /* Isolatebus is primary */
+ }
+ else {
+ xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
+ if (singlecard) scanptr = xf86ConfigLayout.screens->screen->device->busID;
+ }
+ if (scanptr) {
+ int bus, device, func, stroffset = 0;
+ if (tolower(scanptr[0]) == 'p' && strlen(scanptr) >= 4) stroffset = 4;
+ if (sscanf(scanptr + stroffset, "%d:%d:%d", &bus, &device, &func) == 3) {
+ xf86Isolatebus.bus = bus;
+ xf86Isolatebus.device = device;
+ xf86Isolatebus.func = func;
+ xf86Msg(X_INFO,
+ "Isolated PCI Bus set to \"%d:%d:%d\"\n",bus,device,func);
+ }
+ }
+
+
/* Now process everything else */
if (!configFiles(xf86configptr->conf_files) ||
diff -ruN xc-old/programs/Xserver/hw/xfree86/common/xf86Globals.c xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
--- xc-old/programs/Xserver/hw/xfree86/common/xf86Globals.c 2003-02-20 05:05:14.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/common/xf86Globals.c 2004-03-12 22:02:54.000000000 +0100
@@ -215,6 +215,7 @@
#endif
PropertyPtr *xf86RegisteredPropertiesTable = NULL;
Bool xf86inSuspend = FALSE;
+PciBusId xf86Isolatebus;
#ifdef DLOPEN_HACK
/*
diff -ruN xc-old/programs/Xserver/hw/xfree86/common/xf86Init.c xc/programs/Xserver/hw/xfree86/common/xf86Init.c
--- xc-old/programs/Xserver/hw/xfree86/common/xf86Init.c 2004-03-12 22:02:16.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/common/xf86Init.c 2004-03-12 22:02:54.000000000 +0100
@@ -1590,6 +1590,22 @@
xf86AllowMouseOpenFail = TRUE;
return 1;
}
+ if (!strcmp(argv[i], "-isolatebus"))
+ {
+ int bus, device, func;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%d:%d:%d", &bus, &device, &func) == 3) {
+ xf86Isolatebus.bus = bus;
+ xf86Isolatebus.device = device;
+ xf86Isolatebus.func = func;
+ return 2;
+ }
+ else {
+ ErrorF("Invalid isolated PCI Bus\n");
+ return 0;
+ }
+ }
/* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
}
diff -ruN xc-old/programs/Xserver/hw/xfree86/common/xf86Priv.h xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
--- xc-old/programs/Xserver/hw/xfree86/common/xf86Priv.h 2002-12-12 19:29:10.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/common/xf86Priv.h 2004-03-12 22:02:54.000000000 +0100
@@ -53,6 +53,7 @@
extern Gamma xf86Gamma;
extern char *xf86ServerName;
extern Bool xf86ShowUnresolved;
+extern PciBusId xf86Isolatebus;
/* Other parameters */
diff -ruN xc-old/programs/Xserver/hw/xfree86/common/xf86pciBus.c xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
--- xc-old/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2004-03-12 22:02:13.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2004-03-12 22:02:54.000000000 +0100
@@ -160,7 +160,10 @@
int num = 0;
pciVideoPtr info;
Bool mem64 = FALSE;
+ int DoIsolatebusCheck = 0;
+ if( xf86Isolatebus.bus || xf86Isolatebus.device || xf86Isolatebus.func )
+ DoIsolatebusCheck = 1;
pcrpp = xf86PciInfo = xf86scanpci(0);
getPciClassFlags(pcrpp);
@@ -182,7 +185,11 @@
subclass = pcrp->pci_sub_class;
}
- if (PCIINFOCLASSES(baseclass, subclass)) {
+ if (PCIINFOCLASSES(baseclass, subclass) &&
+ (DoIsolatebusCheck ?
+ (xf86Isolatebus.bus == pcrp->busnum &&
+ xf86Isolatebus.device == pcrp->devnum &&
+ xf86Isolatebus.func == pcrp->funcnum):1)) {
num++;
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
sizeof(pciVideoPtr) * (num + 1));
Reply to: