Lines Matching +full:re +full:- +full:routed
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
146 /* XXX - Use pmap_mapdev()? */ in pci_pir_open()
148 if (pt->pt_header.ph_length <= sizeof(struct PIR_header)) in pci_pir_open()
151 i < (pt->pt_header.ph_length); i++) in pci_pir_open()
158 pci_route_count = (pt->pt_header.ph_length - in pci_pir_open()
172 if (pci_link->pl_id == link_id) in pci_pir_find_link()
188 if (entry->pe_bus == lookup->bus && in pci_pir_find_link_handler()
189 entry->pe_device == lookup->device && in pci_pir_find_link_handler()
190 intpin - entry->pe_intpin == lookup->pin) in pci_pir_find_link_handler()
191 *lookup->pci_link_ptr = pci_pir_find_link(intpin->link); in pci_pir_find_link_handler()
203 return (pci_link->pl_irqmask & (1 << irq)); in pci_pir_valid_irq()
218 entry = &pci_route_table->pt_entry[0]; in pci_pir_walk_table()
220 intpin = &entry->pe_intpin[0]; in pci_pir_walk_table()
222 if (intpin->link != 0) in pci_pir_walk_table()
233 pci_link = pci_pir_find_link(intpin->link); in pci_pir_create_links()
235 pci_link->pl_references++; in pci_pir_create_links()
236 if (intpin->irqs != pci_link->pl_irqmask) { in pci_pir_create_links()
240 entry->pe_bus, entry->pe_device, in pci_pir_create_links()
241 (intpin - entry->pe_intpin) + 'A', in pci_pir_create_links()
242 pci_link->pl_id); in pci_pir_create_links()
243 pci_link->pl_irqmask &= intpin->irqs; in pci_pir_create_links()
247 pci_link->pl_id = intpin->link; in pci_pir_create_links()
248 pci_link->pl_irqmask = intpin->irqs; in pci_pir_create_links()
249 pci_link->pl_irq = PCI_INVALID_IRQ; in pci_pir_create_links()
250 pci_link->pl_references = 1; in pci_pir_create_links()
251 pci_link->pl_routed = 0; in pci_pir_create_links()
258 * have an interrupt routed to intpin 'pin' by the BIOS.
313 pin = intpin - entry->pe_intpin; in pci_pir_initial_irqs()
314 pci_link = pci_pir_find_link(intpin->link); in pci_pir_initial_irqs()
315 irq = pci_pir_search_irq(entry->pe_bus, entry->pe_device, pin); in pci_pir_initial_irqs()
316 if (irq == PCI_INVALID_IRQ || irq == pci_link->pl_irq) in pci_pir_initial_irqs()
323 irq, entry->pe_bus, entry->pe_device, pin + 'A', in pci_pir_initial_irqs()
324 pci_link->pl_id); in pci_pir_initial_irqs()
332 if (pci_link->pl_irq == PCI_INVALID_IRQ) { in pci_pir_initial_irqs()
336 irq, entry->pe_bus, entry->pe_device, pin + 'A', in pci_pir_initial_irqs()
337 pci_link->pl_id); in pci_pir_initial_irqs()
338 pci_link->pl_irq = irq; in pci_pir_initial_irqs()
339 pci_link->pl_routed = 1; in pci_pir_initial_irqs()
349 * we are having to guess which setting the BIOS actually routed. in pci_pir_initial_irqs()
355 irq, entry->pe_bus, entry->pe_device, pin + 'A', in pci_pir_initial_irqs()
356 pci_link->pl_id); in pci_pir_initial_irqs()
357 } else if (!pci_pir_valid_irq(pci_link, pci_link->pl_irq)) { in pci_pir_initial_irqs()
360 irq, entry->pe_bus, entry->pe_device, pin + 'A', in pci_pir_initial_irqs()
361 pci_link->pl_id, pci_link->pl_irq); in pci_pir_initial_irqs()
362 pci_link->pl_irq = irq; in pci_pir_initial_irqs()
363 pci_link->pl_routed = 1; in pci_pir_initial_irqs()
367 irq, entry->pe_bus, entry->pe_device, pin + 'A', in pci_pir_initial_irqs()
368 pci_link->pl_id, pci_link->pl_irq); in pci_pir_initial_irqs()
398 * Check to see if the BIOS has already routed any of the links by in pci_pir_parse()
416 "hw.pci.link.%#x.irq", pci_link->pl_id); in pci_pir_parse()
425 irq, pci_link->pl_id); in pci_pir_parse()
426 pci_link->pl_routed = 0; in pci_pir_parse()
427 pci_link->pl_irq = irq; in pci_pir_parse()
436 * Build initial interrupt weights as well as bitmap of "known-good" in pci_pir_parse()
440 if (!PCI_INTERRUPT_VALID(pci_link->pl_irq)) in pci_pir_parse()
442 pir_bios_irqs |= 1 << pci_link->pl_irq; in pci_pir_parse()
443 pir_interrupt_weight[pci_link->pl_irq] += in pci_pir_parse()
444 pci_link->pl_references; in pci_pir_parse()
498 lookup.pin = pin - 1; in pci_pir_route_interrupt()
503 device, pin - 1 + 'A'); in pci_pir_route_interrupt()
512 * we check the set of known-good interrupts that the BIOS has in pci_pir_route_interrupt()
516 if (!PCI_INTERRUPT_VALID(pci_link->pl_irq)) { in pci_pir_route_interrupt()
517 if (pci_link->pl_irqmask != 0 && powerof2(pci_link->pl_irqmask)) in pci_pir_route_interrupt()
518 irq = ffs(pci_link->pl_irqmask) - 1; in pci_pir_route_interrupt()
521 pci_route_table->pt_header.ph_pci_irqs); in pci_pir_route_interrupt()
531 bus, device, pin - 1 + 'A'); in pci_pir_route_interrupt()
534 pci_link->pl_irq = irq; in pci_pir_route_interrupt()
538 if (!pci_link->pl_routed) { in pci_pir_route_interrupt()
539 error = pci_pir_biosroute(bus, device, func, pin - 1, in pci_pir_route_interrupt()
540 pci_link->pl_irq); in pci_pir_route_interrupt()
543 if (error && !powerof2(pci_link->pl_irqmask)) { in pci_pir_route_interrupt()
547 pci_link->pl_routed = 1; in pci_pir_route_interrupt()
551 BUS_CONFIG_INTR(pir_device, pci_link->pl_irq, in pci_pir_route_interrupt()
555 printf("$PIR: %d:%d INT%c routed to irq %d\n", bus, device, in pci_pir_route_interrupt()
556 pin - 1 + 'A', pci_link->pl_irq); in pci_pir_route_interrupt()
557 return (pci_link->pl_irq); in pci_pir_route_interrupt()
570 realmask = pci_link->pl_irqmask & irqmask; in pci_pir_choose_irq()
585 pci_link->pl_id); in pci_pir_choose_irq()
622 printf("%#4x %3d %c %3d ", pci_link->pl_id, in pci_pir_dump_links()
623 pci_link->pl_irq, pci_link->pl_routed ? 'Y' : 'N', in pci_pir_dump_links()
624 pci_link->pl_references); in pci_pir_dump_links()
625 pci_print_irqmask(pci_link->pl_irqmask); in pci_pir_dump_links()
631 * See if any interrupts for a given PCI bus are routed in the PIR. Don't
633 * are probing a PCI-PCI bridge, then require_parse will be true and we should
634 * only succeed if a host-PCI bridge has already attached and parsed the PIR.
644 if (pci_route_table->pt_entry[i].pe_bus == bus) in pci_pir_probe()
650 * The driver for the new-bus pseudo device pir0 for the $PIR table.
678 if (intpin->link != pd->link || pd->bus != -1) in pir_resume_find_device()
680 pd->bus = entry->pe_bus; in pir_resume_find_device()
681 pd->device = entry->pe_device; in pir_resume_find_device()
682 pd->pin = intpin - entry->pe_intpin; in pir_resume_find_device()
692 /* Ask the BIOS to re-route each link that was already routed. */ in pir_resume()
694 if (!PCI_INTERRUPT_VALID(pci_link->pl_irq)) { in pir_resume()
695 KASSERT(!pci_link->pl_routed, in pir_resume()
696 ("link %#x is routed but has invalid PCI IRQ", in pir_resume()
697 pci_link->pl_id)); in pir_resume()
700 if (pci_link->pl_routed) { in pir_resume()
701 pd.bus = -1; in pir_resume()
702 pd.link = pci_link->pl_id; in pir_resume()
704 KASSERT(pd.bus != -1, in pir_resume()
706 pci_link->pl_id)); in pir_resume()
711 pci_link->pl_id, pci_link->pl_irq); in pir_resume()
713 pci_link->pl_irq); in pir_resume()
717 pci_link->pl_id); in pir_resume()