summaryrefslogtreecommitdiff
path: root/driver/xf86-video-intel/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-01-29 17:17:25 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-01-29 17:17:25 +0000
commit8d9e94c75a1d4651256976d0397da59188e37e5b (patch)
tree7ba5827e6a1a9e32e196b7a25c3ae1213cabf2f5 /driver/xf86-video-intel/src
parent7c90a1a39f8476ca22c5975f7aba67139134d0c8 (diff)
Add support to run intel_reg_dumper on OpenBSD.
Diffstat (limited to 'driver/xf86-video-intel/src')
-rw-r--r--driver/xf86-video-intel/src/reg_dumper/README.OpenBSD5
-rw-r--r--driver/xf86-video-intel/src/reg_dumper/main.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/driver/xf86-video-intel/src/reg_dumper/README.OpenBSD b/driver/xf86-video-intel/src/reg_dumper/README.OpenBSD
new file mode 100644
index 000000000..b3f6606fa
--- /dev/null
+++ b/driver/xf86-video-intel/src/reg_dumper/README.OpenBSD
@@ -0,0 +1,5 @@
+To use the reg dumper program on a running X server you need :
+
+- to build a kernel with 'options INSECURE' and reboot in it
+- to set 'securelevel=-1' in /etc/rc.securelevel
+- to run intel_reg_dumper as root.
diff --git a/driver/xf86-video-intel/src/reg_dumper/main.c b/driver/xf86-video-intel/src/reg_dumper/main.c
index 5c8ef9ede..46542e7a3 100644
--- a/driver/xf86-video-intel/src/reg_dumper/main.c
+++ b/driver/xf86-video-intel/src/reg_dumper/main.c
@@ -34,6 +34,13 @@
#include "reg_dumper.h"
+#ifdef __OpenBSD__
+#define DEV_APERTURE "/dev/mem"
+int devMemFd = -1;
+#include <errno.h>
+#include <fcntl.h>
+#endif
+
int main(int argc, char **argv)
{
struct pci_device *dev;
@@ -48,6 +55,15 @@ int main(int argc, char **argv)
exit(1);
}
+#ifdef __OpenBSD__
+ devMemFd = open(DEV_APERTURE, O_RDWR);
+ if (devMemFd < 0) {
+ fprintf(stderr, "Could not open aperture driver: %s\n", strerror(errno));
+ exit(1);
+ }
+ pci_system_init_dev_mem(devMemFd);
+#endif
+
/* Grab the graphics card */
dev = pci_device_find_by_slot(0, 0, 2, 0);
if (dev == NULL)