FreeBSD/sys/powerpc/powermac/macio.c
/*
 * Add an interrupt to the dev's resource list if present
 */
Add an interrupt to the dev's resource list if present
Add an interrupt to the dev ' s resource list if present
static void
macio_add_intr(phandle_t devnode, struct macio_devinfo *dinfo)
{
	phandle_t iparent;
	int	*intr;
	int	i, nintr;
	int 	icells;
	if (dinfo->mdi_ninterrupts >= 6) {
		printf("macio: device has more than 6 interrupts\n");
		return;
	}
	nintr = OF_getprop_alloc(devnode, "interrupts", sizeof(*intr), 
		(void **)&intr);
	if (nintr == -1) {
		nintr = OF_getprop_alloc(devnode, "AAPL,interrupts", 
			sizeof(*intr), (void **)&intr);
		if (nintr == -1)
			return;
	}
	if (intr[0] == -1)
		return;
	if (OF_getprop(devnode, "interrupt-parent", &iparent, sizeof(iparent))
	    <= 0)
		panic("Interrupt but no interrupt parent!\n");
	if (OF_getprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells,
	    sizeof(icells)) <= 0)
		icells = 1;
	for (i = 0; i < nintr; i+=icells) {
		u_int irq = MAP_IRQ(iparent, intr[i]);
		resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ,
		    dinfo->mdi_ninterrupts, irq, irq, 1);
		dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = irq;
		dinfo->mdi_ninterrupts++;
	}
}
static void macio_add_intr ( phandle_t devnode , struct macio_devinfo * dinfo ) { phandle_t iparent ; int * intr ; int i , nintr ; int icells ; if ( dinfo -> mdi_ninterrupts >= 6 ) { printf ( " \n " ) ; return ; } nintr = OF_getprop_alloc ( devnode , " " , sizeof ( * intr ) , ( void * * ) & intr ) ; if ( nintr == -1 ) { nintr = OF_getprop_alloc ( devnode , " " , sizeof ( * intr ) , ( void * * ) & intr ) ; if ( nintr == -1 ) return ; } if ( intr [ 0 ] == -1 ) return ; if ( OF_getprop ( devnode , " " , & iparent , sizeof ( iparent ) ) <= 0 ) panic ( " \n " ) ; if ( OF_getprop ( OF_node_from_xref ( iparent ) , " " , & icells , sizeof ( icells ) ) <= 0 ) icells = 1 ; for ( i = 0 ; i < nintr ; i += icells ) { u_int irq = MAP_IRQ ( iparent , intr [ i ] ) ; resource_list_add ( & dinfo -> mdi_resources , SYS_RES_IRQ , dinfo -> mdi_ninterrupts , irq , irq , 1 ) ; dinfo -> mdi_interrupts [ dinfo -> mdi_ninterrupts ] = irq ; dinfo -> mdi_ninterrupts ++ ; } }
Add an interrupt to the dev's resource list if present
Add an interrupt to the dev ' s resource list if present