* @brief Allocate a reserved resource * * This can be used by buses to force the allocation of resources * that are always active in the system even if they are not allocated * by a driver (e.g. PCI BARs). This function is usually called when * adding a new child to the bus. The resource is allocated from the * parent bus when it is reserved. The resource list entry is marked * with RLE_
| 3349 | * resource could be allocated |
| 3350 | */ |
| 3351 | struct resource * |
| 3352 | resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, |
| 3353 | int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) |
| 3354 | { |
| 3355 | struct resource_list_entry *rle = NULL; |
| 3356 | int passthrough = (device_get_parent(child) != bus); |
| 3357 | struct resource *r; |
| 3358 | |
| 3359 | if (passthrough) |
| 3360 | panic( |
| 3361 | "resource_list_reserve() should only be called for direct children"); |
| 3362 | if (flags & RF_ACTIVE) |
| 3363 | panic( |
| 3364 | "resource_list_reserve() should only reserve inactive resources"); |
| 3365 | |
| 3366 | r = resource_list_alloc(rl, bus, child, type, rid, start, end, count, |
| 3367 | flags); |
| 3368 | if (r != NULL) { |
| 3369 | rle = resource_list_find(rl, type, *rid); |
| 3370 | rle->flags |= RLE_RESERVED; |
| 3371 | } |
| 3372 | return (r); |
| 3373 | } |
| 3374 | |
| 3375 | /** |
| 3376 | * @brief Helper function for implementing BUS_ALLOC_RESOURCE() |
nothing calls this directly
no test coverage detected