Convert xf86IsolateDevice to a 'struct pci_slot_match'.

This commit is contained in:
Ian Romanick 2007-01-17 13:02:27 -08:00
parent d2f8c42c48
commit c1808f1484
4 changed files with 17 additions and 29 deletions

View File

@ -66,6 +66,7 @@
#include "configProcs.h"
#include "globals.h"
#include "extension.h"
#include "Pci.h"
#ifdef XINPUT
#include "xf86Xinput.h"
@ -2456,8 +2457,9 @@ xf86HandleConfigFile(Bool autoconfig)
xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
"\tIgnoring IsolateDevice option.\n");
} else if (sscanf(scanptr, "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
xf86IsolateDevice.bus = bus;
xf86IsolateDevice.device = device;
xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
xf86IsolateDevice.dev = device;
xf86IsolateDevice.func = func;
xf86Msg(X_INFO,
"Isolating PCI bus \"%d:%d:%d\"\n", bus, device, func);

View File

@ -204,4 +204,7 @@ Bool xf86MiscModInDevAllowNonLocal = FALSE;
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
_X_EXPORT Bool xf86inSuspend = FALSE;
Bool xorgHWAccess = FALSE;
PciBusId xf86IsolateDevice;
struct pci_slot_match xf86IsolateDevice = {
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
};

View File

@ -78,7 +78,7 @@ extern Bool xf86BestRefresh;
extern Gamma xf86Gamma;
extern char *xf86ServerName;
extern Bool xf86ShowUnresolved;
extern PciBusId xf86IsolateDevice;
extern struct pci_slot_match xf86IsolateDevice;
/* Other parameters */

View File

@ -112,9 +112,8 @@ FindPCIVideoInfo(void)
{
int i = 0, k;
int num = 0;
struct pci_device * info;
struct pci_slot_match m;
struct pci_device_iterator * iter;
struct pci_device *info;
struct pci_device_iterator *iter;
if (!xf86scanpci()) {
@ -122,29 +121,13 @@ FindPCIVideoInfo(void)
return;
}
if ( (xf86IsolateDevice.bus != 0)
|| (xf86IsolateDevice.device != 0)
|| (xf86IsolateDevice.func != 0) ) {
m.domain = PCI_DOM_FROM_BUS( xf86IsolateDevice.bus );
m.bus = PCI_BUS_NO_DOMAIN( xf86IsolateDevice.bus );
m.dev = xf86IsolateDevice.device;
m.func = xf86IsolateDevice.func;
}
else {
m.domain = PCI_MATCH_ANY;
m.bus = PCI_MATCH_ANY;
m.dev = PCI_MATCH_ANY;
m.func = PCI_MATCH_ANY;
}
iter = pci_slot_match_iterator_create( & m );
while ( (info = pci_device_next( iter )) != NULL ) {
if ( PCIINFOCLASSES( info->device_class ) ) {
iter = pci_slot_match_iterator_create(& xf86IsolateDevice);
while ((info = pci_device_next(iter)) != NULL) {
if (PCIINFOCLASSES(info->device_class)) {
num++;
xf86PciVideoInfo = xnfrealloc( xf86PciVideoInfo,
(sizeof( struct pci_device * )
* (num + 1)) );
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
(sizeof(struct pci_device *)
* (num + 1)));
xf86PciVideoInfo[num] = NULL;
xf86PciVideoInfo[num - 1] = info;