Re: PCI bus numbering and orphaned devices

From: John-Mark Gurney <gurney_j_at_efn.org>
Date: Mon, 9 Jun 2003 21:09:19 -0700
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."
Received on Mon Jun 09 2003 - 19:09:35 UTC

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