pci_chassis_slot_device()

Updated: April 19, 2023

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

Synopsis:

#include <pci/pci.h>

pci_bdf_t pci_chassis_slot_device( pci_cs_t cs,
                                   pci_err_t *err );

Arguments:

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

Library:

libpci

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

Description:

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.

Returns:

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:

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

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

pci_chassis_slot_bridge(), pci_device_chassis_slot()