MCPcopy Create free account
hub / github.com/F-Stack/f-stack / resource_list_add

Function resource_list_add

freebsd/kern/subr_bus.c:3193–3219  ·  view source on GitHub ↗

* @brief Add or modify a resource entry. * * If an existing entry exists with the same type and rid, it will be * modified using the given values of @p start, @p end and @p * count. If no entry exists, a new one will be created using the * given values. The resource list entry that matches is then returned. * * @param rl the resource list to edit * @param type the resource entry type (e

Source from the content-addressed store, hash-verified

3191 * @param count XXX end-start+1
3192 */
3193struct resource_list_entry *
3194resource_list_add(struct resource_list *rl, int type, int rid,
3195 rman_res_t start, rman_res_t end, rman_res_t count)
3196{
3197 struct resource_list_entry *rle;
3198
3199 rle = resource_list_find(rl, type, rid);
3200 if (!rle) {
3201 rle = malloc(sizeof(struct resource_list_entry), M_BUS,
3202 M_NOWAIT);
3203 if (!rle)
3204 panic("resource_list_add: can't record entry");
3205 STAILQ_INSERT_TAIL(rl, rle, link);
3206 rle->type = type;
3207 rle->rid = rid;
3208 rle->res = NULL;
3209 rle->flags = 0;
3210 }
3211
3212 if (rle->res)
3213 panic("resource_list_add: resource entry is busy");
3214
3215 rle->start = start;
3216 rle->end = end;
3217 rle->count = count;
3218 return (rle);
3219}
3220
3221/**
3222 * @brief Determine if a resource entry is busy.

Callers 10

jz4780_pinctrl_attachFunction · 0.85
nexus_set_resourceFunction · 0.85
gic_v3_add_childrenFunction · 0.85
nexus_set_resourceFunction · 0.85
madt_gicv2m_handlerFunction · 0.85
fdt_localbus_reg_decodeFunction · 0.85
resource_list_add_nextFunction · 0.85
isa_alloc_resourceFunction · 0.85
nexus_set_resourceFunction · 0.85

Calls 3

resource_list_findFunction · 0.85
mallocFunction · 0.85
panicFunction · 0.70

Tested by

no test coverage detected