forked from pool/xorg-x11-server
63 lines
1.8 KiB
Diff
63 lines
1.8 KiB
Diff
|
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
|
||
|
index b94d500..e624a17 100644
|
||
|
--- a/hw/xfree86/common/xf86Bus.c
|
||
|
+++ b/hw/xfree86/common/xf86Bus.c
|
||
|
@@ -429,7 +429,7 @@ xf86GetEntityInfo(int entityIndex)
|
||
|
EntityInfoPtr pEnt;
|
||
|
int i;
|
||
|
|
||
|
- if (entityIndex >= xf86NumEntities)
|
||
|
+ if (entityIndex < 0 || entityIndex >= xf86NumEntities)
|
||
|
return NULL;
|
||
|
|
||
|
pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
|
||
|
@@ -1816,6 +1816,20 @@ checkRoutingForScreens(xf86State state)
|
||
|
xf86FreeResList(pResVGA);
|
||
|
}
|
||
|
|
||
|
+CARD16
|
||
|
+xf86BusesClaimed(void)
|
||
|
+{
|
||
|
+ CARD16 ret = 0;
|
||
|
+
|
||
|
+ if (pciSlotClaimed) ret |= 1 << BUS_PCI;
|
||
|
+ if (fbSlotClaimed) ret |= 1 << BUS_NONE;
|
||
|
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
||
|
+ if (sbusSlotClaimed) ret |= 1 << BUS_SBUS;
|
||
|
+#endif
|
||
|
+
|
||
|
+ return ret;
|
||
|
+}
|
||
|
+
|
||
|
/*
|
||
|
* xf86PostProbe() -- Allocate all non conflicting resources
|
||
|
* This function gets called by xf86Init().
|
||
|
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
|
||
|
index 41ca8f5..80d4d00 100644
|
||
|
--- a/hw/xfree86/common/xf86Priv.h
|
||
|
+++ b/hw/xfree86/common/xf86Priv.h
|
||
|
@@ -123,6 +123,7 @@ extern RootWinPropPtr *xf86RegisteredPropertiesTable;
|
||
|
|
||
|
/* xf86Bus.c */
|
||
|
|
||
|
+CARD16 xf86BusesClaimed(void);
|
||
|
void xf86BusProbe(void);
|
||
|
void xf86ChangeBusIndex(int oldIndex, int newIndex);
|
||
|
void xf86AccessInit(void);
|
||
|
diff --git a/hw/xfree86/common/xf86fbBus.c b/hw/xfree86/common/xf86fbBus.c
|
||
|
index 102f6b1..1c99175 100644
|
||
|
--- a/hw/xfree86/common/xf86fbBus.c
|
||
|
+++ b/hw/xfree86/common/xf86fbBus.c
|
||
|
@@ -58,7 +58,10 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
|
||
|
{
|
||
|
EntityPtr p;
|
||
|
int num;
|
||
|
-
|
||
|
+
|
||
|
+ if (xf86BusesClaimed() & ~(1 << BUS_NONE))
|
||
|
+ return -1;
|
||
|
+
|
||
|
num = xf86AllocateEntity();
|
||
|
p = xf86Entities[num];
|
||
|
p->driver = drvp;
|