Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/subr_intr.c
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
static struct intr_pic *pic_lookup(device_t dev, intptr_t xref, int flags); | static struct intr_pic *pic_lookup(device_t dev, intptr_t xref, int flags); | ||||
/* Interrupt source definition. */ | /* Interrupt source definition. */ | ||||
static struct mtx isrc_table_lock; | static struct mtx isrc_table_lock; | ||||
static struct intr_irqsrc *irq_sources[NIRQ]; | static struct intr_irqsrc *irq_sources[NIRQ]; | ||||
u_int irq_next_free; | u_int irq_next_free; | ||||
#ifdef SMP | #ifdef SMP | ||||
static boolean_t irq_assign_cpu = FALSE; | #ifdef EARLY_AP_STARTUP | ||||
static bool irq_assign_cpu = true; | |||||
#else | |||||
static bool irq_assign_cpu = false; | |||||
#endif | #endif | ||||
#endif | |||||
/* | /* | ||||
* - 2 counters for each I/O interrupt. | * - 2 counters for each I/O interrupt. | ||||
* - MAXCPU counters for each IPI counters for SMP. | * - MAXCPU counters for each IPI counters for SMP. | ||||
*/ | */ | ||||
#ifdef SMP | #ifdef SMP | ||||
#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) | #define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) | ||||
#else | #else | ||||
▲ Show 20 Lines • Show All 1,045 Lines • ▼ Show 20 Lines | intr_irq_next_cpu(u_int last_cpu, cpuset_t *cpumask) | ||||
do { | do { | ||||
last_cpu++; | last_cpu++; | ||||
if (last_cpu > mp_maxid) | if (last_cpu > mp_maxid) | ||||
last_cpu = 0; | last_cpu = 0; | ||||
} while (!CPU_ISSET(last_cpu, cpumask)); | } while (!CPU_ISSET(last_cpu, cpumask)); | ||||
return (last_cpu); | return (last_cpu); | ||||
} | } | ||||
#ifndef EARLY_AP_STARTUP | |||||
/* | /* | ||||
* Distribute all the interrupt sources among the available | * Distribute all the interrupt sources among the available | ||||
* CPUs once the AP's have been launched. | * CPUs once the AP's have been launched. | ||||
*/ | */ | ||||
static void | static void | ||||
intr_irq_shuffle(void *arg __unused) | intr_irq_shuffle(void *arg __unused) | ||||
{ | { | ||||
struct intr_irqsrc *isrc; | struct intr_irqsrc *isrc; | ||||
u_int i; | u_int i; | ||||
if (mp_ncpus == 1) | if (mp_ncpus == 1) | ||||
return; | return; | ||||
mtx_lock(&isrc_table_lock); | mtx_lock(&isrc_table_lock); | ||||
irq_assign_cpu = TRUE; | irq_assign_cpu = true; | ||||
for (i = 0; i < NIRQ; i++) { | for (i = 0; i < NIRQ; i++) { | ||||
isrc = irq_sources[i]; | isrc = irq_sources[i]; | ||||
if (isrc == NULL || isrc->isrc_handlers == 0 || | if (isrc == NULL || isrc->isrc_handlers == 0 || | ||||
isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) | isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) | ||||
continue; | continue; | ||||
if (isrc->isrc_event != NULL && | if (isrc->isrc_event != NULL && | ||||
isrc->isrc_flags & INTR_ISRCF_BOUND && | isrc->isrc_flags & INTR_ISRCF_BOUND && | ||||
Show All 9 Lines | for (i = 0; i < NIRQ; i++) { | ||||
* isrc_cpu so inconsistency with ie_cpu will be detectable. | * isrc_cpu so inconsistency with ie_cpu will be detectable. | ||||
*/ | */ | ||||
if (PIC_BIND_INTR(isrc->isrc_dev, isrc) != 0) | if (PIC_BIND_INTR(isrc->isrc_dev, isrc) != 0) | ||||
CPU_ZERO(&isrc->isrc_cpu); | CPU_ZERO(&isrc->isrc_cpu); | ||||
} | } | ||||
mtx_unlock(&isrc_table_lock); | mtx_unlock(&isrc_table_lock); | ||||
} | } | ||||
SYSINIT(intr_irq_shuffle, SI_SUB_SMP, SI_ORDER_SECOND, intr_irq_shuffle, NULL); | SYSINIT(intr_irq_shuffle, SI_SUB_SMP, SI_ORDER_SECOND, intr_irq_shuffle, NULL); | ||||
#endif /* !EARLY_AP_STARTUP */ | |||||
#else | #else | ||||
u_int | u_int | ||||
intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask) | intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask) | ||||
{ | { | ||||
return (PCPU_GET(cpuid)); | return (PCPU_GET(cpuid)); | ||||
} | } | ||||
#endif | #endif /* SMP */ | ||||
/* | /* | ||||
* Allocate memory for new intr_map_data structure. | * Allocate memory for new intr_map_data structure. | ||||
* Initialize common fields. | * Initialize common fields. | ||||
*/ | */ | ||||
struct intr_map_data * | struct intr_map_data * | ||||
intr_alloc_map_data(enum intr_map_data_type type, size_t len, int flags) | intr_alloc_map_data(enum intr_map_data_type type, size_t len, int flags) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 412 Lines • Show Last 20 Lines |