/******************************************************************************* * hwitag_add_irq * * add the irq tag to device <hwi_off> and and set the tag vector field to * <vector>. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_irq(unsigned hwi_off, unsigned vector) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(irq)); tag->irq.vector = vector; }
/******************************************************************************* * hwitag_add_irq_range * * add the irqrange tag to device <hwi_off> and and set the tag fields as * specified in <start_vector> and <num>. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_irqrange(unsigned hwi_off, unsigned start_vector, unsigned num) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(irqrange)); tag->irqrange.irq = start_vector; tag->irqrange.num = num; }
/******************************************************************************* * hwitag_add_inputclk * * add the input clock tag to device <hwi_off> and set the tag fields as * specified in <clk> and <div>. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_inputclk(unsigned hwi_off, unsigned clk, unsigned div) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(inputclk)); tag->inputclk.clk = clk; tag->inputclk.div = div; }
/******************************************************************************* * hwitag_add_busattr * * add the bus attributes tag to device <hwi_off> and set the tag fields as * specified in <attr>. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_busattr(unsigned hwi_off, struct hwi_busattr *attr) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(busattr)); tag->busattr.speed = attr ? attr->speed : 0; tag->busattr.width = attr ? attr->width : 0; tag->busattr.addr = attr ? attr->addr : 0; tag->busattr.flags = attr ? attr->flags : 0; }
/******************************************************************************* * hwitag_add_location * * add the location tag to device <hwi_off> and set the tag fields as specified * in remaining arguments. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_location(unsigned hwi_off, paddr_t base, paddr_t len, unsigned reg_shift, unsigned addr_space) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(location)); tag->location.base = base; tag->location.len = len; tag->location.regshift = reg_shift; tag->location.addrspace = addr_space; }
/******************************************************************************* * hwitag_add_nicaddr * * add the NIC address tag to device <hwi_off> and set the tag fields as * specified in the following parameters. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_nicaddr(unsigned hwi_off, const uint8_t *addr, unsigned len) { hwi_tag *tag; unsigned size; size = offsetof(struct hwi_nicaddr, addr) + len; tag = hwi_alloc_tag(HWI_TAG_NAME_nicaddr, ROUND(size, sizeof(uint32_t)), HWI_TAG_ALIGN_nicaddr); tag->nicaddr.len = len; memmove(tag->nicaddr.addr, addr, len); }
void hwi_add_rtc(const char *name, paddr_t base, unsigned reg_shift, unsigned len, int mmap, int cent_reg) { hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_RTC, name, 0); hwi_add_location(base, len << reg_shift, reg_shift, hwi_find_as(base, mmap)); if(cent_reg != -1) { hwi_tag *cent = hwi_alloc_tag(HWI_TAG_INFO(regname)); cent->regname.regname = 0; cent->regname.offset = cent_reg; } }