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

Function resource_list_reserve

freebsd/kern/subr_bus.c:3351–3373  ·  view source on GitHub ↗

* @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_

Source from the content-addressed store, hash-verified

3349 * resource could be allocated
3350 */
3351struct resource *
3352resource_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()

Callers

nothing calls this directly

Calls 4

device_get_parentFunction · 0.85
resource_list_allocFunction · 0.85
resource_list_findFunction · 0.85
panicFunction · 0.70

Tested by

no test coverage detected