Question about 'pci_attach_device'

Some questions:

1.) The description of this call says it ‘attaches a driver’. It seems to me that this call
just searches for specified pci devices and returns info from their configuration headers. What
does ‘attach a driver’ refer to?

2.) The description also says this call ‘attaches resources’ and ‘allocates resources’. What does
this mean?

3.) The examples show the ‘flags’ argument as 0 when searching for a device. What does this
default to? PCI_SEARCH_VENDEV?

I imagine the answers have something to do with support of architectures other than x86, but I would
appreciate
some help in understanding this.

Thanks.


Art Hays
National Institutes of Health
avhays@nih.gov

Previously, Art Hays wrote in qdn.public.qnxrtp.os:

Some questions:

1.) The description of this call says it ‘attaches a driver’. It seems to me that this call
just searches for specified pci devices and returns info from their configuration headers. What
does ‘attach a driver’ refer to?

Typically drivers use this function to attach themselves to a PCI device, so
that other drivers cannot attach to the same device. This all depends on the
attach flags that are passed in the function call. If the SHARE flag is used,
then multiple drivers can attach to the same device.

2.) The description also says this call ‘attaches resources’ and ‘allocates resources’. What does
this mean?

When a driver attaches to a device, the PCI server allocates the necessary
resources for this device from procnto using the rsrcdbmgr* calls. On X86
bios systems, these resources are normally allocated by the bios, but on
non-x86 systems, these resources have to be allocated from procnto.

3.) The examples show the ‘flags’ argument as 0 when searching for a device. What does this
default to? PCI_SEARCH_VENDEV?

Yes.

I imagine the answers have something to do with support of architectures other than x86, but I would
appreciate
some help in understanding this.

Thanks.


Art Hays
National Institutes of Health
avhays@nih.gov

Hugh Brown <hsbrown@qnx.com> wrote:

… lots of good stuff that I’ll add to the docs. Thanks, Hugh.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems