mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
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
This commit is contained in:
parent
a1f89b6003
commit
c3246c7f70
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=363409
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user