* @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
| 3191 | * @param count XXX end-start+1 |
| 3192 | */ |
| 3193 | struct resource_list_entry * |
| 3194 | resource_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. |
no test coverage detected