FreeBSD/sys/i386/pci/pci_pir.c
/*
 * Try to initialize IRQ based on this device's IRQ.
 */
Try to initialize IRQ based on this device's IRQ.
Try to initialize IRQ based on this device ' s IRQ .
static void
pci_pir_initial_irqs(struct PIR_entry *entry, struct PIR_intpin *intpin,
    void *arg)
{
	struct pci_link *pci_link;
	uint8_t irq, pin;
	pin = intpin - entry->pe_intpin;
	pci_link = pci_pir_find_link(intpin->link);
	irq = pci_pir_search_irq(entry->pe_bus, entry->pe_device, pin);
	if (irq == PCI_INVALID_IRQ || irq == pci_link->pl_irq)
		return;
	if (irq >= NUM_ISA_INTERRUPTS) {
		printf(
	"$PIR: Ignoring invalid BIOS IRQ %d from %d.%d.INT%c for link %#x\n",
		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
		    pci_link->pl_id);
		return;
	}
	if (pci_link->pl_irq == PCI_INVALID_IRQ) {
		if (!pci_pir_valid_irq(pci_link, irq))
			printf(
	"$PIR: Using invalid BIOS IRQ %d from %d.%d.INT%c for link %#x\n",
			    irq, entry->pe_bus, entry->pe_device, pin + 'A',
			    pci_link->pl_id);
		pci_link->pl_irq = irq;
		pci_link->pl_routed = 1;
		return;
	}
	if (!pci_pir_valid_irq(pci_link, irq)) {
		printf(
		"$PIR: BIOS IRQ %d for %d.%d.INT%c is not valid for link %#x\n",
		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
		    pci_link->pl_id);
	} else if (!pci_pir_valid_irq(pci_link, pci_link->pl_irq)) {
		printf(
"$PIR: Preferring valid BIOS IRQ %d from %d.%d.INT%c for link %#x to IRQ %d\n", 
		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
		    pci_link->pl_id, pci_link->pl_irq);
		pci_link->pl_irq = irq;
		pci_link->pl_routed = 1;
	} else
		printf(
	"$PIR: BIOS IRQ %d for %d.%d.INT%c does not match link %#x irq %d\n",
		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
		    pci_link->pl_id, pci_link->pl_irq);
}
static void pci_pir_initial_irqs ( struct PIR_entry * entry , struct PIR_intpin * intpin , void * arg ) { struct pci_link * pci_link ; uint8_t irq , pin ; pin = intpin - entry -> pe_intpin ; pci_link = pci_pir_find_link ( intpin -> link ) ; irq = pci_pir_search_irq ( entry -> pe_bus , entry -> pe_device , pin ) ; if ( irq == PCI_INVALID_IRQ || irq == pci_link -> pl_irq ) return ; if ( irq >= NUM_ISA_INTERRUPTS ) { printf ( " \n " , irq , entry -> pe_bus , entry -> pe_device , pin + ' ' , pci_link -> pl_id ) ; return ; } if ( pci_link -> pl_irq == PCI_INVALID_IRQ ) { if ( ! pci_pir_valid_irq ( pci_link , irq ) ) printf ( " \n " , irq , entry -> pe_bus , entry -> pe_device , pin + ' ' , pci_link -> pl_id ) ; pci_link -> pl_irq = irq ; pci_link -> pl_routed = 1 ; return ; } if ( ! pci_pir_valid_irq ( pci_link , irq ) ) { printf ( " \n " , irq , entry -> pe_bus , entry -> pe_device , pin + ' ' , pci_link -> pl_id ) ; } else if ( ! pci_pir_valid_irq ( pci_link , pci_link -> pl_irq ) ) { printf ( " \n " , irq , entry -> pe_bus , entry -> pe_device , pin + ' ' , pci_link -> pl_id , pci_link -> pl_irq ) ; pci_link -> pl_irq = irq ; pci_link -> pl_routed = 1 ; } else printf ( " \n " , irq , entry -> pe_bus , entry -> pe_device , pin + ' ' , pci_link -> pl_id , pci_link -> pl_irq ) ; }
Try to initialize IRQ based on this device's IRQ.
Try to initialize IRQ based on this device ' s IRQ .
/* Don't trust any BIOS IRQs greater than 15. */ /*
	 * If we don't have an IRQ for this link yet, then we trust the
	 * BIOS, even if it seems invalid from the $PIR entries.
	 */ /*
	 * We have an IRQ and it doesn't match the current IRQ for this
	 * link.  If the new IRQ is invalid, then warn about it and ignore
	 * it.  If the old IRQ is invalid and the new IRQ is valid, then
	 * prefer the new IRQ instead.  If both IRQs are valid, then just
	 * use the first one.  Note that if we ever get into this situation
	 * we are having to guess which setting the BIOS actually routed.
	 * Perhaps we should just give up instead.
	 */