diff options
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/shared')
-rw-r--r-- | xorg-server/hw/xfree86/os-support/shared/bios_mmap.c | 135 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/os-support/shared/vidmem.c | 205 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/os-support/shared/xf86Axp.c | 60 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/os-support/shared/xf86Axp.h | 33 |
4 files changed, 0 insertions, 433 deletions
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c deleted file mode 100644 index e000dc9c8..000000000 --- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 1993 by David Wexelblat <dwex@goblin.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 name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -#ifndef __alpha__ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return -1; - } - psize = getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t) Base); - if (ptr == MAP_FAILED) { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return -1; - } - DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); - (void) memcpy(Buf, (void *) (ptr + Offset), Len); - (void) munmap((caddr_t) ptr, mlen); - (void) close(fd); - return Len; -} - -#else /* __alpha__ */ - - /* - * We trick "mmap" into mapping BUS memory for us via BUS_BASE, - * which is the KSEG address of the start of the DENSE memory - * area. - */ - - /* - * NOTE: there prolly ought to be more validity checks and all - * re: boundaries and sizes and such... - */ - -#ifdef linux - -extern unsigned long _bus_base(void); - -#define BUS_BASE _bus_base() - -#else - -extern u_int64_t dense_base(void); - -#define BUS_BASE dense_base() - -#endif - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - caddr_t base; - int fd; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return -1; - } - - psize = getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - base = mmap((caddr_t) 0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t) (Base + BUS_BASE)); - - if (base == MAP_FAILED) { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - return -1; - } - - xf86SlowBCopyFromBus((unsigned char *) (base + Offset), Buf, Len); - - munmap((caddr_t) base, mlen); - close(fd); - return Len; -} - -#endif /* __alpha__ */ diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c index f473293c7..a6bf677f5 100644 --- a/xorg-server/hw/xfree86/os-support/shared/vidmem.c +++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c @@ -42,119 +42,7 @@ * This file contains the common part of the video memory mapping functions */ -/* - * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold - * the MTRR option information, but it is likely to be expanded if we do - * auto unmapping of memory at VT switch. - * - */ - -typedef struct { - unsigned long size; - void *virtBase; - void *mtrrInfo; -} MappingRec, *MappingPtr; - -typedef struct { - int numMappings; - MappingPtr *mappings; - Bool mtrrEnabled; - MessageType mtrrFrom; - Bool mtrrOptChecked; - ScrnInfoPtr pScrn; -} VidMapRec, *VidMapPtr; - -static int vidMapIndex = -1; - -#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr)) - static VidMemInfo vidMemInfo = { FALSE, }; -static VidMapRec vidMapRec = { 0, NULL, TRUE, X_DEFAULT, FALSE, NULL }; - -static VidMapPtr -getVidMapRec(int scrnIndex) -{ - VidMapPtr vp; - ScrnInfoPtr pScrn; - - if ((scrnIndex < 0) || !(pScrn = xf86Screens[scrnIndex])) - return &vidMapRec; - - if (vidMapIndex < 0) - vidMapIndex = xf86AllocateScrnInfoPrivateIndex(); - - if (VIDMAPPTR(pScrn) != NULL) - return VIDMAPPTR(pScrn); - - vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1); - vp->mtrrEnabled = TRUE; /* default to enabled */ - vp->mtrrFrom = X_DEFAULT; - vp->mtrrOptChecked = FALSE; - vp->pScrn = pScrn; - return vp; -} - -static MappingPtr -newMapping(VidMapPtr vp) -{ - vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) * - (vp->numMappings + 1)); - vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1); - return vp->mappings[vp->numMappings++]; -} - -static MappingPtr -findMapping(VidMapPtr vp, void *vbase, unsigned long size) -{ - int i; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i]->virtBase == vbase && vp->mappings[i]->size == size) - return vp->mappings[i]; - } - return NULL; -} - -static void -removeMapping(VidMapPtr vp, MappingPtr mp) -{ - int i, found = 0; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i] == mp) { - found = 1; - free(vp->mappings[i]); - } - else if (found) { - vp->mappings[i - 1] = vp->mappings[i]; - } - } - vp->numMappings--; - vp->mappings[vp->numMappings] = NULL; -} - -enum { OPTION_MTRR }; - -static const OptionInfoRec opts[] = { - {OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE}, - {-1, NULL, OPTV_NONE, {0}, FALSE} -}; - -static void -checkMtrrOption(VidMapPtr vp) -{ - if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) { - OptionInfoPtr options; - - options = xnfalloc(sizeof(opts)); - (void) memcpy(options, opts, sizeof(opts)); - xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, options); - if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled)) - vp->mtrrFrom = X_CONFIG; - free(options); - vp->mtrrOptChecked = TRUE; - } -} void xf86InitVidMem(void) @@ -164,96 +52,3 @@ xf86InitVidMem(void) xf86OSInitVidMem(&vidMemInfo); } } - -void * -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - void *vbase = NULL; - VidMapPtr vp; - MappingPtr mp; - - if (((Flags & VIDMEM_FRAMEBUFFER) && - (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) - FatalError("Mapping memory with more than one type\n"); - - xf86InitVidMem(); - if (!vidMemInfo.initialised || !vidMemInfo.mapMem) - return NULL; - - vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); - - if (!vbase || vbase == (void *) -1) - return NULL; - - vp = getVidMapRec(ScreenNum); - mp = newMapping(vp); - mp->size = Size; - mp->virtBase = vbase; - - /* - * Check the "mtrr" option even when MTRR isn't supported to avoid - * warnings about unrecognised options. - */ - checkMtrrOption(vp); - - if (vp->mtrrEnabled && vidMemInfo.setWC) { - if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)) - mp->mtrrInfo = - vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom); - else if (Flags & VIDMEM_FRAMEBUFFER) - mp->mtrrInfo = - vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom); - } - return vbase; -} - -void -xf86UnMapVidMem(int ScreenNum, void *Base, unsigned long Size) -{ - VidMapPtr vp; - MappingPtr mp; - - if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) { - xf86DrvMsg(ScreenNum, X_WARNING, - "xf86UnMapVidMem() called before xf86MapVidMem()\n"); - return; - } - - vp = getVidMapRec(ScreenNum); - mp = findMapping(vp, Base, Size); - if (!mp) { - xf86DrvMsg(ScreenNum, X_WARNING, - "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n", - Base, Size); - return; - } - if (vp->mtrrEnabled && vidMemInfo.undoWC && mp) - vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo); - - vidMemInfo.unmapMem(ScreenNum, Base, Size); - removeMapping(vp, mp); -} - -Bool -xf86CheckMTRR(int ScreenNum) -{ - VidMapPtr vp = getVidMapRec(ScreenNum); - - /* - * Check the "mtrr" option even when MTRR isn't supported to avoid - * warnings about unrecognised options. - */ - checkMtrrOption(vp); - - if (vp->mtrrEnabled && vidMemInfo.setWC) - return TRUE; - - return FALSE; -} - -Bool -xf86LinearVidMem(void) -{ - xf86InitVidMem(); - return vidMemInfo.linearSupported; -} diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c deleted file mode 100644 index 5f2f3985e..000000000 --- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 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). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Axp.h" - -axpParams xf86AXPParams[] = { - {SYS_NONE, 0, 0, 0} - , - {TSUNAMI, 0, 0, 0} - , - {LCA, 1 << 24, 0xf8000000, 1UL << 32} - , - {APECS, 1 << 24, 0xf8000000, 1UL << 32} - , - {T2, 0, 0xFC000000, 1UL << 31} - , - {T2_GAMMA, 0, 0xFC000000, 1UL << 31} - , - {CIA, 0, 0xE0000000, 1UL << 34} - , - {MCPCIA, 0, 0xf8000000, 1UL << 31} - , - {JENSEN, 0, 0xE000000, 1UL << 32} - , - {POLARIS, 0, 0, 0} - , - {PYXIS, 0, 0, 0} - , - {PYXIS_CIA, 0, 0xE0000000, 1UL << 34} - , - {IRONGATE, 0, 0, 0} -}; diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h deleted file mode 100644 index fded9d8c9..000000000 --- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#ifndef _XF86_AXP_H_ -#define _XF86_AXP_H_ - -typedef enum { - SYS_NONE, - TSUNAMI, - LCA, - APECS, - T2, - T2_GAMMA, - CIA, - MCPCIA, - JENSEN, - POLARIS, - PYXIS, - PYXIS_CIA, - IRONGATE -} axpDevice; - -typedef struct { - axpDevice id; - unsigned long hae_thresh; - unsigned long hae_mask; - unsigned long size; -} axpParams; - -extern axpParams xf86AXPParams[]; - -#endif |