Subject: Re: multi function PCI devices with shared registers
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: tech-kern
Date: 03/05/1999 18:38:28
Can you give some example code, or direct me to some, that does this
foodevs[] probing that you describe?

This discussion is relevant for PCI-CardBus bridges where the two
sockets are implemented as functions 0,1 of the PCI device, but are
supposed to share the socket status change interrupt.  I'd like to
find some way to discover which functions belong to the same PCI
device, so I can insert a first-level interrupt handler that probes
each socket/function to determine which one caused the SSC interrupt.
Maybe I'm going about this the wrong way?

You say that pci_make_tag() and pci_decompose_tag() aren't exported,
but then which ones are?  In sys/arch/i386/pci/pci_machdep.h, those
functions are listed in the section which are supposed to be
accessible by MI PCI code, but there's a different story in
sys/arch/alpha/pci/pci_machdep.h.

Thanks,

     -- Johnny C. Lam <lamj@stat.cmu.edu>
        Department of Statistics, Carnegie Mellon University
        http://www.stat.cmu.edu/~lamj/

On Thu, 04 Mar 1999 10:54:45 PST, Jason Thorpe <thorpej@nas.nasa.gov> wrote:
> On Thu, 04 Mar 1999 18:09:40 +0100 
>  Stefan Grefen <grefen@hprc.tandem.com> wrote:
> 
>  > 		tpa[i].pa_tag[i] = pci_make_tag(pc,bus,dev,i);
> 
> Nope, pci_make_tag() is not an exported PCI function.  Drivers have
> no business doing that.
> 
> There are other ways to do it, tho.  Search all of foodevs[] for devices
> on your <bus/device> and, since it's a horrible hack, use members of its
> softc as needed :-)
> 
>         -- Jason R. Thorpe <thorpej@nas.nasa.gov>
>