aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi')
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile46
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c156
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c110
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c34
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c182
5 files changed, 528 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile
new file mode 100644
index 000000000..820f76c20
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile
@@ -0,0 +1,46 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.14 2002/10/11 01:46:58 dawes Exp $
+
+
+
+
+XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:23:38 rws $
+
+#include <Server.tmpl>
+
+MOUSESRC = bsdi_mouse.c
+MOUSEOBJ = bsdi_mouse.o
+
+SRCS = bsdi_init.c bsdi_video.c bsdi_io.c bios_devmem.c \
+ VTsw_noop.c std_kbdEv.c posix_tty.c $(MOUSESRC) \
+ libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \
+ kmod_noop.c agp_noop.c
+
+OBJS = bsdi_init.o bsdi_video.o bsdi_io.o bios_devmem.o \
+ VTsw_noop.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \
+ libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \
+ kmod_noop.o agp_noop.o
+
+INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
+ -I$(XINCLUDESRC) -I$(EXTINCSRC)
+
+RESDEFINES = -DUSESTDRES
+
+DEFINES = $(RESDEFINES)
+
+SubdirLibraryRule($(OBJS))
+NormalLibraryObjectRule()
+
+LinkSourceFile(bios_devmem.c,../shared)
+LinkSourceFile(VTsw_noop.c,../shared)
+LinkSourceFile(std_kbdEv.c,../shared)
+LinkSourceFile(posix_tty.c,../shared)
+LinkSourceFile(libc_wrapper.c,../shared)
+LinkSourceFile(stdResource.c,../shared)
+LinkSourceFile(stdPci.c,../shared)
+LinkSourceFile(sigiostubs.c,../shared)
+LinkSourceFile(pm_noop.c,../shared)
+LinkSourceFile(kmod_noop.c,../shared)
+LinkSourceFile(agp_noop.c,../shared)
+
+DependTarget()
+
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c
new file mode 100644
index 000000000..5a166ed26
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c
@@ -0,0 +1,156 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c,v 3.5.4.2 1998/06/05 16:23:08 dawes Exp $ */
+/*
+ * 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.
+ *
+ */
+/* $XConsortium: bsdi_init.c /main/5 1996/02/21 17:51:15 kaleb $ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include <sys/param.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+extern Bool RunFromSmartParent;
+
+static Bool KeepTty = FALSE;
+
+#if BSD >= 199306
+static void
+NonBlockConsoleOff()
+{
+ register int i;
+
+ i = fcntl(2, F_GETFL, 0);
+ if (i >= 0)
+ (void) fcntl(2, F_SETFL, i & ~FNDELAY);
+}
+#endif
+
+void
+xf86OpenConsole()
+{
+ int i, fd;
+
+ if (serverGeneration == 1)
+ {
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+ }
+
+ if (!KeepTty)
+ {
+#if BSD >= 199306
+ if (RunFromSmartParent) {
+ if (atexit(NonBlockConsoleOff))
+ xf86Msg(X_WARNING,
+ "InitOutput: can't register NBIO exit handler\n");
+ i = fcntl(2, F_GETFL, 0);
+ if (i >= 0)
+ i = fcntl(2, F_SETFL, i | FNDELAY);
+ if (i < 0)
+ xf86Msg(X_WARNING,
+ "InitOutput: can't put stderr in non-block mode\n");
+ }
+#else
+ /*
+ * detaching the controlling tty solves problems of kbd character
+ * loss. This is not interesting for CO driver, because it is
+ * exclusive.
+ */
+ setpgrp(0, getpid());
+ if ((i = open("/dev/tty",O_RDWR)) >= 0)
+ {
+ ioctl(i,TIOCNOTTY,(char *)0);
+ close(i);
+ }
+#endif
+ }
+
+ if ((xf86Info.consoleFd = open("/dev/kbd", O_RDWR|O_NDELAY,0)) < 0)
+ {
+ FatalError("xf86OpenConsole: Cannot open /dev/kbd (%s)\n",
+ strerror(errno));
+ }
+ if ((xf86Info.screenFd = open("/dev/vga", O_RDWR|O_NDELAY,0)) < 0)
+ {
+ FatalError("xf86OpenConsole: Cannot open /dev/vga (%s)\n",
+ strerror(errno));
+ }
+
+ if (ioctl(xf86Info.consoleFd, PCCONIOCRAW, 0) < 0)
+ {
+ FatalError("%s: PCCONIOCRAW failed (%s)\n",
+ "xf86OpenConsole", strerror(errno));
+ }
+ }
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ ioctl (xf86Info.consoleFd, PCCONIOCCOOK, 0);
+
+ if (xf86Info.screenFd != xf86Info.consoleFd)
+ {
+ close(xf86Info.screenFd);
+ }
+ close(xf86Info.consoleFd);
+ return;
+}
+
+int
+xf86ProcessArgument (int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return(1);
+ }
+ return(0);
+}
+
+void
+xf86UseMsg()
+{
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c
new file mode 100644
index 000000000..e37bf308c
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c
@@ -0,0 +1,110 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c,v 3.13 2002/10/11 01:40:34 dawes Exp $ */
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Dawes <dawes@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 Rich Murphey and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Dawes 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 DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES 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.
+ *
+ */
+/* $XConsortium: bsdi_io.c /main/10 1996/10/19 18:06:13 kaleb $ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
+{
+ if (loudness && pitch)
+ {
+ int data[2];
+
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, PCCONIOCBEEP, data);
+ }
+}
+
+void
+xf86SetKbdLeds(int leds)
+{
+ ioctl(xf86Info.consoleFd, PCCONIOCSETLED, &leds);
+}
+
+int
+xf86GetKbdLeds()
+{
+ return(0);
+}
+
+void
+xf86SetKbdRepeat(char rad)
+{
+ return;
+}
+
+static struct termio kbdtty;
+
+void
+xf86KbdInit()
+{
+ tcgetattr(xf86Info.consoleFd, &kbdtty);
+}
+
+int
+xf86KbdOn()
+{
+ struct termios nTty;
+
+ nTty = kbdtty;
+ nTty.c_iflag = IGNPAR | IGNBRK;
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed(&nTty, 9600);
+ cfsetospeed(&nTty, 9600);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+ return(xf86Info.consoleFd);
+}
+
+int
+xf86KbdOff()
+{
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
+ return(xf86Info.consoleFd);
+}
+
+#include "xf86OSKbd.h"
+
+Bool
+xf86OSKbdPreInit(InputInfoPtr pInfo)
+{
+ return FALSE;
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c
new file mode 100644
index 000000000..fb50cfcee
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c
@@ -0,0 +1,34 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c,v 1.1 1999/05/22 08:40:10 dawes Exp $ */
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX This needs to be checked. */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+}
+
+OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ return p;
+}
+
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c
new file mode 100644
index 000000000..5b1e474c7
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c
@@ -0,0 +1,182 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c,v 3.10 2003/03/14 13:46:05 tsi Exp $ */
+/*
+ * 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.
+ *
+ */
+/* $XConsortium: bsdi_video.c /main/4 1996/02/21 17:51:22 kaleb $ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+pointer
+xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
+{
+ pointer base;
+
+ /* just try the mapping, and either it will work, or not */
+ base = mmap(0, Size,
+ (Flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FILE, xf86Info.screenFd, Base - 0xA0000);
+ if (base == MAP_FAILED)
+ {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s) at 0x%x\n",
+ strerror(errno), Base);
+ }
+ return(base);
+}
+
+void
+xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, Size);
+}
+
+Bool
+xf86LinearVidMem()
+{
+ return(TRUE);
+}
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+/*
+ * BSDI has a single system-wide TSS I/O bitmap that covers ports up to
+ * 0xFFFF. By default, the TSS has ports 0x3B0-0x3DF enabled.
+ *
+ * It also allows the IOPL to be enabled or disabled on a per-process
+ * basis. Here, we use the IOPL only.
+ */
+
+static Bool ExtendedEnabled = FALSE;
+
+Bool
+xf86EnableIO()
+{
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0) < 0)
+ {
+ xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n",
+ "xf86EnableIOPorts");
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ if (!ExtendedEnabled)
+ return;
+
+ ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0);
+ ExtendedEnabled = FALSE;
+}
+
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+Bool
+xf86DisableInterrupts()
+{
+ if (!ExtendedEnabled)
+ {
+ if (ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0) < 0)
+ {
+ return(FALSE);
+ }
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ {
+ ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0);
+ }
+
+ return(TRUE);
+}
+
+void
+xf86EnableInterrupts()
+{
+ if (!ExtendedEnabled)
+ {
+ ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0);
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ {
+ ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0);
+ }
+
+ return;
+}
+
+void
+xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
+ unsigned long Size)
+{
+}
+
+Bool
+xf86CheckMTRR(int ScreenNum)
+{
+ return FALSE;
+}
+