FreeBSD/sys/i386/pci/pci_pir.c
/*
 * Look to see if any of the function on the PCI device at bus/device have
 * an interrupt routed to intpin 'pin' by the BIOS.
 */
Look to see if any of the function on the PCI device at bus/device have
an interrupt routed to intpin 'pin' by the BIOS.
Look to see if any of the function on the PCI device at bus / device have an interrupt routed to intpin ' pin ' by the BIOS .
static uint8_t
pci_pir_search_irq(int bus, int device, int pin)
{
	uint32_t value;
	uint8_t func, maxfunc;
	value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1);
	if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE)
		return (PCI_INVALID_IRQ);
	if (value & PCIM_MFDEV)
		maxfunc = PCI_FUNCMAX;
	else
		maxfunc = 0;
	for (func = 0; func <= maxfunc; func++) {
		value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4);
		if (value == 0xffffffff)
			continue;
		value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1);
		if (value != pin + 1)
			continue;
		value = pci_cfgregread(bus, device, func, PCIR_INTLINE, 1);
		if (bootverbose)
			printf(
		"$PIR: Found matching pin for %d.%d.INT%c at func %d: %d\n",
			    bus, device, pin + 'A', func, value);
		if (value != PCI_INVALID_IRQ)
			return (value);
	}
	return (PCI_INVALID_IRQ);
}
static uint8_t pci_pir_search_irq ( int bus , int device , int pin ) { uint32_t value ; uint8_t func , maxfunc ; value = pci_cfgregread ( bus , device , 0 , PCIR_HDRTYPE , 1 ) ; if ( ( value & PCIM_HDRTYPE ) > PCI_MAXHDRTYPE ) return ( PCI_INVALID_IRQ ) ; if ( value & PCIM_MFDEV ) maxfunc = PCI_FUNCMAX ; else maxfunc = 0 ; for ( func = 0 ; func <= maxfunc ; func ++ ) { value = pci_cfgregread ( bus , device , func , PCIR_DEVVENDOR , 4 ) ; if ( value == 0xffffffff ) continue ; value = pci_cfgregread ( bus , device , func , PCIR_INTPIN , 1 ) ; if ( value != pin + 1 ) continue ; value = pci_cfgregread ( bus , device , func , PCIR_INTLINE , 1 ) ; if ( bootverbose ) printf ( " \n " , bus , device , pin + ' ' , func , value ) ; if ( value != PCI_INVALID_IRQ ) return ( value ) ; } return ( PCI_INVALID_IRQ ) ; }
Look to see if any of the function on the PCI device at bus/device have
 an interrupt routed to intpin 'pin' by the BIOS.
Look to see if any of the function on the PCI device at bus / device have an interrupt routed to intpin ' pin ' by the BIOS .
/* See if we have a valid device at function 0. */ /* Scan all possible functions at this device. */ /*
		 * See if it uses the pin in question.  Note that the passed
		 * in pin uses 0 for A, .. 3 for D whereas the intpin
		 * register uses 0 for no interrupt, 1 for A, .. 4 for D.
		 */