<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
#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__))
#define SUPPORT_PC98
#endif

View File

@ -84,7 +84,7 @@ static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(__QNXNTO__)
static char *DFLT_MOUSE_PROTO = "OSMouse";
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_PROTO = "auto";
#else

View File

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

View File

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

View File

@ -38,7 +38,9 @@
#include "xf86_OSlib.h"
#include <sys/utsname.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <errno.h>
static Bool KeepTty = FALSE;
static int devConsoleFd = -1;
@ -80,6 +82,10 @@ static int initialVT = -1;
#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
#endif
#ifdef __GLIBC__
#define setpgrp setpgid
#endif
#define CHECK_DRIVER_MSG \
"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.
* Add cases for other *BSD that behave the same.
*/
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
uname (&uts);
if (strcmp(uts.sysname, "FreeBSD") == 0) {
i = atof(uts.release) * 100;
if (i >= 310) goto acquire_vt;
}
i = atof(uts.release) * 100;
if (i >= 310) goto acquire_vt;
#endif
/* otherwise fall through */
case PCVT:
/*

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
#if defined(linux)
#include <asm/ioctl.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/agpio.h>
#endif

View File

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