Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jun 2003 16:58:38 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        freebsd-sparc64@freebsd.org, freebsd-current@freebsd.org
Subject:   PCI bus numbering and orphaned devices
Message-ID:  <20030609165838.32044@hydrogen.funkthat.com>

next in thread | raw e-mail | index | archive | help

--Bk0ad3yNHWXBV/QO
Content-Type: text/plain; charset=us-ascii

Hello,

I've recently started work on making FreeBSD work better on a sparc64
box that a friend has.  It's a Netra AX1105-500 (UltraSPARC-IIe 500MHz).

So far I have found out that the pci bus numbering has problems.  We
don't attach pci busses as they are numbered in the bridge/OFW info.
This causes problems with pciconf -l and pciconf -{w,r} not agreeing.
It isn't too hard to tie down the busses to make pciconf agree with
itself.

The second problem is that this has two SME2300BGA chips on it.  They
are combo ebus/usb/1394/ethernet chips.  The problem is that SUN in
order to only have one ebus on the machine, removed function 0 of the
device from probing.  This means that the other functions of the pci
card never get probed.  This can be fixed by making sure we probe all
the functions on all the devices on the PCI buses.  This then gets the
second ethernet and USB to probe and attach.

Of course the correct way to fix it would be to mirror the OFW tree,
and then probe any devices that exist in the OFW tree, but not in our
device tree.

Attached are the two patches to fix both the issues.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

--Bk0ad3yNHWXBV/QO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pci.patch"

Index: pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pci.c,v
retrieving revision 1.214
diff -u -r1.214 pci.c
--- pci.c	2003/04/16 03:15:08	1.214
+++ pci.c	2003/06/09 23:35:56
@@ -825,7 +825,15 @@
 	    ("dinfo_size too small"));
 	maxslots = PCIB_MAXSLOTS(pcib);	
 	for (s = 0; s <= maxslots; s++) {
+#ifdef __sparc64__
+		/*
+		 * XXX - some sparc hardware has valid hardware when the
+		 * function 0 doesn't probe.  Scan all functions.
+		 */
+		pcifunchigh = PCI_FUNCMAX;
+#else
 		pcifunchigh = 0;
+#endif
 		for (f = 0; f <= pcifunchigh; f++) {
 			dinfo = pci_read_device(pcib, busno, s, f, dinfo_size);
 			if (dinfo != NULL) {

--Bk0ad3yNHWXBV/QO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="apb.patch"

Index: apb.c
===================================================================
RCS file: /home/ncvs/src/sys/sparc64/pci/apb.c,v
retrieving revision 1.4
diff -u -r1.4 apb.c
--- apb.c	2002/03/24 02:10:56	1.4
+++ apb.c	2003/06/09 23:33:07
@@ -207,9 +207,11 @@
 	 * number, we should pick a better value.  One sensible alternative
 	 * would be to pick 255; the only tradeoff here is that configuration
 	 * transactions would be more widely routed than absolutely necessary.
+	 *
+	 * If we don't hardware the bus down, pciconf gets confused.
 	 */
 	if (sc->secbus != 0) {
-		child = device_add_child(dev, "pci", -1);
+		child = device_add_child(dev, "pci", sc->secbus);
 		if (child != NULL)
 			return (bus_generic_attach(dev));
 	} else

--Bk0ad3yNHWXBV/QO--



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