Changeset b14e35f2 in mainline
- Timestamp:
- 2006-10-17T21:20:00Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb8335c
- Parents:
- 4874c2d
- Location:
- kernel/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r4874c2d rb14e35f2 175 175 waitq_t wq; 176 176 177 link_t connected_phones; 178 link_t calls; 179 link_t dispatched_calls; 180 181 link_t answers; 177 link_t connected_phones; /**< Phones connected to this answerbox */ 178 link_t calls; /**< Received calls */ 179 link_t dispatched_calls; /* Should be hash table in the future */ 180 181 link_t answers; /**< Answered calls */ 182 182 183 183 SPINLOCK_DECLARE(irq_lock); 184 link_t irq_notifs; /**< Notifications from IRQ handlers */ 184 link_t irq_notifs; /**< Notifications from IRQ handlers */ 185 link_t irq_head; /**< IRQs with notifications to this answerbox. */ 185 186 }; 186 187 -
kernel/generic/include/ipc/irq.h
r4874c2d rb14e35f2 72 72 #include <typedefs.h> 73 73 #include <arch/types.h> 74 #include <adt/list.h> 74 75 75 76 /** IPC notification config structure. … … 84 85 irq_code_t *code; /**< Top-half pseudocode. */ 85 86 count_t counter; /**< Counter. */ 87 link_t link; /**< Link between IRQs that are notifying the 88 same answerbox. The list is protected by 89 the answerbox irq_lock. */ 86 90 }; 87 91 -
kernel/generic/src/ddi/irq.c
r4874c2d rb14e35f2 146 146 irq->handler = NULL; 147 147 irq->arg = NULL; 148 irq->notif_cfg.notify = false; 148 149 irq->notif_cfg.answerbox = NULL; 149 150 irq->notif_cfg.code = NULL; 150 151 irq->notif_cfg.method = 0; 151 152 irq->notif_cfg.counter = 0; 153 link_initialize(&irq->notif_cfg.link); 152 154 } 153 155 -
kernel/generic/src/ipc/ipc.c
r4874c2d rb14e35f2 109 109 list_initialize(&box->answers); 110 110 list_initialize(&box->irq_notifs); 111 list_initialize(&box->irq_head); 111 112 box->task = TASK; 112 113 } -
kernel/generic/src/ipc/irq.c
r4874c2d rb14e35f2 177 177 if (irq) { 178 178 if (irq->notif_cfg.answerbox == box) { 179 code_free(irq->notif_cfg.code); 179 180 irq->notif_cfg.notify = false; 180 181 irq->notif_cfg.answerbox = NULL; … … 182 183 irq->notif_cfg.method = 0; 183 184 irq->notif_cfg.counter = 0; 184 code_free(irq->notif_cfg.code); 185 186 spinlock_lock(&box->irq_lock); 187 list_remove(&irq->notif_cfg.link); 188 spinlock_unlock(&box->irq_lock); 189 185 190 spinlock_unlock(&irq->lock); 186 191 } … … 199 204 * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success. 200 205 */ 201 int 202 ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) 206 int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) 203 207 { 204 208 ipl_t ipl; … … 233 237 irq->notif_cfg.code = code; 234 238 irq->notif_cfg.counter = 0; 239 240 spinlock_lock(&box->irq_lock); 241 list_append(&irq->notif_cfg.link, &box->irq_head); 242 spinlock_unlock(&box->irq_lock); 243 235 244 spinlock_unlock(&irq->lock); 236 245 interrupts_restore(ipl); … … 311 320 /** Disconnect all IRQ notifications from an answerbox. 312 321 * 322 * This function is effective because the answerbox contains 323 * list of all irq_t structures that are registered to 324 * send notifications to it. 325 * 313 326 * @param box Answerbox for which we want to carry out the cleanup. 314 327 */ 315 328 void ipc_irq_cleanup(answerbox_t *box) 316 329 { 317 /* TODO */ 330 ipl_t ipl; 331 332 loop: 333 ipl = interrupts_disable(); 334 spinlock_lock(&box->irq_lock); 335 336 while (box->irq_head.next != &box->irq_head) { 337 link_t *cur = box->irq_head.next; 338 irq_t *irq; 339 340 irq = list_get_instance(cur, irq_t, notif_cfg.link); 341 if (!spinlock_trylock(&irq->lock)) { 342 /* 343 * Avoid deadlock by trying again. 344 */ 345 spinlock_unlock(&box->irq_lock); 346 interrupts_restore(ipl); 347 goto loop; 348 } 349 350 ASSERT(irq->notif_cfg.answerbox == box); 351 352 list_remove(&irq->notif_cfg.link); 353 354 /* 355 * Don't forget to free any top-half pseudocode. 356 */ 357 code_free(irq->notif_cfg.code); 358 359 irq->notif_cfg.notify = false; 360 irq->notif_cfg.answerbox = NULL; 361 irq->notif_cfg.code = NULL; 362 irq->notif_cfg.method = 0; 363 irq->notif_cfg.counter = 0; 364 365 spinlock_unlock(&irq->lock); 366 } 367 368 spinlock_unlock(&box->irq_lock); 369 interrupts_restore(ipl); 318 370 } 319 371
Note:
See TracChangeset
for help on using the changeset viewer.