Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2007 13:33:04 GMT
From:      Marius Strobl <marius@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 127020 for review
Message-ID:  <200709301333.l8UDX4nt096384@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127020

Change 127020 by marius@flak on 2007/09/30 13:32:36

	IFC @127017 in order to obtain support for PCI domains.

Affected files ...

.. //depot/projects/usiii/amd64/amd64/legacy.c#2 integrate
.. //depot/projects/usiii/amd64/include/legacyvar.h#2 integrate
.. //depot/projects/usiii/amd64/pci/pci_bus.c#2 integrate
.. //depot/projects/usiii/arm/arm/locore.S#2 integrate
.. //depot/projects/usiii/arm/conf/AVILA#2 integrate
.. //depot/projects/usiii/arm/xscale/i80321/i80321_pci.c#2 integrate
.. //depot/projects/usiii/arm/xscale/i8134x/i81342_pci.c#2 integrate
.. //depot/projects/usiii/arm/xscale/ixp425/files.ixp425#2 integrate
.. //depot/projects/usiii/arm/xscale/ixp425/ixp425_npe.c#2 integrate
.. //depot/projects/usiii/arm/xscale/ixp425/ixp425_npevar.h#2 integrate
.. //depot/projects/usiii/arm/xscale/ixp425/ixp425_pci.c#2 integrate
.. //depot/projects/usiii/contrib/dev/npe/IxNpeMicrocode.dat.uu#1 branch
.. //depot/projects/usiii/contrib/dev/npe/LICENSE#1 branch
.. //depot/projects/usiii/dev/acpica/acpi_pci.c#2 integrate
.. //depot/projects/usiii/dev/acpica/acpi_pcib_acpi.c#2 integrate
.. //depot/projects/usiii/dev/bge/if_bge.c#3 integrate
.. //depot/projects/usiii/dev/cardbus/cardbus.c#2 integrate
.. //depot/projects/usiii/dev/pccbb/pccbb.c#2 integrate
.. //depot/projects/usiii/dev/pccbb/pccbb_pci.c#2 integrate
.. //depot/projects/usiii/dev/pccbb/pccbbvar.h#2 integrate
.. //depot/projects/usiii/dev/pci/pci.c#3 integrate
.. //depot/projects/usiii/dev/pci/pci_pci.c#2 integrate
.. //depot/projects/usiii/dev/pci/pci_private.h#2 integrate
.. //depot/projects/usiii/dev/pci/pci_user.c#2 integrate
.. //depot/projects/usiii/dev/pci/pcib_private.h#2 integrate
.. //depot/projects/usiii/dev/pci/pcivar.h#3 integrate
.. //depot/projects/usiii/geom/geom_event.c#2 integrate
.. //depot/projects/usiii/i386/i386/legacy.c#2 integrate
.. //depot/projects/usiii/i386/include/legacyvar.h#2 integrate
.. //depot/projects/usiii/i386/pci/pci_bus.c#2 integrate
.. //depot/projects/usiii/kern/sched_ule.c#3 integrate
.. //depot/projects/usiii/netinet/ip_fw2.c#3 integrate
.. //depot/projects/usiii/powerpc/powermac/grackle.c#2 integrate
.. //depot/projects/usiii/powerpc/powermac/uninorth.c#2 integrate
.. //depot/projects/usiii/sparc64/pci/apb.c#2 integrate
.. //depot/projects/usiii/sparc64/pci/ofw_pcibus.c#4 integrate
.. //depot/projects/usiii/sparc64/pci/psycho.c#4 integrate
.. //depot/projects/usiii/sun4v/sun4v/hv_pci.c#2 integrate
.. //depot/projects/usiii/sys/param.h#2 integrate
.. //depot/projects/usiii/sys/pciio.h#2 integrate
.. //depot/projects/usiii/vm/vm_object.c#3 integrate
.. //depot/projects/usiii/vm/vm_page.c#3 integrate
.. //depot/projects/usiii/vm/vm_page.h#3 integrate

Differences ...

==== //depot/projects/usiii/amd64/amd64/legacy.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.60 2007/03/20 20:21:44 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.61 2007/09/30 11:05:13 marius Exp $");
 
 /*
  * This code implements a system driver for legacy systems that do not
@@ -207,6 +207,9 @@
 	struct legacy_device *atdev = DEVTOAT(child);
 
 	switch (which) {
+	case LEGACY_IVAR_PCIDOMAIN:
+		*result = 0;
+		break;
 	case LEGACY_IVAR_PCIBUS:
 		*result = atdev->lg_pcibus;
 		break;
@@ -223,6 +226,8 @@
 	struct legacy_device *atdev = DEVTOAT(child);
 
 	switch (which) {
+	case LEGACY_IVAR_PCIDOMAIN:
+		return EINVAL;
 	case LEGACY_IVAR_PCIBUS:
 		atdev->lg_pcibus = value;
 		break;

==== //depot/projects/usiii/amd64/include/legacyvar.h#2 (text+ko) ====

@@ -23,19 +23,21 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/legacyvar.h,v 1.7 2005/09/18 01:42:43 imp Exp $
+ * $FreeBSD: src/sys/amd64/include/legacyvar.h,v 1.8 2007/09/30 11:05:13 marius Exp $
  */
 
 #ifndef _MACHINE_LEGACYVAR_H_
 #define	_MACHINE_LEGACYVAR_H_
 
 enum legacy_device_ivars {
+	LEGACY_IVAR_PCIDOMAIN,
 	LEGACY_IVAR_PCIBUS
 };
 
 #define LEGACY_ACCESSOR(var, ivar, type)				\
     __BUS_ACCESSOR(legacy, var, LEGACY, ivar, type)
 
+LEGACY_ACCESSOR(pcidomain,		PCIDOMAIN,	uint32_t)
 LEGACY_ACCESSOR(pcibus,			PCIBUS,		uint32_t)
 
 #undef LEGACY_ACCESSOR

==== //depot/projects/usiii/amd64/pci/pci_bus.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/pci/pci_bus.c,v 1.121 2007/05/02 17:50:34 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/pci/pci_bus.c,v 1.122 2007/09/30 11:05:13 marius Exp $");
 
 #include "opt_cpu.h"
 
@@ -276,6 +276,9 @@
 {
 
 	switch (which) {
+	case  PCIB_IVAR_DOMAIN:
+		*result = 0;
+		return 0;
 	case  PCIB_IVAR_BUS:
 		*result = legacy_get_pcibus(dev);
 		return 0;
@@ -289,6 +292,8 @@
 {
 
 	switch (which) {
+	case  PCIB_IVAR_DOMAIN:
+		return EINVAL;
 	case  PCIB_IVAR_BUS:
 		legacy_set_pcibus(dev, value);
 		return 0;

==== //depot/projects/usiii/arm/arm/locore.S#2 (text+ko) ====

@@ -37,7 +37,7 @@
 #include <machine/asm.h>
 #include <machine/armreg.h>
 #include <machine/pte.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/locore.S,v 1.16 2007/02/26 02:03:48 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/locore.S,v 1.17 2007/09/27 20:52:17 cognet Exp $");
 
 /* What size should this really be ? It is only used by initarm() */
 #define INIT_ARM_STACK_SIZE	2048
@@ -134,7 +134,7 @@
 	adds	r1, r1, #-1
 	bhi	2b
 3:
-	ldmia	r4!, {r1,r2,r3}   /* # of sections, PA|attr, VA */
+	ldmia	r4!, {r1,r2,r3}   /* # of sections, VA, PA|attr */
 	cmp	r1, #0
 	adrne	r5, 2b
 	bicne	r5, r5, #0xff000000

==== //depot/projects/usiii/arm/conf/AVILA#2 (text+ko) ====

@@ -16,7 +16,7 @@
 # If you are in doubt as to the purpose or necessity of a line, check first 
 # in NOTES.
 #
-# $FreeBSD: src/sys/arm/conf/AVILA,v 1.4 2007/05/24 16:27:48 sam Exp $
+# $FreeBSD: src/sys/arm/conf/AVILA,v 1.6 2007/09/27 22:39:49 cognet Exp $
 
 machine		arm
 ident		AVILA
@@ -104,8 +104,8 @@
 device		avila_ata	# Gateworks CF/IDE support
 
 device		npe		# Network Processing Engine
-device		npe_fw		# NPE firmware
-device		firmware	# firmware support for npe_fw
+device		npe_fw
+device		firmware
 device		qmgr		# Q Manager (required by npe)
 device		miibus		# NB: required by npe
 device		ether

==== //depot/projects/usiii/arm/xscale/i80321/i80321_pci.c#2 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_pci.c,v 1.11 2007/07/27 14:53:42 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_pci.c,v 1.12 2007/09/30 11:05:13 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,8 +250,10 @@
 {
 	struct i80321_pci_softc *sc = device_get_softc(dev);
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		*result = 0;
+		return (0);
 	case PCIB_IVAR_BUS:
-
 		*result = sc->sc_busno;
 		return (0);
 		
@@ -265,6 +267,8 @@
 	struct i80321_pci_softc * sc = device_get_softc(dev);
 
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		return (EINVAL);
 	case PCIB_IVAR_BUS:
 		sc->sc_busno = result;
 		return (0);

==== //depot/projects/usiii/arm/xscale/i8134x/i81342_pci.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/i8134x/i81342_pci.c,v 1.1 2007/07/27 14:50:57 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/i8134x/i81342_pci.c,v 1.2 2007/09/30 11:05:14 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -481,8 +481,10 @@
 {
 	struct i81342_pci_softc *sc = device_get_softc(dev);
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		*result = 0;
+		return (0);
 	case PCIB_IVAR_BUS:
-
 		*result = sc->sc_busno;
 		return (0);
 		
@@ -496,6 +498,8 @@
 	struct i81342_pci_softc * sc = device_get_softc(dev);
 
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		return (EINVAL);
 	case PCIB_IVAR_BUS:
 		sc->sc_busno = result;
 		return (0);

==== //depot/projects/usiii/arm/xscale/ixp425/files.ixp425#2 (text+ko) ====

@@ -1,4 +1,4 @@
-#$FreeBSD: src/sys/arm/xscale/ixp425/files.ixp425,v 1.2 2006/12/07 00:49:33 sam Exp $
+#$FreeBSD: src/sys/arm/xscale/ixp425/files.ixp425,v 1.4 2007/09/27 22:39:49 cognet Exp $
 arm/arm/cpufunc_asm_xscale.S		standard
 arm/arm/irq_dispatch.S			standard
 arm/xscale/ixp425/ixp425.c		standard
@@ -16,12 +16,7 @@
 arm/xscale/ixp425/ixp425_a4x_io.S	optional	uart
 dev/uart/uart_dev_ns8250.c		optional	uart
 #
-# NPE-based Ethernet support (requires qmgr also).  Note the
-# firmware images must be downloaded from the Intel web site.
-# The URL seems to change frequently; try this as a starting
-# place:
-#
-# http://www.intel.com/design/network/products/npfamily/download_ixp400.htm
+# NPE-based Ethernet support (requires qmgr also).
 #
 arm/xscale/ixp425/if_npe.c		optional npe
 arm/xscale/ixp425/ixp425_npe.c		optional npe
@@ -41,7 +36,7 @@
 	clean		"IxNpeMicrocode.fwo"
 IxNpeMicrocode.dat			optional npe_fw			\
 	dependency	".PHONY"					\
-	compile-with	"if [ -e $S/arm/xscale/ixp425/IxNpeMicrocode.dat ]; then ln -sf $S/arm/xscale/ixp425/IxNpeMicrocode.dat .; else echo 'WARNING, no IxNpeMicrocode.dat file; you must obtain this from the Intel web site'; false; fi" \
+	compile-with	"uudecode < $S/contrib/dev/npe/IxNpeMicrocode.dat.uu" \
 	no-obj no-implicit-rule						\
 	clean		"IxNpeMicrocode.dat"
 #

==== //depot/projects/usiii/arm/xscale/ixp425/ixp425_npe.c#2 (text+ko) ====

@@ -57,7 +57,7 @@
  * SUCH DAMAGE.
 */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.6 2007/05/24 16:31:22 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.8 2007/09/27 22:39:49 cognet Exp $");
 
 /*
  * Intel XScale Network Processing Engine (NPE) support.

==== //depot/projects/usiii/arm/xscale/ixp425/ixp425_npevar.h#2 (text+ko) ====

@@ -21,7 +21,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npevar.h,v 1.2 2007/05/24 16:31:22 sam Exp $
+ * $FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npevar.h,v 1.4 2007/09/27 22:39:49 cognet Exp $
  */
 
 #ifndef _IXP425_NPEVAR_H_

==== //depot/projects/usiii/arm/xscale/ixp425/ixp425_pci.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_pci.c,v 1.4 2007/03/06 10:58:22 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_pci.c,v 1.5 2007/09/30 11:05:14 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -229,6 +229,9 @@
 
 	sc = device_get_softc(dev);
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		*result = 0;
+		return (0);
 	case PCIB_IVAR_BUS:
 		*result = sc->sc_bus;
 		return (0);
@@ -244,6 +247,8 @@
 
 	sc = device_get_softc(dev);
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		return (EINVAL);
 	case PCIB_IVAR_BUS:
 		sc->sc_bus = value;
 		return (0);

==== //depot/projects/usiii/dev/acpica/acpi_pci.c#2 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.30 2006/05/11 22:13:20 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.31 2007/09/30 11:05:14 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -275,17 +275,19 @@
 static int
 acpi_pci_attach(device_t dev)
 {
-	int busno;
+	int busno, domain;
 
 	/*
 	 * Since there can be multiple independantly numbered PCI
 	 * busses on systems with multiple PCI domains, we can't use
 	 * the unit number to decide which bus we are probing. We ask
-	 * the parent pcib what our bus number is.
+	 * the parent pcib what our domain and bus numbers are.
 	 */
+	domain = pcib_get_domain(dev);
 	busno = pcib_get_bus(dev);
 	if (bootverbose)
-		device_printf(dev, "physical bus=%d\n", busno);
+		device_printf(dev, "domain=%d, physical bus=%d\n",
+		    domain, busno);
 
 	/*
 	 * First, PCI devices are added as in the normal PCI bus driver.
@@ -297,7 +299,7 @@
 	 * pci_add_children() doesn't find.  We currently just ignore
 	 * these devices.
 	 */
-	pci_add_children(dev, busno, sizeof(struct acpi_pci_devinfo));
+	pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo));
 	AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
 	    acpi_pci_save_handle, dev, NULL);
 

==== //depot/projects/usiii/dev/acpica/acpi_pcib_acpi.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pcib_acpi.c,v 1.54 2007/05/02 17:50:35 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pcib_acpi.c,v 1.55 2007/09/30 11:05:14 marius Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -259,6 +259,9 @@
     struct acpi_hpcib_softc	*sc = device_get_softc(dev);
 
     switch (which) {
+    case PCIB_IVAR_DOMAIN:
+	*result = 0;
+	return (0);
     case PCIB_IVAR_BUS:
 	*result = sc->ap_bus;
 	return (0);
@@ -278,6 +281,8 @@
     struct acpi_hpcib_softc	*sc = device_get_softc(dev);
 
     switch (which) {
+    case PCIB_IVAR_DOMAIN:
+	return (EINVAL);
     case PCIB_IVAR_BUS:
 	sc->ap_bus = value;
 	return (0);

==== //depot/projects/usiii/dev/bge/if_bge.c#3 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.197 2007/06/04 18:25:03 dwmalone Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.198 2007/09/30 11:05:14 marius Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -2180,16 +2180,15 @@
 static int
 bge_has_multiple_ports(struct bge_softc *sc)
 {
-	device_t dev, p;
-	u_int b, s, f, fscan;
+	device_t dev = sc->bge_dev;
+	u_int b, d, f, fscan, s;
 
-	dev = sc->bge_dev;
-	p = device_get_parent(device_get_parent(dev));
+	d = pci_get_domain(dev);
 	b = pci_get_bus(dev);
 	s = pci_get_slot(dev);
 	f = pci_get_function(dev);
 	for (fscan = 0; fscan <= PCI_FUNCMAX; fscan++)
-		if (fscan != f && pci_find_pbsf(p, b, s, fscan) != NULL)
+		if (fscan != f && pci_find_dbsf(d, b, s, fscan) != NULL)
 			return (1);
 	return (0);
 }

==== //depot/projects/usiii/dev/cardbus/cardbus.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.65 2007/05/16 23:40:08 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.66 2007/09/30 11:05:14 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,12 +162,13 @@
 {
 	device_t brdev = device_get_parent(cbdev);
 	device_t child;
+	int bus, domain, slot, func;
 	int cardattached = 0;
-	int bus, slot, func;
 	int cardbusfunchigh = 0;
 
 	cardbus_detach_card(cbdev); /* detach existing cards */
 	POWER_ENABLE_SOCKET(brdev, cbdev);
+	domain = pcib_get_domain(cbdev);
 	bus = pcib_get_bus(cbdev);
 	slot = 0;
 	/* For each function, set it up and try to attach a driver to it */
@@ -175,7 +176,7 @@
 		struct cardbus_devinfo *dinfo;
 
 		dinfo = (struct cardbus_devinfo *)
-		    pci_read_device(brdev, bus, slot, func,
+		    pci_read_device(brdev, domain, bus, slot, func,
 			sizeof(struct cardbus_devinfo));
 		if (dinfo == NULL)
 			continue;

==== //depot/projects/usiii/dev/pccbb/pccbb.c#2 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.164 2007/06/04 05:59:44 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.165 2007/09/30 11:05:15 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1470,6 +1470,9 @@
 	struct cbb_softc *sc = device_get_softc(brdev);
 
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		*result = sc->domain;
+		return (0);
 	case PCIB_IVAR_BUS:
 		*result = sc->secbus;
 		return (0);
@@ -1483,6 +1486,8 @@
 	struct cbb_softc *sc = device_get_softc(brdev);
 
 	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		return (EINVAL);
 	case PCIB_IVAR_BUS:
 		sc->secbus = value;
 		return (0);

==== //depot/projects/usiii/dev/pccbb/pccbb_pci.c#2 (text+ko) ====

@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb_pci.c,v 1.25 2007/06/04 05:59:44 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb_pci.c,v 1.26 2007/09/30 11:05:15 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -316,6 +316,7 @@
 	sc->dev = brdev;
 	sc->cbdev = NULL;
 	sc->exca[0].pccarddev = NULL;
+	sc->domain = pci_get_domain(brdev);
 	sc->secbus = pci_read_config(brdev, PCIR_SECBUS_2, 1);
 	sc->subbus = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
 	sc->pribus = pcib_get_bus(parent);
@@ -346,6 +347,8 @@
 	/*Sysctls*/
 	sctx = device_get_sysctl_ctx(brdev);
 	soid = device_get_sysctl_tree(brdev);
+	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "domain",
+	    CTLFLAG_RD, &sc->domain, 0, "Domain number");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus",
 	    CTLFLAG_RD, &sc->pribus, 0, "Primary bus number");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus",

==== //depot/projects/usiii/dev/pccbb/pccbbvar.h#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pccbb/pccbbvar.h,v 1.31 2007/06/04 05:59:44 imp Exp $
+ * $FreeBSD: src/sys/dev/pccbb/pccbbvar.h,v 1.32 2007/09/30 11:05:15 marius Exp $
  */
 
 /*
@@ -62,6 +62,7 @@
 	void		*intrhand;
 	bus_space_tag_t bst;
 	bus_space_handle_t bsh;
+	uint32_t	domain;
 	unsigned int	pribus;
 	unsigned int	secbus;
 	unsigned int	subbus;

==== //depot/projects/usiii/dev/pci/pci.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.354 2007/07/29 02:44:41 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.355 2007/09/30 11:05:15 marius Exp $");
 
 #include "opt_bus.h"
 
@@ -274,34 +274,24 @@
 SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD,
     &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI");
 
-/* Find a device_t by bus/slot/function */
+/* Find a device_t by bus/slot/function in domain 0 */
 
 device_t
 pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t func)
 {
-	struct pci_devinfo *dinfo;
 
-	STAILQ_FOREACH(dinfo, &pci_devq, pci_links) {
-		if ((dinfo->cfg.bus == bus) &&
-		    (dinfo->cfg.slot == slot) &&
-		    (dinfo->cfg.func == func)) {
-			return (dinfo->cfg.dev);
-		}
-	}
-
-	return (NULL);
+	return (pci_find_dbsf(0, bus, slot, func));
 }
 
-/* Find a device_t by pcib/bus/slot/function */
+/* Find a device_t by domain/bus/slot/function */
 
 device_t
-pci_find_pbsf(device_t pcib, uint8_t bus, uint8_t slot, uint8_t func)
+pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func)
 {
 	struct pci_devinfo *dinfo;
 
 	STAILQ_FOREACH(dinfo, &pci_devq, pci_links) {
-		if ((device_get_parent(device_get_parent(dinfo->cfg.dev)) ==
-		    pcib) &&
+		if ((dinfo->cfg.domain == domain) &&
 		    (dinfo->cfg.bus == bus) &&
 		    (dinfo->cfg.slot == slot) &&
 		    (dinfo->cfg.func == func)) {
@@ -436,7 +426,7 @@
 
 /* read configuration header into pcicfgregs structure */
 struct pci_devinfo *
-pci_read_device(device_t pcib, int b, int s, int f, size_t size)
+pci_read_device(device_t pcib, int d, int b, int s, int f, size_t size)
 {
 #define	REG(n, w)	PCIB_READ_CONFIG(pcib, b, s, f, n, w)
 	pcicfgregs *cfg = NULL;
@@ -454,6 +444,7 @@
 
 		cfg = &devlist_entry->cfg;
 
+		cfg->domain		= d;
 		cfg->bus		= b;
 		cfg->slot		= s;
 		cfg->func		= f;
@@ -485,6 +476,7 @@
 
 		STAILQ_INSERT_TAIL(devlist_head, devlist_entry, pci_links);
 
+		devlist_entry->conf.pc_sel.pc_domain = cfg->domain;
 		devlist_entry->conf.pc_sel.pc_bus = cfg->bus;
 		devlist_entry->conf.pc_sel.pc_dev = cfg->slot;
 		devlist_entry->conf.pc_sel.pc_func = cfg->func;
@@ -571,9 +563,10 @@
 					    4);
 					if (addr != MSI_INTEL_ADDR_BASE)
 						device_printf(pcib,
-		    "HT Bridge at %d:%d:%d has non-default MSI window 0x%llx\n",
-						    cfg->bus, cfg->slot,
-						    cfg->func, (long long)addr);
+	    "HT Bridge at pci%d:%d:%d:%d has non-default MSI window 0x%llx\n",
+						    cfg->domain, cfg->bus,
+						    cfg->slot, cfg->func,
+						    (long long)addr);
 				}
 
 				/* Enable MSI -> HT mapping. */
@@ -750,9 +743,9 @@
 				if (remain > (0x7f*4 - vrs.off)) {
 					end = 1;
 					printf(
-			    "pci%d:%d:%d: invalid vpd data, remain %#x\n",
-					    cfg->bus, cfg->slot, cfg->func,
-					    remain);
+			    "pci%d:%d:%d:%d: invalid vpd data, remain %#x\n",
+					    cfg->domain, cfg->bus, cfg->slot,
+					    cfg->func, remain);
 				}
 				name = byte & 0x7f;
 			} else {
@@ -817,8 +810,10 @@
 				 * if this happens, we can't trust the rest
 				 * of the VPD.
 				 */
-				printf("pci%d:%d:%d: bad keyword length: %d\n",
-				    cfg->bus, cfg->slot, cfg->func, dflen);
+				printf(
+				    "pci%d:%d:%d:%d: bad keyword length: %d\n",
+				    cfg->domain, cfg->bus, cfg->slot,
+				    cfg->func, dflen);
 				cksumvalid = 0;
 				end = 1;
 				break;
@@ -851,9 +846,9 @@
 					cksumvalid = 1;
 				else {
 					printf(
-				    "pci%d:%d:%d: bad VPD cksum, remain %hhu\n",
-					    cfg->bus, cfg->slot, cfg->func,
-					    vrs.cksum);
+				"pci%d:%d:%d:%d: bad VPD cksum, remain %hhu\n",
+					    cfg->domain, cfg->bus, cfg->slot,
+					    cfg->func, vrs.cksum);
 					cksumvalid = 0;
 					end = 1;
 					break;
@@ -922,8 +917,9 @@
 			break;
 
 		default:
-			printf("pci%d:%d:%d: invalid state: %d\n",
-			    cfg->bus, cfg->slot, cfg->func, state);
+			printf("pci%d:%d:%d:%d: invalid state: %d\n",
+			    cfg->domain, cfg->bus, cfg->slot, cfg->func,
+			    state);
 			end = 1;
 			break;
 		}
@@ -1967,9 +1963,9 @@
 
 	if (bootverbose)
 		printf(
-		    "pci%d:%d:%d: Transition from D%d to D%d\n",
-		    dinfo->cfg.bus, dinfo->cfg.slot, dinfo->cfg.func,
-		    oldstate, state);
+		    "pci%d:%d:%d:%d: Transition from D%d to D%d\n",
+		    dinfo->cfg.domain, dinfo->cfg.bus, dinfo->cfg.slot,
+		    dinfo->cfg.func, oldstate, state);
 
 	PCI_WRITE_CONFIG(dev, child, cfg->pp.pp_status, status, 2);
 	if (delay)
@@ -2125,8 +2121,8 @@
 
 		printf("found->\tvendor=0x%04x, dev=0x%04x, revid=0x%02x\n",
 		    cfg->vendor, cfg->device, cfg->revid);
-		printf("\tbus=%d, slot=%d, func=%d\n",
-		    cfg->bus, cfg->slot, cfg->func);
+		printf("\tdomain=%d, bus=%d, slot=%d, func=%d\n",
+		    cfg->domain, cfg->bus, cfg->slot, cfg->func);
 		printf("\tclass=%02x-%02x-%02x, hdrtype=0x%02x, mfdev=%d\n",
 		    cfg->baseclass, cfg->subclass, cfg->progif, cfg->hdrtype,
 		    cfg->mfdev);
@@ -2263,7 +2259,8 @@
 		return (barlen);
 	if ((u_long)base != base) {
 		device_printf(bus,
-		    "pci%d:%d:%d bar %#x too many address bits", b, s, f, reg);
+		    "pci%d:%d:%d:%d bar %#x too many address bits",
+		    pci_get_domain(dev), b, s, f, reg);
 		return (barlen);
 	}
 
@@ -2315,8 +2312,8 @@
 	if ((u_long)start != start) {
 		/* Wait a minute!  this platform can't do this address. */
 		device_printf(bus,
-		    "pci%d.%d.%x bar %#x start %#jx, too many bits.",
-		    b, s, f, reg, (uintmax_t)start);
+		    "pci%d:%d.%d.%x bar %#x start %#jx, too many bits.",
+		    pci_get_domain(dev), b, s, f, reg, (uintmax_t)start);
 		resource_list_release(rl, bus, dev, type, reg, res);
 		return (barlen);
 	}
@@ -2401,8 +2398,9 @@
 
 	/* Let the user override the IRQ with a tunable. */
 	irq = PCI_INVALID_IRQ;
-	snprintf(tunable_name, sizeof(tunable_name), "hw.pci%d.%d.INT%c.irq",
-	    cfg->bus, cfg->slot, cfg->intpin + 'A' - 1);
+	snprintf(tunable_name, sizeof(tunable_name),
+	    "hw.pci%d.%d.%d.INT%c.irq",
+	    cfg->domain, cfg->bus, cfg->slot, cfg->intpin + 'A' - 1);
 	if (TUNABLE_INT_FETCH(tunable_name, &irq) && (irq >= 255 || irq <= 0))
 		irq = PCI_INVALID_IRQ;
 
@@ -2488,7 +2486,7 @@
 }
 
 void
-pci_add_children(device_t dev, int busno, size_t dinfo_size)
+pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
 {
 #define	REG(n, w)	PCIB_READ_CONFIG(pcib, busno, s, f, n, w)
 	device_t pcib = device_get_parent(dev);
@@ -2510,7 +2508,8 @@
 		if (hdrtype & PCIM_MFDEV)
 			pcifunchigh = PCI_FUNCMAX;
 		for (f = 0; f <= pcifunchigh; f++) {
-			dinfo = pci_read_device(pcib, busno, s, f, dinfo_size);
+			dinfo = pci_read_device(pcib, domain, busno, s, f,
+			    dinfo_size);
 			if (dinfo != NULL) {
 				pci_add_child(dev, dinfo);
 			}
@@ -2544,19 +2543,21 @@
 static int
 pci_attach(device_t dev)
 {
-	int busno;
+	int busno, domain;
 
 	/*
 	 * Since there can be multiple independantly numbered PCI
 	 * busses on systems with multiple PCI domains, we can't use
 	 * the unit number to decide which bus we are probing. We ask
-	 * the parent pcib what our bus number is.
+	 * the parent pcib what our domain and bus numbers are.
 	 */
+	domain = pcib_get_domain(dev);
 	busno = pcib_get_bus(dev);
 	if (bootverbose)
-		device_printf(dev, "physical bus=%d\n", busno);
+		device_printf(dev, "domain=%d, physical bus=%d\n",
+		    domain, busno);
 
-	pci_add_children(dev, busno, sizeof(struct pci_devinfo));
+	pci_add_children(dev, domain, busno, sizeof(struct pci_devinfo));
 
 	return (bus_generic_attach(dev));
 }
@@ -2679,8 +2680,9 @@
 		dinfo = device_get_ivars(child);
 		pci_print_verbose(dinfo);
 		if (bootverbose)
-			printf("pci%d:%d:%d: reprobing on driver added\n",
-			    dinfo->cfg.bus, dinfo->cfg.slot, dinfo->cfg.func);
+			printf("pci%d:%d:%d:%d: reprobing on driver added\n",
+			    dinfo->cfg.domain, dinfo->cfg.bus, dinfo->cfg.slot,
+			    dinfo->cfg.func);
 		pci_cfg_restore(child, dinfo);
 		if (device_probe_and_attach(child) != 0)
 			pci_cfg_save(child, dinfo, 1);
@@ -3146,6 +3148,9 @@
 	case PCI_IVAR_IRQ:
 		*result = cfg->intline;
 		break;
+	case PCI_IVAR_DOMAIN:
+		*result = cfg->domain;
+		break;
 	case PCI_IVAR_BUS:
 		*result = cfg->bus;
 		break;
@@ -3198,6 +3203,7 @@
 	case PCI_IVAR_PROGIF:
 	case PCI_IVAR_REVID:
 	case PCI_IVAR_IRQ:
+	case PCI_IVAR_DOMAIN:
 	case PCI_IVAR_BUS:
 	case PCI_IVAR_SLOT:
 	case PCI_IVAR_FUNCTION:
@@ -3244,12 +3250,12 @@
 			name = device_get_name(dinfo->cfg.dev);
 
 		p = &dinfo->conf;
-		db_printf("%s%d@pci%d:%d:%d:\tclass=0x%06x card=0x%08x "
+		db_printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x card=0x%08x "
 			"chip=0x%08x rev=0x%02x hdr=0x%02x\n",
 			(name && *name) ? name : "none",
 			(name && *name) ? (int)device_get_unit(dinfo->cfg.dev) :
 			none_count++,
-			p->pc_sel.pc_bus, p->pc_sel.pc_dev,
+			p->pc_sel.pc_domain, p->pc_sel.pc_bus, p->pc_sel.pc_dev,
 			p->pc_sel.pc_func, (p->pc_class << 16) |
 			(p->pc_subclass << 8) | p->pc_progif,
 			(p->pc_subdevice << 16) | p->pc_subvendor,

==== //depot/projects/usiii/dev/pci/pci_pci.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.49 2007/05/23 15:31:00 gallatin Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.50 2007/09/30 11:05:15 marius Exp $");
 
 /*
  * PCI:PCI bridge support.
@@ -147,6 +147,7 @@
      * Get current bridge configuration.
      */
     sc->command   = pci_read_config(dev, PCIR_COMMAND, 1);
+    sc->domain    = pci_get_domain(dev);
     sc->secbus    = pci_read_config(dev, PCIR_SECBUS_1, 1);
     sc->subbus    = pci_read_config(dev, PCIR_SUBBUS_1, 1);
     sc->secstat   = pci_read_config(dev, PCIR_SECSTAT_1, 2);
@@ -257,6 +258,7 @@
 	sc->flags |= PCIB_SUBTRACTIVE;
 	
     if (bootverbose) {
+	device_printf(dev, "  domain            %d\n", sc->domain);
 	device_printf(dev, "  secondary bus     %d\n", sc->secbus);
 	device_printf(dev, "  subordinate bus   %d\n", sc->subbus);
 	device_printf(dev, "  I/O decode        0x%x-0x%x\n", sc->iobase, sc->iolimit);
@@ -309,6 +311,9 @@
     struct pcib_softc	*sc = device_get_softc(dev);
     
     switch (which) {
+    case PCIB_IVAR_DOMAIN:
+	*result = sc->domain;
+	return(0);
     case PCIB_IVAR_BUS:
 	*result = sc->secbus;
 	return(0);
@@ -322,9 +327,11 @@
     struct pcib_softc	*sc = device_get_softc(dev);
 
     switch (which) {
+    case PCIB_IVAR_DOMAIN:
+	return(EINVAL);
     case PCIB_IVAR_BUS:
 	sc->secbus = value;
-	break;
+	return(0);
     }
     return(ENOENT);
 }

==== //depot/projects/usiii/dev/pci/pci_private.h#2 (text+ko) ====

@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pci/pci_private.h,v 1.24 2007/05/16 18:41:42 imp Exp $
+ * $FreeBSD: src/sys/dev/pci/pci_private.h,v 1.25 2007/09/30 11:05:15 marius Exp $
  *
  */
 
@@ -38,7 +38,8 @@
  */
 DECLARE_CLASS(pci_driver);
 
-void		pci_add_children(device_t dev, int busno, size_t dinfo_size);
+void		pci_add_children(device_t dev, int domain, int busno,
+		    size_t dinfo_size);
 void		pci_add_child(device_t bus, struct pci_devinfo *dinfo);
 void		pci_add_resources(device_t bus, device_t dev, int force,
 		    uint32_t prefetchmask);
@@ -84,7 +85,7 @@
 void		pci_delete_resource(device_t dev, device_t child, 
 		    int type, int rid);
 struct resource_list *pci_get_resource_list (device_t dev, device_t child);
-struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f,
+struct pci_devinfo *pci_read_device(device_t pcib, int d, int b, int s, int f,
 		    size_t size);
 void		pci_print_verbose(struct pci_devinfo *dinfo);
 int		pci_freecfg(struct pci_devinfo *dinfo);

==== //depot/projects/usiii/dev/pci/pci_user.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci_user.c,v 1.21 2006/10/06 14:31:32 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci_user.c,v 1.22 2007/09/30 11:05:15 marius Exp $");
 
 #include "opt_bus.h"	/* XXX trim includes */
 #include "opt_compat.h"
@@ -125,6 +125,11 @@
 		 * comparison.  If the comparison fails, we don't have a
 		 * match, go on to the next item if there is one.
 		 */
+		if (((matches[i].flags & PCI_GETCONF_MATCH_DOMAIN) != 0)
+		 && (match_buf->pc_sel.pc_domain !=
+		 matches[i].pc_sel.pc_domain))
+			continue;
+
 		if (((matches[i].flags & PCI_GETCONF_MATCH_BUS) != 0)
 		 && (match_buf->pc_sel.pc_bus != matches[i].pc_sel.pc_bus))
 			continue;
@@ -388,8 +393,9 @@
 			 * Look up the grandparent, i.e. the bridge device,
 			 * so that we can issue configuration space cycles.
 			 */
-			pcidev = pci_find_bsf(io->pi_sel.pc_bus,
-			    io->pi_sel.pc_dev, io->pi_sel.pc_func);
+			pcidev = pci_find_dbsf(io->pi_sel.pc_domain,
+			    io->pi_sel.pc_bus, io->pi_sel.pc_dev,
+			    io->pi_sel.pc_func);
 			if (pcidev) {
 				device_t busdev, brdev;
 

==== //depot/projects/usiii/dev/pci/pcib_private.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pci/pcib_private.h,v 1.12 2007/05/02 17:50:35 jhb Exp $
+ * $FreeBSD: src/sys/dev/pci/pcib_private.h,v 1.13 2007/09/30 11:05:15 marius Exp $
  */
 
 #ifndef __PCIB_PRIVATE_H__
@@ -48,6 +48,7 @@
 #define	PCIB_SUBTRACTIVE	0x1
 #define	PCIB_DISABLE_MSI	0x2
     uint16_t	command;	/* command register */
+    uint32_t	domain;		/* domain number */
     uint8_t	secbus;		/* secondary bus number */
     uint8_t	subbus;		/* subordinate bus number */
     pci_addr_t	pmembase;	/* base address of prefetchable memory */

==== //depot/projects/usiii/dev/pci/pcivar.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pci/pcivar.h,v 1.79 2007/05/02 17:50:35 jhb Exp $
+ * $FreeBSD: src/sys/dev/pci/pcivar.h,v 1.80 2007/09/30 11:05:15 marius Exp $
  *
  */
 
@@ -34,6 +34,7 @@

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709301333.l8UDX4nt096384>