Date: Tue, 29 Jul 2014 23:00:11 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r363409 - head/x11-servers/xorg-server/files Message-ID: <201407292300.s6TN0Bbg016636@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn (src committer) Date: Tue Jul 29 23:00:10 2014 New Revision: 363409 URL: http://svnweb.freebsd.org/changeset/ports/363409 QAT: https://qat.redports.org/buildarchive/r363409/ Log: mmap() /dev/mem instead of /dev/console on PowerPC. Mostly this was already being done in libpciaccess, so this is functionally a no-op in most cases and unifies behavior. Besides aesthetic appeal, the ability to directly mmap() all of physical memory through /dev/console on PowerPC is about to go away on -CURRENT, which means everything should converge on /dev/mem. Approved by: kwm Modified: head/x11-servers/xorg-server/files/extra-new-arch-powerpc Modified: head/x11-servers/xorg-server/files/extra-new-arch-powerpc ============================================================================== --- head/x11-servers/xorg-server/files/extra-new-arch-powerpc Tue Jul 29 22:58:34 2014 (r363408) +++ head/x11-servers/xorg-server/files/extra-new-arch-powerpc Tue Jul 29 23:00:10 2014 (r363409) @@ -1,35 +1,70 @@ ---- ./hw/xfree86/os-support/bsd/ppc_video.c.orig 2012-05-17 12:09:03.000000000 -0500 -+++ ./hw/xfree86/os-support/bsd/ppc_video.c 2014-01-18 14:36:42.000000000 -0600 -@@ -115,17 +115,19 @@ - Bool - xf86EnableIO() +--- hw/xfree86/os-support/bsd/ppc_video.c.orig 2014-07-22 07:52:58.000000000 -0700 ++++ hw/xfree86/os-support/bsd/ppc_video.c 2014-07-22 08:00:21.000000000 -0700 +@@ -44,6 +44,8 @@ + #define DEV_MEM "/dev/xf86" + #endif + ++static int kmem = -1; ++ + static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags); + static void ppcUnmapVidMem(int, pointer, unsigned long); + +@@ -68,6 +70,17 @@ + int fd = xf86Info.consoleFd; + pointer base; + ++#ifdef __FreeBSD__ ++ if (kmem == -1) { ++ kmem = open(DEV_MEM, 2); ++ if (kmem == -1) { ++ FatalError("mapVidMem: open %s", DEV_MEM); ++ } ++ } ++ ++ fd = kmem; ++#endif ++ + #ifdef DEBUG + xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); + #endif +@@ -93,7 +106,6 @@ + int Len) { -- int fd = xf86Info.consoleFd; -+ int fd = open(DEV_MEM, O_RDWR); + int rv; +- static int kmem = -1; + + if (kmem == -1) { + kmem = open(DEV_MEM, 2); +@@ -118,6 +130,8 @@ + int fd = xf86Info.consoleFd; xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); ++ ++#ifndef __FreeBSD__ if (ioBase == MAP_FAILED) { ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xf2000000); - xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase); -+#if 0 /* Non-fatal */ - if (ioBase == MAP_FAILED) { - xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n"); +@@ -127,6 +141,12 @@ return FALSE; } -+#endif } ++#endif ++ /* ++ * Note that outl() etc. check for ioBase == MAP_FAILED, so leaving it that ++ * way (e.g. on FreeBSD) is non-fatal. ++ */ ++ return TRUE; } -@@ -135,7 +137,11 @@ + +@@ -134,8 +154,10 @@ + xf86DisableIO() { ++#ifndef __FreeBSD__ if (ioBase != MAP_FAILED) { -+#if defined(__FreeBSD__) -+ munmap(__DEVOLATILE(unsigned char *, ioBase), 0x10000); -+#else munmap(__UNVOLATILE(ioBase), 0x10000); -+#endif ioBase = MAP_FAILED; } ++#endif }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407292300.s6TN0Bbg016636>