* Add a software interrupt handler to a specified event. If a given event * is not specified, then a new event is created. */
| 1016 | * is not specified, then a new event is created. |
| 1017 | */ |
| 1018 | int |
| 1019 | swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, |
| 1020 | void *arg, int pri, enum intr_type flags, void **cookiep) |
| 1021 | { |
| 1022 | struct intr_event *ie; |
| 1023 | int error = 0; |
| 1024 | |
| 1025 | if (flags & INTR_ENTROPY) |
| 1026 | return (EINVAL); |
| 1027 | |
| 1028 | ie = (eventp != NULL) ? *eventp : NULL; |
| 1029 | |
| 1030 | if (ie != NULL) { |
| 1031 | if (!(ie->ie_flags & IE_SOFT)) |
| 1032 | return (EINVAL); |
| 1033 | } else { |
| 1034 | error = intr_event_create(&ie, NULL, IE_SOFT, 0, |
| 1035 | NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri); |
| 1036 | if (error) |
| 1037 | return (error); |
| 1038 | if (eventp != NULL) |
| 1039 | *eventp = ie; |
| 1040 | } |
| 1041 | if (handler != NULL) { |
| 1042 | error = intr_event_add_handler(ie, name, NULL, handler, arg, |
| 1043 | PI_SWI(pri), flags, cookiep); |
| 1044 | } |
| 1045 | return (error); |
| 1046 | } |
| 1047 | |
| 1048 | /* |
| 1049 | * Schedule a software interrupt thread. |
no test coverage detected