Changeset c4e4507 in mainline
- 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
- Location:
- generic
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/ipc/ipc.h
rfe19611 rc4e4507 186 186 } ipc_phone_state_t; 187 187 188 /** Structure identifying phone (in TASK structure) */ 188 189 struct phone_s { 189 190 SPINLOCK_DECLARE(lock); 190 link_t li st;191 link_t link; 191 192 answerbox_t *callee; 192 193 ipc_phone_state_t state; … … 195 196 196 197 typedef struct { 197 link_t li st;198 link_t link; 198 199 199 200 int flags; … … 227 228 extern int ipc_phone_hangup(phone_t *phone, int aggressive); 228 229 extern void ipc_backsend_err(phone_t *phone, call_t *call, __native err); 230 extern void ipc_print_task(task_id_t taskid); 229 231 230 232 extern answerbox_t *ipc_phone_0; -
generic/src/console/cmd.c
rfe19611 rc4e4507 59 59 #include <proc/thread.h> 60 60 #include <proc/task.h> 61 #include <ipc/ipc.h> 61 62 62 63 /** Data and methods for 'help' command. */ … … 301 302 }; 302 303 304 /** Data and methods for 'ipc_task' command */ 305 static int cmd_ipc_task(cmd_arg_t *argv); 306 static cmd_arg_t ipc_task_argv = { 307 .type = ARG_TYPE_INT, 308 }; 309 static cmd_info_t ipc_task_info = { 310 .name = "ipc_task", 311 .description = "Show memory zone structure.", 312 .func = cmd_ipc_task, 313 .argc = 1, 314 .argv = &ipc_task_argv 315 }; 316 303 317 /** Data and methods for 'zone' command */ 304 318 static int cmd_zone(cmd_arg_t *argv); … … 348 362 &halt_info, 349 363 &help_info, 364 &ipc_task_info, 350 365 &set4_info, 351 366 &slabs_info, … … 687 702 } 688 703 704 /** Command for printing task ipc details 705 * 706 * @param argv Integer argument from cmdline expected 707 * 708 * return Always 1 709 */ 710 int cmd_ipc_task(cmd_arg_t * argv) { 711 ipc_print_task(argv[0].intval); 712 return 1; 713 } 714 715 689 716 /** Command for listing processors. 690 717 * -
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 } -
generic/src/ipc/ipcrsc.c
rfe19611 rc4e4507 141 141 for (lst = TASK->answerbox.dispatched_calls.next; 142 142 lst != &TASK->answerbox.dispatched_calls; lst = lst->next) { 143 call = list_get_instance(lst, call_t, li st);143 call = list_get_instance(lst, call_t, link); 144 144 if ((__native)call == callid) { 145 145 result = call; … … 178 178 { 179 179 ASSERT(phone->state == IPC_PHONE_CONNECTING); 180 ASSERT(! phone->callee);181 180 182 181 /* atomic operation */ -
generic/src/ipc/irq.c
rfe19611 rc4e4507 225 225 226 226 spinlock_lock(&irq_conns[irq].box->irq_lock); 227 list_append(&call->li st, &irq_conns[irq].box->irq_notifs);227 list_append(&call->link, &irq_conns[irq].box->irq_notifs); 228 228 spinlock_unlock(&irq_conns[irq].box->irq_lock); 229 229 -
generic/src/ipc/sysipc.c
rfe19611 rc4e4507 107 107 spinlock_lock(&TASK->answerbox.lock); 108 108 if (answer->data.phone->state == IPC_PHONE_CONNECTED) { 109 list_remove(&answer->data.phone->li st);109 list_remove(&answer->data.phone->link); 110 110 answer->data.phone->state = IPC_PHONE_SLAMMED; 111 111 } -
generic/src/proc/task.c
rfe19611 rc4e4507 230 230 231 231 spinlock_lock(&t->lock); 232 printf("%s : address=%#zX, taskid=%#llX, as=%#zX, ActiveCalls: %zd",233 t->name, t , t->taskid, t->as, atomic_get(&t->active_calls));232 printf("%s(%lld): address=%#zX, as=%#zX, ActiveCalls: %zd", 233 t->name, t->taskid, t, t->as, atomic_get(&t->active_calls)); 234 234 for (j=0; j < IPC_MAX_PHONES; j++) { 235 235 if (t->phones[j].callee)
Note:
See TracChangeset
for help on using the changeset viewer.