This time with the patch actually attached...

On Jul 01, 09 15:38:41 +0200, Matthias Hopf wrote:
> At SUSE we try to use fbdev if possible, so if we cannot use a native
> driver we want to use the fbdev driver, and fail back to vesa if fbdev
> fails (e.g. if the mode on the kernel parameter line failed to set).
> 
> This doesn't work with the current xserver, after the first driver has
> been probed, the pci slot remains claimed. Apparently this was never
> thought to be an issue, because functions for unclaiming pci slots are
> missing.
> 
> This patch unclaims a pci slot by setting its bus type to BUS_NONE, so
> it doesn't match any more. I don't remove the allocation slot at the
> moment, because I'm unsure that there are no references left (and this
> is unlikely to be a regularly called function).
> 
> This fixes Novell bug #511529.
> 
> Thoughts?

Matthias, whistling

-- 
Matthias Hopf <[email protected]>      __        __   __
Maxfeldstr. 5 / 90409 Nuernberg   (_   | |  (_   |__          [email protected]
Phone +49-911-74053-715           __)  |_|  __)  |__  R & D   www.mshopf.de
>From 593348b46a21c6f291194fa9ff61bd5bc7c5cb9f Mon Sep 17 00:00:00 2001
From: Matthias Hopf <[email protected]>
Date: Wed, 24 Jun 2009 18:26:23 +0200
Subject: [PATCH] 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.
---
 hw/xfree86/common/xf86.h       |    1 +
 hw/xfree86/common/xf86Init.c   |    3 ++-
 hw/xfree86/common/xf86pciBus.c |   19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e49f28d..f863840 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 11f4cf1..e77ffab 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 586973b..9a9ae40 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.
  */
-- 
1.6.0.2

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to