What is PCIe function?

Comments and questions related to the "Down to the TLP" pages

What is PCIe function?

Postby Guest »

Hi Eli,

Could you please explain little bit about the PCIe function(s)?
I saw this when I configuring the PCIe HIP settings by using ALTERA Megawizard.

I will appreciate if you can provide some simple example what is this function's role and how its work.

Thanks,
PS
Guest
 

Re: What is PCIe function?

Postby support »

Hello,

The "function" is the third attribute that physically identifies a PCI/PCIe device on the bus. The first two are bus number and device number.

To explain what the function number is about, an example is indeed best: Suppose that I've manufactured a card for computers, which has a VGA output and an the common sound jacks, and I want the commonly generic drivers to be able to use it out of the box. To do so, I'd like the card to present itself as a well-known VGA adapter, so that the generic VGA adapter driver takes care of it, but I'd also like it to say that it's a generic sound card, so the a sound driver takes control of that part.

In other words, I want a single card to present itself as two. To achieve this, the configuration registers are set up to tell the BIOS (or any other software that enumerates the bus) that this physical device has two functions. By doing so, the device will get two positions on the bus, one for each function, which are treated as if they were two physical cards. The first one could get the address 01:00.0, and the second 01:00.1.

Now let's look at an excerpt from the output of my own computer's lspci:

01:00.0 VGA compatible controller: ATI Technologies Inc RV710 [Radeon HD 4350]
01:00.1 Audio device: ATI Technologies Inc R700 Audio Device [Radeon HD 4000 Series]
02:00.0 SATA controller: JMicron Technologies, Inc. 20360/20363 Serial ATA Controller (rev 02)
02:00.1 IDE interface: JMicron Technologies, Inc. 20360/20363 Serial ATA Controller (rev 02)

So here we can see that my graphics card indeed presents itself as a sound card as well. Another device, my disk controller, presents itself as a SATA controller plus an IDE interface.

Now let's look at the lspci -n of those same devices, showing the vendor/product IDs:
01:00.0 0300: 1002:954f
01:00.1 0403: 1002:aa38
02:00.0 0106: 197b:2363 (rev 02)
02:00.1 0101: 197b:2363 (rev 02)

Clearly, the graphics card shows different product IDs for the video card function and the sound function, which is quite natural, since these should be handled by different drivers. On the other hand, the disk controller exposes identical vendor/product pairs for both functions, which makes sense as well: After all, the same disk controller driver should run both.

I hope this clarified things.
Eli
support
 
Posts: 802
Joined:

Re: What is PCIe function?

Postby Guest »

Thanks Eli.
I guess I roughly understand what your mean now. :)

01:00.0 VGA compatible controller: ATI Technologies Inc RV710 [Radeon HD 4350]
01:00.1 Audio device: ATI Technologies Inc R700 Audio Device [Radeon HD 4000 Series]
02:00.0 SATA controller: JMicron Technologies, Inc. 20360/20363 Serial ATA Controller (rev 02)
02:00.1 IDE interface: JMicron Technologies, Inc. 20360/20363 Serial ATA Controller (rev 02)


Based on the provided example above, can I interpret that there are 2 physical PCIe cards talking to your CPU?
Each of the card has 2 functions?

Thanks,
PS
Guest
 

Re: What is PCIe function?

Postby support »

Yes, exactly.

Well, the disk controller is a chip on the board which is attached to the PCIe bus, and not a physical card, but the processor has no way to tell. So for all purposes, these are two PCIe cards with two functions each.

Eli
support
 
Posts: 802
Joined:


Return to General PCIe