diff options
author | marha <marha@users.sourceforge.net> | 2012-04-16 09:17:34 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-16 09:17:34 +0200 |
commit | d6d3999ccb2cb72d55820770260172eccbbb68d7 (patch) | |
tree | 568ce82dd1a8e2edbbe8cd4cb5ab5b14157f34f6 /xorg-server/hw/xfree86/os-support | |
parent | fffd436e9c2ec6f5aa501ee57d0e4ade7293ee60 (diff) | |
download | vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.gz vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.bz2 vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.zip |
libX11 xserver pixman mesa git update 16 Apr 2012
Diffstat (limited to 'xorg-server/hw/xfree86/os-support')
22 files changed, 865 insertions, 877 deletions
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c index 15220d743..0ee51de2f 100644 --- a/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c +++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c @@ -1,103 +1,103 @@ -/*
- * Derived from VTsw_usl.c which is
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- * by S_ren Schmidt (sos@login.dkuug.dk)
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * Handle the VT-switching interface for OSs that use USL-style ioctl()s
- * (the bsd, sysv, sco, and linux subdirs).
- */
-
-/*
- * This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer.
- */
-void
-xf86VTRequest(int sig)
-{
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
- xf86Info.vtRequestsPending = TRUE;
- }
-#endif
- return;
-}
-
-Bool
-xf86VTSwitchPending()
-{
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
- return xf86Info.vtRequestsPending ? TRUE : FALSE;
- }
-#endif
- return FALSE;
-}
-
-Bool
-xf86VTSwitchAway()
-{
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
- return FALSE;
- else
- return TRUE;
- }
-#endif
- return FALSE;
-}
-
-Bool
-xf86VTSwitchTo()
-{
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- return FALSE;
- else
- return TRUE;
- }
-#endif
- return TRUE;
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
- return FALSE;
- }
- return TRUE;
-}
+/* + * Derived from VTsw_usl.c which is + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * by S_ren Schmidt (sos@login.dkuug.dk) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of David Wexelblat not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. David Wexelblat makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +/* + * Handle the VT-switching interface for OSs that use USL-style ioctl()s + * (the bsd, sysv, sco, and linux subdirs). + */ + +/* + * This function is the signal handler for the VT-switching signal. It + * is only referenced inside the OS-support layer. + */ +void +xf86VTRequest(int sig) +{ +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { + xf86Info.vtRequestsPending = TRUE; + } +#endif + return; +} + +Bool +xf86VTSwitchPending() +{ +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { + return xf86Info.vtRequestsPending ? TRUE : FALSE; + } +#endif + return FALSE; +} + +Bool +xf86VTSwitchAway() +{ +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) + return FALSE; + else + return TRUE; + } +#endif + return FALSE; +} + +Bool +xf86VTSwitchTo() +{ +#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) + return FALSE; + else + return TRUE; + } +#endif + return TRUE; +} + +Bool +xf86VTActivate(int vtno) +{ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { + return FALSE; + } + return TRUE; +} diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c index 31b364df3..645377ed6 100644 --- a/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c +++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c @@ -26,74 +26,74 @@ int readDense8(pointer Base, register unsigned long Offset); int readDense16(pointer Base, register unsigned long Offset); int readDense32(pointer Base, register unsigned long Offset); void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, pointer Base, register unsigned long Offset); void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, pointer Base, register unsigned long Offset); void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, pointer Base, register unsigned long Offset); void -writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, pointer Base, register unsigned long Offset); void -writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, pointer Base, register unsigned long Offset); void -writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, pointer Base, register unsigned long Offset); int readDense8(pointer Base, register unsigned long Offset) { mem_barrier(); - return (alpha_ldbu((pointer)((unsigned long)Base+(Offset)))); + return (alpha_ldbu((pointer) ((unsigned long) Base + (Offset)))); } int readDense16(pointer Base, register unsigned long Offset) { mem_barrier(); - return (alpha_ldwu((pointer)((unsigned long)Base+(Offset)))); + return (alpha_ldwu((pointer) ((unsigned long) Base + (Offset)))); } int readDense32(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(volatile CARD32*)((unsigned long)Base+(Offset)); + return *(volatile CARD32 *) ((unsigned long) Base + (Offset)); } void writeDenseNB8(int Value, pointer Base, register unsigned long Offset) { - alpha_stb((pointer)((unsigned long)Base+(Offset)), Value); + alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value); } void writeDenseNB16(int Value, pointer Base, register unsigned long Offset) { - alpha_stw((pointer)((unsigned long)Base + (Offset)), Value); + alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value); } void writeDenseNB32(int Value, pointer Base, register unsigned long Offset) { - *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } void writeDense8(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - alpha_stb((pointer)((unsigned long)Base+(Offset)), Value); + alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value); } void writeDense16(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - alpha_stw((pointer)((unsigned long)Base + (Offset)), Value); + alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value); } void writeDense32(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } diff --git a/xorg-server/hw/xfree86/os-support/bus/Pci.c b/xorg-server/hw/xfree86/os-support/bus/Pci.c index 0362a00e3..52d142fbf 100644 --- a/xorg-server/hw/xfree86/os-support/bus/Pci.c +++ b/xorg-server/hw/xfree86/os-support/bus/Pci.c @@ -129,7 +129,7 @@ Bool xf86scanpci(void) { - Bool success = FALSE; + Bool success = FALSE; success = (pci_system_init() == 0); diff --git a/xorg-server/hw/xfree86/os-support/bus/Pci.h b/xorg-server/hw/xfree86/os-support/bus/Pci.h index 5709bd841..776bb637c 100644 --- a/xorg-server/hw/xfree86/os-support/bus/Pci.h +++ b/xorg-server/hw/xfree86/os-support/bus/Pci.h @@ -95,7 +95,6 @@ * authorization from the copyright holder(s) and author(s). */ - /* * This file has the private Pci definitions. The public ones are imported * from xf86Pci.h. Drivers should not use this file. @@ -119,7 +118,7 @@ #endif #ifndef PCI_DOM_MASK -# define PCI_DOM_MASK 0x0ffu +#define PCI_DOM_MASK 0x0ffu #endif #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) @@ -146,4 +145,4 @@ extern void osPciInit(void); #error No PCI support available for this architecture/OS combination #endif -#endif /* _PCI_H */ +#endif /* _PCI_H */ diff --git a/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h b/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h index cff5e808a..8a10d64fe 100644 --- a/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h +++ b/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h @@ -66,4 +66,4 @@ #define FBTYPE_CREATOR -1 #endif -#endif /* _XF86_SBUS_H */ +#endif /* _XF86_SBUS_H */ diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c index 5fad19451..d98efa247 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c @@ -14,7 +14,7 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> - + #define ACPI_SOCKET "/var/run/acpid.socket" #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 @@ -43,8 +43,8 @@ static CARD32 lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg) { if (lnxACPIOpen()) { - TimerFree(timer); - return 0; + TimerFree(timer); + return 0; } return ACPI_REOPEN_DELAY; @@ -53,7 +53,7 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg) #define LINE_LENGTH 80 static int -lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) +lnxACPIGetEventFromOs(int fd, pmEvent * events, int num) { char ev[LINE_LENGTH]; int n; @@ -61,59 +61,59 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) memset(ev, 0, LINE_LENGTH); do { - n = read( fd, ev, LINE_LENGTH ); + n = read(fd, ev, LINE_LENGTH); } while ((n == -1) && (errno == EAGAIN || errno == EINTR)); if (n <= 0) { - lnxCloseACPI(); - TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL); - return 0; + lnxCloseACPI(); + TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL); + return 0; } /* FIXME: this only processes the first read ACPI event & might break * with interrupted reads. */ - + /* Check that we have a video event */ if (!strncmp(ev, "video", 5)) { - char *video = NULL; - char *GFX = NULL; - char *notify = NULL; - char *data = NULL; /* doesn't appear to be used in the kernel */ - unsigned long int notify_l, data_l; + char *video = NULL; + char *GFX = NULL; + char *notify = NULL; + char *data = NULL; /* doesn't appear to be used in the kernel */ + unsigned long int notify_l, data_l; - video = strtok(ev, " "); + video = strtok(ev, " "); - GFX = strtok(NULL, " "); + GFX = strtok(NULL, " "); #if 0 - ErrorF("GFX: %s\n",GFX); + ErrorF("GFX: %s\n", GFX); #endif - notify = strtok(NULL, " "); - notify_l = strtoul(notify, NULL, 16); + notify = strtok(NULL, " "); + notify_l = strtoul(notify, NULL, 16); #if 0 - ErrorF("notify: 0x%lx\n",notify_l); + ErrorF("notify: 0x%lx\n", notify_l); #endif - data = strtok(NULL, " "); - data_l = strtoul(data, NULL, 16); + data = strtok(NULL, " "); + data_l = strtoul(data, NULL, 16); #if 0 - ErrorF("data: 0x%lx\n",data_l); + ErrorF("data: 0x%lx\n", data_l); #endif - /* Differentiate between events */ - switch (notify_l) { - case ACPI_VIDEO_NOTIFY_SWITCH: - case ACPI_VIDEO_NOTIFY_CYCLE: - case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: - case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: - events[0] = XF86_APM_CAPABILITY_CHANGED; - return 1; - case ACPI_VIDEO_NOTIFY_PROBE: - return 0; - default: - return 0; - } + /* Differentiate between events */ + switch (notify_l) { + case ACPI_VIDEO_NOTIFY_SWITCH: + case ACPI_VIDEO_NOTIFY_CYCLE: + case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: + case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: + events[0] = XF86_APM_CAPABILITY_CHANGED; + return 1; + case ACPI_VIDEO_NOTIFY_PROBE: + return 0; + default: + return 0; + } } - + return 0; } @@ -123,42 +123,42 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event) /* No ability to send back to the kernel in ACPI */ switch (event) { default: - return PM_NONE; + return PM_NONE; } } PMClose lnxACPIOpen(void) { - int fd; + int fd; struct sockaddr_un addr; int r = -1; static int warned = 0; DebugF("ACPI: OSPMOpen called\n"); if (ACPIihPtr || !xf86Info.pmFlag) - return NULL; - + return NULL; + DebugF("ACPI: Opening device\n"); if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) { - memset(&addr, 0, sizeof(addr)); - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, ACPI_SOCKET); - if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) { - if (!warned) - xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n", - ACPI_SOCKET, strerror(errno)); - warned = 1; - shutdown(fd, 2); - close(fd); - return NULL; - } + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, ACPI_SOCKET); + if ((r = connect(fd, (struct sockaddr *) &addr, sizeof(addr))) == -1) { + if (!warned) + xf86MsgVerb(X_WARNING, 3, "Open ACPI failed (%s) (%s)\n", + ACPI_SOCKET, strerror(errno)); + warned = 1; + shutdown(fd, 2); + close(fd); + return NULL; + } } xf86PMGetEventFromOs = lnxACPIGetEventFromOs; xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs; - ACPIihPtr = xf86AddGeneralHandler(fd,xf86HandlePMEvents,NULL); - xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET); + ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL); + xf86MsgVerb(X_INFO, 3, "Open ACPI successful (%s)\n", ACPI_SOCKET); warned = 0; return lnxCloseACPI; @@ -171,9 +171,9 @@ lnxCloseACPI(void) DebugF("ACPI: Closing device\n"); if (ACPIihPtr) { - fd = xf86RemoveGeneralHandler(ACPIihPtr); - shutdown(fd, 2); - close(fd); - ACPIihPtr = NULL; + fd = xf86RemoveGeneralHandler(ACPIihPtr); + shutdown(fd, 2); + close(fd); + ACPIihPtr = NULL; } } diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c index 75cdd3ebc..e1d3cbf17 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c @@ -42,5 +42,5 @@ xf86OSRingBell(int loudness, int pitch, int duration) ioctl(xf86Info.consoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration * loudness / 50) << 16)); + (((unsigned long) duration * loudness / 50) << 16)); } diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c index cb3460d29..49950705a 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c @@ -10,74 +10,74 @@ int readDense8(pointer Base, register unsigned long Offset); int readDense16(pointer Base, register unsigned long Offset); int readDense32(pointer Base, register unsigned long Offset); void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, pointer Base, register unsigned long Offset); void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, pointer Base, register unsigned long Offset); void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, pointer Base, register unsigned long Offset); void -writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, pointer Base, register unsigned long Offset); void -writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, pointer Base, register unsigned long Offset); void -writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, pointer Base, register unsigned long Offset); int readDense8(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(volatile CARD8*) ((unsigned long)Base+(Offset)); + return *(volatile CARD8 *) ((unsigned long) Base + (Offset)); } int readDense16(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(volatile CARD16*) ((unsigned long)Base+(Offset)); + return *(volatile CARD16 *) ((unsigned long) Base + (Offset)); } int readDense32(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(volatile CARD32*)((unsigned long)Base+(Offset)); + return *(volatile CARD32 *) ((unsigned long) Base + (Offset)); } void writeDenseNB8(int Value, pointer Base, register unsigned long Offset) { - *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value; } void writeDenseNB16(int Value, pointer Base, register unsigned long Offset) { - *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value; + *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value; } void writeDenseNB32(int Value, pointer Base, register unsigned long Offset) { - *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } void writeDense8(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value; } void writeDense16(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value; } void writeDense32(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; + *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c index 0b9493d27..0a17c2a81 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c @@ -11,11 +11,9 @@ #include "xf86_OSlib.h" #include "xf86.h" - #define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" #define MAX_PATH 1024 - #if 0 /* XFree86 #defines execl to be the xf86execl() function which does * a fork AND exec. We don't want that. We want the regular, @@ -26,7 +24,6 @@ #endif #endif - /* * Load a Linux kernel module. * This is used by the DRI/DRM to load a DRM kernel module when @@ -39,74 +36,76 @@ int xf86LoadKernelModule(const char *modName) { - char mpPath[MAX_PATH] = ""; - int fd = -1, status, n; - pid_t pid; + char mpPath[MAX_PATH] = ""; + int fd = -1, status, n; + pid_t pid; + + /* get the path to the modprobe program */ + fd = open(MODPROBE_PATH_FILE, O_RDONLY); + if (fd >= 0) { + int count = read(fd, mpPath, MAX_PATH - 1); + + if (count <= 0) { + mpPath[0] = 0; + } + else if (mpPath[count - 1] == '\n') { + mpPath[count - 1] = 0; /* replaces \n with \0 */ + } + close(fd); + /* if this worked, mpPath will be "/sbin/modprobe" or similar. */ + } - /* get the path to the modprobe program */ - fd = open(MODPROBE_PATH_FILE, O_RDONLY); - if (fd >= 0) { - int count = read(fd, mpPath, MAX_PATH - 1); - if (count <= 0) { - mpPath[0] = 0; - } - else if (mpPath[count - 1] == '\n') { - mpPath[count - 1] = 0; /* replaces \n with \0 */ - } - close(fd); - /* if this worked, mpPath will be "/sbin/modprobe" or similar. */ - } + if (mpPath[0] == 0) { + /* we failed to get the path from the system, use a default */ + strcpy(mpPath, "/sbin/modprobe"); + } - if (mpPath[0] == 0) { - /* we failed to get the path from the system, use a default */ - strcpy(mpPath, "/sbin/modprobe"); - } + /* now fork/exec the modprobe command */ + /* + * It would be good to capture stdout/stderr so that it can be directed + * to the log file. modprobe errors currently are missing from the log + * file. + */ + switch (pid = fork()) { + case 0: /* child */ + /* change real/effective user ID to 0/0 as we need to + * preinstall agpgart module for some DRM modules + */ + if (setreuid(0, 0)) { + xf86Msg(X_WARNING, "LoadKernelModule: " + "Setting of real/effective user Id to 0/0 failed"); + } + setenv("PATH", "/sbin", 1); + n = execl(mpPath, "modprobe", modName, NULL); + xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno)); + exit(EXIT_FAILURE); /* if we get here the child's exec failed */ + break; + case -1: /* fork failed */ + return 0; + default: /* fork worked */ + { + /* XXX we loop over waitpid() because it sometimes fails on + * the first attempt. Don't know why! + */ + int count = 0, p; - /* now fork/exec the modprobe command */ - /* - * It would be good to capture stdout/stderr so that it can be directed - * to the log file. modprobe errors currently are missing from the log - * file. - */ - switch (pid = fork()) { - case 0: /* child */ - /* change real/effective user ID to 0/0 as we need to - * preinstall agpgart module for some DRM modules - */ - if (setreuid(0,0)) { - xf86Msg(X_WARNING,"LoadKernelModule: " - "Setting of real/effective user Id to 0/0 failed"); - } - setenv("PATH","/sbin",1); - n = execl(mpPath, "modprobe", modName, NULL); - xf86Msg(X_WARNING,"LoadKernelModule %s\n",strerror(errno)); - exit(EXIT_FAILURE); /* if we get here the child's exec failed */ - break; - case -1: /* fork failed */ - return 0; - default: /* fork worked */ - { - /* XXX we loop over waitpid() because it sometimes fails on - * the first attempt. Don't know why! - */ - int count = 0, p; - do { + do { p = waitpid(pid, &status, 0); - } while (p == -1 && count++ < 4); + } while (p == -1 && count++ < 4); - if (p == -1) { + if (p == -1) { return 0; - } + } - if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - return 1; /* success! */ - } - else { + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { + return 1; /* success! */ + } + else { return 0; - } - } - } + } + } + } - /* never get here */ - return 0; + /* never get here */ + return 0; } diff --git a/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c b/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c index be47cd681..a75d134b4 100644 --- a/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c +++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c @@ -1,60 +1,60 @@ -/*
- * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * No-op functions for OSs without VTs
- */
-
-Bool
-xf86VTSwitchPending(void)
-{
- return FALSE;
-}
-
-Bool
-xf86VTSwitchAway(void)
-{
- return FALSE;
-}
-
-Bool
-xf86VTSwitchTo(void)
-{
- return TRUE;
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
- return TRUE;
-}
+/* + * Copyright 1993 by David Wexelblat <dwex@XFree86.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of David Wexelblat not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. David Wexelblat makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +/* + * No-op functions for OSs without VTs + */ + +Bool +xf86VTSwitchPending(void) +{ + return FALSE; +} + +Bool +xf86VTSwitchAway(void) +{ + return FALSE; +} + +Bool +xf86VTSwitchTo(void) +{ + return TRUE; +} + +Bool +xf86VTActivate(int vtno) +{ + return TRUE; +} diff --git a/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c b/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c index 769fa009c..f20106c90 100644 --- a/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c +++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c @@ -1,86 +1,86 @@ -/*
- * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * Handle the VT-switching interface for OSs that use USL-style ioctl()s
- * (the sysv, sco, and linux subdirs).
- */
-
-/*
- * This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer.
- */
-void
-xf86VTRequest(int sig)
-{
- signal(sig, (void(*)(int))xf86VTRequest);
- xf86Info.vtRequestsPending = TRUE;
- return;
-}
-
-Bool
-xf86VTSwitchPending(void)
-{
- return xf86Info.vtRequestsPending ? TRUE : FALSE;
-}
-
-Bool
-xf86VTSwitchAway(void)
-{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
- return FALSE;
- else
- return TRUE;
-}
-
-Bool
-xf86VTSwitchTo(void)
-{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- return FALSE;
- else
- return TRUE;
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
-#ifdef VT_ACTIVATE
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
- return FALSE;
- }
-#endif
- return TRUE;
-}
+/* + * Copyright 1993 by David Wexelblat <dwex@XFree86.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of David Wexelblat not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. David Wexelblat makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR 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. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +/* + * Handle the VT-switching interface for OSs that use USL-style ioctl()s + * (the sysv, sco, and linux subdirs). + */ + +/* + * This function is the signal handler for the VT-switching signal. It + * is only referenced inside the OS-support layer. + */ +void +xf86VTRequest(int sig) +{ + signal(sig, (void (*)(int)) xf86VTRequest); + xf86Info.vtRequestsPending = TRUE; + return; +} + +Bool +xf86VTSwitchPending(void) +{ + return xf86Info.vtRequestsPending ? TRUE : FALSE; +} + +Bool +xf86VTSwitchAway(void) +{ + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) + return FALSE; + else + return TRUE; +} + +Bool +xf86VTSwitchTo(void) +{ + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) + return FALSE; + else + return TRUE; +} + +Bool +xf86VTActivate(int vtno) +{ +#ifdef VT_ACTIVATE + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { + return FALSE; + } +#endif + return TRUE; +} diff --git a/xorg-server/hw/xfree86/os-support/shared/agp_noop.c b/xorg-server/hw/xfree86/os-support/shared/agp_noop.c index eda466a52..9c6ed4b8d 100644 --- a/xorg-server/hw/xfree86/os-support/shared/agp_noop.c +++ b/xorg-server/hw/xfree86/os-support/shared/agp_noop.c @@ -43,61 +43,60 @@ Bool xf86GARTCloseScreen(int screenNum) { - return FALSE; + return FALSE; } Bool xf86AgpGARTSupported() { - return FALSE; + return FALSE; } AgpInfoPtr xf86GetAGPInfo(int screenNum) { - return NULL; + return NULL; } Bool xf86AcquireGART(int screenNum) { - return FALSE; + return FALSE; } Bool xf86ReleaseGART(int screenNum) { - return FALSE; + return FALSE; } int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, - unsigned long *physical) + unsigned long *physical) { - return -1; + return -1; } Bool xf86DeallocateGARTMemory(int screenNum, int key) { - return FALSE; + return FALSE; } Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) { - return FALSE; + return FALSE; } - Bool xf86UnbindGARTMemory(int screenNum, int key) { - return FALSE; + return FALSE; } Bool xf86EnableAGP(int screenNum, CARD32 mode) { - return FALSE; + return FALSE; } diff --git a/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c b/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c index 805caccac..30688c0b5 100644 --- a/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c +++ b/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c @@ -38,12 +38,11 @@ Bool xf86EnableIO() { - return TRUE; + return TRUE; } void xf86DisableIO() { - return; + return; } - diff --git a/xorg-server/hw/xfree86/os-support/shared/pm_noop.c b/xorg-server/hw/xfree86/os-support/shared/pm_noop.c index bfac4b1c8..1d6f0789d 100644 --- a/xorg-server/hw/xfree86/os-support/shared/pm_noop.c +++ b/xorg-server/hw/xfree86/os-support/shared/pm_noop.c @@ -41,7 +41,5 @@ PMClose xf86OSPMOpen(void) { - return NULL; + return NULL; } - - diff --git a/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c b/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c index cecec37f7..ba8e234f4 100644 --- a/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c +++ b/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c @@ -29,13 +29,13 @@ #include <xorg-config.h> #endif -# include <X11/X.h> -# include "xf86.h" -# include "xf86Priv.h" -# include "xf86_OSlib.h" +#include <X11/X.h> +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" int -xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure) +xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) { return 0; } @@ -47,25 +47,24 @@ xf86RemoveSIGIOHandler(int fd) } int -xf86BlockSIGIO (void) +xf86BlockSIGIO(void) { return 0; } void -xf86UnblockSIGIO (int wasset) +xf86UnblockSIGIO(int wasset) { } void -xf86AssertBlockedSIGIO (char *where) +xf86AssertBlockedSIGIO(char *where) { } /* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */ Bool -xf86SIGIOSupported () +xf86SIGIOSupported() { return FALSE; } - diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h index 5e9d6284c..fded9d8c9 100644 --- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h +++ b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h @@ -6,29 +6,28 @@ #define _XF86_AXP_H_ typedef enum { - SYS_NONE, - TSUNAMI, - LCA, - APECS, - T2, - T2_GAMMA, - CIA, - MCPCIA, - JENSEN, - POLARIS, - PYXIS, - PYXIS_CIA, - IRONGATE + SYS_NONE, + TSUNAMI, + LCA, + APECS, + T2, + T2_GAMMA, + CIA, + MCPCIA, + JENSEN, + POLARIS, + PYXIS, + PYXIS_CIA, + IRONGATE } axpDevice; - + typedef struct { - axpDevice id; - unsigned long hae_thresh; - unsigned long hae_mask; - unsigned long size; + axpDevice id; + unsigned long hae_thresh; + unsigned long hae_mask; + unsigned long size; } axpParams; extern axpParams xf86AXPParams[]; #endif - diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c index 8c4e9f5c1..fb58eca81 100644 --- a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c +++ b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c @@ -51,6 +51,7 @@ static int gartFd = -1; static int acquiredScreen = -1; static Bool initDone = FALSE; + /* * Close /dev/agpgart. This frees all associated memory allocated during * this server generation. @@ -58,17 +59,17 @@ static Bool initDone = FALSE; Bool xf86GARTCloseScreen(int screenNum) { - if (gartFd != -1) { - close(gartFd); - acquiredScreen = -1; - gartFd = -1; - initDone = FALSE; + if (gartFd != -1) { + close(gartFd); + acquiredScreen = -1; + gartFd = -1; + initDone = FALSE; - xf86DrvMsg(screenNum, X_INFO, - "xf86GARTCloseScreen: device closed successfully\n"); + xf86DrvMsg(screenNum, X_INFO, + "xf86GARTCloseScreen: device closed successfully\n"); - } - return TRUE; + } + return TRUE; } /* @@ -77,251 +78,249 @@ xf86GARTCloseScreen(int screenNum) static Bool GARTInit(int screenNum) { - if (initDone) - return gartFd != -1; - - if (gartFd == -1) - gartFd = open(AGP_DEVICE, O_RDWR); - else - return FALSE; - - if (gartFd == -1) { - xf86DrvMsg(screenNum, X_ERROR, - "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", - strerror(errno)); - return FALSE; - } - - initDone = TRUE; - xf86DrvMsg(screenNum, X_INFO, - "GARTInit: " AGP_DEVICE " opened successfully\n"); - - return TRUE; + if (initDone) + return gartFd != -1; + + if (gartFd == -1) + gartFd = open(AGP_DEVICE, O_RDWR); + else + return FALSE; + + if (gartFd == -1) { + xf86DrvMsg(screenNum, X_ERROR, + "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", + strerror(errno)); + return FALSE; + } + + initDone = TRUE; + xf86DrvMsg(screenNum, X_INFO, + "GARTInit: " AGP_DEVICE " opened successfully\n"); + + return TRUE; } Bool xf86AgpGARTSupported(void) { - return (GARTInit(-1)); + return (GARTInit(-1)); } AgpInfoPtr xf86GetAGPInfo(int screenNum) { - agp_info_t agpinf; - AgpInfoPtr info; - - if (!GARTInit(screenNum)) - return NULL; - - if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { - xf86DrvMsg(screenNum, X_ERROR, - "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", - strerror(errno)); - return NULL; - } - - if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { - xf86DrvMsg(screenNum, X_ERROR, - "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); - return NULL; - } - - info->bridgeId = agpinf.agpi_devid; - info->agpMode = agpinf.agpi_mode; - info->base = agpinf.agpi_aperbase; - info->size = agpinf.agpi_apersize; - info->totalPages = (unsigned long)agpinf.agpi_pgtotal; - info->systemPages = (unsigned long)agpinf.agpi_pgsystem; - info->usedPages = (unsigned long)agpinf.agpi_pgused; - - return info; + agp_info_t agpinf; + AgpInfoPtr info; + + if (!GARTInit(screenNum)) + return NULL; + + if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { + xf86DrvMsg(screenNum, X_ERROR, + "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", + strerror(errno)); + return NULL; + } + + if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { + xf86DrvMsg(screenNum, X_ERROR, + "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); + return NULL; + } + + info->bridgeId = agpinf.agpi_devid; + info->agpMode = agpinf.agpi_mode; + info->base = agpinf.agpi_aperbase; + info->size = agpinf.agpi_apersize; + info->totalPages = (unsigned long) agpinf.agpi_pgtotal; + info->systemPages = (unsigned long) agpinf.agpi_pgsystem; + info->usedPages = (unsigned long) agpinf.agpi_pgused; + + return info; } Bool xf86AcquireGART(int screenNum) { - if (!GARTInit(screenNum)) - return FALSE; - - if (acquiredScreen != screenNum) { - if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { - xf86DrvMsg(screenNum, X_WARNING, - "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n", - strerror(errno)); - return FALSE; - } - acquiredScreen = screenNum; - xf86DrvMsg(screenNum, X_INFO, - "xf86AcquireGART: AGPIOC_ACQUIRE succeeded\n"); - } - return TRUE; + if (!GARTInit(screenNum)) + return FALSE; + + if (acquiredScreen != screenNum) { + if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { + xf86DrvMsg(screenNum, X_WARNING, + "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n", + strerror(errno)); + return FALSE; + } + acquiredScreen = screenNum; + xf86DrvMsg(screenNum, X_INFO, + "xf86AcquireGART: AGPIOC_ACQUIRE succeeded\n"); + } + return TRUE; } Bool xf86ReleaseGART(int screenNum) { - if (!GARTInit(screenNum)) - return FALSE; - - if (acquiredScreen == screenNum) { - /* - * The FreeBSD agp driver removes allocations on release. - * The Solaris driver doesn't. xf86ReleaseGART() is expected - * to give up access to the GART, but not to remove any - * allocations. - */ - - if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { - xf86DrvMsg(screenNum, X_WARNING, - "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n", - strerror(errno)); - return FALSE; - } - acquiredScreen = -1; - xf86DrvMsg(screenNum, X_INFO, - "xf86ReleaseGART: AGPIOC_RELEASE succeeded\n"); - return TRUE; - } - return FALSE; + if (!GARTInit(screenNum)) + return FALSE; + + if (acquiredScreen == screenNum) { + /* + * The FreeBSD agp driver removes allocations on release. + * The Solaris driver doesn't. xf86ReleaseGART() is expected + * to give up access to the GART, but not to remove any + * allocations. + */ + + if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { + xf86DrvMsg(screenNum, X_WARNING, + "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n", + strerror(errno)); + return FALSE; + } + acquiredScreen = -1; + xf86DrvMsg(screenNum, X_INFO, + "xf86ReleaseGART: AGPIOC_RELEASE succeeded\n"); + return TRUE; + } + return FALSE; } int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, - unsigned long *physical) + unsigned long *physical) { - agp_allocate_t alloc; - int pages; - - /* - * Allocates "size" bytes of GART memory (rounds up to the next - * page multiple) or type "type". A handle (key) for the allocated - * memory is returned. On error, the return value is -1. - * "size" should be larger than 0, or AGPIOC_ALLOCATE ioctl will - * return error. - */ - - if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) - return -1; - - pages = (size / AGP_PAGE_SIZE); - if (size % AGP_PAGE_SIZE != 0) - pages++; - - alloc.agpa_pgcount = pages; - alloc.agpa_type = type; - - if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: " - "allocation of %d pages failed\n\t(%s)\n", pages, - strerror(errno)); - return -1; - } - - if (physical) - *physical = (unsigned long)alloc.agpa_physical; - - return alloc.agpa_key; + agp_allocate_t alloc; + int pages; + + /* + * Allocates "size" bytes of GART memory (rounds up to the next + * page multiple) or type "type". A handle (key) for the allocated + * memory is returned. On error, the return value is -1. + * "size" should be larger than 0, or AGPIOC_ALLOCATE ioctl will + * return error. + */ + + if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) + return -1; + + pages = (size / AGP_PAGE_SIZE); + if (size % AGP_PAGE_SIZE != 0) + pages++; + + alloc.agpa_pgcount = pages; + alloc.agpa_type = type; + + if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: " + "allocation of %d pages failed\n\t(%s)\n", pages, + strerror(errno)); + return -1; + } + + if (physical) + *physical = (unsigned long) alloc.agpa_physical; + + return alloc.agpa_key; } Bool xf86DeallocateGARTMemory(int screenNum, int key) { - if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) - return FALSE; + if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) + return FALSE; - if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)(uintptr_t)key) != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: " - "deallocation of gart memory with key %d failed\n" - "\t(%s)\n", key, strerror(errno)); - return FALSE; - } + if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *) (uintptr_t) key) != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: " + "deallocation of gart memory with key %d failed\n" + "\t(%s)\n", key, strerror(errno)); + return FALSE; + } - return TRUE; + return TRUE; } /* Bind GART memory with "key" at "offset" */ Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) { - agp_bind_t bind; - int pageOffset; - - if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) - return FALSE; - - if (offset % AGP_PAGE_SIZE != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " - "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%08lx " - "(pgoffset %d)\n", key, offset, pageOffset); - - bind.agpb_pgstart = pageOffset; - bind.agpb_key = key; - - if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " - "binding of gart memory with key %d\n" - "\tat offset 0x%lx failed (%s)\n", - key, offset, strerror(errno)); - return FALSE; - } - - return TRUE; + agp_bind_t bind; + int pageOffset; + + if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) + return FALSE; + + if (offset % AGP_PAGE_SIZE != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " + "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%08lx " + "(pgoffset %d)\n", key, offset, pageOffset); + + bind.agpb_pgstart = pageOffset; + bind.agpb_key = key; + + if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " + "binding of gart memory with key %d\n" + "\tat offset 0x%lx failed (%s)\n", + key, offset, strerror(errno)); + return FALSE; + } + + return TRUE; } /* Unbind GART memory with "key" */ Bool xf86UnbindGARTMemory(int screenNum, int key) { - agp_unbind_t unbind; + agp_unbind_t unbind; - if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) - return FALSE; + if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) + return FALSE; - unbind.agpu_pri = 0; - unbind.agpu_key = key; + unbind.agpu_pri = 0; + unbind.agpu_key = key; - if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: " - "unbinding of gart memory with key %d " - "failed (%s)\n", key, strerror(errno)); - return FALSE; - } + if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: " + "unbinding of gart memory with key %d " + "failed (%s)\n", key, strerror(errno)); + return FALSE; + } - xf86DrvMsgVerb(screenNum, X_INFO, 3, - "xf86UnbindGARTMemory: unbind key %d\n", key); + xf86DrvMsgVerb(screenNum, X_INFO, 3, + "xf86UnbindGARTMemory: unbind key %d\n", key); - return TRUE; + return TRUE; } - /* XXX Interface may change. */ Bool xf86EnableAGP(int screenNum, CARD32 mode) { - agp_setup_t setup; + agp_setup_t setup; - if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) - return FALSE; + if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) + return FALSE; - setup.agps_mode = mode; - if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { - xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: " - "AGPIOC_SETUP with mode %x failed (%s)\n", - (unsigned int) mode, strerror(errno)); - return FALSE; - } + setup.agps_mode = mode; + if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { + xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: " + "AGPIOC_SETUP with mode %x failed (%s)\n", + (unsigned int) mode, strerror(errno)); + return FALSE; + } - return TRUE; + return TRUE; } - diff --git a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c b/xorg-server/hw/xfree86/os-support/stub/stub_bios.c index 8628316dd..dbc92fcdb 100644 --- a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c +++ b/xorg-server/hw/xfree86/os-support/stub/stub_bios.c @@ -6,7 +6,7 @@ int xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) + int Len) { - return -1; + return -1; } diff --git a/xorg-server/hw/xfree86/os-support/stub/stub_init.c b/xorg-server/hw/xfree86/os-support/stub/stub_init.c index 36fd2b818..629675d68 100644 --- a/xorg-server/hw/xfree86/os-support/stub/stub_init.c +++ b/xorg-server/hw/xfree86/os-support/stub/stub_init.c @@ -17,7 +17,7 @@ xf86CloseConsole() int xf86ProcessArgument(int argc, char *argv[], int i) { - return 0; + return 0; } void diff --git a/xorg-server/hw/xfree86/os-support/stub/stub_video.c b/xorg-server/hw/xfree86/os-support/stub/stub_video.c index 327496839..9771fcf6e 100644 --- a/xorg-server/hw/xfree86/os-support/stub/stub_video.c +++ b/xorg-server/hw/xfree86/os-support/stub/stub_video.c @@ -8,6 +8,6 @@ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { - pVidMem->initialised = TRUE; - return; + pVidMem->initialised = TRUE; + return; } diff --git a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h index 754128de9..65769c16f 100644 --- a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h +++ b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h @@ -32,25 +32,25 @@ #ifndef _XF86OSPRIV_H #define _XF86OSPRIV_H -typedef pointer (*MapMemProcPtr)(int, unsigned long, unsigned long, int); -typedef void (*UnmapMemProcPtr)(int, pointer, unsigned long); -typedef pointer (*SetWCProcPtr)(int, unsigned long, unsigned long, Bool, - MessageType); -typedef void (*ProtectMemProcPtr)(int, pointer, unsigned long, Bool); -typedef void (*UndoWCProcPtr)(int, pointer); -typedef void (*ReadSideEffectsProcPtr)(int, pointer, unsigned long); +typedef pointer (*MapMemProcPtr) (int, unsigned long, unsigned long, int); +typedef void (*UnmapMemProcPtr) (int, pointer, unsigned long); +typedef pointer (*SetWCProcPtr) (int, unsigned long, unsigned long, Bool, + MessageType); +typedef void (*ProtectMemProcPtr) (int, pointer, unsigned long, Bool); +typedef void (*UndoWCProcPtr) (int, pointer); +typedef void (*ReadSideEffectsProcPtr) (int, pointer, unsigned long); typedef struct { - Bool initialised; - MapMemProcPtr mapMem; - UnmapMemProcPtr unmapMem; - ProtectMemProcPtr protectMem; - SetWCProcPtr setWC; - UndoWCProcPtr undoWC; - ReadSideEffectsProcPtr readSideEffects; - Bool linearSupported; + Bool initialised; + MapMemProcPtr mapMem; + UnmapMemProcPtr unmapMem; + ProtectMemProcPtr protectMem; + SetWCProcPtr setWC; + UndoWCProcPtr undoWC; + ReadSideEffectsProcPtr readSideEffects; + Bool linearSupported; } VidMemInfo, *VidMemInfoPtr; void xf86OSInitVidMem(VidMemInfoPtr); -#endif /* _XF86OSPRIV_H */ +#endif /* _XF86OSPRIV_H */ diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h index 45500dbdb..9161e181e 100644 --- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h +++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h @@ -85,152 +85,150 @@ /**************************************************************************/ #if (defined(SYSV) || defined(SVR4)) && \ (defined(sun) || defined(__i386__)) -# include <sys/ioctl.h> -# include <signal.h> -# include <termio.h> -# include <sys/stat.h> -# include <sys/types.h> - - -# include <errno.h> - -# if defined(_NEED_SYSI86) -# if !(defined (sun) && defined (SVR4)) -# include <sys/immu.h> -# include <sys/region.h> -# include <sys/proc.h> -# endif -# include <sys/tss.h> -# include <sys/sysi86.h> -# if defined(SVR4) && !defined(sun) -# include <sys/seg.h> -# endif /* SVR4 && !sun */ +#include <sys/ioctl.h> +#include <signal.h> +#include <termio.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include <errno.h> + +#if defined(_NEED_SYSI86) +#if !(defined (sun) && defined (SVR4)) +#include <sys/immu.h> +#include <sys/region.h> +#include <sys/proc.h> +#endif +#include <sys/tss.h> +#include <sys/sysi86.h> +#if defined(SVR4) && !defined(sun) +#include <sys/seg.h> +#endif /* SVR4 && !sun */ /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */ -# if !defined(V86SC_IOPL) /* Solaris 7 or later? */ -# include <sys/v86.h> /* Nope */ -# endif -# if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4) -# include <sys/psw.h> -# endif -# endif /* _NEED_SYSI86 */ - -# if defined(HAS_SVR3_MMAPDRV) -# include <sys/sysmacros.h> -# if !defined(_NEED_SYSI86) -# include <sys/immu.h> -# include <sys/region.h> -# endif -# include <sys/mmap.h> /* MMAP driver header */ -# endif - -# if !defined(sun) || defined(HAVE_SYS_VT_H) -# define HAS_USL_VTS -# endif -# if !defined(sun) -# include <sys/emap.h> -# endif -# if defined(HAS_USL_VTS) -# if !defined(sun) -# include <sys/at_ansi.h> -# endif -# include <sys/kd.h> -# include <sys/vt.h> -# endif - -# if defined(sun) -# include <sys/fbio.h> -# include <sys/kbd.h> -# include <sys/kbio.h> - -/* undefine symbols from <sys/kbd.h> we don't need that conflict with enum - definitions in parser/xf86tokens.h */ -# undef STRING -# undef LEFTALT -# undef RIGHTALT +#if !defined(V86SC_IOPL) /* Solaris 7 or later? */ +#include <sys/v86.h> /* Nope */ +#endif +#if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4) +#include <sys/psw.h> +#endif +#endif /* _NEED_SYSI86 */ -# define LED_CAP LED_CAPS_LOCK -# define LED_NUM LED_NUM_LOCK -# define LED_SCR LED_SCROLL_LOCK -# define LED_COMP LED_COMPOSE -# endif /* sun */ +#if defined(HAS_SVR3_MMAPDRV) +#include <sys/sysmacros.h> +#if !defined(_NEED_SYSI86) +#include <sys/immu.h> +#include <sys/region.h> +#endif +#include <sys/mmap.h> /* MMAP driver header */ +#endif -# if !defined(VT_ACKACQ) -# define VT_ACKACQ 2 -# endif /* !VT_ACKACQ */ +#if !defined(sun) || defined(HAVE_SYS_VT_H) +#define HAS_USL_VTS +#endif +#if !defined(sun) +#include <sys/emap.h> +#endif +#if defined(HAS_USL_VTS) +#if !defined(sun) +#include <sys/at_ansi.h> +#endif +#include <sys/kd.h> +#include <sys/vt.h> +#endif +#if defined(sun) +#include <sys/fbio.h> +#include <sys/kbd.h> +#include <sys/kbio.h> -# if defined(SVR4) -# include <sys/mman.h> -# if !(defined(sun) && defined (SVR4)) -# define DEV_MEM "/dev/pmem" -# endif -# define CLEARDTR_SUPPORT -# define POSIX_TTY -# endif /* SVR4 */ +/* undefine symbols from <sys/kbd.h> we don't need that conflict with enum + definitions in parser/xf86tokens.h */ +#undef STRING +#undef LEFTALT +#undef RIGHTALT + +#define LED_CAP LED_CAPS_LOCK +#define LED_NUM LED_NUM_LOCK +#define LED_SCR LED_SCROLL_LOCK +#define LED_COMP LED_COMPOSE +#endif /* sun */ + +#if !defined(VT_ACKACQ) +#define VT_ACKACQ 2 +#endif /* !VT_ACKACQ */ + +#if defined(SVR4) +#include <sys/mman.h> +#if !(defined(sun) && defined (SVR4)) +#define DEV_MEM "/dev/pmem" +#endif +#define CLEARDTR_SUPPORT +#define POSIX_TTY +#endif /* SVR4 */ -#endif /* (SYSV || SVR4) */ +#endif /* (SYSV || SVR4) */ /**************************************************************************/ /* Linux or Glibc-based system */ /**************************************************************************/ #if defined(__linux__) || defined(__GLIBC__) -# include <sys/ioctl.h> -# include <signal.h> -# include <stdlib.h> -# include <sys/types.h> -# include <assert.h> - -# ifdef __linux__ -# include <termio.h> -# else /* __GLIBC__ */ -# include <termios.h> -# endif -# ifdef __sparc__ -# include <sys/param.h> -# endif - -# include <errno.h> - -# include <sys/stat.h> - -# include <sys/mman.h> -# 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 -# endif - -# define POSIX_TTY - -#endif /* __linux__ || __GLIBC__ */ +#include <sys/ioctl.h> +#include <signal.h> +#include <stdlib.h> +#include <sys/types.h> +#include <assert.h> + +#ifdef __linux__ +#include <termio.h> +#else /* __GLIBC__ */ +#include <termios.h> +#endif +#ifdef __sparc__ +#include <sys/param.h> +#endif + +#include <errno.h> + +#include <sys/stat.h> + +#include <sys/mman.h> +#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 +#endif + +#define POSIX_TTY + +#endif /* __linux__ || __GLIBC__ */ /**************************************************************************/ /* 386BSD and derivatives, BSD/386 */ /**************************************************************************/ #if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__)) -# undef __386BSD__ +#undef __386BSD__ #endif #ifdef CSRG_BASED -# include <sys/ioctl.h> -# include <signal.h> +#include <sys/ioctl.h> +#include <signal.h> -# include <termios.h> -# define termio termios -# define POSIX_TTY +#include <termios.h> +#define termio termios +#define POSIX_TTY -# include <errno.h> +#include <errno.h> -# include <sys/types.h> -# include <sys/mman.h> -# include <sys/stat.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/stat.h> -#endif /* CSRG_BASED */ +#endif /* CSRG_BASED */ /**************************************************************************/ /* Kernel of *BSD */ @@ -238,92 +236,92 @@ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) -# include <sys/param.h> -# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version) -# define __FreeBSD_kernel_version __FreeBSD_version -# endif +#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 */ -# ifdef SYSCONS_SUPPORT -# define COMPAT_SYSCONS -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) -# include <sys/consio.h> -# include <sys/kbio.h> -# else -# include <machine/console.h> -# endif /* FreeBSD 4.1 RELEASE or lator */ -# else -# include <sys/console.h> -# endif -# endif /* SYSCONS_SUPPORT */ -# if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__) -# if !defined(SYSCONS_SUPPORT) +#ifdef SYSCONS_SUPPORT +#define COMPAT_SYSCONS +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) +#include <sys/consio.h> +#include <sys/kbio.h> +#else +#include <machine/console.h> +#endif /* FreeBSD 4.1 RELEASE or lator */ +#else +#include <sys/console.h> +#endif +#endif /* SYSCONS_SUPPORT */ +#if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__) +#if !defined(SYSCONS_SUPPORT) /* no syscons, so include pcvt specific header file */ -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# include <machine/pcvt_ioctl.h> -# else -# include <sys/pcvt_ioctl.h> -# endif /* __FreeBSD_kernel__ */ -# else /* pcvt and syscons: hard-code the ID magic */ -# define VGAPCVTID _IOWR('V',113, struct pcvtid) - struct pcvtid { - char name[16]; - int rmajor, rminor; - }; -# endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */ -# endif /* PCVT_SUPPORT */ -# ifdef WSCONS_SUPPORT -# include <dev/wscons/wsconsio.h> -# include <dev/wscons/wsdisplay_usl_io.h> -# endif /* WSCONS_SUPPORT */ -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013) -# include <sys/mouse.h> -# else -# undef MOUSE_GETINFO -# include <machine/mouse.h> -# endif -# endif +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include <machine/pcvt_ioctl.h> +#else +#include <sys/pcvt_ioctl.h> +#endif /* __FreeBSD_kernel__ */ +#else /* pcvt and syscons: hard-code the ID magic */ +#define VGAPCVTID _IOWR('V',113, struct pcvtid) +struct pcvtid { + char name[16]; + int rmajor, rminor; +}; +#endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */ +#endif /* PCVT_SUPPORT */ +#ifdef WSCONS_SUPPORT +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplay_usl_io.h> +#endif /* WSCONS_SUPPORT */ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013) +#include <sys/mouse.h> +#else +#undef MOUSE_GETINFO +#include <machine/mouse.h> +#endif +#endif /* Include these definitions in case ioctl_pc.h didn't get included */ -# ifndef CONSOLE_X_MODE_ON -# define CONSOLE_X_MODE_ON _IO('t',121) -# endif -# ifndef CONSOLE_X_MODE_OFF -# define CONSOLE_X_MODE_OFF _IO('t',122) -# endif -# ifndef CONSOLE_X_BELL -# define CONSOLE_X_BELL _IOW('t',123,int[2]) -# endif -# ifndef CONSOLE_X_TV_ON -# define CONSOLE_X_TV_ON _IOW('t',155,int) -# define XMODE_RGB 0 -# define XMODE_NTSC 1 -# define XMODE_PAL 2 -# define XMODE_SECAM 3 -# endif -# ifndef CONSOLE_X_TV_OFF -# define CONSOLE_X_TV_OFF _IO('t',156) -# endif +#ifndef CONSOLE_X_MODE_ON +#define CONSOLE_X_MODE_ON _IO('t',121) +#endif +#ifndef CONSOLE_X_MODE_OFF +#define CONSOLE_X_MODE_OFF _IO('t',122) +#endif +#ifndef CONSOLE_X_BELL +#define CONSOLE_X_BELL _IOW('t',123,int[2]) +#endif +#ifndef CONSOLE_X_TV_ON +#define CONSOLE_X_TV_ON _IOW('t',155,int) +#define XMODE_RGB 0 +#define XMODE_NTSC 1 +#define XMODE_PAL 2 +#define XMODE_SECAM 3 +#endif +#ifndef CONSOLE_X_TV_OFF +#define CONSOLE_X_TV_OFF _IO('t',156) +#endif #ifndef CONSOLE_GET_LINEAR_INFO -# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info) +#define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info) #endif -#ifndef CONSOLE_GET_IO_INFO -# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info) +#ifndef CONSOLE_GET_IO_INFO +#define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info) #endif -#ifndef CONSOLE_GET_MEM_INFO -# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info) +#ifndef CONSOLE_GET_MEM_INFO +#define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info) #endif -# endif /* !LINKKIT */ +#endif /* !LINKKIT */ #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) #include <machine/sysarch.h> #endif -# define CLEARDTR_SUPPORT +#define CLEARDTR_SUPPORT -#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ +#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ /**************************************************************************/ /* IRIX */ @@ -333,7 +331,7 @@ /* Generic */ /**************************************************************************/ -#include <sys/wait.h> /* May need to adjust this for other OSs */ +#include <sys/wait.h> /* May need to adjust this for other OSs */ /* For PATH_MAX */ #include "misc.h" @@ -343,21 +341,20 @@ * and it's safe, so just do it. */ #if !defined(O_NDELAY) && defined(O_NONBLOCK) -# define O_NDELAY O_NONBLOCK -#endif /* !O_NDELAY && O_NONBLOCK */ +#define O_NDELAY O_NONBLOCK +#endif /* !O_NDELAY && O_NONBLOCK */ #if !defined(MAXHOSTNAMELEN) -# define MAXHOSTNAMELEN 32 -#endif /* !MAXHOSTNAMELEN */ +#define MAXHOSTNAMELEN 32 +#endif /* !MAXHOSTNAMELEN */ #if defined(_POSIX_SOURCE) -# include <limits.h> +#include <limits.h> #else -# define _POSIX_SOURCE -# include <limits.h> -# undef _POSIX_SOURCE -#endif /* _POSIX_SOURCE */ - +#define _POSIX_SOURCE +#include <limits.h> +#undef _POSIX_SOURCE +#endif /* _POSIX_SOURCE */ #ifndef DEV_MEM #define DEV_MEM "/dev/mem" @@ -376,4 +373,4 @@ #include "compiler.h" #endif -#endif /* _XF86_OSLIB_H */ +#endif /* _XF86_OSLIB_H */ |