summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Salinger <petr.salinger@seznam.cz>2008-10-11 20:22:28 +0200
committerJulien Cristau <jcristau@debian.org>2008-10-11 20:29:11 +0200
commit6ae378611bb4caaf57311734d3adcb7e10ac3622 (patch)
tree9ba630e37006338b3b9c2cdfc77a1f373e828467
parent968289fc3137ac0863c62d3c343153fa3e4aeb10 (diff)
downloadlibpciaccess-6ae378611bb4caaf57311734d3adcb7e10ac3622.tar.gz
libpciaccess-6ae378611bb4caaf57311734d3adcb7e10ac3622.tar.bz2
libpciaccess-6ae378611bb4caaf57311734d3adcb7e10ac3622.zip
Add support for GNU/kFreeBSD
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>
-rw-r--r--configure.ac8
-rw-r--r--src/common_init.c2
-rw-r--r--src/freebsd_pci.c12
3 files changed, 12 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 8d97ae2..1cceb14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/src/common_init.c b/src/common_init.c
index ff24183..0b799ff 100644
--- a/src/common_init.c
+++ b/src/common_init.c
@@ -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();
diff --git a/src/freebsd_pci.c b/src/freebsd_pci.c
index 4b8f7ba..352cac7 100644
--- a/src/freebsd_pci.c
+++ b/src/freebsd_pci.c
@@ -43,12 +43,6 @@
#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;