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/bsd/bsd_mouse.c2
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c114
-rw-r--r--hw/xfree86/os-support/bus/Pci.c3
-rw-r--r--hw/xfree86/os-support/bus/Pci.h6
-rw-r--r--hw/xfree86/os-support/bus/ix86Pci.c15
-rw-r--r--hw/xfree86/os-support/bus/linuxPci.c22
-rw-r--r--hw/xfree86/os-support/drm/drmmodule.c2
-rw-r--r--hw/xfree86/os-support/linux/int10/linux.c26
-rw-r--r--hw/xfree86/os-support/linux/lnx_ia64.c45
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c2
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c1
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.c1
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c2
-rw-r--r--hw/xfree86/os-support/shared/ia64Pci.c81
-rw-r--r--hw/xfree86/os-support/shared/ia64Pci.h41
-rw-r--r--hw/xfree86/os-support/shared/libc_wrapper.c48
-rw-r--r--hw/xfree86/os-support/shared/sigio.c12
-rw-r--r--hw/xfree86/os-support/shared/sigiostubs.c3
-rw-r--r--hw/xfree86/os-support/solaris/sun_init.c19
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.c20
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbdEv.c16
-rw-r--r--hw/xfree86/os-support/solaris/sun_mouse.c243
-rw-r--r--hw/xfree86/os-support/xf86OSmouse.h4
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h4
-rw-r--r--hw/xfree86/os-support/xf86_libc.h2
25 files changed, 672 insertions, 62 deletions
diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c
index bb5936a1e..679f3099a 100644
--- a/hw/xfree86/os-support/bsd/bsd_mouse.c
+++ b/hw/xfree86/os-support/bsd/bsd_mouse.c
@@ -430,6 +430,7 @@ wsconsReadInput(InputInfoPtr pInfo)
default:
xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name,
event->type);
+ ++event;
continue;
}
@@ -472,6 +473,7 @@ wsconsPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
/* Setup the local input proc. */
pInfo->read_input = wsconsReadInput;
+ pMse->xisbscale = sizeof(struct wscons_event);
pInfo->flags |= XI86_CONFIGURED;
return TRUE;
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 3c55ee72f..62d063655 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -46,6 +46,11 @@
#include <sys/queue.h>
#endif
+#if defined(__OpenBSD__) && defined(__amd64__)
+#include <machine/mtrr.h>
+#include <machine/sysarch.h>
+#endif
+
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -94,7 +99,11 @@ static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
MessageType);
static void NetBSDundoWC(int, pointer);
#endif
-
+#if defined(__amd64__) && defined(__OpenBSD__)
+static pointer amd64setWC(int, unsigned long, unsigned long, Bool,
+ MessageType);
+static void amd64undoWC(int, pointer);
+#endif
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
@@ -206,6 +215,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pVidMem->setWC = NetBSDsetWC;
pVidMem->undoWC = NetBSDundoWC;
#endif
+#if defined(__amd64__) && defined(__OpenBSD__)
+ pVidMem->setWC = amd64setWC;
+ pVidMem->undoWC = amd64undoWC;
+#endif
pVidMem->initialised = TRUE;
}
@@ -311,7 +324,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(Len);
}
-
#ifdef USE_I386_IOPL
/***************************************************************************/
/* I/O Permissions section */
@@ -354,6 +366,51 @@ xf86DisableIO()
#endif /* USE_I386_IOPL */
+#ifdef USE_AMD64_IOPL
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+static Bool ExtendedEnabled = FALSE;
+
+void
+xf86EnableIO()
+{
+ if (ExtendedEnabled)
+ return;
+
+ if (amd64_iopl(TRUE) < 0)
+ {
+#ifndef __OpenBSD__
+ FatalError("%s: Failed to set IOPL for extended I/O",
+ "xf86EnableIO");
+#else
+ FatalError("%s: Failed to set IOPL for extended I/O\n%s",
+ "xf86EnableIO", SYSCTL_MSG);
+#endif
+ }
+ ExtendedEnabled = TRUE;
+
+ return;
+}
+
+void
+xf86DisableIO()
+{
+ if (!ExtendedEnabled)
+ return;
+
+ if (amd64_iopl(FALSE) == 0) {
+ ExtendedEnabled = FALSE;
+ }
+ /* Otherwise, the X server has revoqued its root uid,
+ and thus cannot give up IO privileges any more */
+
+ return;
+}
+
+#endif /* USE_AMD64_IOPL */
+
#ifdef USE_DEV_IO
static int IoFd = -1;
@@ -471,7 +528,6 @@ xf86SetRGBOut()
}
#endif
-
#ifdef HAS_MTRR_SUPPORT
/* memory range (MTRR) support for FreeBSD */
@@ -879,3 +935,55 @@ NetBSDundoWC(int screenNum, pointer list)
xfree(mtrrp);
}
#endif
+
+#if defined(__OpenBSD__) && defined(__amd64__)
+static pointer
+amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ struct mtrr *mtrrp;
+ int n;
+
+ xf86DrvMsg(screenNum, X_WARNING,
+ "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
+ base, (base + size));
+
+ mtrrp = xnfalloc(sizeof (struct mtrr));
+ mtrrp->base = base;
+ mtrrp->len = size;
+ mtrrp->type = MTRR_TYPE_WC;
+
+ /*
+ * MTRR_PRIVATE will make this MTRR get reset automatically
+ * if this process exits, so we have no need for an explicit
+ * cleanup operation when starting a new server.
+ */
+
+ if (enable)
+ mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
+ else
+ mtrrp->flags = 0;
+ n = 1;
+
+ if (amd64_set_mtrr(mtrrp, &n) < 0) {
+ xfree(mtrrp);
+ return NULL;
+ }
+ return mtrrp;
+}
+
+static void
+amd64undoWC(int screenNum, pointer list)
+{
+ struct mtrr *mtrrp = (struct mtrr *)list;
+ int n;
+
+ if (mtrrp == NULL)
+ return;
+ n = 1;
+ mtrrp->flags &= ~MTRR_VALID;
+ amd64_set_mtrr(mtrrp, &n);
+ xfree(mtrrp);
+}
+#endif /* OpenBSD/amd64 */
+
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index 6b36fdaf2..ffa906505 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -1203,7 +1203,8 @@ handlePciBIOS(PCITAG Tag, int basereg,
if ((xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) !=
sizeof(tmp)) ||
(tmp[0] != 0x55) || (tmp[1] != 0xaa) || !tmp[2] ) {
- /* Restore the base register if it was changed. */
+ /* Restore the base registers if they were changed. */
+ pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave);
if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2),
(CARD32) savebase);
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index b0c767d5c..3e965265b 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -112,7 +112,7 @@
/*
* Global Definitions
*/
-#define MAX_PCI_DEVICES 64 /* Max number of devices accomodated */
+#define MAX_PCI_DEVICES 128 /* Max number of devices accomodated */
/* by xf86scanpci */
#if defined(sun) && defined(SVR4) && defined(sparc)
# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
@@ -280,7 +280,7 @@
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined(__powerpc64__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
@@ -312,7 +312,7 @@
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
-#elif defined(__sparc__)
+#elif defined(__sparc__) || defined(sparc)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c
index b135d0b73..da1aa7d2f 100644
--- a/hw/xfree86/os-support/bus/ix86Pci.c
+++ b/hw/xfree86/os-support/bus/ix86Pci.c
@@ -272,10 +272,16 @@ void ix86PciSelectCfgmech(void)
*/
switch (xf86Info.pciFlags) {
- case PCIProbe1: /* { */
+ case PCIOsConfig:
+#if ARCH_PCI_OS_INIT
+ return;
+#endif
+
+ case PCIProbe1:
- xf86MsgVerb(X_INFO, 2, "PCI: Probing config type using method 1\n");
- oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG);
+ xf86MsgVerb(X_INFO, 2,
+ "PCI: Probing config type using method 1\n");
+ oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG);
#ifdef DEBUGPCI
if (xf86Verbose > 2) {
@@ -492,9 +498,6 @@ void ix86PciSelectCfgmech(void)
ix86Pci0.funcs = &ix86Funcs2;
return;
- case PCIOsConfig:
- return;
-
case PCIForceNone:
break;
}
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 4846ee0ed..6e33c2550 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -104,6 +104,7 @@ linuxPciOpenFile(PCITAG tag)
static int lbus,ldev,lfunc,fd = -1;
int bus, dev, func;
char file[32];
+ struct stat ignored;
bus = PCI_BUS_FROM_TAG(tag);
dev = PCI_DEV_FROM_TAG(tag);
@@ -111,12 +112,21 @@ linuxPciOpenFile(PCITAG tag)
if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
if (fd != -1)
close(fd);
- if (bus < 256)
- sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
- bus, dev, func);
+ if (bus < 256) {
+ if (stat("/proc/bus/pci/00", &ignored) < 0)
+ sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
+ bus, dev, func);
+ else
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ bus, dev, func);
+ } else {
+ if (stat("/proc/bus/pci/00", &ignored) < 0)
+ sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
+ bus, dev, func);
+ else
+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
+ bus, dev, func);
+ }
fd = open(file,O_RDWR);
lbus = bus;
ldev = dev;
diff --git a/hw/xfree86/os-support/drm/drmmodule.c b/hw/xfree86/os-support/drm/drmmodule.c
index 8192e97eb..2fb082c36 100644
--- a/hw/xfree86/os-support/drm/drmmodule.c
+++ b/hw/xfree86/os-support/drm/drmmodule.c
@@ -39,7 +39,7 @@ static XF86ModuleVersionInfo VersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XF86_VERSION_CURRENT,
+ XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_EXTENSION,
ABI_EXTENSION_VERSION,
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 984c79122..b01004931 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -172,6 +172,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
if (errno == ENOSYS)
xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
" your kernel to include System V IPC support\n");
+ else
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(highmem) error: %s\n",strerror(errno));
goto error1;
}
} else {
@@ -198,16 +201,27 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
ErrorF("Mapping 640kB area\n");
#endif
if ((low_mem = shmget(counter++, V_RAM,
- IPC_CREAT | SHM_R | SHM_W)) == -1)
+ IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(lowmem) error: %s\n",strerror(errno));
goto error2;
+ }
((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
base = shmat(low_mem, 0, 0);
- if (base == SHMERRORPTR) goto error4;
+ if (base == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(low_mem) error: %s\n",strerror(errno));
+ goto error3;
+ }
((linuxInt10Priv *)pInt->private)->base = base;
if (high_mem > -1) {
base_high = shmat(high_mem, 0, 0);
- if (base_high == SHMERRORPTR) goto error4;
+ if (base_high == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(high_mem) error: %s\n",strerror(errno));
+ goto error3;
+ }
((linuxInt10Priv*)pInt->private)->base_high = base_high;
} else
((linuxInt10Priv*)pInt->private)->base_high = NULL;
@@ -388,8 +402,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
xfree(options);
return pInt;
-error4:
- xf86DrvMsg(screen, X_ERROR, "shmat() call returned errno %d\n", errno);
error3:
if (base_high)
shmdt(base_high);
@@ -429,6 +441,8 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
if (addr == SHMERRORPTR) {
xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmat(low_mem) error: %s\n",strerror(errno));
return FALSE;
}
@@ -438,6 +452,8 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
if (addr == SHMERRORPTR) {
xf86DrvMsg(pInt->scrnIndex, X_ERROR,
"Cannot shmat() high memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmget error: %s\n",strerror(errno));
return FALSE;
}
} else {
diff --git a/hw/xfree86/os-support/linux/lnx_ia64.c b/hw/xfree86/os-support/linux/lnx_ia64.c
new file mode 100644
index 000000000..8d0976a36
--- /dev/null
+++ b/hw/xfree86/os-support/linux/lnx_ia64.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004, Egbert Eich
+ *
+ * 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
+ * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+ * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Egbert Eich shall not
+ * be used in advertising or otherwise to promote the sale, use or other deal-
+ *ings in this Software without prior written authorization from Egbert Eich.
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ia64Pci.h"
+#include "Pci.h"
+
+#if defined OS_PROBE_PCI_CHIPSET
+IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags)
+{
+ struct stat unused;
+
+ if (!stat("/proc/bus/mckinley/zx1",&unused)
+ || !stat("/proc/bus/mckinley/zx2",&unused))
+ return ZX1_CHIPSET;
+
+ return NONE_CHIPSET;
+}
+#endif
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 5564f5ab9..da7c0a043 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 1.1.4.2.4.2 2004/03/04 20:16:46 kaleb Exp $ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 1.2 2004/04/23 19:54:08 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c
index 89afc8d64..dda1ff8ef 100644
--- a/hw/xfree86/os-support/linux/lnx_io.c
+++ b/hw/xfree86/os-support/linux/lnx_io.c
@@ -1,5 +1,4 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.25 2003/08/19 17:32:34 tsi Exp $ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 1.1.4.2.6.2 2004/03/04 17:48:09 eich Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Dawes <dawes@xfree86.org>
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c
index ab75fce09..68f3af38b 100644
--- a/hw/xfree86/os-support/linux/lnx_kbd.c
+++ b/hw/xfree86/os-support/linux/lnx_kbd.c
@@ -1,5 +1,4 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.4 2003/11/03 05:11:52 tsi Exp $ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.1.4.1.6.2 2004/03/04 17:48:09 eich Exp $ */
/*
* Copyright (c) 2002 by The XFree86 Project, Inc.
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 5144cdf3e..4cd8152df 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -450,7 +450,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
/* This requires linux-0.99.pl10 or above */
base = mmap((caddr_t)0, Size + alignOff, prot, mapflags, fd,
- (off_t)(off_t)realBase + BUS_BASE);
+ (off_t)realBase + BUS_BASE);
close(fd);
if (base == MAP_FAILED) {
FatalError("xf86MapVidMem: Could not mmap framebuffer"
diff --git a/hw/xfree86/os-support/shared/ia64Pci.c b/hw/xfree86/os-support/shared/ia64Pci.c
new file mode 100644
index 000000000..d0046a7f2
--- /dev/null
+++ b/hw/xfree86/os-support/shared/ia64Pci.c
@@ -0,0 +1,81 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ia64Pci.c,v 1.3 2003/02/23 20:26:49 tsi Exp $ */
+/*
+ * Copyright (C) 2002-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
+ * 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
+ * XFREE86 PROJECT 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 XFree86 Project 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
+ * XFree86 Project.
+ */
+
+/*
+ * This file contains the glue needed to support various IA-64 chipsets.
+ */
+
+#include "460gxPCI.h"
+#include "e8870PCI.h"
+#include "zx1PCI.h"
+#include "Pci.h"
+#include "ia64Pci.h"
+
+void
+ia64ScanPCIWrapper(scanpciWrapperOpt flags)
+{
+ static IA64Chipset chipset = NONE_CHIPSET;
+
+ if (flags == SCANPCI_INIT) {
+
+ /* PCI configuration space probes should be done first */
+ if (xorgProbe460GX(flags)) {
+ chipset = I460GX_CHIPSET;
+ xf86PreScan460GX();
+ return;
+ } else if (xorgProbeE8870(flags)) {
+ chipset = E8870_CHIPSET;
+ xf86PreScanE8870();
+ return;
+ }
+#ifdef OS_PROBE_PCI_CHIPSET
+ chipset = OS_PROBE_PCI_CHIPSET(flags);
+ switch (chipset) {
+ case ZX1_CHIPSET:
+ xf86PreScanZX1();
+ return;
+ default:
+ return;
+ }
+#endif
+ } else /* if (flags == SCANPCI_TERM) */ {
+
+ switch (chipset) {
+ case I460GX_CHIPSET:
+ xf86PostScan460GX();
+ return;
+ case E8870_CHIPSET:
+ xf86PostScanE8870();
+ return;
+ case ZX1_CHIPSET:
+ xf86PostScanZX1();
+ return;
+ default:
+ return;
+ }
+ }
+}
diff --git a/hw/xfree86/os-support/shared/ia64Pci.h b/hw/xfree86/os-support/shared/ia64Pci.h
new file mode 100644
index 000000000..1ee2fc091
--- /dev/null
+++ b/hw/xfree86/os-support/shared/ia64Pci.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004, Egbert Eich
+ *
+ * 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
+ * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+ * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Egbert Eich shall not
+ * be used in advertising or otherwise to promote the sale, use or other deal-
+ *ings in this Software without prior written authorization from Egbert Eich.
+ *
+ */
+#ifndef _IA64_PCI_H
+# define _IA64_PCI_H
+
+#include "Pci.h"
+
+typedef enum {
+ NONE_CHIPSET,
+ I460GX_CHIPSET,
+ E8870_CHIPSET,
+ ZX1_CHIPSET
+} IA64Chipset;
+
+# ifdef OS_PROBE_PCI_CHIPSET
+extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags);
+# endif
+#endif
diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
index 34f375f6c..59c08d85a 100644
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1884,7 +1884,8 @@ int
xf86shmget(xf86key_t key, int size, int xf86shmflg)
{
int shmflg;
-
+ int ret;
+
/* This copies the permissions (SHM_R, SHM_W for u, g, o). */
shmflg = xf86shmflg & 0777;
@@ -1893,14 +1894,20 @@ xf86shmget(xf86key_t key, int size, int xf86shmflg)
if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT;
if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL;
if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT;
- return shmget((key_t) key, size, shmflg);
+ ret = shmget((key_t) key, size, shmflg);
+
+ if (ret == -1)
+ xf86errno = xf86GetErrno();
+
+ return ret;
}
char *
xf86shmat(int id, char *addr, int xf86shmflg)
{
int shmflg = 0;
-
+ pointer ret;
+
#ifdef SHM_RDONLY
if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY;
#endif
@@ -1911,13 +1918,25 @@ xf86shmat(int id, char *addr, int xf86shmflg)
if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP;
#endif
- return shmat(id,addr,shmflg);
+ ret = shmat(id,addr,shmflg);
+
+ if (ret == (pointer) -1)
+ xf86errno = xf86GetErrno();
+
+ return ret;
}
int
xf86shmdt(char *addr)
{
- return shmdt(addr);
+ int ret;
+
+ ret = shmdt(addr);
+
+ if (ret == -1)
+ xf86errno = xf86GetErrno();
+
+ return ret;
}
/*
@@ -1927,7 +1946,8 @@ int
xf86shmctl(int id, int xf86cmd, pointer buf)
{
int cmd;
-
+ int ret;
+
switch (xf86cmd) {
case XF86IPC_RMID:
cmd = IPC_RMID;
@@ -1936,32 +1956,44 @@ xf86shmctl(int id, int xf86cmd, pointer buf)
return 0;
}
- return shmctl(id, cmd, buf);
+ ret = shmctl(id, cmd, buf);
+
+ if (ret == -1)
+ xf86errno = xf86GetErrno();
+
+ return ret;
}
#else
int
xf86shmget(xf86key_t key, int size, int xf86shmflg)
{
- return -1;
+ xf86errno = ENOSYS;
+ return -1;
}
char *
xf86shmat(int id, char *addr, int xf86shmflg)
{
+ xf86errno = ENOSYS;
+
return (char *)-1;
}
int
xf86shmctl(int id, int xf86cmd, pointer buf)
{
+ xf86errno = ENOSYS;
+
return -1;
}
int
xf86shmdt(char *addr)
{
+ xf86errno = ENOSYS;
+
return -1;
}
#endif /* HAVE_SYSV_IPC */
diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
index fbab2a517..7bcb93a0b 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -259,17 +259,25 @@ int
xf86BlockSIGIO (void)
{
sigset_t set, old;
-
+ int ret;
+
sigemptyset (&set);
sigaddset (&set, SIGIO);
sigprocmask (SIG_BLOCK, &set, &old);
- return sigismember (&old, SIGIO);
+ ret = sigismember (&old, SIGIO);
+#ifdef DEBUG
+ ErrorF("%i = xf86BlockSIGIO()\n",ret);
+#endif
+ return ret;
}
void
xf86UnblockSIGIO (int wasset)
{
sigset_t set;
+#ifdef DEBUG
+ ErrorF("xf86UnblockSIGIO(%i)\n",wasset);
+#endif
if (!wasset)
{
diff --git a/hw/xfree86/os-support/shared/sigiostubs.c b/hw/xfree86/os-support/shared/sigiostubs.c
index 51f98f2a4..5e08d4fbe 100644
--- a/hw/xfree86/os-support/shared/sigiostubs.c
+++ b/hw/xfree86/os-support/shared/sigiostubs.c
@@ -25,6 +25,7 @@
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c,v 1.2 2004/06/28 18:08:26 alanc Exp $ */
#ifdef XFree86Server
#ifdef __UNIXOS2__
@@ -32,10 +33,8 @@
#endif
# include "X.h"
# include "xf86.h"
-# include "xf86drm.h"
# include "xf86Priv.h"
# include "xf86_OSlib.h"
-# include "xf86drm.h"
#else
# include <unistd.h>
# include <signal.h>
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index fe8205e13..c7382e0e1 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -26,6 +26,9 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#ifdef __i386
+# include <sys/kd.h>
+#endif
static Bool KeepTty = FALSE;
static Bool Protect0 = FALSE;
@@ -34,7 +37,11 @@ static int VTnum = -1;
static int xf86StartVT = -1;
#endif
+#if defined(__SOL8__) || !defined(__i386)
+static char fb_dev[PATH_MAX] = "/dev/fb";
+#else
static char fb_dev[PATH_MAX] = "/dev/console";
+#endif
void
xf86OpenConsole(void)
@@ -162,12 +169,15 @@ xf86OpenConsole(void)
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
-
+#endif
+#ifdef __i386
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
+#endif
}
else /* serverGeneration != 1 */
{
+#ifdef HAS_USL_VTS
/*
* Now re-get the VT
*/
@@ -245,6 +255,11 @@ xf86CloseConsole(void)
#endif
+#ifdef __i386
+ /* Reset the display back to text mode */
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
+#endif
+
#ifdef HAS_USL_VTS
/*
@@ -261,8 +276,6 @@ xf86CloseConsole(void)
* Did the whole thing similarly to the way linux does it
*/
- /* Reset the display back to text mode */
- ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
{
VT.mode = VT_AUTO; /* Set default vt handling */
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.c b/hw/xfree86/os-support/solaris/sun_kbd.c
index 0213a0732..56929d69b 100644
--- a/hw/xfree86/os-support/solaris/sun_kbd.c
+++ b/hw/xfree86/os-support/solaris/sun_kbd.c
@@ -23,7 +23,9 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c,v 1.3 2004/06/13 04:50:21 alanc Exp $ */
+#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
@@ -55,6 +57,7 @@ void
xf86KbdInit()
{
int klayout;
+ const char *ktype_name;
if (xf86Info.kbdFd < 0) {
xf86Info.kbdFd = open("/dev/kbd", O_RDWR|O_NONBLOCK);
@@ -63,7 +66,7 @@ xf86KbdInit()
}
/*
- * None of the followin should ever fail. If it does, something is
+ * None of the following should ever fail. If it does, something is
* broken (IMO) - DWH 8/21/99
*/
@@ -78,6 +81,21 @@ xf86KbdInit()
if (ioctl(xf86Info.kbdFd, KIOCGDIRECT, &sun_odirect) < 0)
FatalError("Unable to determine keyboard direct setting\n");
+
+ switch (sun_ktype) {
+ case KB_SUN3:
+ ktype_name = "Sun Type 3"; break;
+ case KB_SUN4:
+ ktype_name = "Sun Type 4/5/6"; break;
+ case KB_USB:
+ ktype_name = "USB"; break;
+ case KB_PC:
+ ktype_name = "PC"; break;
+ default:
+ ktype_name = "Unknown"; break;
+ }
+ xf86Msg(X_PROBED, "Keyboard type: %s (%d)\n", ktype_name, sun_ktype);
+ xf86Msg(X_PROBED, "Keyboard layout: %d\n", klayout);
}
int
diff --git a/hw/xfree86/os-support/solaris/sun_kbdEv.c b/hw/xfree86/os-support/solaris/sun_kbdEv.c
index 30cf288ca..c8626a285 100644
--- a/hw/xfree86/os-support/solaris/sun_kbdEv.c
+++ b/hw/xfree86/os-support/solaris/sun_kbdEv.c
@@ -23,6 +23,7 @@
*/
/* [JCH-96/01/21] Extended std reverse map to four buttons. */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c,v 1.3 2004/07/28 03:57:19 alanc Exp $ */
#include "xf86.h"
#include "xf86Priv.h"
@@ -107,6 +108,11 @@ static OsTimerPtr sunTimer = NULL;
* This doesn't seem right. It probably needs to be dependent on a keyboard
* type.
*/
+
+/* Additional Sun Japanese Keyboard Keys not defined in common/atKeynames.h */
+#define KEY_Kanji 0x82
+#define KEY_Execute 0x83
+
static unsigned char map[256] = {
#if defined(i386) || defined(__i386) || defined(__i386__)
KEY_NOTUSED, /* 0 */
@@ -519,11 +525,11 @@ static unsigned char usbmap[256] = {
/* 132 */ KEY_NOTUSED,
/* 133 */ KEY_NOTUSED,
/* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
+ /* 135 */ KEY_BSlash2, /* Sun Japanese Kbd: Backslash / Underscore */
+ /* 136 */ KEY_XFER, /* Sun Japanese Kbd: Henkan Mode */
+ /* 137 */ KEY_Yen, /* Sun Japanese Kbd: Yen / Brokenbar */
+ /* 138 */ KEY_Kanji, /* Sun Japanese Kbd: Kanji */
+ /* 139 */ KEY_Execute, /* Sun Japanese Kbd: Execute */
/* 140 */ KEY_NOTUSED,
/* 141 */ KEY_NOTUSED,
/* 142 */ KEY_NOTUSED,
diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c
index 2e9cee2b1..4cbd1cd5e 100644
--- a/hw/xfree86/os-support/solaris/sun_mouse.c
+++ b/hw/xfree86/os-support/solaris/sun_mouse.c
@@ -1,4 +1,5 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c,v 1.4 2002/01/25 21:56:21 tsi Exp $ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c,v 1.2 2004/04/23 19:54:13 eich Exp $ */
/*
* Copyright 1999-2001 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -24,16 +25,53 @@
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
+/* Copyright 2004 Sun Microsystems, 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 deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
#include "xf86.h"
#include "xf86_OSlib.h"
#include "xf86OSmouse.h"
-#if defined(__SOL8__) || !defined(i386)
+#if defined(__SOL8__) || !defined(__i386)
#include "xisb.h"
#include "mipointer.h"
+#include <sys/stropts.h>
#include <sys/vuid_event.h>
+#include <sys/msio.h>
+
+/* Wheel mouse support in VUID drivers in Solaris 9 updates & Solaris 10 */
+#ifdef WHEEL_DEVID /* Defined in vuid_event.h if VUID wheel support present */
+# define HAVE_VUID_WHEEL
+#endif
+#ifdef HAVE_VUID_WHEEL
+# include <sys/vuid_wheel.h>
+#endif
/* Names of protocols that are handled internally here. */
@@ -42,21 +80,71 @@ static const char *internalNames[] = {
NULL
};
+static const char *solarisMouseDevs[] = {
+ /* Device file: Protocol: */
+ "/dev/mouse", "VUID", /* USB or SPARC */
+#ifdef __i386
+ "/dev/kdmouse", "PS/2", /* PS/2 */
+#endif
+ NULL
+};
+
typedef struct _VuidMseRec {
Firm_event event;
unsigned char *buffer;
+ char *strmod;
} VuidMseRec, *VuidMsePtr;
static int vuidMouseProc(DeviceIntPtr pPointer, int what);
static void vuidReadInput(InputInfoPtr pInfo);
+/*
+ * Initialize and enable the mouse wheel, if present.
+ *
+ * Returns 1 if mouse wheel was successfully enabled.
+ * Returns 0 if an error occurred or if there is no mouse wheel.
+ */
+static int
+vuidMouseWheelInit(InputInfoPtr pInfo)
+{
+#ifdef HAVE_VUID_WHEEL
+ wheel_state wstate;
+ int nwheel = -1;
+
+ wstate.vers = VUID_WHEEL_STATE_VERS;
+ wstate.id = 0;
+ wstate.stateflags = -1;
+
+ if (ioctl(pInfo->fd, VUIDGWHEELCOUNT, &nwheel) != 0)
+ return (0);
+
+ if (ioctl(pInfo->fd, VUIDGWHEELSTATE, &wstate) != 0) {
+ xf86Msg(X_WARNING, "%s: couldn't get wheel state\n", pInfo->name);
+ return (0);
+ }
+
+ wstate.stateflags |= VUID_WHEEL_STATE_ENABLED;
+
+ if (ioctl(pInfo->fd, VUIDSWHEELSTATE, &wstate) != 0) {
+ xf86Msg(X_WARNING, "%s: couldn't enable wheel\n", pInfo->name);
+ return (0);
+ }
+
+ return (1);
+#else
+ return (0);
+#endif
+}
+
+
/* This function is called when the protocol is "VUID". */
static Bool
vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
MouseDevPtr pMse = pInfo->private;
VuidMsePtr pVuidMse;
+ int buttons;
pVuidMse = xalloc(sizeof(VuidMseRec));
if (pVuidMse == NULL) {
@@ -84,7 +172,40 @@ vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
return FALSE;
}
}
+
pVuidMse->buffer = (unsigned char *)&pVuidMse->event;
+
+ pVuidMse->strmod = xf86SetStrOption(pInfo->options, "StreamsModule", NULL);
+ if (pVuidMse->strmod &&
+ (ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod) == -1)) {
+ xf86Msg(X_ERROR,
+ "%s: cannot push module '%s' onto mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ xfree(pVuidMse);
+ xfree(pMse);
+ return FALSE;
+ }
+
+ buttons = xf86SetIntOption(pInfo->options, "Buttons", 0);
+ if (buttons == 0) {
+ if(ioctl(pInfo->fd, MSIOBUTTONS, &buttons) == 0) {
+ pInfo->conf_idev->commonOptions =
+ xf86ReplaceIntOption(pInfo->conf_idev->commonOptions,
+ "Buttons", buttons);
+ xf86Msg(X_INFO, "%s: Setting Buttons option to \"%d\"\n",
+ pInfo->name, buttons);
+ }
+ }
+
+ if (pVuidMse->strmod &&
+ (ioctl(pInfo->fd, I_POP, pVuidMse->strmod) == -1)) {
+ xf86Msg(X_WARNING,
+ "%s: cannot pop module '%s' off mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ }
+
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
@@ -112,6 +233,7 @@ vuidReadInput(InputInfoPtr pInfo)
unsigned int n;
int c;
unsigned char *pBuf;
+ int wmask;
pMse = pInfo->private;
pVuidMse = pMse->mousePriv;
@@ -154,7 +276,15 @@ vuidReadInput(InputInfoPtr pInfo)
dy -= delta;
break;
}
+ }
+#ifdef HAVE_VUID_WHEEL
+ else if (vuid_in_range(VUID_WHEEL, pVuidMse->event.id)) {
+ if (vuid_id_offset(pVuidMse->event.id) == 0)
+ dz -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
+ else
+ dw -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
}
+#endif
n = 0;
if ((c = XisbRead(pMse->buffer)) >= 0) {
@@ -219,9 +349,20 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
pInfo->fd = -1;
} else {
int fmt = VUID_FIRM_EVENT;
- ioctl(pInfo->fd, VUIDSFORMAT, &fmt);
- xf86FlushInput(pInfo->fd);
- AddEnabledDevice(pInfo->fd);
+
+ if (pVuidMse->strmod &&
+ (ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod) == -1)) {
+ xf86Msg(X_ERROR,
+ "%s: cannot push module '%s' onto mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ } else {
+ ioctl(pInfo->fd, VUIDSFORMAT, &fmt);
+ vuidMouseWheelInit(pInfo);
+ xf86FlushInput(pInfo->fd);
+ AddEnabledDevice(pInfo->fd);
+ }
}
}
pMse->lastButtons = 0;
@@ -237,6 +378,12 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
XisbFree(pMse->buffer);
pMse->buffer = NULL;
}
+ if (pVuidMse->strmod &&
+ (ioctl(pInfo->fd, I_POP, pVuidMse->strmod) == -1)) {
+ xf86Msg(X_WARNING,
+ "%s: cannot pop module '%s' off mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ }
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
}
@@ -278,21 +425,98 @@ CheckProtocol(const char *protocol)
static const char *
DefaultProtocol(void)
{
- return "VUID";
+ return "Auto";
+}
+
+static Bool
+solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol,
+ const char **device)
+{
+ const char **pdev, **pproto, *dev = NULL;
+ int fd = -1;
+ Bool found;
+
+ for (pdev = solarisMouseDevs; *pdev; pdev += 2) {
+ pproto = pdev + 1;
+ if ((*protocol != NULL) && (strcmp(*protocol, "Auto") != 0) &&
+ (*pproto != NULL) && (strcmp(*pproto, *protocol) != 0)) {
+ continue;
+ }
+ if ((*device != NULL) && (strcmp(*device, *pdev) != 0)) {
+ continue;
+ }
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", pdev, strerror(errno));
+#endif
+ } else {
+ found = TRUE;
+ if ((*pproto != NULL) && (strcmp(*pproto, "VUID") == 0)) {
+ int i;
+ if (ioctl(fd, VUIDGFORMAT, &i) < 0) {
+ found = FALSE;
+ }
+ }
+ close(fd);
+ if (found == TRUE) {
+ if (*pproto != NULL) {
+ *protocol = *pproto;
+ }
+ *device = *pdev;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
}
static const char *
SetupAuto(InputInfoPtr pInfo, int *protoPara)
{
- return DefaultProtocol();
+ const char *pdev = NULL;
+ const char *pproto = NULL;
+ MouseDevPtr pMse = pInfo->private;
+
+ if (pInfo->fd == -1) {
+ /* probe to find device/protocol to use */
+ if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
+ /* 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);
+ }
+ } else if (pMse->protocolID == PROT_AUTO) {
+ pdev = xf86CheckStrOption(pInfo->conf_idev->commonOptions,
+ "Device", NULL);
+ solarisMouseAutoProbe(pInfo, &pproto, &pdev);
+ }
+ return pproto;
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ const char *pdev = NULL;
+ const char *pproto = protocol;
+
+ if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
+ /* 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;
}
-#else /* __SOL8__ || !i386 */
+#else /* __SOL8__ || !__i386 */
#undef MSE_MISC
#define MSE_MISC 0
-#endif /* !__SOL8__ && i386 */
+#endif /* !__SOL8__ && __i386 */
static int
SupportedInterfaces(void)
@@ -310,12 +534,13 @@ xf86OSMouseInit(int flags)
if (!p)
return NULL;
p->SupportedInterfaces = SupportedInterfaces;
-#if defined(__SOL8__) || !defined(i386)
+#if defined(__SOL8__) || !defined(__i386)
p->BuiltinNames = BuiltinNames;
p->CheckProtocol = CheckProtocol;
p->PreInit = sunMousePreInit;
p->DefaultProtocol = DefaultProtocol;
p->SetupAuto = SetupAuto;
+ p->FindDevice = FindDevice;
#endif
return p;
}
diff --git a/hw/xfree86/os-support/xf86OSmouse.h b/hw/xfree86/os-support/xf86OSmouse.h
index ee6313a3b..87d742d5e 100644
--- a/hw/xfree86/os-support/xf86OSmouse.h
+++ b/hw/xfree86/os-support/xf86OSmouse.h
@@ -169,11 +169,12 @@ extern OSMouseInfoPtr xf86OSMouseInit(int flags);
*
* 1.0.0 - Everything up to when versioning was started.
* 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec
+ * 1.2.0 - xisbscale added to MouseDevRec
*
*/
#define OS_MOUSE_VERSION_MAJOR 1
-#define OS_MOUSE_VERSION_MINOR 1
+#define OS_MOUSE_VERSION_MINOR 2
#define OS_MOUSE_VERSION_PATCH 0
#define OS_MOUSE_VERSION_CURRENT \
@@ -267,6 +268,7 @@ typedef struct _MouseDevRec {
dataGoodProc dataGood;
int angleOffset;
pointer pDragLock; /* drag lock area */
+ int xisbscale; /* buffer size for 1 event */
} MouseDevRec, *MouseDevPtr;
/* Z axis mapping */
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 4df2d502a..5a9c9b1ff 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -67,6 +67,7 @@
*/
/* $XConsortium: xf86_OSlib.h /main/22 1996/10/27 11:06:31 kaleb $ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 1.4 2004/07/28 03:57:19 alanc Exp $ */
/*
* This is private, and should not be included by any drivers. Drivers
@@ -260,6 +261,7 @@ typedef signed long xf86ssize_t;
# define LED_CAP LED_CAPS_LOCK
# define LED_NUM LED_NUM_LOCK
# define LED_SCR LED_SCROLL_LOCK
+# define LED_COMP LED_COMPOSE
# include <signal.h>
@@ -532,7 +534,7 @@ extern int errno;
# endif
# endif /* __bsdi__ */
-#ifdef USE_I386_IOPL
+#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
#include <machine/sysarch.h>
#endif
diff --git a/hw/xfree86/os-support/xf86_libc.h b/hw/xfree86/os-support/xf86_libc.h
index ca54e480e..9579a6611 100644
--- a/hw/xfree86/os-support/xf86_libc.h
+++ b/hw/xfree86/os-support/xf86_libc.h
@@ -1,4 +1,4 @@
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 1.1.4.3 2003/12/20 00:28:30 kaleb Exp $ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 1.2 2004/04/23 19:54:07 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.63 2003/12/08 21:46:55 alanh Exp $ */
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.