From owner-freebsd-current@FreeBSD.ORG Mon Jun 9 19:27:18 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB34837B401; Mon, 9 Jun 2003 19:27:18 -0700 (PDT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2225543F85; Mon, 9 Jun 2003 19:27:15 -0700 (PDT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) by srv1.cosmo-project.de (8.12.9/8.12.9) with ESMTP id h5A2R9Th042581 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Tue, 10 Jun 2003 04:27:12 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.9/8.12.9) with ESMTP id h5A2R8Os057780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Jun 2003 04:27:08 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.9/8.12.9) with ESMTP id h5A2R79F009469; Tue, 10 Jun 2003 04:27:08 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.9/8.12.9/Submit) id h5A2R7LB009468; Tue, 10 Jun 2003 04:27:07 +0200 (CEST) Date: Tue, 10 Jun 2003 04:27:07 +0200 From: Bernd Walter To: John-Mark Gurney , jhb@freebsd.org, imp@freebsd.org Message-ID: <20030610022706.GI509@cicely12.cicely.de> References: <20030609165838.32044@hydrogen.funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030609165838.32044@hydrogen.funkthat.com> X-Operating-System: FreeBSD cicely12.cicely.de 5.1-RELEASE alpha User-Agent: Mutt/1.5.4i cc: freebsd-current@freebsd.org cc: freebsd-sparc64@freebsd.org Subject: Re: PCI bus numbering and orphaned devices X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jun 2003 02:27:19 -0000 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 > @@ -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) { 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@bwct.de info@bwct.de