Re: PCI bus numbering and orphaned devices

From: Bernd Walter <ticso_at_cicely12.cicely.de>
Date: Tue, 10 Jun 2003 04:27:07 +0200
On Mon, Jun 09, 2003 at 04:58:38PM -0700, John-Mark Gurney wrote:
> 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.

> 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
> _at__at_ -825,7 +825,15 _at__at_
>  	    ("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) {

This is problematic as it ignores the fact about single function
devices which may react to all function numbers.
What about reverting the logic:
Initialy set pcifunchigh = PCI_FUNCMAX and set pcifunchigh = 0 in case
we catched a single function device.
I don't think it should be sparc specific.

-- 
B.Walter                   BWCT                http://www.bwct.de
ticso_at_bwct.de                                  info_at_bwct.de
Received on Mon Jun 09 2003 - 17:27:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:11 UTC