diff options
author | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:43:39 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:43:39 +0200 |
commit | f4092abdf94af6a99aff944d6264bc1284e8bdd4 (patch) | |
tree | 2ac1c9cc16ceb93edb2c4382c088dac5aeafdf0f /nx-X11/programs/Xserver/hw/xfree86/os-support/dgux | |
parent | a840692edc9c6d19cd7c057f68e39c7d95eb767d (diff) | |
download | nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.gz nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.bz2 nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.zip |
Imported nx-X11-3.1.0-1.tar.gznx-X11/3.1.0-1
Summary: Imported nx-X11-3.1.0-1.tar.gz
Keywords:
Imported nx-X11-3.1.0-1.tar.gz
into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/xfree86/os-support/dgux')
8 files changed, 1166 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile new file mode 100644 index 000000000..261bd6bab --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile @@ -0,0 +1,35 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.8 2002/10/11 01:46:59 dawes Exp $ +#include <Server.tmpl> + +BIOS_MOD = bios_DGmmap + +SRCS = dgux_init.c dgux_video.c IO_utils.c dgux_io.c $(BIOS_MOD).c VTsw_noop.c \ + dgux_kbd.c dgux_kbdEv.c dgux_tty.c std_mouse.c std_mseEv.c \ + stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c + +OBJS = dgux_init.o dgux_video.o IO_utils.o dgux_io.o $(BIOS_MOD).o VTsw_noop.o \ + dgux_kbd.o dgux_kbdEv.o dgux_tty.o std_mouse.o std_mseEv.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(VTsw_noop,../shared) +LinkSourceFile(IO_utils,../shared) +LinkSourceFile(std_mouse,../shared) +LinkSourceFile(std_mseEv,../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/dgux/bios_DGmmap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c new file mode 100644 index 000000000..95aad7a12 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c @@ -0,0 +1,70 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c,v 1.3 2000/02/11 22:36:02 dawes Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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 "input.h" +#include "scrnintstr.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +/* + * Read the BIOS via mmap() to the device /dev/mem. + */ +int xf86ReadBIOS(Base, Offset, Buf, Len) +unsigned long Base; +unsigned long Offset; +unsigned char *Buf; +int Len; +{ + int fd; + unsigned char *ptr; + int psize; + int mlen; + + if ((fd = open(DEV_MEM, O_RDONLY)) < 0) + { + ErrorF("xf86ReadBios: Failed to open %s (%s)\n", DEV_MEM, + strerror(errno)); + return(-1); + } + psize = xf86getpagesize(); + Offset += Base & (psize - 1); + Base &= ~(psize - 1); + mlen = (Offset + Len + psize - 1) & ~(psize - 1); + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, MAP_SHARED, + fd, (off_t)Base); + if ((int)ptr == -1) + { + ErrorF("xf86ReadBios: %s mmap failed\n", DEV_MEM); + close(fd); + return(-1); + } + (void)memcpy(Buf, (void *)(ptr + Offset), Len); + (void)munmap((caddr_t)ptr, mlen); + (void)close(fd); + return(Len); +} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c new file mode 100644 index 000000000..b7282a004 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c @@ -0,0 +1,182 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c,v 1.1 1998/12/13 07:37:46 dawes Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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 <X11/Xmd.h> +#include "input.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Procs.h" +#include "xf86_OSlib.h" + +static Bool KeepTty = FALSE; +static Bool Protect0 = FALSE; +static int VTnum = -1; + +extern void xf86VTRequest( + int +); + +void xf86OpenConsole() +{ + int i; + int fd; + char vtname[14]; + + if (serverGeneration == 1) + { + /* check if we're run with euid==0 */ + if (geteuid() != 0) + { + FatalError("xf86OpenConsole: Server must be suid root\n"); + } + if (Protect0) + { + int fd = -1; + + if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) + { + ErrorF("xf86OpenConsole: cannot open /dev/zero (%s)\n", + strerror(errno)); + } + else + { + if ((int)mmap(0, 0x1000, PROT_NONE, + MAP_FIXED | MAP_SHARED, fd, 0) == -1) + { + ErrorF("xf86OpenConsole: failed to protect page 0 (%s)\n", + strerror(errno)); + } + close(fd); + } + } + if (VTnum != -1) + { + xf86Info.vtno = VTnum; + } + else + { + if ((fd = open("/dev/console",O_WRONLY,0)) < 0) + { + FatalError( + "xf86OpenConsole: Cannot open system tty (/dev/console), (%s)\n", + strerror(errno)); + } + close(fd); + } + xf86Info.vtno=0; + ErrorF(" (Intel DG/ux: using VT number: systty%d)\n\n", xf86Info.vtno); + + sprintf(vtname,"/dev/console"); + + xf86Config(FALSE); /* Read XF86Config */ + + if (!KeepTty) + { + setpgrp(); + } + + if ((xf86Info.consoleFd = open("/dev/console", O_RDWR|O_NDELAY, 0)) < 0) + { + FatalError("xf86OpenConsole: Cannot open %s (%s)\n", + vtname, strerror(errno)); + } + + + + if ((xf86Info.kbdFd = open("/dev/keybd", O_RDONLY|O_NDELAY, 0)) < 0) + { + FatalError("xf86OpenConsole: Cannot open keyboard (/dev/keybd), (%s)\n", strerror(errno)); + } + /* change ownerships and Grab all other system consoles */ + chown(vtname, getuid(), getgid()); + chown("/dev/syscon", getuid(), getgid()); + chown("/dev/systty", getuid(), getgid()); + if (!KeepTty) + { + /* + * Detach from the controlling tty to avoid char loss + */ + if ((i = open("/dev/tty",O_RDWR)) >= 0) + { + ioctl(i, TIOCNOTTY, 0); + close(i); + } + } + } + else + { + /* serverGeneration != 1 */ + if (!xf86VTSema) + sleep(5); + } + return; +} + +void xf86CloseConsole() +{ + close(xf86Info.kbdFd); /* Close the keyboard */ + close(xf86Info.consoleFd); /* Close the system console */ + return; +} + +int xf86ProcessArgument(argc, argv, i) +int argc; +char *argv[]; +int i; +{ + if (!strcmp(argv[i], "-keeptty")) + { + KeepTty = TRUE; + return(1); + } + if (!strcmp(argv[i], "-protect0")) + { + Protect0 = TRUE; + return(1); + } + if ((argv[i][0] == 'v') && (argv[i][1] == 't')) + { + if (sscanf(argv[i], "vt%2d", &VTnum) == 0) + { + UseMsg(); + VTnum = -1; + return(0); + } + 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/dgux/dgux_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c new file mode 100644 index 000000000..b66051f63 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c @@ -0,0 +1,96 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c,v 1.3 2002/10/11 01:40:34 dawes Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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. + * + */ + +#define NEED_EVENTS +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86Procs.h" +#include "xf86_OSlib.h" + + + +void xf86SoundKbdBell(loudness, pitch, duration) +int loudness; +int pitch; +int duration; +{ + if (loudness && pitch) + { + + /* + * We use KBD_TONE_HIGH to avoid putting the server + * to sleep + */ + ioctl(xf86Info.kbdFd, KBD_TONE_HIGH, + ((1193190 / pitch) & 0xffff) | + (((unsigned long)duration * + loudness / 50) << 16)); + + } +} + + + +void xf86MouseInit(mouse) +MouseDevPtr mouse; +{ + return; +} + + + +/* Added for DG/ux: only RDONLY will not crash the Xserver */ +int xf86MouseOn(mouse) +MouseDevPtr mouse; +{ + if ((mouse->mseFd = open(mouse->mseDevice, O_RDONLY|O_NDELAY)) < 0) + { + if (xf86Info.allowMouseOpenFail) { + ErrorF("Cannot open mouse (%s) - Continuing...\n", + strerror(errno)); + return(-2); + } + FatalError("Cannot open mouse (%s)\n", strerror(errno)); + } + + xf86SetupMouse(mouse); + + /* Flush any pending input */ + ioctl(mouse->mseFd, TCFLSH, 0); + return(mouse->mseFd); +} + +#include "xf86OSKbd.h" + +Bool +xf86OSKbdPreInit(InputInfoPtr pInfo) +{ + return FALSE; +} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c new file mode 100644 index 000000000..7c25fb390 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c @@ -0,0 +1,120 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c,v 1.1 1998/12/13 07:37:46 dawes Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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. + * + */ + +/* *Contents* + + 1 xf86KbdSetLeds + 2 xf86KbdGetLeds + 3 xf86SetKbdRepeat + 4 xf86KbdInit() + 5 xf86KbdOn() + 6 xf86KbdOff() + +*/ + + +#define NEED_EVENTS +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86Procs.h" +#include "xf86_OSlib.h" + + +static struct termios kbdtty; + + +/* ADDED FOR INTEL DGUX */ +void xf86SetKbdLeds(leds) +int leds; +{ + ioctl(xf86Info.kbdFd, KBD_SET_LED, leds); +} + + + +/* ADDED FOR INTEL DGUX */ +int xf86GetKbdLeds() +{ + int leds; + + ioctl(xf86Info.kbdFd, KBD_GET_STATE, &leds); + return(leds); +} + +/* ADDED FOR INTEL DGUX */ +void xf86SetKbdRepeat(char rad) +{ + return; +} + + + + +/* ADDED FOR INTEL DGUX */ + +void xf86KbdInit() +{ + tcgetattr(xf86Info.kbdFd, &kbdtty); +} + + + + + +/* ADDED FOR INTEL DGUX */ + +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.kbdFd, TCSANOW, &nTty); + return(xf86Info.kbdFd); +} + + + + + +/* Intel DG/ux */ +int xf86KbdOff() +{ + tcsetattr(xf86Info.kbdFd, TCSANOW, &kbdtty); + return(xf86Info.kbdFd); +} + diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c new file mode 100644 index 000000000..1651f20d8 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c @@ -0,0 +1,47 @@ +/* $XFree86$ */ +/* + * INTEL DG/UX RELEASE 4.20 MU02 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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. + * + */ + + +#define NEED_EVENTS +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" +#include "scrnintstr.h" + +#include "xf86Procs.h" +#include "xf86_OSlib.h" + +void xf86KbdEvents() +{ + unsigned char rBuf[64]; + int nBytes, i; + + if ((nBytes = read( xf86Info.kbdFd, (char *)rBuf, sizeof(rBuf))) > 0) + { + for (i = 0; i < nBytes; i++) + xf86PostKbdEvent(rBuf[i]); + } +} + diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c new file mode 100644 index 000000000..b6dee0421 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c @@ -0,0 +1,175 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c,v 1.1 1998/12/13 07:37:47 dawes Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * 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. + * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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. + * + */ +/* BSD (POSIX) Flavor tty for ix86 DG/ux R4.20MU03 */ + +#define NEED_EVENTS +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" +#include "scrnintstr.h" + +#include "xf86Procs.h" +#include "xf86_OSlib.h" +#include "xf86_Config.h" + +static Bool not_a_tty = FALSE; + +void xf86SetMouseSpeed(mouse, old, new, cflag) +MouseDevPtr mouse; +int old; +int new; +unsigned cflag; +{ + struct termios tty; + char *c; + + if (not_a_tty) + return; + + if (tcgetattr(mouse->mseFd, &tty) < 0) + { + not_a_tty = TRUE; + ErrorF("Warning: %s unable to get status of mouse fd (%s)\n", + mouse->mseDevice, strerror(errno)); + return; + } + + /* this will query the initial baudrate only once */ + if (mouse->oldBaudRate < 0) { + switch (cfgetispeed(&tty)) + { + case B9600: + mouse->oldBaudRate = 9600; + break; + case B4800: + mouse->oldBaudRate = 4800; + break; + case B2400: + mouse->oldBaudRate = 2400; + break; + case B1200: + default: + mouse->oldBaudRate = 1200; + break; + } + } + + tty.c_iflag = IGNBRK | IGNPAR; + tty.c_oflag = 0; + tty.c_lflag = 0; + tty.c_cflag = (tcflag_t)cflag; + tty.c_cc[VTIME] = 0; + tty.c_cc[VMIN] = 1; + + switch (old) + { + case 9600: + cfsetispeed(&tty, B9600); + cfsetospeed(&tty, B9600); + break; + case 4800: + cfsetispeed(&tty, B4800); + cfsetospeed(&tty, B4800); + break; + case 2400: + cfsetispeed(&tty, B2400); + cfsetospeed(&tty, B2400); + break; + case 1200: + default: + cfsetispeed(&tty, B1200); + cfsetospeed(&tty, B1200); + } + + if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0) + { + if (xf86Info.allowMouseOpenFail) { + ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n", + strerror(errno)); + return; + } + xf86FatalError("Unable to set status of mouse fd (%s)\n", + strerror(errno)); + } + + switch (new) + { + case 9600: + c = "*q"; + cfsetispeed(&tty, B9600); + cfsetospeed(&tty, B9600); + break; + case 4800: + c = "*p"; + cfsetispeed(&tty, B4800); + cfsetospeed(&tty, B4800); + break; + case 2400: + c = "*o"; + cfsetispeed(&tty, B2400); + cfsetospeed(&tty, B2400); + break; + case 1200: + default: + c = "*n"; + cfsetispeed(&tty, B1200); + cfsetospeed(&tty, B1200); + } + + if (mouse->mseType == P_LOGIMAN || mouse->mseType == P_LOGI) + { + if (write(mouse->mseFd, c, 2) != 2) + { + if (xf86AllowMouseOpenFail) { + ErrorF("Unable to write to mouse fd (%s) - Continuing...\n", + strerror(errno)); + return; + } + xf86FatalError("Unable to write to mouse fd (%s)\n", + strerror(errno)); + } + } + usleep(100000); + + if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0) + { + if (xf86AllowMouseOpenFail) { + ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n", + strerror(errno)); + return; + } + xf86FatalError("Unable to set status of mouse fd (%s)\n", + strerror(errno)); + } +} + +/* ADDED FOR X 3.3.2.3 */ +int +xf86FlushInput(fd) +int fd; +{ + return tcflush(fd, TCIFLUSH); +} + diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c new file mode 100644 index 000000000..25336d68a --- /dev/null +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c @@ -0,0 +1,441 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c,v 1.6tsi Exp $ */ +/* + * INTEL DG/UX RELEASE 4.20 MU03 + * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK + * <takis@dpmms.cam.ac.uk> + * + * + * 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. + * XFREE86 PROJECT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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 "input.h" +#include "scrnintstr.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +/* Stuff for the SET_IOPL() ,RESET_IOPL() */ +/* #include <fcntl.h> */ +static int io_takis; +int set_takis; + + +/***************************************************************************/ +/* SET_IOPL() and RESET_IOPL() section for ix86 DG/ux 4.20MU03 */ +/***************************************************************************/ + + +int SET_IOPL() +{ + io_takis=open("/dev/console", O_RDWR,0); + if ((io_takis) < 0) + { + return(-1); + } + set_takis = ioctl(io_takis,KDENABIO,0); + + if (set_takis < 0) + { + return(-1); + } + return(1); +} + + + + +void RESET_IOPL() +{ + + ioctl(io_takis,KDDISABIO,0); + close(io_takis); + return; + +} + +/***************************************************************************/ +/* DG/ux Video Memory Mapping part */ +/***************************************************************************/ + +#undef HAS_SVR3_MMAPDRV /* ix86 DG/ux is a typical SVR4 without SVR3_MMAPDRV */ + +Bool xf86LinearVidMem() +{ + return(TRUE); +} + +pointer +xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) +{ + pointer base; + int fd; + + 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)); + } + base = mmap((caddr_t)0, Size, + (Flags & VIDMEM_READONLY) ? + PROT_READ : (PROT_READ | PROT_WRITE), + MAP_SHARED, fd, (off_t)Base); + close(fd); + if (base == MAP_FAILED) + { + FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", + "xf86MapVidMem", Size, Base, strerror(errno)); + } + + return(base); +} + +void xf86UnMapVidMem(ScreenNum, Region, Base, Size) +int ScreenNum; +int Region; +pointer Base; +unsigned long Size; +{ + munmap(Base, Size); +} + +/***************************************************************************/ +/* I/O Permissions section */ +/***************************************************************************/ + +#define ALWAYS_USE_EXTENDED +#ifdef ALWAYS_USE_EXTENDED + +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; + + ScreenEnabled[ScreenNum] = TRUE; + + if (ExtendedEnabled) + return; + + if (SET_IOPL() < 0) + { + FatalError("%s: Failed to set IOPL for extended I/O\n", + "xf86EnableIOPorts"); + } + ExtendedEnabled = TRUE; + + return; +} + +void +xf86DisableIOPorts(ScreenNum) +int ScreenNum; +{ + int i; + + ScreenEnabled[ScreenNum] = FALSE; + + if (!ExtendedEnabled) + return; + + for (i = 0; i < MAXSCREENS; i++) + if (ScreenEnabled[i]) + return; + + RESET_IOPL(); + ExtendedEnabled = FALSE; + + return; +} + +#else /* !ALWAYS_USE_EXTENDED */ + +#define DISABLED 0 +#define NON_EXTENDED 1 +#define EXTENDED 2 + +static unsigned *EnabledPorts[MAXSCREENS]; +static int NumEnabledPorts[MAXSCREENS]; +static Bool ScreenEnabled[MAXSCREENS]; +static Bool ExtendedPorts[MAXSCREENS]; +static Bool ExtendedEnabled = FALSE; +static Bool InitDone = FALSE; +static struct kd_disparam OrigParams; + +void xf86ClearIOPortList(ScreenNum) +int ScreenNum; +{ + if (!InitDone) + { + xf86InitPortLists(EnabledPorts, NumEnabledPorts, ScreenEnabled, + ExtendedPorts, MAXSCREENS); + if (ioctl(xf86Info.consoleFd, KDDISPTYPE, &OrigParams) < 0) + { + FatalError("%s: Could not get display parameters\n", + "xf86ClearIOPortList"); + } + InitDone = TRUE; + return; + } + ExtendedPorts[ScreenNum] = FALSE; + if (EnabledPorts[ScreenNum] != (unsigned *)NULL) + xfree(EnabledPorts[ScreenNum]); + EnabledPorts[ScreenNum] = (unsigned *)NULL; + NumEnabledPorts[ScreenNum] = 0; +} + +void xf86AddIOPorts(ScreenNum, NumPorts, Ports) +int ScreenNum; +int NumPorts; +unsigned *Ports; +{ + int i; + + if (!InitDone) + { + FatalError("xf86AddIOPorts: I/O control lists not initialised\n"); + } + EnabledPorts[ScreenNum] = xrealloc(EnabledPorts[ScreenNum], + (NumEnabledPorts[ScreenNum]+NumPorts)*sizeof(unsigned)); + for (i = 0; i < NumPorts; i++) + { + EnabledPorts[ScreenNum][NumEnabledPorts[ScreenNum] + i] = + Ports[i]; + if (Ports[i] > 0x3FF) + ExtendedPorts[ScreenNum] = TRUE; + } + NumEnabledPorts[ScreenNum] += NumPorts; +} + +void xf86EnableIOPorts(ScreenNum) +int ScreenNum; +{ + struct kd_disparam param; + int i, j; + + if (ScreenEnabled[ScreenNum]) + return; + + for (i = 0; i < MAXSCREENS; i++) + { + if (ExtendedPorts[i] && (ScreenEnabled[i] || i == ScreenNum)) + { + if (SET_IOPL() < 0) + { + FatalError("%s: Failed to set IOPL for extended I/O\n", + "xf86EnableIOPorts"); + } + ExtendedEnabled = TRUE; + break; + } + } + if (ExtendedEnabled && i == MAXSCREENS) + { + RESET_IOPL(); + ExtendedEnabled = FALSE; + } + if (ioctl(xf86Info.consoleFd, KDDISPTYPE, ¶m) < 0) + { + FatalError("%s: Could not get display parameters\n", + "xf86EnableIOPorts"); + } + for (i = 0; i < NumEnabledPorts[ScreenNum]; i++) + { + unsigned port = EnabledPorts[ScreenNum][i]; + + if (port > 0x3FF) + continue; + + if (!xf86CheckPorts(port, EnabledPorts, NumEnabledPorts, + ScreenEnabled, MAXSCREENS)) + { + continue; + } + for (j=0; j < MKDIOADDR; j++) + { + if (param.ioaddr[j] == port) + { + break; + } + } + if (j == MKDIOADDR) + { + if (ioctl(xf86Info.consoleFd, KDADDIO, port) < 0) + { + FatalError("%s: Failed to enable port 0x%x\n", + "xf86EnableIOPorts", port); + } + } + } + if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0) + { + FatalError("xf86EnableIOPorts: I/O port enable failed (%s)\n", + strerror(errno)); + } + ScreenEnabled[ScreenNum] = TRUE; + return; +} + +void xf86DisableIOPorts(ScreenNum) +int ScreenNum; +{ + struct kd_disparam param; + int i, j; + + if (!ScreenEnabled[ScreenNum]) + return; + + ScreenEnabled[ScreenNum] = FALSE; + for (i = 0; i < MAXSCREENS; i++) + { + if (ScreenEnabled[i] && ExtendedPorts[i]) + break; + } + if (ExtendedEnabled && i == MAXSCREENS) + { + RESET_IOPL(); + ExtendedEnabled = FALSE; + } + /* Turn off I/O before changing the access list */ + ioctl(xf86Info.consoleFd, KDDISABIO, 0); + if (ioctl(xf86Info.consoleFd, KDDISPTYPE, ¶m) < 0) + { + ErrorF("%s: Could not get display parameters\n", + "xf86DisableIOPorts"); + return; + } + + for (i=0; i < MKDIOADDR; i++) + { + if (param.ioaddr[i] == 0) + { + break; + } + if (!xf86CheckPorts(param.ioaddr[i], EnabledPorts, + NumEnabledPorts, ScreenEnabled, MAXSCREENS)) + { + continue; + } + for (j=0; j < MKDIOADDR; j++) + { + if (param.ioaddr[i] == OrigParams.ioaddr[j]) + { + /* + * Port was one of the original ones; don't + * touch it. + */ + break; + } + } + if (j == MKDIOADDR) + { + /* + * We added this port, so remove it. + */ + ioctl(xf86Info.consoleFd, KDDELIO, param.ioaddr[i]); + } + } + for (i = 0; i < MAXSCREENS; i++) + { + if (ScreenEnabled[i]) + { + ioctl(xf86Info.consoleFd, KDENABIO, 0); + break; + } + } + return; +} +#endif + +void xf86DisableIOPrivs() +{ + if (ExtendedEnabled) + RESET_IOPL(); + return; +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + + +Bool xf86DisableInterrupts() +{ + +#ifdef __GNUC__ + __asm__ __volatile__("cli"); +#else + asm("cli"); +#endif /* __GNUC__ */ + + return(TRUE); +} + +void xf86EnableInterrupts() +{ + +#ifdef __GNUC__ + __asm__ __volatile__("sti"); +#else + asm("sti"); +#endif /* __GNUC__ */ + + return; +} + + +void +xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, + unsigned long Size) +{ +} + |