Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


PCI Function Number

Sathiyaraj_VenkatesanSathiyaraj_Venkatesan Member Posts: 5
Hi all,
Can any body explain PCI Function Number?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,065
    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 NICs.

    Hope that helps,

    Peter
    OSR

    Peter Viscarola
    OSR
    @OSRDrivers

  • Jake_OshinsJake_Oshins Member Posts: 1,058
    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.
    --
    Jake Oshins
    Hyper-V I/O Architect
    (Microsoft representative to several PCI SIG committees)
    Windows Kernel Group

    This post implies no warranties and confers no rights.

    --------------------------------------------------------------


    <[email protected]> wrote in message news:[email protected]
    > 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
    > NICs.
    >
    > Hope that helps,
    >
    > Peter
    > OSR
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online
Writing WDF Drivers 22 May 2023 Live, Online