Lines Matching +full:irq +full:- +full:start
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
168 if (dinfo->udi_ninterrupts >= 6) { in unin_chip_add_intr()
175 if (nintr == -1) { in unin_chip_add_intr()
178 if (nintr == -1) in unin_chip_add_intr()
182 if (intr[0] == -1) in unin_chip_add_intr()
185 if (OF_getprop(devnode, "interrupt-parent", &iparent, sizeof(iparent)) in unin_chip_add_intr()
189 if (OF_searchprop(iparent, "#interrupt-cells", &icells, sizeof(icells)) in unin_chip_add_intr()
194 u_int irq = MAP_IRQ(iparent, intr[i]); in unin_chip_add_intr() local
196 resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, in unin_chip_add_intr()
197 dinfo->udi_ninterrupts, irq, irq, 1); in unin_chip_add_intr()
200 powerpc_config_intr(irq, in unin_chip_add_intr()
205 dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq; in unin_chip_add_intr()
206 dinfo->udi_ninterrupts++; in unin_chip_add_intr()
217 if (nreg == -1) in unin_chip_add_reg()
221 resource_list_add(&dinfo->udi_resources, SYS_RES_MEMORY, i, in unin_chip_add_reg()
236 reg = (void *)(sc->sc_addr + regoff); in unin_update_reg()
265 if (strcmp(name, "uni-n") != 0 && strcmp(name, "u3") != 0 in unin_chip_probe()
285 u_int irq, reg[3]; in unin_chip_attach() local
295 OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells)); in unin_chip_attach()
296 OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells)); in unin_chip_attach()
299 sc->sc_physaddr = reg[i++]; in unin_chip_attach()
301 sc->sc_physaddr <<= 32; in unin_chip_attach()
302 sc->sc_physaddr |= reg[i++]; in unin_chip_attach()
304 sc->sc_size = reg[i++]; in unin_chip_attach()
306 sc->sc_size <<= 32; in unin_chip_attach()
307 sc->sc_size |= reg[i++]; in unin_chip_attach()
310 sc->sc_mem_rman.rm_type = RMAN_ARRAY; in unin_chip_attach()
311 sc->sc_mem_rman.rm_descr = "UniNorth Device Memory"; in unin_chip_attach()
313 error = rman_init(&sc->sc_mem_rman); in unin_chip_attach()
320 error = rman_manage_region(&sc->sc_mem_rman, sc->sc_physaddr, in unin_chip_attach()
321 sc->sc_physaddr + sc->sc_size - 1); in unin_chip_attach()
333 * Iterate through the sub-devices in unin_chip_attach()
337 if (ofw_bus_gen_setup_devinfo(&dinfo->udi_obdinfo, child) in unin_chip_attach()
344 resource_list_init(&dinfo->udi_resources); in unin_chip_attach()
345 dinfo->udi_ninterrupts = 0; in unin_chip_attach()
359 if (dinfo->udi_ninterrupts == 0 && in unin_chip_attach()
360 (strcmp(name, "i2c-bus") == 0 || in unin_chip_attach()
362 if (OF_getprop(child, "interrupt-parent", &iparent, in unin_chip_attach()
368 irq = MAP_IRQ(iparent, 0); in unin_chip_attach()
369 resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, in unin_chip_attach()
370 dinfo->udi_ninterrupts, irq, irq, 1); in unin_chip_attach()
371 dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq; in unin_chip_attach()
372 dinfo->udi_ninterrupts++; in unin_chip_attach()
380 dinfo->udi_obdinfo.obd_name); in unin_chip_attach()
381 resource_list_free(&dinfo->udi_resources); in unin_chip_attach()
382 ofw_bus_gen_destroy_devinfo(&dinfo->udi_obdinfo); in unin_chip_attach()
394 sc->sc_addr = (vm_offset_t)pmap_mapdev(sc->sc_physaddr, PAGE_SIZE); in unin_chip_attach()
396 sc->sc_version = *(u_int *)sc->sc_addr; in unin_chip_attach()
397 device_printf(dev, "Version %d\n", sc->sc_version); in unin_chip_attach()
408 if (strcmp(compat, "chrp,open-pic") == 0) in unin_chip_attach()
433 rl = &dinfo->udi_resources; in unin_chip_print_child()
438 retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); in unin_chip_print_child()
454 rl = &dinfo->udi_resources; in unin_chip_probe_nomatch()
460 resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); in unin_chip_probe_nomatch()
474 return (&sc->sc_mem_rman); in unin_chip_get_rman()
482 rman_res_t start, rman_res_t end, rman_res_t count, in unin_chip_alloc_resource() argument
494 rle = resource_list_find(&dinfo->udi_resources, SYS_RES_MEMORY, in unin_chip_alloc_resource()
502 rle->end = rle->end - 1; /* Hack? */ in unin_chip_alloc_resource()
504 if (start < rle->start) in unin_chip_alloc_resource()
505 adjstart = rle->start; in unin_chip_alloc_resource()
506 else if (start > rle->end) in unin_chip_alloc_resource()
507 adjstart = rle->end; in unin_chip_alloc_resource()
509 adjstart = start; in unin_chip_alloc_resource()
511 if (end < rle->start) in unin_chip_alloc_resource()
512 adjend = rle->start; in unin_chip_alloc_resource()
513 else if (end > rle->end) in unin_chip_alloc_resource()
514 adjend = rle->end; in unin_chip_alloc_resource()
518 adjcount = adjend - adjstart; in unin_chip_alloc_resource()
526 type, rid, start, end, count, in unin_chip_alloc_resource()
529 rle = resource_list_find(&dinfo->udi_resources, SYS_RES_IRQ, in unin_chip_alloc_resource()
532 if (dinfo->udi_ninterrupts >= 6) { in unin_chip_alloc_resource()
538 resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, in unin_chip_alloc_resource()
539 dinfo->udi_ninterrupts, start, start, in unin_chip_alloc_resource()
542 dinfo->udi_interrupts[dinfo->udi_ninterrupts] = start; in unin_chip_alloc_resource()
543 dinfo->udi_ninterrupts++; in unin_chip_alloc_resource()
546 return (resource_list_alloc(&dinfo->udi_resources, bus, child, in unin_chip_alloc_resource()
547 type, rid, start, end, count, in unin_chip_alloc_resource()
558 rman_res_t start, rman_res_t end) in unin_chip_adjust_resource() argument
563 return (bus_generic_rman_adjust_resource(bus, child, r, start, in unin_chip_adjust_resource()
566 return (bus_generic_adjust_resource(bus, child, r, start, end)); in unin_chip_adjust_resource()
620 rman_res_t length, start; in unin_chip_map_resource() local
637 error = resource_validate_map_request(r, argsp, &args, &start, &length); in unin_chip_map_resource()
642 printf("nexus mapdev: start %jx, len %jd\n", in unin_chip_map_resource()
643 (uintmax_t)start, (uintmax_t)length); in unin_chip_map_resource()
645 map->r_vaddr = pmap_mapdev_attr(start, length, args.memattr); in unin_chip_map_resource()
646 if (map->r_vaddr == NULL) in unin_chip_map_resource()
648 map->r_bustag = &bs_be_tag; in unin_chip_map_resource()
649 map->r_size = length; in unin_chip_map_resource()
650 map->r_bushandle = (bus_space_handle_t)map->r_vaddr; in unin_chip_map_resource()
664 pmap_unmapdev(map->r_vaddr, map->r_size); in unin_chip_unmap_resource()
678 return (&dinfo->udi_resources); in unin_chip_get_resource_list()
687 return (&dinfo->udi_obdinfo); in unin_chip_get_devinfo()