Lines Matching +full:irq +full:- +full:start
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
154 * XXX We should attach only to pure' compatible = "simple-bus"', in simplebus_probe()
157 * "syscon", "simple-bus"; is handled by fdt/syscon driver in simplebus_probe()
158 * "simple-mfd", "simple-bus"; is handled by fdt/simple-mfd driver in simplebus_probe()
161 ofw_bus_is_compatible(dev, "simple-mfd")) in simplebus_probe()
165 * FDT data puts a "simple-bus" compatible string on many things that in simplebus_probe()
169 if (!(ofw_bus_is_compatible(dev, "simple-bus") && in simplebus_probe()
188 if ((sc->flags & SB_FLAG_NO_RANGES) == 0 && in simplebus_attach_impl()
189 simplebus_fill_ranges(sc->node, sc) < 0) { in simplebus_attach_impl()
199 for (node = OF_child(sc->node); node > 0; node = OF_peer(node)) in simplebus_attach_impl()
200 simplebus_add_device(dev, node, 0, NULL, -1, NULL); in simplebus_attach_impl()
229 if (sc->ranges != NULL) in simplebus_detach()
230 free(sc->ranges, M_DEVBUF); in simplebus_detach()
243 sc->dev = dev; in simplebus_init()
244 sc->node = node; in simplebus_init()
249 sc->acells = 2; in simplebus_init()
250 OF_getencprop(node, "#address-cells", &sc->acells, sizeof(sc->acells)); in simplebus_init()
251 sc->scells = 1; in simplebus_init()
252 OF_getencprop(node, "#size-cells", &sc->scells, sizeof(sc->scells)); in simplebus_init()
264 err = OF_searchencprop(OF_parent(node), "#address-cells", in simplebus_fill_ranges()
267 return (-1); in simplebus_fill_ranges()
271 return (-1); in simplebus_fill_ranges()
272 sc->nranges = nbase_ranges / sizeof(cell_t) / in simplebus_fill_ranges()
273 (sc->acells + host_address_cells + sc->scells); in simplebus_fill_ranges()
274 if (sc->nranges == 0) in simplebus_fill_ranges()
277 sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]), in simplebus_fill_ranges()
282 for (i = 0, j = 0; i < sc->nranges; i++) { in simplebus_fill_ranges()
283 sc->ranges[i].bus = 0; in simplebus_fill_ranges()
284 for (k = 0; k < sc->acells; k++) { in simplebus_fill_ranges()
285 sc->ranges[i].bus <<= 32; in simplebus_fill_ranges()
286 sc->ranges[i].bus |= base_ranges[j++]; in simplebus_fill_ranges()
288 sc->ranges[i].host = 0; in simplebus_fill_ranges()
290 sc->ranges[i].host <<= 32; in simplebus_fill_ranges()
291 sc->ranges[i].host |= base_ranges[j++]; in simplebus_fill_ranges()
293 sc->ranges[i].size = 0; in simplebus_fill_ranges()
294 for (k = 0; k < sc->scells; k++) { in simplebus_fill_ranges()
295 sc->ranges[i].size <<= 32; in simplebus_fill_ranges()
296 sc->ranges[i].size |= base_ranges[j++]; in simplebus_fill_ranges()
301 return (sc->nranges); in simplebus_fill_ranges()
316 if (ofw_bus_gen_setup_devinfo(&ndi->obdinfo, node) != 0) { in simplebus_setup_dinfo()
322 resource_list_init(&ndi->rl); in simplebus_setup_dinfo()
323 ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl); in simplebus_setup_dinfo()
324 ofw_bus_intr_to_rl(dev, node, &ndi->rl, NULL); in simplebus_setup_dinfo()
341 ndi->obdinfo.obd_name); in simplebus_add_device()
342 resource_list_free(&ndi->rl); in simplebus_add_device()
343 ofw_bus_gen_destroy_devinfo(&ndi->obdinfo); in simplebus_add_device()
364 ndi->obdinfo.obd_node = -1; in simplebus_add_child()
365 resource_list_init(&ndi->rl); in simplebus_add_child()
379 return (&ndi->obdinfo); in simplebus_get_devinfo()
390 return (&ndi->rl); in simplebus_get_resource_list()
410 return (-1); in simplebus_get_property()
448 return (-1); in simplebus_get_property()
464 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) in simplebus_alloc_resource() argument
477 if (RMAN_IS_DEFAULT_RANGE(start, end)) { in simplebus_alloc_resource()
481 rle = resource_list_find(&di->rl, type, *rid); in simplebus_alloc_resource()
488 start = rle->start; in simplebus_alloc_resource()
489 end = rle->end; in simplebus_alloc_resource()
490 count = rle->count; in simplebus_alloc_resource()
495 for (j = 0; j < sc->nranges; j++) { in simplebus_alloc_resource()
496 if (start >= sc->ranges[j].bus && end < in simplebus_alloc_resource()
497 sc->ranges[j].bus + sc->ranges[j].size) { in simplebus_alloc_resource()
498 start -= sc->ranges[j].bus; in simplebus_alloc_resource()
499 start += sc->ranges[j].host; in simplebus_alloc_resource()
500 end -= sc->ranges[j].bus; in simplebus_alloc_resource()
501 end += sc->ranges[j].host; in simplebus_alloc_resource()
505 if (j == sc->nranges && sc->nranges != 0) { in simplebus_alloc_resource()
508 "%#jx-%#jx\n", start, end); in simplebus_alloc_resource()
514 return (bus_generic_alloc_resource(bus, child, type, rid, start, end, in simplebus_alloc_resource()
526 rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#jx"); in simplebus_print_res()
527 rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%jd"); in simplebus_print_res()
580 error = ofw_bus_parse_xref_list_alloc(node, "msi-parent", "#msi-cells", in simplebus_get_id()
607 /* Only MSI or non-MSI for now */ in simplebus_alloc_msi()
608 rle = resource_list_find(&ndi->rl, SYS_RES_IRQ, 0); in simplebus_alloc_msi()
609 if (rle != NULL && rle->res != NULL) in simplebus_alloc_msi()
653 simplebus_pcib_alloc_msix(device_t dev, device_t child, int *irq) in simplebus_pcib_alloc_msix() argument
655 return (PCIB_ALLOC_MSIX(device_get_parent(dev), child, irq)); in simplebus_pcib_alloc_msix()
659 simplebus_pcib_release_msix(device_t dev, device_t child, int irq) in simplebus_pcib_release_msix() argument
661 return (PCIB_RELEASE_MSIX(device_get_parent(dev), child, irq)); in simplebus_pcib_release_msix()
665 simplebus_pcib_map_msi(device_t dev, device_t child, int irq, uint64_t *addr, in simplebus_pcib_map_msi() argument
668 return (PCIB_MAP_MSI(device_get_parent(dev), child, irq, addr, in simplebus_pcib_map_msi()