pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/43487: sysutils/915resolution fix for DragonFly
>Number: 43487
>Category: pkg
>Synopsis: sysutils/915resolution fix for DragonFly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Jun 17 14:25:00 +0000 2010
>Originator: Alexander Polakov
>Release: n/a
>Organization:
>Environment:
>Description:
915resolution is disabled for DragonFly and FreeBSD due to missing iopl().
This can be worked around with a patch attached (not tested on FreeBSD, but
inspired by this:
http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/915resolution/files/patch-915resolution.c?rev=1.2;content-type=text/plain)
Build and works fine, tested on DragonFly with my ASUS Eee netbook.
>How-To-Repeat:
>Fix:
--- 915resolution.c.orig 2007-04-15 14:46:56 +0400
+++ 915resolution.c 2010-06-17 18:04:11 +0400
@@ -22,11 +22,57 @@
#include <string.h>
#include <sys/mman.h>
#include <fcntl.h>
+#ifdef __linux__
#include <sys/io.h>
+#endif
+#ifdef __NetBSD__
+#include <machine/pio.h>
+#include <machine/sysarch.h>
+# if defined(__i386__)
+#define iopl(a) i386_iopl(a)
+# elif defined(__x86_64__)
+#define iopl(a) x86_64_iopl(a)
+# endif
+#endif
#include <unistd.h>
#include <assert.h>
+static uint8_t
+asm_inb(unsigned port)
+{
+ uint8_t data;
+ __asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static __inline void
+asm_outb(uint8_t data, unsigned port)
+{
+ __asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
+}
+
+static uint32_t
+asm_inl(unsigned port)
+{
+ uint32_t data;
+ __asm volatile("inl %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+static __inline void
+asm_outl(uint32_t data, unsigned port)
+{
+ __asm volatile("outl %0,%w1" : : "a" (data), "d" (port));
+}
+
+#undef inb
+#undef outb
+#define inb asm_inb
+#define outb asm_outb
+#undef inl
+#undef outl
+#define inl asm_inl
+#define outl asm_outl
#define NEW(a) ((a *)(calloc(1, sizeof(a))))
#define FREE(a) (free(a))
@@ -165,7 +211,12 @@
void initialize_system(char * filename) {
if (!filename) {
+#if !defined(__FreeBSD__) & !defined(__DragonFly__)
if (iopl(3) < 0) {
+#else
+ FILE *iof = fopen("/dev/io", "r");
+ if(iof == NULL) {
+#endif
perror("Unable to obtain the proper IO permissions");
exit(2);
}
Home |
Main Index |
Thread Index |
Old Index