Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_intr.c
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
static void start_softintr(void *); | static void start_softintr(void *); | ||||
/* Map an interrupt type to an ithread priority. */ | /* Map an interrupt type to an ithread priority. */ | ||||
u_char | u_char | ||||
intr_priority(enum intr_type flags) | intr_priority(enum intr_type flags) | ||||
{ | { | ||||
u_char pri; | u_char pri; | ||||
flags &= (INTR_TYPE_TTY | INTR_TYPE_BIO | INTR_TYPE_NET | | switch (flags & INTR_TYPE_MASK) { | ||||
INTR_TYPE_CAM | INTR_TYPE_MISC | INTR_TYPE_CLK | INTR_TYPE_AV); | |||||
switch (flags) { | |||||
case INTR_TYPE_TTY: | case INTR_TYPE_TTY: | ||||
pri = PI_TTY; | pri = PI_TTY; | ||||
break; | break; | ||||
case INTR_TYPE_BIO: | case INTR_TYPE_BIO: | ||||
pri = PI_DISK; | pri = PI_DISK; | ||||
break; | break; | ||||
case INTR_TYPE_NET: | case INTR_TYPE_NET: | ||||
case INTR_TYPE_LKPI: | |||||
pri = PI_NET; | pri = PI_NET; | ||||
break; | break; | ||||
case INTR_TYPE_CAM: | case INTR_TYPE_CAM: | ||||
pri = PI_DISK; | pri = PI_DISK; | ||||
break; | break; | ||||
case INTR_TYPE_AV: | case INTR_TYPE_AV: | ||||
pri = PI_AV; | pri = PI_AV; | ||||
break; | break; | ||||
case INTR_TYPE_CLK: | case INTR_TYPE_CLK: | ||||
pri = PI_REALTIME; | pri = PI_REALTIME; | ||||
break; | break; | ||||
case INTR_TYPE_MISC: | case INTR_TYPE_MISC: | ||||
pri = PI_DULL; /* don't care */ | pri = PI_DULL; /* don't care */ | ||||
break; | break; | ||||
default: | default: | ||||
/* We didn't specify an interrupt level. */ | /* No interrupt level specified. */ | ||||
panic("intr_priority: no interrupt type in flags"); | panic("intr_priority: Unsupported flags(0x%08x)", flags); | ||||
} | } | ||||
return (pri); | |||||
return pri; | |||||
} | } | ||||
/* | /* | ||||
* Update an ithread based on the associated intr_event. | * Update an ithread based on the associated intr_event. | ||||
*/ | */ | ||||
static void | static void | ||||
ithread_update(struct intr_thread *ithd) | ithread_update(struct intr_thread *ithd) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | intr_event_add_handler(struct intr_event *ie, const char *name, | ||||
ih->ih_event = ie; | ih->ih_event = ie; | ||||
ih->ih_pri = pri; | ih->ih_pri = pri; | ||||
if (flags & INTR_EXCL) | if (flags & INTR_EXCL) | ||||
ih->ih_flags = IH_EXCLUSIVE; | ih->ih_flags = IH_EXCLUSIVE; | ||||
if (flags & INTR_MPSAFE) | if (flags & INTR_MPSAFE) | ||||
ih->ih_flags |= IH_MPSAFE; | ih->ih_flags |= IH_MPSAFE; | ||||
if (flags & INTR_ENTROPY) | if (flags & INTR_ENTROPY) | ||||
ih->ih_flags |= IH_ENTROPY; | ih->ih_flags |= IH_ENTROPY; | ||||
if (flags & INTR_TYPE_NET) | if ((flags & INTR_TYPE_MASK) == INTR_TYPE_NET) | ||||
ih->ih_flags |= IH_NET; | ih->ih_flags |= IH_NET; | ||||
/* We can only have one exclusive handler in a event. */ | /* We can only have one exclusive handler in a event. */ | ||||
mtx_lock(&ie->ie_lock); | mtx_lock(&ie->ie_lock); | ||||
if (!CK_SLIST_EMPTY(&ie->ie_handlers)) { | if (!CK_SLIST_EMPTY(&ie->ie_handlers)) { | ||||
if ((flags & INTR_EXCL) || | if ((flags & INTR_EXCL) || | ||||
(CK_SLIST_FIRST(&ie->ie_handlers)->ih_flags & IH_EXCLUSIVE)) { | (CK_SLIST_FIRST(&ie->ie_handlers)->ih_flags & IH_EXCLUSIVE)) { | ||||
mtx_unlock(&ie->ie_lock); | mtx_unlock(&ie->ie_lock); | ||||
▲ Show 20 Lines • Show All 1,042 Lines • Show Last 20 Lines |