summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Hopf <mhopf@suse.de>2009-06-24 18:26:23 +0200
committerMatthias Hopf <mhopf@suse.de>2009-07-06 18:38:26 +0200
commit43ee8d2ead862f84a4526a472519663ef27a8d6a (patch)
tree590741f86e7ab50e5f903ba28acc5886e9223e65
parent73abdc94c3cceadeda26a9b6bd3cdfecf0df8db2 (diff)
Unclaim PCI slot if driver probing fails.
Otherwise no subsequent driver will be able to claim this pci slot. Example for this: fbdev tries to claim, but framebuffer device is not available. Later on VESA cannot claim the device.
-rw-r--r--hw/xfree86/common/xf86.h1
-rw-r--r--hw/xfree86/common/xf86Init.c3
-rw-r--r--hw/xfree86/common/xf86pciBus.c19
3 files changed, 22 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e49f28db0..f8638403b 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -97,6 +97,7 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
extern _X_EXPORT Bool xf86CheckPciSlot( const struct pci_device * );
extern _X_EXPORT int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
+extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *);
extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
int *func);
extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 11f4cf1b1..e77ffabf9 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -495,7 +495,8 @@ probe_devices_from_device_sections(DriverPtr drvp)
if ((*drvp->PciProbe)(drvp, entry, pPci,
devices[j].match_data)) {
foundScreen = TRUE;
- }
+ } else
+ xf86UnclaimPciSlot(pPci);
}
break;
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 586973b55..9a9ae4091 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -753,6 +753,25 @@ xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
}
/*
+ * Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim.
+ */
+void
+xf86UnclaimPciSlot(struct pci_device *d)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ const EntityPtr p = xf86Entities[i];
+
+ if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
+ /* Probably the slot should be deallocated? */
+ p->bus.type = BUS_NONE;
+ return;
+ }
+ }
+}
+
+/*
* Parse a BUS ID string, and return the PCI bus parameters if it was
* in the correct format for a PCI bus id.
*/