summaryrefslogtreecommitdiff
blob: d2668366f3729708c32adf396495d52597a1a37f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Fixup support for FreeBSD.

Patch by Diego Petten�.

http://bugs.gentoo.org/103241

--- lib/fbsd-device.c
+++ lib/fbsd-device.c
@@ -13,10 +13,21 @@
 
 #include <fcntl.h>
 #include <string.h>
+#include <errno.h>
 #include <unistd.h>
+#include <osreldate.h>
 
-#include <pci/pcivar.h>
-#include <pci/pci_ioctl.h>
+#if __FreeBSD_version < 500000
+#  include <pci/pcivar.h>
+#else
+#  include <dev/pci/pcivar.h>
+#endif
+
+#if __FreeBSD_version < 430000
+#  include <pci/pci_ioctl.h>
+#else
+#  include <sys/pciio.h>
+#endif
 
 #include "internal.h"
 
@@ -75,8 +86,12 @@
   pi.pi_reg = pos;
   pi.pi_width = len;
 	
-  if (ioctl(d->access->fd, PCIOCREAD, &pi) < 0)
-    d->access->error("fbsd_read: ioctl(PCIOCREAD) failed");
+  if (ioctl(d->access->fd, PCIOCREAD, &pi) < 0) {
+    if (errno == ENODEV)
+      return 0;
+    else
+      d->access->error("fbsd_read: ioctl(PCIOCREAD) failed");
+  }
   
   switch (len)
     {