| 416 | } |
| 417 | |
| 418 | static int |
| 419 | nexus_activate_resource(device_t bus, device_t child, int type, int rid, |
| 420 | struct resource *r) |
| 421 | { |
| 422 | void *vaddr; |
| 423 | vm_paddr_t paddr; |
| 424 | vm_size_t psize; |
| 425 | int err; |
| 426 | |
| 427 | /* |
| 428 | * If this is a memory resource, use pmap_mapdev to map it. |
| 429 | */ |
| 430 | if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { |
| 431 | paddr = rman_get_start(r); |
| 432 | psize = rman_get_size(r); |
| 433 | rman_set_bustag(r, mips_bus_space_generic); |
| 434 | err = bus_space_map(rman_get_bustag(r), paddr, psize, 0, |
| 435 | (bus_space_handle_t *)&vaddr); |
| 436 | if (err != 0) { |
| 437 | rman_deactivate_resource(r); |
| 438 | return (err); |
| 439 | } |
| 440 | rman_set_virtual(r, vaddr); |
| 441 | rman_set_bushandle(r, (bus_space_handle_t)(uintptr_t)vaddr); |
| 442 | } else if (type == SYS_RES_IRQ) { |
| 443 | #ifdef INTRNG |
| 444 | err = mips_pic_activate_intr(child, r); |
| 445 | if (err != 0) { |
| 446 | rman_deactivate_resource(r); |
| 447 | return (err); |
| 448 | } |
| 449 | #endif |
| 450 | } |
| 451 | |
| 452 | return (rman_activate_resource(r)); |
| 453 | } |
| 454 | |
| 455 | static int |
| 456 | nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, |
nothing calls this directly
no test coverage detected