FreeBSD/sys/i386/pci/pci_pir.c
/*
 * Look for the interrupt routing table.
 *
 * We use PCI BIOS's PIR table if it's available. $PIR is the standard way
 * to do this.  Sadly, some machines are not standards conforming and have
 * _PIR instead.  We shrug and cope by looking for both.
 */
Look for the interrupt routing table.
We use PCI BIOS's PIR table if it's available. $PIR is the standard way
to do this.  Sadly, some machines are not standards conforming and have
_PIR instead.  We shrug and cope by looking for both.
Look for the interrupt routing table . We use PCI BIOS ' s PIR table if it ' s available . $PIR is the standard way to do this . Sadly some machines are not standards conforming and have _PIR instead . We shrug and cope by looking for both .
void
pci_pir_open(void)
{
	struct PIR_table *pt;
	uint32_t sigaddr;
	int i;
	uint8_t ck, *cv;
	if (pci_route_table != NULL)
		return;
	sigaddr = bios_sigsearch(0, "$PIR", 4, 16, 0);
	if (sigaddr == 0)
		sigaddr = bios_sigsearch(0, "_PIR", 4, 16, 0);
	if (sigaddr == 0)
		return;
	pt = (struct PIR_table *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr);
	if (pt->pt_header.ph_length <= sizeof(struct PIR_header))
		return;
	for (cv = (u_int8_t *)pt, ck = 0, i = 0;
	     i < (pt->pt_header.ph_length); i++)
		ck += cv[i];
	if (ck != 0)
		return;
	pci_route_table = pt;
	pci_route_count = (pt->pt_header.ph_length -
	    sizeof(struct PIR_header)) / 
	    sizeof(struct PIR_entry);
}
void pci_pir_open ( void ) { struct PIR_table * pt ; uint32_t sigaddr ; int i ; uint8_t ck , * cv ; if ( pci_route_table != NULL ) return ; sigaddr = bios_sigsearch ( 0 , " " , 4 , 16 , 0 ) ; if ( sigaddr == 0 ) sigaddr = bios_sigsearch ( 0 , " " , 4 , 16 , 0 ) ; if ( sigaddr == 0 ) return ; pt = ( struct PIR_table * ) ( uintptr_t ) BIOS_PADDRTOVADDR ( sigaddr ) ; if ( pt -> pt_header . ph_length <= sizeof ( struct PIR_header ) ) return ; for ( cv = ( u_int8_t * ) pt , ck = 0 , i = 0 ; i < ( pt -> pt_header . ph_length ) ; i ++ ) ck += cv [ i ] ; if ( ck != 0 ) return ; pci_route_table = pt ; pci_route_count = ( pt -> pt_header . ph_length - sizeof ( struct PIR_header ) ) / sizeof ( struct PIR_entry ) ; }
Look for the interrupt routing table.
Look for the interrupt routing table .
/* Don't try if we've already found a table. */ /* Look for $PIR and then _PIR. */ /* If we found something, check the checksum and length. */ /* XXX - Use pmap_mapdev()? */ /* Ok, we've got a valid table. */