diff options
Diffstat (limited to 'hw/xfree86/os-support/bsd')
-rw-r--r-- | hw/xfree86/os-support/bsd/alpha_video.c | 46 | ||||
-rw-r--r-- | hw/xfree86/os-support/bsd/bsd_kbd.c | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/bsd/bsd_mouse.c | 67 |
3 files changed, 102 insertions, 15 deletions
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index aa3313dc3..655ac4a83 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.5 2003/04/03 16:50:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.6 2003/12/30 15:18:30 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -121,7 +121,7 @@ static struct alpha_bus_window *abw; static int abw_count = -1; static void -init_abw() +init_abw(void) { if (abw_count < 0) { abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw); @@ -142,7 +142,7 @@ has_bwx(void) } static unsigned long -dense_base() +dense_base(void) { if (abw_count < 0) init_abw(); @@ -154,7 +154,7 @@ dense_base() } static unsigned long -memory_base() +memory_base(void) { if (abw_count < 0) init_abw(); @@ -284,11 +284,13 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) xf86Msg(X_PROBED,"Machine needs sparse mapping\n"); pVidMem->mapMem = mapVidMemSparse; pVidMem->unmapMem = unmapVidMemSparse; +#ifndef __NetBSD__ if (axpSystem == -1) axpSystem = bsdGetAXP(); hae_thresh = xf86AXPParams[axpSystem].hae_thresh; hae_mask = xf86AXPParams[axpSystem].hae_mask; sparse_size = xf86AXPParams[axpSystem].size; +#endif /* __NetBSD__ */ } pVidMem->initialised = TRUE; } @@ -314,7 +316,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) 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", + FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n", "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno)); } @@ -324,7 +326,7 @@ 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\n", "xf86MapVidMem", Base); } base = mmap(0, Size, @@ -372,7 +374,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)); return(-1); } @@ -446,7 +448,9 @@ xf86EnableInterrupts() #define vuip volatile unsigned int * +#ifndef __NetBSD__ static unsigned long msb_set = 0; +#endif static pointer memSBase = 0; static pointer memBase = 0; @@ -490,6 +494,7 @@ struct parms { u_int64_t hae; }; +#ifndef __NetBSD__ static int sethae(u_int64_t hae) { @@ -505,6 +510,7 @@ sethae(u_int64_t hae) return -1; #endif } +#endif /* __NetBSD__ */ static pointer mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) @@ -552,11 +558,13 @@ static int readSparse8(pointer Base, register unsigned long Offset) { register unsigned long result, shift; +#ifndef __NetBSD__ register unsigned long msb; - +#endif mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x3) << 3; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -565,7 +573,7 @@ readSparse8(pointer Base, register unsigned long Offset) msb_set = msb; } } - +#endif result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); result >>= shift; return 0xffUL & result; @@ -575,11 +583,14 @@ static int readSparse16(pointer Base, register unsigned long Offset) { register unsigned long result, shift; +#ifndef __NetBSD__ register unsigned long msb; +#endif mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x2) << 3; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -588,6 +599,7 @@ readSparse16(pointer Base, register unsigned long Offset) msb_set = msb; } } +#endif result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); result >>= shift; return 0xffffUL & result; @@ -603,11 +615,14 @@ readSparse32(pointer Base, register unsigned long Offset) static void writeSparse8(int Value, pointer Base, register unsigned long Offset) { +#ifndef __NetBSD__ register unsigned long msb; +#endif register unsigned int b = Value & 0xffU; write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -616,17 +631,21 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) msb_set = msb; } } +#endif *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; } static void writeSparse16(int Value, pointer Base, register unsigned long Offset) { +#ifndef __NetBSD__ register unsigned long msb; +#endif register unsigned int w = Value & 0xffffU; write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -635,6 +654,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) msb_set = msb; } } +#endif *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; @@ -651,10 +671,13 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset) static void writeSparseNB8(int Value, pointer Base, register unsigned long Offset) { +#ifndef __NetBSD__ register unsigned long msb; +#endif register unsigned int b = Value & 0xffU; Offset += (unsigned long)Base - (unsigned long)memBase; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -663,16 +686,20 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) msb_set = msb; } } +#endif *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; } static void writeSparseNB16(int Value, pointer Base, register unsigned long Offset) { +#ifndef __NetBSD__ register unsigned long msb; +#endif register unsigned int w = Value & 0xffffU; Offset += (unsigned long)Base - (unsigned long)memBase; +#ifndef __NetBSD__ if (Offset >= (hae_thresh)) { msb = Offset & hae_mask ; Offset -= msb; @@ -681,6 +708,7 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) msb_set = msb; } } +#endif *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; } diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c index 0d586ef72..3c22eeb4d 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.8 2003/11/04 03:16:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.9 2004/01/07 17:05:28 tsi Exp $ */ /* * Copyright (c) 2002 by The XFree86 Project, Inc. @@ -497,7 +497,7 @@ OpenKeyboard(InputInfoPtr pInfo) #endif default: xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"", - pKbd->wsKbdType, pInfo->name); + pInfo->name, pKbd->wsKbdType); close(pInfo->fd); return FALSE; } diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c index 943bb9855..bb5936a1e 100644 --- a/hw/xfree86/os-support/bsd/bsd_mouse.c +++ b/hw/xfree86/os-support/bsd/bsd_mouse.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.26 2003/10/10 20:56:05 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.28 2004/02/06 17:15:36 tsi Exp $ */ /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. @@ -80,6 +80,16 @@ static const char *mouseDevs[] = { DEFAULT_PS2_DEV, NULL }; +#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) +/* Only wsmouse mices are autoconfigured for now on OpenBSD */ +#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse" +#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0" + +static const char *mouseDevs[] = { + DEFAULT_WSMOUSE_DEV, + DEFAULT_WSMOUSE0_DEV, + NULL +}; #endif static int @@ -141,6 +151,8 @@ DefaultProtocol(void) { #if defined(__FreeBSD__) return "Auto"; +#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + return "WSMouse"; #else return NULL; #endif @@ -195,7 +207,7 @@ SetupAuto(InputInfoPtr pInfo, int *protoPara) protoPara[0] = mode.syncmask[0]; protoPara[1] = mode.syncmask[1]; } - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", pInfo->name, devproto[i].name); return devproto[i].name; } @@ -325,7 +337,50 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) } #endif -#if defined(WSCONS_SUPPORT) +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + +/* Only support wsmouse configuration for now */ +static const char * +SetupAuto(InputInfoPtr pInfo, int *protoPara) +{ + + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", + pInfo->name, "wsmouse"); + return "wsmouse"; +} + +static void +SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) +{ + + xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n", + pInfo->name, protocol, rate, res); +} + +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)); + if (fd != -1) { + /* Set the Device option. */ + pInfo->conf_idev->commonOptions = + xf86AddNewOption(pInfo->conf_idev->commonOptions, + "Device", *pdev); + xf86Msg(X_INFO, "%s: found Device \"%s\"\n", + pInfo->name, *pdev); + close(fd); + break; + } + } + return *pdev; +} +#endif /* __OpenBSD__ && WSCONS_SUPPORT */ + +#ifdef WSCONS_SUPPORT #define NUMEVENTS 64 static void @@ -718,7 +773,11 @@ xf86OSMouseInit(int flags) p->SetBMRes = SetSysMouseRes; p->SetMiscRes = SetSysMouseRes; #endif -#if defined(__FreeBSD__) +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) + p->SetupAuto = SetupAuto; + p->SetMiscRes = SetMouseRes; +#endif +#if defined(__FreeBSD__) || defined(__OpenBSD__) p->FindDevice = FindDevice; #endif p->PreInit = bsdMousePreInit; |