subr_autoconf.c (88a55912032a981bfdb62d340cab058188dd1dc2) | subr_autoconf.c (e52368365db3c0a696b37bfc09d08b7093b41b57) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This software was developed by the Computer Systems Engineering group 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and --- 124 unchanged lines hidden (view full) --- 133 mtx_unlock(&intr_config_hook_lock); 134 return; 135 } 136 running = 1; 137 138 while (next_to_notify != NULL) { 139 hook_entry = next_to_notify; 140 next_to_notify = STAILQ_NEXT(hook_entry, ich_links); | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This software was developed by the Computer Systems Engineering group 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and --- 124 unchanged lines hidden (view full) --- 133 mtx_unlock(&intr_config_hook_lock); 134 return; 135 } 136 running = 1; 137 138 while (next_to_notify != NULL) { 139 hook_entry = next_to_notify; 140 next_to_notify = STAILQ_NEXT(hook_entry, ich_links); |
141 hook_entry->ich_state = ICHS_RUNNING; |
|
141 mtx_unlock(&intr_config_hook_lock); 142 (*hook_entry->ich_func)(hook_entry->ich_arg); 143 mtx_lock(&intr_config_hook_lock); 144 } 145 146 running = 0; 147 mtx_unlock(&intr_config_hook_lock); 148} --- 45 unchanged lines hidden (view full) --- 194 mtx_unlock(&intr_config_hook_lock); 195 printf("config_intrhook_establish: establishing an " 196 "already established hook.\n"); 197 return (1); 198 } 199 STAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); 200 if (next_to_notify == NULL) 201 next_to_notify = hook; | 142 mtx_unlock(&intr_config_hook_lock); 143 (*hook_entry->ich_func)(hook_entry->ich_arg); 144 mtx_lock(&intr_config_hook_lock); 145 } 146 147 running = 0; 148 mtx_unlock(&intr_config_hook_lock); 149} --- 45 unchanged lines hidden (view full) --- 195 mtx_unlock(&intr_config_hook_lock); 196 printf("config_intrhook_establish: establishing an " 197 "already established hook.\n"); 198 return (1); 199 } 200 STAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); 201 if (next_to_notify == NULL) 202 next_to_notify = hook; |
203 hook->ich_state = ICHS_QUEUED; |
|
202 mtx_unlock(&intr_config_hook_lock); 203 if (cold == 0) 204 /* 205 * XXX Call from a task since not all drivers expect 206 * to be re-entered at the time a hook is established. 207 */ 208 /* XXX Sufficient for modules loaded after initial config??? */ 209 run_interrupt_driven_config_hooks(); --- 11 unchanged lines hidden (view full) --- 221 ohook = malloc(sizeof(*ohook), M_DEVBUF, M_WAITOK); 222 ohook->och_func = func; 223 ohook->och_arg = arg; 224 ohook->och_hook.ich_func = config_intrhook_oneshot_func; 225 ohook->och_hook.ich_arg = ohook; 226 config_intrhook_establish(&ohook->och_hook); 227} 228 | 204 mtx_unlock(&intr_config_hook_lock); 205 if (cold == 0) 206 /* 207 * XXX Call from a task since not all drivers expect 208 * to be re-entered at the time a hook is established. 209 */ 210 /* XXX Sufficient for modules loaded after initial config??? */ 211 run_interrupt_driven_config_hooks(); --- 11 unchanged lines hidden (view full) --- 223 ohook = malloc(sizeof(*ohook), M_DEVBUF, M_WAITOK); 224 ohook->och_func = func; 225 ohook->och_arg = arg; 226 ohook->och_hook.ich_func = config_intrhook_oneshot_func; 227 ohook->och_hook.ich_arg = ohook; 228 config_intrhook_establish(&ohook->och_hook); 229} 230 |
229void 230config_intrhook_disestablish(struct intr_config_hook *hook) | 231static void 232config_intrhook_disestablish_locked(struct intr_config_hook *hook) |
231{ 232 struct intr_config_hook *hook_entry; 233 | 233{ 234 struct intr_config_hook *hook_entry; 235 |
234 mtx_lock(&intr_config_hook_lock); | |
235 STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) 236 if (hook_entry == hook) 237 break; 238 if (hook_entry == NULL) 239 panic("config_intrhook_disestablish: disestablishing an " 240 "unestablished hook"); 241 242 if (next_to_notify == hook) 243 next_to_notify = STAILQ_NEXT(hook, ich_links); 244 STAILQ_REMOVE(&intr_config_hook_list, hook, intr_config_hook, ich_links); 245 TSRELEASE("config hooks"); 246 247 /* Wakeup anyone watching the list */ | 236 STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) 237 if (hook_entry == hook) 238 break; 239 if (hook_entry == NULL) 240 panic("config_intrhook_disestablish: disestablishing an " 241 "unestablished hook"); 242 243 if (next_to_notify == hook) 244 next_to_notify = STAILQ_NEXT(hook, ich_links); 245 STAILQ_REMOVE(&intr_config_hook_list, hook, intr_config_hook, ich_links); 246 TSRELEASE("config hooks"); 247 248 /* Wakeup anyone watching the list */ |
249 hook->ich_state = ICHS_DONE; |
|
248 wakeup(&intr_config_hook_list); | 250 wakeup(&intr_config_hook_list); |
251} 252 253void 254config_intrhook_disestablish(struct intr_config_hook *hook) 255{ 256 mtx_lock(&intr_config_hook_lock); 257 config_intrhook_disestablish_locked(hook); |
|
249 mtx_unlock(&intr_config_hook_lock); 250} 251 | 258 mtx_unlock(&intr_config_hook_lock); 259} 260 |
261int 262config_intrhook_drain(struct intr_config_hook *hook) 263{ 264 mtx_lock(&intr_config_hook_lock); 265 266 /* 267 * The config hook has completed, so just return. 268 */ 269 if (hook->ich_state == ICHS_DONE) { 270 mtx_unlock(&intr_config_hook_lock); 271 return (ICHS_DONE); 272 } 273 274 /* 275 * The config hook hasn't started running, just call disestablish. 276 */ 277 if (hook->ich_state == ICHS_QUEUED) { 278 config_intrhook_disestablish_locked(hook); 279 mtx_unlock(&intr_config_hook_lock); 280 return (ICHS_QUEUED); 281 } 282 283 /* 284 * The config hook is running, so wait for it to complete and return. 285 */ 286 while (hook->ich_state != ICHS_DONE) { 287 if (msleep(&intr_config_hook_list, &intr_config_hook_lock, 288 0, "confhd", hz) == EWOULDBLOCK) { 289 // XXX do I whine? 290 } 291 } 292 mtx_unlock(&intr_config_hook_lock); 293 return (ICHS_RUNNING); 294} 295 |
|
252#ifdef DDB 253#include <ddb/ddb.h> 254 255DB_SHOW_COMMAND(conifhk, db_show_conifhk) 256{ 257 struct intr_config_hook *hook_entry; 258 char namebuf[64]; 259 long offset; --- 15 unchanged lines hidden --- | 296#ifdef DDB 297#include <ddb/ddb.h> 298 299DB_SHOW_COMMAND(conifhk, db_show_conifhk) 300{ 301 struct intr_config_hook *hook_entry; 302 char namebuf[64]; 303 long offset; --- 15 unchanged lines hidden --- |