Components and Plugins: PCI functions to be used by components

## Functions

int | hwloc_insert_pci_device_list (struct hwloc_backend *backend, struct hwloc_obj *first_obj)
unsigned | hwloc_pci_find_cap (const unsigned char *config, unsigned cap)
int | hwloc_pci_find_linkspeed (const unsigned char *config, unsigned offset, float *linkspeed)
int | hwloc_pci_prepare_bridge (hwloc_obj_t obj, const unsigned char *config)

## Detailed Description

## Function Documentation

## hwloc_insert_pci_device_list()

int hwloc_insert_pci_device_list | ( | struct hwloc_backend * | backend,
|  | struct hwloc_obj * | first_obj
| ) |  |

Insert a list of PCI devices and bridges in the backend topology.

Insert a list of objects (either PCI device or bridges) starting at first_obj (linked by next_sibling in the topology, and ending with NULL). Objects are placed under the right bridges, and the remaining upstream bridges are then inserted in the topology by calling the get_obj_cpuset() callback to find their locality.

## hwloc_pci_find_cap()

unsigned hwloc_pci_find_cap | ( | const unsigned char * | config,
|  | unsigned | cap
| ) |  |

Return the offset of the given capability in the PCI config space buffer.

This function requires a 256-bytes config space. Unknown/unavailable bytes should be set to 0xff.

## hwloc_pci_find_linkspeed()

int hwloc_pci_find_linkspeed | ( | const unsigned char * | config,
|  | unsigned | offset,
|  | float * | linkspeed
| ) |  |

Fill linkspeed by reading the PCI config space where PCI_CAP_ID_EXP is at position offset.

Needs 20 bytes of EXP capability block starting at offset in the config space for registers up to link status.

## hwloc_pci_prepare_bridge()

int hwloc_pci_prepare_bridge | ( | hwloc_obj_t | obj,
|  | const unsigned char * | config
| ) |  |

Modify the PCI device object into a bridge and fill its attribute if a bridge is found in the PCI config space.

This function requires 64 bytes of common configuration header at the beginning of config.

Returns -1 and destroys /p obj if bridge fields are invalid.