Find a specific item instance owned by a specific parent, resolving all synonym names
#include <drvr/hwinfo.h> unsigned hwi_find( const char *device_name, int unit, unsigned hwi_off);
Use the -l drvr option to qcc to link against this library.
The hwi_find() function lets you find a specific item instance owned by a specific parent, resolving (all) synonym names (aliases) to a real device or bus. If the unit instance of device_name has been added to the hwinfo section of the system page and belongs to parent hwi_off, the function returns its hwi offset.
If hwi_off is HWI_NULL_OFF, indicating no parent specified, then hwi_find() does a system-wide search and returns the results regardless of the owning parent. If unit is -1, indicating that you aren't looking for a specific instance, hwi_find() returns the offset of the first occurrence of device_name. Setting unit to -1 is most useful when you're searching for a device on a specific bus (i.e., hwi_off != HWI_NULL_OFF).
Note that the search can be directed from a specific item hwi_off. Therefore, if a certain device is expected to be found attached to a certain bus, you can set hwi_off to the results of hwi_find_bus(). For example, if you have multiple instances of the same device attached to two different buses, the hwi_off parameter allows you to find the instance connected to one of the buses only.
The offset of the device found, or HWI_NULL_OFF if no device was found.
hwi_find_bus(), hwi_find_device(), hwi_find_devicebus(), hwi_find_num_units(), hwi_find_unit(), hwi_tag_find(), hwiattr_get(), hwiattr_get_*(), hwitag_find_busattr(), hwitag_find_clkfreq(), hwitag_find_errata(), hwitag_find_ivec(), hwitag_find_nicaddr(), hwitag_find_phyaddr()