aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/os-support
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-23 07:51:31 +0000
committermarha <marha@users.sourceforge.net>2010-12-23 07:51:31 +0000
commit71e1361d0fd4c2d1c6c31f9a28d474fceee7e12e (patch)
tree4e5cebc3ac6d1c0f5dd765697a7c2ad7be796136 /xorg-server/hw/xfree86/os-support
parent374f6889ce26ba0a914d07f4946cd113263a6e18 (diff)
parent8fd06c45853cb2300105db84e4b722f0e2dad8d2 (diff)
downloadvcxsrv-71e1361d0fd4c2d1c6c31f9a28d474fceee7e12e.tar.gz
vcxsrv-71e1361d0fd4c2d1c6c31f9a28d474fceee7e12e.tar.bz2
vcxsrv-71e1361d0fd4c2d1c6c31f9a28d474fceee7e12e.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/os-support')
-rw-r--r--xorg-server/hw/xfree86/os-support/Makefile.am52
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/Makefile.am5
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c127
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_init.c294
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_iop.c90
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_video.c290
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSlib.h31
7 files changed, 28 insertions, 861 deletions
diff --git a/xorg-server/hw/xfree86/os-support/Makefile.am b/xorg-server/hw/xfree86/os-support/Makefile.am
index c0504d5eb..3af4328ff 100644
--- a/xorg-server/hw/xfree86/os-support/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/Makefile.am
@@ -1,26 +1,26 @@
-SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
-DIST_SUBDIRS = bsd bus misc linux solaris sco hurd
-
-sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h
-
-EXTRA_DIST = int10Defines.h xf86OSpriv.h
-
-# to get the grouping semantics right, you have to glom these three together
-# as one library, otherwise libtool will actively defeat your attempts to
-# list them multiple times on the link line.
-noinst_LTLIBRARIES = libxorgos.la
-libxorgos_la_SOURCES = xorgos.c
-libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
- bus/libbus.la \
- misc/libmisc.la
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-xorgos.c:
- touch $@
-
-DISTCLEANFILES = xorgos.c
-
-# FIXME: These don't seem to be used anywhere
-EXTRA_DIST += \
- shared/bios_devmem.c
+SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
+DIST_SUBDIRS = bsd bus misc linux solaris hurd
+
+sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h
+
+EXTRA_DIST = int10Defines.h xf86OSpriv.h
+
+# to get the grouping semantics right, you have to glom these three together
+# as one library, otherwise libtool will actively defeat your attempts to
+# list them multiple times on the link line.
+noinst_LTLIBRARIES = libxorgos.la
+libxorgos_la_SOURCES = xorgos.c
+libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
+ bus/libbus.la \
+ misc/libmisc.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+xorgos.c:
+ touch $@
+
+DISTCLEANFILES = xorgos.c
+
+# FIXME: These don't seem to be used anywhere
+EXTRA_DIST += \
+ shared/bios_devmem.c
diff --git a/xorg-server/hw/xfree86/os-support/sco/Makefile.am b/xorg-server/hw/xfree86/os-support/sco/Makefile.am
deleted file mode 100644
index b5d40f7a5..000000000
--- a/xorg-server/hw/xfree86/os-support/sco/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-EXTRA_DIST = \
- VTsw_sco.c \
- sco_init.c \
- sco_iop.c \
- sco_video.c
diff --git a/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c b/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c
deleted file mode 100644
index c9ef7d5cd..000000000
--- a/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- *
- * 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"
-
-/* For the event driver prototypes */
-#include <sys/event.h>
-#include <mouse.h>
-
-/*
- * Handle the VT-switching interface for SCO
- */
-
-/*
- * This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer. NOTE: we do NOT need
- * to re-arm the signal here, since we used sigaction() to set the signal
- * disposition in sco_init.c. If we had used signal(), we would need to
- * re-arm the signal here. All we need to do now is record the fact that
- * we got the signal. XFree86 handles the rest.
- */
-void
-xf86VTRequest(int sig)
-{
- xf86Info.vtRequestsPending = TRUE;
- return;
-}
-
-Bool
-xf86VTSwitchPending(void)
-{
- return xf86Info.vtRequestsPending ? TRUE : FALSE;
-}
-
-/*
- * When we switch away, we need to flush and suspend the event driver
- * before the VT_RELDISP. We also need to get the current LED status
- * and preserve it, so that we can restore it when we come back.
- */
-static int sco_ledstatus = -1;
-static unsigned int sco_ledstate = 0;
-
-Bool
-xf86VTSwitchAway(void)
-{
- ev_flush();
- ev_suspend();
-
- sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate);
-
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_TRUE) < 0) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-/*
- * When we come back to the X server, we need to resume the event driver,
- * and we need to restore the LED settings to what they were when we
- * switched away.
- */
-Bool
-xf86VTSwitchTo(void)
-{
- ev_resume();
-
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
- return FALSE;
- } else {
- if (sco_ledstatus >= 0) {
- ioctl (xf86Info.consoleFd, KDSETLED, sco_ledstate);
- }
- sco_ledstatus = -1;
-
- /*
- * Convince the console driver this screen is in graphics mode,
- * otherwise it assumes it can do more to the screen than it should.
- */
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
- }
-
- return TRUE;
- }
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno - 1) < 0) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_init.c b/xorg-server/hw/xfree86/os-support/sco/sco_init.c
deleted file mode 100644
index fd4c898dd..000000000
--- a/xorg-server/hw/xfree86/os-support/sco/sco_init.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright 2001-2005 by J. Kean Johnston <jkj@sco.com>
- *
- * 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 J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON 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.
- */
-
-/* Re-written May 2001 to represent the current state of reality */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-static Bool KeepTty = FALSE;
-static int VTnum = -1;
-static char vtdevice[48];
-static int sco_console_mode = -1;
-
-extern Bool mpxLock;
-
-void
-xf86OpenConsole(void)
-{
- int i, ioctl_ret;
- struct vt_mode VT;
- struct vid_info vidinf;
- struct sigaction sigvtsw;
- char *ttn;
-
- if (serverGeneration == 1) {
- /* check if we're run with euid==0 */
- if (geteuid() != 0) {
- FatalError("xf86OpenConsole: Server must be setuid root\n");
- }
-
- /* If we are run in the background we will get SIGTTOU. Ignore it. */
- OsSignal (SIGTTOU, SIG_IGN);
-
- /*
- * Set up the virtual terminal (multiscreen in SCO parlance).
- * For the actual console itself, screens are numbered from
- * 1 to (usually) 16. However, it is possible to have a nested
- * server, and it is also possible to be on a multi-console
- * system such as MaxSpeed or SunRiver. Therefore, we should
- * not make any assumptions about the TTY name we are on, and
- * instead we rely on ttyname() to give us the real TTY name.
- * Previously, we tried to determine the TTY name manually.
- * This is wrong. The only time we need to futz with the TTY name
- * is if we were given the name of a TTY to run on explicity on
- * the command line.
- */
-
- if (VTnum == -1) {
- /*
- * No device was specified. We need to query the kernel to see which
- * console device we are on (and in fact if we are on a console at all).
- */
- ttn = ttyname (1);
-
- if (ttn == (char *)0) {
- FatalError ("xf86OpenConsole: Could not determine TTY name: %s\n",
- strerror(errno));
- }
- strlcpy (vtdevice, ttn, sizeof(vtdevice));
- } else if (VTnum >= 0) {
- snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum);
- }
-
- /*
- * Now we can dispose of stdin/stdout
- */
- fclose (stdin);
- fclose (stdout);
-
- if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NDELAY, 0)) < 0) {
- FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice,
- strerror(errno));
- }
-
- /*
- * We make 100% sure we use the correct VT number. This can get ugly
- * where there are multi-consoles in use, so we make sure we query
- * the kernel for the correct VT number. It knows best, we don't.
- */
- vidinf.size = sizeof(vidinf);
- if (ioctl (xf86Info.consoleFd, CONS_GETINFO, &vidinf) < 0) {
- FatalError ("xf86OpenConsole: %s not a console device "
- "or error querying device: %s\n", vtdevice, strerror (errno));
- }
- xf86Info.vtno = vidinf.m_num;
- VTnum = vidinf.m_num + 1; /* 0-based */
-
- ErrorF("(using VT%02d device %s)\n\n", VTnum, vtdevice);
-
- /* We activate the console just in case its not the one we are on */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
- }
-
- /* Disassociate from controling TTY */
- if (!KeepTty) {
- setpgrp();
- }
-
- /*
- * Now we get the current mode that the console device is in. We will
- * use this later when we close the console device to restore it to
- * that same mode.
- */
- if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) {
- FatalError("xf86OpenConsole: CONS_GET failed on console (%s)\n",
- strerror(errno));
- }
-
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
- FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", strerror(errno));
- }
-
- sigvtsw.sa_handler = xf86VTRequest;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
-
- /* NOTE: Using sigaction means we dont have to re-arm the signal */
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- VT.frsig = SIGINT; /* Not implemented */
- VT.waitv = 0;
-
- /*
- * The SCO X server tries the following call 5 times. Lets do the same
- * thing. It shouldn't really be required but sometimes things take a
- * while to settle down when switching screens. *helpless shrug* I know
- * its sucks but ...
- */
-
- ioctl_ret = 0;
- for (i = 0; i < 5; i++) {
- ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
- if (ioctl_ret >= 0)
- break;
- usleep(999999); /* Dont use nap() - it forces linking with -lx */
- }
-
- if (ioctl_ret < 0) {
- FatalError("xf86OpenConsole: VT_SETMODE failed (%s)\n", strerror(errno));
- }
-
- /*
- * Convince the console driver we are in graphics mode.
- */
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
- }
- } else { /* serverGeneration != 1 */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
- }
- }
-}
-
-/*
- * Restore the console to its previous state. This may cause flicker if
- * the screen was previous in a graphics mode, because we first set it
- * to text mode. This has the advantage of getting the console driver
- * to do a soft reset on the card, which really does help settle the
- * video card down again after coming out of Xfree86.
- */
-void
-xf86CloseConsole(void)
-{
- struct vt_mode VT;
- struct sigaction sigvtsw;
-
- /* Set text mode (possibly briefly) */
- ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0);
-
- /* Restore the original mode */
- if (sco_console_mode != -1) {
- ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L);
- }
-
- ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */
-
- sigvtsw.sa_handler = SIG_DFL;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
-
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- VT.mode = VT_AUTO;
- VT.waitv = 0;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- VT.frsig = SIGINT;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */
-
- close(xf86Info.consoleFd); /* We're done with the device */
-}
-
-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;
- }
-
- /*
- * By default, the X server wants to bind itself to CPU 0. This makes
- * sure that the server has full access to the I/O ports at IOPL 3.
- * Some SMP systems have trouble with I/O on CPU's other than 0. If,
- * however, you have a system that is well behaved, you can specify
- * this argument and let the scheduler decide which CPU the server
- * should run on.
- */
- if (!strcmp(argv[i], "-nompxlock")) {
- mpxLock = FALSE;
- return 1;
- }
-
- /*
- * Specify the VT number to run on (NOT the device).
- */
- if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- if (VTnum <= 0) {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- return 1;
- }
-
- /*
- * Use a device the user specifies.
- */
- if (!strcmp(argv[i], "-crt")) {
- if (++i > argc) {
- UseMsg();
- VTnum = -1;
- return 0;
- } else {
- VTnum = -2;
- strlcpy (vtdevice, argv[i], sizeof(vtdevice));
- return 2;
- }
- }
- return 0;
-}
-
-void
-xf86UseMsg(void)
-{
- ErrorF("vtXX use the specified VT number\n");
- ErrorF("-crt DEVICE use the specified VT device\n");
- ErrorF("-nompxlock dont bind X server to CPU 0\n");
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
-}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_iop.c b/xorg-server/hw/xfree86/os-support/sco/sco_iop.c
deleted file mode 100644
index 3da4fcf3a..000000000
--- a/xorg-server/hw/xfree86/os-support/sco/sco_iop.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2001 by J. Kean Johnston <jkj@caldera.com>
- *
- * 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 J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON 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 "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-
-/***************************************************************************/
-/* I/O Permissions section */
-/***************************************************************************/
-
-/*
- * There is a right way and a wrong way of doing this. Unfortunately, we
- * are forced to do it the wrong way. The right way is to be told the range
- * or ranges of I/O ports the driver(s) need access to, in order to use the
- * CONS_IOPERM ioctl() to grant access only to those ports we care about.
- * This way we can guarantee some small level of stability because a driver
- * does not have access to all ports (which would mean it could play with
- * the PIT and thus affect scheduling times, or a whole slew of other
- * nasty things). However, because XFree86 currently only enables or disables
- * ALL port access, we need to run at IOPL 3, which basically means the
- * X Server runs at the same level as the kernel. You can image why this is
- * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are
- * affected by this as well.
- *
- * So, for the time being, we change our IOPL until such time as the XFree86
- * architecture is changed to allow for tighter control of I/O ports. If and
- * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable
- * or disable access to the desired ports.
- */
-
-extern long sysi86 (int cmd, ...);
-
-static Bool IOEnabled = FALSE;
-
-Bool
-xf86EnableIO(void)
-{
- if (IOEnabled)
- return TRUE;
-
- if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
- xf86Msg(X_WARNING,"Failed to set IOPL for extended I/O\n");
- return FALSE;
- }
-
- IOEnabled = TRUE;
- return TRUE;
-}
-
-void
-xf86DisableIO(void)
-{
- if (!IOEnabled)
- return;
-
- sysi86(SI86V86, V86SC_IOPL, 0);
- IOEnabled = FALSE;
-}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_video.c b/xorg-server/hw/xfree86/os-support/sco/sco_video.c
deleted file mode 100644
index f63b71df8..000000000
--- a/xorg-server/hw/xfree86/os-support/sco/sco_video.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
- *
- * 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 J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON 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.
- */
-
-/* Re-written May 2001 to represent the current state of reality */
-
-/*
- * This file contains the completely re-written SCO OpenServer video
- * routines for XFree86 4.x. Much of this is based on the SCO X server
- * code (which is an X11R5 server) and will probably only work on
- * OpenServer versions 5.0.5, 5.0.6 and later. Please send me (jkj@sco.com)
- * email if you have any questions.
- *
- * Ideally, you should use OSR5.0.6A or later, with the updated console
- * driver for 5.0.6A (its the default driver in 5.0.7 and later).
- * However, if you are running on an older system, this code will detect
- * that and adjust accordingly.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/ci/ciioctl.h>
-#define MPXNAME "/dev/atp1"
-#define BASECPU 1
-
-Bool mpxLock = TRUE;
-
-#define USE_VASMETHOD 1
-
-/***************************************************************************/
-/* Video Memory Mapping section */
-/***************************************************************************/
-
-static int sco_mcdone = 0, sco_ismc = 0;
-
-/***************************************************************************/
-/*
- * To map the video memory, we first need to see if we are on a multi-console
- * system. If we are, we need to try to use an existing video class in the
- * kernel. We do this by retrieving the list of currently defined classes
- * (via the new CONS_GETCLASS ioctl()) to see if we have a class that will
- * match the range of memory we desire. If we can't find one, we have an
- * error and we abort.
- *
- * If we are not using a multi-console, we can simply use mmap() to map in
- * the frame buffer, using the classs-access method as a fall-back only if
- * the mmap() fails (it shouldn't). We always set the appropriate pointers
- * in the config structure to point ot the right function to map and unmap
- * the video memory. An alternative to using mmap() is to use the new
- * CONS_ADDVAS call, which will use vasmalloc() and vasbind() in the kernel
- * to map the physical address to a virtual one, which it then returns.
- * I am not 100% sure if this is faster or not, but it may prove easier to
- * debug things. Just to be on the safe side, I have included both methods
- * here, and the mmap() method can be used by setting USE_VASMETHOD to 0
- * above.
- */
-
-#if !defined(CONS_ADDVAS)
-# undef USE_VASMETHOD
-# define USE_VASMETHOD 0
-#endif
-
-static int
-scoIsMultiConsole (void)
-{
- int x;
-
- if (sco_mcdone)
- return sco_ismc;
- x = access ("/usr/lib/vidconf/.multiconsole", F_OK);
- if (x == 0)
- sco_ismc = 1;
- sco_mcdone = 1;
- return sco_ismc;
-}
-
-/*
- * This maps memory using mmap()
- */
-static pointer
-mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- int fd;
- unsigned long realBase, alignOff;
- pointer base;
-
- fd = open (DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM,
- strerror(errno));
- return 0; /* NOTREACHED */
- }
-
- realBase = Base & ~(getpagesize() - 1);
- alignOff = Base - realBase;
-
- DebugF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff);
-
- base = mmap((caddr_t)0, Size + alignOff,
- (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_SHARED, fd, (off_t)realBase);
- close(fd);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (0x%08x,0x%x) (%s)\n",
- Base, Size, strerror(errno));
- return 0; /* NOTREACHED */
- }
-
- DebugF("base: %lx aligned base: %lx\n",base, base + alignOff);
- return (pointer)((char *)base + alignOff);
-}
-
-#if (USE_VASMETHOD)
-/*
- * This maps memory using the virtual address space (VAS) console calls.
- */
-static pointer
-mapVidMemVAS(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- struct vidvasmem vas;
- pointer base;
-
- vas.base = (long)Base;
- vas.size = (long)Size;
-
- base = (pointer)ioctl (xf86Info.consoleFd, CONS_ADDVAS, &vas);
- if (base == (pointer)-1) {
- return mapVidMemMMAP(ScreenNum, Base, Size, flags);
- }
- return base;
-}
-#endif /* USE_VASMETHOD */
-
-struct vidclass vidclasslist[] = {
- { "VBE", "", 0xf0000000, 0x2000000, 0 },
- { "P9000", "", 0xc0000000, 0x400000, 0 },
- { "TULIP", "", 0x80000000, 0x400000, 0 },
- { "VIPER", "", 0xa0000000, 0x400000, 0 },
- { "S3T", "", 0xa0000000, 0x200000, 0 },
- { "S3DT", "", 0x4000000, 0x400000, 0 },
- { "MGA", "", 0x2200000, 0x4000, 0 },
- { "CLVGA", "", 0xa0000, 0x20000, 0 },
- { "OLIVE", "", 0xd8000000, 0x400000, 0 },
- { "S3C", "", 0xa0000, 0x10000, 0 },
- { "MGAVLB", "", 0xac000, 0x34000, 0 },
- { "ATI8514", "", 0xFF000, 0x1000, 0 },
- { "GXREGS", "", 0xb0000, 0x10000, 0 },
- { "GX", "", 0xa0000, 0x10000, 0 },
- { "CT64300", "", 0xa0000000, 0x400000, 0 },
- { "SVGA", "", 0xa0000, 0x20000, 0 },
- { "S3V", "", 0xa0000000, 0x400000, 0 },
- { "8514A", "", 0xFF000, 0x1000, 0 },
- { "VGA", "", 0xa0000, 0x10000, 0 },
- { 0 }
-};
-
-static pointer
-mapVidMemVC(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- struct vidclass *vcp;
- char *class = NULL;
- pointer base;
-
- for (vcp = vidclasslist; vcp->name; vcp++) {
- if ((vcp->base == Base) && (vcp->size == Size)) {
- class = vcp->name;
- break;
- }
- }
-
- if (class == NULL) {
- /*
- * As a fall-back, we will try and use the mmap() approach. This may
- * prove to be the wrong thing to do, but time and testing will tell.
- */
- ErrorF("xf86MapVidMem: No class map defined for (0x%08x,0x%08x)\n", Base, Size);
-#if USE_VASMETHOD
- return mapVidMemVAS(ScreenNum, Base, Size, flags);
-#else /* !USE_VASMETHOD */
- return mapVidMemMMAP(ScreenNum, Base, Size, flags);
-#endif
- }
-
- /*
- * We found a suitable class. Try and use it.
- */
- base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class);
- if ((int)base == -1) {
- FatalError("xf86MapVidMem: Failed to map video memory class `%s'\n", class);
- return 0; /* NOTREACHED */
- }
-
- return base;
-}
-
-/*
- * Unmapping the video memory is easy. We always call munmap(), as it is
- * safe to do so even if we haven't actually mapped in any pages via mmap().
- * In the case where we used the video class, we don't need to do anything
- * as the kernel will clean up the TSS when we exit, and will undo the
- * vasbind() that was done when the class was originally mapped. If we used
- * vasmap, we simply undo the map. Again, it is benign to call vasunmap
- * even if we got the frame buffer via some other mechanism (like mmap).
- */
-
-static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
-{
-#if USE_VASMETHOD
- struct vidvasmem vas;
- int x;
-
- vas.base = (long)Base;
- vas.size = (long)Size;
-
- x = ioctl (xf86Info.consoleFd, CONS_DELVAS, &vas);
- if (x == 0)
- return;
-#endif /* USE_VASMETHOD */
-
- munmap(Base, Size);
-}
-
-/*
- * Set things up to point to our local functions. When the kernel gets
- * MTRR support, we will need to add the required functions for that
- * here too. MTRR support will most likely appear in 5.0.8 or 5.1.0.
- *
- * We also want to lock the X server process to the base CPU in an MPX
- * system, since we will be going to IOPL 3. Most engine drivers can cope
- * with I/O access on any CPU but there are a few (AST Manhattan I believe)
- * that can't, so the server needs to be locked to CPU0.
- */
-void
-xf86OSInitVidMem(VidMemInfoPtr pVidMem)
-{
- int mpx_fd;
-
- if (scoIsMultiConsole ()) {
- pVidMem->mapMem = mapVidMemVC;
- } else {
-#if USE_VASMETHOD
- pVidMem->mapMem = mapVidMemVAS;
-#else
- pVidMem->mapMem = mapVidMemMMAP;
-#endif
- }
-
- pVidMem->unmapMem = unmapVidMem;
- pVidMem->linearSupported = TRUE;
- pVidMem->initialised = TRUE;
-
- if (mpxLock && (mpx_fd = open (MPXNAME, O_RDONLY)) > 0) {
- if (ioctl (mpx_fd, ACPU_XLOCK, BASECPU) < 0)
- ErrorF ("xf86OSInitVidMem: Can not bind to CPU 0 (%s)\n",
- strerror(errno));
- close (mpx_fd);
- }
-}
-
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
index c53fc0dac..3b646da70 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
@@ -85,22 +85,11 @@
/**************************************************************************/
#if (defined(SYSV) || defined(SVR4)) && \
(defined(sun) || defined(__i386__))
-# ifdef SCO325
-# ifndef _SVID3
-# define _SVID3
-# endif
-# ifndef _NO_STATIC
-# define _NO_STATIC
-# endif
-# endif
# include <sys/ioctl.h>
# include <signal.h>
# include <termio.h>
# include <sys/stat.h>
# include <sys/types.h>
-# if defined(__SCO__)
-# include <sys/param.h>
-# endif
# include <errno.h>
@@ -140,15 +129,7 @@
# if !defined(sun)
# include <sys/emap.h>
# endif
-# if defined(SCO325)
-# include <sys/vtkd.h>
-# include <sys/console.h>
-# include <sys/scankbd.h>
-# include <sys/vid.h>
-# define LED_CAP CLKED
-# define LED_NUM NLKED
-# define LED_SCR SLKED
-# elif defined(HAS_USL_VTS)
+# if defined(HAS_USL_VTS)
# if !defined(sun)
# include <sys/at_ansi.h>
# endif
@@ -177,20 +158,12 @@
# define VT_ACKACQ 2
# endif /* !VT_ACKACQ */
-# if defined(__SCO__)
-# include <sys/sysmacros.h>
-# define POSIX_TTY
-# endif /* __SCO__ */
-# if defined(SVR4) || defined(SCO325)
+# if defined(SVR4)
# include <sys/mman.h>
# if !(defined(sun) && defined (SVR4))
# define DEV_MEM "/dev/pmem"
# endif
-# ifdef SCO325
-# undef DEV_MEM
-# define DEV_MEM "/dev/mem"
-# endif
# define CLEARDTR_SUPPORT
# define POSIX_TTY
# endif /* SVR4 */