Eliminate the last few places outside xf86pciBus.c that use
xf86PciVideoInfo. In all cases this means converting the code to use the pci_device_iterator interfaces.
This commit is contained in:
parent
5bfb2ee965
commit
83ebf61ec0
|
@ -213,23 +213,23 @@ xf86AutoConfig(void)
|
|||
{
|
||||
const char **p;
|
||||
char buf[1024];
|
||||
struct pci_device ** pciptr;
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_device * info = NULL;
|
||||
char *driver = NULL;
|
||||
ConfigStatus ret;
|
||||
|
||||
/* Find the primary device, and get some information about it. */
|
||||
if (xf86PciVideoInfo) {
|
||||
for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
|
||||
if (xf86IsPrimaryPci(info)) {
|
||||
break;
|
||||
}
|
||||
iter = pci_slot_match_iterator_create(NULL);
|
||||
while ((info = pci_device_next(iter)) != NULL) {
|
||||
if (xf86IsPrimaryPci(info)) {
|
||||
break;
|
||||
}
|
||||
if (!info) {
|
||||
ErrorF("Primary device is not PCI\n");
|
||||
}
|
||||
} else {
|
||||
ErrorF("xf86PciVideoInfo is not set\n");
|
||||
}
|
||||
|
||||
pci_iterator_destroy(iter);
|
||||
|
||||
if (!info) {
|
||||
ErrorF("Primary device is not PCI\n");
|
||||
}
|
||||
|
||||
if (info)
|
||||
|
|
|
@ -1628,7 +1628,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
|||
{
|
||||
int i,j;
|
||||
struct pci_device * pPci;
|
||||
struct pci_device ** ppPci;
|
||||
struct pci_device_iterator *iter;
|
||||
struct Inst *instances = NULL;
|
||||
int numClaimedInstances = 0;
|
||||
int allocatedInstances = 0;
|
||||
|
@ -1648,20 +1648,22 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
|||
*/
|
||||
if ( !xf86DoProbe && !(xf86DoConfigure && xf86DoConfigurePass1) ) {
|
||||
unsigned max_entries = numDevs;
|
||||
for (ppPci = xf86PciVideoInfo ; *ppPci != NULL ; ppPci++) {
|
||||
|
||||
iter = pci_slot_match_iterator_create(NULL);
|
||||
while ((pPci = pci_device_next(iter)) != NULL) {
|
||||
max_entries++;
|
||||
}
|
||||
|
||||
instances = xnfalloc( max_entries * sizeof(struct Inst) );
|
||||
pci_iterator_destroy(iter);
|
||||
instances = xnfalloc(max_entries * sizeof(struct Inst));
|
||||
}
|
||||
|
||||
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
|
||||
unsigned device_class = (*ppPci)->device_class;
|
||||
iter = pci_slot_match_iterator_create(NULL);
|
||||
while ((pPci = pci_device_next(iter)) != NULL) {
|
||||
unsigned device_class = pPci->device_class;
|
||||
Bool foundVendor = FALSE;
|
||||
|
||||
|
||||
pPci = *ppPci;
|
||||
|
||||
/* Convert the pre-PCI 2.0 device class for a VGA adapter to the
|
||||
* 2.0 version of the same class.
|
||||
*/
|
||||
|
@ -1686,11 +1688,11 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
|||
const unsigned device_id = (id->PCIid & 0x0000FFFF);
|
||||
const unsigned match_class = 0x00030000 | id->PCIid;
|
||||
|
||||
if ( (vendor_id == pPci->vendor_id)
|
||||
|| ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class)) ) {
|
||||
if ( !foundVendor && (instances != NULL) ) {
|
||||
if ((vendor_id == pPci->vendor_id)
|
||||
|| ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) {
|
||||
if (!foundVendor && (instances != NULL)) {
|
||||
++allocatedInstances;
|
||||
instances[allocatedInstances - 1].pci = *ppPci;
|
||||
instances[allocatedInstances - 1].pci = pPci;
|
||||
instances[allocatedInstances - 1].dev = NULL;
|
||||
instances[allocatedInstances - 1].claimed = FALSE;
|
||||
instances[allocatedInstances - 1].foundHW = FALSE;
|
||||
|
@ -1709,10 +1711,10 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
|||
|
||||
|
||||
if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
|
||||
if ( xf86CheckPciSlot( pPci ) ) {
|
||||
if (xf86CheckPciSlot(pPci)) {
|
||||
GDevPtr pGDev =
|
||||
xf86AddDeviceToConfigure( drvp->driverName,
|
||||
pPci, -1 );
|
||||
xf86AddDeviceToConfigure(drvp->driverName,
|
||||
pPci, -1);
|
||||
if (pGDev) {
|
||||
/* After configure pass 1, chipID and chipRev
|
||||
* are treated as over-rides, so clobber them
|
||||
|
@ -1735,6 +1737,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
|||
}
|
||||
}
|
||||
|
||||
pci_iterator_destroy(iter);
|
||||
|
||||
|
||||
/* In "probe only" or "configure" mode (signaled by instances being NULL),
|
||||
* our work is done. Return the number of detected devices.
|
||||
|
|
|
@ -272,24 +272,22 @@ probe_devices_from_device_sections(DriverPtr drvp)
|
|||
{
|
||||
int i, j;
|
||||
struct pci_device * pPci;
|
||||
struct pci_device **ppPci;
|
||||
Bool foundScreen = FALSE;
|
||||
const struct pci_id_match * const devices = drvp->supported_devices;
|
||||
GDevPtr *devList;
|
||||
const unsigned numDevs = xf86MatchDevice( drvp->driverName, & devList );
|
||||
const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
|
||||
|
||||
|
||||
for ( i = 0 ; i < numDevs ; i++ ) {
|
||||
struct pci_device_iterator *iter;
|
||||
unsigned device_id;
|
||||
|
||||
|
||||
/* Find the pciVideoRec associated with this device section.
|
||||
*/
|
||||
pPci = NULL;
|
||||
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
|
||||
pPci = *ppPci;
|
||||
|
||||
if ( devList[i]->busID && *devList[i]->busID ) {
|
||||
iter = pci_id_match_iterator_create(NULL);
|
||||
while ((pPci = pci_device_next(iter)) != NULL) {
|
||||
if (devList[i]->busID && *devList[i]->busID) {
|
||||
if (xf86ComparePciBusString(devList[i]->busID,
|
||||
((pPci->domain << 8)
|
||||
| pPci->bus),
|
||||
|
@ -298,15 +296,17 @@ probe_devices_from_device_sections(DriverPtr drvp)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if ( xf86IsPrimaryPci( pPci ) ) {
|
||||
else if (xf86IsPrimaryPci(pPci)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pPci == NULL ) {
|
||||
pci_iterator_destroy(iter);
|
||||
|
||||
if (pPci == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
device_id = (devList[i]->chipID > 0)
|
||||
? devList[i]->chipID : pPci->device_id;
|
||||
|
||||
|
@ -380,14 +380,13 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
|
|||
{
|
||||
const struct pci_id_match * const devices = drvp->supported_devices;
|
||||
int j;
|
||||
struct pci_device ** ppPci;
|
||||
struct pci_device *pPci;
|
||||
struct pci_device_iterator *iter;
|
||||
int numFound = 0;
|
||||
|
||||
|
||||
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
|
||||
struct pci_device * const pPci = *ppPci;
|
||||
|
||||
|
||||
iter = pci_id_match_iterator_create(NULL);
|
||||
while ((pPci = pci_device_next(iter)) != NULL) {
|
||||
/* Determine if this device is supported by the driver. If it is,
|
||||
* add it to the list of devices to configure.
|
||||
*/
|
||||
|
@ -415,6 +414,8 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
|
|||
}
|
||||
}
|
||||
|
||||
pci_iterator_destroy(iter);
|
||||
|
||||
|
||||
return (numFound != 0);
|
||||
}
|
||||
|
@ -425,23 +426,18 @@ check_for_matching_devices(DriverPtr drvp)
|
|||
{
|
||||
const struct pci_id_match * const devices = drvp->supported_devices;
|
||||
int j;
|
||||
struct pci_device ** ppPci;
|
||||
|
||||
|
||||
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
|
||||
const struct pci_device * pPci = *ppPci;
|
||||
|
||||
|
||||
/* Determine if this device is supported by the driver. If it is,
|
||||
* add it to the list of devices to configure.
|
||||
*/
|
||||
for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
|
||||
if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
|
||||
&& PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
|
||||
&& ((devices[j].device_class_mask & pPci->device_class)
|
||||
== devices[j].device_class) ) {
|
||||
return TRUE;
|
||||
}
|
||||
for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_device *dev;
|
||||
|
||||
iter = pci_id_match_iterator_create(& devices[j]);
|
||||
dev = pci_device_next(iter);
|
||||
pci_iterator_destroy(iter);
|
||||
|
||||
if (dev != NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ extern Bool xf86Resetting;
|
|||
extern Bool xf86Initialising;
|
||||
extern Bool xf86ProbeFailed;
|
||||
extern int xf86NumScreens;
|
||||
extern struct pci_device ** xf86PciVideoInfo;
|
||||
extern xf86CurrentAccessRec xf86CurrentAccess;
|
||||
extern const char *xf86VisualNames[];
|
||||
extern int xf86Verbose; /* verbosity level */
|
||||
|
|
Loading…
Reference in New Issue
Block a user