Get the Bus/Device/Function of the device that resides in the specified chassis and slot


#include <pci/pci.h>

pci_bdf_t pci_chassis_slot_device( pci_cs_t cs,
                                   pci_err_t *err );


A pci_cs_t that contains the chassis and slot number; see below.
NULL, or a pointer to a location where the function can store an error code.



Use the -l pci option to qcc to link against this library.


The pci_chassis_slot_device() function returns the BDF of the device that resides in the specified chassis and slot. The pci_cs_t data type is defined as a uint16_t; the encoding is as follows:

cccs ssss ssss ssss

You can use the following macros to encode or decode a pci_cs_t:

There's a maximum of 32 slots per chassis, as defined by the Slot Identification capability, but there are 13 bits for slot numbers to accommodate the size of the “physical slot number” field in the slot capabilities register of PCIe root ports. The 16-bit data type for pci_cs_t permits up to 8 chassis (7 expansion chassis).

Slot numbers start at 1.

Even if there are no chassis-based bridges in the system, a chassis number of 0 exists. That is, a board with PCI devices on it (perhaps including slots) will logically reside in a chassis 0.


The BDF of the device, or PCI_BDF_NONE. If PCI_BDF_NONE is returned and err isn't NULL, the object that err points to indicates why:

The chassis and slot provided were invalid.
The slot is empty.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

pci_chassis_slot_bridge(), pci_device_chassis_slot()