diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
commit | c0190187060808fe0ad2a09b31f4244757572ff9 (patch) | |
tree | b028697436476ae3ff34218b0b233a233d8a7818 /xserver/hw/xfree86/os-support/bsd | |
parent | 33eda071f5846d332b428de759c5b1649e9cf1ba (diff) |
Update to X server 1.14.1. Tested by many during t2k13. Thanks.
Diffstat (limited to 'xserver/hw/xfree86/os-support/bsd')
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/Makefile.in | 16 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/alpha_video.c | 222 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/arm_video.c | 121 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/bsd_agp.c | 2 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/bsd_apm.c | 26 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/bsd_init.c | 476 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c | 26 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/hp300_video.c | 2 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/hppa_video.c | 2 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/i386_video.c | 140 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/ppc_video.c | 19 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/sparc64_video.c | 34 |
12 files changed, 539 insertions, 547 deletions
diff --git a/xserver/hw/xfree86/os-support/bsd/Makefile.in b/xserver/hw/xfree86/os-support/bsd/Makefile.in index e9cae2794..e3ca02991 100644 --- a/xserver/hw/xfree86/os-support/bsd/Makefile.in +++ b/xserver/hw/xfree86/os-support/bsd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -216,13 +216,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -244,6 +240,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,6 +265,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -283,7 +281,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -382,6 +379,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -550,7 +548,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -575,9 +573,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): diff --git a/xserver/hw/xfree86/os-support/bsd/alpha_video.c b/xserver/hw/xfree86/os-support/bsd/alpha_video.c index 2fc482792..2da673c10 100644 --- a/xserver/hw/xfree86/os-support/bsd/alpha_video.c +++ b/xserver/hw/xfree86/os-support/bsd/alpha_video.c @@ -6,19 +6,19 @@ * 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 names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR 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 + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR 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. * */ @@ -67,6 +67,7 @@ memory_base(void) if (base == 0) { size_t len = sizeof(base); int error; + #ifdef __OpenBSD__ int mib[3]; @@ -76,11 +77,11 @@ memory_base(void) if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0) #else - if ((error = sysctlbyname("hw.chipset.memory", &base, &len, - 0, 0)) < 0) + if ((error = sysctlbyname("hw.chipset.memory", &base, &len, 0, 0)) < 0) #endif FatalError("xf86MapVidMem: can't find memory\n"); } + return base; } @@ -90,6 +91,7 @@ has_bwx(void) static int bwx = 0; size_t len = sizeof(bwx); int error; + #ifdef __OpenBSD__ int mib[3]; @@ -108,9 +110,9 @@ has_bwx(void) return bwx; #endif } -#else /* __NetBSD__ */ +#else /* __NetBSD__ */ static unsigned long hae_thresh = (1UL << 24); -static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */ +static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */ static struct alpha_bus_window *abw; static int abw_count = -1; @@ -130,8 +132,7 @@ has_bwx(void) if (abw_count < 0) init_abw(); - xf86Msg(X_INFO, "has_bwx = %d\n", - abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ + xf86Msg(X_INFO, "has_bwx = %d\n", abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ return abw[0].abw_abst.abst_flags & ABST_BWX; } @@ -142,8 +143,7 @@ dense_base(void) init_abw(); /* XXX check abst_flags for ABST_DENSE just to be safe? */ - xf86Msg(X_INFO, "dense base = %#lx\n", - abw[0].abw_abst.abst_sys_start); /* XXXX */ + xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */ return abw[0].abw_abst.abst_sys_start; } @@ -163,23 +163,23 @@ memory_base(void) return 0; } } -#endif /* __NetBSD__ */ +#endif /* __NetBSD__ */ -#define BUS_BASE dense_base() -#define BUS_BASE_BWX memory_base() +#define BUS_BASE dense_base() +#define BUS_BASE_BWX memory_base() /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ #ifdef __OpenBSD__ -#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n" \ +#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details" #endif static Bool useDevMem = FALSE; -static int devMemFd = -1; +static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" @@ -209,11 +209,11 @@ checkDevMem(Bool warn) /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, + MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); + munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", @@ -230,11 +230,11 @@ checkDevMem(Bool warn) #endif if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, + MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); + munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; return; @@ -254,11 +254,11 @@ checkDevMem(Bool warn) #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); -#else /* __OpenBSD__ */ +#else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), SYSCTL_MSG); -#endif /* __OpenBSD__ */ +#endif /* __OpenBSD__ */ #endif xf86ErrorF("\tlinear framebuffer access unavailable\n"); } @@ -273,12 +273,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->linearSupported = useDevMem; if (has_bwx()) { - xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n"); + xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n"); pVidMem->mapMem = mapVidMem; pVidMem->unmapMem = unmapVidMem; } else { - xf86Msg(X_PROBED,"Machine needs sparse mapping\n"); + xf86Msg(X_PROBED, "Machine needs sparse mapping\n"); pVidMem->mapMem = mapVidMemSparse; pVidMem->unmapMem = unmapVidMemSparse; #ifndef __NetBSD__ @@ -286,7 +286,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) axpSystem = bsdGetAXP(); hae_thresh = xf86AXPParams[axpSystem].hae_thresh; hae_mask = xf86AXPParams[axpSystem].hae_mask; -#endif /* __NetBSD__ */ +#endif /* __NetBSD__ */ } pVidMem->initialised = TRUE; } @@ -297,35 +297,33 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) pointer base; checkDevMem(FALSE); - Base = Base & ((1L<<32) - 1); + Base = Base & ((1L << 32) - 1); if (useDevMem) { if (devMemFd < 0) { FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM, strerror(errno)); } - base = mmap((caddr_t)0, Size, + base = mmap((caddr_t) 0, Size, (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); + MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX); if (base == MAP_FAILED) { FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); + "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno)); } return base; } /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) { + if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) { FatalError("%s: Address 0x%lx outside allowable range\n", "xf86MapVidMem", Base); } base = mmap(0, Size, (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.consoleFd, - (unsigned long)Base + BUS_BASE); + MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE); if (base == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", strerror(errno)); @@ -336,7 +334,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) static void unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { - munmap((caddr_t)Base, Size); + munmap((caddr_t) Base, Size); } /* @@ -360,20 +358,21 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, 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, devMemFd, (off_t)Base+BUS_BASE); - if ((long)ptr == -1) { + ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ, + MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE); + if ((long) ptr == -1) { xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n", DEV_MEM, Len, Base, Offset, strerror(errno)); return -1; } #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); + xf86MsgVerb(X_INFO, 3, + "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base, + ptr[0] | (ptr[1] << 8)); #endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); + (void) memcpy(Buf, (void *) (ptr + Offset), Len); + (void) munmap((caddr_t) ptr, mlen); #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" "-> %02x %02x %02x %02x...\n", @@ -382,7 +381,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return Len; } - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) extern int ioperm(unsigned long from, unsigned long num, int on); @@ -401,7 +399,7 @@ xf86DisableIO() return; } -#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ +#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ #ifdef USE_ALPHA_PIO @@ -418,7 +416,7 @@ xf86DisableIO() alpha_pci_io_enable(0); } -#endif /* USE_ALPHA_PIO */ +#endif /* USE_ALPHA_PIO */ #define vuip volatile unsigned int * @@ -429,33 +427,33 @@ extern int readDense8(pointer Base, register unsigned long Offset); extern int readDense16(pointer Base, register unsigned long Offset); extern int readDense32(pointer Base, register unsigned long Offset); extern void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, pointer Base, register unsigned long Offset); extern void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, pointer Base, register unsigned long Offset); extern void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, pointer Base, register unsigned long Offset); extern void -writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, pointer Base, register unsigned long Offset); extern void -writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, pointer Base, register unsigned long Offset); extern void -writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, pointer Base, register unsigned long Offset); static int readSparse8(pointer Base, register unsigned long Offset); static int readSparse16(pointer Base, register unsigned long Offset); static int readSparse32(pointer Base, register unsigned long Offset); static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset); + writeSparseNB8(int Value, pointer Base, register unsigned long Offset); static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset); + writeSparseNB16(int Value, pointer Base, register unsigned long Offset); static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset); + writeSparseNB32(int Value, pointer Base, register unsigned long Offset); static void -writeSparse8(int Value, pointer Base, register unsigned long Offset); + writeSparse8(int Value, pointer Base, register unsigned long Offset); static void -writeSparse16(int Value, pointer Base, register unsigned long Offset); + writeSparse16(int Value, pointer Base, register unsigned long Offset); static void -writeSparse32(int Value, pointer Base, register unsigned long Offset); + writeSparse32(int Value, pointer Base, register unsigned long Offset); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int sysarch(int, void *); @@ -474,13 +472,14 @@ sethae(u_int64_t hae) if (p.hae != hae) { p.hae = hae; - sysarch(ALPHA_SETHAE, (char *)&p); + sysarch(ALPHA_SETHAE, (char *) &p); } } #endif static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, + int flags) { static Bool was_here = FALSE; @@ -499,21 +498,19 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags xf86ReadMmio16 = readSparse16; xf86ReadMmio32 = readSparse32; - memBase = mmap((caddr_t)0, 0x100000000, + memBase = mmap((caddr_t) 0, 0x100000000, PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE); - memSBase = mmap((caddr_t)0, 0x100000000, + MAP_SHARED, devMemFd, (off_t) BUS_BASE); + memSBase = mmap((caddr_t) 0, 0x100000000, PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE_BWX); + MAP_SHARED, devMemFd, (off_t) BUS_BASE_BWX); - if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { + if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", strerror(errno)); } } - return (pointer)((unsigned long)memBase + Base); + return (pointer) ((unsigned long) memBase + Base); } static void @@ -526,8 +523,9 @@ readSparse8(pointer Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; + mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -536,7 +534,7 @@ readSparse8(pointer Base, register unsigned long Offset) sethae(msb); #endif } - result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); + result = *(vuip) ((unsigned long) memSBase + (Offset << 5)); result >>= shift; return 0xffUL & result; } @@ -548,7 +546,7 @@ readSparse16(pointer Base, register unsigned long Offset) register unsigned long msb; mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; shift = (Offset & 0x2) << 3; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -557,7 +555,8 @@ readSparse16(pointer Base, register unsigned long Offset) sethae(msb); #endif } - result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); + result = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))); result >>= shift; return 0xffffUL & result; } @@ -566,7 +565,7 @@ static int readSparse32(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(vuip)((unsigned long)Base+(Offset)); + return *(vuip) ((unsigned long) Base + (Offset)); } static void @@ -576,7 +575,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) register unsigned int b = Value & 0xffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -584,7 +583,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101; } static void @@ -594,7 +593,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) register unsigned int w = Value & 0xffffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -602,7 +601,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001; } @@ -611,7 +610,7 @@ static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(vuip)((unsigned long)Base + (Offset)) = Value; + *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } @@ -621,7 +620,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int b = Value & 0xffU; - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -629,7 +628,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101; } static void @@ -638,47 +637,47 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int w = Value & 0xffffU; - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask ; + msb = Offset & hae_mask; Offset -= msb; #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001; } static void writeSparseNB32(int Value, pointer Base, register unsigned long Offset) { - *(vuip)((unsigned long)Base + (Offset)) = Value; + *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } -_X_EXPORT void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset) - = writeDense8; -_X_EXPORT void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset) - = writeDense16; -_X_EXPORT void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset) - = writeDense32; -_X_EXPORT void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB8; -_X_EXPORT void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB16; -_X_EXPORT void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB32; -_X_EXPORT int (*xf86ReadMmio8)(pointer Base, unsigned long Offset) - = readDense8; -_X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) - = readDense16; -_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) - = readDense32; +void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset) + = writeDense8; +void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset) + = writeDense16; +void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset) + = writeDense32; +void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB8; +void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB16; +void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB32; +int (*xf86ReadMmio8) (pointer Base, unsigned long Offset) + = readDense8; +int (*xf86ReadMmio16) (pointer Base, unsigned long Offset) + = readDense16; +int (*xf86ReadMmio32) (pointer Base, unsigned long Offset) + = readDense32; /* - * Do all things that need root privileges early - * and revoke those priviledges + * Do all things that need root privileges early + * and revoke those priviledges */ _X_EXPORT void xf86PrivilegedInit(void) @@ -688,3 +687,4 @@ xf86PrivilegedInit(void) pci_system_init(); xf86OpenConsole(); } + diff --git a/xserver/hw/xfree86/os-support/bsd/arm_video.c b/xserver/hw/xfree86/os-support/bsd/arm_video.c index 0d9c41f6a..ea4e50455 100644 --- a/xserver/hw/xfree86/os-support/bsd/arm_video.c +++ b/xserver/hw/xfree86/os-support/bsd/arm_video.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.6 2003/10/07 23:14:55 herrb Exp $ */ -/* $OpenBSD: arm_video.c,v 1.9 2012/06/10 13:21:25 matthieu Exp $ */ +/* $OpenBSD: arm_video.c,v 1.10 2013/06/07 17:28:52 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -119,13 +119,14 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) if (base == MAP_FAILED) FatalError("%s: could not mmap screen [s=%lx,a=%lx] (%s)", "xf86MapVidMem", Size, Base, strerror(errno)); - + return base; } static void ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { + munmap(Base, Size); } @@ -136,24 +137,24 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { int rv; - + if (Base < 0x80000000) { xf86Msg(X_WARNING, "No VGA Base=%#lx\n", Base); return 0; } - + if (kmem == -1) { kmem = open(DEV_MEM, 2); if (kmem == -1) { FatalError("xf86ReadBIOS: open %s", DEV_MEM); } } - + #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); #endif - + lseek(kmem, Base + Offset, 0); rv = read(kmem, Buf, Len); return rv; @@ -168,7 +169,7 @@ xf86PrivilegedInit(void) int mib[2]; char buf[128]; size_t len; - + mib[0] = CTL_HW; mib[1] = HW_MACHINE; len = sizeof(buf); @@ -195,58 +196,58 @@ xf86PrivilegedInit(void) */ arm_softfloat() { - void __adddf3(); - void __addsf3(); - void __eqdf2(); - void __eqsf2(); - void __extendsfdf2(); - void __fixdfsi(); - void __fixsfsi(); - void __fixunsdfsi(); - void __fixunssfsi(); - void __floatsidf(); - void __floatsisf(); - void __gedf2(); - void __gesf2(); - void __gtdf2(); - void __gtsf2(); - void __ledf2(); - void __lesf2(); - void __ltdf2(); - void __ltsf2(); - void __nedf2(); - void __negdf2(); - void __negsf2(); - void __nesf2(); - void __subdf3(); - void __subsf3(); - void __truncdfsf2(); - - __adddf3(); - __addsf3(); - __eqdf2(); - __eqsf2(); - __extendsfdf2(); - __fixdfsi(); - __fixsfsi(); - __fixunsdfsi(); - __fixunssfsi(); - __floatsidf(); - __floatsisf(); - __gedf2(); - __gesf2(); - __gtdf2(); - __gtsf2(); - __ledf2(); - __lesf2(); - __ltdf2(); - __ltsf2(); - __nedf2(); - __negdf2(); - __negsf2(); - __nesf2(); - __subdf3(); - __subsf3(); - __truncdfsf2(); +void __adddf3(); +void __addsf3(); +void __eqdf2(); +void __eqsf2(); +void __extendsfdf2(); +void __fixdfsi(); +void __fixsfsi(); +void __fixunsdfsi(); +void __fixunssfsi(); +void __floatsidf(); +void __floatsisf(); +void __gedf2(); +void __gesf2(); +void __gtdf2(); +void __gtsf2(); +void __ledf2(); +void __lesf2(); +void __ltdf2(); +void __ltsf2(); +void __nedf2(); +void __negdf2(); +void __negsf2(); +void __nesf2(); +void __subdf3(); +void __subsf3(); +void __truncdfsf2(); + +__adddf3(); +__addsf3(); +__eqdf2(); +__eqsf2(); +__extendsfdf2(); +__fixdfsi(); +__fixsfsi(); +__fixunsdfsi(); +__fixunssfsi(); +__floatsidf(); +__floatsisf(); +__gedf2(); +__gesf2(); +__gtdf2(); +__gtsf2(); +__ledf2(); +__lesf2(); +__ltdf2(); +__ltsf2(); +__nedf2(); +__negdf2(); +__negsf2(); +__nesf2(); +__subdf3(); +__subsf3(); +__truncdfsf2(); } #endif /* __VFP_FP__ */ diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c index c32a5bc56..122035a07 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bsd_agp.c,v 1.5 2012/06/10 13:21:25 matthieu Exp $ */ +/* $OpenBSD: bsd_agp.c,v 1.6 2013/06/07 17:28:52 matthieu Exp $ */ /* * Abstraction of the AGP GART interface. * diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c index a8a4164e0..b1938cf0d 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c @@ -21,21 +21,19 @@ static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { - { - APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { - APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { - APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { - APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, + {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, + {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, + {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { - APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_init.c b/xserver/hw/xfree86/os-support/bsd/bsd_init.c index b78912191..0c4501a25 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_init.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_init.c @@ -47,7 +47,9 @@ static Bool KeepTty = FALSE; +#ifdef PCCONS_SUPPORT static int devConsoleFd = -1; +#endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) static int VTnum = -1; static int initialVT = -1; @@ -104,7 +106,6 @@ static char *supported_drivers[] = { #endif }; - /* * Functions to probe for the existance of a supported console driver. * Any function returns either a valid file descriptor (driver probed @@ -113,19 +114,19 @@ static char *supported_drivers[] = { * an X server. */ -typedef int (*xf86ConsOpen_t)(void); +typedef int (*xf86ConsOpen_t) (void); #ifdef PCCONS_SUPPORT static int xf86OpenPccons(void); -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #ifdef SYSCONS_SUPPORT static int xf86OpenSyscons(void); -#endif /* SYSCONS_SUPPORT */ +#endif /* SYSCONS_SUPPORT */ #ifdef PCVT_SUPPORT static int xf86OpenPcvt(void); -#endif /* PCVT_SUPPORT */ +#endif /* PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT static int xf86OpenWScons(void); @@ -150,17 +151,18 @@ static xf86ConsOpen_t xf86ConsTab[] = { #ifdef WSCONS_SUPPORT xf86OpenWScons, #endif - (xf86ConsOpen_t)NULL + (xf86ConsOpen_t) NULL }; - void xf86OpenConsole() { int i, fd = -1; xf86ConsOpen_t *driver; + #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) int result; + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) struct utsname uts; #endif @@ -171,50 +173,50 @@ xf86OpenConsole() return; } if (serverGeneration == 1) { - /* check if we are run with euid==0 */ - if (geteuid() != 0 && issetugid()) { - FatalError("xf86OpenConsole: Server must either be suid root" + /* check if we are run with euid==0 */ + if (geteuid() != 0 && issetugid()) { + FatalError("xf86OpenConsole: Server must either be suid root" " or without privileges at all"); - } - - if (!KeepTty) { - /* - * detaching the controlling tty solves problems of kbd character - * loss. This is not interesting for CO driver, because it is - * exclusive. - */ - setpgrp(0, getpid()); - if ((i = open("/dev/tty",O_RDWR)) >= 0) { - ioctl(i,TIOCNOTTY,(char *)0); - close(i); - } - } - - /* detect which driver we are running on */ - for (driver = xf86ConsTab; *driver; driver++) { - if ((fd = (*driver)()) >= 0) - break; - } - - /* Check that a supported console driver was found */ - if (fd < 0) { - char cons_drivers[80] = {0, }; - for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) { - if (i) { - strcat(cons_drivers, ", "); - } - strcat(cons_drivers, supported_drivers[i]); - } - FatalError - ("%s: No console driver found\n\tSupported drivers: %s\n\t%s", - "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); - } - xf86Info.consoleFd = fd; - - switch (xf86Info.consType) { + } + + if (!KeepTty) { + /* + * detaching the controlling tty solves problems of kbd character + * loss. This is not interesting for CO driver, because it is + * exclusive. + */ + setpgrp(0, getpid()); + if ((i = open("/dev/tty",O_RDWR)) >= 0) { + ioctl(i,TIOCNOTTY,(char *)0); + close(i); + } + } + + /* detect which driver we are running on */ + for (driver = xf86ConsTab; *driver; driver++) { + if ((fd = (*driver)()) >= 0) + break; + } + + /* Check that a supported console driver was found */ + if (fd < 0) { + char cons_drivers[80] = {0, }; + for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) { + if (i) { + strcat(cons_drivers, ", "); + } + strcat(cons_drivers, supported_drivers[i]); + } + FatalError( + "%s: No console driver found\n\tSupported drivers: %s\n\t%s", + "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); + } + xf86Info.consoleFd = fd; + + switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS: - if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) { + if (ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) { FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s", "xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG); @@ -223,7 +225,7 @@ xf86OpenConsole() * Hack to prevent keyboard hanging when syslogd closes * /dev/console */ - if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0) { + if ((devConsoleFd = open("/dev/console", O_WRONLY, 0)) < 0) { xf86Msg(X_WARNING, "xf86OpenConsole: couldn't open /dev/console (%s)\n", strerror(errno)); @@ -235,31 +237,32 @@ xf86OpenConsole() /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt * switching anymore. Here we check for FreeBSD 3.1 and up. * Add cases for other *BSD that behave the same. - */ + */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - uname (&uts); + uname(&uts); i = atof(uts.release) * 100; - if (i >= 310) goto acquire_vt; + if (i >= 310) + goto acquire_vt; #endif /* otherwise fall through */ case PCVT: #if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000)) /* - * First activate the #1 VT. This is a hack to allow a server - * to be started while another one is active. There should be - * a better way. - */ - if (initialVT != 1) { - - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) { - xf86Msg(X_WARNING, + * First activate the #1 VT. This is a hack to allow a server + * to be started while another one is active. There should be + * a better way. + */ + if (initialVT != 1) { + + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) { + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - sleep(1); - } + } + sleep(1); + } #endif acquire_vt: - if (!xf86Info.ShareVTs) { + if (!xf86Info.ShareVTs) { /* * now get the VT */ @@ -275,7 +278,7 @@ acquire_vt: } signal(SIGUSR2, xf86VTRequest); - + vtmode.mode = VT_PROCESS; vtmode.relsig = SIGUSR2; vtmode.acqsig = SIGUSR2; @@ -292,21 +295,21 @@ acquire_vt: if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed"); } - } + } else { /* xf86Info.ShareVTs */ close(xf86Info.consoleFd); - } - break; + } + break; #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT - case WSCONS: - /* Nothing to do */ - break; + case WSCONS: + /* Nothing to do */ + break; #endif } } else { - /* serverGeneration != 1 */ + /* serverGeneration != 1 */ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (!xf86Info.ShareVTs && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)) { @@ -314,12 +317,11 @@ acquire_vt: xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); } } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ } return; } - #ifdef PCCONS_SUPPORT static int @@ -328,16 +330,14 @@ xf86OpenPccons() int fd = -1; if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0)) - >= 0 || - (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0)) + >= 0 || (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0)) >= 0) { if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0) { - FatalError( - "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s", - "xf86OpenPccons", - strerror(errno), - "Was expecting pccons driver with X support", - CHECK_DRIVER_MSG); + FatalError("%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s", + "xf86OpenPccons", + strerror(errno), + "Was expecting pccons driver with X support", + CHECK_DRIVER_MSG); } xf86Info.consType = PCCONS; xf86Msg(X_PROBED, "Using pccons driver with X support\n"); @@ -345,7 +345,7 @@ xf86OpenPccons() return fd; } -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #ifdef SYSCONS_SUPPORT @@ -394,68 +394,67 @@ xf86OpenSyscons() xf86Info.vtno = -1; } #if 0 - } + } #endif - - if (xf86Info.vtno == -1) { - /* - * All VTs are in use. If initialVT was found, use it. - */ - if (initialVT != -1) { - xf86Info.vtno = initialVT; - } + + if (xf86Info.vtno == -1) { + /* + * All VTs are in use. If initialVT was found, use it. + */ + if (initialVT != -1) { + xf86Info.vtno = initialVT; + } else { - if (syscons_version >= 0x100) { - FatalError("%s: Cannot find a free VT", - "xf86OpenSyscons"); - } - /* Should no longer reach here */ - FatalError("%s: %s %s\n\t%s %s", - "xf86OpenSyscons", - "syscons versions prior to 1.0 require", - "either the", - "server's stdin be a VT", - "or the use of the vtxx server option"); - } - } - from = X_PROBED; - } - - close(fd); + if (syscons_version >= 0x100) { + FatalError("%s: Cannot find a free VT", + "xf86OpenSyscons"); + } + /* Should no longer reach here */ + FatalError("%s: %s %s\n\t%s %s", + "xf86OpenSyscons", + "syscons versions prior to 1.0 require", + "either the", + "server's stdin be a VT", + "or the use of the vtxx server option"); + } + } + from = X_PROBED; + } + + close(fd); #ifndef __OpenBSD__ - snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1); + snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1); #else - sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1); -#endif - if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) { - FatalError("xf86OpenSyscons: Cannot open %s (%s)", - vtname, strerror(errno)); - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("xf86OpenSyscons: VT_GETMODE failed"); - } - xf86Info.consType = SYSCONS; - xf86Msg(X_PROBED, "Using syscons driver with X support"); - if (syscons_version >= 0x100) { - xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8, - syscons_version & 0xFF); - } + sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1); +#endif + if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) { + FatalError("xf86OpenSyscons: Cannot open %s (%s)", + vtname, strerror(errno)); + } + if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("xf86OpenSyscons: VT_GETMODE failed"); + } + xf86Info.consType = SYSCONS; + xf86Msg(X_PROBED, "Using syscons driver with X support"); + if (syscons_version >= 0x100) { + xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8, + syscons_version & 0xFF); + } else { - xf86ErrorF(" (version 0.x)\n"); - } - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - } + xf86ErrorF(" (version 0.x)\n"); + } + xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); + } else { - /* VT_GETMODE failed, probably not syscons */ - close(fd); - fd = -1; - } + /* VT_GETMODE failed, probably not syscons */ + close(fd); + fd = -1; + } } return fd; } -#endif /* SYSCONS_SUPPORT */ - +#endif /* SYSCONS_SUPPORT */ #ifdef PCVT_SUPPORT @@ -475,11 +474,11 @@ xf86OpenPcvt() #endif if (VTnum != -1) { - snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1); - fd = open(vtname, PCVT_CONSOLE_MODE, 0); - } + snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1); + fd = open(vtname, PCVT_CONSOLE_MODE, 0); + } else { - fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); + fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); } #ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV if (fd < 0) { @@ -488,55 +487,55 @@ xf86OpenPcvt() } #endif if (fd >= 0) { - if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) { - if(ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("%s: VT_GETMODE failed\n%s%s\n%s", - "xf86OpenPcvt", - "Found pcvt driver but X11 seems to be", - " not supported.", CHECK_DRIVER_MSG); - } - - xf86Info.vtno = VTnum; - - if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) - initialVT = -1; - - if (xf86Info.vtno == -1) { - if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) { - /* No free VTs */ - xf86Info.vtno = -1; - } - - if (xf86Info.vtno == -1) { - /* - * All VTs are in use. If initialVT was found, use it. - */ - if (initialVT != -1) { - xf86Info.vtno = initialVT; - } + if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) { + if(ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("%s: VT_GETMODE failed\n%s%s\n%s", + "xf86OpenPcvt", + "Found pcvt driver but X11 seems to be", + " not supported.", CHECK_DRIVER_MSG); + } + + xf86Info.vtno = VTnum; + + if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) + initialVT = -1; + + if (xf86Info.vtno == -1) { + if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) { + /* No free VTs */ + xf86Info.vtno = -1; + } + + if (xf86Info.vtno == -1) { + /* + * All VTs are in use. If initialVT was found, use it. + */ + if (initialVT != -1) { + xf86Info.vtno = initialVT; + } else { - FatalError("%s: Cannot find a free VT", - "xf86OpenPcvt"); - } - } - } + FatalError("%s: Cannot find a free VT", + "xf86OpenPcvt"); + } + } + } - close(fd); + close(fd); snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); - if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { - ErrorF("xf86OpenPcvt: Cannot open %s (%s)", - vtname, strerror(errno)); - xf86Info.vtno = initialVT; - snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); - if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { - FatalError("xf86OpenPcvt: Cannot open %s (%s)", - vtname, strerror(errno)); - } - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("xf86OpenPcvt: VT_GETMODE failed"); - } - xf86Info.consType = PCVT; + if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { + ErrorF("xf86OpenPcvt: Cannot open %s (%s)", + vtname, strerror(errno)); + xf86Info.vtno = initialVT; + snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); + if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { + FatalError("xf86OpenPcvt: Cannot open %s (%s)", + vtname, strerror(errno)); + } + } + if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("xf86OpenPcvt: VT_GETMODE failed"); + } + xf86Info.consType = PCVT; #ifdef WSCONS_SUPPORT xf86Msg(X_PROBED, "Using wscons driver on %s in pcvt compatibility mode " @@ -556,7 +555,7 @@ xf86OpenPcvt() return fd; } -#endif /* PCVT_SUPPORT */ +#endif /* PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT @@ -576,31 +575,30 @@ xf86OpenWScons() mib[1] = KERN_CONSDEV; len = sizeof(dev); if (sysctl(mib, 2, &dev, &len, NULL, 0) != -1) { - snprintf(ttyname, sizeof(ttyname), "/dev/%s", devname(dev, S_IFCHR)); - if ((fd = open(ttyname, 2)) != -1) { - if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == -1) { - close(fd); - fd = -1; - } - } + snprintf(ttyname, sizeof(ttyname), "/dev/%s", devname(dev, S_IFCHR)); + if ((fd = open(ttyname, 2)) != -1) { + if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == -1) { + close(fd); + fd = -1; + } + } } #endif if (fd == -1) { - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { #if defined(__NetBSD__) - snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i); + snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i); #elif defined(__OpenBSD__) - snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i); + snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i); #endif - if ((fd = open(ttyname, 2)) != -1) - break; + if ((fd = open(ttyname, 2)) != -1) + break; } } if (fd != -1) { if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) { FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s", - "xf86OpenConsole", strerror(errno), - CHECK_DRIVER_MSG); + "xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG); } xf86Info.consType = WSCONS; xf86Msg(X_PROBED, "Using wscons driver\n"); @@ -608,23 +606,24 @@ xf86OpenWScons() return fd; } -#endif /* WSCONS_SUPPORT */ +#endif /* WSCONS_SUPPORT */ void xf86CloseConsole() { #if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) - struct vt_mode VT; + struct vt_mode VT; #endif - if (xf86Info.ShareVTs) return; + if (xf86Info.ShareVTs) + return; switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS: - ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0); + ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0); break; -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) case SYSCONS: case PCVT: @@ -633,7 +632,7 @@ xf86CloseConsole() VT.mode = VT_AUTO; ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ } -#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) +#if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) { xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)", strerror(errno)); @@ -642,13 +641,15 @@ xf86CloseConsole() if (initialVT != -1) ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT); break; -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT - case WSCONS: { + case WSCONS: + { int mode = WSDISPLAYIO_MODE_EMUL; + ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode); break; - } + } #endif } @@ -667,7 +668,7 @@ int xf86ProcessArgument(int argc, char *argv[], int i) { /* - * Keep server from detaching from controlling tty. This is useful + * Keep server from detaching from controlling tty. This is useful * when debugging (so the server can receive keyboard signals. */ if (!strcmp(argv[i], "-keeptty")) { @@ -676,15 +677,14 @@ xf86ProcessArgument(int argc, char *argv[], int i) } #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || - VTnum < 1 || VTnum > 12) { + if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) { UseMsg(); VTnum = -1; return 0; } return 1; } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ return 0; } @@ -693,7 +693,7 @@ xf86UseMsg() { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) ErrorF("vtXX use the specified VT number (1-12)\n"); -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); return; @@ -709,29 +709,29 @@ xf86UseMsg() void xf86DropPriv(char *disp) { - struct passwd *pw; - - /* revoke privileges */ - if (getuid() == 0) { - /* Running as root */ - pw = getpwnam("_x11"); - if (!pw) - return; - /* give away lock file to unpriviledged user */ - if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) { - FatalError("Chown Lock"); - } - - /* Start privileged child */ - if (priv_init(pw->pw_uid, pw->pw_gid) == -1) { - FatalError("priv_init"); - } - } - else { - /* Normal user */ - if (priv_init(getuid(), getgid()) == -1) { - FatalError("priv_init"); - } - } + struct passwd *pw; + + /* revoke privileges */ + if (getuid() == 0) { + /* Running as root */ + pw = getpwnam("_x11"); + if (!pw) + return; + /* give away lock file to unpriviledged user */ + if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) { + FatalError("Chown Lock"); + } + + /* Start privileged child */ + if (priv_init(pw->pw_uid, pw->pw_gid) == -1) { + FatalError("priv_init"); + } + } + else { + /* Normal user */ + if (priv_init(getuid(), getgid()) == -1) { + FatalError("priv_init"); + } + } } #endif diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c index 79703c5d7..8417c335a 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c @@ -54,21 +54,19 @@ static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { - { - APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { - APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { - APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { - APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, + {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, + {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, + {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { - APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; diff --git a/xserver/hw/xfree86/os-support/bsd/hp300_video.c b/xserver/hw/xfree86/os-support/bsd/hp300_video.c index 83292e202..8850378e6 100644 --- a/xserver/hw/xfree86/os-support/bsd/hp300_video.c +++ b/xserver/hw/xfree86/os-support/bsd/hp300_video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp300_video.c,v 1.4 2012/06/16 15:08:08 matthieu Exp $ */ +/* $OpenBSD: hp300_video.c,v 1.5 2013/06/07 17:28:52 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> diff --git a/xserver/hw/xfree86/os-support/bsd/hppa_video.c b/xserver/hw/xfree86/os-support/bsd/hppa_video.c index 111eec527..2938b1d26 100644 --- a/xserver/hw/xfree86/os-support/bsd/hppa_video.c +++ b/xserver/hw/xfree86/os-support/bsd/hppa_video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hppa_video.c,v 1.7 2012/06/16 15:08:08 matthieu Exp $ */ +/* $OpenBSD: hppa_video.c,v 1.8 2013/06/07 17:28:52 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> diff --git a/xserver/hw/xfree86/os-support/bsd/i386_video.c b/xserver/hw/xfree86/os-support/bsd/i386_video.c index f7057c625..3141e27c1 100644 --- a/xserver/hw/xfree86/os-support/bsd/i386_video.c +++ b/xserver/hw/xfree86/os-support/bsd/i386_video.c @@ -65,12 +65,12 @@ #ifdef __OpenBSD__ #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" #define SYSCTL_MSG2 \ - "Check that you have set 'machdep.allowaperture=2'\n" \ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" + "Check that you have set 'machdep.allowaperture=2'\n" \ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" #endif /***************************************************************************/ @@ -78,7 +78,7 @@ /***************************************************************************/ static Bool useDevMem = FALSE; -static int devMemFd = -1; +static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" @@ -108,18 +108,18 @@ checkDevMem(Bool warn) static Bool devMemChecked = FALSE; int fd; pointer base; - + if (devMemChecked) return; devMemChecked = TRUE; - + #ifdef HAS_APERTURE_DRV /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000); - + if (base != MAP_FAILED) { munmap((caddr_t)base, 4096); devMemFd = fd; @@ -140,7 +140,7 @@ checkDevMem(Bool warn) /* Try to map a page at the VGA address */ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000); - + if (base != MAP_FAILED) { munmap((caddr_t)base, 4096); devMemFd = fd; @@ -162,13 +162,13 @@ checkDevMem(Bool warn) #else #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); + "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); #else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), SYSCTL_MSG); #endif /* __OpenBSD__ */ - + xf86ErrorF("\tlinear framebuffer access unavailable\n"); } useDevMem = FALSE; @@ -206,9 +206,9 @@ static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; - + checkDevMem(FALSE); - + if (useDevMem) { if (devMemFd < 0) { FatalError("xf86MapVidMem: failed to open %s (%s)", @@ -246,7 +246,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) static void unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { - munmap((caddr_t)Base, Size); + munmap((caddr_t) Base, Size); } /* @@ -260,12 +260,12 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, unsigned char *ptr; int psize; int mlen; - + checkDevMem(TRUE); if (devMemFd == -1) { return -1; } - + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); @@ -287,8 +287,8 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base, ptr[0] | (ptr[1] << 8)); #endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); + (void) memcpy(Buf, (void *) (ptr + Offset), Len); + (void) munmap((caddr_t) ptr, mlen); #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" "-> %02x %02x %02x %02x...\n", @@ -310,13 +310,12 @@ xf86EnableIO() if (ExtendedEnabled) return TRUE; - if (i386_iopl(TRUE) < 0) - { + if (i386_iopl(TRUE) < 0) { #ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; @@ -337,11 +336,10 @@ xf86DisableIO() } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ - return; } -#endif /* USE_I386_IOPL */ +#endif /* USE_I386_IOPL */ #ifdef USE_AMD64_IOPL /***************************************************************************/ @@ -358,10 +356,10 @@ xf86EnableIO() if (amd64_iopl(TRUE) < 0) { #ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; @@ -376,17 +374,17 @@ xf86DisableIO() { if (!ExtendedEnabled) return; - + if (amd64_iopl(FALSE) == 0) { ExtendedEnabled = FALSE; } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ - + return; } -#endif /* USE_AMD64_IOPL */ +#endif /* USE_AMD64_IOPL */ #ifdef USE_DEV_IO static int IoFd = -1; @@ -398,7 +396,7 @@ xf86EnableIO() return TRUE; if ((IoFd = open("/dev/io", O_RDWR)) == -1) { - xf86Msg(X_WARNING,"xf86EnableIO: " + xf86Msg(X_WARNING, "xf86EnableIO: " "Failed to open /dev/io for extended I/O"); return FALSE; } @@ -427,17 +425,18 @@ xf86SetTVOut(int mode) { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT - case PCCONS:{ - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to TV output, %s\n", - strerror(errno)); - } - } - break; + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to TV output, %s\n", + strerror(errno)); + } + } + break; #endif /* PCCONS_SUPPORT */ - default: + default: FatalError("Xf86SetTVOut: Unsupported console"); break; } @@ -449,17 +448,18 @@ xf86SetRGBOut() { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT - case PCCONS:{ - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to RGB output, %s\n", - strerror(errno)); - } - } - break; + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to RGB output, %s\n", + strerror(errno)); + } + } + break; #endif /* PCCONS_SUPPORT */ - default: + default: FatalError("Xf86SetTVOut: Unsupported console"); break; } @@ -528,8 +528,8 @@ cleanMTRR() (mrd[i].mr_flags & MDF_ACTIVE)) { #ifdef DEBUG ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)mrd[i].mr_len); + (unsigned long) mrd[i].mr_base, + (unsigned long) mrd[i].mr_len); #endif if (mrd[i].mr_flags & MDF_FIXACTIVE) { mro.mo_arg[0] = MEMRANGE_SET_UPDATE; @@ -624,15 +624,16 @@ sortRangeList(RangePtr list) */ static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) +findRanges(unsigned long base, unsigned long size, RangePtr * ucp, + RangePtr * wcp) { struct mem_range_desc *mrd; int nmr, i; RangePtr rp, *p; - + if (!(mrd = getAllRanges(&nmr))) return; - + for (i = 0; i < nmr; i++) { if ((mrd[i].mr_flags & MDF_ACTIVE) && mrd[i].mr_base < base + size && @@ -691,17 +692,17 @@ addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) RangePtr uc = NULL, wc = NULL, retlist = NULL; struct mem_range_desc mrd; struct mem_range_op mro; - + findRanges(base, size, &uc, &wc); - + /* See of the full range is already WC */ if (!uc && fullCoverage(base, size, wc)) { xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", + "Write-combining range (0x%lx,0x%lx) was already set\n", base, size); return NULL; } - + /* Otherwise, try to add the new range */ mrd.mr_base = base; mrd.mr_len = size; @@ -732,20 +733,20 @@ delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) RangePtr uc = NULL, wc = NULL, retlist = NULL; struct mem_range_desc mrd; struct mem_range_op mro; - + findRanges(base, size, &uc, &wc); - + /* * See of the full range is already not WC, or if there is full * coverage from UC ranges. */ if (!wc || fullCoverage(base, size, uc)) { xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", + "Write-combining range (0x%lx,0x%lx) was already clear\n", base, size); return NULL; } - + /* Otherwise, try to add the new range */ mrd.mr_base = base; mrd.mr_len = size; @@ -793,8 +794,8 @@ undoWC(int screenNum, pointer list) while (rp) { #ifdef DEBUG ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); + (unsigned long) rp->mrd.mr_base, + (unsigned long) rp->mrd.mr_len, rp->wasWC); #endif failed = FALSE; if (rp->wasWC) { @@ -821,15 +822,14 @@ undoWC(int screenNum, pointer list) if (failed) { xf86DrvMsg(screenNum, X_WARNING, "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); + (unsigned long) rp->mrd.mr_base, + (unsigned long) rp->mrd.mr_len); } rp = rp->next; } } -#endif /* HAS_MTRR_SUPPORT */ - +#endif /* HAS_MTRR_SUPPORT */ #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) static pointer @@ -843,7 +843,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, "%s MTRR %lx - %lx\n", enable ? "set" : "remove", base, (base + size)); - mtrrp = xnfalloc(sizeof (struct mtrr)); + mtrrp = xnfalloc(sizeof(struct mtrr)); mtrrp->base = base; mtrrp->len = size; mtrrp->type = MTRR_TYPE_WC; @@ -870,7 +870,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, static void NetBSDundoWC(int screenNum, pointer list) { - struct mtrr *mtrrp = (struct mtrr *)list; + struct mtrr *mtrrp = (struct mtrr *) list; int n; if (mtrrp == NULL) diff --git a/xserver/hw/xfree86/os-support/bsd/ppc_video.c b/xserver/hw/xfree86/os-support/bsd/ppc_video.c index 7790774d1..9c256f53f 100644 --- a/xserver/hw/xfree86/os-support/bsd/ppc_video.c +++ b/xserver/hw/xfree86/os-support/bsd/ppc_video.c @@ -56,24 +56,25 @@ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { xf86OpenConsole(); - + pVidMem->linearSupported = TRUE; pVidMem->mapMem = ppcMapVidMem; pVidMem->unmapMem = ppcUnmapVidMem; pVidMem->initialised = TRUE; - + pci_system_init_dev_mem(xf86Info.consoleFd); xf86EnableIO(); } -_X_EXPORT volatile unsigned char *ioBase = MAP_FAILED; +volatile unsigned char *ioBase = MAP_FAILED; static pointer ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; pointer base; + #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); @@ -103,7 +104,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { int rv; - + if (Base < 0x80000000) { xf86Msg(X_WARNING, "No VGA Base=%#lx\n", Base); return 0; @@ -117,18 +118,15 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, } #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", - Base, Offset, Len); + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); #endif - lseek(kmem, Base + Offset, 0); rv = read(kmem, Buf, Len); return rv; } - #ifdef X_PRIVSEP /* * Do all initialisation that need root privileges @@ -155,7 +153,7 @@ Bool xf86EnableIO() xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); if (ioBase == MAP_FAILED) { - ioBase = mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, + ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xf2000000); xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase); if (ioBase == MAP_FAILED) { @@ -166,7 +164,8 @@ Bool xf86EnableIO() return TRUE; } -void xf86DisableIO() +void +xf86DisableIO() { if (ioBase != MAP_FAILED) { diff --git a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c index 39ccc7a6b..c500f5e11 100644 --- a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c @@ -6,19 +6,19 @@ * 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 names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR 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 + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR 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. * */ @@ -61,14 +61,12 @@ sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, pointer base; #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", - Base, Size, fd); + xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); #endif base = mmap(0, Size, (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, Base); + PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base); if (base == MAP_FAILED) FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)", "xf86MapVidMem", Size, Base, strerror(errno)); @@ -91,13 +89,13 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, #ifdef X_PRIVSEP /* - * Do all things that need root privileges early - * and revoke those privileges + * Do all things that need root privileges early + * and revoke those privileges */ _X_EXPORT void xf86PrivilegedInit(void) { - pci_system_init(); - xf86OpenConsole(); + pci_system_init(); + xf86OpenConsole(); } #endif |