Changeset c4e4507 in mainline for generic/src/ipc/ipc.c
- Timestamp:
- 2006-06-04T17:17:29Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2cb5e64
- Parents:
- fe19611
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/ipc/ipc.c
rfe19611 rc4e4507 111 111 spinlock_lock(&phone->lock); 112 112 113 ASSERT(!phone->callee);114 113 phone->state = IPC_PHONE_CONNECTED; 115 114 phone->callee = box; 116 115 117 116 spinlock_lock(&box->lock); 118 list_append(&phone->li st, &box->connected_phones);117 list_append(&phone->link, &box->connected_phones); 119 118 spinlock_unlock(&box->lock); 120 119 … … 156 155 157 156 spinlock_lock(&callerbox->lock); 158 list_append(&call->li st, &callerbox->answers);157 list_append(&call->link, &callerbox->answers); 159 158 spinlock_unlock(&callerbox->lock); 160 159 waitq_wakeup(&callerbox->wq, 0); … … 170 169 /* Remove from active box */ 171 170 spinlock_lock(&box->lock); 172 list_remove(&call->li st);171 list_remove(&call->link); 173 172 spinlock_unlock(&box->lock); 174 173 /* Send back answer */ … … 198 197 199 198 spinlock_lock(&box->lock); 200 list_append(&call->li st, &box->calls);199 list_append(&call->link, &box->calls); 201 200 spinlock_unlock(&box->lock); 202 201 waitq_wakeup(&box->wq, 0); … … 262 261 /* Remove myself from answerbox */ 263 262 spinlock_lock(&box->lock); 264 list_remove(&phone->li st);263 list_remove(&phone->link); 265 264 spinlock_unlock(&box->lock); 266 265 … … 277 276 } 278 277 279 phone->callee = 0;280 281 278 phone->state = IPC_PHONE_HUNGUP; 282 279 spinlock_unlock(&phone->lock); … … 298 295 { 299 296 spinlock_lock(&oldbox->lock); 300 list_remove(&call->li st);297 list_remove(&call->link); 301 298 spinlock_unlock(&oldbox->lock); 302 299 … … 331 328 spinlock_lock(&box->irq_lock); 332 329 333 request = list_get_instance(box->irq_notifs.next, call_t, li st);334 list_remove(&request->li st);330 request = list_get_instance(box->irq_notifs.next, call_t, link); 331 list_remove(&request->link); 335 332 336 333 spinlock_unlock(&box->irq_lock); … … 338 335 } else if (!list_empty(&box->answers)) { 339 336 /* Handle asynchronous answers */ 340 request = list_get_instance(box->answers.next, call_t, li st);341 list_remove(&request->li st);337 request = list_get_instance(box->answers.next, call_t, link); 338 list_remove(&request->link); 342 339 atomic_dec(&request->data.phone->active_calls); 343 340 } else if (!list_empty(&box->calls)) { 344 341 /* Handle requests */ 345 request = list_get_instance(box->calls.next, call_t, li st);346 list_remove(&request->li st);342 request = list_get_instance(box->calls.next, call_t, link); 343 list_remove(&request->link); 347 344 /* Append request to dispatch queue */ 348 list_append(&request->li st, &box->dispatched_calls);345 list_append(&request->link, &box->dispatched_calls); 349 346 } else { 350 347 /* This can happen regularly after ipc_cleanup, remove … … 365 362 366 363 while (!list_empty(lst)) { 367 call = list_get_instance(lst->next, call_t, li st);368 list_remove(&call->li st);364 call = list_get_instance(lst->next, call_t, link); 365 list_remove(&call->link); 369 366 370 367 IPC_SET_RETVAL(call->data, EHANGUP); … … 395 392 while (!list_empty(&task->answerbox.connected_phones)) { 396 393 phone = list_get_instance(task->answerbox.connected_phones.next, 397 phone_t, 398 list); 394 phone_t, link); 399 395 if (! spinlock_trylock(&phone->lock)) { 400 396 spinlock_unlock(&task->answerbox.lock); … … 405 401 ASSERT(phone->state == IPC_PHONE_CONNECTED); 406 402 phone->state = IPC_PHONE_SLAMMED; 407 list_remove(&phone->li st);403 list_remove(&phone->link); 408 404 409 405 spinlock_unlock(&phone->lock); … … 452 448 } 453 449 450 451 /** Kconsole - list answerbox contents */ 452 void ipc_print_task(task_id_t taskid) 453 { 454 task_t *task; 455 int i; 456 call_t *call; 457 link_t *tmp; 458 459 spinlock_lock(&tasks_lock); 460 task = task_find_by_id(taskid); 461 if (task) 462 spinlock_lock(&task->lock); 463 spinlock_unlock(&tasks_lock); 464 if (!task) 465 return; 466 467 /* Print opened phones & details */ 468 printf("PHONE:\n"); 469 for (i=0; i < IPC_MAX_PHONES;i++) { 470 spinlock_lock(&task->phones[i].lock); 471 if (task->phones[i].state != IPC_PHONE_FREE) { 472 printf("%d: ",i); 473 switch (task->phones[i].state) { 474 case IPC_PHONE_CONNECTING: 475 printf("connecting "); 476 break; 477 case IPC_PHONE_CONNECTED: 478 printf("connected to: %P ", 479 task->phones[i].callee); 480 break; 481 case IPC_PHONE_SLAMMED: 482 printf("slammed by: %P ", 483 task->phones[i].callee); 484 break; 485 case IPC_PHONE_HUNGUP: 486 printf("hung up - was: %P ", 487 task->phones[i].callee); 488 break; 489 default: 490 break; 491 } 492 printf("active: %d\n", atomic_get(&task->phones[i].active_calls)); 493 } 494 spinlock_unlock(&task->phones[i].lock); 495 } 496 497 498 /* Print answerbox - calls */ 499 spinlock_lock(&task->answerbox.lock); 500 printf("ABOX - CALLS:\n"); 501 for (tmp=task->answerbox.calls.next; tmp != &task->answerbox.calls;tmp = tmp->next) { 502 call = list_get_instance(tmp, call_t, link); 503 printf("Callid: %P Srctask:%lld M:%d A1:%d A2:%d A3:%d Flags:%x\n",call, 504 call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data), 505 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags); 506 } 507 /* Print answerbox - calls */ 508 printf("ABOX - DISPATCHED CALLS:\n"); 509 for (tmp=task->answerbox.dispatched_calls.next; 510 tmp != &task->answerbox.dispatched_calls; 511 tmp = tmp->next) { 512 call = list_get_instance(tmp, call_t, link); 513 printf("Callid: %P Srctask:%lld M:%d A1:%d A2:%d A3:%d Flags:%x\n",call, 514 call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data), 515 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags); 516 } 517 /* Print answerbox - calls */ 518 printf("ABOX - ANSWERS:\n"); 519 for (tmp=task->answerbox.answers.next; tmp != &task->answerbox.answers; tmp = tmp->next) { 520 call = list_get_instance(tmp, call_t, link); 521 printf("Callid:%P M:%d A1:%d A2:%d A3:%d Flags:%x\n",call, 522 IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data), 523 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags); 524 } 525 526 spinlock_unlock(&task->answerbox.lock); 527 spinlock_unlock(&task->lock); 528 }
Note:
See TracChangeset
for help on using the changeset viewer.