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 );
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:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |