changeset 14567:f525cb411927

openbsd xf86 aperture support
author alex
date Fri, 21 Jan 2005 21:36:30 +0000
parents f38a2658bdd4
children bfdec335c4d4
files libdha/libdha.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libdha/libdha.c	Fri Jan 21 21:32:15 2005 +0000
+++ b/libdha/libdha.c	Fri Jan 21 21:36:30 2005 +0000
@@ -50,6 +50,10 @@
 #  endif
 # endif /* SVR4 */
 
+#if defined(__OpenBSD__)
+#define DEV_APERTURE "/dev/xf86"
+#endif
+
 /* Generic version */
 #include <sys/mman.h>
 
@@ -117,6 +121,20 @@
 #endif
 
 dev_mem_way:
+#ifdef DEV_APERTURE
+  if ((mem_fd = open(DEV_APERTURE, O_RDWR)) == -1)
+	perror("libdha: opening aperture failed");
+  else {
+	void *p = mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem_fd,base);
+
+	if (p == MAP_FAILED) {
+	    perror("libdha: mapping aperture failed");
+	    close(mem_fd);
+	} else
+	    return p;
+  }
+#endif
+
   if ( (mem_fd = open(DEV_MEM,O_RDWR)) == -1)
   {
     perror("libdha: opening /dev/mem failed");