Changeset 426 for soft/giet_vm
- Timestamp:
- Oct 4, 2014, 3:16:21 PM (10 years ago)
- Location:
- soft/giet_vm/giet_drivers
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/bdv_driver.c
r413 r426 120 120 unsigned int count) 121 121 { 122 123 #if GIET_DEBUG_IOC_DRIVER 124 unsigned int procid = _get_procid(); 125 unsigned int cxy = procid / NB_PROCS_MAX; 126 unsigned int lpid = procid % NB_PROCS_MAX; 127 unsigned int x = cxy >> Y_WIDTH; 128 unsigned int y = cxy & ((1<<Y_WIDTH) - 1); 129 122 unsigned int procid = _get_procid(); 123 unsigned int x = procid >> (Y_WIDTH + P_WIDTH); 124 unsigned int y = (procid >> P_WIDTH) & ((1<<Y_WIDTH) - 1); 125 unsigned int p = procid & ((1<<P_WIDTH)-1); 126 127 #if GIET_DEBUG_IOC_DRIVER 130 128 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] enters at cycle %d\n" 129 " - to_mem = %d\n" 131 130 " - mode = %d\n" 132 131 " - paddr = %l\n" 133 132 " - sectors = %x\n" 134 133 " - lba = %x\n", 135 x, y, lpid, _get_proctime(), mode, buf_paddr, count, lba );134 x, y, p, _get_proctime(), to_mem, mode, buf_paddr, count, lba ); 136 135 #endif 137 136 … … 140 139 // get the lock protecting BDV 141 140 _get_lock(&_bdv_lock); 141 142 #if GIET_DEBUG_IOC_DRIVER 143 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] get bdv_lock at cycle %d \n", 144 x, y, p, _get_proctime() ); 145 #endif 142 146 143 147 // set device registers … … 146 150 _bdv_set_register( BLOCK_DEVICE_COUNT , count ); 147 151 _bdv_set_register( BLOCK_DEVICE_LBA , lba ); 148 149 #if GIET_DEBUG_IOC_DRIVER150 _printf("\n[BDV DEBUG] _bdv_access() : config registers set\n");151 #endif152 152 153 153 // In BOOT mode, we launch transfer, and poll the BDV_STATUS … … 160 160 161 161 #if GIET_DEBUG_IOC_DRIVER 162 _printf("\n[BDV DEBUG] _bdv_access() : transfer launched in polling mode\n"); 162 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] launch transfer in polling mode\n", 163 x, y, p ); 163 164 #endif 164 165 unsigned int status; … … 168 169 169 170 #if GIET_DEBUG_IOC_DRIVER 170 _printf("\n[BDV DEBUG] _bdv_access() : ... waiting on BDV_STATUS register ...\n"); 171 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] wait on BDV_STATUS register ...\n", 172 x, y, p ); 171 173 #endif 172 174 } … … 193 195 unsigned int save_sr; 194 196 unsigned int ltid = _get_current_task_id(); 195 unsigned int gpid = _get_procid();196 197 197 198 // activates BDV interrupts … … 205 206 206 207 // set _bdv_gtid and reset runnable 207 _bdv_gtid = ( gpid<<16) + ltid;208 _set_task_slot( gpid, ltid, CTX_RUN_ID, 0 );208 _bdv_gtid = (procid<<16) + ltid; 209 _set_task_slot( x, y, p, ltid, CTX_RUN_ID, 0 ); 209 210 210 211 // launch transfer … … 213 214 214 215 #if GIET_DEBUG_IOC_DRIVER 215 _printf("\n[BDV DEBUG] _bdv_access() : transfert lauched in interrupt mode\n"); 216 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] launch transfer in interrupt mode\n", 217 x, y, p ); 216 218 #endif 217 219 // deschedule task 218 220 _ctx_switch(); 219 221 222 #if GIET_DEBUG_IOC_DRIVER 223 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] resume execution after descheduling\n", 224 x, y, p ); 225 #endif 220 226 // restore SR 221 227 _it_restore( &save_sr ); 222 228 229 #if GIET_DEBUG_IOC_DRIVER 230 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] returns from _it_restore()\n", 231 x, y, p ); 232 #endif 223 233 // analyse status 224 234 error = ( (_bdv_status == BLOCK_DEVICE_READ_ERROR) || … … 232 242 #if GIET_DEBUG_IOC_DRIVER 233 243 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] exit at cycle %d / error = %d\n", 234 x, y, lpid, _get_proctime(), error );244 x, y, p, _get_proctime(), error ); 235 245 #endif 236 246 … … 333 343 334 344 // identify task waiting on BDV 335 unsigned int rprocid = _bdv_gtid>>16; 336 unsigned int ltid = _bdv_gtid & 0xFFFF; 337 unsigned int remote_xy = rprocid / NB_PROCS_MAX; 338 unsigned int remote_lpid = rprocid % NB_PROCS_MAX; 345 unsigned int remote_procid = _bdv_gtid>>16; 346 unsigned int ltid = _bdv_gtid & 0xFFFF; 347 unsigned int remote_cluster = remote_procid >> P_WIDTH; 348 unsigned int remote_x = remote_cluster >> Y_WIDTH; 349 unsigned int remote_y = remote_cluster & ((1<<Y_WIDTH)-1); 350 unsigned int remote_p = remote_procid & ((1<<P_WIDTH)-1); 339 351 340 352 // re-activates sleeping task 341 _set_task_slot( rprocid, // global processor index 342 ltid, // local task index on processor 353 _set_task_slot( remote_x, 354 remote_y, 355 remote_p, 356 ltid, 343 357 CTX_RUN_ID, // CTX_RUN slot 344 358 1 ); // running 345 359 346 360 // requires a context switch for remote processor running the waiting task 347 _xcu_send_wti( remote_ xy, // remote cluster index348 remote_ lpid, // remote local processor index361 _xcu_send_wti( remote_cluster, 362 remote_p, 349 363 0 ); // don't force context switch if not idle 350 364 351 365 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlock 352 unsigned int procid = _get_procid(); 353 unsigned int cluster_xy = procid / NB_PROCS_MAX; 354 unsigned int lpid = procid % NB_PROCS_MAX; 355 unsigned int x = cluster_xy >> Y_WIDTH; 356 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 357 unsigned int rx = remote_xy >> Y_WIDTH; 358 unsigned int ry = remote_xy & ((1<<Y_WIDTH)-1); 366 unsigned int procid = _get_procid(); 367 unsigned int x = procid >> (Y_WIDTH + P_WIDTH); 368 unsigned int y = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1); 369 unsigned int p = procid & ((1<<P_WIDTH)-1); 370 359 371 _puts("\n[IRQS DEBUG] Processor["); 360 372 _putd(x ); … … 362 374 _putd(y ); 363 375 _puts(","); 364 _putd( lpid);376 _putd(p ); 365 377 _puts("] enters _bdv_isr() at cycle "); 366 378 _putd(_get_proctime() ); … … 368 380 _putd(ltid ); 369 381 _puts(" running on processor["); 370 _putd(r x );382 _putd(remote_x ); 371 383 _puts(","); 372 _putd(r y );384 _putd(remore_y ); 373 385 _puts(","); 374 _putd(remote_ lpid);386 _putd(remote_p ); 375 387 _puts(" / bdv status = "); 376 388 _putx(_bdv_status ); -
soft/giet_vm/giet_drivers/ioc_driver.c
r413 r426 94 94 #if GIET_DEBUG_IOC_DRIVER 95 95 unsigned int procid = _get_procid(); 96 unsigned int cid = procid / NB_PROCS_MAX; 97 unsigned int lpid = procid % NB_PROCS_MAX; 98 unsigned int x = cid >> Y_WIDTH; 99 unsigned int y = cid & ((1<<Y_WIDTH) - 1); 100 96 unsigned int x = procid >> (Y_WIDTH + P_WIDTH); 97 unsigned int y = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1); 98 unsigned int p = procid & ((1<<P_WIDTH)-1); 101 99 _printf("\n[IOC DEBUG] _ioc_access() : P[%d,%d,%d] enters at cycle %d\n" 102 100 " - channel = %d\n" … … 105 103 " - sectors = %d\n" 106 104 " - lba = %x\n", 107 x, y, lpid, _get_proctime(), channel, mode, buf_vaddr, count, lba );105 x, y, p, _get_proctime(), channel, mode, buf_vaddr, count, lba ); 108 106 #endif 109 107 -
soft/giet_vm/giet_drivers/mmc_driver.c
r345 r426 159 159 unsigned int channel ) // unused 160 160 { 161 unsigned int procid = _get_procid(); 162 unsigned int cluster_xy = procid / NB_PROCS_MAX; 163 unsigned int lpid = procid % NB_PROCS_MAX; 161 unsigned int gpid = _get_procid(); 162 unsigned int cluster_xy = gpid >> P_WIDTH; 164 163 unsigned int x = cluster_xy >> Y_WIDTH; 165 164 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 165 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 166 166 167 167 _printf("[GIET ERROR] MMC IRQ received by processor[%d,%d,%d]" -
soft/giet_vm/giet_drivers/tim_driver.c
r333 r426 223 223 #if NB_TIM_CHANNELS 224 224 225 unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;225 unsigned int cluster_xy = _get_procid() >> P_WIDTH; 226 226 227 227 // acknowledge IRQ depending on type -
soft/giet_vm/giet_drivers/tty_driver.c
r350 r426 198 198 unsigned int channel ) // TTY channel 199 199 { 200 unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX; 200 unsigned int gpid = _get_procid(); 201 unsigned int cluster_xy = gpid >> P_WIDTH; 201 202 202 203 // get TTY status … … 225 226 unsigned int x = cluster_xy >> Y_WIDTH; 226 227 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 227 unsigned int lpid = _get_procid() % NB_PROCS_MAX;228 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 228 229 _puts("\n[IRQS DEBUG] Processor["); 229 230 _putd(x );
Note: See TracChangeset
for help on using the changeset viewer.