diff options
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/os-support')
22 files changed, 439 insertions, 106 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile index 16f6058a5..9b30dd159 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.42 2000/08/10 17:40:34 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.43 2000/11/06 19:24:08 dawes Exp $ @@ -26,10 +26,6 @@ OS_SUBDIR = qnx4 OS_SUBDIR = nto #endif -#if defined(ArcArchitecture) -OS_SUBDIR = bsd -#endif - #if defined(SVR3Architecture) # if defined(i386ScoArchitecture) OS_SUBDIR = sco @@ -66,16 +62,13 @@ OS_SUBDIR = linux OS_SUBDIR = lynxos #endif -#if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) -# if defined(BSDOSArchitecture) -OS_SUBDIR = bsdi -# else +#if defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || \ + defined(OpenBSDArchitecture) OS_SUBDIR = bsd -# endif #endif -#if defined(NetBSDArchitecture) && defined(Arm32Architecture) -OS_SUBDIR = bsd +#if defined(BSDOSArchitecture) +OS_SUBDIR = bsdi #endif #if defined(i386MachArchitecture) || defined(OsfArchitecture) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile index 65642f566..874355c26 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/12 1996/10/27 11:06:35 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.45 2000/08/16 01:45:29 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.46 2000/11/06 19:24:08 dawes Exp $ #include <Server.tmpl> @@ -29,6 +29,9 @@ SHARED_CFLAGS = PositionIndependentCFlags IOPERMDEFINES = -DUSE_ARC_MMAP # elif defined(Arm32Architecture) IOPERMDEFINES = -DUSE_ARM32_MMAP +# elif defined(PpcArchitecture) + IOPERM_SRC = ioperm_noop.c + IOPERM_OBJ = ioperm_noop.o # else IOPERMDEFINES = -DUSE_I386_IOPL # endif @@ -65,7 +68,8 @@ SUBDIRS = libusb #endif -#if defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) +#if (defined(NetBSDArchitecture) || defined(OpenBSDArchitecture)) \ + && defined(i386Architecture) APMSRC = bsd_apm.c APMOBJ = bsd_apm.o #else @@ -113,7 +117,7 @@ OBJS = bsd_init.o bsd_video.o bsd_io.o bsd_VTsw.o \ $(AXP_OBJ) $(KMODOBJ) $(AGP_OBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi -I$(APINCLUDES) \ + -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi $(APINCLUDES) \ $(LIBUSBINCLUDES) CONSDEFINES = XFree86ConsoleDefines @@ -122,7 +126,7 @@ RESDEFINES = -DUSESTDRES #if HasNetBSDApertureDriver APDIR = NetBSDApertureDir APDEFINES = -DHAS_APERTURE_DRV -APINCLUDES = $(APDIR)/include +APINCLUDES = -I$(APDIR)/include #endif DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \ @@ -154,7 +158,8 @@ InstallDynamicModule(bsd_jstk.o,$(MODULEDIR),input) # endif #endif -#if !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) +#if !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) || \ + !defined(i386Architecture) LinkSourceFile(pm_noop.c,../shared) #endif LinkSourceFile(ioperm_noop.c,../shared) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c index ee075f113..a94be5ecb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.1 2000/03/05 16:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.2 2000/11/06 19:24:08 dawes Exp $ */ /* Resource information code */ @@ -89,6 +89,44 @@ xf86AccResFromOS(resPtr ret) return ret; } +#elif defined(__powerpc__) + +resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; + +resPtr +xf86BusAccWindowsFromOS(void) +{ + resPtr ret = NULL; + resRange range; + + RANGE(range, 0, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + + RANGE(range, 0, 0x0000ffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + return ret; +} + +resPtr +xf86PciBusAccWindowsFromOS(void) +{ + resPtr ret = NULL; + resRange range; + + RANGE(range, 0, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + + RANGE(range, 0, 0x0000ffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + return ret; +} + +resPtr +xf86AccResFromOS(resPtr ret) +{ + return ret; +} + #else #error : Put your platform dependent code here!! diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c index f2d289367..73ad37281 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.13 1999/04/28 05:36:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.14 2000/11/06 19:24:08 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -84,6 +84,9 @@ static char *supported_drivers[] = { #ifdef PCVT_SUPPORT "pcvt", #endif +#ifdef WSCONS_SUPPORT + "wscons", +#endif }; @@ -109,6 +112,10 @@ static int xf86OpenSyscons(void); static int xf86OpenPcvt(void); #endif /* PCVT_SUPPORT */ +#ifdef WSCONS_SUPPORT +static int xf86OpenWScons(void); +#endif + /* * The sequence of the driver probes is important; start with the * driver that is best distinguishable, and end with the most generic @@ -125,6 +132,9 @@ static xf86ConsOpen_t xf86ConsTab[] = { #ifdef PCCONS_SUPPORT xf86OpenPccons, #endif +#ifdef WSCONS_SUPPORT + xf86OpenWScons, +#endif (xf86ConsOpen_t)NULL }; @@ -265,6 +275,12 @@ xf86OpenConsole() } break; #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#ifdef WSCONS_SUPPORT + case WSCONS: + fprintf(stderr, "xf86OpenConsole\n"); + /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */ + break; +#endif } } else @@ -549,6 +565,35 @@ xf86OpenPcvt() #endif /* PCVT_SUPPORT */ +#ifdef WSCONS_SUPPORT + +static int +xf86OpenWScons() +{ + int fd = -1; + int mode = WSDISPLAYIO_MODE_MAPPED; + int i; + char ttyname[16]; + + /* XXX Is this ok? */ + for (i = 0; i < 8; i++) { + sprintf(ttyname, "/dev/ttyE%d", i); + if ((fd = open(ttyname, 2)) != -1) + break; + } + if (fd != -1) { + if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) { + FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s\n", + "xf86OpenConsole", strerror(errno), + CHECK_DRIVER_MSG); + } + xf86Info.consType = WSCONS; + xf86Msg(X_PROBED, "Using wscons driver\n"); + } + return fd; +} + +#endif /* WSCONS_SUPPORT */ void xf86CloseConsole() @@ -584,6 +629,14 @@ xf86CloseConsole() ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT); break; #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#ifdef WSCONS_SUPPORT + case WSCONS: + { + int mode = WSDISPLAYIO_MODE_EMUL; + ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode); + break; + } +#endif } if (xf86Info.screenFd != xf86Info.consoleFd) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c index b0ced38d2..3b78fb833 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.17 1999/09/04 13:04:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.18 2000/11/06 19:24:08 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -159,6 +159,10 @@ xf86KbdOn() #endif break; #endif +#ifdef WSCONS_SUPPORT + case WSCONS: + return xf86Info.kbdFd; +#endif } return(xf86Info.consoleFd); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c index b5a9cb6f8..9f1b00077 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.35 2000/08/11 17:27:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.37 2000/11/06 19:24:08 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -167,18 +167,23 @@ static int devMemFd = -1; #endif #define DEV_MEM "/dev/mem" -static pointer mapVidMem(int, unsigned long, unsigned long); +static pointer mapVidMem(int, unsigned long, unsigned long, int); static void unmapVidMem(int, pointer, unsigned long); #ifdef __alpha__ -static pointer mapVidMemSparse(int, unsigned long, unsigned long); +static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); static void unmapVidMemSparse(int, pointer, unsigned long); #endif +#ifdef __powerpc__ +static pointer ppcMapVidMem(int, unsigned long, unsigned long); +static void ppcUnmapVidMem(int, pointer, unsigned long); +#endif #ifdef HAS_MTRR_SUPPORT static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); static void undoWC(int, pointer); static Bool cleanMTRR(void); #endif +#if !defined(__powerpc__) /* * Check if /dev/mem can be mmap'd. If it can't print a warning when * "warn" is TRUE. @@ -267,12 +272,17 @@ checkDevMem(Bool warn) #endif } +#endif /* !__powerpc__ */ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { +#if defined(__powerpc__) + pVidMem->linearSupported = TRUE; +#else checkDevMem(TRUE); pVidMem->linearSupported = useDevMem; +#endif #if defined(__alpha__) if (has_bwx()) { xf86Msg(X_INFO,"Machine type has 8/16 bit access\n"); @@ -286,6 +296,9 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) #elif defined(__arm32__) pVidMem->mapMem = armMapVidMem; pVidMem->unmapVidMem = armUnmapVidMem; +#elif defined(__powerpc__) + pVidMem->mapMem = ppcMapVidMem; + pVidMem->unmapMem = ppcUnmapVidMem; #else pVidMem->mapMem = mapVidMem; pVidMem->unmapMem = unmapVidMem; @@ -302,8 +315,9 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->initialised = TRUE; } +#if !defined(__powerpc__) static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; @@ -385,8 +399,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); if ((long)ptr == -1) { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n", - DEV_MEM, strerror(errno)); + xf86Msg(X_WARNING, + "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", + DEV_MEM, Len, Base, Offset, strerror(errno)); return(-1); } #ifdef DEBUG @@ -395,9 +410,14 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, #endif (void)memcpy(Buf, (void *)(ptr + Offset), Len); (void)munmap((caddr_t)ptr, mlen); + xf86Msg(X_INFO, "xf86ReadBIOS(%x, %x, Buf, %x)" + "-> %02x %02x %02x %02x...\n", + Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); return(Len); } +#endif /* !__powerpc__ */ + #ifdef __arm32__ /* XXX This needs to be updated for the ND */ @@ -530,7 +550,7 @@ xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size) } static pointer -armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { struct memAccess *memInfoP; @@ -558,7 +578,7 @@ armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) base = xf86MapInfoMap(memInfoP, Base, Size); return (base); } - return mapVidMem(ScreenNum, Base, Size); + return mapVidMem(ScreenNum, Base, Size, flags); } static void @@ -574,6 +594,63 @@ armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) } #endif /* __arm32__ */ +#if defined(__powerpc__) + +volatile unsigned char *ioBase = MAP_FAILED; + +static pointer +ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +{ + int fd = xf86Info.screenFd; + pointer base; + + fprintf(stderr, "mapVidMem %lx, %lx, fd = %d\n", Base, Size, fd); + + base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base); + if (base == MAP_FAILED) + FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", Size, Base, strerror(errno)); + + return base; +} + +static void +ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap(Base, Size); +} + +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + int rv; + int kmem; + + kmem = open("/dev/kmem", 2); + if (kmem == -1) { + FatalError("xf86ReadBIOS: open /dev/kmem\n"); + } + + + fprintf(stderr, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); + + if (Base < 0x80000000) { + fprintf(stderr, "No VGA\n"); + return 0; + } + + + lseek(kmem, Base + Offset, 0); + rv = read(kmem, Buf, Len); + close(kmem); + + return rv; +} + + +#endif /* __powerpc__ */ + #ifdef USE_I386_IOPL /***************************************************************************/ /* I/O Permissions section */ @@ -710,7 +787,8 @@ Bool xf86DisableInterrupts() { -#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) +#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) && \ + !defined(__powerpc__) #ifdef __GNUC__ __asm__ __volatile__("cli"); #else @@ -725,7 +803,8 @@ void xf86EnableInterrupts() { -#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) +#if !defined(__mips__) && !defined(__arm32__) && !defined(__alpha__) && \ + !defined(__powerpc__) #ifdef __GNUC__ __asm__ __volatile__("sti"); #else @@ -736,6 +815,24 @@ xf86EnableInterrupts() return; } +/************************************************************************/ +/* This is required for the loader */ +/************************************************************************/ +#if defined(__powerpc__) +void +ppc_flush_icache(char *addr) +{ + __asm__ volatile ( + "dcbf 0,%0;" + "sync;" + "icbi 0,%0;" + "sync;" + "isync;" + : : "r"(addr) : "memory"); +} +#endif + + #ifdef __NetBSD__ /***************************************************************************/ /* Set TV output mode */ @@ -1345,7 +1442,7 @@ sethae(u_int64_t hae) } static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { static Bool was_here = FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile index 764440fdc..c37b982df 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/27 18:07:43 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.13 2000/06/13 02:28:36 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.14 2000/11/06 19:24:09 dawes Exp $ #include <Server.tmpl> @@ -30,6 +30,13 @@ XCOMM generic linux PCI driver (using /proc/bus/pci, requires kernel 2.2) PCIDRVRSRC = linuxPci.c PCIDRVROBJ = linuxPci.o +#elif defined(OpenBSDArchitecture) && defined(PpcArchitecture) + +XCOMM OpenBSD/powerpc + +PCIDRVRSRC = freebsdPci.c +PCIDRVROBJ = freebsdPci.o + #elif defined(PpcArchitecture) XCOMM PowerPC PCI drivers diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c index 9de4fa9c7..ffbcfa0bc 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.35 2000/10/17 16:53:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.37 2000/10/28 13:35:06 tsi Exp $ */ /* * Pci.c - New server PCI access functions * diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h index 6c3f44ed8..b73bb6446 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.14 2000/10/17 16:53:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.15 2000/11/06 19:24:09 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -139,6 +139,9 @@ #if (defined(__powerpc__) || defined(__mips__)) && defined(linux) # define ARCH_PCI_INIT linuxPciInit # define INCLUDE_XF86_MAP_PCI_MEM +#elif defined(__powerpc__) && defined(__OpenBSD__) +# define ARCH_PCI_INIT freebsdPciInit +# define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__powerpc__) # define ARCH_PCI_INIT ppcPciInit # if !defined(PowerMAX_OS) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c index 43f7cc7f9..b566246bd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.1 2000/02/12 20:45:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.2 2000/11/06 19:24:09 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -79,6 +79,7 @@ pciBusInfo_t freebsdPci0 = { /* pciBusPriv */ NULL }; +#if !defined(__OpenBSD__) #if X_BYTE_ORDER == X_BIG_ENDIAN #ifdef __sparc__ #ifndef ASI_PL @@ -98,6 +99,11 @@ __ret; \ #else #define PCI_CPU(val) (val) #endif +#else /* ! OpenBSD */ +/* OpenBSD has already the bytes in the right order + for all architectures */ +#define PCI_CPU(val) (val) +#endif #define BUS(tag) (((tag)>>16)&0xff) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c index e3a0b7e5c..0967641d7 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.2 2000/04/04 19:25:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.3 2000/11/02 19:10:55 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -135,45 +135,4 @@ sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) val = (val & ~mask) | (bits & mask); syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); } - -int sparcUseHWMulDiv(void); - -#if defined(__GNUC__) && defined(__GLIBC__) -#define HWCAP_SPARC_MULDIV 8 -extern unsigned long int _dl_hwcap; -#endif - -int -sparcUseHWMulDiv(void) -{ - FILE *f; - char buffer[1024]; - char *p; -#if defined(__GNUC__) && defined(__GLIBC__) - unsigned long *hwcap; - __asm(".weak _dl_hwcap"); - - hwcap = &_dl_hwcap; - __asm("" : "=r" (hwcap) : "0" (hwcap)); - if (hwcap) { - if (*hwcap & HWCAP_SPARC_MULDIV) - return 1; - else - return 0; - } -#endif - f = fopen("/proc/cpuinfo","r"); - if (!f) return 0; - while (fgets(buffer, 1024, f) != NULL) { - if (!strncmp (buffer, "type", 4)) { - p = strstr (buffer, "sun4"); - if (p && (p[4] == 'u' || p[4] == 'd' || p[4] == 'm')) { - fclose(f); - return 1; - } - } - } - fclose(f); - return 0; -} #endif /* Linux */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c index 04a9ececc..29cce2f8a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.15 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.16 2000/11/03 18:30:49 eich Exp $ */ /* * linux specific part of the int10 module * Copyright 1999 Egbert Eich @@ -67,7 +67,7 @@ xf86InitInt10(int entityIndex) char *base_high; int pagesize; legacyVGARec vga; - + screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; if (int10skip(xf86Screens[screen],entityIndex)) return NULL; @@ -161,7 +161,6 @@ xf86InitInt10(int entityIndex) #endif if (xf86IsEntityPrimary(entityIndex)) { - int size; int cs = ((CARD16*)0)[(0x10<<1)+1]; CARD8 *bios_base = (unsigned char *)(cs << 4); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c new file mode 100644 index 000000000..50d338fde --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c @@ -0,0 +1,98 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.2 2000/11/06 21:57:11 dawes Exp $ */ + +#include <stdio.h> +#include "X.h" +#include "os.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86Axp.h" + +axpDevice lnxGetAXP(void); + +static AXP axpList[] = { + { "Tsunami", NULL, NULL, TSUNAMI }, + { "Eiger", NULL, NULL, TSUNAMI }, + {"Noname", NULL, NULL, LCA }, + { "AlphaBook1", NULL, NULL, LCA }, + {"EB66", NULL, NULL, LCA}, + {"EB64+",NULL,NULL, APECS}, + {"Noritake",NULL,NULL,APECS}, + {"XL",NULL,NULL,APECS}, + {"Avanti",NULL,NULL,APECS}, + {"Mikasa",NULL,"EV5",CIA}, + {"Mikasa",NULL,"EV56",CIA}, + {"Mikasa",NULL,NULL,APECS}, + {"EB164","EB164",NULL,APECS}, + {"EB164","PC164", NULL,CIA}, + {"EB164","RX164",NULL, POLARIS}, + {"EB164","LX164",NULL, PYXIS}, + {"Alcor",NULL,NULL,CIA}, + {"Takara",NULL,NULL,CIA}, + {"Sable",NULL, "EV5",T2_GAMMA}, + {"Sable",NULL,"EV56",T2_GAMMA}, + {"Sable",NULL,NULL,T2}, + {"Rawhide",NULL,NULL,MCPCIA}, + {"Jensen",NULL,NULL,JENSEN}, + {"Miata",NULL,NULL,PYXIS_CIA}, + {"Ruffian",NULL,NULL,PYXIS_CIA}, + {"Nautilus",NULL,NULL,IRONGATE}, + {NULL,NULL,NULL,NONE} +}; + + +axpDevice +lnxGetAXP(void) +{ + FILE *file; + int count = 0; + char res[256]; + char cpu[255]; + char systype[255]; + char sysvari[255]; + if (!(file = fopen("/proc/cpuinfo","r"))) + return SYS_NONE; + do { + if (!fgets(res,0xff,file)) return SYS_NONE; + switch (count) { + case 1: + sscanf(res, "cpu model : %s",cpu); +#ifdef DEBUG + ErrorF("CPU %s\n",cpu); +#endif + break; + case 5: + sscanf(res, "system type : %s",systype); +#ifdef DEBUG + ErrorF("system type : %s\n",systype); +#endif + break; + case 6: + sscanf(res, "system variation : %s",sysvari); +#ifdef DEBUG + ErrorF("system variation: %s\n",sysvari); +#endif + break; + } + count++; + } while (count < 8); + + fclose(file); + + count = 0; + + do { + if (!axpList[count].sysName || !strcmp(axpList[count].sysName,systype)) { + if (axpList[count].sysVari && strcmp(axpList[count].sysVari,sysvari)) { + count++; + continue; + }; + if (axpList[count].cpu && strcmp(axpList[count].cpu,cpu)) { + count++; + continue; + } + return axpList[count].sys; + } + count++; + } while (1); +} + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c index 0b570ba68..4553552b3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.37 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.38 2000/10/28 01:42:27 mvojkovi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -80,13 +80,13 @@ extern void sethae(unsigned long hae); /* Video Memory Mapping section */ /***************************************************************************/ -static pointer mapVidMem(int, unsigned long, unsigned long); +static pointer mapVidMem(int, unsigned long, unsigned long, int); static void unmapVidMem(int, pointer, unsigned long); #if defined (__alpha__) -static pointer mapVidMemSparse(int, unsigned long, unsigned long); +static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); static void unmapVidMemSparse(int, pointer, unsigned long); # if defined(JENSEN_SUPPORT) -static pointer mapVidMemJensen(int, unsigned long, unsigned long); +static pointer mapVidMemJensen(int, unsigned long, unsigned long, int); static void unmapVidMemJensen(int, pointer, unsigned long); # endif #endif @@ -329,13 +329,28 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; int fd; - + int mapflags = MAP_SHARED; + #if defined(__ia64__) - if ((fd = open(DEV_MEM, O_RDWR | O_SYNC)) < 0) { +#ifndef MAP_WRITECOMBINED +#define MAP_WRITECOMBINED 0x00010000 +#endif +#ifndef MAP_NONCACHED +#define MAP_NONCACHED 0x00020000 +#endif + if(flags & VIDMEM_FRAMEBUFFER) + mapflags |= MAP_WRITECOMBINED; + else + mapflags |= MAP_NONCACHED; +#endif + +#if defined(__ia64_) + /* this will disappear when people upgrade their kernels */ + if ((fd = open(DEV_MEM, O_RDWR|O_SYNC)) < 0) { #else if ((fd = open(DEV_MEM, O_RDWR)) < 0) { #endif @@ -345,7 +360,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) /* This requires linux-0.99.pl10 or above */ base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, + mapflags, fd, (off_t)(off_t)Base + BUS_BASE); close(fd); if (base == MAP_FAILED) { @@ -520,7 +535,7 @@ static void writeSparse32(int Value, pointer Base, register unsigned long Offset); static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd; static Bool was_here = FALSE; @@ -764,7 +779,7 @@ writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset); #define JENSEN_SHIFT(x) ((long)x<<SPARSE) static pointer -mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; int fd; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c index 7ffd9056c..e67b64621 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.16 2000/04/17 16:30:13 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.17 2000/10/28 01:42:27 mvojkovi Exp $ */ #include "X.h" #include "input.h" @@ -91,7 +91,7 @@ smemCleanup(void) } static pointer -MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { static int once; int free_slot = -1; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile index 3fb7ba9fb..c8ea7c804 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.9 2000/08/10 17:40:36 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.10 2000/11/02 19:10:56 dawes Exp $ @@ -12,8 +12,8 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:12 rws $ XSRCS = BUSmemcpy.S IODelay.S SlowBcopy.S XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o #elif defined(SparcArchitecture) -XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c SparcMulDiv.S -XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o SparcMulDiv.o +XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c +XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o #else XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o @@ -39,9 +39,6 @@ ObjectFromAsmSource(BUSmemcpy,NullParameter) ObjectFromAsmSource(IODelay,NullParameter) ObjectFromAsmSource(SlowBcopy,NullParameter) #endif -#if defined(SparcArchitecture) -ObjectFromAsmSource(SparcMulDiv,NullParameter) -#endif DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c b/xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c index fce28d654..7dc19880a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.13 2000/04/05 18:13:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.14 2000/10/28 01:42:28 mvojkovi Exp $ */ /* * (c) Copyright 1994,1999 by Holger Veit * <Holger.Veit@gmd.de> @@ -102,7 +102,7 @@ typedef struct { /* ARGSUSED */ static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { DIOParPkt par; ULONG plen; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c index fb71e4f33..69c485202 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.12 2000/07/11 01:46:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.13 2000/10/28 01:42:28 mvojkovi Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc * @@ -153,7 +153,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) if (!vidMemInfo.initialised || !vidMemInfo.mapMem) return NULL; - vbase = vidMemInfo.mapMem(ScreenNum, Base, Size); + vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); if (!vbase || vbase == (pointer)-1) return NULL; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c new file mode 100644 index 000000000..24d31db59 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c @@ -0,0 +1,20 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c,v 1.2 2000/11/06 21:57:11 dawes Exp $ */ + +#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/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h new file mode 100644 index 000000000..23d6f8609 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h @@ -0,0 +1,39 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h,v 1.2 2000/11/06 21:57:11 dawes Exp $ */ + +#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 + { char* sysName; + char* sysVari; + char* cpu; + axpDevice sys; } +AXP; + +typedef struct { + axpDevice id; + unsigned long hae_thresh; + unsigned long hae_mask; + unsigned long size; +} axpParams; + +extern axpParams xf86AXPParams[]; + +#endif + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c b/xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c index 7bbbb8013..ab604e95a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.19 1999/05/15 14:31:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.20 2000/10/28 01:42:29 mvojkovi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -138,7 +138,7 @@ linearVidMem() } static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size) +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; int fd; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h index 4bef78436..c3224aeeb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h,v 1.4 2000/02/15 02:00:14 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h,v 1.5 2000/10/28 01:42:24 mvojkovi Exp $ */ #ifndef _XF86OSPRIV_H #define _XF86OSPRIV_H -typedef pointer (*MapMemProcPtr)(int, unsigned long, unsigned long); +typedef pointer (*MapMemProcPtr)(int, unsigned long, unsigned long, int); typedef void (*UnmapMemProcPtr)(int, pointer, unsigned long); typedef pointer (*SetWCProcPtr)(int, unsigned long, unsigned long, Bool, MessageType); |