aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86Helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Helper.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c285
1 files changed, 27 insertions, 258 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 282eb49f9..00df10574 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -60,7 +60,6 @@
#include "mivalidate.h"
#include "xf86RAC.h"
#include "xf86Bus.h"
-#include "xf86Version.h"
/* For xf86GetClocks */
#if defined(CSRG_BASED) || defined(__GNU__)
@@ -357,11 +356,11 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
if (pInp->drv)
pInp->drv->refCount--;
- /* This should *really* be handled in drv->UnInit(dev) call instead */
-#if 0
+ /* This should *really* be handled in drv->UnInit(dev) call instead, but
+ * if the driver forgets about it make sure we free it or at least crash
+ * with flying colors */
if (pInp->private)
xfree(pInp->private);
-#endif
/* Remove the entry from the list. */
if (pInp == xf86InputDevs)
@@ -448,10 +447,6 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
#define GLOBAL_DEFAULT_DEPTH 24
#endif
-#ifndef GLOBAL_DEFAULT_FBBPP
-#define GLOBAL_DEFAULT_FBBPP 32
-#endif
-
_X_EXPORT Bool
xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
int depth24flags)
@@ -529,7 +524,6 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
if (depth > 0)
scrp->depth = depth;
} else {
- scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP;
scrp->depth = GLOBAL_DEFAULT_DEPTH;
}
}
@@ -1097,9 +1091,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
BoxRec box;
@@ -1169,12 +1160,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
anyMarked = TRUE;
}
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
@@ -1184,10 +1169,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
{
if (anyMarked)
(*pScreen->HandleExposures)(pWin);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
}
@@ -1552,6 +1533,21 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
return i;
}
+static Bool
+pciDeviceHasBars(struct pci_device *pci)
+{
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (pci->regions[i].size)
+ return TRUE;
+
+ if (pci->rom_size)
+ return TRUE;
+
+ return FALSE;
+}
+
struct Inst {
struct pci_device * pci;
GDevPtr dev;
@@ -1687,8 +1683,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
if (xf86CheckPciSlot(pPci)) {
GDevPtr pGDev =
- xf86AddDeviceToConfigure(drvp->driverName,
- pPci, -1);
+ xf86AddBusDeviceToConfigure(drvp->driverName,
+ BUS_PCI, pPci, -1);
if (pGDev) {
/* After configure pass 1, chipID and chipRev
* are treated as over-rides, so clobber them
@@ -1806,7 +1802,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
}
if (devBus) dev = devBus; /* busID preferred */
if (!dev) {
- if ( xf86CheckPciSlot( pPci ) ) {
+ if (xf86CheckPciSlot(pPci) && pciDeviceHasBars(pPci)) {
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID PCI:%u@%u:%u:%u) found\n",
driverName, pPci->domain, pPci->bus, pPci->dev,
@@ -1957,108 +1953,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
return numFound;
}
-_X_EXPORT int
-xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
- IsaChipsets *ISAchipsets, DriverPtr drvp,
- FindIsaDevProc FindIsaDevice, GDevPtr *devList,
- int numDevs, int **foundEntities)
-{
- SymTabRec *c;
- IsaChipsets *Chips;
- int i;
- int numFound = 0;
- int foundChip = -1;
- int *retEntities = NULL;
-
- *foundEntities = NULL;
-
-#if defined(__sparc__) || defined(__powerpc__)
- FindIsaDevice = NULL; /* Temporary */
-#endif
-
- if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) {
- if (FindIsaDevice &&
- ((foundChip = (*FindIsaDevice)(NULL)) != -1)) {
- xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip);
- return 1;
- }
- return 0;
- }
-
- for (i = 0; i < numDevs; i++) {
- MessageType from = X_CONFIG;
- GDevPtr dev = NULL;
- GDevPtr devBus = NULL;
-
- if (devList[i]->busID && *devList[i]->busID) {
- if (xf86ParseIsaBusString(devList[i]->busID)) {
- if (devBus) xf86MsgVerb(X_WARNING,0,
- "%s: More than one matching Device "
- "section for ISA-Bus found: %s\n",
- driverName,devList[i]->identifier);
- else devBus = devList[i];
- }
- } else {
- if (xf86IsPrimaryIsa()) {
- if (dev) xf86MsgVerb(X_WARNING,0,
- "%s: More than one matching "
- "Device section found: %s\n",
- driverName,devList[i]->identifier);
- else dev = devList[i];
- }
- }
- if (devBus) dev = devBus;
- if (dev) {
- if (dev->chipset) {
- for (c = chipsets; c->token >= 0; c++) {
- if (xf86NameCmp(c->name, dev->chipset) == 0)
- break;
- }
- if (c->token == -1) {
- xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
- "section \"%s\" isn't valid for this driver\n",
- driverName, dev->chipset,
- dev->identifier);
- } else
- foundChip = c->token;
- } else {
- if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev);
- /* Probe it */
- from = X_PROBED;
- }
- }
-
- /* Check if the chip type is listed in the chipset table - for sanity*/
-
- if (foundChip >= 0){
- for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) {
- if (Chips->numChipset == foundChip)
- break;
- }
- if (Chips->numChipset == -1){
- foundChip = -1;
- xf86MsgVerb(X_WARNING,0,
- "%s: Driver detected unknown ISA-Bus Chipset\n",
- driverName);
- }
- }
- if (foundChip != -1) {
- numFound++;
- retEntities = xnfrealloc(retEntities,numFound * sizeof(int));
- retEntities[numFound - 1] =
- xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE);
- for (c = chipsets; c->token >= 0; c++) {
- if (c->token == foundChip)
- break;
- }
- xf86Msg(from, "Chipset %s found\n", c->name);
- }
- }
- *foundEntities = retEntities;
-
- return numFound;
-}
-
/*
* xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
*/
@@ -2098,14 +1992,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
cnt = 0;
sync = 200000;
- /* XXX How critical is this? */
- if (!xf86DisableInterrupts())
- {
- (*ClockFunc)(pScrn, CLK_REG_RESTORE);
- ErrorF("Failed to disable interrupts during clock probe. If\n");
- ErrorF("your OS does not support disabling interrupts, then you\n");
- FatalError("must specify a Clocks line in the XF86Config file.\n");
- }
while ((inb(status) & maskval) == 0x00)
if (sync-- == 0) goto finish;
/* Something appears to be happening, so reset sync count */
@@ -2126,8 +2012,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
}
finish:
- xf86EnableInterrupts();
-
pScrn->clock[i] = cnt ? cnt : -1;
if (BlankScreen)
(*BlankScreen)(pScrn, TRUE);
@@ -2339,12 +2223,6 @@ xf86DisableRandR()
}
_X_EXPORT CARD32
-xf86GetVersion()
-{
- return XF86_VERSION_CURRENT;
-}
-
-_X_EXPORT CARD32
xf86GetModuleVersion(pointer module)
{
return (CARD32)LoaderGetModuleVersion(module);
@@ -2567,49 +2445,6 @@ xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
#include "loader/os.c"
/* new RAC */
-/*
- * xf86ConfigIsa/PciEntity() -- These helper functions assign an
- * active entity to a screen, registers its fixed resources, assign
- * special enter/leave functions and their private scratch area to
- * this entity, take the dog for a walk...
- */
-_X_EXPORT ScrnInfoPtr
-xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
- IsaChipsets *i_chip, resList res, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private)
-{
- IsaChipsets *i_id;
- EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return pScrn;
-
- if (!(pEnt->location.type == BUS_ISA)) {
- xfree(pEnt);
- return pScrn;
- }
-
- if (!pEnt->active) {
- xf86ConfigIsaEntityInactive(pEnt, i_chip, res, init, enter,
- leave, private);
- xfree(pEnt);
- return pScrn;
- }
-
- if (!pScrn)
- pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
- xf86AddEntityToScreen(pScrn,entityIndex);
-
- if (i_chip) {
- for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
- if (pEnt->chipset == i_id->numChipset) break;
- }
- xf86ClaimFixedResources(i_id->resList,entityIndex);
- }
- xfree(pEnt);
- xf86ClaimFixedResources(res,entityIndex);
- xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
-
- return pScrn;
-}
_X_EXPORT ScrnInfoPtr
xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
@@ -2685,39 +2520,9 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
/*
*
- * OBSOLETE ! xf86ConfigActiveIsaEntity() and xf86ConfigActivePciEntity()
- * are obsolete functions. They the are likely to be removed
- * Don't use!
+ * OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete functions.
+ * They the are likely to be removed. Don't use!
*/
-_X_EXPORT Bool
-xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
- IsaChipsets *i_chip, resList res, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private)
-{
- IsaChipsets *i_id;
- EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return FALSE;
-
- if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) {
- xfree(pEnt);
- return FALSE;
- }
-
- xf86AddEntityToScreen(pScrn,entityIndex);
-
- if (i_chip) {
- for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
- if (pEnt->chipset == i_id->numChipset) break;
- }
- xf86ClaimFixedResources(i_id->resList,entityIndex);
- }
- xfree(pEnt);
- xf86ClaimFixedResources(res,entityIndex);
- if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
- return FALSE;
-
- return TRUE;
-}
_X_EXPORT Bool
xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
@@ -2750,10 +2555,10 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
}
/*
- * xf86ConfigPci/IsaEntityInactive() -- These functions can be used
+ * xf86ConfigPciEntityInactive() -- This functions can be used
* to configure an inactive entity as well as to reconfigure an
* previously active entity inactive. If the entity has been
- * assigned to a screen before it will be removed. If p_pci(p_isa) is
+ * assigned to a screen before it will be removed. If p_pci is
* non-NULL all static resources listed there will be registered.
*/
_X_EXPORT void
@@ -2778,28 +2583,6 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
}
-_X_EXPORT void
-xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
- resList res, EntityProc init, EntityProc enter,
- EntityProc leave, pointer private)
-{
- IsaChipsets *i_id;
- ScrnInfoPtr pScrn;
-
- if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
- xf86RemoveEntityFromScreen(pScrn,pEnt->index);
- else if (i_chip) {
- for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
- if (pEnt->chipset == i_id->numChipset) break;
- }
- xf86ClaimFixedResources(i_id->resList,pEnt->index);
- }
- xf86ClaimFixedResources(res,pEnt->index);
- /* shared resources are only needed when entity is active: remove */
- xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
- xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
-}
-
void
xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
EntityProc enter, EntityProc leave, pointer private)
@@ -2939,21 +2722,7 @@ xf86MotionHistoryAllocate(LocalDevicePtr local)
_X_EXPORT int
xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
- unsigned long stop, ScreenPtr pScreen)
-{
- return GetMotionHistory(pDev, buff, start, stop, pScreen);
-}
-
-_X_EXPORT void
-xf86getsecs(long * secs, long * usecs)
+ unsigned long stop, ScreenPtr pScreen, BOOL core)
{
- struct timeval tv;
-
- X_GETTIMEOFDAY(&tv);
- if (secs)
- *secs = tv.tv_sec;
- if (usecs)
- *usecs= tv.tv_usec;
-
- return;
+ return GetMotionHistory(pDev, buff, start, stop, pScreen, core);
}