aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-03-13 04:39:12 +0800
committerjkim <jkim@FreeBSD.org>2010-03-13 04:39:12 +0800
commit474760bdfc4bca4d6b413f648d11ec1b740bf95c (patch)
tree415996d2d2c3fda667f56968ffbeaf6ceddbac8a /sysutils
parent272c4efd6dd5fb8d22f43d769f95ab3e0f4adb00 (diff)
downloadfreebsd-ports-gnome-474760bdfc4bca4d6b413f648d11ec1b740bf95c.tar.gz
freebsd-ports-gnome-474760bdfc4bca4d6b413f648d11ec1b740bf95c.tar.zst
freebsd-ports-gnome-474760bdfc4bca4d6b413f648d11ec1b740bf95c.zip
- Enable support for 16-color mode on amd64.
- Make MTRR range for write-combining always power of two. - Clear the memory range when we are exiting. Okay'ed by: nrg milk (bsdports at mail dot com) (maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/jfbterm/Makefile1
-rw-r--r--sysutils/jfbterm/files/patch-configure11
-rw-r--r--sysutils/jfbterm/files/patch-mtrr90
3 files changed, 102 insertions, 0 deletions
diff --git a/sysutils/jfbterm/Makefile b/sysutils/jfbterm/Makefile
index 0482d56bd10b..9659b7b27dc3 100644
--- a/sysutils/jfbterm/Makefile
+++ b/sysutils/jfbterm/Makefile
@@ -6,6 +6,7 @@
PORTNAME= jfbterm
PORTVERSION= 0.6.0
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://www.ac.auone-net.jp/~baba/jfbterm/ \
http://chirashi-no-ura.net/files/
diff --git a/sysutils/jfbterm/files/patch-configure b/sysutils/jfbterm/files/patch-configure
new file mode 100644
index 000000000000..2428c7605d4e
--- /dev/null
+++ b/sysutils/jfbterm/files/patch-configure
@@ -0,0 +1,11 @@
+--- configure.in.orig 2009-02-10 19:40:45.000000000 -0500
++++ configure.in 2010-02-22 16:37:33.000000000 -0500
+@@ -111,7 +111,7 @@
+ case $system in
+ Linux|FreeBSD)
+ case $machine in
+- i?86|x86_64)
++ amd64|i?86|x86_64)
+ AC_DEFINE(ENABLE_VGA16FB)
+ ;;
+ *)
diff --git a/sysutils/jfbterm/files/patch-mtrr b/sysutils/jfbterm/files/patch-mtrr
new file mode 100644
index 000000000000..021779861809
--- /dev/null
+++ b/sysutils/jfbterm/files/patch-mtrr
@@ -0,0 +1,90 @@
+--- framebuffer.c.orig 2009-02-23 18:23:54.000000000 -0500
++++ framebuffer.c 2010-02-22 19:26:38.000000000 -0500
+@@ -442,6 +442,11 @@
+ assert(initialized);
+
+ if (self->memory != MAP_FAILED) {
++ if (writecombine.enable) {
++ memctl_clearWriteCombine(writecombine.base,
++ writecombine.size);
++ writecombine.enable = false;
++ }
+ if (munmap(self->memory, self->length) == -1)
+ warn("munmap()");
+ self->memory = MAP_FAILED;
+@@ -1162,18 +1167,21 @@
+ warnx("Invalid write-combining base detected. "
+ "Start of framebuffer memory is %#x.",
+ video_adapter_info.va_window);
+- writecombine.base = video_adapter_info.va_window;
++ writecombine.base = (u_long)video_adapter_info.va_window;
+ if (writecombine.size != 0 &&
+ video_adapter_info.va_window_size != writecombine.size)
+ warnx("Invalid write-combining size detected. "
+ "Framebuffer size is %#x.",
+ video_adapter_info.va_window_size);
+ writecombine.size = video_adapter_info.va_window_size;
++ writecombine.size = powerof2(writecombine.size) ?
++ writecombine.size : 1UL << flsl(writecombine.size);
+ #endif
+- if (writecombine.base != 0 && writecombine.size != 0)
+- memctl_setWriteCombine(writecombine.base,
+- writecombine.size);
++ if (writecombine.base == 0 || writecombine.size == 0)
++ writecombine.enable = false;
+ }
++ if (writecombine.enable)
++ memctl_setWriteCombine(writecombine.base, writecombine.size);
+
+ /* VGA */
+ #ifdef ENABLE_VGA16FB
+--- memctl.c.orig 2009-01-23 10:53:36.000000000 -0500
++++ memctl.c 2010-02-22 19:26:38.000000000 -0500
+@@ -92,7 +92,7 @@
+ mem_range_desc.mr_owner[sizeof(mem_range_desc.mr_owner) - 1] =
+ '\0';
+ mem_range_op.mo_desc = &mem_range_desc;
+- mem_range_op.mo_arg[0] = 0;
++ mem_range_op.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(fd, MEMRANGE_SET, &mem_range_op) != -1)
+ result = true;
+ close(fd);
+@@ -130,3 +130,28 @@
+ #endif
+ }
+
++void memctl_clearWriteCombine(unsigned long base, unsigned long size)
++{
++#if defined (__FreeBSD__) && (defined (__amd64__) || defined (__i386__))
++ struct mem_range_desc mem_range_desc;
++ struct mem_range_op mem_range_op;
++ int fd;
++
++ assert(base != 0);
++ assert(size != 0);
++
++ privilege_on();
++ fd = open(_PATH_MEM, O_RDONLY);
++ privilege_off();
++ if (fd != -1) {
++ mem_range_desc.mr_base = base;
++ mem_range_desc.mr_len = size;
++ mem_range_op.mo_desc = &mem_range_desc;
++ mem_range_op.mo_arg[0] = MEMRANGE_SET_REMOVE;
++ if (ioctl(fd, MEMRANGE_SET, &mem_range_op) == -1)
++ warn("failed to clear mtrr (0x%lx/0x%lx)\n",
++ base, size);
++ close(fd);
++ }
++#endif
++}
+--- memctl.h.orig 2009-01-23 10:53:36.000000000 -0500
++++ memctl.h 2010-02-22 19:26:38.000000000 -0500
+@@ -31,6 +31,7 @@
+ #include <stdbool.h>
+
+ bool memctl_setWriteCombine(unsigned long base, unsigned long size);
++void memctl_clearWriteCombine(unsigned long base, unsigned long size);
+
+ #endif /* INCLUDE_MEMCTL_H */
+