Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jun 2003 21:09:19 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        ticso@cicely.de
Cc:        freebsd-sparc64@freebsd.org
Subject:   Re: PCI bus numbering and orphaned devices
Message-ID:  <20030609210919.33379@hydrogen.funkthat.com>
In-Reply-To: <20030610022706.GI509@cicely12.cicely.de>; from Bernd Walter on Tue, Jun 10, 2003 at 04:27:07AM %2B0200
References:  <20030609165838.32044@hydrogen.funkthat.com> <20030610022706.GI509@cicely12.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Bernd Walter scribbled this message on Jun 10:
> On Mon, Jun 09, 2003 at 04:58:38PM -0700, John-Mark Gurney wrote:
> > +#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.

Wouldn't this happen with the current logic? since if function 0 is
found, it scans the rest...  (Might be getting confused with SCSI
buses).

> 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.

Actually, I was thinking that we could check to see if the next word
is not -1.  The chip responds to the rest of the registers, but just
doesn't respond to the DEVVENDOR (first word).  So, if we check if the
first function's first word returns -1, check the second word, and if
that is not -1, then probe all the rest of the functions.

-bash-2.05b$ pciconf -r pci1:5:0 0x0:0x4
ffffffff 02800002

I'm also thinking of adding support code to the pci bus to let the
userland add a new device node to be probed.  It shouldn't be too hard,
but would be help in these cases.

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

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



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