summaryrefslogtreecommitdiff
path: root/xserver
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2008-01-04 13:44:24 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2008-01-04 13:44:24 +0000
commit777484c8aa87fe478b728f1173be5a1e322331f4 (patch)
treed682fc462621cc653ef0a4cf5f76008df8ce8f34 /xserver
parent36b26974b37905027b38f008d9b199d274b68790 (diff)
Add support for xserver on OpenBSD/sgi and enable build.
ok matthieu@
Diffstat (limited to 'xserver')
-rw-r--r--xserver/Makefile.bsd-wrapper6
-rw-r--r--xserver/configure.ac5
-rw-r--r--xserver/hw/xfree86/os-support/bsd/Makefile.am5
-rw-r--r--xserver/hw/xfree86/os-support/bsd/sgi_video.c120
-rw-r--r--xserver/hw/xfree86/os-support/bus/Pci.h4
5 files changed, 137 insertions, 3 deletions
diff --git a/xserver/Makefile.bsd-wrapper b/xserver/Makefile.bsd-wrapper
index dec556779..da924bdc4 100644
--- a/xserver/Makefile.bsd-wrapper
+++ b/xserver/Makefile.bsd-wrapper
@@ -1,12 +1,12 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.17 2007/05/27 05:56:03 matthieu Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.18 2008/01/04 13:44:23 jsing Exp $
DIST= ${.CURDIR}
# Machines for which we don't build the Xorg Xserver
NO_XORG_MACHINES= aviion hppa hppa64 landisk \
- mvme68k mvme88k mvmeppc sgi solbourne vax
+ mvme68k mvme88k mvmeppc solbourne vax
-NO_XF86UTIL_MACHINES= hp300 landisk mac68k sparc vax
+NO_XF86UTIL_MACHINES= hp300 landisk mac68k sgi sparc vax
NO_XPRINT_MACHINES= landisk vax
diff --git a/xserver/configure.ac b/xserver/configure.ac
index ff6045348..8ef051bee 100644
--- a/xserver/configure.ac
+++ b/xserver/configure.ac
@@ -320,6 +320,10 @@ case $host_cpu in
*freebsd*) DEFAULT_INT10=stub ;;
esac
;;
+ mips*)
+ SGI_VIDEO=yes
+ BSD_ARCH_SOURCES="sgi_video.c ioperm_noop.c"
+ ;;
sparc*)
xorg_loader_sparcmuldiv="yes"
SPARC64_VIDEO=yes
@@ -348,6 +352,7 @@ AM_CONDITIONAL(HP300_VIDEO, [test "x$HP300_VIDEO" = xyes])
AM_CONDITIONAL(HPPA_VIDEO, [test "x$HPPA_VIDEO" = xyes])
AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
+AM_CONDITIONAL(SGI_VIDEO, [test "x$SGI_VIDEO" = xyes])
AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
DRI=no
diff --git a/xserver/hw/xfree86/os-support/bsd/Makefile.am b/xserver/hw/xfree86/os-support/bsd/Makefile.am
index b7bbbdcaa..d1e6fc135 100644
--- a/xserver/hw/xfree86/os-support/bsd/Makefile.am
+++ b/xserver/hw/xfree86/os-support/bsd/Makefile.am
@@ -59,6 +59,11 @@ ARCH_SOURCES = ppc_video.c \
$(srcdir)/../shared/ioperm_noop.c
endif
+if SGI_VIDEO
+ARCH_SOURCES = sgi_video.c \
+ $(srcdir)/../shared/ioperm_noop.c
+endif
+
if SPARC64_VIDEO
# Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO.
ARCH_SOURCES = \
diff --git a/xserver/hw/xfree86/os-support/bsd/sgi_video.c b/xserver/hw/xfree86/os-support/bsd/sgi_video.c
new file mode 100644
index 000000000..f33d5515d
--- /dev/null
+++ b/xserver/hw/xfree86/os-support/bsd/sgi_video.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * 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 names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR 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"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+#define DEBUG 1
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static pointer sgiMapVidMem(int, unsigned long, unsigned long, int);
+static void sgiUnmapVidMem(int, pointer, unsigned long);
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = sgiMapVidMem;
+ pVidMem->unmapMem = sgiUnmapVidMem;
+ pVidMem->initialised = TRUE;
+}
+
+static pointer
+sgiMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
+{
+ int fd = xf86Info.screenFd;
+ pointer base;
+
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
+ Base, Size, fd);
+#endif
+
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, Base);
+ if (base == MAP_FAILED)
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ return base;
+}
+
+static void
+sgiUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap(Base, Size);
+}
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ return (0);
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+#ifdef X_PRIVSEP
+/*
+ * Do all things that need root privileges early
+ * and revoke those privileges
+ */
+_X_EXPORT void
+xf86PrivilegedInit(void)
+{
+ xf86OpenConsole();
+}
+#endif
diff --git a/xserver/hw/xfree86/os-support/bus/Pci.h b/xserver/hw/xfree86/os-support/bus/Pci.h
index a36d925c9..c9098b1b5 100644
--- a/xserver/hw/xfree86/os-support/bus/Pci.h
+++ b/xserver/hw/xfree86/os-support/bus/Pci.h
@@ -307,6 +307,10 @@
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
+# elif defined(__OpenBSD__)
+# define ARCH_PCI_INIT freebsdPciInit
+# define INCLUDE_XF86_MAP_PCI_MEM
+# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__powerpc__) || defined(__powerpc64__)
# if defined(linux)