summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/os-support')
-rw-r--r--hw/xfree86/os-support/assyntax.h29
-rw-r--r--hw/xfree86/os-support/bsd/alpha_video.c20
-rw-r--r--hw/xfree86/os-support/bsd/arm_video.c26
-rw-r--r--hw/xfree86/os-support/bsd/bsdResource.c4
-rw-r--r--hw/xfree86/os-support/bsd/bsd_axp.c6
-rw-r--r--hw/xfree86/os-support/bsd/bsd_init.c46
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.c8
-rw-r--r--hw/xfree86/os-support/bsd/bsd_mouse.c144
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c42
-rw-r--r--hw/xfree86/os-support/bsd/ppc_video.c17
-rw-r--r--hw/xfree86/os-support/bsd/sparc64_video.c9
-rw-r--r--hw/xfree86/os-support/bus/460gxPCI.c21
-rw-r--r--hw/xfree86/os-support/bus/Pci.c126
-rw-r--r--hw/xfree86/os-support/bus/Pci.h56
-rw-r--r--hw/xfree86/os-support/bus/Sbus.c23
-rw-r--r--hw/xfree86/os-support/bus/e8870PCI.c4
-rw-r--r--hw/xfree86/os-support/bus/freebsdPci.c4
-rw-r--r--hw/xfree86/os-support/bus/ix86Pci.c80
-rw-r--r--hw/xfree86/os-support/bus/netbsdPci.c13
-rw-r--r--hw/xfree86/os-support/bus/sparcPci.c8
-rw-r--r--hw/xfree86/os-support/bus/xf86Pci.h36
-rw-r--r--hw/xfree86/os-support/bus/xf86Sbus.h8
-rw-r--r--hw/xfree86/os-support/bus/zx1PCI.c39
-rw-r--r--hw/xfree86/os-support/int10Defines.h28
-rw-r--r--hw/xfree86/os-support/linux/int10/linux.c16
-rw-r--r--hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c4
-rw-r--r--hw/xfree86/os-support/linux/lnx_agp.c14
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c8
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.c18
-rw-r--r--hw/xfree86/os-support/linux/lnx_mouse.c175
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c55
-rw-r--r--hw/xfree86/os-support/misc/Delay.c5
-rw-r--r--hw/xfree86/os-support/misc/SlowBcopy.c5
-rw-r--r--hw/xfree86/os-support/sco/VTsw_sco.c5
-rw-r--r--hw/xfree86/os-support/sco/sco_video.c9
-rw-r--r--hw/xfree86/os-support/shared/agp_noop.c33
-rw-r--r--hw/xfree86/os-support/shared/at_scancode.c56
-rw-r--r--hw/xfree86/os-support/shared/kbd.c28
-rw-r--r--hw/xfree86/os-support/shared/kmod_noop.c27
-rw-r--r--hw/xfree86/os-support/shared/libc_wrapper.c53
-rw-r--r--hw/xfree86/os-support/shared/pm_noop.c28
-rw-r--r--hw/xfree86/os-support/shared/posix_tty.c9
-rw-r--r--hw/xfree86/os-support/shared/sigio.c31
-rw-r--r--hw/xfree86/os-support/shared/sigiostubs.c31
-rw-r--r--hw/xfree86/os-support/shared/stdPci.c31
-rw-r--r--hw/xfree86/os-support/shared/stdResource.c34
-rw-r--r--hw/xfree86/os-support/shared/vidmem.c30
-rw-r--r--hw/xfree86/os-support/shared/xf86Axp.c28
-rw-r--r--hw/xfree86/os-support/solaris/sun_bios.c6
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.c7
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbdEv.c256
-rw-r--r--hw/xfree86/os-support/sysv/sysv_video.c11
-rw-r--r--hw/xfree86/os-support/xf86OSKbd.h49
-rw-r--r--hw/xfree86/os-support/xf86OSmouse.h124
-rw-r--r--hw/xfree86/os-support/xf86OSpriv.h28
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h31
-rw-r--r--hw/xfree86/os-support/xf86_OSproc.h5
-rw-r--r--hw/xfree86/os-support/xf86_ansic.h7
-rw-r--r--hw/xfree86/os-support/xf86_libc.h44
59 files changed, 1703 insertions, 395 deletions
diff --git a/hw/xfree86/os-support/assyntax.h b/hw/xfree86/os-support/assyntax.h
index 3ae8a7940..191c7e49e 100644
--- a/hw/xfree86/os-support/assyntax.h
+++ b/hw/xfree86/os-support/assyntax.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.12 1999/12/27 00:39:46 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.13 2003/08/24 17:37:03 dawes Exp $ */
#ifndef __ASSYNTAX_H__
#define __ASSYNTAX_H__
@@ -23,6 +23,33 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+/*
+ * Copyright (c) 1993-1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
/* $XConsortium: assyntax.h /main/5 1996/02/21 17:50:49 kaleb $ */
/*
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index d3aa25961..aa3313dc3 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.2.2.1 2003/05/09 02:30:43 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.5 2003/04/03 16:50:04 dawes Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -215,7 +215,7 @@ checkDevMem(Bool warn)
/* Try the aperture driver first */
if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
/* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
if (base != MAP_FAILED) {
@@ -235,7 +235,7 @@ checkDevMem(Bool warn)
#endif
if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
/* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
if (base != MAP_FAILED) {
@@ -308,8 +308,10 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
FatalError("xf86MapVidMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
- base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
- MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
if (base == MAP_FAILED)
{
FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
@@ -325,9 +327,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
FatalError("%s: Address 0x%x outside allowable range\n",
"xf86MapVidMem", Base);
}
- base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS,
- xf86Info.screenFd,
- (unsigned long)Base + BUS_BASE);
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base + BUS_BASE);
if (base == MAP_FAILED)
{
FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index 96abe2ea4..36943add1 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.1 2002/08/06 13:08:38 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.2 2003/03/14 13:46:03 tsi Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -135,7 +135,7 @@ checkDevMem(Bool warn)
if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
{
/* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
if (base != MAP_FAILED)
@@ -190,8 +190,10 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
FatalError("xf86MapVidMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
- base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
- MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
if (base == MAP_FAILED)
{
FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
@@ -207,9 +209,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
FatalError("%s: Address 0x%x outside allowable range\n",
"xf86MapVidMem", Base);
}
- base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS,
- xf86Info.screenFd,
- (unsigned long)Base - 0xA0000);
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base - 0xA0000);
if (base == MAP_FAILED)
{
FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
@@ -353,7 +357,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
if((memInfoP->regionVirtBase =
mmap((caddr_t)0,
Size,
- PROT_READ|PROT_WRITE,
+ PROT_READ | PROT_WRITE,
MAP_SHARED,
xf86Info.screenFd,
(unsigned long)mapInfoP->u.map_info_mmap.map_offset))
@@ -485,7 +489,7 @@ xf86EnableIO()
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
/* Try to map a page at the pccons I/O space */
- base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE,
+ base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0x0000);
if (base != (pointer)-1) {
@@ -571,7 +575,7 @@ int ScreenNum;
#ifdef USE_ARC_MMAP
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
/* Try to map a page at the pccons I/O space */
- base = (pointer)mmap((caddr_t)0, 65536, PROT_READ|PROT_WRITE,
+ base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0x0000);
if (base != (pointer)-1) {
@@ -613,7 +617,7 @@ int ScreenNum;
if (devMemFd >= 0 && useDevMem)
{
- base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ|PROT_WRITE,
+ base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ | PROT_WRITE,
MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE);
if (base != (pointer)-1)
diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c
index f999561cf..6c675b5da 100644
--- a/hw/xfree86/os-support/bsd/bsdResource.c
+++ b/hw/xfree86/os-support/bsd/bsdResource.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.8 2002/05/22 21:38:29 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.9 2003/10/02 13:30:06 eich Exp $ */
/* Resource information code */
@@ -18,7 +18,7 @@ resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
#ifdef INCLUDE_XF86_NO_DOMAIN
-#if defined(__alpha__) || defined(__sparc64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
resPtr
xf86BusAccWindowsFromOS(void)
diff --git a/hw/xfree86/os-support/bsd/bsd_axp.c b/hw/xfree86/os-support/bsd/bsd_axp.c
index c38ac073c..91367078e 100644
--- a/hw/xfree86/os-support/bsd/bsd_axp.c
+++ b/hw/xfree86/os-support/bsd/bsd_axp.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.2 2002/10/29 23:19:13 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.3 2003/10/07 22:33:37 herrb Exp $ */
#include "X.h"
#include "os.h"
@@ -23,9 +23,9 @@ axpDevice bsdGetAXP(void);
typedef struct {
char *name;
int type;
-} AXP;
+} _AXP;
-static AXP axpList[] = {
+static _AXP axpList[] = {
{"apecs",APECS},
{"pyxis",PYXIS},
{"cia",CIA},
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 236b6ffbb..e4927d91a 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.19 2002/05/05 18:54:02 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.22 2003/10/07 23:14:55 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -38,8 +38,10 @@
static Bool KeepTty = FALSE;
static int devConsoleFd = -1;
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
static int VTnum = -1;
static int initialVT = -1;
+#endif
#ifdef PCCONS_SUPPORT
/* Stock 0.1 386bsd pccons console driver interface */
@@ -146,10 +148,10 @@ void
xf86OpenConsole()
{
int i, fd = -1;
- int result;
- struct utsname uts;
xf86ConsOpen_t *driver;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ int result;
+ struct utsname uts;
vtmode_t vtmode;
#endif
@@ -158,7 +160,7 @@ xf86OpenConsole()
/* check if we are run with euid==0 */
if (geteuid() != 0)
{
- FatalError("xf86OpenConsole: Server must be suid root\n");
+ FatalError("xf86OpenConsole: Server must be suid root");
}
if (!KeepTty)
@@ -196,7 +198,7 @@ xf86OpenConsole()
strcat(cons_drivers, supported_drivers[i]);
}
FatalError(
- "%s: No console driver found\n\tSupported drivers: %s\n\t%s\n",
+ "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
"xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
}
#if 0 /* stdin is already closed in OsInit() */
@@ -211,7 +213,7 @@ xf86OpenConsole()
case PCCONS:
if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
{
- FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s\n",
+ FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
"xf86OpenConsole", strerror(errno),
CHECK_DRIVER_MSG);
}
@@ -280,18 +282,18 @@ acquire_vt:
vtmode.frsig = SIGUSR1;
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0)
{
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
}
#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
{
- FatalError("xf86OpenConsole: KDENABIO failed (%s)\n",
+ FatalError("xf86OpenConsole: KDENABIO failed (%s)",
strerror(errno));
}
#endif
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
{
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
}
break;
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
@@ -335,7 +337,7 @@ xf86OpenPccons()
if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0)
{
FatalError(
- "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s\n",
+ "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
"xf86OpenPccons",
strerror(errno),
"Was expecting pccons driver with X support",
@@ -425,11 +427,11 @@ xf86OpenSyscons()
{
if (syscons_version >= 0x100)
{
- FatalError("%s: Cannot find a free VT\n",
+ FatalError("%s: Cannot find a free VT",
"xf86OpenSyscons");
}
/* Should no longer reach here */
- FatalError("%s: %s %s\n\t%s %s\n",
+ FatalError("%s: %s %s\n\t%s %s",
"xf86OpenSyscons",
"syscons versions prior to 1.0 require",
"either the",
@@ -448,18 +450,18 @@ xf86OpenSyscons()
#endif
if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
{
- FatalError("xf86OpenSyscons: Cannot open %s (%s)\n",
+ FatalError("xf86OpenSyscons: Cannot open %s (%s)",
vtname, strerror(errno));
}
if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
{
- FatalError("xf86OpenSyscons: VT_GETMODE failed\n");
+ FatalError("xf86OpenSyscons: VT_GETMODE failed");
}
xf86Info.consType = SYSCONS;
xf86Msg(X_PROBED, "Using syscons driver with X support");
if (syscons_version >= 0x100)
{
- xf86ErrorF(" (version %d.%d)\n", syscons_version >> 8,
+ xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
syscons_version & 0xFF);
}
else
@@ -513,7 +515,7 @@ xf86OpenPcvt()
{
if(ioctl(fd, VT_GETMODE, &vtmode) < 0)
{
- FatalError("%s: VT_GETMODE failed\n%s%s\n%s\n",
+ FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
"xf86OpenPcvt",
"Found pcvt driver but X11 seems to be",
" not supported.", CHECK_DRIVER_MSG);
@@ -552,7 +554,7 @@ xf86OpenPcvt()
}
else
{
- FatalError("%s: Cannot find a free VT\n",
+ FatalError("%s: Cannot find a free VT",
"xf86OpenPcvt");
}
}
@@ -562,12 +564,12 @@ xf86OpenPcvt()
sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
{
- FatalError("xf86OpenPcvt: Cannot open %s (%s)\n",
+ FatalError("xf86OpenPcvt: Cannot open %s (%s)",
vtname, strerror(errno));
}
if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
{
- FatalError("xf86OpenPcvt: VT_GETMODE failed\n");
+ FatalError("xf86OpenPcvt: VT_GETMODE failed");
}
xf86Info.consType = PCVT;
#ifdef WSCONS_SUPPORT
@@ -614,7 +616,7 @@ xf86OpenWScons()
}
if (fd != -1) {
if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
- FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s\n",
+ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
"xf86OpenConsole", strerror(errno),
CHECK_DRIVER_MSG);
}
@@ -652,7 +654,7 @@ xf86CloseConsole()
#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
{
- xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)\n",
+ xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
strerror(errno));
}
#endif
@@ -676,7 +678,7 @@ xf86CloseConsole()
close(xf86Info.consoleFd);
if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
{
- xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)\n",
+ xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
strerror(errno));
}
}
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c
index 20d8b04d4..0d586ef72 100644
--- a/hw/xfree86/os-support/bsd/bsd_kbd.c
+++ b/hw/xfree86/os-support/bsd/bsd_kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.5 2003/02/17 15:11:56 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.8 2003/11/04 03:16:58 tsi Exp $ */
/*
* Copyright (c) 2002 by The XFree86 Project, Inc.
@@ -33,7 +33,7 @@ static KbdProtocolRec protocols[] = {
#ifdef WSCONS_SUPPORT
{"wskbd", PROT_WSCONS },
#endif
- { NULL, PROT_UNKNOWN }
+ { NULL, PROT_UNKNOWN_KBD }
};
typedef struct {
@@ -143,8 +143,10 @@ static int
KbdOn(InputInfoPtr pInfo, int what)
{
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
+#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
struct termios nTty;
+#endif
#ifdef WSCONS_SUPPORT
int option;
#endif
@@ -406,7 +408,7 @@ OpenKeyboard(InputInfoPtr pInfo)
{
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
int i;
- KbdProtocolId prot = PROT_UNKNOWN;
+ KbdProtocolId prot = PROT_UNKNOWN_KBD;
char *s;
s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c
index f681d90d9..943bb9855 100644
--- a/hw/xfree86/os-support/bsd/bsd_mouse.c
+++ b/hw/xfree86/os-support/bsd/bsd_mouse.c
@@ -1,7 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.24 2003/02/15 05:37:59 paulo Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.26 2003/10/10 20:56:05 herrb Exp $ */
/*
- * Copyright 1999 by The XFree86 Project, Inc.
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
#include "X.h"
@@ -45,6 +68,20 @@
static void usbSigioReadInput (int fd, void *closure);
#endif
+#if defined(__FreeBSD__)
+/* These are for FreeBSD */
+#define DEFAULT_MOUSE_DEV "/dev/mouse"
+#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
+#define DEFAULT_PS2_DEV "/dev/psm0"
+
+static const char *mouseDevs[] = {
+ DEFAULT_MOUSE_DEV,
+ DEFAULT_SYSMOUSE_DEV,
+ DEFAULT_PS2_DEV,
+ NULL
+};
+#endif
+
static int
SupportedInterfaces(void)
{
@@ -196,6 +233,98 @@ SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
}
#endif
+#if defined(__FreeBSD__)
+
+#define MOUSED_PID_FILE "/var/run/moused.pid"
+
+/*
+ * Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without
+ * it. There doesn't seem to be a better way of checking.
+ */
+static Bool
+MousedRunning(void)
+{
+ FILE *f = NULL;
+ unsigned int pid;
+
+ if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) {
+ if (fscanf(f, "%u", &pid) == 1 && pid > 0) {
+ if (kill(pid, 0) == 0) {
+ fclose(f);
+ return TRUE;
+ }
+ }
+ fclose(f);
+ }
+ return FALSE;
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev, *dev = NULL;
+ Bool devMouse = FALSE;
+ struct stat devMouseStat;
+ struct stat sb;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
+#endif
+ } else {
+ /*
+ * /dev/mouse is held until checks for matches with other devices
+ * are done. This is so that when it points to /dev/sysmouse,
+ * the test for whether /dev/sysmouse is usable can be made.
+ */
+ if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
+ if (fstat(fd, &devMouseStat) == 0)
+ devMouse = TRUE;
+ close(fd);
+ continue;
+ } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
+ /* Check if /dev/mouse is the same as /dev/sysmouse. */
+ if (devMouse && fstat(fd, &sb) == 0 &&
+ devMouseStat.st_dev == sb.st_dev &&
+ devMouseStat.st_ino == sb.st_ino) {
+ /* If the same, use /dev/sysmouse. */
+ devMouse = FALSE;
+ }
+ close(fd);
+ if (MousedRunning())
+ break;
+ else {
+#ifdef DEBUG
+ ErrorF("moused isn't running\n");
+#endif
+ }
+ } else {
+ close(fd);
+ break;
+ }
+ }
+ }
+
+ if (*pdev)
+ dev = *pdev;
+ else if (devMouse)
+ dev = DEFAULT_MOUSE_DEV;
+
+ if (dev) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", dev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, dev);
+ }
+
+ return *pdev;
+}
+#endif
+
#if defined(WSCONS_SUPPORT)
#define NUMEVENTS 64
@@ -502,11 +631,11 @@ usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
#ifdef USB_NEW_HID
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) {
- xf86Msg(X_WARNING, "%s: no x locator\n");
+ xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
}
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) {
- xf86Msg(X_WARNING, "%s: no y locator\n");
+ xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
}
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) {
@@ -514,11 +643,11 @@ usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
#else
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
hid_input, &pUsbMse->loc_x) < 0) {
- xf86Msg(X_WARNING, "%s: no x locator\n");
+ xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
}
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
hid_input, &pUsbMse->loc_y) < 0) {
- xf86Msg(X_WARNING, "%s: no y locator\n");
+ xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
}
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
hid_input, &pUsbMse->loc_z) < 0) {
@@ -589,6 +718,9 @@ xf86OSMouseInit(int flags)
p->SetBMRes = SetSysMouseRes;
p->SetMiscRes = SetSysMouseRes;
#endif
+#if defined(__FreeBSD__)
+ p->FindDevice = FindDevice;
+#endif
p->PreInit = bsdMousePreInit;
return p;
}
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 3c056ce55..75c8f8200 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c,v 1.2 2002/09/10 15:53:31 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c,v 1.5 2003/10/07 23:14:55 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -62,11 +62,11 @@
#ifdef __OpenBSD__
#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
"\tin /etc/sysctl.conf and reboot your machine\n" \
- "\trefer to xf86(4) for details\n"
+ "\trefer to xf86(4) for details"
#define SYSCTL_MSG2 \
"Check that you have set 'machdep.allowaperture=2'\n" \
"\tin /etc/sysctl.conf and reboot your machine\n" \
- "\trefer to xf86(4) for details\n"
+ "\trefer to xf86(4) for details"
#endif
/***************************************************************************/
@@ -114,7 +114,7 @@ checkDevMem(Bool warn)
if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
{
/* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0xA0000);
if (base != MAP_FAILED)
@@ -147,7 +147,7 @@ checkDevMem(Bool warn)
if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0)
{
/* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
MAP_FLAGS, fd, (off_t)0xA0000);
if (base != MAP_FAILED)
@@ -220,14 +220,16 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
if (devMemFd < 0)
{
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ FatalError("xf86MapVidMem: failed to open %s (%s)",
DEV_MEM, strerror(errno));
}
- base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
- MAP_FLAGS, devMemFd, (off_t)Base);
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base);
if (base == MAP_FAILED)
{
- FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
"xf86MapVidMem", DEV_MEM, Size, Base,
strerror(errno));
}
@@ -237,16 +239,18 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
/* else, mmap /dev/vga */
if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
{
- FatalError("%s: Address 0x%x outside allowable range\n",
+ FatalError("%s: Address 0x%lx outside allowable range",
"xf86MapVidMem", Base);
}
- base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS,
- xf86Info.screenFd,
- (unsigned long)Base - 0xA0000
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base - 0xA0000
);
if (base == MAP_FAILED)
{
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
strerror(errno));
}
return(base);
@@ -284,7 +288,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
if ((long)ptr == -1)
{
xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
DEV_MEM, Len, Base, Offset, strerror(errno));
#ifdef __OpenBSD__
if (Base < 0xa0000) {
@@ -324,7 +328,7 @@ xf86EnableIO()
if (i386_iopl(TRUE) < 0)
{
#ifndef __OpenBSD__
- FatalError("%s: Failed to set IOPL for extended I/O\n",
+ FatalError("%s: Failed to set IOPL for extended I/O",
"xf86EnableIO");
#else
FatalError("%s: Failed to set IOPL for extended I/O\n%s",
@@ -362,7 +366,7 @@ xf86EnableIO()
if ((IoFd = open("/dev/io", O_RDWR)) == -1)
{
FatalError("xf86EnableIO: "
- "Failed to open /dev/io for extended I/O\n");
+ "Failed to open /dev/io for extended I/O");
}
return;
}
@@ -435,7 +439,7 @@ xf86SetTVOut(int mode)
#endif /* PCCONS_SUPPORT */
default:
- FatalError("Xf86SetTVOut: Unsupported console\n");
+ FatalError("Xf86SetTVOut: Unsupported console");
break;
}
return;
@@ -460,7 +464,7 @@ xf86SetRGBOut()
#endif /* PCCONS_SUPPORT */
default:
- FatalError("Xf86SetTVOut: Unsupported console\n");
+ FatalError("Xf86SetTVOut: Unsupported console");
break;
}
return;
diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c
index 4ec7045e8..3e4ff9ee7 100644
--- a/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/hw/xfree86/os-support/bsd/ppc_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.3 2002/11/09 17:28:08 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.6 2003/10/07 23:14:55 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -44,7 +44,11 @@
/* Video Memory Mapping section */
/***************************************************************************/
+#ifndef __OpenBSD__
#define DEV_MEM "/dev/mem"
+#else
+#define DEV_MEM "/dev/xf86"
+#endif
static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags);
static void ppcUnmapVidMem(int, pointer, unsigned long);
@@ -71,9 +75,12 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
Base, Size, fd);
#endif
- base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+ 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)\n",
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
"xf86MapVidMem", Size, Base, strerror(errno));
return base;
@@ -93,9 +100,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
static int kmem = -1;
if (kmem == -1) {
- kmem = open("/dev/xf86", 2);
+ kmem = open(DEV_MEM, 2);
if (kmem == -1) {
- FatalError("xf86ReadBIOS: open /dev/xf86\n");
+ FatalError("xf86ReadBIOS: open %s", DEV_MEM);
}
}
diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c
index 877550154..fe301acf5 100644
--- a/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c,v 1.1 2002/08/06 13:08:39 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c,v 1.3 2003/10/07 23:14:55 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -66,9 +66,12 @@ sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
Base, Size, fd);
#endif
- base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+ 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)\n",
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
"xf86MapVidMem", Size, Base, strerror(errno));
return base;
}
diff --git a/hw/xfree86/os-support/bus/460gxPCI.c b/hw/xfree86/os-support/bus/460gxPCI.c
index 4840fd144..3b16f401a 100644
--- a/hw/xfree86/os-support/bus/460gxPCI.c
+++ b/hw/xfree86/os-support/bus/460gxPCI.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c,v 1.2 2003/01/10 22:05:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c,v 1.4 2003/08/29 21:08:06 tsi Exp $ */
/*
* Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -122,7 +122,7 @@ Control460GXBridge(int bus, CARD16 mask, CARD16 value)
* host bridges.
*/
static void
-Get460GXBridgeBusses(int bus, int *primary, int *secondary, int *subordinate)
+Get460GXBridgeBuses(int bus, int *primary, int *secondary, int *subordinate)
{
pciConfigPtr pPCI = Verify460GXBus(bus);
int i;
@@ -217,7 +217,7 @@ xf86PreScan460GX(void)
/* First look for a 460GX's primary host bridge */
tag = PCI_MAKE_TAG(0, 0x10, 0);
- if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) {
+ if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
cbn_460gx = -1;
return FALSE;
}
@@ -239,7 +239,7 @@ xf86PreScan460GX(void)
}
tag = PCI_MAKE_TAG(cbn_460gx, 0, 0);
- if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) {
+ if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
/* Sanity check failed */
cbn_460gx = -1;
return TRUE;
@@ -253,7 +253,8 @@ xf86PreScan460GX(void)
for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) {
tag = PCI_MAKE_TAG(cbn_460gx, devno, 0);
- if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 460GX_SAC)) {
+ if (pciReadLong(tag, PCI_ID_REG) !=
+ DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
/* Sanity check failed */
cbn_460gx = -1;
return TRUE;
@@ -272,8 +273,8 @@ xf86PreScan460GX(void)
tag = PCI_MAKE_TAG(cbn_460gx, devno, 1);
tmp = pciReadLong(tag, PCI_ID_REG);
switch (tmp) {
- case DEVID(INTEL, 460GX_PXB):
- case DEVID(INTEL, 460GX_WXB):
+ case DEVID(VENDOR_INTEL, CHIP_460GX_PXB):
+ case DEVID(VENDOR_INTEL, CHIP_460GX_WXB):
if (cbdevs_460gx & (1 << devno)) {
/* Sanity check failed */
cbn_460gx = -1;
@@ -289,7 +290,7 @@ xf86PreScan460GX(void)
has_err_460gx[i] = 1;
break;
- case DEVID(INTEL, 460GX_GXB_1):
+ case DEVID(VENDOR_INTEL, CHIP_460GX_GXB_1):
if (cbdevs_460gx & (1 << devno)) {
/* Sanity check failed */
cbn_460gx = -1;
@@ -323,7 +324,7 @@ xf86PreScan460GX(void)
}
/*
- * The 460GX spec says that any access to busses higher than CBN will be
+ * The 460GX spec says that any access to buses higher than CBN will be
* master-aborted. It seems possible however that this is not the case in
* all 460GX implementations. For now, limit the bus scan to CBN, unless
* we have already found a higher bus number.
@@ -353,7 +354,7 @@ xf86PostScan460GX(void)
/* Set up our extra bus functions */
BusFuncs_460gx = *(pciBusInfo[0]->funcs);
BusFuncs_460gx.pciControlBridge = Control460GXBridge;
- BusFuncs_460gx.pciGetBridgeBusses = Get460GXBridgeBusses;
+ BusFuncs_460gx.pciGetBridgeBuses = Get460GXBridgeBuses;
BusFuncs_460gx.pciGetBridgeResources = Get460GXBridgeResources;
/*
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index c7777827d..a0b639143 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.71.2.2 2003/05/06 17:00:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.81 2003/09/24 02:43:34 dawes Exp $ */
/*
* Pci.c - New server PCI access functions
*
@@ -19,8 +19,6 @@
* pciWriteByte() - Write an 8 bit value to a device's cfg space
* pciSetBitsLong() - Write a 32 bit value against a mask
* pciSetBitsByte() - Write an 8 bit value against a mask
- * pciLongFunc() - Return pointer to the requested low level
- * function
* pciTag() - Return tag for a given PCI bus, device, &
* function
* pciBusAddrToHostAddr() - Convert a PCI address to a host address
@@ -170,6 +168,33 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
#include <errno.h>
#include <signal.h>
#include "Xarch.h"
@@ -376,7 +401,7 @@ pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val)
pciInit();
if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] &&
- pciBusInfo[bus]->funcs->pciReadLong) {
+ pciBusInfo[bus]->funcs->pciSetBitsLong) {
(*pciBusInfo[bus]->funcs->pciSetBitsLong)(tag, offset, mask, val);
}
}
@@ -393,27 +418,6 @@ pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val)
pciSetBitsLong(tag, aligned_offset, tmp_mask, tmp_val);
}
-pointer
-pciLongFunc(PCITAG tag, pciFunc func)
-{
- int bus = PCI_BUS_FROM_TAG(tag);
-
- pciInit();
-
- if ((bus < 0) || (bus > pciNumBuses) || !pciBusInfo[bus] ||
- !pciBusInfo[bus]->funcs->pciReadLong) return NULL;
-
- switch (func) {
- case WRITE:
- return (void *)pciBusInfo[bus]->funcs->pciWriteLong;
- case READ:
- return (void *)pciBusInfo[bus]->funcs->pciReadLong;
- case SET_BITS:
- return (void *)pciBusInfo[bus]->funcs->pciSetBitsLong;
- }
- return NULL;
-}
-
ADDRESS
pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
{
@@ -551,11 +555,7 @@ pciGetBaseSize(PCITAG tag, int index, Bool destructive, Bool *min)
}
/* I/O maps can be no larger than 8 bits */
-#if defined(Lynx) && defined(__powerpc__)
- if (PCI_MAP_IS_IO(addr1) && bits > 8)
-#else
if ((index < 6) && PCI_MAP_IS_IO(addr1) && bits > 8)
-#endif
bits = 8;
/* ROM maps can be no larger than 24 bits */
if (index == 6 && bits > 24)
@@ -569,6 +569,8 @@ pciTag(int busnum, int devnum, int funcnum)
return(PCI_MAKE_TAG(busnum,devnum,funcnum));
}
+#if defined(PCI_MFDEV_SUPPORT) || defined(PowerMAX_OS)
+
Bool
pciMfDev(int busnum, int devnum)
{
@@ -579,7 +581,7 @@ pciMfDev(int busnum, int devnum)
tag0 = PCI_MAKE_TAG(busnum, devnum, 0);
id0 = pciReadLong(tag0, PCI_ID_REG);
- if (id0 == 0xffffffff)
+ if ((CARD16)(id0 + 1) <= (CARD16)1UL)
return FALSE;
val = pciReadLong(tag0, PCI_HEADER_MISC) & 0x00ff0000;
@@ -594,10 +596,15 @@ pciMfDev(int busnum, int devnum)
*/
tag1 = PCI_MAKE_TAG(busnum, devnum, 1);
id1 = pciReadLong(tag1, PCI_ID_REG);
- if (id1 == 0xffffffff || id1 == 0x00000000)
+ if ((CARD16)(id1 + 1) <= (CARD16)1UL)
+ return FALSE;
+
+ /* Vendor IDs should match */
+ if ((id0 ^ id1) & 0x0000ffff)
return FALSE;
if ((id0 != id1) ||
+ /* Note the following test is valid for header types 0, 1 and 2 */
(pciReadLong(tag0, PCI_MAP_REG_START) !=
pciReadLong(tag1, PCI_MAP_REG_START)))
return TRUE;
@@ -605,6 +612,8 @@ pciMfDev(int busnum, int devnum)
return FALSE;
}
+#endif
+
/*
* Generic find/read/write functions
*/
@@ -678,6 +687,7 @@ pciGenFindNext(void)
* No more devices for this bus. Next bus please
*/
if (speculativeProbe) {
+ NextSpeculativeBus:
xfree(pciBusInfo[pciBusNum]);
pciBusInfo[pciBusNum] = NULL;
speculativeProbe = FALSE;
@@ -715,7 +725,7 @@ pciGenFindNext(void)
#endif
pciDeviceTag = PCI_MAKE_TAG(pciBusNum, pciDevNum, pciFuncNum);
inProbe = TRUE;
- devid = pciReadLong(pciDeviceTag, 0);
+ devid = pciReadLong(pciDeviceTag, PCI_ID_REG);
inProbe = FALSE;
#ifdef DEBUGPCI
ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid);
@@ -723,18 +733,36 @@ pciGenFindNext(void)
if ((CARD16)(devid + 1U) <= (CARD16)1UL)
continue; /* Nobody home. Next device please */
+ /*
+ * Some devices mis-decode configuration cycles in such a way as to
+ * create phantom buses.
+ */
+ if (speculativeProbe && (pciDevNum == 0) && (pciFuncNum == 0) &&
+ (PCI_BUS_NO_DOMAIN(pciBusNum) > 0)) {
+ for (;;) {
+ if (++pciDevNum >= pciBusInfo[pciBusNum]->numDevices)
+ goto NextSpeculativeBus;
+ if (devid !=
+ pciReadLong(PCI_MAKE_TAG(pciBusNum, pciDevNum, 0),
+ PCI_ID_REG))
+ break;
+ }
+
+ pciDevNum = 0;
+ }
+
if (pciNumBuses <= pciBusNum)
pciNumBuses = pciBusNum + 1;
speculativeProbe = FALSE;
previousBus = pciBusNum;
+#ifdef PCI_BRIDGE_SUPPORT
/*
* Before checking for a specific devid, look for enabled
* PCI to PCI bridge devices. If one is found, create and
* initialize a bus info record (if one does not already exist).
*/
-#ifdef PCI_BRIDGE_SUPPORT
tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG);
base_class = PCI_CLASS_EXTRACT(tmp);
sub_class = PCI_SUBCLASS_EXTRACT(tmp);
@@ -754,7 +782,7 @@ pciGenFindNext(void)
(sub_class != PCI_SUBCLASS_BRIDGE_CARDBUS))
xf86Msg(X_WARNING,
"pciGenFindNext: primary bus mismatch on PCI"
- " bridge 0x%08x (0x%02x, 0x%02x)\n",
+ " bridge 0x%08lx (0x%02x, 0x%02x)\n",
pciDeviceTag, pciBusNum, pri_bus);
pri_bus = pciBusNum;
}
@@ -970,12 +998,6 @@ xf86scanpci(int flags)
for (i = 0; i < 17; i++) /* PCI hdr plus 1st dev spec dword */
devp->cfgspc.dwords[i] = pciReadLong(tag, i * sizeof(CARD32));
-#ifdef ARCH_PCI_HOST_BRIDGE
- if ((devp->pci_base_class == PCI_CLASS_BRIDGE) &&
- (devp->pci_sub_class == PCI_SUBCLASS_BRIDGE_HOST))
- ARCH_PCI_HOST_BRIDGE(devp);
-#endif
-
/* Some broken devices don't implement this field... */
if (devp->pci_header_type == 0xff)
devp->pci_header_type = 0;
@@ -1115,7 +1137,7 @@ xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
base = xf86MapDomainMemory(ScreenNum, Flags, Tag, hostbase, Size);
if (!base) {
FatalError("xf86MapPciMem: Could not mmap PCI memory "
- "[base=0x%x,hostbase=0x%x,size=%x] (%s)\n",
+ "[base=0x%lx,hostbase=0x%lx,size=%lx] (%s)\n",
Base, hostbase, Size, strerror(errno));
}
/*
@@ -1165,8 +1187,8 @@ handlePciBIOS(PCITAG Tag, int basereg,
savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2));
xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
" for device %i:%i:%i\n", basereg,
- PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag),
- PCI_FUNC_FROM_TAG(Tag));
+ (int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag),
+ (int)PCI_FUNC_FROM_TAG(Tag));
pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2),
(CARD32)~0);
}
@@ -1275,7 +1297,7 @@ readPciBios(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer args)
}
if ((rd->Offset) > (image_length)) {
xf86Msg(X_WARNING,"xf86ReadPciBios: requesting data past "
- "end of BIOS %i > %i\n",(rd->Offset) , (image_length));
+ "end of BIOS %li > %i\n",(rd->Offset) , (image_length));
} else {
if ((rd->Offset + rd->Len) > (image_length)) {
rd->Len = (image_length) - rd->Offset;
@@ -1299,7 +1321,7 @@ getPciBIOSTypes(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer arg)
/* We found a PCI BIOS Image. Now we collect the types type */
do {
unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8);
- unsigned char data[16];
+ unsigned char data[0x16];
unsigned int i_length;
if ((xf86ReadDomainMemory(Tag, hostbase + data_off, sizeof(data), data)
@@ -1359,22 +1381,20 @@ HandlePciBios(PCITAG Tag, int basereg,
if (!num) return 0;
#define PCI_ENA (PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE)
- Acc1 = ((ReadProcPtr)(pciLongFunc(Tag,READ)))(Tag,PCI_CMD_STAT_REG);
- ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,
- PCI_CMD_STAT_REG,(Acc1 & ~PCI_ENA));
+ Acc1 = pciReadLong(Tag, PCI_CMD_STAT_REG);
+ pciWriteLong(Tag, PCI_CMD_STAT_REG, (Acc1 & ~PCI_ENA));
for (i = 0; i < num; i++) {
- Acc2 = ((ReadProcPtr)(pciLongFunc(pTag[i],READ)))(pTag[i],PCI_CMD_STAT_REG);
- ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],
- PCI_CMD_STAT_REG,(Acc2 | PCI_ENA));
+ Acc2 = pciReadLong(pTag[i], PCI_CMD_STAT_REG);
+ pciWriteLong(pTag[i], PCI_CMD_STAT_REG, (Acc2 | PCI_ENA));
n = handlePciBIOS(pTag[i],0,func,ptr);
- ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],PCI_CMD_STAT_REG,Acc2);
+ pciWriteLong(pTag[i], PCI_CMD_STAT_REG, Acc2);
if (n)
break;
}
- ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1);
+ pciWriteLong(Tag, PCI_CMD_STAT_REG, Acc1);
return n;
}
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 8fb421b34..74ca95baf 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.36.2.1 2003/03/21 22:29:59 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.44 2003/11/07 23:57:47 dawes Exp $ */
/*
* Copyright 1998 by Concurrent Computer Corporation
*
@@ -69,6 +69,33 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
/*
* This file has the private Pci definitions. The public ones are imported
@@ -98,7 +125,7 @@
#endif
#define DEVID(vendor, device) \
- ((CARD32)((PCI_CHIP_##device << 16) | PCI_VENDOR_##vendor))
+ ((CARD32)((PCI_##device << 16) | PCI_##vendor))
#ifndef PCI_DOM_MASK
# define PCI_DOM_MASK 0x0ffu
@@ -228,11 +255,14 @@
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
+# elif defined(FreeBSD)
+# define ARCH_PCI_INIT freebsdPciInit
+# define INCLUDE_XF86_MAP_PCI_MEM
+# define INCLUDE_XF86_NO_DOMAIN
# endif
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
#elif defined(__i386__)
# define ARCH_PCI_INIT ix86PciInit
-# define ARCH_PCI_HOST_BRIDGE ix86PciHostBridge
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# if defined(linux)
@@ -289,14 +319,20 @@
# elif defined(sun)
# define ARCH_PCI_INIT sparcPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
-# elif defined(__OpenBSD__) && defined(__sparc64__)
+# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
-# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
-#elif defined(__x86_64__)
-# define ARCH_PCI_INIT ix86PciInit
+# if !defined(__FreeBSD__)
+# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
+# endif
+#elif defined(__AMD64__)
+# if defined(__FreeBSD__)
+# define ARCH_PCI_INIT freebsdPciInit
+# else
+# define ARCH_PCI_INIT ix86PciInit
+# endif
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# if defined(linux)
@@ -313,10 +349,6 @@ extern void ARCH_PCI_INIT(void);
extern void ARCH_PCI_OS_INIT(void);
#endif
-#if defined(ARCH_PCI_HOST_BRIDGE)
-extern void ARCH_PCI_HOST_BRIDGE(pciConfigPtr pPCI);
-#endif
-
#if defined(ARCH_PCI_PCI_BRIDGE)
extern void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI);
#endif
@@ -344,7 +376,7 @@ typedef struct pci_bus_funcs {
* to be performed generically.
*/
CARD16 (*pciControlBridge)(int, CARD16, CARD16);
- void (*pciGetBridgeBusses)(int, int *, int *, int *);
+ void (*pciGetBridgeBuses)(int, int *, int *, int *);
/* Use pointer's to avoid #include recursion */
void (*pciGetBridgeResources)(int, pointer *, pointer *, pointer *);
} pciBusFuncs_t, *pciBusFuncs_p;
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index c730c1559..57262efa2 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -20,7 +20,7 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.2 2001/10/28 03:34:01 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.4 2003/10/02 13:30:06 eich Exp $ */
#include <fcntl.h>
#include <stdio.h>
@@ -170,6 +170,8 @@ promIsP1275(void)
promP1275 = TRUE;
else
promP1275 = FALSE;
+#elif defined(__FreeBSD__)
+ promP1275 = TRUE;
#else
#error Missing promIsP1275() function for this OS
#endif
@@ -554,6 +556,9 @@ pointer
xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
{
pointer ret;
+ unsigned long pagemask = xf86getpagesize() - 1;
+ unsigned long off = offset & ~pagemask;
+ unsigned long len = ((offset + size + pagemask) & ~pagemask) - off;
if (psdp->fd == -1) {
psdp->fd = open(psdp->device, O_RDWR);
@@ -562,22 +567,26 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
} else if (psdp->fd < 0)
return NULL;
- ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
- psdp->fd, offset);
+ ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ psdp->fd, off);
if (ret == (pointer) -1) {
- ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
- psdp->fd, offset);
+ ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
+ psdp->fd, off);
}
if (ret == (pointer) -1)
return NULL;
- return ret;
+ return (char *)ret + (offset - off);
}
void
xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size)
{
- munmap (addr, size);
+ unsigned long mask = xf86getpagesize() - 1;
+ unsigned long base = (unsigned long)addr & ~mask;
+ unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base;
+
+ munmap ((pointer)base, len);
}
/* Tell OS that we are driving the HW cursor ourselves. */
diff --git a/hw/xfree86/os-support/bus/e8870PCI.c b/hw/xfree86/os-support/bus/e8870PCI.c
index 829de03c0..adbd189f1 100644
--- a/hw/xfree86/os-support/bus/e8870PCI.c
+++ b/hw/xfree86/os-support/bus/e8870PCI.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c,v 1.1 2003/02/23 20:26:49 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c,v 1.2 2003/07/17 15:08:22 tsi Exp $ */
/*
* Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -40,7 +40,7 @@ xf86PreScanE8870(void)
/* Look for an E8870's Hub interface */
tag = PCI_MAKE_TAG(0, 0x1E, 0);
- if (pciReadLong(tag, PCI_ID_REG) != DEVID(INTEL, 82801_P2P))
+ if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_82801_P2P))
return FALSE;
/* XXX Fill me in... */
diff --git a/hw/xfree86/os-support/bus/freebsdPci.c b/hw/xfree86/os-support/bus/freebsdPci.c
index c3e621daf..06baa69ea 100644
--- a/hw/xfree86/os-support/bus/freebsdPci.c
+++ b/hw/xfree86/os-support/bus/freebsdPci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.5 2002/08/27 22:07:07 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.6 2003/10/02 13:30:07 eich Exp $ */
/*
* Copyright 1998 by Concurrent Computer Corporation
*
@@ -84,7 +84,7 @@ static pciBusInfo_t freebsdPci0 = {
/* bridge */ NULL
};
-#if !defined(__OpenBSD__)
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
#if X_BYTE_ORDER == X_BIG_ENDIAN
#ifdef __sparc__
#ifndef ASI_PL
diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c
index e07f5497c..b135d0b73 100644
--- a/hw/xfree86/os-support/bus/ix86Pci.c
+++ b/hw/xfree86/os-support/bus/ix86Pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.18 2003/01/27 00:01:44 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.25 2003/09/24 02:43:34 dawes Exp $ */
/*
* ix86Pci.c - x86 PCI driver
*
@@ -109,6 +109,33 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
#include <stdio.h>
#include "compiler.h"
#include "xf86.h"
@@ -318,8 +345,9 @@ void ix86PciSelectCfgmech(void)
xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
xf86MsgVerb(X_INFO, 3,
- "PCI: stages = 0x%02x, oldVal1 = 0x%08x, mode1Res1"
- " = 0x%08x\n", stages, oldVal1, mode1Res1);
+ "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1"
+ " = 0x%08lx\n", stages, (unsigned long)oldVal1,
+ (unsigned long)mode1Res1);
return;
}
@@ -372,9 +400,10 @@ void ix86PciSelectCfgmech(void)
xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
xf86MsgVerb(X_INFO, 3,
- "PCI: stages = 0x%02x, oldVal1 = 0x%08x,\n"
- "\tmode1Res1 = 0x%08x, mode1Res2 = 0x%08x\n",
- stages, oldVal1, mode1Res1, mode1Res2);
+ "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
+ "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
+ stages, (unsigned long)oldVal1,
+ (unsigned long)mode1Res1, (unsigned long)mode1Res2);
return;
}
@@ -388,9 +417,10 @@ void ix86PciSelectCfgmech(void)
}
xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n");
- xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08x,\n"
- "\tmode1Res1 = 0x%08x, mode1Res2 = 0x%08x\n",
- stages, oldVal1, mode1Res1, mode1Res2);
+ xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
+ "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
+ stages, (unsigned long)oldVal1, (unsigned long)mode1Res1,
+ (unsigned long)mode1Res2);
/* Try config type 2 */
oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG);
@@ -656,35 +686,3 @@ ix86PciInit()
pciBusInfo[0] = NULL;
}
}
-
-#ifdef ARCH_PCI_HOST_BRIDGE
-
-/*
- * A small table of host bridges that limit the number of PCI buses to less
- * than the maximum of 256.
- */
-static struct {
- CARD32 devid;
- int maxpcibus;
-} host_bridges[] = {
- { DEVID(ALI_2, M1541), 128},
- { DEVID(VIA, APOLLOVP1), 64},
- { DEVID(VIA, APOLLOPRO133X), 64},
- { DEVID(INTEL, 430HX_BRIDGE), 16},
- { DEVID(INTEL, 440BX_BRIDGE), 32},
-};
-#define NUM_BRIDGES (sizeof(host_bridges) / sizeof(host_bridges[0]))
-
-void ARCH_PCI_HOST_BRIDGE(pciConfigPtr pPCI)
-{
- int i;
-
- for (i = 0; i < NUM_BRIDGES; i++) {
- if (pPCI->pci_device_vendor == host_bridges[i].devid) {
- pciMaxBusNum = host_bridges[i].maxpcibus;
- break;
- }
- }
-}
-
-#endif /* ARCH_PCI_HOST_BRIDGE */
diff --git a/hw/xfree86/os-support/bus/netbsdPci.c b/hw/xfree86/os-support/bus/netbsdPci.c
index 637bd7021..9c46ee3d3 100644
--- a/hw/xfree86/os-support/bus/netbsdPci.c
+++ b/hw/xfree86/os-support/bus/netbsdPci.c
@@ -1,5 +1,6 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c,v 1.4 2003/08/24 17:37:04 dawes Exp $ */
/*
- * Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -25,7 +26,6 @@
* use or other dealings in this Software without prior written
* authorization from the XFree86 Project.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c,v 1.2 2002/08/27 22:07:07 tsi Exp $ */
#include <sys/types.h>
#include <sys/mman.h>
@@ -60,10 +60,6 @@ static pciBusInfo_t netbsdPci0 = {
/* numDevices */ 32,
/* secondary */ FALSE,
/* primary_bus */ 0,
-#ifdef PowerMAX_OS
-/* io_base */ 0,
-/* io_size */ 0,
-#endif
/* funcs */ &netbsdFuncs0,
/* pciBusPriv */ NULL,
/* bridge */ NULL
@@ -72,6 +68,7 @@ static pciBusInfo_t netbsdPci0 = {
void
netbsdPciInit()
{
+ struct pciio_businfo pci_businfo;
devpci = open("/dev/pci0", O_RDWR);
if (devpci == -1)
@@ -81,6 +78,10 @@ netbsdPciInit()
pciBusInfo[0] = &netbsdPci0;
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
+ /* use businfo to get the number of devs */
+ if (ioctl(devpci, PCI_IOC_BUSINFO, &pci_businfo) != 0)
+ FatalError("netbsdPciInit: not a PCI bus device");
+ netbsdPci0.numDevices = pci_businfo.maxdevs;
}
static CARD32
diff --git a/hw/xfree86/os-support/bus/sparcPci.c b/hw/xfree86/os-support/bus/sparcPci.c
index 24bbec44c..2ada6fd47 100644
--- a/hw/xfree86/os-support/bus/sparcPci.c
+++ b/hw/xfree86/os-support/bus/sparcPci.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.12 2003/01/02 18:11:32 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.14 2003/08/24 17:37:04 dawes Exp $ */
/*
- * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) 2001-2003 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -852,7 +852,7 @@ simbaVerifyBus(int bus)
pciConfigPtr pPCI;
if ((bus < 0) || (bus >= pciNumBuses) ||
!pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) ||
- (pPCI->pci_device_vendor != DEVID(SUN, SIMBA)))
+ (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA)))
return NULL;
return pPCI;
@@ -1012,7 +1012,7 @@ void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI)
pciBusInfo_t *pBusInfo;
CARD16 pcicommand;
- if (pPCI->pci_device_vendor != DEVID(SUN, SIMBA))
+ if (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA))
return;
pBusInfo = pPCI->businfo;
diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index 3ffc7d544..f2b5c0727 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.36.2.1 2003/03/21 22:29:59 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.39 2003/08/24 17:37:05 dawes Exp $ */
/*
* Copyright 1998 by Concurrent Computer Corporation
*
@@ -69,6 +69,33 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
/*
* This file contains just the public interface to the PCI code.
@@ -638,12 +665,6 @@ typedef struct pci_device {
} pciDevice, *pciConfigPtr;
typedef enum {
- WRITE,
- READ,
- SET_BITS
-} pciFunc;
-
-typedef enum {
PCI_MEM,
PCI_MEM_SIZE,
PCI_MEM_SPARSE_BASE,
@@ -744,7 +765,6 @@ void pciWriteWord(PCITAG tag, int offset, CARD16 val);
void pciWriteByte(PCITAG tag, int offset, CARD8 val);
void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val);
void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val);
-pointer pciLongFunc(PCITAG tag, pciFunc func);
ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
PCITAG pciTag(int busnum, int devnum, int funcnum);
diff --git a/hw/xfree86/os-support/bus/xf86Sbus.h b/hw/xfree86/os-support/bus/xf86Sbus.h
index 5c8acfd4b..1f5f03bd2 100644
--- a/hw/xfree86/os-support/bus/xf86Sbus.h
+++ b/hw/xfree86/os-support/bus/xf86Sbus.h
@@ -20,7 +20,7 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.5 2002/05/22 21:38:30 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.6 2003/10/02 13:30:07 eich Exp $ */
#ifndef _XF86_SBUS_H
#define _XF86_SBUS_H
@@ -35,7 +35,13 @@
#elif defined(__OpenBSD__) && defined(__sparc64__)
/* XXX */
#elif defined(CSRG_BASED)
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/fbio.h>
+#include <dev/ofw/openpromio.h>
+#else
#include <machine/fbio.h>
+#endif
#else
#include <sun/fbio.h>
#endif
diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c
index dc4d062f3..b5a483560 100644
--- a/hw/xfree86/os-support/bus/zx1PCI.c
+++ b/hw/xfree86/os-support/bus/zx1PCI.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.1 2003/02/23 20:26:49 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.5 2003/11/06 18:38:14 tsi Exp $ */
/*
* Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -97,6 +97,8 @@
#define LBA_PORT5_CNTRL 0x1228U
#define LBA_PORT6_CNTRL 0x1230U
#define LBA_PORT7_CNTRL 0x1238U
+#define LBA_ROPE_RESET 0x01UL
+#define LBA_CLEAR_ERROR 0x10UL
#define LBA_HARD_FAIL 0x40UL
#define ROPE_PAGE_CONTROL 0x1418U
@@ -326,7 +328,8 @@ ControlZX1Bridge(int bus, CARD16 mask, CARD16 value)
}
/* Move on to master abort failure enablement */
- tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL);
+ tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) &
+ ~(LBA_ROPE_RESET | LBA_CLEAR_ERROR);
if ((tmp1 & LBA_HARD_FAIL) || (tmp2 & IOA_HARD_FAIL)) {
current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN;
if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) &&
@@ -388,14 +391,15 @@ GetZX1BridgeResources(int bus,
static CARD32
zx1FakeReadLong(PCITAG tag, int offset)
{
- FatalError("zx1FakeReadLong(0x%X, 0x%X) called\n", tag, offset);
+ FatalError("zx1FakeReadLong(0x%lX, 0x%X) called\n",
+ (unsigned long)tag, offset);
}
static void
zx1FakeWriteLong(PCITAG tag, int offset, CARD32 val)
{
- FatalError("zx1FakeWriteLong(0x%X, 0x%X, 0x%08X) called\n",
- tag, offset, val);
+ FatalError("zx1FakeWriteLong(0x%lX, 0x%X, 0x%08X) called\n",
+ (unsigned long)tag, offset, val);
}
static void
@@ -458,8 +462,10 @@ xf86PreScanZX1(void)
return FALSE;
/* Look for ZX1's SBA and IOC */
- if ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != DEVID(HP, ZX1_SBA)) ||
- (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != DEVID(HP, ZX1_IOC))) {
+ if ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) !=
+ DEVID(VENDOR_HP, CHIP_ZX1_SBA)) ||
+ (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) !=
+ DEVID(VENDOR_HP, CHIP_ZX1_IOC))) {
xf86UnMapVidMem(-1, pZX1mio, mapSize);
pZX1mio = NULL;
return FALSE;
@@ -513,7 +519,8 @@ xf86PreScanZX1(void)
if (zx1_ropemap[i] == i) {
/* Prevent hard-fails */
- zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL);
+ zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) &
+ ~(LBA_ROPE_RESET | LBA_CLEAR_ERROR);
if (zx1_lbacntl[i] & LBA_HARD_FAIL)
MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) =
zx1_lbacntl[i] & ~LBA_HARD_FAIL;
@@ -521,8 +528,10 @@ xf86PreScanZX1(void)
/* Poke for an ioa */
tmp = IOA_LONG(i, PCI_ID_REG);
switch ((CARD32)tmp) {
- case DEVID(HP, ELROY): /* Expected vendor/device id's */
- case DEVID(HP, ZX1_LBA):
+ case DEVID(VENDOR_HP, CHIP_ELROY):
+ case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */
+ case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */
+ /* Expected vendor/device IDs */
zx1_busno[i] =
(unsigned int)IOA_BYTE(i, IOA_SECONDARY_BUS);
zx1_subno[i] =
@@ -900,9 +909,9 @@ xf86PostScanZX1(void)
ppPCI = ppPCI2 = xf86scanpci(0); /* Recursion is only apparent */
while ((pPCI = *ppPCI2++)) {
switch (pPCI->pci_device_vendor) {
- case DEVID(HP, ZX1_SBA):
- case DEVID(HP, ZX1_IOC):
- case DEVID(HP, ZX1_LBA):
+ case DEVID(VENDOR_HP, CHIP_ZX1_SBA):
+ case DEVID(VENDOR_HP, CHIP_ZX1_IOC):
+ case DEVID(VENDOR_HP, CHIP_ZX1_LBA):
xfree(pPCI); /* Remove it */
continue;
@@ -975,7 +984,7 @@ xf86PostScanZX1(void)
pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, 0, 0);
pPCI->busnum = zx1_fakebus;
/* pPCI->devnum = pPCI->funcnum = 0; */
- pPCI->pci_device_vendor = DEVID(HP, ZX1_SBA);
+ pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_SBA);
pPCI->pci_base_class = PCI_CLASS_BRIDGE;
/* pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_HOST; */
pPCI->fakeDevice = TRUE;
@@ -1009,7 +1018,7 @@ xf86PostScanZX1(void)
pPCI->devnum = i | 0x10;
/* pPCI->funcnum = 0; */
pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0);
- pPCI->pci_device_vendor = DEVID(HP, ZX1_LBA);
+ pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_LBA);
pPCI->pci_base_class = PCI_CLASS_BRIDGE;
pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_PCI;
pPCI->pci_header_type = 1;
diff --git a/hw/xfree86/os-support/int10Defines.h b/hw/xfree86/os-support/int10Defines.h
index d99ea8672..77d2f4db9 100644
--- a/hw/xfree86/os-support/int10Defines.h
+++ b/hw/xfree86/os-support/int10Defines.h
@@ -1,4 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.3 2001/06/30 21:54:03 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.4 2003/08/24 17:37:03 dawes Exp $ */
+/*
+ * Copyright (c) 2000-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
#ifndef _INT10DEFINES_H_
#define _INT10DEFINES_H_ 1
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 4ef765451..11fe19f67 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.29 2002/10/16 21:13:47 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.31 2003/09/24 02:43:35 dawes Exp $ */
/*
* linux specific part of the int10 module
* Copyright 1999 Egbert Eich
@@ -123,7 +123,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
ErrorF("Mapping sys bios area\n");
#endif
if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
+ PROT_READ | PROT_EXEC,
MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
== MAP_FAILED) {
xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
@@ -238,7 +238,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x%06X.\n", cs);
+ "Unable to retrieve all of segment 0x%06lX.\n", cs);
#ifdef DEBUG
ErrorF("done\n");
#endif
@@ -250,13 +250,13 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
&& !(initPrimary(options))) {
if (bios.bus == BUS_ISA && bios.location.legacy) {
xf86DrvMsg(screen, X_CONFIG,
- "Overriding BIOS location: 0x%lx\n",
+ "Overriding BIOS location: 0x%x\n",
bios.location.legacy);
cs = bios.location.legacy >> 4;
bios_base = (unsigned char *)(cs << 4);
if (!int10_check_bios(screen, cs, bios_base)) {
xf86DrvMsg(screen, X_ERROR,
- "No V_BIOS at specified address 0x%x\n",cs << 4);
+ "No V_BIOS at specified address 0x%lx\n",cs << 4);
goto error3;
}
} else {
@@ -286,7 +286,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
}
}
- xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs);
+ xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", cs);
pInt->BIOSseg = cs;
set_return_trap(pInt);
@@ -345,7 +345,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
bios_base = (unsigned char *)(cs << 4);
if (!int10_check_bios(screen, cs, bios_base)) {
xf86DrvMsg(screen,X_ERROR,"No V_BIOS found "
- "on override address 0x%x\n",bios_base);
+ "on override address %p\n",bios_base);
goto error3;
}
} else {
@@ -365,7 +365,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
}
}
}
- xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs);
+ xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%lx\n",cs);
pInt->BIOSseg = cs;
break;
default:
diff --git a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
index 6203cc3c3..dc737ac47 100644
--- a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
+++ b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
@@ -1,3 +1,5 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c,v 1.3 2003/11/03 05:36:33 tsi Exp $ */
+
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
@@ -173,7 +175,7 @@ vm86_GP_fault(xf86Int10InfoPtr pInt)
case 0x0f:
xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP);
+ "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP);
goto op0ferr;
default:
diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 13e423433..acac20bce 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -7,7 +7,7 @@
* Copyright © 2001 The XFree86 Project, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.10 2002/12/12 18:29:11 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.12 2003/09/24 02:43:35 dawes Exp $ */
#include "X.h"
#include "xf86.h"
@@ -18,7 +18,7 @@
#if defined(linux)
#include <asm/ioctl.h>
#include <linux/agpgart.h>
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/ioctl.h>
#include <sys/agpio.h>
#endif
@@ -263,14 +263,14 @@ xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
if (offset % AGP_PAGE_SIZE != 0) {
xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
- "offset (0x%x) is not page-aligned (%d)\n",
+ "offset (0x%lx) is not page-aligned (%d)\n",
offset, AGP_PAGE_SIZE);
return FALSE;
}
pageOffset = offset / AGP_PAGE_SIZE;
xf86DrvMsgVerb(screenNum, X_INFO, 3,
- "xf86BindGARTMemory: bind key %d at 0x%08x "
+ "xf86BindGARTMemory: bind key %d at 0x%08lx "
"(pgoffset %d)\n", key, offset, pageOffset);
bind.pg_start = pageOffset;
@@ -279,7 +279,7 @@ xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
"binding of gart memory with key %d\n"
- "\tat offset 0x%x failed (%s)\n",
+ "\tat offset 0x%lx failed (%s)\n",
key, offset, strerror(errno));
return FALSE;
}
@@ -332,8 +332,8 @@ xf86EnableAGP(int screenNum, CARD32 mode)
setup.agp_mode = mode;
if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
- "AGPIOC_SETUP with mode %d failed (%s)\n",
- mode, strerror(errno));
+ "AGPIOC_SETUP with mode %ld failed (%s)\n",
+ (unsigned long)mode, strerror(errno));
return FALSE;
}
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c
index 741b9a279..7631a1ff0 100644
--- a/hw/xfree86/os-support/linux/lnx_io.c
+++ b/hw/xfree86/os-support/linux/lnx_io.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.24 2002/10/20 21:45:27 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.26 2003/11/17 22:20:41 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Dawes <dawes@xfree86.org>
@@ -67,6 +67,7 @@ xf86GetKbdLeds()
* from util-linux-2.9t package */
#include <linux/kd.h>
+#include <linux/version.h>
#ifdef __sparc__
#include <asm/param.h>
#include <asm/kbio.h>
@@ -142,12 +143,7 @@ KIOCSRATE_ioctl_ok(int rate, int delay) {
#undef rate
-#if NeedFunctionPrototypes
void xf86SetKbdRepeat(char rad)
-#else
-void xf86SetKbdRepeat(rad)
-char rad;
-#endif
{
#ifdef __sparc__
int rate = 500; /* Default rate */
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c
index f2d508c04..ba18f28a1 100644
--- a/hw/xfree86/os-support/linux/lnx_kbd.c
+++ b/hw/xfree86/os-support/linux/lnx_kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.2 2003/02/17 15:11:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.5 2003/11/04 03:14:39 tsi Exp $ */
/*
* Copyright (c) 2002 by The XFree86 Project, Inc.
@@ -27,7 +27,7 @@
static KbdProtocolRec protocols[] = {
{"standard", PROT_STD },
- { NULL, PROT_UNKNOWN }
+ { NULL, PROT_UNKNOWN_KBD }
};
extern Bool VTSwitchEnabled;
@@ -93,12 +93,20 @@ GetKbdLeds(InputInfoPtr pInfo)
/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al.
* from util-linux-2.9t package */
-
+#include <linux/kd.h>
+#include <linux/version.h>
#ifdef __sparc__
#include <asm/param.h>
#include <asm/kbio.h>
#endif
+/* Deal with spurious kernel header change */
+#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42)
+# define rate period
+# endif
+#endif
+
static int
KDKBDREP_ioctl_ok(int rate, int delay) {
#if defined(KDKBDREP) && !defined(__sparc__)
@@ -160,6 +168,8 @@ KIOCSRATE_ioctl_ok(int rate, int delay) {
#endif /* KIOCSRATE */
}
+#undef rate
+
static void
SetKbdRepeat(InputInfoPtr pInfo, char rad)
{
@@ -436,7 +446,7 @@ OpenKeyboard(InputInfoPtr pInfo)
{
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
int i;
- KbdProtocolId prot = PROT_UNKNOWN;
+ KbdProtocolId prot = PROT_UNKNOWN_KBD;
char *s;
s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
diff --git a/hw/xfree86/os-support/linux/lnx_mouse.c b/hw/xfree86/os-support/linux/lnx_mouse.c
index 8bc7e6331..3d0d30f52 100644
--- a/hw/xfree86/os-support/linux/lnx_mouse.c
+++ b/hw/xfree86/os-support/linux/lnx_mouse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c,v 1.1 1999/05/17 13:17:18 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c,v 1.2 2003/10/08 14:58:30 dawes Exp $ */
/*
* Copyright 1999 by The XFree86 Project, Inc.
@@ -8,6 +8,10 @@
#include "xf86.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
+#include "xf86_OSlib.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
static int
SupportedInterfaces(void)
@@ -15,6 +19,172 @@ SupportedInterfaces(void)
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
}
+static const char *
+DefaultProtocol(void)
+{
+ return "Auto";
+}
+
+#define DEFAULT_MOUSE_DEV "/dev/mouse"
+#define DEFAULT_PS2_DEV "/dev/psaux"
+#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata"
+#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata"
+
+static const char *mouseDevs[] = {
+ DEFAULT_MOUSE_DEV,
+ DEFAULT_PS2_DEV,
+ DEFAULT_GPM_DATA_DEV,
+ NULL
+};
+
+typedef enum {
+ MOUSE_PROTO_UNKNOWN = 0,
+ MOUSE_PROTO_SERIAL,
+ MOUSE_PROTO_PS2,
+ MOUSE_PROTO_MSC,
+ MOUSE_PROTO_GPM
+} protocolTypes;
+
+static struct {
+ protocolTypes proto;
+ const char *name;
+} devproto[] = {
+ { MOUSE_PROTO_UNKNOWN, NULL },
+ { MOUSE_PROTO_PS2, "PS/2" },
+ { MOUSE_PROTO_MSC, "MouseSystems" },
+ { MOUSE_PROTO_GPM, "GPM" }
+};
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
+#endif
+ } else
+ break;
+ }
+
+ if (*pdev) {
+ close(fd);
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, *pdev);
+ }
+
+ return *pdev;
+}
+
+static const char *
+GuessProtocol(InputInfoPtr pInfo, int flags)
+{
+ int fd = -1;
+ const char *dev;
+ char *realdev;
+ struct stat sbuf;
+ int i;
+ int proto = MOUSE_PROTO_UNKNOWN;
+
+ dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL);
+ if (!dev) {
+#ifdef DEBUG
+ ErrorF("xf86SetStrOption failed to return the device name\n");
+#endif
+ return NULL;
+ }
+ /* Look at the device name to guess the protocol. */
+ realdev = NULL;
+ if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) {
+ if (lstat(dev, &sbuf) != 0) {
+#ifdef DEBUG
+ ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ return NULL;
+ }
+ if (S_ISLNK(sbuf.st_mode)) {
+ realdev = xnfalloc(PATH_MAX + 1);
+ i = readlink(dev, realdev, PATH_MAX);
+ if (i <= 0) {
+#ifdef DEBUG
+ ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ xfree(realdev);
+ return NULL;
+ }
+ realdev[i] = '\0';
+ }
+ }
+ if (!realdev)
+ realdev = xnfstrdup(dev);
+ else {
+ /* If realdev doesn't contain a '/' then prepend "/dev/" */
+ if (!strchr(realdev, '/')) {
+ char *tmp = xnfalloc(strlen(realdev) + 5 + 1);
+ sprintf(tmp, "/dev/%s", realdev);
+ xfree(realdev);
+ realdev = tmp;
+ }
+ }
+
+ if (strcmp(realdev, DEFAULT_PS2_DEV) == 0)
+ proto = MOUSE_PROTO_PS2;
+ else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0)
+ proto = MOUSE_PROTO_MSC;
+ else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0)
+ proto = MOUSE_PROTO_GPM;
+ xfree(realdev);
+ /*
+ * If the protocol can't be guessed from the device name,
+ * try to characterise it.
+ */
+ if (proto == MOUSE_PROTO_UNKNOWN) {
+ SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL));
+ if (isatty(fd)) {
+ /* Serial PnP has already failed, so give up. */
+ } else {
+ if (fstat(fd, &sbuf) != 0) {
+#ifdef DEBUG
+ ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ close(fd);
+ return NULL;
+ }
+ if (S_ISFIFO(sbuf.st_mode)) {
+ /* Assume GPM data in MSC format. */
+ proto = MOUSE_PROTO_MSC;
+ } else {
+ /* Default to PS/2 */
+ proto = MOUSE_PROTO_PS2;
+ }
+ }
+ close(fd);
+ }
+ if (proto == MOUSE_PROTO_UNKNOWN) {
+ xf86Msg(X_ERROR, "%s: GuessProtocol: Cannot find mouse protocol.\n",
+ pInfo->name);
+ return NULL;
+ } else {
+ for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) {
+ if (devproto[i].proto == proto) {
+ xf86Msg(X_INFO,
+ "%s: GuessProtocol: "
+ "setting mouse protocol to \"%s\"\n",
+ pInfo->name, devproto[i].name);
+ return devproto[i].name;
+ }
+ }
+ }
+ return NULL;
+}
+
OSMouseInfoPtr
xf86OSMouseInit(int flags)
{
@@ -24,6 +194,9 @@ xf86OSMouseInit(int flags)
if (!p)
return NULL;
p->SupportedInterfaces = SupportedInterfaces;
+ p->DefaultProtocol = DefaultProtocol;
+ p->FindDevice = FindDevice;
+ p->GuessProtocol = GuessProtocol;
return p;
}
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 107d5595e..ad3a17fa2 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.64 2003/02/17 15:29:22 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.68 2003/09/24 02:43:35 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -407,6 +407,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
pointer base;
int fd;
int mapflags = MAP_SHARED;
+ int prot;
memType realBase, alignOff;
realBase = Base & ~(getpagesize() - 1);
@@ -429,25 +430,31 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
mapflags |= MAP_NONCACHED;
#endif
-#if defined(__ia64__)
+#if 0
/* this will disappear when people upgrade their kernels */
- if ((fd = open(DEV_MEM, O_RDWR|O_SYNC)) < 0)
+ fd = open(DEV_MEM,
+ ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
#else
- if ((fd = open(DEV_MEM, O_RDWR)) < 0)
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
#endif
+ if (fd < 0)
{
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
strerror(errno));
}
+
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
/* This requires linux-0.99.pl10 or above */
- base = mmap((caddr_t)0, Size + alignOff,
- PROT_READ|PROT_WRITE,
- mapflags, fd,
+ base = mmap((caddr_t)0, Size + alignOff, prot, mapflags, fd,
(off_t)(off_t)realBase + BUS_BASE);
close(fd);
if (base == MAP_FAILED) {
FatalError("xf86MapVidMem: Could not mmap framebuffer"
- " (0x%08x,0x%x) (%s)\n", Base, Size,
+ " (0x%08lx,0x%lx) (%s)\n", Base, Size,
strerror(errno));
}
#ifdef DEBUG
@@ -500,7 +507,7 @@ xf86EnableIO(void)
fd = open("/dev/mem", O_RDWR);
if (ioBase == NULL) {
ioBase = (volatile unsigned char *)mmap(0, 0x20000,
- PROT_READ|PROT_WRITE, MAP_SHARED, fd,
+ PROT_READ | PROT_WRITE, MAP_SHARED, fd,
ioBase_phys);
/* Should this be fatal or just a warning? */
#if 0
@@ -656,7 +663,7 @@ static unsigned long msb_set = 0;
static pointer
mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- int fd;
+ int fd, prot;
unsigned long ret, rets = 0;
static Bool was_here = FALSE;
@@ -675,7 +682,8 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
xf86ReadMmio32 = readSparse32;
}
- if ((fd = open(DEV_MEM, O_RDWR)) < 0) {
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
strerror(errno));
}
@@ -685,14 +693,18 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
Base, Size, flags);
#endif
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
/* This requirers linux-0.99.pl10 or above */
/*
* Always do DENSE mmap, since read32/write32 currently require it.
*/
ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, fd,
+ prot, MAP_SHARED, fd,
(off_t) (bus_base + Base));
/*
@@ -706,8 +718,7 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
{
rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)),
- Size << 5, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd,
+ Size << 5, prot, MAP_SHARED, fd,
(off_t) _bus_base_sparse() + (Base << 5));
}
@@ -968,7 +979,7 @@ static pointer
mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
pointer base;
- int fd;
+ int fd, prot;
xf86WriteMmio8 = writeSparseJensen8;
xf86WriteMmio16 = writeSparseJensen16;
@@ -980,14 +991,20 @@ mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags
xf86ReadMmio16 = readSparseJensen16;
xf86ReadMmio32 = readSparseJensen32;
- if ((fd = open(DEV_MEM, O_RDWR)) < 0) {
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
strerror(errno));
}
+
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
/* This requires linux-0.99.pl10 or above */
base = mmap((caddr_t)0, JENSEN_SHIFT(Size),
- PROT_READ|PROT_WRITE,
- MAP_SHARED, fd,
+ prot, MAP_SHARED, fd,
(off_t)(JENSEN_SHIFT((off_t)Base) + _bus_base_sparse()));
close(fd);
if (base == MAP_FAILED) {
diff --git a/hw/xfree86/os-support/misc/Delay.c b/hw/xfree86/os-support/misc/Delay.c
index 7d5dad40b..b5de1d899 100644
--- a/hw/xfree86/os-support/misc/Delay.c
+++ b/hw/xfree86/os-support/misc/Delay.c
@@ -1,5 +1,8 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.3 2000/12/08 20:13:38 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.4 2003/03/25 04:18:23 dawes Exp $ */
+#ifdef __UNIXOS2__
+#define I_NEED_OS2_H
+#endif
#include "X.h"
#include "xf86.h"
#include "xf86Priv.h"
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index f705e0f42..98546b688 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -4,7 +4,7 @@
for Alpha Linux
*******************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c,v 1.5 2001/11/19 15:44:18 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c,v 1.6 2003/04/07 16:23:39 eich Exp $ */
/*
* Create a dependency that should be immune from the effect of register
@@ -26,6 +26,9 @@
void
xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
{
+#if defined(__ia64__)
+ outb(0x80, 0x00);
+#endif
while(len--)
{
*dst++ = *src++;
diff --git a/hw/xfree86/os-support/sco/VTsw_sco.c b/hw/xfree86/os-support/sco/VTsw_sco.c
index d06bd3949..899c3820b 100644
--- a/hw/xfree86/os-support/sco/VTsw_sco.c
+++ b/hw/xfree86/os-support/sco/VTsw_sco.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.3 2001/06/30 22:41:49 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.4 2003/07/07 15:34:27 eich Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
* Copyright 1993 by David McCullough <davidm@stallion.oz.au>
@@ -72,6 +72,7 @@ xf86VTSwitchAway()
{
ev_flush();
ev_suspend();
+
sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate);
xf86Info.vtRequestsPending = FALSE;
@@ -97,7 +98,7 @@ xf86VTSwitchTo()
return(FALSE);
} else {
if (sco_ledstatus >= 0) {
- ioctl (xf86Info.consoleFd, KDSETLED, &sco_ledstate);
+ ioctl (xf86Info.consoleFd, KDSETLED, sco_ledstate);
}
sco_ledstatus = -1;
diff --git a/hw/xfree86/os-support/sco/sco_video.c b/hw/xfree86/os-support/sco/sco_video.c
index eb4b80c48..3c00f5564 100644
--- a/hw/xfree86/os-support/sco/sco_video.c
+++ b/hw/xfree86/os-support/sco/sco_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.8 2002/06/03 21:22:10 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.9 2003/03/14 13:46:07 tsi Exp $ */
/*
* Copyright 2001 by J. Kean Johnston <jkj@sco.com>
*
@@ -112,7 +112,7 @@ mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
unsigned long realBase, alignOff;
pointer base;
- fd = open (DEV_MEM, O_RDWR);
+ 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));
@@ -126,8 +126,9 @@ mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
ErrorF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff);
#endif
- base = mmap((caddr_t)0, Size + alignOff, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, (off_t)realBase);
+ 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",
diff --git a/hw/xfree86/os-support/shared/agp_noop.c b/hw/xfree86/os-support/shared/agp_noop.c
index c1100e67b..5da36fa19 100644
--- a/hw/xfree86/os-support/shared/agp_noop.c
+++ b/hw/xfree86/os-support/shared/agp_noop.c
@@ -1,10 +1,39 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c,v 1.5 2003/08/24 17:37:05 dawes Exp $ */
+/*
+ * Copyright (c) 2000-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
/*
* Abstraction of the AGP GART interface. Stubs for platforms without
* AGP GART support.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c,v 1.3 2001/05/19 00:26:46 dawes Exp $ */
-
+#ifdef __UNIXOS2__
+# define I_NEED_OS2_H
+#endif
#include "X.h"
#include "xf86.h"
#include "xf86Priv.h"
diff --git a/hw/xfree86/os-support/shared/at_scancode.c b/hw/xfree86/os-support/shared/at_scancode.c
index a1529579f..821e116ab 100644
--- a/hw/xfree86/os-support/shared/at_scancode.c
+++ b/hw/xfree86/os-support/shared/at_scancode.c
@@ -1,7 +1,29 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c,v 1.1 2002/10/11 01:40:37 dawes Exp $ */
-
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c,v 1.4 2003/08/24 17:37:05 dawes Exp $ */
/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
+ * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
#include "xf86.h"
@@ -21,6 +43,34 @@ ATScancode(InputInfoPtr pInfo, int *scanCode)
case KEY_Prefix1:
pKbd->scanPrefix = *scanCode; /* special prefixes */
return TRUE;
+ case 0x59: *scanCode = KEY_0x59; break;
+ case 0x5a: *scanCode = KEY_0x5A; break;
+ case 0x5b: *scanCode = KEY_0x5B; break;
+ case 0x5c: *scanCode = KEY_KP_Equal; break; /* Keypad Equal */
+ case 0x5d: *scanCode = KEY_0x5D; break;
+ case 0x5e: *scanCode = KEY_0x5E; break;
+ case 0x5f: *scanCode = KEY_0x5F; break;
+ case 0x62: *scanCode = KEY_0x62; break;
+ case 0x63: *scanCode = KEY_0x63; break;
+ case 0x64: *scanCode = KEY_0x64; break;
+ case 0x65: *scanCode = KEY_0x65; break;
+ case 0x66: *scanCode = KEY_0x66; break;
+ case 0x67: *scanCode = KEY_0x67; break;
+ case 0x68: *scanCode = KEY_0x68; break;
+ case 0x69: *scanCode = KEY_0x69; break;
+ case 0x6a: *scanCode = KEY_0x6A; break;
+ case 0x6b: *scanCode = KEY_0x6B; break;
+ case 0x6c: *scanCode = KEY_0x6C; break;
+ case 0x6d: *scanCode = KEY_0x6D; break;
+ case 0x6e: *scanCode = KEY_0x6E; break;
+ case 0x6f: *scanCode = KEY_0x6F; break;
+ case 0x70: *scanCode = KEY_0x70; break;
+ case 0x71: *scanCode = KEY_0x71; break;
+ case 0x72: *scanCode = KEY_0x72; break;
+ case 0x73: *scanCode = KEY_0x73; break;
+ case 0x74: *scanCode = KEY_0x74; break;
+ case 0x75: *scanCode = KEY_0x75; break;
+ case 0x76: *scanCode = KEY_0x76; break;
}
break;
case KEY_Prefix0:
diff --git a/hw/xfree86/os-support/shared/kbd.c b/hw/xfree86/os-support/shared/kbd.c
index 0ebf729ac..213e8bd62 100644
--- a/hw/xfree86/os-support/shared/kbd.c
+++ b/hw/xfree86/os-support/shared/kbd.c
@@ -1,7 +1,29 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c,v 1.2 2003/02/17 15:11:59 dawes Exp $ */
-
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kbd.c,v 1.3 2003/08/24 17:37:05 dawes Exp $ */
/*
- * Copyright (c) 2001 by The XFree86 Project, Inc.
+ * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
#include "xf86OSKbd.h"
diff --git a/hw/xfree86/os-support/shared/kmod_noop.c b/hw/xfree86/os-support/shared/kmod_noop.c
index 80f487593..ae6852ed9 100644
--- a/hw/xfree86/os-support/shared/kmod_noop.c
+++ b/hw/xfree86/os-support/shared/kmod_noop.c
@@ -1,3 +1,30 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c,v 1.2 2003/08/24 17:37:05 dawes Exp $ */
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
#include "xf86_OSproc.h"
diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
index e72997cc3..b6aa8fb29 100644
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.88.2.2 2003/03/13 21:49:53 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.102 2003/11/19 03:52:58 dawes Exp $ */
/*
- * Copyright 1997 by The XFree86 Project, Inc.
+ * Copyright 1997-2003 by The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -27,6 +27,9 @@
#undef __STRICT_ANSI__
#endif
#include <X.h>
+#ifdef __UNIXOS2__
+#define I_NEED_OS2_H
+#endif
#include <Xmd.h>
#include <Xos.h>
#include <sys/types.h>
@@ -251,6 +254,18 @@ xf86strlen(const char* s)
return (xf86size_t)strlen(s);
}
+xf86size_t
+xf86strlcat(char *dest, const char *src, xf86size_t size)
+{
+ return(strlcat(dest, src, size));
+}
+
+xf86size_t
+xf86strlcpy(char *dest, const char *src, xf86size_t size)
+{
+ return strlcpy(dest, src, size);
+}
+
char*
xf86strncat(char* dest, const char* src, xf86size_t n)
{
@@ -481,7 +496,7 @@ xf86mmap(void *start, xf86size_t length, int prot,
if (flags & XF86_MAP_FIXED) f |= MAP_FIXED;
if (flags & XF86_MAP_SHARED) f |= MAP_SHARED;
if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE;
-#ifdef __x86_64__
+#if defined(__AMD64__) && defined(linux)
if (flags & XF86_MAP_32BIT) f |= MAP_32BIT;
#endif
if (prot & XF86_PROT_EXEC) p |= PROT_EXEC;
@@ -655,7 +670,7 @@ static void _xf86checkhndl(XF86FILE_priv* f,const char *func)
{
if (!f || f->magic != XF86FILE_magic ||
!f->filehnd || !f->fname) {
- FatalError("libc_wrapper error: passed invalid FILE handle to %s\n",
+ FatalError("libc_wrapper error: passed invalid FILE handle to %s",
func);
exit(42);
}
@@ -1088,7 +1103,7 @@ xf86setvbuf(XF86FILE* f, char *buf, int mode, xf86size_t size)
vbufmode = _IOLBF;
break;
default:
- FatalError("libc_wrapper error: mode in setvbuf incorrect\n");
+ FatalError("libc_wrapper error: mode in setvbuf incorrect");
exit(42);
}
@@ -1298,7 +1313,7 @@ static void
_xf86checkdirhndl(XF86DIR_priv* f,const char *func)
{
if (!f || f->magic != XF86DIR_magic || !f->dir || !f->dirent) {
- FatalError("libc_wrapper error: passed invalid DIR handle to %s\n",
+ FatalError("libc_wrapper error: passed invalid DIR handle to %s",
func);
exit(42);
}
@@ -1550,8 +1565,12 @@ int
xf86finite(double x)
{
#ifndef QNX4
+#ifndef __UNIXOS2__
return(finite(x));
#else
+ return(isfinite(x));
+#endif /* __UNIXOS2__ */
+#else
/* XXX Replace this with something that really works. */
return 1;
#endif
@@ -1810,7 +1829,7 @@ xf86getpagesize()
pagesize = PAGE_SIZE;
#endif
if (pagesize == -1)
- FatalError("xf86getpagesize: Cannot determine page size\n");
+ FatalError("xf86getpagesize: Cannot determine page size");
return pagesize;
}
@@ -1859,22 +1878,18 @@ xf86GetErrno ()
-#ifdef NEED_SNPRINTF
-#include "snprintf.c"
-#endif
-
#ifdef HAVE_SYSV_IPC
int
xf86shmget(xf86key_t key, int size, int xf86shmflg)
{
- int shmflg = xf86shmflg & 0777;
+ int shmflg;
+
+ /* This copies the permissions (SHM_R, SHM_W for u, g, o). */
+ shmflg = xf86shmflg & 0777;
if (key == XF86IPC_PRIVATE) key = IPC_PRIVATE;
-
- if (xf86shmflg & XF86SHM_R) shmflg |= SHM_R;
- if (xf86shmflg & XF86SHM_W) shmflg |= SHM_W;
if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT;
if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL;
if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT;
@@ -1967,7 +1982,7 @@ int
xf86setjmp(xf86jmp_buf env)
{
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
- return __sigsetjmp(env, xf86setjmp1_arg2());
+ return __sigsetjmp((void *)env, xf86setjmp1_arg2());
#else
return xf86setjmp1(env, xf86setjmp1_arg2());
#endif
@@ -1976,7 +1991,7 @@ xf86setjmp(xf86jmp_buf env)
int
xf86setjmp0(xf86jmp_buf env)
{
- FatalError("setjmp: type 0 called instead of type %d\n", xf86getjmptype());
+ FatalError("setjmp: type 0 called instead of type %d", xf86getjmptype());
}
#if !defined(__GLIBC__) || (__GLIBC__ < 2) /* libc5 */
@@ -1995,7 +2010,7 @@ xf86setjmp1(xf86jmp_buf env, int arg2)
int
xf86setjmp1(xf86jmp_buf env, int arg2)
{
- FatalError("setjmp: type 1 called instead of type %d\n", xf86getjmptype());
+ FatalError("setjmp: type 1 called instead of type %d", xf86getjmptype());
}
#endif /* HAS_GLIBC_SIGSETJMP */
@@ -2009,7 +2024,7 @@ xf86setjmp1_arg2()
int
xf86setjmperror(xf86jmp_buf env)
{
- FatalError("setjmp: don't know how to handle setjmp() type %d\n",
+ FatalError("setjmp: don't know how to handle setjmp() type %d",
xf86getjmptype());
}
diff --git a/hw/xfree86/os-support/shared/pm_noop.c b/hw/xfree86/os-support/shared/pm_noop.c
index fc02b3a20..b5f4941bc 100644
--- a/hw/xfree86/os-support/shared/pm_noop.c
+++ b/hw/xfree86/os-support/shared/pm_noop.c
@@ -1,4 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c,v 1.1 2000/02/13 03:36:11 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c,v 1.2 2003/08/24 17:37:06 dawes Exp $ */
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
/* Stubs for the OS-support layer power-management functions. */
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
index a4f487025..1812729c0 100644
--- a/hw/xfree86/os-support/shared/posix_tty.c
+++ b/hw/xfree86/os-support/shared/posix_tty.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.28 2003/02/17 15:11:59 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.30 2003/08/24 17:37:06 dawes Exp $ */
/*
- * Copyright 1993-1999 by The XFree86 Project, Inc.
+ * Copyright 1993-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -127,12 +127,7 @@ xf86OpenSerial (pointer options)
return (-1);
}
-#ifndef Lynx
- SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK | O_EXCL));
-#else
- /* O_EXCL yields an EEXIST on LynxOS */
SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK));
-#endif
if (fd == -1)
{
xf86Msg (X_ERROR,
diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
index 077c566a6..fbab2a517 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -1,3 +1,5 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.16 2003/09/04 00:21:17 dawes Exp $ */
+
/* sigio.c -- Support for SIGIO handler installation and removal
* Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
*
@@ -24,12 +26,34 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+/*
+ * Copyright (c) 2002 by The XFree86 Project, Inc.
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.14 2002/05/05 19:18:14 herrb Exp $
- *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
-
#ifdef XFree86Server
# include "X.h"
# include "xf86.h"
@@ -151,6 +175,7 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n",
fd, strerror(errno));
#endif
+ xf86UnblockSIGIO(blocked);
return 0;
}
sigemptyset(&sa.sa_mask);
diff --git a/hw/xfree86/os-support/shared/sigiostubs.c b/hw/xfree86/os-support/shared/sigiostubs.c
index 0fdebda1d..51f98f2a4 100644
--- a/hw/xfree86/os-support/shared/sigiostubs.c
+++ b/hw/xfree86/os-support/shared/sigiostubs.c
@@ -1,6 +1,35 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c,v 1.2 1999/10/14 04:25:01 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c,v 1.4 2003/08/24 17:37:06 dawes Exp $ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
#ifdef XFree86Server
+#ifdef __UNIXOS2__
+# define I_NEED_OS2_H
+#endif
# include "X.h"
# include "xf86.h"
# include "xf86drm.h"
diff --git a/hw/xfree86/os-support/shared/stdPci.c b/hw/xfree86/os-support/shared/stdPci.c
index b21acabcc..fd60ec509 100644
--- a/hw/xfree86/os-support/shared/stdPci.c
+++ b/hw/xfree86/os-support/shared/stdPci.c
@@ -1,5 +1,34 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c,v 3.2 1999/12/06 03:55:13 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c,v 3.4 2003/08/24 17:37:06 dawes Exp $ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+#ifdef __UNIXOS2__
+# define I_NEED_OS2_H
+#endif
#include "X.h"
#include "xf86.h"
#include "xf86Priv.h"
diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c
index 5aae4ae9d..df781c371 100644
--- a/hw/xfree86/os-support/shared/stdResource.c
+++ b/hw/xfree86/os-support/shared/stdResource.c
@@ -1,7 +1,36 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.20 2002/01/25 21:56:20 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.22 2003/08/24 17:37:06 dawes Exp $ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
/* Standard resource information code */
+#ifdef __UNIXOS2__
+# define I_NEED_OS2_H
+#endif
#include "X.h"
#include "xf86.h"
#include "xf86Priv.h"
@@ -11,6 +40,9 @@
#include "xf86_OSlib.h"
#include "xf86Resources.h"
+#ifdef __UNIXOS2__
+# undef ADDRESS
+#endif
/* Avoid Imakefile changes */
#include "bus/Pci.h"
diff --git a/hw/xfree86/os-support/shared/vidmem.c b/hw/xfree86/os-support/shared/vidmem.c
index 872cd7aa9..aed735680 100644
--- a/hw/xfree86/os-support/shared/vidmem.c
+++ b/hw/xfree86/os-support/shared/vidmem.c
@@ -1,9 +1,35 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.15 2001/10/28 03:34:02 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.17 2003/08/24 17:37:06 dawes Exp $ */
/*
- * Copyright 1993-1999 by The XFree86 Project, Inc
+ * Copyright (c) 1993-2003 by The XFree86 Project, Inc.
*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
+
+#ifdef __UNIXOS2__
+# define I_NEED_OS2_H
+#endif
#include "X.h"
#include "input.h"
#include "scrnintstr.h"
diff --git a/hw/xfree86/os-support/shared/xf86Axp.c b/hw/xfree86/os-support/shared/xf86Axp.c
index 24d31db59..42edbc53c 100644
--- a/hw/xfree86/os-support/shared/xf86Axp.c
+++ b/hw/xfree86/os-support/shared/xf86Axp.c
@@ -1,4 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c,v 1.2 2000/11/06 21:57:11 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c,v 1.3 2003/08/24 17:37:06 dawes Exp $ */
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
#include "xf86Axp.h"
diff --git a/hw/xfree86/os-support/solaris/sun_bios.c b/hw/xfree86/os-support/solaris/sun_bios.c
index d1c79888b..e93e0e9dd 100644
--- a/hw/xfree86/os-support/solaris/sun_bios.c
+++ b/hw/xfree86/os-support/solaris/sun_bios.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c,v 1.2 2001/10/28 03:34:02 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c,v 1.3 2003/11/07 13:45:27 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -71,7 +71,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
{
if (!xf86LinearVidMem())
FatalError("xf86ReadBIOS: Could not mmap BIOS"
- " [a=%x]\n", Base);
+ " [a=%lx]\n", Base);
sprintf(solx86_vtname, apertureDevName);
}
@@ -86,7 +86,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
if (ptr == MAP_FAILED)
{
xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed "
- "[0x%05x, 0x%04x]\n",
+ "[0x%08lx, 0x%04x]\n",
solx86_vtname, Base, mlen);
close(fd);
return -1;
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.c b/hw/xfree86/os-support/solaris/sun_kbd.c
index 7e4998817..058f1109a 100644
--- a/hw/xfree86/os-support/solaris/sun_kbd.c
+++ b/hw/xfree86/os-support/solaris/sun_kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c,v 1.1 2001/05/28 02:42:31 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c,v 1.2 2003/10/09 11:44:00 pascal Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Dawes <dawes@XFree86.org>
@@ -29,6 +29,7 @@
static int sun_otranslation = -1;
static int sun_odirect = -1;
+int sun_ktype;
int
xf86GetKbdLeds()
@@ -53,7 +54,7 @@ xf86SetKbdRepeat(char rad)
void
xf86KbdInit()
{
- int ktype, klayout;
+ int klayout;
if (xf86Info.kbdFd < 0) {
xf86Info.kbdFd = open("/dev/kbd", O_RDWR|O_NONBLOCK);
@@ -66,7 +67,7 @@ xf86KbdInit()
* broken (IMO) - DWH 8/21/99
*/
- if (ioctl(xf86Info.kbdFd, KIOCTYPE, &ktype) < 0)
+ if (ioctl(xf86Info.kbdFd, KIOCTYPE, &sun_ktype) < 0)
FatalError("Unable to determine keyboard type: %d\n", errno);
if (ioctl(xf86Info.kbdFd, KIOCLAYOUT, &klayout) < 0)
diff --git a/hw/xfree86/os-support/solaris/sun_kbdEv.c b/hw/xfree86/os-support/solaris/sun_kbdEv.c
index ff4ef3288..f6481af29 100644
--- a/hw/xfree86/os-support/solaris/sun_kbdEv.c
+++ b/hw/xfree86/os-support/solaris/sun_kbdEv.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c,v 1.4 2001/11/08 04:15:33 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c,v 1.6 2003/10/09 11:44:00 pascal Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
* Copyright 1993 by David Dawes <dawes@xfree86.org>
@@ -41,8 +41,11 @@
#endif
#include <sys/vuid_event.h>
+#include <sys/kbd.h>
#include "atKeynames.h"
+extern int sun_ktype;
+
#ifdef XKB
extern Bool noXkbExtension;
#endif
@@ -105,7 +108,7 @@ static OsTimerPtr sunTimer = NULL;
* type.
*/
static unsigned char map[256] = {
-#if defined(i368) || defined(__i386) || defined(__i386__)
+#if defined(i386) || defined(__i386) || defined(__i386__)
KEY_NOTUSED, /* 0 */
KEY_Tilde, /* 1 */
KEY_1, /* 2 */
@@ -374,6 +377,248 @@ static unsigned char map[256] = {
/* The rest default to KEY_UNKNOWN */
};
+#if defined(KB_USB)
+static unsigned char usbmap[256] = {
+/*
+ * partially taken from ../bsd/bsd_KbdMap.c
+ *
+ * added keycodes for Sun special keys (left function keys, audio control)
+ */
+ /* 0 */ KEY_NOTUSED,
+ /* 1 */ KEY_NOTUSED,
+ /* 2 */ KEY_NOTUSED,
+ /* 3 */ KEY_NOTUSED,
+ /* 4 */ KEY_A,
+ /* 5 */ KEY_B,
+ /* 6 */ KEY_C,
+ /* 7 */ KEY_D,
+ /* 8 */ KEY_E,
+ /* 9 */ KEY_F,
+ /* 10 */ KEY_G,
+ /* 11 */ KEY_H,
+ /* 12 */ KEY_I,
+ /* 13 */ KEY_J,
+ /* 14 */ KEY_K,
+ /* 15 */ KEY_L,
+ /* 16 */ KEY_M,
+ /* 17 */ KEY_N,
+ /* 18 */ KEY_O,
+ /* 19 */ KEY_P,
+ /* 20 */ KEY_Q,
+ /* 21 */ KEY_R,
+ /* 22 */ KEY_S,
+ /* 23 */ KEY_T,
+ /* 24 */ KEY_U,
+ /* 25 */ KEY_V,
+ /* 26 */ KEY_W,
+ /* 27 */ KEY_X,
+ /* 28 */ KEY_Y,
+ /* 29 */ KEY_Z,
+ /* 30 */ KEY_1, /* 1 !*/
+ /* 31 */ KEY_2, /* 2 @ */
+ /* 32 */ KEY_3, /* 3 # */
+ /* 33 */ KEY_4, /* 4 $ */
+ /* 34 */ KEY_5, /* 5 % */
+ /* 35 */ KEY_6, /* 6 ^ */
+ /* 36 */ KEY_7, /* 7 & */
+ /* 37 */ KEY_8, /* 8 * */
+ /* 38 */ KEY_9, /* 9 ( */
+ /* 39 */ KEY_0, /* 0 ) */
+ /* 40 */ KEY_Enter, /* Return */
+ /* 41 */ KEY_Escape, /* Escape */
+ /* 42 */ KEY_BackSpace, /* Backspace Delete */
+ /* 43 */ KEY_Tab, /* Tab */
+ /* 44 */ KEY_Space, /* Space */
+ /* 45 */ KEY_Minus, /* - _ */
+ /* 46 */ KEY_Equal, /* = + */
+ /* 47 */ KEY_LBrace, /* [ { */
+ /* 48 */ KEY_RBrace, /* ] } */
+ /* 49 */ KEY_BSlash, /* \ | */
+ /* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */
+ /* 51 */ KEY_SemiColon, /* ; : */
+ /* 52 */ KEY_Quote, /* ' " */
+ /* 53 */ KEY_Tilde, /* ` ~ */
+ /* 54 */ KEY_Comma, /* , < */
+ /* 55 */ KEY_Period, /* . > */
+ /* 56 */ KEY_Slash, /* / ? */
+ /* 57 */ KEY_CapsLock, /* Caps Lock */
+ /* 58 */ KEY_F1, /* F1 */
+ /* 59 */ KEY_F2, /* F2 */
+ /* 60 */ KEY_F3, /* F3 */
+ /* 61 */ KEY_F4, /* F4 */
+ /* 62 */ KEY_F5, /* F5 */
+ /* 63 */ KEY_F6, /* F6 */
+ /* 64 */ KEY_F7, /* F7 */
+ /* 65 */ KEY_F8, /* F8 */
+ /* 66 */ KEY_F9, /* F9 */
+ /* 67 */ KEY_F10, /* F10 */
+ /* 68 */ KEY_F11, /* F11 */
+ /* 69 */ KEY_F12, /* F12 */
+ /* 70 */ KEY_Print, /* PrintScrn SysReq */
+ /* 71 */ KEY_ScrollLock, /* Scroll Lock */
+ /* 72 */ KEY_Pause, /* Pause Break */
+ /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
+ /* 74 */ KEY_Home, /* Home */
+ /* 75 */ KEY_PgUp, /* Page Up */
+ /* 76 */ KEY_Delete, /* Delete */
+ /* 77 */ KEY_End, /* End */
+ /* 78 */ KEY_PgDown, /* Page Down */
+ /* 79 */ KEY_Right, /* Right Arrow */
+ /* 80 */ KEY_Left, /* Left Arrow */
+ /* 81 */ KEY_Down, /* Down Arrow */
+ /* 82 */ KEY_Up, /* Up Arrow */
+ /* 83 */ KEY_NumLock, /* Num Lock */
+ /* 84 */ KEY_KP_Divide, /* Keypad / */
+ /* 85 */ KEY_KP_Multiply, /* Keypad * */
+ /* 86 */ KEY_KP_Minus, /* Keypad - */
+ /* 87 */ KEY_KP_Plus, /* Keypad + */
+ /* 88 */ KEY_KP_Enter, /* Keypad Enter */
+ /* 89 */ KEY_KP_1, /* Keypad 1 End */
+ /* 90 */ KEY_KP_2, /* Keypad 2 Down */
+ /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
+ /* 92 */ KEY_KP_4, /* Keypad 4 Left */
+ /* 93 */ KEY_KP_5, /* Keypad 5 */
+ /* 94 */ KEY_KP_6, /* Keypad 6 */
+ /* 95 */ KEY_KP_7, /* Keypad 7 Home */
+ /* 96 */ KEY_KP_8, /* Keypad 8 Up */
+ /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
+ /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
+ /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
+ /* 100 */ KEY_Less, /* < > on some keyboards */
+ /* 101 */ KEY_Menu, /* Menu */
+ /* 102 */ KEY_Power, /* Sun: Power */
+ /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
+ /* 104 */ KEY_NOTUSED,
+ /* 105 */ KEY_NOTUSED,
+ /* 106 */ KEY_NOTUSED,
+ /* 107 */ KEY_NOTUSED,
+ /* 108 */ KEY_NOTUSED,
+ /* 109 */ KEY_NOTUSED,
+ /* 110 */ KEY_NOTUSED,
+ /* 111 */ KEY_NOTUSED,
+ /* 112 */ KEY_NOTUSED,
+ /* 113 */ KEY_NOTUSED,
+ /* 114 */ KEY_NOTUSED,
+ /* 115 */ KEY_NOTUSED,
+ /* 116 */ KEY_L7, /* Sun: Open */
+ /* 117 */ KEY_Help, /* Sun: Help */
+ /* 118 */ KEY_L3, /* Sun: Props */
+ /* 119 */ KEY_L5, /* Sun: Front */
+ /* 120 */ KEY_L1, /* Sun: Stop */
+ /* 121 */ KEY_L2, /* Sun: Again */
+ /* 122 */ KEY_L4, /* Sun: Undo */
+ /* 123 */ KEY_L10, /* Sun: Cut */
+ /* 124 */ KEY_L6, /* Sun: Copy */
+ /* 125 */ KEY_L8, /* Sun: Paste */
+ /* 126 */ KEY_L9, /* Sun: Find */
+ /* 127 */ KEY_Mute, /* Sun: AudioMute */
+ /* 128 */ KEY_AudioRaise, /* Sun: AudioRaise */
+ /* 129 */ KEY_AudioLower, /* Sun: AudioLower */
+ /* 130 */ KEY_NOTUSED,
+ /* 131 */ KEY_NOTUSED,
+ /* 132 */ KEY_NOTUSED,
+ /* 133 */ KEY_NOTUSED,
+ /* 134 */ KEY_NOTUSED,
+ /* 135 */ KEY_NOTUSED,
+ /* 136 */ KEY_NOTUSED,
+ /* 137 */ KEY_NOTUSED,
+ /* 138 */ KEY_NOTUSED,
+ /* 139 */ KEY_NOTUSED,
+ /* 140 */ KEY_NOTUSED,
+ /* 141 */ KEY_NOTUSED,
+ /* 142 */ KEY_NOTUSED,
+ /* 143 */ KEY_NOTUSED,
+ /* 144 */ KEY_NOTUSED,
+ /* 145 */ KEY_NOTUSED,
+ /* 146 */ KEY_NOTUSED,
+ /* 147 */ KEY_NOTUSED,
+ /* 148 */ KEY_NOTUSED,
+ /* 149 */ KEY_NOTUSED,
+ /* 150 */ KEY_NOTUSED,
+ /* 151 */ KEY_NOTUSED,
+ /* 152 */ KEY_NOTUSED,
+ /* 153 */ KEY_NOTUSED,
+ /* 154 */ KEY_NOTUSED,
+ /* 155 */ KEY_NOTUSED,
+ /* 156 */ KEY_NOTUSED,
+ /* 157 */ KEY_NOTUSED,
+ /* 158 */ KEY_NOTUSED,
+ /* 159 */ KEY_NOTUSED,
+ /* 160 */ KEY_NOTUSED,
+ /* 161 */ KEY_NOTUSED,
+ /* 162 */ KEY_NOTUSED,
+ /* 163 */ KEY_NOTUSED,
+ /* 164 */ KEY_NOTUSED,
+ /* 165 */ KEY_NOTUSED,
+ /* 166 */ KEY_NOTUSED,
+ /* 167 */ KEY_NOTUSED,
+ /* 168 */ KEY_NOTUSED,
+ /* 169 */ KEY_NOTUSED,
+ /* 170 */ KEY_NOTUSED,
+ /* 171 */ KEY_NOTUSED,
+ /* 172 */ KEY_NOTUSED,
+ /* 173 */ KEY_NOTUSED,
+ /* 174 */ KEY_NOTUSED,
+ /* 175 */ KEY_NOTUSED,
+ /* 176 */ KEY_NOTUSED,
+ /* 177 */ KEY_NOTUSED,
+ /* 178 */ KEY_NOTUSED,
+ /* 179 */ KEY_NOTUSED,
+ /* 180 */ KEY_NOTUSED,
+ /* 181 */ KEY_NOTUSED,
+ /* 182 */ KEY_NOTUSED,
+ /* 183 */ KEY_NOTUSED,
+ /* 184 */ KEY_NOTUSED,
+ /* 185 */ KEY_NOTUSED,
+ /* 186 */ KEY_NOTUSED,
+ /* 187 */ KEY_NOTUSED,
+ /* 188 */ KEY_NOTUSED,
+ /* 189 */ KEY_NOTUSED,
+ /* 190 */ KEY_NOTUSED,
+ /* 191 */ KEY_NOTUSED,
+ /* 192 */ KEY_NOTUSED,
+ /* 193 */ KEY_NOTUSED,
+ /* 194 */ KEY_NOTUSED,
+ /* 195 */ KEY_NOTUSED,
+ /* 196 */ KEY_NOTUSED,
+ /* 197 */ KEY_NOTUSED,
+ /* 198 */ KEY_NOTUSED,
+ /* 199 */ KEY_NOTUSED,
+ /* 200 */ KEY_NOTUSED,
+ /* 201 */ KEY_NOTUSED,
+ /* 202 */ KEY_NOTUSED,
+ /* 203 */ KEY_NOTUSED,
+ /* 204 */ KEY_NOTUSED,
+ /* 205 */ KEY_NOTUSED,
+ /* 206 */ KEY_NOTUSED,
+ /* 207 */ KEY_NOTUSED,
+ /* 208 */ KEY_NOTUSED,
+ /* 209 */ KEY_NOTUSED,
+ /* 210 */ KEY_NOTUSED,
+ /* 211 */ KEY_NOTUSED,
+ /* 212 */ KEY_NOTUSED,
+ /* 213 */ KEY_NOTUSED,
+ /* 214 */ KEY_NOTUSED,
+ /* 215 */ KEY_NOTUSED,
+ /* 216 */ KEY_NOTUSED,
+ /* 217 */ KEY_NOTUSED,
+ /* 218 */ KEY_NOTUSED,
+ /* 219 */ KEY_NOTUSED,
+ /* 220 */ KEY_NOTUSED,
+ /* 221 */ KEY_NOTUSED,
+ /* 222 */ KEY_NOTUSED,
+ /* 223 */ KEY_NOTUSED,
+ /* 224 */ KEY_LCtrl, /* Left Control */
+ /* 225 */ KEY_ShiftL, /* Left Shift */
+ /* 226 */ KEY_Alt, /* Left Alt */
+ /* 227 */ KEY_LMeta, /* Left Meta */
+ /* 228 */ KEY_RCtrl, /* Right Control */
+ /* 229 */ KEY_ShiftR, /* Right Shift */
+ /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
+ /* 231 */ KEY_RMeta, /* Right Meta */
+};
+
+#endif /* KB_USB */
/*
* sunPostKbdEvent --
* Translate the raw hardware Firm_event into an XEvent, and tell DIX
@@ -404,7 +649,12 @@ sunPostKbdEvent(Firm_event *event)
* and now get some special keysequences
*/
- keycode = map[event->id];
+#if defined(KB_USB)
+ if(sun_ktype == KB_USB)
+ keycode = usbmap[event->id];
+ else
+#endif
+ keycode = map[event->id];
if ((ModifierDown(ControlMask | AltMask)) ||
(ModifierDown(ControlMask | AltLangMask)))
diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c
index ab604e95a..c0460f524 100644
--- a/hw/xfree86/os-support/sysv/sysv_video.c
+++ b/hw/xfree86/os-support/sysv/sysv_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.20 2000/10/28 01:42:29 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.21 2003/03/14 13:46:08 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -144,13 +144,16 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
int fd;
#if defined(SVR4)
- if ((fd = open(DEV_MEM, O_RDWR)) < 0)
+ 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, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, (off_t)Base);
+ 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)
{
diff --git a/hw/xfree86/os-support/xf86OSKbd.h b/hw/xfree86/os-support/xf86OSKbd.h
index e63d7759c..917b11526 100644
--- a/hw/xfree86/os-support/xf86OSKbd.h
+++ b/hw/xfree86/os-support/xf86OSKbd.h
@@ -1,7 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h,v 1.3 2003/02/17 15:11:55 dawes Exp $ */
-
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h,v 1.6 2003/11/03 05:11:51 tsi Exp $ */
/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
+ * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ *
* Author: Ivan Pascal.
*/
@@ -81,7 +104,7 @@ typedef enum {
PROT_XQUEUE,
PROT_WSCONS,
PROT_USB,
- PROT_UNKNOWN
+ PROT_UNKNOWN_KBD
} KbdProtocolId;
typedef struct {
@@ -90,3 +113,21 @@ typedef struct {
} KbdProtocolRec;
Bool xf86OSKbdPreInit(InputInfoPtr pInfo);
+
+/* Adjust this when the kbd interface changes. */
+
+/*
+ * History:
+ *
+ * 1.0.0 - Initial version.
+ */
+
+#define OS_KBD_VERSION_MAJOR 1
+#define OS_KBD_VERSION_MINOR 0
+#define OS_KBD_VERSION_PATCH 0
+
+#define OS_KBD_VERSION_CURRENT \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(OS_KBD_VERSION_MAJOR, \
+ OS_KBD_VERSION_MINOR, \
+ OS_KBD_VERSION_PATCH)
+
diff --git a/hw/xfree86/os-support/xf86OSmouse.h b/hw/xfree86/os-support/xf86OSmouse.h
index a4486b987..ee6313a3b 100644
--- a/hw/xfree86/os-support/xf86OSmouse.h
+++ b/hw/xfree86/os-support/xf86OSmouse.h
@@ -1,7 +1,29 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.20 2002/12/17 20:55:23 dawes Exp $ */
-
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.24 2003/11/03 05:11:51 tsi Exp $ */
/*
- * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
/* Public interface to OS-specific mouse support. */
@@ -22,6 +44,36 @@
* specific protocol names that are
* supported for this class. */
+/* Mouse Protocol IDs. */
+typedef enum {
+ PROT_UNKNOWN = -2,
+ PROT_UNSUP = -1, /* protocol is not supported */
+ PROT_MS = 0,
+ PROT_MSC,
+ PROT_MM,
+ PROT_LOGI,
+ PROT_LOGIMAN,
+ PROT_MMHIT,
+ PROT_GLIDE,
+ PROT_IMSERIAL,
+ PROT_THINKING,
+ PROT_ACECAD,
+ PROT_VALUMOUSESCROLL,
+ PROT_PS2,
+ PROT_GENPS2,
+ PROT_IMPS2,
+ PROT_EXPPS2,
+ PROT_THINKPS2,
+ PROT_MMPS2,
+ PROT_GLIDEPS2,
+ PROT_NETPS2,
+ PROT_NETSCPS2,
+ PROT_BM,
+ PROT_AUTO,
+ PROT_SYSMOUSE,
+ PROT_NUMPROTOS /* This must always be last. */
+} MouseProtocolID;
+
struct _MouseDevRec;
typedef int (*GetInterfaceTypesProc)(void);
@@ -33,10 +85,9 @@ typedef const char *(*DefaultProtocolProc)(void);
typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
int res);
-typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
-typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
-typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
-typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
+typedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol,
+ int flags);
+typedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags);
/*
* OSMouseInfoRec is used to pass information from the OSMouse layer to the
@@ -52,6 +103,8 @@ typedef struct {
SetResProc SetPS2Res;
SetResProc SetBMRes;
SetResProc SetMiscRes;
+ FindDeviceProc FindDevice;
+ GuessProtocolProc GuessProtocol;
} OSMouseInfoRec, *OSMouseInfoPtr;
/*
@@ -78,7 +131,11 @@ typedef struct {
* auto-detection. It returns the name of the detected protocol,
* or NULL when detection fails. It may also adjust one or more
* of the "protoPara" values for the detected protocol by setting
- * then to something other than -1.
+ * then to something other than -1. SetupAuto gets called in two
+ * ways. The first is before any devices have been opened. This
+ * can be used when the protocol "Auto" always maps to a single
+ * protocol type. The second is with the device open, allowing
+ * OS-specific probing to be done.
*
* SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
* protocol types.
@@ -86,15 +143,62 @@ typedef struct {
* SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
*
* SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
+ *
+ * FindDevice: This function gets called when no Device has been specified
+ * in the config file. OS-specific methods may be used to guess
+ * which input device to use. This function is called after the
+ * pre-open attempts at protocol discovery are done, but before
+ * the device is open. I.e., after the first SetupAuto() call,
+ * after the DefaultProtocol() call, but before the PreInit()
+ * call. Available protocol information may be used in locating
+ * the default input device.
+ *
+ * GuessProtocol: A last resort attempt at guessing the mouse protocol by
+ * whatever OS-specific means might be available. OS-independent
+ * things should be in the mouse driver. This function gets
+ * called after the mouse driver's OS-independent methods have
+ * failed.
*/
extern OSMouseInfoPtr xf86OSMouseInit(int flags);
+/* Adjust this when the mouse interface changes. */
+
+/*
+ * History:
+ *
+ * 1.0.0 - Everything up to when versioning was started.
+ * 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec
+ *
+ */
+
+#define OS_MOUSE_VERSION_MAJOR 1
+#define OS_MOUSE_VERSION_MINOR 1
+#define OS_MOUSE_VERSION_PATCH 0
+
+#define OS_MOUSE_VERSION_CURRENT \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(OS_MOUSE_VERSION_MAJOR, \
+ OS_MOUSE_VERSION_MINOR, \
+ OS_MOUSE_VERSION_PATCH)
+
+#define HAVE_GUESS_PROTOCOL \
+ (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
+
+#define HAVE_FIND_DEVICE \
+ (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
+
/*
* Mouse device record. This is shared by the mouse driver and the OSMouse
* layer.
*/
+typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
+typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
+typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
+typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
+
typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
int dx, int dy, int dz, int dw);
typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
@@ -106,8 +210,8 @@ typedef struct _MouseDevRec {
DeviceIntPtr device;
const char * mseDevice;
const char * protocol;
- int protocolID;
- int oldProtocolID; /* hack */
+ MouseProtocolID protocolID;
+ MouseProtocolID oldProtocolID; /* hack */
int class;
int mseModel;
int baudRate;
diff --git a/hw/xfree86/os-support/xf86OSpriv.h b/hw/xfree86/os-support/xf86OSpriv.h
index c3224aeeb..865738c40 100644
--- a/hw/xfree86/os-support/xf86OSpriv.h
+++ b/hw/xfree86/os-support/xf86OSpriv.h
@@ -1,4 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h,v 1.5 2000/10/28 01:42:24 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h,v 1.6 2003/08/24 17:37:03 dawes Exp $ */
+/*
+ * Copyright (c) 1999-2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
#ifndef _XF86OSPRIV_H
#define _XF86OSPRIV_H
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index b35186724..4d3205eb4 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.90 2002/05/31 18:46:00 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.95 2003/11/17 22:20:40 dawes Exp $ */
/*
* Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1992 by David Dawes <dawes@XFree86.org>
@@ -10,7 +10,7 @@
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
* Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
* Copyright 1997 by Takis Psarogiannakopoulos <takis@dpmms.cam.ac.uk>
- * Copyright 1994-1998 by The XFree86 Project, Inc
+ * Copyright 1994-2003 by The XFree86 Project, Inc
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -92,10 +92,6 @@ extern int xf86getpagesize(void);
extern int xf86GetErrno(void);
typedef unsigned long xf86size_t;
typedef signed long xf86ssize_t;
-#ifdef NEED_SNPRINTF
-extern int snprintf(char *str, size_t size, const char *format, ...);
-extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
-#endif
#endif
#include <stdio.h>
@@ -106,7 +102,7 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
/* SYSV386 (SVR3, SVR4) - But not Solaris8 */
/**************************************************************************/
#if (defined(SYSV) || defined(SVR4)) && \
- !defined(DGUX) && \
+ !defined(DGUX) && !defined(sgi) && \
!defined(__SOL8__) && \
(!defined(sun) || defined(i386))
# ifdef SCO325
@@ -180,11 +176,11 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
# if defined(SCO)
# include <sys/vtkd.h>
# include <sys/console.h>
-# include <sys/keyboard.h>
+# include <sys/scankbd.h>
# include <sys/vid.h>
-# define LED_CAP 0x01
-# define LED_NUM 0x02
-# define LED_SCR 0x04
+# define LED_CAP CLKED
+# define LED_NUM NLKED
+# define LED_SCR SLKED
# elif defined(HAS_USL_VTS)
# include <sys/at_ansi.h>
# include <sys/kd.h>
@@ -675,6 +671,17 @@ extern char* __XOS2RedirRoot(char*);
#endif /* __GNU__ */
/**************************************************************************/
+/* IRIX */
+/**************************************************************************/
+#if defined(sgi)
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#endif
+
+/**************************************************************************/
/* Generic */
/**************************************************************************/
@@ -721,9 +728,7 @@ extern int sys_nerr;
#if defined(ISC) || defined(Lynx)
#define rint(x) RInt(x)
double RInt(
-#if NeedFunctionPrototypes
double x
-#endif
);
#endif
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index 4f067d5e0..09d3f2861 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -8,7 +8,7 @@
* Copyright 1993 by Vrije Universiteit, The Netherlands
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
* Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
- * Copyright 1994-1999 by The XFree86 Project, Inc
+ * Copyright 1994-2003 by The XFree86 Project, Inc
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -64,7 +64,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.55 2002/01/25 21:56:17 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.57 2003/10/07 23:14:54 herrb Exp $ */
#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H
@@ -125,6 +125,7 @@ extern void xf86WrapperInit(void);
#define xf86FatalError(a, b) \
if (dispatchException & DE_TERMINATE) { \
ErrorF(a, b); \
+ ErrorF("\n"); \
return; \
} else FatalError(a, b)
diff --git a/hw/xfree86/os-support/xf86_ansic.h b/hw/xfree86/os-support/xf86_ansic.h
index 03fa33417..733a5543d 100644
--- a/hw/xfree86/os-support/xf86_ansic.h
+++ b/hw/xfree86/os-support/xf86_ansic.h
@@ -1,5 +1,6 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.53 2003/10/28 18:36:37 tsi Exp $ */
/*
- * Copyright 1997-2000 by The XFree86 Project, Inc
+ * Copyright 1997-2003 by The XFree86 Project, Inc
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -22,8 +23,6 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.49.2.1 2003/03/13 04:10:49 tsi Exp $ */
-
#ifndef _XF86_ANSIC_H
#define _XF86_ANSIC_H
@@ -240,6 +239,8 @@ extern int xf86strcasecmp(const char*,const char*);
extern char* xf86strcpy(char*,const char*);
extern xf86size_t xf86strcspn(const char*,const char*);
extern char* xf86strerror(int);
+extern xf86size_t xf86strlcat(char*,const char*,xf86size_t);
+extern xf86size_t xf86strlcpy(char*,const char*,xf86size_t);
extern xf86size_t xf86strlen(const char*);
extern char* xf86strncat(char *, const char *, xf86size_t);
extern int xf86strncmp(const char*,const char*,xf86size_t);
diff --git a/hw/xfree86/os-support/xf86_libc.h b/hw/xfree86/os-support/xf86_libc.h
index b97599ed5..61eb93d8b 100644
--- a/hw/xfree86/os-support/xf86_libc.h
+++ b/hw/xfree86/os-support/xf86_libc.h
@@ -1,6 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.56 2003/02/22 06:00:39 dawes Exp $ */
-
-
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.60 2003/10/26 12:17:17 herrb Exp $ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
/*
* This file is an attempt to make developing code for the new loadable module
@@ -71,7 +95,11 @@ struct xf86stat {
typedef int xf86key_t;
/* setjmp/longjmp */
+#if defined(__ia64__)
+typedef int xf86jmp_buf[1024] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
+#else
typedef int xf86jmp_buf[1024];
+#endif
/* for setvbuf */
#define XF86_IONBF 1
@@ -348,6 +376,10 @@ typedef int xf86jmp_buf[1024];
#define strcspn(ccp1,ccp2) xf86strcspn(ccp1,ccp2)
#undef strerror
#define strerror(i) xf86strerror(i)
+#undef strlcat
+#define strlcat(cp,ccp,I) xf86strlcat(cp,ccp,I)
+#undef strlcpy
+#define strlcpy(cp,ccp,I) xf86strlcpy(cp,ccp,I)
#undef strlen
#define strlen(ccp) xf86strlen(ccp)
#undef strncmp
@@ -385,11 +417,11 @@ typedef int xf86jmp_buf[1024];
#undef ungetc
#define ungetc(i,FP) xf86ungetc(i,FP)
#undef vfprinf
-#define vfprintf xf86vfprintf
+#define vfprintf(p,f,a) xf86vfprintf(p,f,a)
#undef vsnprintf
-#define vsnprintf xf86vsnprintf
+#define vsnprintf(s,n,f,a) xf86vsnprintf(s,n,f,a)
#undef vsprintf
-#define vsprintf xf86vsprintf
+#define vsprintf(s,f,a) xf86vsprintf(s,f,a)
/* XXX Disable assert as if NDEBUG was defined */
/* Some X headers defined this away too */
#undef assert