aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86Bus.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/hw/xfree86/common/xf86Bus.c
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Bus.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c578
1 files changed, 85 insertions, 493 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index f7ffac85e..b94d500f0 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -25,7 +25,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-#define REDUCER
/*
* This file contains the interfaces to the bus-specific code
*/
@@ -60,7 +59,10 @@ int xf86NumEntities = 0;
static int xf86EntityPrivateCount = 0;
BusAccPtr xf86BusAccInfo = NULL;
-xf86AccessRec AccessNULL = {NULL,NULL,NULL};
+static void
+noopEnableDisable(void *arg) { }
+
+xf86AccessRec AccessNULL = { noopEnableDisable, noopEnableDisable, NULL };
xf86CurrentAccessRec xf86CurrentAccess = {NULL,NULL};
@@ -68,10 +70,6 @@ BusRec primaryBus = { BUS_NONE, {{0}}};
static Bool xf86ResAccessEnter = FALSE;
-#ifdef REDUCER
-/* Resources that temporarily conflict with estimated resources */
-static resPtr AccReducers = NULL;
-#endif
/* resource lists */
resPtr Acc = NULL;
@@ -96,10 +94,6 @@ static Bool doFramebufferMode = FALSE;
static StateChangeNotificationPtr StateChangeNotificationList;
static void notifyStateChange(xf86NotifyState state);
-#undef MIN
-#define MIN(x,y) ((x<y)?x:y)
-
-
/*
* Call the bus probes relevant to the architecture.
*
@@ -141,8 +135,6 @@ StringToBusType(const char* busID, const char **retID)
}
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
ret = BUS_PCI;
- if (!xf86NameCmp(p, "isa"))
- ret = BUS_ISA;
if (!xf86NameCmp(p, "sbus"))
ret = BUS_SBUS;
if (ret != BUS_NONE)
@@ -160,8 +152,6 @@ void
xf86EntityInit(void)
{
int i;
- resPtr *pprev_next;
- resPtr res;
xf86AccessPtr pacc;
for (i = 0; i < xf86NumEntities; i++)
@@ -170,22 +160,9 @@ xf86EntityInit(void)
((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
(xf86Entities[i]->access->busAcc);
pacc = xf86Entities[i]->access->fallback;
- if (pacc->AccessEnable)
- pacc->AccessEnable(pacc->arg);
+ pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
- if (pacc->AccessDisable)
- pacc->AccessDisable(pacc->arg);
- /* remove init resources after init is processed */
- pprev_next = &Acc;
- res = Acc;
- while (res) {
- if (res->res_type & ResInit && (res->entityIndex == i)) {
- (*pprev_next) = res->next;
- xfree(res);
- } else
- pprev_next = &(res->next);
- res = (*pprev_next);
- }
+ pacc->AccessDisable(pacc->arg);
}
}
@@ -213,11 +190,9 @@ EntityEnter(void)
((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
(xf86Entities[i]->access->busAcc);
pacc = xf86Entities[i]->access->fallback;
- if (pacc->AccessEnable)
- pacc->AccessEnable(pacc->arg);
+ pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
- if (pacc->AccessDisable)
- pacc->AccessDisable(pacc->arg);
+ pacc->AccessDisable(pacc->arg);
}
}
@@ -233,11 +208,9 @@ EntityLeave(void)
((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
(xf86Entities[i]->access->busAcc);
pacc = xf86Entities[i]->access->fallback;
- if (pacc->AccessEnable)
- pacc->AccessEnable(pacc->arg);
+ pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
- if (pacc->AccessDisable)
- pacc->AccessDisable(pacc->arg);
+ pacc->AccessDisable(pacc->arg);
}
}
@@ -251,8 +224,6 @@ xf86IsEntityPrimary(int entityIndex)
switch (pEnt->busType) {
case BUS_PCI:
return (pEnt->bus.id.pci == primaryBus.id.pci);
- case BUS_ISA:
- return TRUE;
case BUS_SBUS:
return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
default:
@@ -260,7 +231,7 @@ xf86IsEntityPrimary(int entityIndex)
}
}
-_X_EXPORT Bool
+Bool
xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
EntityProc leave, pointer private)
{
@@ -358,10 +329,10 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
peacc = xf86Entities[pScrn->entityList[i]]->access;
(*ptr) = peacc->next;
/* disable entity: call disable func */
- if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ if (peacc->pAccess)
peacc->pAccess->AccessDisable(peacc->pAccess->arg);
/* also disable fallback - just in case */
- if (peacc->fallback && peacc->fallback->AccessDisable)
+ if (peacc->fallback)
peacc->fallback->AccessDisable(peacc->fallback->arg);
for (i++; i < pScrn->numEntities; i++)
pScrn->entityList[i-1] = pScrn->entityList[i];
@@ -391,10 +362,10 @@ xf86ClearEntityListForScreen(int scrnIndex)
xf86Entities[entityIndex]->inUse = FALSE;
/* disable resource: call the disable function */
peacc = xf86Entities[entityIndex]->access;
- if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ if (peacc->pAccess)
peacc->pAccess->AccessDisable(peacc->pAccess->arg);
/* and the fallback function */
- if (peacc->fallback && peacc->fallback->AccessDisable)
+ if (peacc->fallback)
peacc->fallback->AccessDisable(peacc->fallback->arg);
/* shared resources are only needed when entity is active: remove */
xf86DeallocateResourcesForEntity(entityIndex, ResShared);
@@ -409,7 +380,7 @@ xf86ClearEntityListForScreen(int scrnIndex)
pScrn->entityInstanceList = NULL;
}
-_X_EXPORT void
+void
xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type)
{
resPtr *pprev_next = &Acc;
@@ -525,14 +496,14 @@ disableAccess(void)
for (i = 0; i < xf86NumScreens; i++) {
peacc = xf86Screens[i]->CurrentAccess->pIoAccess;
while (peacc) {
- if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ if (peacc->pAccess)
peacc->pAccess->AccessDisable(peacc->pAccess->arg);
peacc = peacc->next;
}
xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
peacc = xf86Screens[i]->CurrentAccess->pMemAccess;
while (peacc) {
- if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ if (peacc->pAccess)
peacc->pAccess->AccessDisable(peacc->pAccess->arg);
peacc = peacc->next;
}
@@ -541,8 +512,7 @@ disableAccess(void)
/* then call the generic entity disable funcs */
for (i = 0; i < xf86NumEntities; i++) {
pacc = xf86Entities[i]->access->fallback;
- if (pacc->AccessDisable)
- pacc->AccessDisable(pacc->arg);
+ pacc->AccessDisable(pacc->arg);
}
}
@@ -692,16 +662,16 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
pScrn->CurrentAccess->pMemAccess = NULL;
while (pceAcc) {
pAcc = pceAcc->pAccess;
- if ( pAcc && pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessDisable(pAcc->arg);
pceAcc = pceAcc->next;
}
if (pScrn->busAccess)
((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
while (peAcc) {
pAcc = peAcc->pAccess;
- if (pAcc && pAcc->AccessEnable)
- (*pAcc->AccessEnable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessEnable(pAcc->arg);
peAcc = peAcc->next;
}
pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
@@ -713,8 +683,8 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
tmp = pceAcc;
while (pceAcc) {
pAcc = pceAcc->pAccess;
- if (pAcc && pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessDisable(pAcc->arg);
pceAcc = pceAcc->next;
}
pceAcc = pScrn->CurrentAccess->pMemAccess;
@@ -722,8 +692,8 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
&& tmp !=pceAcc) {
while (pceAcc) {
pAcc = pceAcc->pAccess;
- if (pAcc && pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessDisable(pAcc->arg);
pceAcc = pceAcc->next;
}
}
@@ -734,8 +704,8 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
}
while (pceAcc) { /* current Mem != pAccess */
pAcc = pceAcc->pAccess;
- if (pAcc && pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessDisable(pAcc->arg);
pceAcc = pceAcc->next;
}
}
@@ -743,8 +713,8 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
while (peAcc) {
pAcc = peAcc->pAccess;
- if (pAcc && pAcc->AccessEnable)
- (*pAcc->AccessEnable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessEnable(pAcc->arg);
peAcc = peAcc->next;
}
pScrn->CurrentAccess->pMemAccess =
@@ -760,16 +730,16 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
pScrn->CurrentAccess->pIoAccess = NULL;
while (pceAcc) {
pAcc = pceAcc->pAccess;
- if ( pAcc && pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessDisable(pAcc->arg);
pceAcc = pceAcc->next;
}
if (pScrn->busAccess)
((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
while (peAcc) {
pAcc = peAcc->pAccess;
- if (pAcc && pAcc->AccessEnable)
- (*pAcc->AccessEnable)(pAcc->arg);
+ if (pAcc)
+ pAcc->AccessEnable(pAcc->arg);
peAcc = peAcc->next;
}
pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access;
@@ -808,13 +778,11 @@ xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn)
while (pceAcc) {
pAcc = pceAcc->pAccess;
- if ( pAcc) {
- if (!Enable) {
- if (pAcc->AccessDisable)
- (*pAcc->AccessDisable)(pAcc->arg);
+ if (pAcc) {
+ if (Enable) {
+ pAcc->AccessEnable(pAcc->arg);
} else {
- if (pAcc->AccessEnable)
- (*pAcc->AccessEnable)(pAcc->arg);
+ pAcc->AccessDisable(pAcc->arg);
}
}
pceAcc = pceAcc->next;
@@ -836,11 +804,6 @@ xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
rac = xf86Entities[pEnt->index]->rac;
- if (funcs->mem == funcs->io_mem && funcs->mem && funcs->io)
- xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_MEM_FROM_IO;
- if (funcs->io == funcs->io_mem && funcs->mem && funcs->io)
- xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_IO_FROM_MEM;
-
rac->mem_new = funcs->mem;
rac->io_new = funcs->io;
rac->io_mem_new = funcs->io_mem;
@@ -1011,10 +974,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
BusType loc = BUS_NONE;
BusType r_loc = BUS_NONE;
- /* Ignore overlapped ranges that have been nullified */
- if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end))
- return FALSE;
-
if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask))
return FALSE;
@@ -1025,10 +984,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
if (pRes->res_type & type & ResBios)
return FALSE;
- /*If requested, skip over estimated resources */
- if (pRes->res_type & type & ResEstimated)
- return FALSE;
-
if (type & pRes->res_type & ResUnused)
return FALSE;
@@ -1050,33 +1005,10 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
if (pRes->entityIndex > -1)
r_loc = xf86Entities[pRes->entityIndex]->busType;
- switch (type & ResAccMask) {
- case ResExclusive:
- switch (pRes->res_type & ResAccMask) {
- case ResExclusive:
- break;
- case ResShared:
- /* ISA buses are only locally exclusive on a PCI system */
- if (loc == BUS_ISA && r_loc == BUS_PCI)
- return FALSE;
- break;
- }
- break;
- case ResShared:
- switch (pRes->res_type & ResAccMask) {
- case ResExclusive:
- /* ISA buses are only locally exclusive on a PCI system */
- if (loc == BUS_PCI && r_loc == BUS_ISA)
- return FALSE;
- break;
- case ResShared:
- return FALSE;
- }
- break;
- case ResAny:
- break;
- }
-
+ if ((type & ResAccMask) == ResShared &&
+ (pRes->res_type & ResAccMask) == ResShared)
+ return FALSE;
+
if (pRes->entityIndex == entityIndex) return FALSE;
if (pRes->entityIndex > -1 &&
@@ -1106,7 +1038,7 @@ checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
case ResBlock:
if (rgp->rEnd < rgp->rBegin) {
xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
- rgp->rEnd,rgp->rBegin);
+ (long)rgp->rEnd, (long)rgp->rBegin);
return 0;
}
if ((ret = checkConflictBlock(rgp, pRes))) {
@@ -1119,7 +1051,7 @@ checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
if ((rgp->rBase & rgp->rMask) != rgp->rBase) {
xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
"doesn't satisfy (base & mask = mask)\n",
- rgp->rBase, rgp->rMask);
+ (long)rgp->rBase, (long)rgp->rMask);
return 0;
}
if ((ret = checkConflictSparse(rgp, pRes))) {
@@ -1135,30 +1067,21 @@ checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
}
/*
- * ChkConflict() -- used within xxxBus ; find conflict with any location.
- */
-memType
-ChkConflict(resRange *rgp, resPtr res, xf86State state)
-{
- return checkConflict(rgp, res, -2, state,FALSE);
-}
-
-/*
* xf86ChkConflict() - This function is the low level interface to
* the resource broker that gets exported. Tests all resources ie.
* performs test with SETUP flag.
*/
-_X_EXPORT memType
+static memType
xf86ChkConflict(resRange *rgp, int entityIndex)
{
- return checkConflict(rgp, Acc, entityIndex, SETUP,FALSE);
+ return checkConflict(rgp, Acc, entityIndex, SETUP, FALSE);
}
/*
* Resources List handling
*/
-_X_EXPORT resPtr
+static resPtr
xf86JoinResLists(resPtr rlist1, resPtr rlist2)
{
resPtr pRes;
@@ -1175,7 +1098,7 @@ xf86JoinResLists(resPtr rlist1, resPtr rlist2)
return rlist1;
}
-_X_EXPORT resPtr
+resPtr
xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
{
resPtr new;
@@ -1184,7 +1107,7 @@ xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
case ResBlock:
if (range->rEnd < range->rBegin) {
xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
- range->rEnd,range->rBegin);
+ (long)range->rEnd, (long)range->rBegin);
return rlist;
}
break;
@@ -1192,7 +1115,7 @@ xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
if ((range->rBase & range->rMask) != range->rBase) {
xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
"doesn't satisfy (base & mask = mask)\n",
- range->rBase, range->rMask);
+ (long)range->rBase, (long)range->rMask);
return rlist;
}
break;
@@ -1225,7 +1148,7 @@ xf86FreeResList(resPtr rlist)
xfree(rlist);
}
-_X_EXPORT resPtr
+static resPtr
xf86DupResList(const resPtr rlist)
{
resPtr pRes, ret, prev, new;
@@ -1245,7 +1168,7 @@ xf86DupResList(const resPtr rlist)
return ret;
}
-_X_EXPORT void
+static void
xf86PrintResList(int verb, resPtr list)
{
int i = 0;
@@ -1267,14 +1190,17 @@ xf86PrintResList(int verb, resPtr list)
"\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)",
i, list->entityIndex,
(list->res_type & ResDomain) >> 24,
- list->block_begin, list->block_end,
- list->block_end - list->block_begin + 1);
+ (long)list->block_begin,
+ (long)list->block_end,
+ (long)(list->block_end -
+ list->block_begin + 1));
break;
case ResSparse:
xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ",
i, list->entityIndex,
(list->res_type & ResDomain) >> 24,
- list->sparse_base,list->sparse_mask);
+ (long)list->sparse_base,
+ (long)list->sparse_mask);
break;
default:
list = list->next;
@@ -1309,10 +1235,6 @@ xf86PrintResList(int verb, resPtr list)
s = "[?]";
}
xf86ErrorFVerb(verb, "%s", s);
- if (list->res_type & ResEstimated)
- xf86ErrorFVerb(verb, "E");
- if (list->res_type & ResOverlap)
- xf86ErrorFVerb(verb, "O");
if (list->res_type & ResInit)
xf86ErrorFVerb(verb, "t");
if (list->res_type & ResBios)
@@ -1366,187 +1288,10 @@ xf86ResourceBrokerInit(void)
xf86PrintResList(3, Acc);
}
-#define MEM_ALIGN (1024 * 1024)
-
-/*
- * RemoveOverlaps() -- remove overlaps between resources of the
- * same kind.
- * Beware: This function doesn't check for access attributes.
- * At resource broker initialization this is no problem as this
- * only deals with exclusive resources.
- */
-#if 0
-void
-RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
-{
- resPtr pRes;
- memType size, newsize, adjust;
-
- if (!target)
- return;
-
- for (pRes = list; pRes; pRes = pRes->next) {
- if (pRes != target
- && ((pRes->res_type & ResTypeMask) ==
- (target->res_type & ResTypeMask))
- && pRes->block_begin <= target->block_end
- && pRes->block_end >= target->block_begin) {
- /* Possibly ignore estimated resources */
- if (!useEstimated && (pRes->res_type & ResEstimated)) continue;
- /*
- * Target should be a larger region than pRes. If pRes fully
- * contains target, don't do anything unless target can overlap.
- */
- if (pRes->block_begin <= target->block_begin &&
- pRes->block_end >= target->block_end) {
- if (target->res_type & ResOverlap) {
- /* Nullify range but keep its ResOverlap bit on */
- target->block_end = target->block_begin - 1;
- return;
- }
- continue;
- }
- /*
- * In cases where the target and pRes have the same starting
- * address, reduce the size of the target (given it's an estimate).
- */
- if (pRes->block_begin == target->block_begin) {
- if (target->res_type & ResOverlap)
- target->block_end = target->block_begin - 1;
- else
- target->block_end = pRes->block_end;
- }
- /* Otherwise, trim target to remove the overlap */
- else if (pRes->block_begin <= target->block_end) {
- target->block_end = pRes->block_begin - 1;
- } else if (!pow2Alignment &&
- pRes->block_end >= target->block_begin) {
- target->block_begin = pRes->block_end + 1;
- }
- if (pow2Alignment) {
- /*
- * Align to a power of two. This requires finding the
- * largest power of two that is smaller than the adjusted
- * size.
- */
- size = target->block_end - target->block_begin + 1;
- newsize = 1UL << (sizeof(memType) * 8 - 1);
- while (!(newsize & size))
- newsize >>= 1;
- target->block_end = target->block_begin + newsize - 1;
- } else if (target->block_end > MEM_ALIGN) {
- /* Align the end to MEM_ALIGN */
- if ((adjust = (target->block_end + 1) % MEM_ALIGN))
- target->block_end -= adjust;
- }
- }
- }
-}
-#else
-
-void
-RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
-{
- resPtr pRes;
- memType size, newsize, adjust;
-
- if (!target)
- return;
-
- if (!(target->res_type & ResEstimated) /* Don't touch sure resources */
- && !(target->res_type & ResOverlap)) /* Unless they may overlap */
- return;
-
- for (pRes = list; pRes; pRes = pRes->next) {
- if (pRes == target
- || ((pRes->res_type & ResTypeMask) !=
- (target->res_type & ResTypeMask))
- || pRes->block_begin > target->block_end
- || pRes->block_end < target->block_begin)
- continue;
-
- if (pRes->block_begin <= target->block_begin) {
- /* Possibly ignore estimated resources */
- if (!useEstimated && (pRes->res_type & ResEstimated))
- continue;
-
- /* Special cases */
- if (pRes->block_end >= target->block_end) {
- /*
- * If pRes fully contains target, don't do anything
- * unless target can overlap.
- */
- if (target->res_type & ResOverlap) {
- /* Nullify range but keep its ResOverlap bit on */
- target->block_end = target->block_begin - 1;
- return;
- } else
- continue;
- } else {
-#if 0 /* Don't trim start address - we trust what we got */
- /*
- * If !pow2Alignment trim start address: !pow2Alingment
- * is only set when estimated OS addresses are handled.
- * In cases where the target and pRes have the same
- * starting address, reduce the size of the target
- * (given it's an estimate).
- */
- if (!pow2Alignment)
- target->block_begin = pRes->block_end + 1;
- else
-#endif
- if (pRes->block_begin == target->block_begin)
- target->block_end = pRes->block_end;
- else
- continue;
- }
- } else {
- /* Trim target to remove the overlap */
- target->block_end = pRes->block_begin - 1;
- }
- if (pow2Alignment) {
- /*
- * Align to a power of two. This requires finding the
- * largest power of two that is smaller than the adjusted
- * size.
- */
- size = target->block_end - target->block_begin + 1;
- newsize = 1UL << (sizeof(memType) * 8 - 1);
- while (!(newsize & size))
- newsize >>= 1;
- target->block_end = target->block_begin + newsize - 1;
- } else if (target->block_end > MEM_ALIGN) {
- /* Align the end to MEM_ALIGN */
- if ((adjust = (target->block_end + 1) % MEM_ALIGN))
- target->block_end -= adjust;
- }
- }
-}
-
-#endif
-
/*
- * Resource registrarion
+ * Resource registration
*/
-static resList
-xf86GetResourcesImplicitly(int entityIndex)
-{
- if (entityIndex >= xf86NumEntities) return NULL;
-
- switch (xf86Entities[entityIndex]->bus.type) {
- case BUS_ISA:
- case BUS_NONE:
- case BUS_SBUS:
- return NULL;
- case BUS_PCI:
- return NULL;
- case BUS_last:
- return NULL;
- }
- return NULL;
-}
-
static void
convertRange2Host(int entityIndex, resRange *pRange)
{
@@ -1555,9 +1300,6 @@ convertRange2Host(int entityIndex, resRange *pRange)
case BUS_PCI:
pciConvertRange2Host(entityIndex,pRange);
break;
- case BUS_ISA:
- isaConvertRange2Host(pRange);
- break;
default:
break;
}
@@ -1577,24 +1319,19 @@ xf86ConvertListToHost(int entityIndex, resPtr list)
/*
* xf86RegisterResources() -- attempts to register listed resources.
- * If list is NULL it tries to obtain resources implicitly. Function
- * returns a resPtr listing all resources not successfully registered.
+ * Returns a resPtr listing all resources not successfully registered, by
+ * which we mean, NULL.
*/
_X_EXPORT resPtr
xf86RegisterResources(int entityIndex, resList list, unsigned long access)
{
- resPtr res = NULL;
resRange range;
resList list_f = NULL;
- if (!list) {
- list = xf86GetResourcesImplicitly(entityIndex);
- /* these resources have to be in host address space already */
- if (!list) return NULL;
- list_f = list;
- }
-
+ if (!list)
+ return NULL;
+
while(list->type != ResEnd) {
range = *list;
@@ -1604,15 +1341,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
}
range.type &= ~ResEstimated; /* Not allowed for drivers */
-#if !((defined(__alpha__) || (defined(__ia64__))) && defined(linux))
- /* On Alpha Linux, do not check for conflicts, trust the kernel. */
- if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE))
- res = xf86AddResToList(res,&range,entityIndex);
- else
-#endif
- {
- Acc = xf86AddResToList(Acc,&range,entityIndex);
- }
+ Acc = xf86AddResToList(Acc,&range,entityIndex);
list++;
}
if (list_f)
@@ -1621,12 +1350,8 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
#ifdef DEBUG
xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
xf86PrintResList(3, Acc);
- if (res) xf86MsgVerb(X_INFO, 3,
- "Failed Resources after driver initialization "
- "for Entity: %i\n",entityIndex);
- xf86PrintResList(3, res);
#endif
- return res;
+ return NULL;
}
@@ -1635,7 +1360,6 @@ busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem,
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
{
switch (pEnt->bus.type) {
- case BUS_ISA:
case BUS_SBUS:
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
break;
@@ -1733,7 +1457,7 @@ setAccess(EntityPtr pEnt, xf86State state)
if (pEnt->rac->old) {
/* give it to the driver, leave state disabled */
pEnt->rac->old->io = org_io;
- } else if (org_io->AccessEnable) {
+ } else {
/* driver doesn't want it - enable generic access */
org_io->AccessEnable(org_io->arg);
}
@@ -1744,7 +1468,7 @@ setAccess(EntityPtr pEnt, xf86State state)
if (pEnt->rac->old) {
/* give it to the driver, leave state disabled */
pEnt->rac->old->io_mem = org_mem_io;
- } else if (org_mem_io->AccessEnable) {
+ } else {
/* driver doesn't want it - enable generic access */
org_mem_io->AccessEnable(org_mem_io->arg);
}
@@ -1755,7 +1479,7 @@ setAccess(EntityPtr pEnt, xf86State state)
if (pEnt->rac->old) {
/* give it to the driver, leave state disabled */
pEnt->rac->old->mem = org_mem;
- } else if (org_mem->AccessEnable) {
+ } else {
/* driver doesn't want it - enable generic access */
org_mem->AccessEnable(org_mem->arg);
}
@@ -1763,27 +1487,26 @@ setAccess(EntityPtr pEnt, xf86State state)
if (!(prop & NEED_MEM_SHARED)){
if (prop & NEED_MEM) {
- if (acc_mem && acc_mem->AccessEnable)
+ if (acc_mem)
acc_mem->AccessEnable(acc_mem->arg);
} else {
- if (acc_mem && acc_mem->AccessDisable)
+ if (acc_mem)
acc_mem->AccessDisable(acc_mem->arg);
}
}
if (!(prop & NEED_IO_SHARED)) {
if (prop & NEED_IO) {
- if (acc_io && acc_io->AccessEnable)
- acc_io->AccessEnable(acc_io->arg);
+ if (acc_io)
+ acc_io->AccessEnable(acc_io->arg);
} else {
- if (acc_io && acc_io->AccessDisable)
+ if (acc_io)
acc_io->AccessDisable(acc_io->arg);
}
}
/* disable shared resources */
- if (pEnt->access->pAccess
- && pEnt->access->pAccess->AccessDisable)
+ if (pEnt->access->pAccess)
pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg);
/*
@@ -1820,7 +1543,7 @@ SetSIGIOForState(xf86State state)
}
}
-_X_EXPORT void
+void
xf86EnterServerState(xf86State state)
{
EntityPtr pEnt;
@@ -1962,44 +1685,6 @@ xf86SetOperatingState(resList list, int entityIndex, int mask)
/*
* Stage specific code
*/
- /*
- * ProcessEstimatedConflicts() -- Do something about driver-registered
- * resources that conflict with estimated resources. For now, just register
- * them with a logged warning.
- */
-#ifdef REDUCER
-static void
-ProcessEstimatedConflicts(void)
-{
- if (!AccReducers)
- return;
-
- /* Temporary */
- xf86MsgVerb(X_WARNING, 3,
- "Registering the following despite conflicts with estimated"
- " resources:\n");
- xf86PrintResList(3, AccReducers);
- Acc = xf86JoinResLists(Acc, AccReducers);
- AccReducers = NULL;
-}
-#endif
-
-/*
- * xf86ClaimFixedResources() -- This function gets called from the
- * driver Probe() function to claim fixed resources.
- */
-static void
-resError(resList list)
-{
- FatalError("A driver tried to allocate the %s %sresource at \n"
- "0x%lx:0x%lx which conflicted with another resource. Send the\n"
- "output of the server to %s. Please \n"
- "specify your computer hardware as closely as possible.\n",
- ResIsBlock(list)?"Block":"Sparse",
- ResIsMem(list)?"Mem":"Io",
- ResIsBlock(list)?list->rBegin:list->rBase,
- ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR);
-}
/*
* xf86ClaimFixedResources() is used to allocate non-relocatable resources.
@@ -2023,20 +1708,7 @@ xf86ClaimFixedResources(resList list, int entityIndex)
case ResExclusive:
if (!xf86ChkConflict(&range, entityIndex)) {
Acc = xf86AddResToList(Acc, &range, entityIndex);
-#ifdef REDUCER
- } else {
- range.type |= ResEstimated;
- if (!xf86ChkConflict(&range, entityIndex) &&
- !checkConflict(&range, AccReducers, entityIndex,
- SETUP, FALSE)) {
- range.type &= ~(ResEstimated | ResBios);
- AccReducers =
- xf86AddResToList(AccReducers, &range, entityIndex);
-#endif
- } else resError(&range); /* no return */
-#ifdef REDUCER
- }
-#endif
+ } else FatalError("xf86ClaimFixedResources conflict\n");
break;
case ResShared:
/* at this stage the resources are just added to the
@@ -2058,9 +1730,6 @@ xf86ClaimFixedResources(resList list, int entityIndex)
xf86MsgVerb(X_INFO, 3,
"resource ranges after xf86ClaimFixedResources() call:\n");
xf86PrintResList(3,Acc);
-#ifdef REDUCER
- ProcessEstimatedConflicts();
-#endif
#ifdef DEBUG
if (ptr) {
xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
@@ -2156,10 +1825,10 @@ xf86PostProbe(void)
{
memType val;
int i,j;
- resPtr resp, acc, tmp, resp_x, *pprev_next;
+ resPtr resp, acc, tmp, resp_x;
if (fbSlotClaimed) {
- if (pciSlotClaimed || isaSlotClaimed
+ if (pciSlotClaimed
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|| sbusSlotClaimed
#endif
@@ -2176,17 +1845,7 @@ xf86PostProbe(void)
return;
}
}
- /* don't compare against ResInit - remove it from clone.*/
acc = tmp = xf86DupResList(Acc);
- pprev_next = &acc;
- while (tmp) {
- if (tmp->res_type & ResInit) {
- (*pprev_next) = tmp->next;
- xfree(tmp);
- } else
- pprev_next = &(tmp->next);
- tmp = (*pprev_next);
- }
for (i=0; i<xf86NumEntities; i++) {
resp = xf86Entities[i]->resources;
@@ -2199,32 +1858,17 @@ xf86PostProbe(void)
resp_x = resp;
resp = resp->next;
resp_x->next = tmp;
-#ifdef REDUCER
- } else {
- resp->res_type |= ResEstimated;
- if (!checkConflict(&resp->val, acc, i, SETUP, FALSE)) {
- resp->res_type &= ~(ResEstimated | ResBios);
- tmp = AccReducers;
- AccReducers = resp;
- resp = resp->next;
- AccReducers->next = tmp;
-#endif
} else {
- xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
+ xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",
+ (long)val);
resp->res_type &= ~ResEstimated;
tmp = xf86Entities[i]->resources;
xf86Entities[i]->resources = resp;
resp = resp->next;
xf86Entities[i]->resources->next = tmp;
}
-#ifdef REDUCER
- }
-#endif
}
xf86JoinResLists(Acc,resp_x);
-#ifdef REDUCER
- ProcessEstimatedConflicts();
-#endif
}
xf86FreeResList(acc);
@@ -2276,13 +1920,6 @@ checkRequiredResources(int entityIndex)
pAcc = pAcc->next;
}
- /* check if we can separately enable mem/io resources */
- /* XXX we still need to find out how to set this yet */
- if ( ((pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)
- && (pEnt->entityProp & NEED_MEM_SHARED))
- || ((pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)
- && (pEnt->entityProp & NEED_IO_SHARED)) )
- pEnt->entityProp |= NEED_SHARED;
/*
* After we have checked all resources of an entity agains any
* other resource we know if the entity need this resource type
@@ -2290,13 +1927,11 @@ checkRequiredResources(int entityIndex)
* so no need to share it either.
*/
if ((pEnt->entityProp & NEED_MEM_SHARED)
- && (!(pEnt->entityProp & NEED_MEM))
- && (!(pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)))
+ && (!(pEnt->entityProp & NEED_MEM)))
pEnt->entityProp &= ~(unsigned long)NEED_MEM_SHARED;
if ((pEnt->entityProp & NEED_IO_SHARED)
- && (!(pEnt->entityProp & NEED_IO))
- && (!(pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)))
+ && (!(pEnt->entityProp & NEED_IO)))
pEnt->entityProp &= ~(unsigned long)NEED_IO_SHARED;
}
@@ -2730,9 +2365,6 @@ xf86ExtractTypeFromList(resPtr list, unsigned long type)
return ret;
}
-/*------------------------------------------------------------*/
-static void CheckGenericGA(void);
-
/*
* xf86FindPrimaryDevice() - Find the display device which
* was active when the server was started.
@@ -2740,9 +2372,6 @@ static void CheckGenericGA(void);
void
xf86FindPrimaryDevice()
{
- /* if no VGA device is found check for primary PCI device */
- if (primaryBus.type == BUS_NONE && xorgHWAccess)
- CheckGenericGA();
if (primaryBus.type != BUS_NONE) {
char *bus;
char loc[16];
@@ -2756,10 +2385,6 @@ xf86FindPrimaryDevice()
primaryBus.id.pci->dev,
primaryBus.id.pci->func);
break;
- case BUS_ISA:
- bus = "ISA";
- loc[0] = '\0';
- break;
case BUS_SBUS:
bus = "SBUS";
snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum);
@@ -2773,40 +2398,7 @@ xf86FindPrimaryDevice()
}
}
-#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__)
-#include "vgaHW.h"
-#include "compiler.h"
-#endif
-
-/*
- * CheckGenericGA() - Check for presence of a VGA device.
- */
-static void
-CheckGenericGA()
-{
-/* This needs to be changed for multiple domains */
-#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__)
- IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
- CARD8 CurrentValue, TestValue;
-
- /* VGA CRTC registers are not used here, so don't bother unlocking them */
-
- /* VGA has one more read/write attribute register than EGA */
- (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */
- outb(VGA_ATTR_INDEX, 0x14 | 0x20);
- CurrentValue = inb(VGA_ATTR_DATA_R);
- outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F);
- outb(VGA_ATTR_INDEX, 0x14 | 0x20);
- TestValue = inb(VGA_ATTR_DATA_R);
- outb(VGA_ATTR_DATA_W, CurrentValue);
-
- if ((CurrentValue ^ 0x0F) == TestValue) {
- primaryBus.type = BUS_ISA;
- }
-#endif
-}
-
-_X_EXPORT Bool
+Bool
xf86NoSharedResources(int screenIndex,resType res)
{
int j;