Message 3 of 3
05 May 09 11:09
Posts To This List: 1047
PCI Function Number
Let me expand on what Peter said. (Peter was correct, by the way, for early
definitions of "Function.")
For many years, the PCI specs defined "Function" like most of us would
define "device." Each "slot" could contain a device with up to eight
functions. Each PCI bus could contain up to 32 devices. Thus you could
theoretically have 256 functions on a bus.
Today, with PCI Express, a "device" occupies an entire bus. If your device
supports it, you can indicate that your device occupies all 256 functions on
that bus. This is dependent on the upstream switch or root port also
supporting this type of enumeration. See the "Alternative Routing
Interpretation (ARI)" Engineering Change Notice (ECN) in the PCI Express
specs for more details. No Windows version currently supports ARI, though.
To Windows, either of these situations is 256 completely separate device
stacks, each with their own driver. Windows Plug-and-Play and Power
Management assume that all device stacks are completely independent, except
when there is explicit information to the contrary. A child node is assumed
to be dependent on the parent. Thus all device stacks will be powered down
before their bus drivers that enumerated them. In PnP, we have "device
relations/bus relations" that can specify that certain devices are
physically contained in the same package and must be ejected together. In
ACPI, we have "power relations" which specify that certain devices are
powered by the same planes and removal of power from one constitutes removal
of power from all.
But, aside from those, the assumption is that all PCI Functions are
completely independent. If one function in your device is in D3, this has
no effect on the others. Any of the drivers on various functions can be
updated (with their stacks torn down and rebuilt) without affecting the
operation of any others. This assumption is often violated by hardware
designers who don't understand the consequences. Then poor driver writers
like yourselves are asked to "just write software" that will make it all
function as a single logical device. This is very difficult software to
write. If you're on this path, and you still have a chance to get the
hardware designer to change the design, do so.
As a final note, and at this point I'm just trying to be over-complete, the
PCI Express spec has recently defined "I/O Virtualization" that allows a
device to implement a control function "called a Physical Function" with
many "Virtual Functions" which can perform I/O but which cannot enforce
policy. This allows a device to have many interfaces, each which can be
under the control of a separate virtual machine.
Hyper-V I/O Architect
(Microsoft representative to several PCI SIG committees)
Windows Kernel Group
This post implies no warranties and confers no rights.
wrote in message news:123579@ntdev...
> The PCI Function Number is the logical number of an individual device
> that's resident in the same bus slot.
> Each PCI card sits in a single slot. On that card can be more than one
> logical device, each with its own set of resources. Each of these logical
> devices is referred to as a function.
> For example, a single PCI network card could have two logically separate
<...excess quoted lines suppressed...>