FreeBSD/sys/x86/x86/local_apic.c
/* Request a free IDT vector to be used by the specified IRQ. */
Request a free IDT vector to be used by the specified IRQ.
Request a free IDT vector to be used by the specified IRQ .
static u_int
native_apic_alloc_vector(u_int apic_id, u_int irq)
{
	u_int vector;
	KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq));
	mtx_lock_spin(&icu_lock);
	for (vector = 0; vector < APIC_NUM_IOINTS; vector++) {
		if (lapics[apic_id].la_ioint_irqs[vector] != -1)
			continue;
		lapics[apic_id].la_ioint_irqs[vector] = irq;
		mtx_unlock_spin(&icu_lock);
		return (vector + APIC_IO_INTS);
	}
	mtx_unlock_spin(&icu_lock);
	return (0);
}
static u_int native_apic_alloc_vector ( u_int apic_id , u_int irq ) { u_int vector ; KASSERT ( irq < NUM_IO_INTS , ( " " , irq ) ) ; mtx_lock_spin ( & icu_lock ) ; for ( vector = 0 ; vector < APIC_NUM_IOINTS ; vector ++ ) { if ( lapics [ apic_id ] . la_ioint_irqs [ vector ] != -1 ) continue ; lapics [ apic_id ] . la_ioint_irqs [ vector ] = irq ; mtx_unlock_spin ( & icu_lock ) ; return ( vector + APIC_IO_INTS ) ; } mtx_unlock_spin ( & icu_lock ) ; return ( 0 ) ; }
Request a free IDT vector to be used by the specified IRQ.
Request a free IDT vector to be used by the specified IRQ .
/*
	 * Search for a free vector.  Currently we just use a very simple
	 * algorithm to find the first free vector.
	 */