Updated: October 28, 2024 |
Get the index of the next occurrence of a specific capability of a device
#include <pci/pci.h> int_t pci_device_find_capid_next( pci_bdf_t bdf, pci_capid_t capid, int_t start_idx );
You can use pci_device_find_capid_next() to locate the next occurrence of a capability which the device identified by bdf supports, starting at the capability index start_idx.
You can locate each instance of a specific capability by using pci_device_find_capid_next() with the index returned from a previous call as long as the returned index is a not a negative value.
In the case a negative value is returned (e.g. -1), calling pci_device_find_capid_next() will return the same value calling pci_device_find_capid() will. Returning a negative value also means that there are no more instances of the specific capability present.
On success, when a non-negative 0 based index value is returned, you can use it to call pci_device_read_cap().
The index for the next occurrence of a specific capability, or -1 if there is not more than one occurrence.