| 253 | } |
| 254 | |
| 255 | int |
| 256 | intr_event_create(struct intr_event **event, void *source, int flags, int irq, |
| 257 | void (*pre_ithread)(void *), void (*post_ithread)(void *), |
| 258 | void (*post_filter)(void *), int (*assign_cpu)(void *, int), |
| 259 | const char *fmt, ...) |
| 260 | { |
| 261 | struct intr_event *ie; |
| 262 | va_list ap; |
| 263 | |
| 264 | /* The only valid flag during creation is IE_SOFT. */ |
| 265 | if ((flags & ~IE_SOFT) != 0) |
| 266 | return (EINVAL); |
| 267 | ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO); |
| 268 | ie->ie_source = source; |
| 269 | ie->ie_pre_ithread = pre_ithread; |
| 270 | ie->ie_post_ithread = post_ithread; |
| 271 | ie->ie_post_filter = post_filter; |
| 272 | ie->ie_assign_cpu = assign_cpu; |
| 273 | ie->ie_flags = flags; |
| 274 | ie->ie_irq = irq; |
| 275 | ie->ie_cpu = NOCPU; |
| 276 | CK_SLIST_INIT(&ie->ie_handlers); |
| 277 | mtx_init(&ie->ie_lock, "intr event", NULL, MTX_DEF); |
| 278 | |
| 279 | va_start(ap, fmt); |
| 280 | vsnprintf(ie->ie_name, sizeof(ie->ie_name), fmt, ap); |
| 281 | va_end(ap); |
| 282 | strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname)); |
| 283 | mtx_lock(&event_lock); |
| 284 | TAILQ_INSERT_TAIL(&event_list, ie, ie_list); |
| 285 | mtx_unlock(&event_lock); |
| 286 | if (event != NULL) |
| 287 | *event = ie; |
| 288 | CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name); |
| 289 | return (0); |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * Bind an interrupt event to the specified CPU. Note that not all |
no test coverage detected