Lines Matching +full:irq +full:- +full:start

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause AND MIT
115 * in *config and return the regions in *result. Returns non-zero if
134 result->ic_nmem = config->ic_nmem; in isa_find_memory()
135 for (i = 0; i < config->ic_nmem; i++) { in isa_find_memory()
136 uint32_t start, end, size, align; in isa_find_memory() local
138 size = config->ic_mem[i].ir_size; in isa_find_memory()
142 result->ic_mem[i].ir_start = 0; in isa_find_memory()
143 result->ic_mem[i].ir_end = 0; in isa_find_memory()
144 result->ic_mem[i].ir_size = 0; in isa_find_memory()
145 result->ic_mem[i].ir_align = 0; in isa_find_memory()
149 for (start = config->ic_mem[i].ir_start, in isa_find_memory()
150 end = config->ic_mem[i].ir_end, in isa_find_memory()
151 align = config->ic_mem[i].ir_align; in isa_find_memory()
152 start + size - 1 <= end && start + size > start; in isa_find_memory()
153 start += MAX(align, 1)) { in isa_find_memory()
155 start, size); in isa_find_memory()
160 result->ic_mem[i].ir_start = start; in isa_find_memory()
161 result->ic_mem[i].ir_end = start + size - 1; in isa_find_memory()
162 result->ic_mem[i].ir_size = size; in isa_find_memory()
163 result->ic_mem[i].ir_align = align; in isa_find_memory()
189 * in *config and return the regions in *result. Returns non-zero if
208 result->ic_nport = config->ic_nport; in isa_find_port()
209 for (i = 0; i < config->ic_nport; i++) { in isa_find_port()
210 uint32_t start, end, size, align; in isa_find_port() local
212 size = config->ic_port[i].ir_size; in isa_find_port()
216 result->ic_port[i].ir_start = 0; in isa_find_port()
217 result->ic_port[i].ir_end = 0; in isa_find_port()
218 result->ic_port[i].ir_size = 0; in isa_find_port()
219 result->ic_port[i].ir_align = 0; in isa_find_port()
223 for (start = config->ic_port[i].ir_start, in isa_find_port()
224 end = config->ic_port[i].ir_end, in isa_find_port()
225 align = config->ic_port[i].ir_align; in isa_find_port()
226 start + size - 1 <= end; in isa_find_port()
227 start += align) { in isa_find_port()
229 start, size); in isa_find_port()
234 result->ic_port[i].ir_start = start; in isa_find_port()
235 result->ic_port[i].ir_end = start + size - 1; in isa_find_port()
236 result->ic_port[i].ir_size = size; in isa_find_port()
237 result->ic_port[i].ir_align = align; in isa_find_port()
262 * Return the index of the first bit in the mask (or -1 if mask is empty.
267 return (ffs(mask) - 1); in find_first_bit()
271 * Return the index of the next bit in the mask, or -1 if there are no more.
276 return (find_first_bit(mask & (-2 << bit))); in find_next_bit()
281 * and return the regions in *result. Returns non-zero if a set of
300 result->ic_nirq = config->ic_nirq; in isa_find_irq()
301 for (i = 0; i < config->ic_nirq; i++) { in isa_find_irq()
302 uint32_t mask = config->ic_irqmask[i]; in isa_find_irq()
303 int irq; in isa_find_irq() local
307 result->ic_irqmask[i] = 0; in isa_find_irq()
311 for (irq = find_first_bit(mask); in isa_find_irq()
312 irq != -1; in isa_find_irq()
313 irq = find_next_bit(mask, irq)) { in isa_find_irq()
315 irq, 1); in isa_find_irq()
320 result->ic_irqmask[i] = (1 << irq); in isa_find_irq()
326 * If we didn't find a place for irq range i, then in isa_find_irq()
346 * and return the regions in *result. Returns non-zero if a set of
365 result->ic_ndrq = config->ic_ndrq; in isa_find_drq()
366 for (i = 0; i < config->ic_ndrq; i++) { in isa_find_drq()
367 uint32_t mask = config->ic_drqmask[i]; in isa_find_drq()
372 result->ic_drqmask[i] = 0; in isa_find_drq()
377 drq != -1; in isa_find_drq()
385 result->ic_drqmask[i] = (1 << drq); in isa_find_drq()
411 * non-zero if a working configuration is found.
425 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) { in isa_assign_resources()
427 if (!isa_find_memory(child, &ice->ice_config, cfg)) in isa_assign_resources()
430 if (!isa_find_port(child, &ice->ice_config, cfg)) in isa_assign_resources()
432 reason = "irq"; in isa_assign_resources()
433 if (!isa_find_irq(child, &ice->ice_config, cfg)) in isa_assign_resources()
436 if (!isa_find_drq(child, &ice->ice_config, cfg)) in isa_assign_resources()
444 if (idev->id_config_cb) { in isa_assign_resources()
445 idev->id_config_cb(idev->id_config_arg, in isa_assign_resources()
460 if (idev->id_config_cb) in isa_assign_resources()
461 idev->id_config_cb(idev->id_config_arg, cfg, 0); in isa_assign_resources()
476 struct resource_list *rl = &idev->id_resources; in isa_claim_resources()
481 if (!rle->res) { in isa_claim_resources()
482 rid = rle->rid; in isa_claim_resources()
483 resource_list_alloc(rl, dev, child, rle->type, &rid, in isa_claim_resources()
501 * Create all the non-hinted children by calling drivers' in isa_probe_children()
526 if (idev->id_config_cb) in isa_probe_children()
527 idev->id_config_cb(idev->id_config_arg, cfg, 0); in isa_probe_children()
540 if (idev->id_order > ISA_ORDER_PNPBIOS) in isa_probe_children()
542 if (!TAILQ_EMPTY(&idev->id_configs) && in isa_probe_children()
552 * Next, enumerate hinted devices and probe all non-pnp devices so in isa_probe_children()
559 printf("isa_probe_children: probing non-PnP devices\n"); in isa_probe_children()
565 !TAILQ_EMPTY(&idev->id_configs)) in isa_probe_children()
569 if (err == 0 && idev->id_vendorid == 0 && in isa_probe_children()
573 "non-PNP ISA device will be removed from GENERIC in FreeBSD 16.\n"); in isa_probe_children()
585 if (device_is_attached(child) || TAILQ_EMPTY(&idev->id_configs)) in isa_probe_children()
616 resource_list_init(&idev->id_resources); in isa_add_child()
617 TAILQ_INIT(&idev->id_configs); in isa_add_child()
618 idev->id_order = order; in isa_add_child()
635 struct resource_list *rl = &idev->id_resources; in isa_print_all_resources()
643 retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); in isa_print_all_resources()
647 if (idev->id_vendorid) in isa_print_all_resources()
648 retval += printf(" pnpid %s", pnp_eisaformat(idev->id_vendorid)); in isa_print_all_resources()
682 struct resource_list *rl = &idev->id_resources; in isa_read_ivar()
689 *result = rle->start; in isa_read_ivar()
691 *result = -1; in isa_read_ivar()
697 *result = rle->start; in isa_read_ivar()
699 *result = -1; in isa_read_ivar()
705 *result = rle->count; in isa_read_ivar()
713 *result = rle->count; in isa_read_ivar()
721 *result = rle->start; in isa_read_ivar()
723 *result = -1; in isa_read_ivar()
729 *result = rle->start; in isa_read_ivar()
731 *result = -1; in isa_read_ivar()
737 *result = rle->count; in isa_read_ivar()
745 *result = rle->count; in isa_read_ivar()
753 *result = rle->start; in isa_read_ivar()
755 *result = -1; in isa_read_ivar()
761 *result = rle->start; in isa_read_ivar()
763 *result = -1; in isa_read_ivar()
769 *result = rle->start; in isa_read_ivar()
771 *result = -1; in isa_read_ivar()
777 *result = rle->start; in isa_read_ivar()
779 *result = -1; in isa_read_ivar()
783 *result = idev->id_vendorid; in isa_read_ivar()
787 *result = idev->id_serial; in isa_read_ivar()
791 *result = idev->id_logicalid; in isa_read_ivar()
795 *result = idev->id_compatid; in isa_read_ivar()
799 *result = idev->id_config_attr; in isa_read_ivar()
803 *result = idev->id_pnp_csn; in isa_read_ivar()
807 *result = idev->id_pnp_ldn; in isa_read_ivar()
811 *result = idev->id_pnpbios_handle; in isa_read_ivar()
842 idev->id_vendorid = value; in isa_write_ivar()
846 idev->id_serial = value; in isa_write_ivar()
850 idev->id_logicalid = value; in isa_write_ivar()
854 idev->id_compatid = value; in isa_write_ivar()
858 idev->id_config_attr = value; in isa_write_ivar()
877 if (TAILQ_FIRST(&idev->id_configs)) in isa_child_detached()
903 struct resource_list *rl = &idev->id_resources; in isa_driver_added()
915 STAILQ_FOREACH(rle, &idev->id_resources, link) { in isa_driver_added()
916 if (rle->res) in isa_driver_added()
918 rle->res); in isa_driver_added()
921 if (TAILQ_FIRST(&idev->id_configs)) in isa_driver_added()
927 if (TAILQ_FIRST(&idev->id_configs)) in isa_driver_added()
936 rman_res_t start, rman_res_t count) in isa_set_resource() argument
939 struct resource_list *rl = &idev->id_resources; in isa_set_resource()
955 resource_list_add(rl, type, rid, start, start + count - 1, count); in isa_set_resource()
964 struct resource_list *rl = &idev->id_resources; in isa_get_resource_list()
983 newice->ice_priority = priority; in isa_add_config()
984 newice->ice_config = *config; in isa_add_config()
986 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) { in isa_add_config()
987 if (ice->ice_priority > priority) in isa_add_config()
993 TAILQ_INSERT_TAIL(&idev->id_configs, newice, ice_link); in isa_add_config()
1004 idev->id_config_cb = fn; in isa_set_config_callback()
1005 idev->id_config_arg = arg; in isa_set_config_callback()
1013 if (!idev->id_vendorid) in isa_pnp_probe()
1016 while (ids && ids->ip_id) { in isa_pnp_probe()
1020 if (idev->id_logicalid == ids->ip_id in isa_pnp_probe()
1021 || idev->id_compatid == ids->ip_id) { in isa_pnp_probe()
1022 if (ids->ip_desc) in isa_pnp_probe()
1023 device_set_desc(child, ids->ip_desc); in isa_pnp_probe()
1037 if (idev->id_vendorid) in isa_child_pnpinfo()
1039 pnp_eisaformat(idev->id_vendorid)); in isa_child_pnpinfo()
1050 if (idev->id_vendorid) in isa_child_location()
1051 sbuf_printf(sbuf, "pnphandle=%d", idev->id_pnphandle); in isa_child_location()
1101 * ISA can be attached to a PCI-ISA bridge, or other locations on some