diff --git a/x11/XFree86-4-libraries/files/patch-8 b/x11/XFree86-4-libraries/files/patch-8 deleted file mode 100644 index 577efa3c9216..000000000000 --- a/x11/XFree86-4-libraries/files/patch-8 +++ /dev/null @@ -1,19 +0,0 @@ ---- programs/xterm/termcap.orig Mon May 10 15:10:04 1999 -+++ programs/xterm/termcap Mon Sep 27 02:32:32 1999 -@@ -32,7 +32,7 @@ - :k;=\E[21~:F1=\E[23~:F2=\E[24~:\ - :kn#12:\ - :kH=\E[4~::@7=\E[4~:kh=\E[1~:\ -- :@0=\E[1~:kI=\E[2~:kD=^?:\ -+ :@0=\E[1~:kI=\E[2~:kD=^?:\ - :*6=\E[4~:kP=\E[5~:kN=\E[6~:\ - :km:\ - :kb=^H:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\ -@@ -125,6 +125,6 @@ - # This is the only entry which you should have to customize, since "xterm" - # is widely used for a variety of incompatible terminal emulations including - # color_xterm and rxvt. --v0|xterm|X11 terminal emulator:\ -+v0|xterm|X11 terminal emulator:\ - :tc=xterm-xfree86: - # :tc=xterm-r6: diff --git a/x11/XFree86-4-libraries/files/patch-9 b/x11/XFree86-4-libraries/files/patch-9 deleted file mode 100644 index 1cca9510c9b4..000000000000 --- a/x11/XFree86-4-libraries/files/patch-9 +++ /dev/null @@ -1,11 +0,0 @@ ---- programs/Xserver/hw/xfree86/vga256/drivers/s3v/regs3v.h~ Mon Sep 6 10:47:18 1999 -+++ programs/Xserver/hw/xfree86/vga256/drivers/s3v/regs3v.h Fri Sep 24 14:39:18 1999 -@@ -421,7 +421,7 @@ - - /* Wait until Command FIFO is empty */ - #define WaitCommandEmpty() do { int loop=0; mem_barrier(); \ -- if (s3vPriv.chip == S3_ViRGE_GX2 || s3vPriv.chip == S3_ViRGE_MX || s3vPriv.chip == S3_ViRGE_MXP) \ -+ if (S3_ViRGE_GX2_SERIES(s3vPriv.chip) || S3_ViRGE_MX_SERIES(s3vPriv.chip)) \ - while ((!(((((mmtr)s3vMmioMem)->subsys_regs.regs.adv_func_cntl)) & 0x400)) && (loop++subsys_regs.regs.adv_func_cntl)) & 0x400)) && (loop++ 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5) +-#define DefaultGcc2i386Opt -O2 ++#define DefaultGcc2i386Opt + #endif + #endif + + #ifdef i386Architecture + # define OptimizedCDebugFlags DefaultGcc2i386Opt + #else +-# define OptimizedCDebugFlags -O2 ++# define OptimizedCDebugFlags + #endif + + #ifndef PreIncDir +@@ -449,14 +454,18 @@ + #define DlLibrary /**/ + #endif + ++#ifdef AlphaArchitecture ++#define IoLibrary -lio ++#else ++#define IoLibrary /**/ ++#endif ++ + #if BuildDynamicLoading +-#define ServerExtraSysLibs DlLibrary ++#define ServerExtraSysLibs DlLibrary IoLibrary + #else +-#define ServerExtraSysLibs /**/ ++#define ServerExtraSysLibs IoLibrary + #endif + + #include + +-#ifdef i386Architecture + #include +-#endif +--- /usr/ports/x11/XFree86/work/xc/config/cf/Imake.cf Fri Nov 13 14:10:12 1998 ++++ config/cf/Imake.cf Tue Dec 8 10:05:49 1998 +@@ -160,6 +160,11 @@ + # define i386Architecture + # undef i386 + # endif ++# ifdef __alpha__ ++# define AlphaBsdArchitecture ++# define AlphaArchitecture ++# undef __alpha__ ++# endif + #endif /* __FreeBSD__ */ + + #ifdef AMOEBA diff --git a/x11/XFree86/files/patch-01 b/x11/XFree86/files/patch-01 new file mode 100644 index 000000000000..677d184b5c89 --- /dev/null +++ b/x11/XFree86/files/patch-01 @@ -0,0 +1,12 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/config/cf/xfree86.cf config/cf/xfree86.cf +--- /usr/ports/x11/XFree86/work/xc/config/cf/xfree86.cf Sun Nov 8 11:19:11 1998 ++++ config/cf/xfree86.cf Tue Dec 8 10:05:55 1998 +@@ -853,7 +853,7 @@ + #endif + + #ifndef XFree86ConsoleDefines +-#ifdef i386BsdArchitecture ++#if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) + #define XFree86ConsoleDefines -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT + #else + #define XFree86ConsoleDefines /**/ diff --git a/x11/XFree86/files/patch-02 b/x11/XFree86/files/patch-02 new file mode 100644 index 000000000000..036e849db7fe --- /dev/null +++ b/x11/XFree86/files/patch-02 @@ -0,0 +1,30 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h Mon Dec 23 06:31:04 1996 ++++ programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h Tue Dec 8 10:05:55 1998 +@@ -37,6 +37,18 @@ + #define outw(p,v) _outw((v),(p)) + #define outl(p,v) _outl((v),(p)) + #else ++#if defined(__FreeBSD__) && defined(__alpha__) ++ ++#include ++ ++extern void outb(u_int32_t port, u_int8_t val); ++extern void outw(u_int32_t port, u_int16_t val); ++extern void outl(u_int32_t port, u_int32_t val); ++extern u_int8_t inb(u_int32_t port); ++extern u_int16_t inw(u_int32_t port); ++extern u_int32_t inl(u_int32_t port); ++ ++#else + #ifdef GCCUSESGAS + static __inline__ void + outb(port, val) +@@ -156,6 +168,7 @@ + + #endif /* GCCUSESGAS */ + #endif /* linux && __alpha__ */ ++#endif /* __FreeBSD__ && __alpha__ */ + + #ifdef linux + diff --git a/x11/XFree86/files/patch-03 b/x11/XFree86/files/patch-03 new file mode 100644 index 000000000000..d4005c2cb7ce --- /dev/null +++ b/x11/XFree86/files/patch-03 @@ -0,0 +1,14 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile programs/Xserver/hw/xfree86/SuperProbe/Imakefile +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile Mon Oct 19 21:38:44 1998 ++++ programs/Xserver/hw/xfree86/SuperProbe/Imakefile Tue Dec 8 10:05:55 1998 +@@ -31,6 +31,10 @@ + #if defined(i386BsdArchitecture) + # define OSModule OS_386BSD + #endif ++#if defined(AlphaBsdArchitecture) ++# define OSModule OS_386BSD ++ SYS_LIBRARIES = -lio ++#endif + #if defined(MinixArchitecture) + # define OSModule OS_Minix + #endif diff --git a/x11/XFree86/files/patch-04 b/x11/XFree86/files/patch-04 new file mode 100644 index 000000000000..45d6465c8354 --- /dev/null +++ b/x11/XFree86/files/patch-04 @@ -0,0 +1,21 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c programs/Xserver/hw/xfree86/accel/s3/s3.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c Mon Oct 19 21:39:13 1998 ++++ programs/Xserver/hw/xfree86/accel/s3/s3.c Wed Dec 9 10:27:41 1998 +@@ -291,7 +291,7 @@ + int s3_968_DashBug = 0; + unsigned long s3MemBase = 0; + Bool tmp_useSWCursor = FALSE; +-#ifdef __alpha__ ++#if defined(__alpha__) && defined(linux) + unsigned long _bus_base(void); + Bool isJensen = FALSE; + #endif +@@ -1034,7 +1034,7 @@ + + xf86VerifyOptions(&validOptions, &s3InfoRec); + +-#ifdef __alpha__ ++#if defined(__alpha__) && defined(linux) + #ifdef TEST_JENSEN_CODE + if (1) + #else diff --git a/x11/XFree86/files/patch-05 b/x11/XFree86/files/patch-05 new file mode 100644 index 000000000000..4480d68e23c3 --- /dev/null +++ b/x11/XFree86/files/patch-05 @@ -0,0 +1,12 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c programs/Xserver/hw/xfree86/accel/s3/s3im.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c Fri Nov 13 14:15:12 1998 ++++ programs/Xserver/hw/xfree86/accel/s3/s3im.c Wed Dec 9 10:29:01 1998 +@@ -51,7 +51,7 @@ + (a & 0x02) << 5 | \ + (a & 0x01) << 7; + +-#ifdef __alpha__ ++#if defined(__alpha__) && defined(linux) + extern Bool isJensen; + #define MemToBusBase(Base,dst,src,count) { if(isJensen) JensenMemToBus(Base,dst,src,count); else MemToBus(&Base[dst],src,count); } + #define BusToMemBase(dst,Base,src,count) { if(isJensen) JensenBusToMem(Base,dst,src,count); else BusToMem(dst,&Base[src],count); } diff --git a/x11/XFree86/files/patch-06 b/x11/XFree86/files/patch-06 new file mode 100644 index 000000000000..1749cb1532ae --- /dev/null +++ b/x11/XFree86/files/patch-06 @@ -0,0 +1,26 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common/compiler.h programs/Xserver/hw/xfree86/common/compiler.h +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Oct 19 21:39:32 1998 ++++ programs/Xserver/hw/xfree86/common/compiler.h Tue Dec 8 10:58:16 1998 +@@ -145,7 +145,21 @@ + return _inl(port); + } + +-# else /* defined(linux) */ ++# elif defined(__FreeBSD__) ++/* for FreeBSD on Alpha, we use the libio inx/outx routines */ ++/* note that the appropriate setup via "ioperm" needs to be done */ ++/* *before* any inx/outx is done. */ ++ ++#include ++ ++extern void outb(u_int32_t port, u_int8_t val); ++extern void outw(u_int32_t port, u_int16_t val); ++extern void outl(u_int32_t port, u_int32_t val); ++extern u_int8_t inb(u_int32_t port); ++extern u_int16_t inw(u_int32_t port); ++extern u_int32_t inl(u_int32_t port); ++ ++# else /* defined(__FreeBSD__) */ + + #define outb(a, b) /* NOP */ + #define outw(a, b) /* NOP */ diff --git a/x11/XFree86/files/patch-07 b/x11/XFree86/files/patch-07 new file mode 100644 index 000000000000..6f47aca6451f --- /dev/null +++ b/x11/XFree86/files/patch-07 @@ -0,0 +1,12 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/BUSmemcpy.c programs/Xserver/hw/xfree86/common_hw/BUSmemcpy.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/BUSmemcpy.c Sun Nov 24 09:55:37 1996 ++++ programs/Xserver/hw/xfree86/common_hw/BUSmemcpy.c Tue Dec 8 10:05:56 1998 +@@ -299,8 +299,6 @@ + * "bge reg, xx"). I hope alpha-gcc will be fixed to notice this eventually.. + */ + +-#include +- + /* + * This should be done in one go with ldq_u*2/mask/stq_u. Do it + * with a macro so that we can fix it up later.. diff --git a/x11/XFree86/files/patch-08 b/x11/XFree86/files/patch-08 new file mode 100644 index 000000000000..2cd67f8d3b08 --- /dev/null +++ b/x11/XFree86/files/patch-08 @@ -0,0 +1,21 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/Imakefile programs/Xserver/hw/xfree86/common_hw/Imakefile +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/Imakefile Tue Feb 24 21:01:21 1998 ++++ programs/Xserver/hw/xfree86/common_hw/Imakefile Tue Dec 8 10:05:56 1998 +@@ -15,7 +15,7 @@ + XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c $(IOSRC) + XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o $(IOOBJ) + #else +-#if defined(ArcArchitecture) ++#if defined(ArcArchitecture) || defined(AlphaArchitecture) + XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c $(IOSRC) + XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o $(IOOBJ) + #else +@@ -42,7 +42,7 @@ + + NormalLibraryTarget(xf86_hw,$(OBJS)) + +-#if !(defined(LinuxArchitecture) && defined(AlphaArchitecture)) && !defined(ArcArchitecture) ++#if !defined(AlphaArchitecture) && !defined(ArcArchitecture) + ObjectFromAsmSource(BUSmemcpy,NullParameter) + ObjectFromAsmSource(IODelay,NullParameter) + ObjectFromAsmSource(SlowBcopy,NullParameter) diff --git a/x11/XFree86/files/patch-09 b/x11/XFree86/files/patch-09 new file mode 100644 index 000000000000..579b70768c05 --- /dev/null +++ b/x11/XFree86/files/patch-09 @@ -0,0 +1,34 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c Sun Jan 5 11:58:24 1997 ++++ programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c Tue Dec 8 10:05:56 1998 +@@ -37,7 +37,12 @@ + * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 + */ + ++#ifdef linux + unsigned long _bus_base(void); ++#define isJensen() (!_bus_base()) ++#else ++#define isJensen() 0 ++#endif + + #ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ + #define SPARSE (5) +@@ -50,7 +55,7 @@ + unsigned char *src, *dst; + int count; + { +- if (!_bus_base()) /* Jensen */ ++ if (isJensen()) + { + unsigned long addr; + long result; +@@ -74,7 +79,7 @@ + unsigned char *src, *dst; + int count; + { +- if (!_bus_base()) /* Jensen */ ++ if (isJensen()) + { + unsigned long addr; + diff --git a/x11/XFree86/files/patch-0a b/x11/XFree86/files/patch-0a new file mode 100644 index 000000000000..0808363a702d --- /dev/null +++ b/x11/XFree86/files/patch-0a @@ -0,0 +1,112 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c Fri Nov 13 14:15:23 1998 ++++ programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c Tue Dec 8 10:05:56 1998 +@@ -490,7 +490,7 @@ + static int pciConfigType = 0; + static int pciMaxDevice = 0; + +-#if defined(__alpha__) ++#if defined(__alpha__) && defined(linux) + #include + #define BUS(tag) (((tag)>>16)&0xff) + #define DFN(tag) (((tag)>>8)&0xff) +@@ -512,7 +512,69 @@ + { + return syscall(__NR_pciconfig_write, bus, dfn, off, len, buf); + } +-#endif /* __alpha__ */ ++#endif /* __alpha__ && linux */ ++#if defined(__alpha__) && defined(__FreeBSD__) ++ ++#include ++ ++#define BUS(tag) (((tag)>>16)&0xff) ++#define DFN(tag) (((tag)>>8)&0xff) ++ ++static int pciFd = -1; ++ ++void pciconfig_enable(void) ++{ ++ pciFd = open("/dev/pci", O_RDWR); ++} ++ ++void pciconfig_disable(void) ++{ ++#if 0 ++ /* MGA server calls pciWriteLong after pciDisableIO */ ++ close(pciFd); ++ pciFd = -1; ++#endif ++} ++ ++int pciconfig_read( ++ unsigned char bus, ++ unsigned char dfn, ++ unsigned char off, ++ unsigned char len, ++ void * buf) ++{ ++ struct pci_io io; ++ int error; ++ io.pi_sel.pc_bus = bus; ++ io.pi_sel.pc_dev = dfn >> 3; ++ io.pi_sel.pc_func = dfn & 7; ++ io.pi_reg = off; ++ io.pi_width = len; ++ error = ioctl(pciFd, PCIOCREAD, &io); ++ if (error) ++ return error; ++ memcpy(buf, &io.pi_data, len); ++ return 0; ++} ++ ++int pciconfig_write( ++ unsigned char bus, ++ unsigned char dfn, ++ unsigned char off, ++ unsigned char len, ++ void * buf) ++{ ++ struct pci_io io; ++ io.pi_sel.pc_bus = bus; ++ io.pi_sel.pc_dev = dfn >> 3; ++ io.pi_sel.pc_func = dfn & 7; ++ io.pi_reg = off; ++ io.pi_width = len; ++ memcpy(&io.pi_data, buf, len); ++ return ioctl(pciFd, PCIOCWRITE, &io); ++} ++ ++#endif /* __alpha__ && __FreeBSD__ */ + + static Bool + pcibusCheck() +@@ -1052,6 +1114,9 @@ + static void + pciEnableIO(int scrnIndex) + { ++#if defined(__alpha__) && defined(__FreeBSD__) ++ pciconfig_enable(); ++#else + /* This is enough to ensure that full I/O is enabled */ + unsigned pciIOPorts[] = { PCI_MODE1_ADDRESS_REG }; + int numPciIOPorts = sizeof(pciIOPorts) / sizeof(pciIOPorts[0]); +@@ -1059,13 +1124,18 @@ + xf86ClearIOPortList(scrnIndex); + xf86AddIOPorts(scrnIndex, numPciIOPorts, pciIOPorts); + xf86EnableIOPorts(scrnIndex); ++#endif + } + + static void + pciDisableIO(int scrnIndex) + { ++#if defined(__alpha__) && defined(__FreeBSD__) ++ pciconfig_disable(); ++#else + xf86DisableIOPorts(scrnIndex); + xf86ClearIOPortList(scrnIndex); ++#endif + } + + static Bool diff --git a/x11/XFree86/files/patch-0b b/x11/XFree86/files/patch-0b new file mode 100644 index 000000000000..6eae94c40370 --- /dev/null +++ b/x11/XFree86/files/patch-0b @@ -0,0 +1,12 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/Imakefile programs/Xserver/hw/xfree86/os-support/Imakefile +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/Imakefile Sun May 11 06:04:24 1997 ++++ programs/Xserver/hw/xfree86/os-support/Imakefile Tue Dec 8 10:05:56 1998 +@@ -38,7 +38,7 @@ + OS_SUBDIR = lynxos + #endif + +-#if defined(i386BsdArchitecture) ++#if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) + # if defined(BSD386Architecture) + OS_SUBDIR = bsdi + # else diff --git a/x11/XFree86/files/patch-0c b/x11/XFree86/files/patch-0c new file mode 100644 index 000000000000..433600270792 --- /dev/null +++ b/x11/XFree86/files/patch-0c @@ -0,0 +1,16 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile programs/Xserver/hw/xfree86/os-support/bsd/Imakefile +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile Sun Jan 5 11:59:09 1997 ++++ programs/Xserver/hw/xfree86/os-support/bsd/Imakefile Tue Dec 8 10:05:56 1998 +@@ -31,8 +31,12 @@ + IOPERMDEFINES = -DUSE_I386_IOPL + # endif + #else ++# if defined(AlphaBsdArchitecture) ++ IOPERMDEFINES = -DUSE_ALPHA_PORTS ++# else + IOPERM_SRC = ioperm_noop.c + IOPERM_OBJ = ioperm_noop.o ++# endif + #endif + + SRCS = bsd_init.c bsd_video.c bsd_io.c bsd_VTsw.c bios_devmem.c mapVT_noop.c \ diff --git a/x11/XFree86/files/patch-0d b/x11/XFree86/files/patch-0d new file mode 100644 index 000000000000..40c39830d8a5 --- /dev/null +++ b/x11/XFree86/files/patch-0d @@ -0,0 +1,12 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c Mon Oct 19 21:40:36 1998 ++++ programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c Tue Dec 8 10:05:56 1998 +@@ -386,7 +386,7 @@ + vtmode_t vtmode; + char vtname[12]; + struct stat status; +- long syscons_version; ++ int syscons_version; + + /* Check for syscons */ + if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0 diff --git a/x11/XFree86/files/patch-0e b/x11/XFree86/files/patch-0e new file mode 100644 index 000000000000..562c6b102ee0 --- /dev/null +++ b/x11/XFree86/files/patch-0e @@ -0,0 +1,398 @@ +diff -ur /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c +--- /usr/ports/x11/XFree86/work/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c Mon Feb 16 00:42:01 1998 ++++ programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c Tue Dec 8 10:05:56 1998 +@@ -40,6 +40,13 @@ + #define MAP_FLAGS (MAP_FILE | MAP_SHARED) + #endif + ++#ifdef __alpha__ ++extern u_int64_t dense_base(); ++#define BUS_BASE dense_base() ++#else ++#define BUS_BASE 0L ++#endif ++ + /***************************************************************************/ + /* Video Memory Mapping section */ + /***************************************************************************/ +@@ -77,7 +84,7 @@ + { + /* Try to map a page at the VGA address */ + base = (pointer)mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, +- MAP_FLAGS, fd, (off_t)0xA0000); ++ MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + + if (base != (pointer)-1) + { +@@ -147,7 +154,6 @@ + #endif + } + +- + pointer + xf86MapVidMem(ScreenNum, Region, Base, Size) + int ScreenNum; +@@ -160,6 +166,10 @@ + if (!devMemChecked) + checkDevMem(FALSE); + ++#ifdef __alpha__ ++ Base = (pointer)((unsigned long)Base & ((1L<<32) - 1)); ++#endif ++ + if (useDevMem) + { + if (devMemFd < 0) +@@ -169,7 +179,7 @@ + } + base = (pointer)mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, + MAP_FLAGS, devMemFd, +- (off_t)(unsigned long) Base); ++ (off_t)(unsigned long) Base + BUS_BASE); + if (base == (pointer)-1) + { + FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", +@@ -195,11 +205,14 @@ + } + base = (pointer)mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, + xf86Info.screenFd, +-#ifdef __mips__ +- (unsigned long)Base); ++#if defined(__alpha__) ++ (unsigned long)Base + BUS_BASE ++#elif defined(__mips__) ++ (unsigned long)Base + #else +- (unsigned long)Base - 0xA0000); ++ (unsigned long)Base - 0xA0000 + #endif ++ ); + if (base == (pointer)-1) + { + FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", +@@ -397,7 +410,73 @@ + ErrorF("EnableIOPorts: failed to open %s (%s)\n", + "/dev/ttyC0", strerror(errno)); + } +- ++ ++ ExtendedEnabled = TRUE; ++ ++ return; ++} ++ ++void ++xf86DisableIOPorts(ScreenNum) ++int ScreenNum; ++{ ++ int i; ++ ++ ScreenEnabled[ScreenNum] = FALSE; ++ ++ return; ++} ++ ++void xf86DisableIOPrivs() ++{ ++} ++ ++#endif /* USE_ARC_MMAP */ ++ ++#ifdef USE_ALPHA_PORTS ++ ++static Bool ScreenEnabled[MAXSCREENS]; ++static Bool ExtendedEnabled = FALSE; ++static Bool InitDone = FALSE; ++ ++void ++xf86ClearIOPortList(ScreenNum) ++int ScreenNum; ++{ ++ if (!InitDone) ++ { ++ int i; ++ for (i = 0; i < MAXSCREENS; i++) ++ ScreenEnabled[i] = FALSE; ++ InitDone = TRUE; ++ } ++ return; ++} ++ ++void ++xf86AddIOPorts(ScreenNum, NumPorts, Ports) ++int ScreenNum; ++int NumPorts; ++unsigned *Ports; ++{ ++ return; ++} ++ ++void ++xf86EnableIOPorts(ScreenNum) ++int ScreenNum; ++{ ++ int i; ++ int fd; ++ pointer base; ++ ++ ScreenEnabled[ScreenNum] = TRUE; ++ ++ if (ExtendedEnabled) ++ return; ++ ++ ioperm(0, 65536, TRUE); ++ + ExtendedEnabled = TRUE; + + return; +@@ -411,6 +490,8 @@ + + ScreenEnabled[ScreenNum] = FALSE; + ++ ioperm(0, 65536, FALSE); ++ + return; + } + +@@ -428,7 +509,7 @@ + xf86DisableInterrupts() + { + +-#if !defined(__mips__) ++#if !defined(__mips__) && !defined(__alpha__) + #ifdef __GNUC__ + __asm__ __volatile__("cli"); + #else +@@ -443,7 +524,7 @@ + xf86EnableInterrupts() + { + +-#if !defined(__mips__) ++#if !defined(__mips__) && !defined(__alpha__) + #ifdef __GNUC__ + __asm__ __volatile__("sti"); + #else +@@ -453,3 +534,223 @@ + + return; + } ++ ++#if defined(__alpha__) ++ ++#if 0 ++ ++#include ++ ++#define SPARSE_SHIFT 5 ++ ++static pointer sparseMappedVirt; ++static unsigned long sparseMappedPhys; ++ ++pointer xf86MapVidMemSparse(ScreenNum, Region, Base, Size) ++int ScreenNum; ++int Region; ++pointer Base; ++unsigned long Size; ++{ ++ pointer base; ++ int fd; ++ ++ sparseMappedPhys = (unsigned long) Base; ++ ++ Size <<= SPARSE_SHIFT; ++ Base = (pointer)((sparseMappedPhys & ~_bus_hae_mask()) << SPARSE_SHIFT); ++ ++ if ((fd = open("/dev/mem", O_RDWR)) < 0) ++ { ++ FatalError("xf86MapVidMem: failed to open /dev/mem (%s)\n", ++ strerror(errno)); ++ } ++ /* This requirers linux-0.99.pl10 or above */ ++ base = (pointer)mmap((caddr_t)0, Size, ++ PROT_READ | PROT_WRITE, ++ MAP_SHARED, fd, ++ (off_t)Base + _bus_base_sparse()); ++ close(fd); ++ if ((long)base == -1) ++ { ++ FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", ++ strerror(errno)); ++ } ++ ++ /* ++ * This enables user HAE settings for this process. ++ */ ++ alpha_sethae(0); ++ ++ sparseMappedVirt = base; ++ ++ return base; ++} ++ ++void xf86UnMapVidMemSparse(ScreenNum, Region, Base, Size) ++int ScreenNum; ++int Region; ++pointer Base; ++unsigned long Size; ++{ ++ Size <<= SPARSE_SHIFT; ++ ++ munmap((caddr_t)Base, Size); ++} ++ ++#define vuip volatile unsigned int * ++ ++static void ++setupAddress(Offset) ++unsigned long Offset; ++{ ++ unsigned long phys = sparseMappedPhys + Offset; ++ alpha_sethae(phys & _bus_hae_mask()); ++} ++ ++int xf86ReadSparse8(Base, Offset) ++pointer Base; ++unsigned long Offset; ++{ ++ unsigned long result, shift; ++ ++ shift = (Offset & 0x3) * 8; ++ setupAddress(Offset); ++ result = *(vuip) ((unsigned long)Base + (Offset << SPARSE_SHIFT)); ++ result >>= shift; ++ return 0xffUL & result; ++} ++ ++int xf86ReadSparse16(Base, Offset) ++pointer Base; ++unsigned long Offset; ++{ ++ unsigned long result, shift; ++ ++ shift = (Offset & 0x2) * 8; ++ setupAddress(Offset); ++ result = *(vuip)((unsigned long)Base+(Offset<>= shift; ++ return 0xffffUL & result; ++} ++ ++int xf86ReadSparse32(Base, Offset) ++pointer Base; ++unsigned long Offset; ++{ ++ unsigned long result; ++ ++ setupAddress(Offset); ++ result = *(vuip)((unsigned long)Base+(Offset<subsys_regs.regs.adv_func_cntl)) & 0x400)) && (loop++