diff options
author | Keith Packard <keithp@keithp.com> | 2008-11-25 22:19:08 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-11-25 22:19:08 -0800 |
commit | 4715f079b9c61362755c95c1ebf89c97cc6fff2b (patch) | |
tree | d9db5974fbbb38225a0eb389c5782ac779e20530 /hw | |
parent | 9ffc6719390df8fdd0a5295a7a7a0eaea792be45 (diff) | |
parent | ed597f19fdc3017dde6d1452b5cdf8ddcd69a5b1 (diff) |
Merge commit 'origin/master'
Diffstat (limited to 'hw')
70 files changed, 324 insertions, 2681 deletions
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 1bc95a8fc..d289d7335 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -578,14 +578,14 @@ hostx_get_visual_masks (EphyrScreenInfo screen, } static int -hostx_calculate_color_shift(unsigned long mask, - int bits_per_rgb) +hostx_calculate_color_shift(unsigned long mask) { - int shift = 0; - while(mask) { - mask = mask >> bits_per_rgb; - if (mask) shift += bits_per_rgb; - } + int shift = 1; + /* count # of bits in mask */ + while (mask=(mask>>1)) shift++; + /* cmap entry is an unsigned char so adjust it by size of that */ + shift = shift - sizeof(unsigned char) * 8; + if (shift < 0) shift = 0; return shift; } @@ -601,12 +601,9 @@ hostx_set_cmap_entry(unsigned char idx, static int first_time = 1; if (first_time) { first_time = 0; - rshift = hostx_calculate_color_shift(HostX.visual->red_mask, - HostX.visual->bits_per_rgb); - gshift = hostx_calculate_color_shift(HostX.visual->green_mask, - HostX.visual->bits_per_rgb); - bshift = hostx_calculate_color_shift(HostX.visual->blue_mask, - HostX.visual->bits_per_rgb); + rshift = hostx_calculate_color_shift(HostX.visual->red_mask); + gshift = hostx_calculate_color_shift(HostX.visual->green_mask); + bshift = hostx_calculate_color_shift(HostX.visual->blue_mask); } HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) | ((g << gshift) & HostX.visual->green_mask) | diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 06d53c14b..77ab4c386 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -14,7 +14,7 @@ XISOURCES = xf86Xinput.c xisb.c XISDKINCS = xf86Xinput.h xisb.h RANDRSOURCES = xf86RandR.c -BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) +BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes @@ -27,8 +27,7 @@ BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86DGA.c xf86DPMS.c \ - xf86DoProbe.c xf86Events.c \ - xf86Globals.c xf86AutoConfig.c \ + xf86Events.c xf86Globals.c xf86AutoConfig.c \ xf86Option.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \ diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index f55219b9b..285d9a3f6 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -1541,8 +1541,6 @@ extern void (*xf86WriteMmio32)(int, void *, unsigned long); extern void (*xf86WriteMmioNB8)(int, void *, unsigned long); extern void (*xf86WriteMmioNB16)(int, void *, unsigned long); extern void (*xf86WriteMmioNB32)(int, void *, unsigned long); -extern void xf86JensenMemToBus(char *, long, long, int); -extern void xf86JensenBusToMem(char *, char *, unsigned long, int); extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); @@ -1556,20 +1554,13 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); # define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) # endif -# if defined (JENSEN_SUPPORT) -# define MMIO_OUT32(base, offset, val) \ - (*xf86WriteMmio32)((CARD32)(val), base, offset) -# define MMIO_ONB32(base, offset, val) \ - (*xf86WriteMmioNB32)((CARD32)(val), base, offset) -# else -# define MMIO_OUT32(base, offset, val) \ +# define MMIO_OUT32(base, offset, val) \ do { \ write_mem_barrier(); \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ } while (0) -# define MMIO_ONB32(base, offset, val) \ +# define MMIO_ONB32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) -# endif # define MMIO_OUT8(base, offset, val) \ (*xf86WriteMmio8)((CARD8)(val), base, offset) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 4432c551b..a32aa9bcc 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -66,7 +66,6 @@ extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; extern ScrnInfoPtr xf86CurrentScreen; extern Bool pciSlotClaimed; -extern Bool isaSlotClaimed; extern Bool fbSlotClaimed; #if defined(__sparc__) || defined(__sparc) extern Bool sbusSlotClaimed; @@ -103,16 +102,12 @@ Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); void xf86FormatPciBusNumber(int busnum, char *buffer); resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); -int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -int xf86GetIsaInfoForScreen(int scrnIndex); int xf86GetFbInfoForScreen(int scrnIndex); -Bool xf86ParseIsaBusString(const char *busID); int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); void xf86EnableAccess(ScrnInfoPtr pScrn); void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); Bool xf86IsPrimaryPci(struct pci_device * pPci); -Bool xf86IsPrimaryIsa(void); /* new RAC */ resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex); void xf86FreeResList(resPtr rlist); @@ -159,8 +154,6 @@ DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); /* xf86Configure.c */ GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset); -GDevPtr xf86AddDeviceToConfigure( const char *driver, - struct pci_device * pVideo, int chipset ); /* xf86Cursor.c */ @@ -243,10 +236,6 @@ int xf86MatchPciInstances(const char *driverName, int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities); -int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, - IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, - int numDevs, int **foundEntities); void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), void (*ProtectRegs)(ScrnInfoPtr, Bool), @@ -297,11 +286,6 @@ ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, resList res, EntityProc init, EntityProc enter, EntityProc leave, pointer private); -ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, @@ -313,19 +297,10 @@ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, EntityProc enter, EntityProc leave, pointer private); /* Obsolete! don't use */ -Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, resList res, EntityProc init, EntityProc enter, EntityProc leave, pointer private); -void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, EntityProc enter, EntityProc leave, pointer private); @@ -369,13 +344,14 @@ void xf86PruneDriverModes(ScrnInfoPtr scrp); void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); void xf86PrintModes(ScrnInfoPtr scrp); void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); -double xf86ModeHSync(DisplayModePtr mode); -double xf86ModeVRefresh(DisplayModePtr mode); +double xf86ModeHSync(const DisplayModeRec *mode); +double xf86ModeVRefresh(const DisplayModeRec *mode); void xf86SetModeDefaultName(DisplayModePtr mode); void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); -DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode); +DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); -Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2); +Bool xf86ModesEqual(const DisplayModeRec *pMode1, + const DisplayModeRec *pMode2); void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 758560d14..3236b5a4f 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/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 */ @@ -71,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; @@ -99,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. * @@ -144,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) @@ -163,8 +152,6 @@ void xf86EntityInit(void) { int i; - resPtr *pprev_next; - resPtr res; xf86AccessPtr pacc; for (i = 0; i < xf86NumEntities; i++) @@ -176,17 +163,6 @@ xf86EntityInit(void) pacc->AccessEnable(pacc->arg); xf86Entities[i]->entityInit(i,xf86Entities[i]->private); 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); - } } } @@ -248,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: @@ -1000,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; @@ -1014,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; @@ -1039,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 && @@ -1289,10 +1232,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) @@ -1346,117 +1285,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. - */ - -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; - } - } -} - /* * 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) { @@ -1465,9 +1297,6 @@ convertRange2Host(int entityIndex, resRange *pRange) case BUS_PCI: pciConvertRange2Host(entityIndex,pRange); break; - case BUS_ISA: - isaConvertRange2Host(pRange); - break; default: break; } @@ -1487,24 +1316,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; @@ -1514,15 +1338,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) @@ -1532,11 +1348,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access) xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n"); xf86PrintResList(3, Acc); #endif - if (res) { - xf86MsgVerb(X_INFO, 3, "Failed to register resources:\n"); - xf86PrintResList(3, res); - } - return res; + return NULL; } @@ -1545,7 +1357,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; @@ -1871,44 +1682,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. @@ -1932,20 +1705,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 @@ -1967,9 +1727,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"); @@ -2065,10 +1822,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 @@ -2085,17 +1842,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; @@ -2108,16 +1855,6 @@ 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); resp->res_type &= ~ResEstimated; @@ -2126,14 +1863,8 @@ xf86PostProbe(void) resp = resp->next; xf86Entities[i]->resources->next = tmp; } -#ifdef REDUCER - } -#endif } xf86JoinResLists(Acc,resp_x); -#ifdef REDUCER - ProcessEstimatedConflicts(); -#endif } xf86FreeResList(acc); @@ -2630,9 +2361,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. @@ -2640,9 +2368,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]; @@ -2656,10 +2381,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); @@ -2673,39 +2394,6 @@ xf86FindPrimaryDevice() } } -#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__) && !defined(__m32r__) -#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__) && !defined(__m32r__) - 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 -} - Bool xf86NoSharedResources(int screenIndex,resType res) { diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index c5f5dcce7..c2d5bb7d4 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -140,7 +140,5 @@ BusType StringToBusType(const char* busID, const char **retID); Bool xf86IsSubsetOf(resRange range, resPtr list); resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); resPtr xf86FindIntersect(resRange Range, resPtr list); -void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, - Bool useEstimated); #endif /* _XF86_BUS_H */ diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 6680a618e..87004966a 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -115,18 +115,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int return NULL; isPrimary = xf86IsPrimaryPci(pVideo); break; - case BUS_ISA: - /* - * This needs to be revisited as it doesn't allow for non-PCI - * multihead. - */ - if (!xf86IsPrimaryIsa()) - return NULL; - isPrimary = TRUE; - for (i = 0; i < nDevToConfig; i++) - if (!DevToConfig[i].pVideo) - return NULL; - break; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: for (i = 0; i < nDevToConfig; i++) @@ -202,10 +190,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset = (pVideo->vendor_id << 16) | pVideo->device_id; } break; - case BUS_ISA: - NewDevice.GDev.identifier = "ISA Adapter"; - NewDevice.GDev.busID = "ISA"; - break; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: { char *promPath = NULL; @@ -241,17 +225,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int # undef NewDevice } -/* - * Backwards compatibility - */ -_X_EXPORT GDevPtr -xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo, - int chipset) -{ - return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA, - pVideo, chipset); -} - static XF86ConfInputPtr configureInputSection (void) { @@ -662,12 +635,17 @@ configureDDCMonitorSection (int screennum) return ptr; } +#if !defined(PATH_MAX) +# define PATH_MAX 1024 +#endif + void -DoConfigure() +DoConfigure(void) { int i,j, screennum = -1; char *home = NULL; - char *filename = NULL; + char filename[PATH_MAX]; + char *addslash = ""; XF86ConfigPtr xf86config = NULL; char **vlist, **vl; int *dev2screen; @@ -765,29 +743,21 @@ DoConfigure() xf86config->conf_input_lst = configureInputSection(); xf86config->conf_layout_lst = configureLayoutSection(); - if (!(home = getenv("HOME"))) + home = getenv("HOME"); + if ((home == NULL) || (home[0] == '\0')) { home = "/"; - { -#if !defined(PATH_MAX) -#define PATH_MAX 1024 -#endif - const char* configfile = XF86CONFIGFILE".new"; - char homebuf[PATH_MAX]; - /* getenv might return R/O memory, as with OS/2 */ - strncpy(homebuf,home,PATH_MAX-1); - homebuf[PATH_MAX-1] = '\0'; - home = homebuf; - if (!(filename = - (char *)xalloc(strlen(home) + - strlen(configfile) + 3))) - goto bail; - - if (home[0] == '/' && home[1] == '\0') - home[0] = '\0'; - sprintf(filename, "%s/%s", home,configfile); - + } else { + /* Determine if trailing slash is present or needed */ + int l = strlen(home); + + if (home[l-1] != '/') { + addslash = "/"; + } } + snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new", + home, addslash); + xf86writeConfigFile(filename, xf86config); xf86DoConfigurePass1 = FALSE; diff --git a/hw/xfree86/common/xf86DoProbe.c b/hw/xfree86/common/xf86DoProbe.c deleted file mode 100644 index bba6ab7e8..000000000 --- a/hw/xfree86/common/xf86DoProbe.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * finish setting up the server - * Load the driver modules and call their probe functions. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <ctype.h> -#include <stdlib.h> -#include <X11/X.h> -#include <X11/Xmd.h> -#include "os.h" -#include "loaderProcs.h" -#include "xf86Config.h" -#include "xf86_OSlib.h" -#include "xf86.h" -#include "xf86Priv.h" - -void -DoProbe() -{ - int i; - Bool probeResult; - Bool ioEnableFailed = FALSE; - - /* Find the list of video driver modules. */ - char **list = xf86DriverlistFromCompile(); - char **l; - - if (list) { - ErrorF("List of video driver modules:\n"); - for (l = list; *l; l++) - ErrorF("\t%s\n", *l); - } else { - ErrorF("No video driver modules found\n"); - } - - /* Load all the drivers that were found. */ - xf86LoadModules(list, NULL); - - /* Disable PCI devices */ - xf86AccessInit(); - - /* Call all of the probe functions, reporting the results. */ - for (i = 0; i < xf86NumDrivers; i++) { - DriverRec * const drv = xf86DriverList[i]; - - if (!xorgHWAccess) { - xorgHWFlags flags; - if (!drv->driverFunc - || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) - || NEED_IO_ENABLED(flags)) { - if (ioEnableFailed) - continue; - if (!xf86EnableIO()) { - ioEnableFailed = TRUE; - continue; - } - xorgHWAccess = TRUE; - } - } - - - xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName); - - probeResult = xf86CallDriverProbe( drv, TRUE ); - if (!probeResult) { - xf86ErrorF("Probe in driver `%s' returns FALSE\n", - drv->driverName); - } else { - xf86ErrorF("Probe in driver `%s' returns TRUE\n", - drv->driverName); - - /* If we have a result, then call driver's Identify function */ - if (drv->Identify != NULL) { - const int verbose = xf86SetVerbosity(1); - (*drv->Identify)(0); - xf86SetVerbosity(verbose); - } - } - } - - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 3e2316408..00df10574 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1683,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 @@ -1953,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 ... */ @@ -2094,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 */ @@ -2122,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); @@ -2557,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, @@ -2675,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, @@ -2740,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 @@ -2768,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) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index c35cb2c38..922e7b35d 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -548,8 +548,8 @@ add_matching_devices_to_configure_list(DriverPtr drvp) && ((devices[j].device_class_mask & pPci->device_class) == devices[j].device_class) ) { if (xf86CheckPciSlot(pPci)) { - GDevPtr pGDev = - xf86AddDeviceToConfigure(drvp->driverName, pPci, -1); + GDevPtr pGDev = xf86AddBusDeviceToConfigure( + drvp->driverName, BUS_PCI, pPci, -1); if (pGDev != NULL) { /* After configure pass 1, chipID and chipRev are * treated as over-rides, so clobber them here. @@ -643,6 +643,75 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) return foundScreen; } +static void +DoProbe(void) +{ + int i; + Bool probeResult; + Bool ioEnableFailed = FALSE; + + /* Find the list of video driver modules. */ + char **list = xf86DriverlistFromCompile(); + char **l; + + if (list) { + ErrorF("List of video driver modules:\n"); + for (l = list; *l; l++) + ErrorF("\t%s\n", *l); + } else { + ErrorF("No video driver modules found\n"); + } + + /* Load all the drivers that were found. */ + xf86LoadModules(list, NULL); + + /* Disable PCI devices */ + xf86AccessInit(); + + /* Call all of the probe functions, reporting the results. */ + for (i = 0; i < xf86NumDrivers; i++) { + DriverRec * const drv = xf86DriverList[i]; + + if (!xorgHWAccess) { + xorgHWFlags flags; + if (!drv->driverFunc + || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) + || NEED_IO_ENABLED(flags)) { + if (ioEnableFailed) + continue; + if (!xf86EnableIO()) { + ioEnableFailed = TRUE; + continue; + } + xorgHWAccess = TRUE; + } + } + + + xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName); + + probeResult = xf86CallDriverProbe( drv, TRUE ); + if (!probeResult) { + xf86ErrorF("Probe in driver `%s' returns FALSE\n", + drv->driverName); + } else { + xf86ErrorF("Probe in driver `%s' returns TRUE\n", + drv->driverName); + + /* If we have a result, then call driver's Identify function */ + if (drv->Identify != NULL) { + const int verbose = xf86SetVerbosity(1); + (*drv->Identify)(0); + xf86SetVerbosity(verbose); + } + } + } + + OsCleanup(TRUE); + AbortDDX(); + fflush(stderr); + exit(0); +} /* * InitOutput -- diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index f3dfd70d8..5de48ac77 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -150,9 +150,10 @@ Bool xf86PathIsSafe(const char *path); extern const DisplayModeRec xf86DefaultModes[]; extern const int xf86NumDefaultModes; -/* xf86DoProbe.c */ -void DoProbe(void); +/* xf86Configure.c */ void DoConfigure(void); + +/* xf86ShowOpts.c */ void DoShowOptions(void); /* xf86Events.c */ diff --git a/hw/xfree86/common/xf86isaBus.c b/hw/xfree86/common/xf86isaBus.c deleted file mode 100644 index 3abad38ef..000000000 --- a/hw/xfree86/common/xf86isaBus.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1997-2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <ctype.h> -#include <stdlib.h> -#include <unistd.h> -#include <X11/X.h> -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -Bool isaSlotClaimed = FALSE; - -/* - * If the slot requested is already in use, return FALSE. - * Otherwise, claim the slot for the screen requesting it. - */ - -_X_EXPORT int -xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p; - BusAccPtr pbap = xf86BusAccInfo; - int num; - - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = chipset; - p->busType = BUS_ISA; - p->active = active; - p->inUse = FALSE; - xf86AddDevToEntity(num, dev); - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - p->busAcc = NULL; - while (pbap) { - if (pbap->type == BUS_ISA) - p->busAcc = pbap; - pbap = pbap->next; - } - isaSlotClaimed = TRUE; - return num; -} - -/* - * Get the list of ISA "slots" claimed by a screen - * - * Note: The ISA implementation here assumes that only one ISA "slot" type - * can be claimed by any one screen. That means a return value other than - * 0 or 1 isn't useful. - */ -int -xf86GetIsaInfoForScreen(int scrnIndex) -{ - int num = 0; - int i; - EntityPtr p; - - for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) { - p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]; - if (p->busType == BUS_ISA) { - num++; - } - } - return num; -} - -/* - * Parse a BUS ID string, and return True if it is a ISA bus id. - */ - -_X_EXPORT Bool -xf86ParseIsaBusString(const char *busID) -{ - /* - * The format assumed to be "isa" or "isa:" - */ - return (StringToBusType(busID,NULL) == BUS_ISA); -} - - -/* - * xf86IsPrimaryIsa() -- return TRUE if primary device - * is ISA. - */ - -_X_EXPORT Bool -xf86IsPrimaryIsa(void) -{ - return ( primaryBus.type == BUS_ISA ); -} - -void -isaConvertRange2Host(resRange *pRange) -{ - return; -} diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index d5ae75b3a..b6ec4adbb 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -564,11 +564,6 @@ initPciBusState(void) pbap->disable_f = pciBusAccessDisable; savePciBusState(pbap); break; - case PCI_SUBCLASS_BRIDGE_ISA: - case PCI_SUBCLASS_BRIDGE_EISA: - case PCI_SUBCLASS_BRIDGE_MC: - pbap->type = BUS_ISA; - break; } pbap->next = xf86BusAccInfo; xf86BusAccInfo = pbap; diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h index 7d08502fc..1cbfa38ea 100644 --- a/hw/xfree86/common/xf86pciBus.h +++ b/hw/xfree86/common/xf86pciBus.h @@ -70,6 +70,5 @@ void PciBusStateEnter(void); void PciStateLeave(void); void PciBusStateLeave(void); void pciConvertRange2Host(int entityIndex, resRange *pRange); -void isaConvertRange2Host(resRange *pRange); #endif /* _XF86_PCI_BUS_H */ diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 8c211234b..904c369a6 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -383,17 +383,12 @@ typedef enum { struct pci_device; typedef struct { - unsigned int dummy; -} IsaBusId; - -typedef struct { int fbNum; } SbusBusId; typedef struct _bus { BusType type; union { - IsaBusId isa; struct pci_device *pci; SbusBusId sbus; } id; @@ -436,8 +431,6 @@ typedef struct { int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; -typedef int (*FindIsaDevProc)(GDevPtr dev); - typedef struct { char * identifier; char * driver; @@ -623,9 +616,6 @@ typedef struct _CurrAccRec { #define ResMem 0x0001 #define ResIo 0x0002 -#define ResIrq 0x0003 -#define ResDma 0x0004 -#define ResPciCfg 0x000e /* PCI Configuration space */ #define ResPhysMask 0x000F #define ResExclusive 0x0010 @@ -648,7 +638,6 @@ typedef struct _CurrAccRec { #define ResMiscMask 0x00F000 #define ResBus 0x010000 -#define ResOverlap 0x020000 #if defined(__alpha__) && defined(linux) # define ResDomain 0x1ff000000ul @@ -687,7 +676,6 @@ typedef struct _CurrAccRec { #define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock) #define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse) #define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated) -#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap)) typedef struct { unsigned long type; /* shared, exclusive, unused etc. */ @@ -722,11 +710,6 @@ typedef struct _resRec { #define block_end val.rEnd #define res_type val.type -typedef struct { - int numChipset; - resRange *resList; -} IsaChipsets; - typedef struct _PciChipsets { /** * Key used to match this device with its name in an array of diff --git a/hw/xfree86/dummylib/xf86info.c b/hw/xfree86/dummylib/xf86info.c index 221a9d2bb..7db6817c3 100644 --- a/hw/xfree86/dummylib/xf86info.c +++ b/hw/xfree86/dummylib/xf86info.c @@ -8,5 +8,5 @@ #include "xf86Priv.h" /* Dummy variables */ -xf86InfoRec xf86Info = {NULL, }; +xf86InfoRec xf86Info; diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index d04d0a25e..0af7c1baa 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -220,19 +220,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size); break; } - case BUS_ISA: - vbiosMem = (unsigned char *)sysMem + bios_location; -#if 0 - memset(vbiosMem, 0, V_BIOS_SIZE); - if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE) - < V_BIOS_SIZE) - xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%x.\n",bios_location); -#endif - if (!int10_check_bios(screen, bios_location >> 4, vbiosMem)) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); - goto error1; - } default: goto error1; } diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index 15eba4928..1c89ce508 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -32,6 +32,8 @@ #include "Pci.h" #ifdef _X86EMU #include "x86emu/x86emui.h" +#else +#define DEBUG_IO_TRACE() 0 #endif #include <pciaccess.h> diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 70c54a76a..e98f013c4 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -1134,24 +1134,6 @@ UnloadSubModule(ModuleDescPtr mod) } static void -FreeModuleDesc(ModuleDescPtr head) -{ - ModuleDescPtr sibs, prev; - - if (head == (ModuleDescPtr) 1) - return; - if (head->child) - FreeModuleDesc(head->child); - sibs = head; - while (sibs) { - prev = sibs; - sibs = sibs->sib; - TestFree(prev->name); - xfree(prev); - } -} - -static void RemoveChild(ModuleDescPtr child) { ModuleDescPtr mdp; diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 234635600..6378948d4 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -244,8 +244,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86ReadBIOS) SYMFUNC(xf86EnableIO) SYMFUNC(xf86DisableIO) - SYMFUNC(xf86DisableInterrupts) - SYMFUNC(xf86EnableInterrupts) SYMFUNC(xf86LinearVidMem) SYMFUNC(xf86CheckMTRR) SYMFUNC(xf86MapVidMem) @@ -253,7 +251,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86MapReadSideEffects) SYMFUNC(xf86MapDomainMemory) SYMFUNC(xf86UDelay) - SYMFUNC(xf86IODelay) SYMFUNC(xf86SlowBcopy) SYMFUNC(xf86SetReallySlowBcopy) #ifdef __alpha__ @@ -296,17 +293,14 @@ _X_HIDDEN void *xfree86LookupTab[] = { /* xf86Bus.c */ SYMFUNC(xf86CheckPciSlot) SYMFUNC(xf86ClaimPciSlot) - SYMFUNC(xf86ClaimIsaSlot) SYMFUNC(xf86ClaimFbSlot) SYMFUNC(xf86ClaimNoSlot) SYMFUNC(xf86ParsePciBusString) SYMFUNC(xf86ComparePciBusString) SYMFUNC(xf86FormatPciBusNumber) - SYMFUNC(xf86ParseIsaBusString) SYMFUNC(xf86EnableAccess) SYMFUNC(xf86SetCurrentAccess) SYMFUNC(xf86IsPrimaryPci) - SYMFUNC(xf86IsPrimaryIsa) SYMFUNC(xf86FreeResList) SYMFUNC(xf86ClaimFixedResources) SYMFUNC(xf86AddEntityToScreen) @@ -337,9 +331,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86AllocateEntityPrivateIndex) SYMFUNC(xf86GetEntityPrivate) - /* xf86Configure.c */ - SYMFUNC(xf86AddDeviceToConfigure) - /* xf86Cursor.c */ SYMFUNC(xf86GetPointerScreenFuncs) @@ -414,7 +405,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86PrintChipsets) SYMFUNC(xf86MatchDevice) SYMFUNC(xf86MatchPciInstances) - SYMFUNC(xf86MatchIsaInstances) SYMFUNC(xf86GetVerbosity) SYMFUNC(xf86GetVisualName) SYMFUNC(xf86GetPix24) @@ -454,12 +444,9 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86FindXvOptions) SYMFUNC(xf86GetOS) SYMFUNC(xf86ConfigPciEntity) - SYMFUNC(xf86ConfigIsaEntity) SYMFUNC(xf86ConfigFbEntity) SYMFUNC(xf86ConfigActivePciEntity) - SYMFUNC(xf86ConfigActiveIsaEntity) SYMFUNC(xf86ConfigPciEntityInactive) - SYMFUNC(xf86ConfigIsaEntityInactive) SYMFUNC(xf86IsScreenPrimary) SYMFUNC(xf86RegisterRootWindowProperty) SYMFUNC(xf86IsUnblank) @@ -654,7 +641,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(pciTag) SYMFUNC(pciBusAddrToHostAddr) - SYMFUNC(xf86scanpci) /* Loader functions */ SYMFUNC(LoadSubModule) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index bea2f7e64..5ed61c1d0 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -418,7 +418,7 @@ MonitorStandardTimingLevel(xf86MonPtr DDC) } static int -ModeRefresh(DisplayModePtr mode) +ModeRefresh(const DisplayModeRec *mode) { return (int)(xf86ModeVRefresh(mode) + 0.5); } @@ -432,7 +432,7 @@ static DisplayModePtr FindDMTMode(int hsize, int vsize, int refresh, Bool rb) { int i; - DisplayModePtr ret; + const DisplayModeRec *ret; for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) { ret = &DMTModes[i]; diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 0fdfbdb85..1522fa731 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -52,7 +52,7 @@ extern XF86ConfigPtr xf86configptr; * Exact copy of xf86Mode.c's. */ _X_EXPORT double -xf86ModeHSync(DisplayModePtr mode) +xf86ModeHSync(const DisplayModeRec *mode) { double hsync = 0.0; @@ -70,7 +70,7 @@ xf86ModeHSync(DisplayModePtr mode) * Exact copy of xf86Mode.c's. */ _X_EXPORT double -xf86ModeVRefresh(DisplayModePtr mode) +xf86ModeVRefresh(const DisplayModeRec *mode) { double refresh = 0.0; @@ -89,7 +89,7 @@ xf86ModeVRefresh(DisplayModePtr mode) } _X_EXPORT int -xf86ModeWidth (DisplayModePtr mode, Rotation rotation) +xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: @@ -104,7 +104,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation) } _X_EXPORT int -xf86ModeHeight (DisplayModePtr mode, Rotation rotation) +xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: @@ -206,7 +206,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) * Allocates and returns a copy of pMode, including pointers within pMode. */ _X_EXPORT DisplayModePtr -xf86DuplicateMode(DisplayModePtr pMode) +xf86DuplicateMode(const DisplayModeRec *pMode) { DisplayModePtr pNew; @@ -264,7 +264,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) * This isn't in xf86Modes.c, but it might deserve to be there. */ _X_EXPORT Bool -xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2) +xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2) { if (pMode1->Clock == pMode2->Clock && pMode1->HDisplay == pMode2->HDisplay && @@ -519,7 +519,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, } Bool -xf86ModeIsReduced(DisplayModePtr mode) +xf86ModeIsReduced(const DisplayModeRec *mode) { if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && ((mode->HTotal - mode->HDisplay) == 160) && @@ -698,7 +698,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) for (i = 0; i < xf86NumDefaultModes; i++) { - DisplayModePtr defMode = &xf86DefaultModes[i]; + const DisplayModeRec *defMode = &xf86DefaultModes[i]; if (!interlaceAllowed && (defMode->Flags & V_INTERLACE)) continue; diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index af5987b24..2fb6a374d 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -40,22 +40,23 @@ #include "xf86Rename.h" #endif -double xf86ModeHSync(DisplayModePtr mode); -double xf86ModeVRefresh(DisplayModePtr mode); +double xf86ModeHSync(const DisplayModeRec *mode); +double xf86ModeVRefresh(const DisplayModeRec *mode); unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); int -xf86ModeWidth (DisplayModePtr mode, Rotation rotation); +xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation); int -xf86ModeHeight (DisplayModePtr mode, Rotation rotation); +xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation); -DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode); +DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); void xf86SetModeDefaultName(DisplayModePtr mode); void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); -Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2); +Bool xf86ModesEqual(const DisplayModeRec *pMode1, + const DisplayModeRec *pMode2); void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); @@ -65,7 +66,7 @@ DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); Bool -xf86ModeIsReduced(DisplayModePtr mode); +xf86ModeIsReduced(const DisplayModeRec *mode); void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index 523c4488e..9de25f66b 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -433,24 +433,6 @@ xf86DisableIO() #endif /* USE_ALPHA_PIO */ -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - return; -} - - #define vuip volatile unsigned int * static unsigned long msb_set = 0; diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index 23948b5d6..a0ebdf2e6 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -522,27 +522,6 @@ xf86DisableIO() #endif /* USE_ARC_MMAP */ - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} - - - #if 0 /* * XXX This is here for reference. It needs to be handled differently for the diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 9a28611ca..83dabc9c6 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -444,38 +444,6 @@ xf86DisableIO() #endif - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - return; -} - - #ifdef __NetBSD__ /***************************************************************************/ /* Set TV output mode */ diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c index 06be654e1..f1ff64c2a 100644 --- a/hw/xfree86/os-support/bsd/ppc_video.c +++ b/hw/xfree86/os-support/bsd/ppc_video.c @@ -123,24 +123,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return rv; } -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} - Bool xf86EnableIO() { int fd = xf86Info.screenFd; diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c index fb5e8529b..fe3b5e7f2 100644 --- a/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/hw/xfree86/os-support/bsd/sparc64_video.c @@ -89,21 +89,3 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return (0); } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index 5199340fc..92a519bcc 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -11,10 +11,6 @@ if XORG_BUS_BSDPCI PCI_SOURCES += bsd_pci.c endif -if XORG_BUS_IX86PCI -PCI_SOURCES += ix86Pci.c -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 5dccd39dc..8ca2f1f9b 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -138,13 +138,13 @@ /* Global data */ -pciBusInfo_t *pciBusInfo = NULL; +pciBusFuncs_t *pciBusFuncs = NULL; _X_EXPORT ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { - if (pciBusInfo->funcs->pciAddrBusToHost) - return pciBusInfo->funcs->pciAddrBusToHost(tag, type, addr); + if (pciBusFuncs && pciBusFuncs->pciAddrBusToHost) + return pciBusFuncs->pciAddrBusToHost(tag, type, addr); else return addr; } @@ -161,7 +161,7 @@ pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr) return(addr); } -_X_EXPORT Bool +Bool xf86scanpci(void) { Bool success = FALSE; diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 2eb1745a7..5feb73349 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -168,37 +168,15 @@ #endif /* !defined(DEBUGPCI) */ -/* - * PCI Config mechanism definitions - */ -#define PCI_EN 0x80000000 - -#define PCI_CFGMECH1_ADDRESS_REG 0xCF8 -#define PCI_CFGMECH1_DATA_REG 0xCFC - -#define PCI_CFGMECH1_MAXDEV 32 - #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__DragonFly__) || defined(__sun) #define ARCH_PCI_INIT bsdPciInit #endif #if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# if defined(__m32r__) -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif +#define ARCH_PCI_INIT linuxPciInit #endif /* defined(linux) */ - -#if !defined(ARCH_PCI_INIT) -#warning You really need to port to libpciaccess. -#if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) -#define ARCH_PCI_INIT ix86PciInit -#endif /* i386/amd64 */ -#endif /* !defined(ARCH_PCI_INIT) */ - #ifndef ARCH_PCI_INIT #error No PCI support available for this architecture/OS combination #endif @@ -213,34 +191,9 @@ typedef struct pci_bus_funcs { ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS); } pciBusFuncs_t, *pciBusFuncs_p; -/* - * pciBusInfo_t - One structure per defined PCI bus - */ -typedef struct pci_bus_info { - unsigned char configMech; /* PCI config type to use */ - unsigned char numDevices; /* Range of valid devnums */ - unsigned char secondary; /* Boolean: bus is a secondary */ - int primary_bus; /* Parent bus */ - pciBusFuncs_p funcs; /* PCI access functions */ - void *pciBusPriv; /* Implementation private data */ - struct pci_device *bridge; /* bridge that opens this bus */ -} pciBusInfo_t; - -#define HOST_NO_BUS ((pciBusInfo_t *)(-1)) - -/* configMech values */ -#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */ -#define PCI_CFG_MECH_1 1 /* Most machines */ -#define PCI_CFG_MECH_2 2 /* Older PC's */ -#define PCI_CFG_MECH_OTHER 3 /* Something else */ - /* Generic PCI service functions and helpers */ -CARD32 pciCfgMech1Read(PCITAG tag, int offset); -void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val); -void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, - CARD32 val); ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); -extern pciBusInfo_t *pciBusInfo; +extern pciBusFuncs_t *pciBusFuncs; #endif /* _PCI_H */ diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c index 7becc0a17..9b55d3a44 100644 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ b/hw/xfree86/os-support/bus/bsd_pci.c @@ -48,20 +48,6 @@ #include "pciaccess.h" -static pciBusFuncs_t bsd_funcs = { - .pciAddrBusToHost = pciAddrNOOP, -}; - -static pciBusInfo_t bsd_pci = { - .configMech = PCI_CFG_MECH_OTHER, - .numDevices = 32, - .secondary = FALSE, - .primary_bus = 0, - .funcs = &bsd_funcs, - .pciBusPriv = NULL, - .bridge = NULL, -}; - _X_EXPORT pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, ADDRESS Base, unsigned long Size) @@ -79,7 +65,5 @@ xf86MapLegacyIO(struct pci_device *dev) void bsdPciInit(void) { - pciBusInfo = &bsd_pci; - xf86InitVidMem(); } diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c deleted file mode 100644 index a279363d9..000000000 --- a/hw/xfree86/os-support/bus/ix86Pci.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * ix86Pci.c - x86 PCI driver - * - * The XFree86 server PCI access functions have been reimplemented as a - * framework that allows each supported platform/OS to have their own - * platform/OS specific PCI driver. - * - * Most of the code of these functions was simply lifted from the - * Intel architecture specifric portion of the original Xfree86 - * PCI code in hw/xfree86/common_hw/xf86_PCI.C... - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This software is derived from the original XFree86 PCI code - * which includes the following copyright notices as well: - * - * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * This code is also based heavily on the code in FreeBSD-current, which was - * written by Wolfgang Stanglmeier, and contains the following copyright: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <stdio.h> -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#ifdef PC98 -#define outb(port,data) _outb(port,data) -#define outl(port,data) _outl(port,data) -#define inb(port) _inb(port) -#define inl(port) _inl(port) -#endif - -#define PCI_CFGMECH2_ENABLE_REG 0xCF8 -#ifdef PC98 -#define PCI_CFGMECH2_FORWARD_REG 0xCF9 -#else -#define PCI_CFGMECH2_FORWARD_REG 0xCFA -#endif - -#define PCI_CFGMECH2_MAXDEV 16 - -#define PCI_ADDR_FROM_TAG_CFG1(tag,reg) (PCI_EN | tag | (reg & 0xfc)) -#define PCI_FORWARD_FROM_TAG(tag) PCI_BUS_FROM_TAG(tag) -#define PCI_ENABLE_FROM_TAG(tag) (0xf0 | (((tag) & 0x00000700) >> 7)) -#define PCI_ADDR_FROM_TAG_CFG2(tag,reg) (0xc000 | (((tag) & 0x0000f800) >> 3) \ - | (reg & 0xfc)) - -/* - * Intel x86 platform specific PCI access functions - */ -#if 0 -static CARD32 ix86PciReadLongSetup(PCITAG tag, int off); -static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off); -static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off); -static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val); -#endif - -static pciBusFuncs_t ix86Funcs0 = { -#if 0 -/* pciReadLong */ ix86PciReadLongSetup, -/* pciWriteLong */ ix86PciWriteLongSetup, -/* pciSetBitsLong */ ix86PciSetBitsLongSetup, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs1 = { -#if 0 -/* pciReadLong */ ix86PciReadLongCFG1, -/* pciWriteLong */ ix86PciWriteLongCFG1, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG1, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs2 = { -#if 0 -/* pciReadLong */ ix86PciReadLongCFG2, -/* pciWriteLong */ ix86PciWriteLongCFG2, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG2, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusInfo_t ix86Pci0 = { -/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */ -/* numDevices */ 0, /* Set by ix86PciInit() */ -/* secondary */ FALSE, -/* primary_bus */ 0, -/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */ -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -_X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, - ADDRESS Base, unsigned long Size) -{ - return xf86MapVidMem(ScreenNum, Flags, Base, Size); -} - -IOADDRESS -xf86MapLegacyIO(struct pci_device *dev) -{ - (void)dev; - return 0; -} - -static Bool -ix86PciBusCheck(void) -{ -#if 0 - PCITAG tag; - CARD32 id, class; - CARD8 device; - - for (device = 0; device < ix86Pci0.numDevices; device++) { - tag = PCI_MAKE_TAG(0, device, 0); - id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG); - - if ((CARD16)(id + 1U) <= (CARD16)1UL) - continue; - - /* The rest of this is inspired by the Linux kernel */ - class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG); - - /* Ignore revision id and programming interface */ - switch (class >> 16) { - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC: - /* Check for vendors of known buggy chipsets */ - id &= 0x0000ffff; - if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ)) - return TRUE; - continue; - - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA: - case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA: - case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST: - return TRUE; - - default: - break; - } - } -#endif - return FALSE; -} - -static void -ix86PciSelectCfgmech(void) -{ - static Bool beenhere = FALSE; - CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0; - CARD8 mode2Res1 = 0, mode2Res2 = 0, oldVal2 = 0; - int stages = 0; - - if (beenhere) - return; /* Been there, done that */ - - beenhere = TRUE; - - /* Determine if motherboard chipset supports PCI Config Mech 1 or 2 */ - do { - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, - "PCI: Probing config type using method 1\n"); - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("Checking config type 1:\n" - "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1); - ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n"); - } -#endif - - /* Assuming config type 1 to start with */ - if ((oldVal1 & 0x7f000000) == 0) { - - stages |= 0x01; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue indicates possibly config type 1\n"); - ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN); -#if 0 - ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n"); -#endif - } -#endif - - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); - -#if 0 - /* - * This seems to cause some Neptune-based PCI machines to switch - * from config type 1 to config type 2 - */ - outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0); -#endif - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res1); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if (mode1Res1) { - - stages |= 0x02; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back is non-zero, and indicates possible" - " config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1" - " = 0x%08lx\n", stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this, continuing type 1" - " check ...\n"); - } -#endif - - } - - stages |= 0x04; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n"); - } -#endif - outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001); - mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res2); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if ((mode1Res2 & 0x80000001) == 0x80000000) { - - stages |= 0x08; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back has only the msb set\n" - "\tThis indicates possible config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1, (unsigned long)mode1Res2); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this.\n"); - } -#endif - - } - } - - xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); - xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, (unsigned long)mode1Res1, - (unsigned long)mode1Res2); - - /* Try config type 2 */ - oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); - if ((oldVal2 & 0xf0) == 0) { - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - - outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - outb(PCI_CFGMECH2_ENABLE_REG, oldVal2); - - if (mode2Res1 == 0x0e) { - if (ix86PciBusCheck()) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - return; - } - } - } - break; - } while (0); - - /* No PCI found */ - ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN; - xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found\n"); -} - -void -ix86PciInit() -{ - /* Initialize pciBusInfo */ - pciBusInfo = &ix86Pci0; - - /* Make sure that there is a PCI bus present. */ - ix86PciSelectCfgmech(); - if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) { - pciBusInfo = NULL; - } -} diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 8b0a820fa..263fd8ff1 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -79,42 +79,28 @@ static pciBusFuncs_t linuxFuncs0 = { #endif }; -static pciBusInfo_t linuxPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* funcs */ &linuxFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - static const struct pci_id_match match_host_bridge = { PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8), 0x0000ffff00, 0 }; -#ifndef INCLUDE_XF86_NO_DOMAIN #define MAX_DOMAINS 257 static pointer DomainMmappedIO[MAX_DOMAINS]; -#endif void linuxPciInit(void) { struct stat st; -#ifndef INCLUDE_XF86_NO_DOMAIN memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO)); -#endif if (-1 == stat("/proc/bus/pci", &st)) { /* when using this as default for all linux architectures, we'll need a fallback for 2.0 kernels here */ return; } - pciBusInfo = &linuxPci0; + pciBusFuncs = &linuxFuncs0; } /** @@ -237,7 +223,6 @@ linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) #endif /* __powerpc__ */ -#ifndef INCLUDE_XF86_NO_DOMAIN /* * Compiling the following simply requires the presence of <linux/pci.c>. @@ -601,4 +586,3 @@ xf86AccResFromOS(resPtr pRes) return pRes; } -#endif /* !INCLUDE_XF86_NO_DOMAIN */ diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c index 04763ada7..b814072cb 100644 --- a/hw/xfree86/os-support/hurd/hurd_video.c +++ b/hw/xfree86/os-support/hurd/hurd_video.c @@ -142,20 +142,6 @@ xf86DisableIO() return; } -/************************************************************************** - * Interrupt Handling section - **************************************************************************/ -Bool -xf86DisableInterrupts() -{ - return TRUE; -} -void -xf86EnableInterrupts() -{ - return; -} - void xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, unsigned long Size) diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index f12dfb05c..da1dcf690 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -2,7 +2,6 @@ noinst_LTLIBRARIES = liblinux.la if LINUX_IA64 PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c -PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset PLATFORM_INCLUDES = -I$(srcdir)/../shared endif if LINUX_ALPHA diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index b15f7fdc4..06f42f8af 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -292,10 +292,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->BIOSseg = V_BIOS >> 4; break; } - case BUS_ISA: - if (!xf86int10GetBiosSegment(pInt, NULL)) - goto error3; - break; default: goto error3; } diff --git a/hw/xfree86/os-support/linux/lnx_axp.c b/hw/xfree86/os-support/linux/lnx_axp.c index a8ad161b6..e8b6d4749 100644 --- a/hw/xfree86/os-support/linux/lnx_axp.c +++ b/hw/xfree86/os-support/linux/lnx_axp.c @@ -179,7 +179,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) */ _iobase = _alpha_iobase; -#ifndef INCLUDE_XF86_NO_DOMAIN /* * Only take over the inx/outx functions if this is a dense I/O * system *and* addressing domains are being used. The dense I/O @@ -191,7 +190,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) _alpha_inb = _dense_inb; _alpha_inw = _dense_inw; _alpha_inl = _dense_inl; -#endif /* !INCLUDE_XF86_NO_DOMAIN */ } else _iobase = _alpha_iobase_legacy; return _iobase(flags, hose, bus, devfn); diff --git a/hw/xfree86/os-support/linux/lnx_bell.c b/hw/xfree86/os-support/linux/lnx_bell.c index 93ad680d7..702dfa675 100644 --- a/hw/xfree86/os-support/linux/lnx_bell.c +++ b/hw/xfree86/os-support/linux/lnx_bell.c @@ -32,6 +32,7 @@ #include "xf86.h" #include "xf86Priv.h" +#include "xf86_OSproc.h" _X_EXPORT void xf86OSRingBell(int loudness, int pitch, int duration) diff --git a/hw/xfree86/os-support/linux/lnx_ev56.c b/hw/xfree86/os-support/linux/lnx_ev56.c index 11c45e538..e751da2d0 100644 --- a/hw/xfree86/os-support/linux/lnx_ev56.c +++ b/hw/xfree86/os-support/linux/lnx_ev56.c @@ -90,7 +90,6 @@ writeDense32(int Value, pointer Base, register unsigned long Offset) } -#ifndef INCLUDE_XF86_NO_DOMAIN void _dense_outb(char val, unsigned long port) @@ -146,5 +145,4 @@ _dense_inl(unsigned long port) return *(volatile CARD32 *)port; } -#endif /* !INCLUDE_XF86_NO_DOMAIN */ diff --git a/hw/xfree86/os-support/linux/lnx_ia64.c b/hw/xfree86/os-support/linux/lnx_ia64.c deleted file mode 100644 index 5f742d01f..000000000 --- a/hw/xfree86/os-support/linux/lnx_ia64.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/utsname.h> -#include <unistd.h> -#include <stdlib.h> - -#include "ia64Pci.h" -#include "Pci.h" - -#if defined OS_PROBE_PCI_CHIPSET -IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags) -{ - struct stat unused; - struct utsname utsName; - - if (!stat("/proc/bus/mckinley/zx1",&unused) - || !stat("/proc/bus/mckinley/zx2",&unused)) - return ZX1_CHIPSET; - - if (!stat("/proc/sgi_sn/licenseID", &unused)) { - int major, minor, patch; - char *c; - - /* We need a 2.6.11 or better kernel for Altix support */ - uname(&utsName); - c = utsName.release; - - major = atoi(c); - c = strstr(c, ".") + 1; - minor = atoi(c); - c = strstr(c, ".") + 1; - patch = atoi(c); - - if (major < 2 || (major == 2 && minor < 6) || - (major == 2 && minor == 6 && patch < 11)) { - ErrorF("Kernel 2.6.11 or better needed for Altix support\n"); - return NONE_CHIPSET; - } - return ALTIX_CHIPSET; - } - - return NONE_CHIPSET; -} -#endif diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 4c64fa447..688106af4 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -77,8 +77,6 @@ extern int iopl(int __level); extern void sethae(unsigned long hae); -# define isJensen (axpSystem == JENSEN) - # define BUS_BASE bus_base #else @@ -97,10 +95,6 @@ static void unmapVidMem(int, pointer, unsigned long); static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); extern axpDevice lnxGetAXP(void); static void unmapVidMemSparse(int, pointer, unsigned long); -# if defined(JENSEN_SUPPORT) -static pointer mapVidMemJensen(int, unsigned long, unsigned long, int); -static void unmapVidMemJensen(int, pointer, unsigned long); -# endif static axpDevice axpSystem = -1; static Bool needSparse; static unsigned long hae_thresh; @@ -388,17 +382,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) } bus_base = _bus_base(); } - if (isJensen) { -# ifndef JENSEN_SUPPORT - FatalError("Jensen is not supported any more\n" - "If you are intereseted in fixing Jensen support\n" - "please contact xorg@lists.freedesktop.org\n"); -# else - xf86Msg(X_INFO,"Machine type is Jensen\n"); - pVidMem->mapMem = mapVidMemJensen; - pVidMem->unmapMem = unmapVidMemJensen; -# endif /* JENSEN_SUPPORT */ - } else if (needSparse) { + if (needSparse) { xf86Msg(X_INFO,"Machine needs sparse mapping\n"); pVidMem->mapMem = mapVidMemSparse; pVidMem->unmapMem = unmapVidMemSparse; @@ -584,24 +568,6 @@ xf86DisableIO(void) return; } -/* - * Don't use these two functions. They can't possibly work. If you actually - * need interrupts off for something, you ought to be doing it in the kernel - * anyway. - */ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - return (TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - return; -} - #if defined (__alpha__) #define vuip volatile unsigned int * @@ -922,175 +888,4 @@ _X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) _X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) = readDense32; -#ifdef JENSEN_SUPPORT - -static int -readSparseJensen8(pointer Base, register unsigned long Offset); -static int -readSparseJensen16(pointer Base, register unsigned long Offset); -static int -readSparseJensen32(pointer Base, register unsigned long Offset); -static void -writeSparseJensen8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset); - -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE -#define SPARSE (5) -#else -#define SPARSE (7) -#endif - -#define JENSEN_SHIFT(x) ((long)x<<SPARSE) - -static pointer -mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - int fd, prot; - - xf86WriteMmio8 = writeSparseJensen8; - xf86WriteMmio16 = writeSparseJensen16; - xf86WriteMmio32 = writeSparseJensen32; - xf86WriteMmioNB8 = writeSparseJensenNB8; - xf86WriteMmioNB16 = writeSparseJensenNB16; - xf86WriteMmioNB32 = writeSparseJensenNB32; - xf86ReadMmio8 = readSparseJensen8; - xf86ReadMmio16 = readSparseJensen16; - xf86ReadMmio32 = readSparseJensen32; - - fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (fd < 0) { - FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n", - strerror(errno)); - } - - if (flags & VIDMEM_READONLY) - prot = PROT_READ; - else - prot = PROT_READ | PROT_WRITE; - - /* This requires linux-0.99.pl10 or above */ - base = mmap((caddr_t)0, JENSEN_SHIFT(Size), - prot, MAP_SHARED, fd, - (off_t)(JENSEN_SHIFT((off_t)Base) + _bus_base_sparse())); - close(fd); - if (base == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer" - " (0x%08x,0x%x) (%s)\n", Base, Size, - strerror(errno)); - } - return base; -} - -static void -unmapVidMemJensen(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, JENSEN_SHIFT(Size)); -} - -static int -readSparseJensen8(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - - mem_barrier(); - shift = (Offset & 0x3) << 3; - - result = *(vuip) ((unsigned long)Base + (Offset << SPARSE)); - - result >>= shift; - return 0xffUL & result; -} - -static int -readSparseJensen16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - - mem_barrier(); - shift = (Offset & 0x2) << 3; - - result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))); - - result >>= shift; - return 0xffffUL & result; -} - -static int -readSparseJensen32(pointer Base, register unsigned long Offset) -{ - register unsigned long result; - - mem_barrier(); - result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))); - - return result; -} - -static void -writeSparseJensen8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned int b = Value & 0xffU; - - write_mem_barrier(); - *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101; -} - -static void -writeSparseJensen16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned int w = Value & 0xffffU; - - write_mem_barrier(); - *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) = - w * 0x00010001; -} - -static void -writeSparseJensen32(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value; -} - -static void -writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned int b = Value & 0xffU; - - *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101; -} - -static void -writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned int w = Value & 0xffffU; - - *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) = - w * 0x00010001; -} - -static void -writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset) -{ - *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value; -} -#endif /* JENSEN_SUPPORT */ - #endif /* __alpha__ */ diff --git a/hw/xfree86/os-support/misc/BUSmemcpy.c b/hw/xfree86/os-support/misc/BUSmemcpy.c index b482b867a..0500bf6c1 100644 --- a/hw/xfree86/os-support/misc/BUSmemcpy.c +++ b/hw/xfree86/os-support/misc/BUSmemcpy.c @@ -26,233 +26,8 @@ Thanks to Linus Torvalds for contributing this code. #include "compiler.h" -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. These routines are only used in s3im.c - * Non time critical code uses SlowBCopy_{from/to} bus. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define LWORD_CODING (0x18) -#define SPARSE (5) -#else #define LWORD_CODING (0x60) #define SPARSE (7) -#endif - -void -xf86JensenMemToBus(char *Base, long dst, long src, int count) -{ - if( ((long)src^((long)dst)) & 3) { - /* src & dst are NOT aligned to each other */ - unsigned long addr; - unsigned long low_word, high_word,last_read; - long rm,loop; - unsigned long tmp,org,org2,mask,src_org,count_org; - - src_org=src; - count_org=count; - - /* add EISA longword coding and round off*/ - addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE); - rm = (long)dst & 3; - count += rm; - - count = count_org + rm; - org = *(volatile unsigned int *)addr; - __asm__("ldq_u %0,%1" - :"=r" (low_word):"m" (*(unsigned long *)(src_org))); - src = src_org - rm; - if( count > 4 ) { - last_read = src_org+count_org - 1; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - src += 4; - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - tmp |= org2; - - loop = (count-4) >> 2; /* loop eqv. count>=4 ; count -= 4 */ - while (loop) { - /* tmp to be stored completly -- need to read next word*/ - low_word = high_word; - *(volatile unsigned int *) (addr) = tmp; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long*)(src+4))); - loop --; - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)src)); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)src)); - src += 4; - tmp |= low_word; - addr += 4<<SPARSE; - } - if ( count & 3 ) { - /* Store tmp completly, and possibly read one more word.*/ - *(volatile unsigned int *) (addr) = tmp; - __asm__("ldq_u %0,%1" - :"=r" (tmp):"m" (*((unsigned long *)(last_read)) )); - addr += 4<<SPARSE; - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (high_word), "r" ((unsigned long)src)); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" ((unsigned long)src)); - tmp |= low_word; - org = *(volatile unsigned int *)addr; - - __asm__("mskql %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (count&3)); - __asm__("mskqh %1,%2,%0" - :"=r" (org) - :"r" (org), "r" (count&3)); - - tmp |= org; - } - *(volatile unsigned int *) (addr) = tmp; - return; - } else { /* count > 4 */ - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - if( count < 4 ) { - - mask = -1; - __asm__("mskqh %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (count)); - tmp = (tmp & mask) | (org & ~mask); - *(volatile unsigned int *) (addr) = tmp; - return; - } else { - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - - tmp |= org2; - *(volatile unsigned int *) (addr) = tmp; - return; - } - } - } else { /* src & dst are aligned to each other */ - unsigned long addr; - unsigned int tmp,org,rm; - unsigned int *src_r; - - /* add EISA longword coding and round off*/ - addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE); - - src_r = (unsigned int*)((long)src & ~3L); - rm=(long)src & 3; - count += rm; - - tmp = *src_r; - org = *(volatile unsigned int *)addr; - - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org) - :"r" (org), "r" (rm)); - - tmp |= org; - - while (count > 4) { - *(volatile unsigned int *) addr = tmp; - addr += 4<<SPARSE; - src_r += 1; - tmp = *src_r; - count -= 4; - } - - org = *(volatile unsigned int *)addr; - __asm__("mskql %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (count)); - __asm__("mskqh %1,%2,%0" - :"=r" (org) - :"r" (org), "r" (count)); - tmp |= org; - *(volatile unsigned int *) (addr) = tmp; - } -} - -void -xf86JensenBusToMem(char *Base, char *dst, unsigned long src, int count) -{ -#if 0 - /* Optimization of BusToMem() is left as an exercise to the reader ;-) - * Consider that ldq_u/extlh/extll won't work because of the bus being - * only 4 bytes wide! - */ -#else - unsigned long addr; - long result; - - addr = (unsigned long)(Base+(src<<SPARSE)) ; - while( addr & (3<<SPARSE) ){ - if(count <= 0) return; - result = *(volatile int *) addr; - result >>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<<SPARSE; - count--; - } - count -=4; - while(count >= 0){ - int i; - - result = *(volatile int *) (addr+LWORD_CODING); - for(i=4;i--;) { - *dst++ = (char) result; - result >>= 8; - } - addr += 4<<SPARSE; - count -= 4; - } - count +=4; - - while( count ){ - result = *(volatile int *) addr; - result >>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<<SPARSE; - count--; - } -#endif -} - static unsigned long __memcpy(unsigned long dest, unsigned long src, int n); diff --git a/hw/xfree86/os-support/misc/IODelay.c b/hw/xfree86/os-support/misc/IODelay.c deleted file mode 100644 index e4422f234..000000000 --- a/hw/xfree86/os-support/misc/IODelay.c +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - Stub for Alpha Linux -*******************************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * All we really need is a delay of about 40ns for I/O recovery for just - * about any occasion, but we'll be more conservative here: On a - * 100-MHz CPU, produce at least a delay of 1,000ns. - */ -_X_EXPORT void -xf86IODelay() -{ - xf86UDelay(1); -} - diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am index 39066ecb0..3d4b8ff0e 100644 --- a/hw/xfree86/os-support/misc/Makefile.am +++ b/hw/xfree86/os-support/misc/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libmisc.la -libmisc_la_SOURCES = Delay.c BUSmemcpy.c IODelay.c SlowBcopy.c +libmisc_la_SOURCES = Delay.c BUSmemcpy.c SlowBcopy.c #AM_LDFLAGS = -r diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c index 7c51fcca3..be69b9dd1 100644 --- a/hw/xfree86/os-support/misc/SlowBcopy.c +++ b/hw/xfree86/os-support/misc/SlowBcopy.c @@ -56,29 +56,13 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) } #ifdef __alpha__ -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. Time critical code uses routines from - * BUSmemcpy.c - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ #ifdef linux -unsigned long _bus_base(void); - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define SPARSE (5) -#else #define SPARSE (7) -#endif - -#define isJensen() (!_bus_base()) #else -#define isJensen() 0 #define SPARSE 0 #endif @@ -86,42 +70,32 @@ unsigned long _bus_base(void); _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count) { - if (isJensen()) - { - unsigned long addr; - long result; - - addr = (unsigned long) src; - while( count ){ - result = *(volatile int *) addr; - result >>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (unsigned char) (0xffUL & result); - addr += 1<<SPARSE; - count--; - outb(0x80, 0x00); - } + unsigned long addr; + long result; + + addr = (unsigned long) src; + while( count ){ + result = *(volatile int *) addr; + result >>= ((addr>>SPARSE) & 3) * 8; + *dst++ = (unsigned char) (0xffUL & result); + addr += 1<<SPARSE; + count--; + outb(0x80, 0x00); } - else - xf86SlowBcopy(src,dst,count); } _X_EXPORT void xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count) { - if (isJensen()) - { - unsigned long addr; - - addr = (unsigned long) dst; - while(count) { - *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101; - src++; - addr += 1<<SPARSE; - count--; - outb(0x80, 0x00); - } + unsigned long addr; + + addr = (unsigned long) dst; + while(count) { + *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101; + src++; + addr += 1<<SPARSE; + count--; + outb(0x80, 0x00); } - else - xf86SlowBcopy(src,dst,count); } #endif diff --git a/hw/xfree86/os-support/sco/sco_iop.c b/hw/xfree86/os-support/sco/sco_iop.c index bb8d06d2e..86210d71a 100644 --- a/hw/xfree86/os-support/sco/sco_iop.c +++ b/hw/xfree86/os-support/sco/sco_iop.c @@ -88,47 +88,3 @@ xf86DisableIO(void) sysi86(SI86V86, V86SC_IOPL, 0); IOEnabled = FALSE; } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return FALSE; - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return; - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } -} diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c index 8bac87ebe..0c368e713 100644 --- a/hw/xfree86/os-support/shared/bios_mmap.c +++ b/hw/xfree86/os-support/shared/bios_mmap.c @@ -91,33 +91,15 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, * re: boundaries and sizes and such... */ -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - #ifdef linux -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define SPARSE (5) -#define isJensen (1) -#else -#define isJensen (!_bus_base()) -#define SPARSE (7) -#endif - extern unsigned long _bus_base(void); -extern unsigned long _bus_base_sparse(void); -#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base()) -#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x) +#define BUS_BASE _bus_base() #else extern u_int64_t dense_base(void); #define BUS_BASE dense_base() -#define JENSEN_SHIFT(x) ((long) x) #endif @@ -141,8 +123,8 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); - base = mmap((caddr_t)0, JENSEN_SHIFT(mlen), PROT_READ, - MAP_SHARED, fd, (off_t)(JENSEN_SHIFT(Base) + BUS_BASE)); + base = mmap((caddr_t)0, mlen, PROT_READ, + MAP_SHARED, fd, (off_t)(Base + BUS_BASE)); if (base == MAP_FAILED) { @@ -151,10 +133,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - xf86SlowBCopyFromBus((unsigned char *)(base+JENSEN_SHIFT(Offset)), - Buf, Len); + xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len); - munmap((caddr_t)JENSEN_SHIFT(base), JENSEN_SHIFT(mlen)); + munmap((caddr_t)base, mlen); close(fd); return(Len); } diff --git a/hw/xfree86/os-support/shared/ia64Pci.h b/hw/xfree86/os-support/shared/ia64Pci.h deleted file mode 100644 index 978c9ff0e..000000000 --- a/hw/xfree86/os-support/shared/ia64Pci.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#ifndef _IA64_PCI_H -# define _IA64_PCI_H - -#include "Pci.h" - -typedef enum { - NONE_CHIPSET, - I460GX_CHIPSET, - E8870_CHIPSET, - ZX1_CHIPSET, - ALTIX_CHIPSET -} IA64Chipset; - -# ifdef OS_PROBE_PCI_CHIPSET -extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags); -# endif -#endif diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c index c144211f0..8cb101488 100644 --- a/hw/xfree86/os-support/shared/stdResource.c +++ b/hw/xfree86/os-support/shared/stdResource.c @@ -77,9 +77,6 @@ xf86StdAccResFromOS(resPtr ret) ret = xf86AddResToList(ret, &range, -1); RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00100000, 0x3fffffff, - ResExcMemBlock | ResBios | ResEstimated); - ret = xf86AddResToList(ret, &range, -1); #if 0 RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios); ret = xf86AddResToList(ret, &range, -1); diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c index b79814d8a..795b0c13c 100644 --- a/hw/xfree86/os-support/solaris/sun_init.c +++ b/hw/xfree86/os-support/solaris/sun_init.c @@ -49,8 +49,9 @@ static char fb_dev[PATH_MAX] = "/dev/console"; void xf86OpenConsole(void) { + int i; #ifdef HAS_USL_VTS - int fd, i; + int fd; struct vt_mode VT; struct vt_stat vtinfo; int FreeVTslot; @@ -173,9 +174,14 @@ xf86OpenConsole(void) if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); #endif + #ifdef KDSETMODE - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n"); + SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS)); + if (i < 0) { + xf86Msg(X_WARNING, + "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n", + fb_dev, strerror(errno)); + } #endif } else /* serverGeneration != 1 */ @@ -257,7 +263,7 @@ xf86CloseConsole(void) #ifdef KDSETMODE /* Reset the display back to text mode */ - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); + SYSCALL(ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT)); #endif #ifdef HAS_USL_VTS diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c index 2b50dd619..3982f631f 100644 --- a/hw/xfree86/os-support/solaris/sun_vid.c +++ b/hw/xfree86/os-support/solaris/sun_vid.c @@ -263,46 +263,3 @@ xf86DisableIO(void) ExtendedEnabled = FALSE; #endif /* i386 */ } - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts(void) -{ -#if defined(__i386__) || defined(__i386) || defined(__x86) - if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) - return FALSE; - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - sysi86(SI86V86, V86SC_IOPL, 0); -#endif /* i386 */ - - return TRUE; -} - -_X_EXPORT void -xf86EnableInterrupts(void) -{ -#if defined(__i386__) || defined(__i386) || defined(__x86) - if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) - return; - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - sysi86(SI86V86, V86SC_IOPL, 0); -#endif /* i386 */ -} diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c index 9972bcaa4..a9bbd6580 100644 --- a/hw/xfree86/os-support/sysv/sysv_video.c +++ b/hw/xfree86/os-support/sysv/sysv_video.c @@ -313,55 +313,3 @@ xf86DisableIO() return; } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (SET_IOPL() < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - RESET_IOPL(); - } - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (SET_IOPL() < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - RESET_IOPL(); - } - return; -} diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index 74c2dc0f2..b4513d65f 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -146,14 +146,11 @@ extern void xf86MapReadSideEffects(int, int, pointer, unsigned long); extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int); extern Bool xf86EnableIO(void); extern void xf86DisableIO(void); -extern Bool xf86DisableInterrupts(void); -extern void xf86EnableInterrupts(void); extern void xf86SetTVOut(int); extern void xf86SetRGBOut(void); extern void xf86OSRingBell(int, int, int); extern void xf86BusToMem(unsigned char *, unsigned char *, int); extern void xf86MemToBus(unsigned char *, unsigned char *, int); -extern void xf86IODelay(void); extern void xf86UDelay(long usec); extern void xf86SetReallySlowBcopy(void); extern void xf86SlowBcopy(unsigned char *, unsigned char *, int); diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c index 8af1727cc..4986b5b29 100644 --- a/hw/xfree86/vbe/vbe.c +++ b/hw/xfree86/vbe/vbe.c @@ -1108,7 +1108,7 @@ VBEReadPanelID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; pointer page = pVbe->memory; - unsigned char *tmp = NULL; + void *tmp = NULL; int screen = pVbe->pInt10->scrnIndex; pVbe->pInt10->ax = 0x4F11; @@ -1129,8 +1129,8 @@ VBEReadPanelID(vbeInfoPtr pVbe) switch (pVbe->pInt10->ax & 0xff00) { case 0x0: xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n"); - tmp = (unsigned char *)xnfalloc(32); - memcpy(tmp,page,32); + tmp = xnfalloc(32); + memcpy(tmp, page, 32); break; case 0x100: xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n"); diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c index 0672bcf5b..40871424a 100644 --- a/hw/xfree86/xaa/xaaInitAccel.c +++ b/hw/xfree86/xaa/xaaInitAccel.c @@ -16,8 +16,6 @@ #include "xf86fbman.h" #include "servermd.h" -static const OptionInfoRec *XAAAvailableOptions(void *unused); - /* * XAA Config options */ @@ -111,13 +109,6 @@ static XF86ModuleVersionInfo xaaVersRec = _X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL }; -/*ARGSUSED*/ -static const OptionInfoRec * -XAAAvailableOptions(void *unused) -{ - return (XAAOptions); -} - Bool XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index e25b9df52..69a59050c 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -1051,6 +1051,10 @@ StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void); int XAAPolyText8TEColorExpansion( diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index 08305b10b..676a2ba95 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -90,7 +90,7 @@ xnestPixmapToRegion(PixmapPtr pPixmap) register RegionPtr pReg, pTmpReg; register int x, y; unsigned long previousPixel, currentPixel; - BoxRec Box; + BoxRec Box = { 0, 0, 0, 0 }; Bool overlap; ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0, diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 91debd663..1cfbe0803 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -75,8 +75,6 @@ void X11ApplicationMain(int argc, char **argv, char **envp); extern int X11EnableKeyEquivalents; extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu; -#define APP_PREFS "org.x.X11" - #define PREFS_APPSMENU "apps_menu" #define PREFS_FAKEBUTTONS "enable_fake_buttons" #define PREFS_SYSBEEP "enable_system_beep" diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 57f680965..44b8418f0 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -76,6 +76,8 @@ extern int darwinFakeButtons; X11Application *X11App; +CFStringRef app_prefs_domain_cfstr = NULL; + #define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) @interface X11Application (Private) @@ -466,7 +468,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (CFPropertyListRef) prefs_get:(NSString *)key { CFPropertyListRef value; - value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS)); + value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr); if (value == NULL) { static CFDictionaryRef defaults; @@ -618,7 +620,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberIntType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -629,7 +631,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberFloatType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -638,7 +640,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (void) prefs_set_boolean:(NSString *)key value:(int)value { CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) (value ? kCFBooleanTrue - : kCFBooleanFalse), CFSTR (APP_PREFS), + : kCFBooleanFalse), app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -649,14 +651,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { cfarray = nsarray_to_cfarray (value); CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) cfarray, - CFSTR (APP_PREFS), + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (cfarray); } - (void) prefs_set_string:(NSString *)key value:(NSString *)value { CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value, - CFSTR (APP_PREFS), kCFPreferencesCurrentUser, + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -857,6 +859,9 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { pool = [[NSAutoreleasePool alloc] init]; X11App = (X11Application *) [X11Application sharedApplication]; init_ports (); + + app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; + [NSApp read_defaults]; [NSBundle loadNibNamed:@"main" owner:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:NSApp diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 76fbb573a..233fd4f1d 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -55,6 +55,8 @@ #include <sys/types.h> #include <sys/wait.h> +BOOL xquartz_resetenv_display = NO; + @implementation X11Controller - (void) awakeFromNib @@ -356,7 +358,7 @@ /* Setup environment */ temp = getenv("DISPLAY"); - if (temp == NULL || temp[0] == 0) { + if (xquartz_resetenv_display || temp == NULL || temp[0] == 0) { snprintf(buf, sizeof(buf), ":%s", display); setenv("DISPLAY", buf, TRUE); } diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index a49013e0d..e58277a9e 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -29,6 +29,7 @@ prior written authorization. */ #include <CoreFoundation/CoreFoundation.h> +#include <AvailabilityMacros.h> #include <X11/Xlib.h> #include <unistd.h> @@ -56,6 +57,8 @@ void DarwinListenOnOpenFD(int fd); extern int noPanoramiXExtension; +extern int xquartz_resetenv_display; + #define DEFAULT_CLIENT "/usr/X11/bin/xterm" #define DEFAULT_STARTX "/usr/X11/bin/startx" #define DEFAULT_SHELL "/bin/sh" @@ -72,10 +75,9 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui char __crashreporter_info__buf[4096]; char *__crashreporter_info__ = __crashreporter_info__buf; -#define DEBUG 1 +static char *server_bootstrap_name = "org.x.X11"; -static int execute(const char *command); -static char *command_from_prefs(const char *key, const char *default_value); +#define DEBUG 1 /* This is in quartzStartup.c */ int server_main(int argc, char **argv, char **envp); @@ -372,9 +374,13 @@ int startup_trigger(int argc, char **argv, char **envp) { strlcpy(newenvp[i], envp[i], STRING_T_SIZE); } - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if (kr != KERN_SUCCESS) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif exit(EXIT_FAILURE); } @@ -404,6 +410,9 @@ int startup_trigger(int argc, char **argv, char **envp) { if((s = getenv("DISPLAY"))) { fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); unsetenv("DISPLAY"); + + /* This tells X11Controller to not use the environment's DISPLAY and reset it based on the server's display */ + xquartz_resetenv_display = 1; } else { fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); } @@ -424,6 +433,22 @@ int main(int argc, char **argv, char **envp) { /* Setup the initial crasherporter info */ strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len); + /* Pass on our prefs domain to startx and its inheritors (mainly for + * quartz-wm and the Xquartz stub's MachIPC) + */ + CFBundleRef bundle = CFBundleGetMainBundle(); + if(bundle) { + CFStringRef pd = CFBundleGetIdentifier(bundle); + if(pd) { + const char *pds = CFStringGetCStringPtr(pd, 0); + if(pds) { + server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1)); + strcpy(server_bootstrap_name, pds); + setenv("X11_PREFS_DOMAIN", pds, 1); + } + } + } + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); for(i=0; i < argc; i++) { fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); @@ -432,9 +457,9 @@ int main(int argc, char **argv, char **envp) { } } - mp = checkin_or_register(SERVER_BOOTSTRAP_NAME); + mp = checkin_or_register(server_bootstrap_name); if(mp == MACH_PORT_NULL) { - fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME); + fprintf(stderr, "NULL mach service: %s", server_bootstrap_name); return EXIT_FAILURE; } diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h index 97ac147cd..459c750db 100644 --- a/hw/xquartz/mach-startup/mach_startup_types.h +++ b/hw/xquartz/mach-startup/mach_startup_types.h @@ -1,7 +1,6 @@ #ifndef _MACH_STARTUP_TYPES_H_ #define _MACH_STARTUP_TYPES_H_ -#define SERVER_BOOTSTRAP_NAME "org.x.X11" #define STRING_T_SIZE 1024 typedef char string_t[STRING_T_SIZE]; diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index bc4f7eca0..893d19c8d 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -40,6 +40,12 @@ #include <sys/socket.h> #include <sys/un.h> +static char *server_bootstrap_name = "org.x.X11"; + +/* The launchd startup is only designed for the primary X11.app that is + * org.x.X11... server_bootstrap_name might be differnet if we were triggered to + * start by another X11.app. + */ #define kX11AppBundleId "org.x.X11" #define kX11AppBundlePath "/Contents/MacOS/X11" @@ -222,6 +228,9 @@ int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; } + if(getenv("X11_PREFS_DOMAIN")) + server_bootstrap_name = getenv("X11_PREFS_DOMAIN"); + /* We don't have a mechanism in place to handle this interrupt driven * server-start notification, so just send the signal now, so xinit doesn't * time out waiting for it and will just poll for the server. @@ -238,7 +247,7 @@ int main(int argc, char **argv, char **envp) { /* Get the $DISPLAY FD */ launchd_fd = launchd_display_fd(); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr != KERN_SUCCESS) { set_x11_path(); @@ -261,13 +270,17 @@ int main(int argc, char **argv, char **envp) { /* Try connecting for 10 seconds */ for(i=0; i < 80; i++) { usleep(250000); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr == KERN_SUCCESS) break; } if(kr != KERN_SUCCESS) { - fprintf(stderr, "Xquartz: bootstrap_look_up(): Timed out: %s\n", bootstrap_strerror(kr)); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + fprintf(stderr, "Xquartz: bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "Xquartz: bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif return EXIT_FAILURE; } } diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m index b5748dace..cb0fa5744 100644 --- a/hw/xquartz/pbproxy/app-main.m +++ b/hw/xquartz/pbproxy/app-main.m @@ -34,6 +34,11 @@ #include <unistd.h> /*for getpid*/ #include <Cocoa/Cocoa.h> +static const char *app_prefs_domain = "org.x.X11"; +CFStringRef app_prefs_domain_cfstr; + +char *display = NULL; + static void signal_handler (int sig) { switch(sig) { case SIGHUP: @@ -50,6 +55,27 @@ int main (int argc, const char *argv[]) { #endif xpbproxy_is_standalone = YES; + + if((s = getenv("X11_PREFS_DOMAIN"))) + app_prefs_domain = s; + + for (i = 1; i < argc; i++) { + if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) { + app_prefs_domain = argv[++i]; + } else if (strcmp (argv[i], "--help") == 0) { + printf("usage: xpbproxy OPTIONS\n" + "Pasteboard proxying for X11.\n\n" + "--prefs-domain <domain> Change the domain used for reading preferences\n" + " (default: org.x.X11)\n"); + return 0; + } else { + fprintf(stderr, "usage: xpbproxy OPTIONS...\n" + "Try 'xpbproxy --help' for more information.\n"); + return 1; + } + } + + app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8); if(!xpbproxy_init()) return EXIT_FAILURE; diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m index efa42e3a3..247ff7475 100644 --- a/hw/xquartz/pbproxy/main.m +++ b/hw/xquartz/pbproxy/main.m @@ -31,6 +31,7 @@ #import "x-selection.h" #include <pthread.h> +#include <unistd.h> #include <X11/extensions/applewm.h> Display *xpbproxy_dpy; @@ -38,6 +39,8 @@ int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; BOOL xpbproxy_have_xfixes; +extern char *display; + #ifdef STANDALONE_XPBPROXY BOOL xpbproxy_is_standalone = NO; #endif @@ -67,10 +70,24 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) { BOOL xpbproxy_init (void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - xpbproxy_dpy = XOpenDisplay (NULL); + size_t i; + + for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) { + xpbproxy_dpy = XOpenDisplay(NULL); + + if(!xpbproxy_dpy && display) { + char _display[32]; + snprintf(_display, sizeof(_display), ":%s", display); + setenv("DISPLAY", _display, TRUE); + + xpbproxy_dpy=XOpenDisplay(_display); + } + if(!xpbproxy_dpy) + sleep(1); + } + if (xpbproxy_dpy == NULL) { - fprintf (stderr, "can't open default display\n"); + fprintf (stderr, "xpbproxy: can't open default display\n"); [pool release]; return FALSE; } @@ -80,7 +97,7 @@ BOOL xpbproxy_init (void) { if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base, &xpbproxy_apple_wm_error_base)) { - fprintf (stderr, "can't open AppleWM server extension\n"); + fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n"); [pool release]; return FALSE; } diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m index 960499557..cd540be98 100644 --- a/hw/xquartz/pbproxy/x-selection.m +++ b/hw/xquartz/pbproxy/x-selection.m @@ -97,12 +97,13 @@ dump_prefs (FILE *fp) { } #endif -#define APP_PREFS "org.x.X11" +extern CFStringRef app_prefs_domain_cfstr; + static BOOL prefs_get_bool (CFStringRef key, BOOL defaultValue) { Boolean value, ok; - value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok); + value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok); return ok ? (BOOL) value : defaultValue; } @@ -1425,7 +1426,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato * It's uncertain how we could handle the synchronization failing, so cast to void. * The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid. */ - (void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS)); + (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr); #ifdef STANDALONE_XPBPROXY if(xpbproxy_is_standalone) pbproxy_prefs.active = YES; diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h index 8b04b798e..c5da4c510 100644 --- a/hw/xquartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -54,20 +54,16 @@ typedef void (*InitInputProc)(int argc, char **argv); * Cursor functions */ typedef Bool (*InitCursorProc)(ScreenPtr pScreen); -typedef void (*CursorUpdateProc)(void); /* * Suspend and resume X11 activity */ typedef void (*SuspendScreenProc)(ScreenPtr pScreen); typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y); -typedef void (*CaptureScreensProc)(void); -typedef void (*ReleaseScreensProc)(void); /* * Screen state change support */ -typedef void (*ScreenChangedProc)(void); typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height); typedef void (*UpdateScreenProc)(ScreenPtr pScreen); @@ -101,14 +97,10 @@ typedef struct _QuartzModeProcs { InitInputProc InitInput; InitCursorProc InitCursor; - CursorUpdateProc CursorUpdate; // Not used if NULL SuspendScreenProc SuspendScreen; ResumeScreenProc ResumeScreen; - CaptureScreensProc CaptureScreens; // Only called in fullscreen - ReleaseScreensProc ReleaseScreens; // Only called in fullscreen - ScreenChangedProc ScreenChanged; AddPseudoramiXScreensProc AddPseudoramiXScreens; UpdateScreenProc UpdateScreen; diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index 8aaa57025..1ee2382aa 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -77,143 +77,6 @@ enum { #define UKEYSYM(u) ((u) | 0x01000000) -#define AltMask Mod1Mask -#define MetaMask Mod2Mask -#define FunctionMask Mod3Mask - -#define UK(a) NoSymbol // unknown symbol - -static KeySym const next_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, -// 128 - NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex, - XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, -// 144 - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave, - XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute, - XK_THORN, XK_mu, XK_multiply, XK_division, -// 160 - XK_copyright, XK_exclamdown, XK_cent, XK_sterling, - UK(fraction), XK_yen, UK(fhook), XK_section, - XK_currency, XK_rightsinglequotemark, - XK_leftdoublequotemark, - XK_guillemotleft, - XK_leftanglebracket, - XK_rightanglebracket, - UK(filigature), UK(flligature), -// 176 - XK_registered, XK_endash, XK_dagger, XK_doubledagger, - XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet), - XK_singlelowquotemark, - XK_doublelowquotemark, - XK_rightdoublequotemark, - XK_guillemotright, - XK_ellipsis, UK(permille), XK_notsign, XK_questiondown, -// 192 - XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex, - XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot, - XK_dead_diaeresis, - XK_twosuperior, XK_dead_abovering, - XK_dead_cedilla, - XK_threesuperior, - XK_dead_doubleacute, - XK_dead_ogonek, XK_dead_caron, -// 208 - XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf, - XK_threequarters, - XK_agrave, XK_aacute, XK_acircumflex, - XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, -// 224 - XK_igrave, XK_AE, XK_iacute, XK_ordfeminine, - XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde, - XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine, - XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde, -// 240 - XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute, - XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave, - XK_lstroke, XK_ooblique, XK_oe, XK_ssharp, - XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol, - }; - -#define MIN_SYMBOL 0xAC -static KeySym const symbol_to_x[] = { - XK_Left, XK_Up, XK_Right, XK_Down - }; -static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); - -#define MIN_FUNCKEY 0x20 -static KeySym const funckey_to_x[] = { - XK_F1, XK_F2, XK_F3, XK_F4, - XK_F5, XK_F6, XK_F7, XK_F8, - XK_F9, XK_F10, XK_F11, XK_F12, - XK_Insert, XK_Delete, XK_Home, XK_End, - XK_Page_Up, XK_Page_Down, XK_F13, XK_F14, - XK_F15 - }; -static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); - -typedef struct { - KeySym normalSym; - KeySym keypadSym; -} darwinKeyPad_t; - -static darwinKeyPad_t const normal_to_keypad[] = { - { XK_0, XK_KP_0 }, - { XK_1, XK_KP_1 }, - { XK_2, XK_KP_2 }, - { XK_3, XK_KP_3 }, - { XK_4, XK_KP_4 }, - { XK_5, XK_KP_5 }, - { XK_6, XK_KP_6 }, - { XK_7, XK_KP_7 }, - { XK_8, XK_KP_8 }, - { XK_9, XK_KP_9 }, - { XK_equal, XK_KP_Equal }, - { XK_asterisk, XK_KP_Multiply }, - { XK_plus, XK_KP_Add }, - { XK_comma, XK_KP_Separator }, - { XK_minus, XK_KP_Subtract }, - { XK_period, XK_KP_Decimal }, - { XK_slash, XK_KP_Divide } -}; - -static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); - /* Table of keycode->keysym mappings we use to fallback on for important keys that are often not in the Unicode mapping. */ @@ -733,24 +596,29 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n", (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data); #endif + KLGetCurrentKeyboardLayout (&key_layout); KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if(chr_data != NULL) { ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } +#endif } if (chr_data == NULL) { - ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n"); + ErrorF("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n"); ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n"); KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); is_uchr = 0; num_keycodes = 128; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if(chr_data != NULL) { ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } +#endif } #endif diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index a4ee30351..18406b89c 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -423,12 +423,8 @@ static QuartzModeProcsRec xprModeProcs = { xprSetupScreen, xprInitInput, QuartzInitCursor, - NULL, // No need to update cursor QuartzSuspendXCursor, QuartzResumeXCursor, - NULL, // No capture or release in rootless mode - NULL, - NULL, // Xplugin sends screen change events directly xprAddPseudoramiXScreens, xprUpdateScreen, xprIsX11Window, |