Пример #1
0
void 
hwi_add_device(const char *bname, const char *cname, const char *dname, unsigned pnp) {
	hwi_tag		*tag;
	unsigned	bus;
	unsigned	class;

	bus = hwi_find_item(HWI_NULL_OFF, bname, NULL);
	if(bus == HWI_NULL_OFF) {
		unsigned off = hwi_find_item(HWI_NULL_OFF, HWI_ITEM_ROOT_HW, NULL);

		tag = hwi_alloc_item(HWI_TAG_INFO(bus), bname, off);
		bus = hwi_tag2off(tag);
	}
	class = hwi_find_item(HWI_NULL_OFF, bname, cname, NULL);
	if(class == HWI_NULL_OFF) {
		tag = hwi_alloc_item(HWI_TAG_INFO(group), cname, bus);
		class = hwi_tag2off(tag);
	}
	tag = hwi_alloc_item(HWI_TAG_INFO(device), dname, class);
	tag->device.pnpid = pnp;
}
Пример #2
0
/*******************************************************************************
 * hwibus_add
 * 
 * adds the bus <bus_name> to the device (or bus) <parent_hwi_off>. We ignore
 * the class specifier
 * 
 * Returns: the hwi_off for the added bus or HWI_NULL_OFF on error
 * 
 * Note that although we used the name 'bus' to be consistent with previous
 * nomenclature, from a topology perscpective, we actually mean any interconnect
 * to which a device is connected
*/
unsigned hwibus_add(const char *bus_name, unsigned parent_hwi_off)
{
	unsigned hwi_off = HWI_NULL_OFF;

	/* if no parent is provided for the bus, it will get added to HWI_ITEM_ROOT_HW */
	if ((parent_hwi_off != HWI_NULL_OFF) ||
		(parent_hwi_off = hwi_find_item(HWI_NULL_OFF, HWI_ITEM_ROOT_HW, NULL)) != HWI_NULL_OFF)
	{
		hwi_tag *tag = hwi_alloc_item(HWI_TAG_INFO(bus), bus_name, parent_hwi_off);
		if (tag != NULL) hwi_off = hwi_tag2off(tag);
	}
	return hwi_off;
}