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