diff options
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/shared')
5 files changed, 250 insertions, 250 deletions
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 f3ddb29c9..be47cd681 100644 --- a/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c +++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c @@ -38,23 +38,23 @@ Bool
xf86VTSwitchPending(void)
{
- return(FALSE);
+ return FALSE;
}
Bool
xf86VTSwitchAway(void)
{
- return(FALSE);
+ return FALSE;
}
Bool
xf86VTSwitchTo(void)
{
- return(TRUE);
+ return TRUE;
}
Bool
xf86VTActivate(int vtno)
{
- return(TRUE);
+ 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 34bca7ae2..00bfb7151 100644 --- a/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c +++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c @@ -55,7 +55,7 @@ xf86VTRequest(int sig) Bool
xf86VTSwitchPending(void)
{
- return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+ return xf86Info.vtRequestsPending ? TRUE : FALSE;
}
Bool
@@ -64,14 +64,14 @@ xf86VTSwitchAway(void) xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
{
- return(FALSE);
+ return FALSE;
}
else
{
#ifdef OSSWITCHAWAY
OSSWITCHAWAY;
#endif
- return(TRUE);
+ return TRUE;
}
}
@@ -81,11 +81,11 @@ xf86VTSwitchTo(void) xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
{
- return(FALSE);
+ return FALSE;
}
else
{
- return(TRUE);
+ return TRUE;
}
}
@@ -94,8 +94,8 @@ xf86VTActivate(int vtno) {
#ifdef VT_ACTIVATE
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
- return(FALSE);
+ return FALSE;
}
#endif
- return(TRUE);
+ return TRUE;
}
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c b/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c index 67a14f5d6..4699fcb88 100644 --- a/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c +++ b/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c @@ -1,75 +1,75 @@ -/* - * Copyright 1993 by David Wexelblat <dwex@goblin.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" -#include <string.h> - -/* - * Read BIOS via /dev/mem. - */ - -#ifndef DEV_MEM -# define DEV_MEM "/dev/mem" -#endif - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - -#ifdef __ia64__ - if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0) -#else - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) -#endif - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - - if (lseek(fd, (Base+Offset), SEEK_SET) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } - if (read(fd, Buf, Len) != Len) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } - close(fd); - return(Len); -} +/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.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"
+#include <string.h>
+
+/*
+ * Read BIOS via /dev/mem.
+ */
+
+#ifndef DEV_MEM
+# define DEV_MEM "/dev/mem"
+#endif
+
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int fd;
+
+#ifdef __ia64__
+ if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0)
+#else
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+#endif
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+
+ if (lseek(fd, (Base+Offset), SEEK_SET) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ if (read(fd, Buf, Len) != Len)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return Len;
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c index 40afd5b8e..a5887f578 100644 --- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c +++ b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c @@ -1,141 +1,141 @@ -/* - * Copyright 1993 by David Wexelblat <dwex@goblin.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" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -#ifndef __alpha__ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - psize = getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n", - DEV_MEM, strerror(errno)); - close(fd); - return(-1); - } - DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - -#else /* __alpha__ */ - - /* - * We trick "mmap" into mapping BUS memory for us via BUS_BASE, - * which is the KSEG address of the start of the DENSE memory - * area. - */ - - /* - * NOTE: there prolly ought to be more validity checks and all - * re: boundaries and sizes and such... - */ - -#ifdef linux - -extern unsigned long _bus_base(void); -#define BUS_BASE _bus_base() - -#else - -extern u_int64_t dense_base(void); -#define BUS_BASE dense_base() - -#endif - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - caddr_t base; - int fd; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - - psize = getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - base = mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)(Base + BUS_BASE)); - - if (base == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - return(-1); - } - - xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len); - - munmap((caddr_t)base, mlen); - close(fd); - return(Len); -} - -#endif /* __alpha__ */ +/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.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"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/*
+ * Read BIOS via mmap()ing DEV_MEM
+ */
+
+#ifndef __alpha__
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int fd;
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t)Base);
+ if (ptr == MAP_FAILED)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+ (void)close(fd);
+ return Len;
+}
+
+#else /* __alpha__ */
+
+ /*
+ * We trick "mmap" into mapping BUS memory for us via BUS_BASE,
+ * which is the KSEG address of the start of the DENSE memory
+ * area.
+ */
+
+ /*
+ * NOTE: there prolly ought to be more validity checks and all
+ * re: boundaries and sizes and such...
+ */
+
+#ifdef linux
+
+extern unsigned long _bus_base(void);
+#define BUS_BASE _bus_base()
+
+#else
+
+extern u_int64_t dense_base(void);
+#define BUS_BASE dense_base()
+
+#endif
+
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ caddr_t base;
+ int fd;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ base = mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t)(Base + BUS_BASE));
+
+ if (base == MAP_FAILED)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+
+ xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len);
+
+ munmap((caddr_t)base, mlen);
+ close(fd);
+ return Len;
+}
+
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c index 7e2c4a181..97860d0f2 100644 --- a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c +++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c @@ -108,7 +108,7 @@ GetBaud (int baudrate) if (baudrate == 460800)
return B460800;
#endif
- return (0);
+ return 0;
}
int
@@ -122,7 +122,7 @@ xf86OpenSerial (pointer options) if (!dev)
{
xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n");
- return (-1);
+ return -1;
}
SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK));
@@ -132,14 +132,14 @@ xf86OpenSerial (pointer options) "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
dev, strerror (errno));
free(dev);
- return (-1);
+ return -1;
}
if (!isatty (fd))
{
/* Allow non-tty devices to be opened. */
free(dev);
- return (fd);
+ return fd;
}
/* set up default port parameters */
@@ -162,7 +162,7 @@ xf86OpenSerial (pointer options) {
SYSCALL (close (fd));
free(dev);
- return (-1);
+ return -1;
}
SYSCALL (i = fcntl (fd, F_GETFL, 0));
@@ -170,7 +170,7 @@ xf86OpenSerial (pointer options) {
SYSCALL (close (fd));
free(dev);
- return (-1);
+ return -1;
}
i &= ~O_NONBLOCK;
SYSCALL (i = fcntl (fd, F_SETFL, i));
@@ -178,10 +178,10 @@ xf86OpenSerial (pointer options) {
SYSCALL (close (fd));
free(dev);
- return (-1);
+ return -1;
}
free(dev);
- return (fd);
+ return fd;
}
int
@@ -212,7 +212,7 @@ xf86SetSerial (int fd, pointer options) {
xf86Msg (X_ERROR,
"Invalid Option BaudRate value: %d\n", val);
- return (-1);
+ return -1;
}
}
@@ -229,7 +229,7 @@ xf86SetSerial (int fd, pointer options) default:
xf86Msg (X_ERROR,
"Invalid Option StopBits value: %d\n", val);
- return (-1);
+ return -1;
break;
}
}
@@ -257,7 +257,7 @@ xf86SetSerial (int fd, pointer options) default:
xf86Msg (X_ERROR,
"Invalid Option DataBits value: %d\n", val);
- return (-1);
+ return -1;
break;
}
}
@@ -281,7 +281,7 @@ xf86SetSerial (int fd, pointer options) {
xf86Msg (X_ERROR, "Invalid Option Parity value: %s\n",
s);
- return (-1);
+ return -1;
}
}
@@ -317,7 +317,7 @@ xf86SetSerial (int fd, pointer options) {
xf86Msg (X_ERROR,
"Invalid Option FlowControl value: %s\n", s);
- return (-1);
+ return -1;
}
}
@@ -333,7 +333,7 @@ xf86SetSerial (int fd, pointer options) #else
xf86Msg (X_WARNING,
"Option ClearDTR not supported on this OS\n");
- return (-1);
+ return -1;
#endif
xf86MarkOptionUsedByName (options, "ClearDTR");
}
@@ -342,12 +342,12 @@ xf86SetSerial (int fd, pointer options) {
xf86Msg (X_WARNING,
"Option ClearRTS not supported on this OS\n");
- return (-1);
+ return -1;
xf86MarkOptionUsedByName (options, "ClearRTS");
}
SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
- return (r);
+ return r;
}
int
@@ -374,11 +374,11 @@ xf86SetSerialSpeed (int fd, int speed) {
xf86Msg (X_ERROR,
"Invalid Option BaudRate value: %d\n", speed);
- return (-1);
+ return -1;
}
SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
- return (r);
+ return r;
}
int
@@ -393,7 +393,7 @@ xf86ReadSerial (int fd, void *buf, int count) for (i = 1; i < r; i++)
DebugF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
DebugF("\n");
- return (r);
+ return r;
}
int
@@ -407,7 +407,7 @@ xf86WriteSerial (int fd, const void *buf, int count) ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
DebugF("\n");
SYSCALL (r = write (fd, buf, count));
- return (r);
+ return r;
}
int
@@ -416,7 +416,7 @@ xf86CloseSerial (int fd) int r;
SYSCALL (r = close (fd));
- return (r);
+ return r;
}
int
@@ -442,7 +442,7 @@ xf86WaitForInput (int fd, int timeout) SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to));
}
xf86ErrorFVerb (9,"select returned %d\n", r);
- return (r);
+ return r;
}
int
@@ -451,7 +451,7 @@ xf86SerialSendBreak (int fd, int duration) int r;
SYSCALL (r = tcsendbreak (fd, duration));
- return (r);
+ return r;
}
|