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

1 /*-
59 u_int irq; member
91 switch (res->Type) { in acpi_lookup_irq_handler()
93 irqnum = res->Data.Irq.InterruptCount; in acpi_lookup_irq_handler()
95 if (res->Data.Irq.Interrupts[i] == req->irq) { in acpi_lookup_irq_handler()
101 trig = res->Data.Irq.Triggering; in acpi_lookup_irq_handler()
102 pol = res->Data.Irq.Polarity; in acpi_lookup_irq_handler()
105 irqnum = res->Data.ExtendedIrq.InterruptCount; in acpi_lookup_irq_handler()
107 if (res->Data.ExtendedIrq.Interrupts[i] == req->irq) { in acpi_lookup_irq_handler()
113 trig = res->Data.ExtendedIrq.Triggering; in acpi_lookup_irq_handler()
114 pol = res->Data.ExtendedIrq.Polarity; in acpi_lookup_irq_handler()
121 if (req->checkrid) { in acpi_lookup_irq_handler()
122 if (req->counter != req->rid) { in acpi_lookup_irq_handler()
123 req->counter++; in acpi_lookup_irq_handler()
127 req->found = 1; in acpi_lookup_irq_handler()
128 req->pol = pol; in acpi_lookup_irq_handler()
129 req->trig = trig; in acpi_lookup_irq_handler()
130 if (req->acpi_res != NULL) in acpi_lookup_irq_handler()
131 bcopy(res, req->acpi_res, len); in acpi_lookup_irq_handler()
143 req.irq = rman_get_start(res); in acpi_lookup_irq_resource()
158 u_int irq; in acpi_config_intr() local
161 switch (res->Type) { in acpi_config_intr()
163 KASSERT(res->Data.Irq.InterruptCount == 1, in acpi_config_intr()
165 irq = res->Data.Irq.Interrupts[0]; in acpi_config_intr()
166 trig = res->Data.Irq.Triggering; in acpi_config_intr()
167 pol = res->Data.Irq.Polarity; in acpi_config_intr()
170 KASSERT(res->Data.ExtendedIrq.InterruptCount == 1, in acpi_config_intr()
172 irq = res->Data.ExtendedIrq.Interrupts[0]; in acpi_config_intr()
173 trig = res->Data.ExtendedIrq.Triggering; in acpi_config_intr()
174 pol = res->Data.ExtendedIrq.Polarity; in acpi_config_intr()
177 panic("%s: bad resource type %u", __func__, res->Type); in acpi_config_intr()
181 if (irq < 16 && trig == ACPI_EDGE_SENSITIVE && pol == ACPI_ACTIVE_LOW && in acpi_config_intr()
183 device_printf(dev, "forcing active-hi polarity for IRQ %u\n", irq); in acpi_config_intr()
187 BUS_CONFIG_INTR(dev, irq, (trig == ACPI_EDGE_SENSITIVE) ? in acpi_config_intr()
194 acpi_map_intr(device_t dev, u_int irq, ACPI_HANDLE handle) in acpi_map_intr() argument
204 req.irq = irq; in acpi_map_intr()
214 return ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, irq, in acpi_map_intr()
259 dev = arc->dev; in acpi_parse_resource()
260 set = arc->set; in acpi_parse_resource()
262 switch (res->Type) { in acpi_parse_resource()
267 if (res->Data.FixedIo.AddressLength <= 0) in acpi_parse_resource()
270 res->Data.FixedIo.Address, res->Data.FixedIo.AddressLength)); in acpi_parse_resource()
271 set->set_ioport(dev, arc->context, res->Data.FixedIo.Address, in acpi_parse_resource()
272 res->Data.FixedIo.AddressLength); in acpi_parse_resource()
275 if (res->Data.Io.AddressLength <= 0) in acpi_parse_resource()
277 if (res->Data.Io.Minimum == res->Data.Io.Maximum) { in acpi_parse_resource()
279 res->Data.Io.Minimum, res->Data.Io.AddressLength)); in acpi_parse_resource()
280 set->set_ioport(dev, arc->context, res->Data.Io.Minimum, in acpi_parse_resource()
281 res->Data.Io.AddressLength); in acpi_parse_resource()
283 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Io 0x%x-0x%x/%d\n", in acpi_parse_resource()
284 res->Data.Io.Minimum, res->Data.Io.Maximum, in acpi_parse_resource()
285 res->Data.Io.AddressLength)); in acpi_parse_resource()
286 set->set_iorange(dev, arc->context, res->Data.Io.Minimum, in acpi_parse_resource()
287 res->Data.Io.Maximum, res->Data.Io.AddressLength, in acpi_parse_resource()
288 res->Data.Io.Alignment); in acpi_parse_resource()
292 if (res->Data.FixedMemory32.AddressLength <= 0) in acpi_parse_resource()
295 res->Data.FixedMemory32.Address, in acpi_parse_resource()
296 res->Data.FixedMemory32.AddressLength)); in acpi_parse_resource()
297 set->set_memory(dev, arc->context, res->Data.FixedMemory32.Address, in acpi_parse_resource()
298 res->Data.FixedMemory32.AddressLength); in acpi_parse_resource()
301 if (res->Data.Memory32.AddressLength <= 0) in acpi_parse_resource()
303 if (res->Data.Memory32.Minimum == res->Data.Memory32.Maximum) { in acpi_parse_resource()
305 res->Data.Memory32.Minimum, res->Data.Memory32.AddressLength)); in acpi_parse_resource()
306 set->set_memory(dev, arc->context, res->Data.Memory32.Minimum, in acpi_parse_resource()
307 res->Data.Memory32.AddressLength); in acpi_parse_resource()
309 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory32 0x%x-0x%x/%d\n", in acpi_parse_resource()
310 res->Data.Memory32.Minimum, res->Data.Memory32.Maximum, in acpi_parse_resource()
311 res->Data.Memory32.AddressLength)); in acpi_parse_resource()
312 set->set_memoryrange(dev, arc->context, res->Data.Memory32.Minimum, in acpi_parse_resource()
313 res->Data.Memory32.Maximum, res->Data.Memory32.AddressLength, in acpi_parse_resource()
314 res->Data.Memory32.Alignment); in acpi_parse_resource()
318 if (res->Data.Memory24.AddressLength <= 0) in acpi_parse_resource()
320 if (res->Data.Memory24.Minimum == res->Data.Memory24.Maximum) { in acpi_parse_resource()
322 res->Data.Memory24.Minimum, res->Data.Memory24.AddressLength)); in acpi_parse_resource()
323 set->set_memory(dev, arc->context, res->Data.Memory24.Minimum, in acpi_parse_resource()
324 res->Data.Memory24.AddressLength); in acpi_parse_resource()
326 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory24 0x%x-0x%x/%d\n", in acpi_parse_resource()
327 res->Data.Memory24.Minimum, res->Data.Memory24.Maximum, in acpi_parse_resource()
328 res->Data.Memory24.AddressLength)); in acpi_parse_resource()
329 set->set_memoryrange(dev, arc->context, res->Data.Memory24.Minimum, in acpi_parse_resource()
330 res->Data.Memory24.Maximum, res->Data.Memory24.AddressLength, in acpi_parse_resource()
331 res->Data.Memory24.Alignment); in acpi_parse_resource()
340 set->set_irq(dev, arc->context, res->Data.Irq.Interrupts, in acpi_parse_resource()
341 res->Data.Irq.InterruptCount, res->Data.Irq.Triggering, in acpi_parse_resource()
342 res->Data.Irq.Polarity); in acpi_parse_resource()
350 set->set_drq(dev, arc->context, res->Data.Dma.Channels, in acpi_parse_resource()
351 res->Data.Dma.ChannelCount); in acpi_parse_resource()
354 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "start dependent functions\n")); in acpi_parse_resource()
355 set->set_start_dependent(dev, arc->context, in acpi_parse_resource()
356 res->Data.StartDpf.CompatibilityPriority); in acpi_parse_resource()
360 set->set_end_dependent(dev, arc->context); in acpi_parse_resource()
366 switch (res->Type) { in acpi_parse_resource()
368 gran = res->Data.Address16.Address.Granularity; in acpi_parse_resource()
369 min = res->Data.Address16.Address.Minimum; in acpi_parse_resource()
370 max = res->Data.Address16.Address.Maximum; in acpi_parse_resource()
371 length = res->Data.Address16.Address.AddressLength; in acpi_parse_resource()
377 gran = res->Data.Address32.Address.Granularity; in acpi_parse_resource()
378 min = res->Data.Address32.Address.Minimum; in acpi_parse_resource()
379 max = res->Data.Address32.Address.Maximum; in acpi_parse_resource()
380 length = res->Data.Address32.Address.AddressLength; in acpi_parse_resource()
386 gran = res->Data.Address64.Address.Granularity; in acpi_parse_resource()
387 min = res->Data.Address64.Address.Minimum; in acpi_parse_resource()
388 max = res->Data.Address64.Address.Maximum; in acpi_parse_resource()
389 length = res->Data.Address64.Address.AddressLength; in acpi_parse_resource()
395 KASSERT(res->Type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, in acpi_parse_resource()
397 gran = res->Data.ExtAddress64.Address.Granularity; in acpi_parse_resource()
398 min = res->Data.ExtAddress64.Address.Minimum; in acpi_parse_resource()
399 max = res->Data.ExtAddress64.Address.Maximum; in acpi_parse_resource()
400 length = res->Data.ExtAddress64.Address.AddressLength; in acpi_parse_resource()
408 if (!arc->ignore_producer_flag && in acpi_parse_resource()
409 res->Data.Address.ProducerConsumer != ACPI_CONSUMER) { in acpi_parse_resource()
412 acpi_address_range_name(res->Data.Address.ResourceType))); in acpi_parse_resource()
415 if (res->Data.Address.ResourceType != ACPI_MEMORY_RANGE && in acpi_parse_resource()
416 res->Data.Address.ResourceType != ACPI_IO_RANGE) { in acpi_parse_resource()
418 "ignored %s for non-memory, non-I/O\n", name)); in acpi_parse_resource()
423 if (min > ULONG_MAX || (res->Data.Address.MaxAddressFixed && max > in acpi_parse_resource()
432 if (res->Data.Address.MinAddressFixed == ACPI_ADDRESS_FIXED && in acpi_parse_resource()
433 res->Data.Address.MaxAddressFixed == ACPI_ADDRESS_FIXED) { in acpi_parse_resource()
434 if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { in acpi_parse_resource()
437 set->set_memory(dev, arc->context, min, length); in acpi_parse_resource()
441 set->set_ioport(dev, arc->context, min, length); in acpi_parse_resource()
443 } else if (res->Data.Address.MinAddressFixed != ACPI_ADDRESS_FIXED && in acpi_parse_resource()
444 res->Data.Address.MaxAddressFixed != ACPI_ADDRESS_FIXED) { in acpi_parse_resource()
447 if ((min + length - 1) > max) { in acpi_parse_resource()
449 "invalid memory range: start: %jx end: %jx max: %jx\n", in acpi_parse_resource()
450 (uintmax_t)min, (uintmax_t)(min + length - 1), in acpi_parse_resource()
453 if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { in acpi_parse_resource()
457 set->set_memory(dev, arc->context, min, length); in acpi_parse_resource()
461 set->set_ioport(dev, arc->context, min, length); in acpi_parse_resource()
465 if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) { in acpi_parse_resource()
467 "%s/Memory 0x%jx-0x%jx/%ju\n", name, (uintmax_t)min, in acpi_parse_resource()
469 set->set_memoryrange(dev, arc->context, min, max, length, gran); in acpi_parse_resource()
471 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s/IO 0x%jx-0x%jx/%ju\n", in acpi_parse_resource()
473 set->set_iorange(dev, arc->context, min, max, length, gran); in acpi_parse_resource()
478 if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) { in acpi_parse_resource()
482 set->set_ext_irq(dev, arc->context, res->Data.ExtendedIrq.Interrupts, in acpi_parse_resource()
483 res->Data.ExtendedIrq.InterruptCount, in acpi_parse_resource()
484 res->Data.ExtendedIrq.Triggering, res->Data.ExtendedIrq.Polarity); in acpi_parse_resource()
499 * Note that it might be nice to also locate ACPI-specific resource items, such
502 * We really need to split the resource-fetching code out from the
503 * resource-parsing code, since we may want to use the parsing
515 set->set_init(dev, arg, &arc.context); in acpi_parse_resources()
550 printf("can't fetch resources for %s - %s\n", in acpi_parse_resources()
554 set->set_done(dev, arc.context); in acpi_parse_resources()
559 * Resource-set vectors used to attach _CRS-derived resources
574 static void acpi_res_set_irq(device_t dev, void *context, uint8_t *irq,
577 uint32_t *irq, int count, int trig, int pol);
612 acpi_res_ignore(device_t dev, int type, rman_res_t start, rman_res_t count) in acpi_res_ignore() argument
618 /* Ignore IRQ resources for PCI link devices. */ in acpi_res_ignore()
628 * under the PCI bridge. Do allow the one known-correct case on in acpi_res_ignore()
638 if (ACPI_SUCCESS(AcpiGetObjectInfo(ad->ad_handle, &devinfo))) { in acpi_res_ignore()
639 if ((devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0) { in acpi_res_ignore()
641 allow = (type == SYS_RES_IOPORT && start == CONF1_ADDR_PORT); in acpi_res_ignore()
664 cp->ar_parent = arg; in acpi_res_set_init()
689 bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length); in acpi_res_set_ioport()
704 * I/O range instead of the start. These are then treated as a in acpi_res_set_iorange()
716 bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, low, length); in acpi_res_set_iorange()
733 bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length); in acpi_res_set_memory()
748 acpi_res_set_irq(device_t dev, void *context, uint8_t *irq, int count, in acpi_res_set_irq() argument
754 if (cp == NULL || irq == NULL) in acpi_res_set_irq()
758 if (acpi_res_ignore(dev, SYS_RES_IRQ, irq[i], 1)) in acpi_res_set_irq()
760 bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, irq[i], 1); in acpi_res_set_irq()
765 acpi_res_set_ext_irq(device_t dev, void *context, uint32_t *irq, int count, in acpi_res_set_ext_irq() argument
771 if (cp == NULL || irq == NULL) in acpi_res_set_ext_irq()
775 if (acpi_res_ignore(dev, SYS_RES_IRQ, irq[i], 1)) in acpi_res_set_ext_irq()
777 bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, irq[i], 1); in acpi_res_set_ext_irq()
795 bus_set_resource(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1); in acpi_res_set_drq()
819 * Resource-owning placeholders for IO and memory pseudo-devices.
871 rman_res_t start, end, count; in acpi_sysres_attach() local
883 bus_rl = &bus_sc->sysres_rl; in acpi_sysres_attach()
885 if (dev_rle->type != SYS_RES_IOPORT && dev_rle->type != SYS_RES_MEMORY) in acpi_sysres_attach()
888 start = dev_rle->start; in acpi_sysres_attach()
889 end = dev_rle->end; in acpi_sysres_attach()
890 count = dev_rle->count; in acpi_sysres_attach()
891 type = dev_rle->type; in acpi_sysres_attach()
895 if (bus_rle->type != type) in acpi_sysres_attach()
899 if (start >= bus_rle->start && end <= bus_rle->end) in acpi_sysres_attach()
903 if (start < bus_rle->start && end >= bus_rle->start) { in acpi_sysres_attach()
904 bus_rle->count += bus_rle->start - start; in acpi_sysres_attach()
905 bus_rle->start = start; in acpi_sysres_attach()
910 if (start <= bus_rle->end && end > bus_rle->end) { in acpi_sysres_attach()
911 bus_rle->count += end - bus_rle->end; in acpi_sysres_attach()
912 bus_rle->end = end; in acpi_sysres_attach()
923 resource_list_add_next(bus_rl, type, start, end, count); in acpi_sysres_attach()