pkgsrc/graphics/cqcam/patches/patch-ab
joerg c207c3f459 - DESTDIR support
- Fix build on !i386
- Fix build with modular Xorg
- Honour rpath flags
- Bump revision
2008-10-01 22:12:01 +00:00

72 lines
1.5 KiB
Text

$NetBSD: patch-ab,v 1.6 2008/10/01 22:12:01 joerg Exp $
--- libcqcam/port.C.orig 2000-08-23 20:03:19.000000000 +0200
+++ libcqcam/port.C
@@ -30,6 +30,7 @@
#include "config.h"
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#ifdef LOCKING
@@ -47,6 +48,10 @@
#include <conio.h>
#elif defined(FREEBSD)
#include <machine/cpufunc.h>
+#elif defined(NETBSD)
+#include <sys/types.h>
+#include <machine/sysarch.h>
+#include <machine/pio.h> /* XXX */
#elif defined(BSDI)
#include <machine/inline.h>
#elif defined(OPENBSD)
@@ -90,6 +95,28 @@ port_t::port_t(int iport) {
perror("fopen /dev/io");
return;
}
+#elif defined(NETBSD)
+# if defined(__alpha__)
+ if (alpha_pci_io_enable(1) != 0) {
+ perror("alpha_pci_io_enable");
+ return;
+ }
+# elif defined(__i386__)
+ if (i386_iopl(3) != 0) {
+ perror("i386_iopl");
+ return;
+ }
+# elif defined(__x86_64__)
+ if (x86_64_iopl(3) != 0) {
+ perror("x86_64_iopl");
+ return;
+ }
+# else
+# error Not supported on this CPU.
+# endif
+#elif defined(LYNX)
+ if (io_access() < 0) {
+ perror("io_access");
#elif defined(OPENBSD)
if (i386_iopl(1) == -1) {
perror("i386_iopl");
@@ -196,3 +223,19 @@ void port_t::unlock(int portnum) {
#endif /* DEBUG */
}
#endif /* LOCKING */
+
+#if defined(NETBSD)
+void
+outb(unsigned port, uint8_t data)
+{
+ __asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
+}
+
+uint8_t
+inb(unsigned port)
+{
+ uint8_t data;
+ __asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+#endif