summaryrefslogtreecommitdiff
path: root/src/ati.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-08-03 16:45:50 +1000
committerDave Airlie <airlied@redhat.com>2012-09-03 12:35:11 +1000
commit0873b8cef21abf1e7286731758f0db1e7f2e7c97 (patch)
tree4deddb95a51ff18d95d4c4c8c3c18a124ba6f9fd /src/ati.c
parentcdf522f5992adf7b76f9153c777e6dddcf7758a6 (diff)
ati: fix stub driver loader to load all drivers properly
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/ati.c')
-rw-r--r--src/ati.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ati.c b/src/ati.c
index e1c136fc..256fbd8c 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -102,6 +102,7 @@ ati_device_get_from_busid(int bus, int dev, int func)
func);
}
+#ifndef XSERVER_PLATFORM_BUS
static struct pci_device*
ati_device_get_primary(void)
{
@@ -119,6 +120,26 @@ ati_device_get_primary(void)
return device;
}
+#else
+static struct pci_device *
+ati_device_get_indexed(int index)
+{
+ struct pci_device *device = NULL;
+ struct pci_device_iterator *device_iter;
+ int count = 0;
+
+ device_iter = pci_slot_match_iterator_create(NULL);
+
+ while ((device = pci_device_next(device_iter)) != NULL) {
+ if (device->vendor_id == PCI_VENDOR_ATI) {
+ if (count == index)
+ return device;
+ count++;
+ }
+ }
+ return NULL;
+}
+#endif
#else /* XSERVER_LIBPCIACCESS */
@@ -197,9 +218,14 @@ ati_gdev_subdriver(pointer options)
device = ati_device_get_from_busid(bus, dev, func);
}
+#ifdef XSERVER_PLATFORM_BUS
+ else
+ device = ati_device_get_indexed(i);
+#else
else {
device = ati_device_get_primary();
}
+#endif
if (!device)
continue;