FreeBSD/sys/x86/x86/intr_machdep.c
/*
 * Register a new interrupt source with the global interrupt system.
 * The global interrupts need to be disabled when this function is
 * called.
 */
Register a new interrupt source with the global interrupt system.
The global interrupts need to be disabled when this function is
called.
Register a new interrupt source with the global interrupt system . The global interrupts need to be disabled when this function is called .
int
intr_register_source(struct intsrc *isrc)
{
	int error, vector;
	KASSERT(intr_pic_registered(isrc->is_pic), ("unregistered PIC"));
	vector = isrc->is_pic->pic_vector(isrc);
	if (interrupt_sources[vector] != NULL)
		return (EEXIST);
	error = intr_event_create(&isrc->is_event, isrc, 0, vector,
	    intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
	    (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
	    vector);
	if (error)
		return (error);
	mtx_lock(&intr_table_lock);
	if (interrupt_sources[vector] != NULL) {
		mtx_unlock(&intr_table_lock);
		intr_event_destroy(isrc->is_event);
		return (EEXIST);
	}
	intrcnt_register(isrc);
	interrupt_sources[vector] = isrc;
	isrc->is_handlers = 0;
	mtx_unlock(&intr_table_lock);
	return (0);
}
int intr_register_source ( struct intsrc * isrc ) { int error , vector ; KASSERT ( intr_pic_registered ( isrc -> is_pic ) , ( " " ) ) ; vector = isrc -> is_pic -> pic_vector ( isrc ) ; if ( interrupt_sources [ vector ] != NULL ) return ( EEXIST ) ; error = intr_event_create ( & isrc -> is_event , isrc , 0 , vector , intr_disable_src , ( mask_fn ) isrc -> is_pic -> pic_enable_source , ( mask_fn ) isrc -> is_pic -> pic_eoi_source , intr_assign_cpu , " " , vector ) ; if ( error ) return ( error ) ; mtx_lock ( & intr_table_lock ) ; if ( interrupt_sources [ vector ] != NULL ) { mtx_unlock ( & intr_table_lock ) ; intr_event_destroy ( isrc -> is_event ) ; return ( EEXIST ) ; } intrcnt_register ( isrc ) ; interrupt_sources [ vector ] = isrc ; isrc -> is_handlers = 0 ; mtx_unlock ( & intr_table_lock ) ; return ( 0 ) ; }
Register a new interrupt source with the global interrupt system.
Register a new interrupt source with the global interrupt system .