summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-10-10 14:32:09 -0700
committerEric Anholt <eric@anholt.net>2007-10-10 14:32:09 -0700
commit393145db90578d7d598fccf949b249217066a67c (patch)
tree9463ca7b9557061d2d05fd264a8bbe796d6f5dcb /src
parent7d809e149b59f22e24723db7360a4c38a9145b45 (diff)
FreeBSD: Add support for multiple PCI domains.
Diffstat (limited to 'src')
-rw-r--r--src/freebsd_pci.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/freebsd_pci.c b/src/freebsd_pci.c
index b703936..e51b9c5 100644
--- a/src/freebsd_pci.c
+++ b/src/freebsd_pci.c
@@ -38,10 +38,17 @@
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/pciio.h>
#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"
@@ -154,6 +161,9 @@ pci_device_freebsd_read( struct pci_device * dev, void * data,
{
struct pci_io io;
+#if DOMAIN_SUPPORT
+ io.pi_sel.pc_domain = dev->domain;
+#endif
io.pi_sel.pc_bus = dev->bus;
io.pi_sel.pc_dev = dev->dev;
io.pi_sel.pc_func = dev->func;
@@ -191,6 +201,9 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
{
struct pci_io io;
+#if DOMAIN_SUPPORT
+ io.pi_sel.pc_domain = dev->domain;
+#endif
io.pi_sel.pc_bus = dev->bus;
io.pi_sel.pc_dev = dev->dev;
io.pi_sel.pc_func = dev->func;
@@ -467,7 +480,11 @@ pci_system_freebsd_create( void )
for ( i = 0; i < pciconfio.num_matches; i++ ) {
struct pci_conf *p = &pciconf[ i ];
- pci_sys->devices[ i ].base.domain = 0; /* XXX */
+#if DOMAIN_SUPPORT
+ pci_sys->devices[ i ].base.domain = p->pc_sel.pc_domain;
+#else
+ pci_sys->devices[ i ].base.domain = 0;
+#endif
pci_sys->devices[ i ].base.bus = p->pc_sel.pc_bus;
pci_sys->devices[ i ].base.dev = p->pc_sel.pc_dev;
pci_sys->devices[ i ].base.func = p->pc_sel.pc_func;