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

Function nexus_activate_resource

freebsd/arm64/arm64/nexus.c:343–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343static int
344nexus_activate_resource(device_t bus, device_t child, int type, int rid,
345 struct resource *r)
346{
347 int err;
348 bus_addr_t paddr;
349 bus_size_t psize;
350 bus_space_handle_t vaddr;
351
352 if ((err = rman_activate_resource(r)) != 0)
353 return (err);
354
355 /*
356 * If this is a memory resource, map it into the kernel.
357 */
358 if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
359 paddr = (bus_addr_t)rman_get_start(r);
360 psize = (bus_size_t)rman_get_size(r);
361 err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr);
362 if (err != 0) {
363 rman_deactivate_resource(r);
364 return (err);
365 }
366 rman_set_bustag(r, &memmap_bus);
367 rman_set_virtual(r, (void *)vaddr);
368 rman_set_bushandle(r, vaddr);
369 } else if (type == SYS_RES_IRQ) {
370 err = intr_activate_irq(child, r);
371 if (err != 0) {
372 rman_deactivate_resource(r);
373 return (err);
374 }
375 }
376 return (0);
377}
378
379static struct resource_list *
380nexus_get_reslist(device_t dev, device_t child)

Callers

nothing calls this directly

Calls 9

rman_activate_resourceFunction · 0.85
rman_get_startFunction · 0.85
rman_get_sizeFunction · 0.85
bus_space_mapFunction · 0.85
rman_deactivate_resourceFunction · 0.85
rman_set_bustagFunction · 0.85
rman_set_virtualFunction · 0.85
rman_set_bushandleFunction · 0.85
intr_activate_irqFunction · 0.85

Tested by

no test coverage detected