FreeBSD/sys/i386/pci/pci_pir.c
/*
 * Parse $PIR to enumerate link devices and attempt to determine their
 * initial state.  This could perhaps be cleaner if we had drivers for the
 * various interrupt routers as they could read the initial IRQ for each
 * link.
 */
Parse $PIR to enumerate link devices and attempt to determine their
initial state.  This could perhaps be cleaner if we had drivers for the
various interrupt routers as they could read the initial IRQ for each
link.
Parse $PIR to enumerate link devices and attempt to determine their initial state . This could perhaps be cleaner if we had drivers for the various interrupt routers as they could read the initial IRQ for each link .
static void
pci_pir_parse(void)
{
	char tunable_buffer[64];
	struct pci_link *pci_link;
	int i, irq;
	if (pir_parsed)
		return;
	pir_parsed = 1;
	TAILQ_INIT(&pci_links);
	pci_pir_walk_table(pci_pir_create_links, NULL);
	if (bootverbose) {
		printf("$PIR: Links after initial probe:\n");
		pci_pir_dump_links();
	}
	pci_pir_walk_table(pci_pir_initial_irqs, NULL);
	if (bootverbose) {
		printf("$PIR: Links after initial IRQ discovery:\n");
		pci_pir_dump_links();
	}
	i = 0;
	TAILQ_FOREACH(pci_link, &pci_links, pl_links) {
		snprintf(tunable_buffer, sizeof(tunable_buffer),
		    "hw.pci.link.%#x.irq", pci_link->pl_id);
		if (getenv_int(tunable_buffer, &irq) == 0)
			continue;
		if (irq == 0)
			irq = PCI_INVALID_IRQ;
		if (irq != PCI_INVALID_IRQ &&
		    !pci_pir_valid_irq(pci_link, irq) && bootverbose)
			printf(
		"$PIR: Warning, IRQ %d for link %#x is not listed as valid\n",
			    irq, pci_link->pl_id);
		pci_link->pl_routed = 0;
		pci_link->pl_irq = irq;
		i = 1;
	}
	if (bootverbose && i) {
		printf("$PIR: Links after tunable overrides:\n");
		pci_pir_dump_links();
	}
	TAILQ_FOREACH(pci_link, &pci_links, pl_links) {
		if (!PCI_INTERRUPT_VALID(pci_link->pl_irq))
			continue;
		pir_bios_irqs |= 1 << pci_link->pl_irq;
		pir_interrupt_weight[pci_link->pl_irq] +=
		    pci_link->pl_references;
	}
	if (bootverbose) {
		printf("$PIR: IRQs used by BIOS: ");
		pci_print_irqmask(pir_bios_irqs);
		printf("\n");
		printf("$PIR: Interrupt Weights:\n[ ");
		for (i = 0; i < NUM_ISA_INTERRUPTS; i++)
			printf(" %3d", i);
		printf(" ]\n[ ");
		for (i = 0; i < NUM_ISA_INTERRUPTS; i++)
			printf(" %3d", pir_interrupt_weight[i]);
		printf(" ]\n");
	}
}
static void pci_pir_parse ( void ) { char tunable_buffer [ 64 ] ; struct pci_link * pci_link ; int i , irq ; if ( pir_parsed ) return ; pir_parsed = 1 ; TAILQ_INIT ( & pci_links ) ; pci_pir_walk_table ( pci_pir_create_links , NULL ) ; if ( bootverbose ) { printf ( " \n " ) ; pci_pir_dump_links ( ) ; } pci_pir_walk_table ( pci_pir_initial_irqs , NULL ) ; if ( bootverbose ) { printf ( " \n " ) ; pci_pir_dump_links ( ) ; } i = 0 ; TAILQ_FOREACH ( pci_link , & pci_links , pl_links ) { snprintf ( tunable_buffer , sizeof ( tunable_buffer ) , " " , pci_link -> pl_id ) ; if ( getenv_int ( tunable_buffer , & irq ) == 0 ) continue ; if ( irq == 0 ) irq = PCI_INVALID_IRQ ; if ( irq != PCI_INVALID_IRQ && ! pci_pir_valid_irq ( pci_link , irq ) && bootverbose ) printf ( " \n " , irq , pci_link -> pl_id ) ; pci_link -> pl_routed = 0 ; pci_link -> pl_irq = irq ; i = 1 ; } if ( bootverbose && i ) { printf ( " \n " ) ; pci_pir_dump_links ( ) ; } TAILQ_FOREACH ( pci_link , & pci_links , pl_links ) { if ( ! PCI_INTERRUPT_VALID ( pci_link -> pl_irq ) ) continue ; pir_bios_irqs |= 1 << pci_link -> pl_irq ; pir_interrupt_weight [ pci_link -> pl_irq ] += pci_link -> pl_references ; } if ( bootverbose ) { printf ( " " ) ; pci_print_irqmask ( pir_bios_irqs ) ; printf ( " \n " ) ; printf ( " \n " ) ; for ( i = 0 ; i < NUM_ISA_INTERRUPTS ; i ++ ) printf ( " " , i ) ; printf ( " \n " ) ; for ( i = 0 ; i < NUM_ISA_INTERRUPTS ; i ++ ) printf ( " " , pir_interrupt_weight [ i ] ) ; printf ( " \n " ) ; } }
Parse $PIR to enumerate link devices and attempt to determine their
 initial state.
Parse $PIR to enumerate link devices and attempt to determine their initial state .
/* Only parse once. */ /* Enumerate link devices. */ /*
	 * Check to see if the BIOS has already routed any of the links by
	 * checking each device connected to each link to see if it has a
	 * valid IRQ.
	 */ /*
	 * Allow the user to override the IRQ for a given link device.  We
	 * allow invalid IRQs to be specified but warn about them.  An IRQ
	 * of 255 or 0 clears any preset IRQ.
	 */ /*
	 * Build initial interrupt weights as well as bitmap of "known-good"
	 * IRQs that the BIOS has already used for PCI link devices.
	 */