<https://bugs.freedesktop.org/attachment.cgi?id=3463> GNU/kFreeBSD
    Xserver support (Robert Millan)
This commit is contained in:
Alan Coopersmith 2005-10-03 16:46:14 +00:00
parent 22b4200b01
commit 6d4b350dee
11 changed files with 111 additions and 77 deletions

View File

@ -83,7 +83,8 @@ extern DeviceAssocRec mouse_assoc;
#endif #endif
#if (defined(i386) || defined(__i386__)) && \ #if (defined(i386) || defined(__i386__)) && \
(defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \ (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(linux) || \
(defined(SVR4) && !defined(sun)) || defined(__GNU__)) (defined(SVR4) && !defined(sun)) || defined(__GNU__))
#define SUPPORT_PC98 #define SUPPORT_PC98
#endif #endif

View File

@ -84,7 +84,7 @@ static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(__QNXNTO__) #elif defined(__QNXNTO__)
static char *DFLT_MOUSE_PROTO = "OSMouse"; static char *DFLT_MOUSE_PROTO = "OSMouse";
static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0";
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
static char *DFLT_MOUSE_PROTO = "auto"; static char *DFLT_MOUSE_PROTO = "auto";
#else #else

View File

@ -120,7 +120,7 @@ typedef struct {
/* graphics part */ /* graphics part */
Bool sharedMonitor; Bool sharedMonitor;
ScreenPtr currentScreen; ScreenPtr currentScreen;
#ifdef CSRG_BASED #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
int screenFd; /* fd for memory mapped access to int screenFd; /* fd for memory mapped access to
* vga card */ * vga card */
int consType; /* Which console driver? */ int consType; /* Which console driver? */
@ -222,7 +222,7 @@ typedef struct _RootWinProp {
#define XCOMP ((unsigned long) 0x00008000) #define XCOMP ((unsigned long) 0x00008000)
/* BSD console driver types (consType) */ /* BSD console driver types (consType) */
#ifdef CSRG_BASED #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
#define PCCONS 0 #define PCCONS 0
#define CODRV011 1 #define CODRV011 1
#define CODRV01X 2 #define CODRV01X 2

View File

@ -37,7 +37,7 @@
#include <sys/param.h> #include <sys/param.h>
#ifndef __NetBSD__ #ifndef __NetBSD__
# include <sys/sysctl.h> # include <sys/sysctl.h>
# ifdef __FreeBSD__ # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <machine/sysarch.h> # include <machine/sysarch.h>
# endif # endif
# else # else
@ -399,7 +399,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
} }
#if defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
extern int ioperm(unsigned long from, unsigned long num, int on); extern int ioperm(unsigned long from, unsigned long num, int on);
@ -417,7 +417,7 @@ xf86DisableIO()
return; return;
} }
#endif /* __FreeBSD__ || __OpenBSD__ */ #endif /* __FreeBSD_kernel__ || __OpenBSD__ */
#ifdef USE_ALPHA_PIO #ifdef USE_ALPHA_PIO
@ -492,7 +492,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset);
static void static void
writeSparse32(int Value, pointer Base, register unsigned long Offset); writeSparse32(int Value, pointer Base, register unsigned long Offset);
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
extern int sysarch(int, void *); extern int sysarch(int, void *);
#endif #endif
@ -504,7 +504,7 @@ struct parms {
static int static int
sethae(u_int64_t hae) sethae(u_int64_t hae)
{ {
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#ifndef ALPHA_SETHAE #ifndef ALPHA_SETHAE
#define ALPHA_SETHAE 0 #define ALPHA_SETHAE 0
#endif #endif

View File

@ -38,7 +38,9 @@
#include "xf86_OSlib.h" #include "xf86_OSlib.h"
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/ioctl.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h>
static Bool KeepTty = FALSE; static Bool KeepTty = FALSE;
static int devConsoleFd = -1; static int devConsoleFd = -1;
@ -80,6 +82,10 @@ static int initialVT = -1;
#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0" #define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
#endif #endif
#ifdef __GLIBC__
#define setpgrp setpgid
#endif
#define CHECK_DRIVER_MSG \ #define CHECK_DRIVER_MSG \
"Check your kernel's console driver configuration and /dev entries" "Check your kernel's console driver configuration and /dev entries"
@ -239,11 +245,11 @@ xf86OpenConsole()
* switching anymore. Here we check for FreeBSD 3.1 and up. * switching anymore. Here we check for FreeBSD 3.1 and up.
* Add cases for other *BSD that behave the same. * Add cases for other *BSD that behave the same.
*/ */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
uname (&uts); uname (&uts);
if (strcmp(uts.sysname, "FreeBSD") == 0) {
i = atof(uts.release) * 100; i = atof(uts.release) * 100;
if (i >= 310) goto acquire_vt; if (i >= 310) goto acquire_vt;
} #endif
/* otherwise fall through */ /* otherwise fall through */
case PCVT: case PCVT:
/* /*

View File

@ -31,6 +31,7 @@
#endif #endif
#include <X11/X.h> #include <X11/X.h>
#include <termios.h>
#include "compiler.h" #include "compiler.h"
@ -148,7 +149,7 @@ xf86SetKbdRepeat(char rad)
} }
#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) #if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
static struct termio kbdtty; static struct termios kbdtty;
#endif #endif
void void

View File

@ -15,6 +15,7 @@
#endif #endif
#include <X11/X.h> #include <X11/X.h>
#include <termios.h>
#include "compiler.h" #include "compiler.h"
@ -41,7 +42,7 @@ static KbdProtocolRec protocols[] = {
}; };
typedef struct { typedef struct {
struct termio kbdtty; struct termios kbdtty;
} BsdKbdPrivRec, *BsdKbdPrivPtr; } BsdKbdPrivRec, *BsdKbdPrivPtr;
static static
@ -74,10 +75,16 @@ SetKbdLeds(InputInfoPtr pInfo, int leds)
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
int real_leds = 0; int real_leds = 0;
#ifdef LED_CAP
if (leds & XLED1) real_leds |= LED_CAP; if (leds & XLED1) real_leds |= LED_CAP;
#endif
#ifdef LED_NUM
if (leds & XLED2) real_leds |= LED_NUM; if (leds & XLED2) real_leds |= LED_NUM;
#endif
#ifdef LED_SCR
if (leds & XLED3) real_leds |= LED_SCR; if (leds & XLED3) real_leds |= LED_SCR;
if (leds & XLED4) real_leds |= LED_SCR; if (leds & XLED4) real_leds |= LED_SCR;
#endif
switch (pKbd->consType) { switch (pKbd->consType) {
@ -119,9 +126,15 @@ GetKbdLeds(InputInfoPtr pInfo)
#endif #endif
} }
#ifdef LED_CAP
if (real_leds & LED_CAP) leds |= XLED1; if (real_leds & LED_CAP) leds |= XLED1;
#endif
#ifdef LED_NUM
if (real_leds & LED_NUM) leds |= XLED2; if (real_leds & LED_NUM) leds |= XLED2;
#endif
#ifdef LED_SCR
if (real_leds & LED_SCR) leds |= XLED3; if (real_leds & LED_SCR) leds |= XLED3;
#endif
return(leds); return(leds);
} }
@ -311,16 +324,20 @@ Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
case KEY_F8: case KEY_F8:
case KEY_F9: case KEY_F9:
case KEY_F10: case KEY_F10:
#ifdef VT_ACTIVATE
if (down) { if (down) {
ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
return TRUE; return TRUE;
} }
#endif
case KEY_F11: case KEY_F11:
case KEY_F12: case KEY_F12:
#ifdef VT_ACTIVATE
if (down) { if (down) {
ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
return TRUE; return TRUE;
} }
#endif
} }
} }
} }

View File

@ -72,7 +72,7 @@
static void usbSigioReadInput (int fd, void *closure); static void usbSigioReadInput (int fd, void *closure);
#endif #endif
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/* These are for FreeBSD */ /* These are for FreeBSD */
#define DEFAULT_MOUSE_DEV "/dev/mouse" #define DEFAULT_MOUSE_DEV "/dev/mouse"
#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" #define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
@ -101,7 +101,7 @@ SupportedInterfaces(void)
{ {
#if defined(__NetBSD__) #if defined(__NetBSD__)
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
#else #else
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
@ -124,7 +124,7 @@ static const char *internalNames[] = {
* main "mouse" driver. * main "mouse" driver.
*/ */
static const char *miscNames[] = { static const char *miscNames[] = {
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
"SysMouse", "SysMouse",
#endif #endif
NULL NULL
@ -153,7 +153,7 @@ CheckProtocol(const char *protocol)
static const char * static const char *
DefaultProtocol(void) DefaultProtocol(void)
{ {
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
return "Auto"; return "Auto";
#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
return "WSMouse"; return "WSMouse";
@ -162,7 +162,7 @@ DefaultProtocol(void)
#endif #endif
} }
#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE) #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE)
static struct { static struct {
int dproto; int dproto;
const char *name; const char *name;
@ -231,7 +231,7 @@ SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
mode.rate = rate > 0 ? rate : -1; mode.rate = rate > 0 ? rate : -1;
mode.resolution = res > 0 ? res : -1; mode.resolution = res > 0 ? res : -1;
mode.accelfactor = -1; mode.accelfactor = -1;
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (pMse->autoProbe || if (pMse->autoProbe ||
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
/* /*
@ -249,7 +249,7 @@ SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
} }
#endif #endif
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define MOUSED_PID_FILE "/var/run/moused.pid" #define MOUSED_PID_FILE "/var/run/moused.pid"
@ -773,7 +773,7 @@ xf86OSMouseInit(int flags)
p->BuiltinNames = BuiltinNames; p->BuiltinNames = BuiltinNames;
p->DefaultProtocol = DefaultProtocol; p->DefaultProtocol = DefaultProtocol;
p->CheckProtocol = CheckProtocol; p->CheckProtocol = CheckProtocol;
#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE) #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE)
p->SetupAuto = SetupAuto; p->SetupAuto = SetupAuto;
p->SetPS2Res = SetSysMouseRes; p->SetPS2Res = SetSysMouseRes;
p->SetBMRes = SetSysMouseRes; p->SetBMRes = SetSysMouseRes;
@ -783,7 +783,7 @@ xf86OSMouseInit(int flags)
p->SetupAuto = SetupAuto; p->SetupAuto = SetupAuto;
p->SetMiscRes = SetMouseRes; p->SetMiscRes = SetMouseRes;
#endif #endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
p->FindDevice = FindDevice; p->FindDevice = FindDevice;
#endif #endif
p->PreInit = bsdMousePreInit; p->PreInit = bsdMousePreInit;

View File

@ -34,6 +34,9 @@
#include "xf86.h" #include "xf86.h"
#include "xf86Priv.h" #include "xf86Priv.h"
#include <errno.h>
#include <sys/mman.h>
#ifdef HAS_MTRR_SUPPORT #ifdef HAS_MTRR_SUPPORT
#ifndef __NetBSD__ #ifndef __NetBSD__
#include <sys/types.h> #include <sys/types.h>

View File

@ -22,7 +22,7 @@
#if defined(linux) #if defined(linux)
#include <asm/ioctl.h> #include <asm/ioctl.h>
#include <linux/agpgart.h> #include <linux/agpgart.h>
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/agpio.h> #include <sys/agpio.h>
#endif #endif

View File

@ -326,12 +326,24 @@ typedef signed long xf86ssize_t;
#endif /* DGUX && SVR4 */ #endif /* DGUX && SVR4 */
/**************************************************************************/ /**************************************************************************/
/* Linux */ /* Linux or Glibc-based system */
/**************************************************************************/ /**************************************************************************/
#if defined(linux) #if defined(__linux__) || defined(__GLIBC__)
# include <sys/ioctl.h> # include <sys/ioctl.h>
# include <signal.h> # include <signal.h>
# include <stdlib.h>
# include <sys/types.h>
# include <assert.h>
#ifdef __GNU__ /* GNU/Hurd */
# define USE_OSMOUSE
#endif
# ifdef __linux__
# include <termio.h> # include <termio.h>
# else /* __GLIBC__ */
# include <termios.h>
# endif
# ifdef __sparc__ # ifdef __sparc__
# include <sys/param.h> # include <sys/param.h>
# endif # endif
@ -340,20 +352,21 @@ typedef signed long xf86ssize_t;
# include <sys/stat.h> # include <sys/stat.h>
# define HAS_USL_VTS
# include <sys/mman.h> # include <sys/mman.h>
# ifdef __linux__
# define HAS_USL_VTS
# include <sys/kd.h> # include <sys/kd.h>
# include <sys/vt.h> # include <sys/vt.h>
# define LDGMAP GIO_SCRNMAP # define LDGMAP GIO_SCRNMAP
# define LDSMAP PIO_SCRNMAP # define LDSMAP PIO_SCRNMAP
# define LDNMAP LDSMAP # define LDNMAP LDSMAP
# define CLEARDTR_SUPPORT # define CLEARDTR_SUPPORT
# define USE_VT_SYSREQ # define USE_VT_SYSREQ
# endif
# define POSIX_TTY # define POSIX_TTY
#endif /* linux */ #endif /* __linux__ || __GLIBC__ */
/**************************************************************************/ /**************************************************************************/
/* LynxOS AT */ /* LynxOS AT */
@ -413,6 +426,30 @@ extern int errno;
# include <errno.h> # include <errno.h>
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
# if defined(__bsdi__)
# include <sys/param.h>
# if (_BSDI_VERSION < 199510)
# include <i386/isa/vgaioctl.h>
# endif
# endif /* __bsdi__ */
#endif /* CSRG_BASED */
/**************************************************************************/
/* Kernel of *BSD */
/**************************************************************************/
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
# include <sys/param.h>
# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
# define __FreeBSD_kernel_version __FreeBSD_version
# endif
# if !defined(LINKKIT) # if !defined(LINKKIT)
/* Don't need this stuff for the Link Kit */ /* Don't need this stuff for the Link Kit */
# if defined(__bsdi__) # if defined(__bsdi__)
@ -434,9 +471,8 @@ extern int errno;
# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include <machine/console.h> # include <machine/console.h>
# else # else
# if defined(__FreeBSD__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <osreldate.h> # if (__FreeBSD_kernel_version >= 410000)
# if __FreeBSD_version >= 410000
# include <sys/consio.h> # include <sys/consio.h>
# include <sys/kbio.h> # include <sys/kbio.h>
# else # else
@ -450,7 +486,7 @@ extern int errno;
# if defined(PCVT_SUPPORT) # if defined(PCVT_SUPPORT)
# if !defined(SYSCONS_SUPPORT) # if !defined(SYSCONS_SUPPORT)
/* no syscons, so include pcvt specific header file */ /* no syscons, so include pcvt specific header file */
# if defined(__FreeBSD__) || defined(__DragonFly__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
# include <machine/pcvt_ioctl.h> # include <machine/pcvt_ioctl.h>
# else # else
# if defined(__NetBSD__) || defined(__OpenBSD__) # if defined(__NetBSD__) || defined(__OpenBSD__)
@ -460,7 +496,7 @@ extern int errno;
# else # else
# include <sys/pcvt_ioctl.h> # include <sys/pcvt_ioctl.h>
# endif /* __NetBSD__ */ # endif /* __NetBSD__ */
# endif /* __FreeBSD__ || __OpenBSD__ */ # endif /* __FreeBSD_kernel__ || __OpenBSD__ */
# else /* pcvt and syscons: hard-code the ID magic */ # else /* pcvt and syscons: hard-code the ID magic */
# define VGAPCVTID _IOWR('V',113, struct pcvtid) # define VGAPCVTID _IOWR('V',113, struct pcvtid)
struct pcvtid { struct pcvtid {
@ -473,9 +509,8 @@ extern int errno;
# include <dev/wscons/wsconsio.h> # include <dev/wscons/wsconsio.h>
# include <dev/wscons/wsdisplay_usl_io.h> # include <dev/wscons/wsdisplay_usl_io.h>
# endif /* WSCONS_SUPPORT */ # endif /* WSCONS_SUPPORT */
# if defined(__FreeBSD__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <osreldate.h> # if (__FreeBSD_kernel_version >= 500013)
# if __FreeBSD_version >= 500013
# include <sys/mouse.h> # include <sys/mouse.h>
# else # else
# undef MOUSE_GETINFO # undef MOUSE_GETINFO
@ -514,17 +549,6 @@ extern int errno;
# endif /* __bsdi__ */ # endif /* __bsdi__ */
# endif /* !LINKKIT */ # endif /* !LINKKIT */
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
# if defined(__bsdi__)
# include <sys/param.h>
# if (_BSDI_VERSION < 199510)
# include <i386/isa/vgaioctl.h>
# endif
# endif /* __bsdi__ */
#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
#include <machine/sysarch.h> #include <machine/sysarch.h>
#endif #endif
@ -535,7 +559,8 @@ extern int errno;
# define USE_VT_SYSREQ # define USE_VT_SYSREQ
# endif # endif
#endif /* CSRG_BASED */ #endif
/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
/**************************************************************************/ /**************************************************************************/
/* OS/2 */ /* OS/2 */
@ -644,25 +669,6 @@ extern char* __XOS2RedirRoot(char*);
#endif #endif
/**************************************************************************/
/* GNU/Hurd */
/**************************************************************************/
#if defined(__GNU__)
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <sys/stat.h>
#include <assert.h>
#define POSIX_TTY
#define USE_OSMOUSE
#endif /* __GNU__ */
/**************************************************************************/ /**************************************************************************/
/* IRIX */ /* IRIX */
/**************************************************************************/ /**************************************************************************/