Get the Bus/Device/Function of the bridge that's connected to the specified chassis and slot
#include <pci/pci.h> pci_bdf_t pci_chassis_slot_bridge( pci_cs_t cs );
The pci_chassis_slot_bridge() function returns the BDF of the bridge that's connected to 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 devices 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 bridge, or PCI_BDF_NONE if the chassis and slot provided were invalid or aren't associated with a bridge or Root Port.
A PCI bridge (not a PCIe Root Port) may be connected to several slots. In this case, the same BDF is returned for each slot connected to the bridge.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |