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,24 +213,24 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
ErrorF("Primary device is not PCI\n");
|
ErrorF("Primary device is not PCI\n");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ErrorF("xf86PciVideoInfo is not set\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
driver = videoPtrToDriverName(info);
|
driver = videoPtrToDriverName(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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
instances = xnfalloc(max_entries * sizeof(struct Inst));
|
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.
|
||||||
*/
|
*/
|
||||||
|
@ -1690,7 +1692,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
||||||
|| ((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;
|
||||||
|
@ -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,7 +272,6 @@ 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;
|
||||||
|
@ -280,15 +279,14 @@ probe_devices_from_device_sections(DriverPtr drvp)
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -303,6 +301,8 @@ probe_devices_from_device_sections(DriverPtr drvp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
if (pPci == NULL) {
|
if (pPci == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -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,25 +426,20 @@ 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++) {
|
|
||||||
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++) {
|
for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
|
||||||
if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
|
struct pci_device_iterator *iter;
|
||||||
&& PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
|
struct pci_device *dev;
|
||||||
&& ((devices[j].device_class_mask & pPci->device_class)
|
|
||||||
== devices[j].device_class) ) {
|
iter = pci_id_match_iterator_create(& devices[j]);
|
||||||
|
dev = pci_device_next(iter);
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -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