P3.1 Understanding BDF: How Every PCIe Function is Uniquely Identified

To effectively manage and communicate with all the different components inside a computer, the system needs a reliable way to identify exactly where each component is located within the system’s topology. In the PCI Express (PCIe) architecture, every single function is uniquely identified by a combination of its Bus number, Device number, and Function number.

This unique identifier is commonly referred to as the BDF. Here is a breakdown of the three elements that make up this critical identifier and how they logically organize the system.

1. The Bus Number

The largest organizational unit in the topology is the bus. The PCIe architecture uses an 8-bit value to represent the bus, meaning a system can support a maximum of 256 distinct buses (numbered 0 through 255).

  • Bus 0: The initial bus, Bus 0, is typically assigned by the hardware directly to the Root Complex.
  • Assigning Buses: As the system boots up, configuration software discovers bridges and switches. Every time it finds a new bus, it must assign it a unique bus number so that traffic can be successfully routed to it.

2. The Device Number

Within a specific bus, there can be multiple devices attached. The system uses a 5-bit value for the device number, which allows for a maximum of 32 devices per bus.

However, the way devices are attached in PCIe differs greatly from legacy parallel buses:

  • External Links (Device 0): Because physical PCIe links are strictly point-to-point connections, an external link only ever has one single device attached to the downstream end of it. By rule, this external device is always designated as Device 0.
  • Internal Virtual Buses: The only time you will realistically see multiple different device numbers on a single bus is on the internal “Virtual PCI buses” hidden inside Root Complexes and Switches, which are allowed to have multiple devices logically attached to them.

3. The Function Number

A “Device” is really just a physical piece of silicon; the actual working components inside that device are called Functions. A Function is the specific logic that does the work, such as an Ethernet controller, a display controller, or a USB controller.

The system allocates a 3-bit value for the function number, meaning a single device can contain up to 8 internal Functions.

  • Function 0 is Mandatory: Every single PCIe device must implement at least Function 0.
  • Multi-Function Devices: If a device implements two or more functions, it is known as a multi-function device.
  • Non-Sequential Numbering: A multi-function device does not have to implement its functions in sequential order. For example, a single device might only populate Functions 0, 2, and 7. Because of this flexible numbering, system configuration software is forced to check all eight possible function numbers on a multi-function device to discover exactly which ones are present.

Putting It All Together: The Requester ID

When you combine the 8-bit Bus number, the 5-bit Device number, and the 3-bit Function number, you get a unique 16-bit identifier for every function in the entire computer.

This BDF combination is often used as a device’s unique Requester ID. When a device initiates a transaction (like requesting to read data from system memory), it includes its BDF in the request header. This acts as a reliable “return address,” ensuring that when the targeted device gathers the data, it can use ID Routing to send the Completion packets directly back through the PCIe topology to the exact function that asked for them.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top