Changeset 630 for soft/giet_vm/giet_drivers/hba_driver.c
- Timestamp:
- Jul 18, 2015, 3:04:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/hba_driver.c
r603 r630 23 23 #include <vmem.h> 24 24 25 /////////////////////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////////////////// 26 // Extern variables 27 ////////////////////////////////////////////////////////////////////////////////// 28 29 // allocated in the boot.c or kernel_init.c files 30 extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 31 32 ////////////////////////////////////////////////////////////////////////////////// 26 33 // Global variables 27 ///////////////////////////////////////////////////////////////////////////////////28 29 34 ////////////////////////////////////////////////////////////////////////////////// 30 35 // The global variable hba_boot_mode defines the way the HBA component is used 31 36 // and must be defined in both kernel_init.c and boot.c files. 32 // - during the boot phase, only one processor has access tothe HBA in synchronous33 // mode , there is no need for the allocator to use a lock37 // - during the boot phase, only one processor access the HBA in synchronous 38 // mode. There is no need for the allocator to use a lock. 34 39 // - after the boot phase, the HBA device can be used by several processors. The 35 40 // allocator is protected by a sqt_lock. … … 278 283 // in descheduling mode, we deschedule the task 279 284 // and use an interrupt to reschedule the task. 280 // We need a critical section, because we must reset theRUN bit285 // We need a critical section, because we must set the NORUN bit 281 286 // before to launch the transfer, and we don't want to be 282 287 // descheduled between these two operations. … … 303 308 _it_disable( &save_sr ); 304 309 305 // reset runnable 306 _set_task_slot( x, y, p, ltid, CTX_RUN_ID, 0 ); 307 310 // Set NORUN_MASK_IOC bit 311 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 312 unsigned int* ptr = &psched->context[ltid][CTX_NORUN_ID]; 313 _atomic_or( ptr , NORUN_MASK_IOC ); 314 308 315 // start HBA transfer 309 316 _hba_set_register( HBA_PXCI, (1<<cmd_id) ); … … 432 439 433 440 // identify waiting task 434 unsigned int remote_procid = _hba_gtid[cmd_id]>>16;435 unsigned int ltid 436 unsigned int remote_cluster = remote_procid >> P_WIDTH;437 unsigned int remote_x = remote_cluster >> Y_WIDTH;438 unsigned int remote_y = remote_cluster & ((1<<Y_WIDTH)-1);439 unsigned int remote_p = remote_procid & ((1<<P_WIDTH)-1);441 unsigned int procid = _hba_gtid[cmd_id]>>16; 442 unsigned int ltid = _hba_gtid[cmd_id] & 0xFFFF; 443 unsigned int cluster = procid >> P_WIDTH; 444 unsigned int x = cluster >> Y_WIDTH; 445 unsigned int y = cluster & ((1<<Y_WIDTH)-1); 446 unsigned int p = procid & ((1<<P_WIDTH)-1); 440 447 441 // re-activates waiting task 442 _set_task_slot( remote_x, 443 remote_y, 444 remote_p, 445 ltid, 446 CTX_RUN_ID, 447 1 ); 448 // Reset NORUN_MASK_IOC bit 449 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 450 unsigned int* ptr = &psched->context[ltid][CTX_NORUN_ID]; 451 _atomic_and( ptr , ~NORUN_MASK_IOC ); 448 452 449 453 // send a WAKUP WTI to processor running the waiting task 450 _xcu_send_wti( remote_cluster ,451 remote_p ,454 _xcu_send_wti( cluster , 455 p , 452 456 0 ); // don't force context switch 453 457 … … 457 461 " resume task %d running on P[%d,%d,%d]\n", 458 462 cmd_id , _get_proctime() , 459 ltid , remote_x , remote_y , remote_p );463 ltid , x , y , p ); 460 464 #endif 461 465 }
Note: See TracChangeset
for help on using the changeset viewer.