Hardware Locality (hwloc): Components and Plugins: helpers for PCI discovery

Hardware Locality (hwloc) 2.9.3

Functions
Components and Plugins: helpers for PCI discovery

## Functions
unsigned | hwloc_pcidisc_find_cap (const unsigned char *config, unsigned cap)
int | hwloc_pcidisc_find_linkspeed (const unsigned char *config, unsigned offset, float *linkspeed)
hwloc_obj_type_t | hwloc_pcidisc_check_bridge_type (unsigned device_class, const unsigned char *config)
int | hwloc_pcidisc_find_bridge_buses (unsigned domain, unsigned bus, unsigned dev, unsigned func, unsigned *secondary_busp, unsigned *subordinate_busp, const unsigned char *config)
void | hwloc_pcidisc_tree_insert_by_busid (struct hwloc_obj **treep, struct hwloc_obj *obj)
int | hwloc_pcidisc_tree_attach (struct hwloc_topology *topology, struct hwloc_obj *tree)

## Detailed Description

Note
  These structures and functions may change when HWLOC_COMPONENT_ABI is modified.

## Function Documentation

## ◆ hwloc_pcidisc_check_bridge_type()

hwloc_obj_type_t hwloc_pcidisc_check_bridge_type | ( | unsigned | device_class,
|  | const unsigned char * | config
| ) |  |

Return the hwloc object type (PCI device or Bridge) for the given class and configuration space.

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

## ◆ hwloc_pcidisc_find_bridge_buses()

int hwloc_pcidisc_find_bridge_buses | ( | unsigned | domain,
|  | unsigned | bus,
|  | unsigned | dev,
|  | unsigned | func,
|  | unsigned * | secondary_busp,
|  | unsigned * | subordinate_busp,
|  | const unsigned char * | config
| ) |  |

Fills the attributes of the given PCI bridge using the given PCI config space.

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

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

## ◆ hwloc_pcidisc_find_cap()

unsigned hwloc_pcidisc_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_pcidisc_find_linkspeed()

int hwloc_pcidisc_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_pcidisc_tree_attach()

int hwloc_pcidisc_tree_attach | ( | struct hwloc_topology * | topology,
|  | struct hwloc_obj * | tree
| ) |  |

Add some hostbridges on top of the given tree of PCI objects and attach them to the topology.

Other backends may lookup PCI objects or localities (for instance to attach OS devices) by using hwloc_pcidisc_find_by_busid() or hwloc_pcidisc_find_busid_parent().

## ◆ hwloc_pcidisc_tree_insert_by_busid()

void hwloc_pcidisc_tree_insert_by_busid | ( | struct hwloc_obj ** | treep,
|  | struct hwloc_obj * | obj
| ) |  |

Insert a PCI object in the given PCI tree by looking at PCI bus IDs.

If `treep` points to `NULL`, the new object is inserted there.