Add support for GNU/kFreeBSD
authorPetr Salinger <petr.salinger@seznam.cz>
Sat, 11 Oct 2008 18:22:28 +0000 (20:22 +0200)
committerJulien Cristau <jcristau@debian.org>
Sat, 11 Oct 2008 18:29:11 +0000 (20:29 +0200)
We need to initialize the FreeBSD backend on GNU/kFreeBSD and detect
whether pci_io.pi_sel.pc_domain member exists.

X.Org bug#17882 <http://bugs.freedesktop.org/show_bug.cgi?id=17882>

configure.ac
src/common_init.c
src/freebsd_pci.c

index 8d97ae2..1cceb14 100644 (file)
@@ -110,6 +110,14 @@ if test "x$have_mtrr_h" = xyes; then
     AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
 fi
 
+dnl check for the pci_io.pi_sel.pc_domain
+AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
+               [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
+               [],
+               [ #include <sys/types.h>
+                 #include <sys/pciio.h>
+               ])
+
 AC_SUBST(PCIACCESS_CFLAGS)
 AC_SUBST(PCIACCESS_LIBS)
                  
index ff24183..0b799ff 100644 (file)
@@ -54,7 +54,7 @@ pci_system_init( void )
     
 #ifdef linux
     err = pci_system_linux_sysfs_create();
-#elif defined(__FreeBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
     err = pci_system_freebsd_create();
 #elif defined(__OpenBSD__)
     err = pci_system_openbsd_create();
index 4b8f7ba..352cac7 100644 (file)
 #include <sys/mman.h>
 #include <sys/memrange.h>
 
-#if __FreeBSD_version >= 700053
-#define DOMAIN_SUPPORT 1
-#else
-#define DOMAIN_SUPPORT 0
-#endif
-
 #include "pciaccess.h"
 #include "pciaccess_private.h"
 
@@ -168,7 +162,7 @@ pci_device_freebsd_read( struct pci_device * dev, void * data,
 {
     struct pci_io io;
 
-#if DOMAIN_SUPPORT
+#if HAVE_PCI_IO_PC_DOMAIN
     io.pi_sel.pc_domain = dev->domain;
 #endif
     io.pi_sel.pc_bus = dev->bus;
@@ -208,7 +202,7 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
 {
     struct pci_io io;
 
-#if DOMAIN_SUPPORT
+#if HAVE_PCI_IO_PC_DOMAIN
     io.pi_sel.pc_domain = dev->domain;
 #endif
     io.pi_sel.pc_bus = dev->bus;
@@ -488,7 +482,7 @@ pci_system_freebsd_create( void )
     for ( i = 0; i < pciconfio.num_matches; i++ ) {
        struct pci_conf *p = &pciconf[ i ];
 
-#if DOMAIN_SUPPORT
+#if HAVE_PCI_IO_PC_DOMAIN
        pci_sys->devices[ i ].base.domain = p->pc_sel.pc_domain;
 #else
        pci_sys->devices[ i ].base.domain = 0;