Changeset 426


Ignore:
Timestamp:
Oct 4, 2014, 3:16:21 PM (10 years ago)
Author:
alain
Message:

Introducing fixed format (X_WIDTH / Y_WIDTH / P_WIDTH ) for processor index.

Location:
soft/giet_vm/giet_drivers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/bdv_driver.c

    r413 r426  
    120120                                 unsigned int       count)
    121121{
    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
    130128_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] enters at cycle %d\n"
     129        " - to_mem  = %d\n"
    131130        " - mode    = %d\n"
    132131        " - paddr   = %l\n"
    133132        " - sectors = %x\n"
    134133        " - 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 );
    136135#endif
    137136
     
    140139    // get the lock protecting BDV
    141140    _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
    142146
    143147    // set device registers
     
    146150    _bdv_set_register( BLOCK_DEVICE_COUNT     , count );
    147151    _bdv_set_register( BLOCK_DEVICE_LBA       , lba );
    148 
    149 #if GIET_DEBUG_IOC_DRIVER
    150 _printf("\n[BDV DEBUG] _bdv_access() : config registers set\n");
    151 #endif
    152152
    153153    // In BOOT mode, we launch transfer, and poll the BDV_STATUS
     
    160160
    161161#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 );
    163164#endif
    164165        unsigned int status;
     
    168169
    169170#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 );
    171173#endif
    172174        }
     
    193195        unsigned int save_sr;
    194196        unsigned int ltid = _get_current_task_id();
    195         unsigned int gpid = _get_procid();
    196197
    197198        // activates BDV interrupts
     
    205206
    206207        // 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 ); 
    209210       
    210211        // launch transfer
     
    213214
    214215#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 );
    216218#endif
    217219        // deschedule task
    218220        _ctx_switch();                     
    219221
     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
    220226        // restore SR
    221227        _it_restore( &save_sr );
    222228
     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
    223233        // analyse status
    224234        error = ( (_bdv_status == BLOCK_DEVICE_READ_ERROR) ||
     
    232242#if GIET_DEBUG_IOC_DRIVER
    233243_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 );
    235245#endif
    236246
     
    333343
    334344    // 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);
    339351
    340352    // 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,       
    343357                    CTX_RUN_ID,  // CTX_RUN slot
    344358                    1 );         // running
    345359
    346360    // requires a context switch for remote processor running the waiting task
    347     _xcu_send_wti( remote_xy,    // remote cluster index
    348                    remote_lpid,  // remote local processor index
     361    _xcu_send_wti( remote_cluster,   
     362                   remote_p,
    349363                   0 );          // don't force context switch if not idle
    350364
    351365#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);
     366unsigned int procid  = _get_procid();
     367unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
     368unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
     369unsigned int p       = procid & ((1<<P_WIDTH)-1);
     370
    359371_puts("\n[IRQS DEBUG] Processor[");
    360372_putd(x );
     
    362374_putd(y );
    363375_puts(",");
    364 _putd(lpid );
     376_putd(p );
    365377_puts("] enters _bdv_isr() at cycle ");
    366378_putd(_get_proctime() );
     
    368380_putd(ltid );
    369381_puts(" running on processor[");
    370 _putd(rx );
     382_putd(remote_x );
    371383_puts(",");
    372 _putd(ry );
     384_putd(remore_y );
    373385_puts(",");
    374 _putd(remote_lpid );
     386_putd(remote_p );
    375387_puts(" / bdv status = ");
    376388_putx(_bdv_status );
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r413 r426  
    9494#if GIET_DEBUG_IOC_DRIVER
    9595unsigned 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 
     96unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
     97unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
     98unsigned int p       = procid & ((1<<P_WIDTH)-1);
    10199_printf("\n[IOC DEBUG] _ioc_access() : P[%d,%d,%d] enters at cycle %d\n"
    102100        " - channel  = %d\n"
     
    105103        " - sectors  = %d\n"
    106104        " - 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 );
    108106#endif
    109107
  • soft/giet_vm/giet_drivers/mmc_driver.c

    r345 r426  
    159159               unsigned int channel )  // unused
    160160{
    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;
    164163    unsigned int x          = cluster_xy >> Y_WIDTH;
    165164    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
     165    unsigned int lpid       = gpid & ((1<<P_WIDTH)-1);
    166166
    167167    _printf("[GIET ERROR] MMC IRQ received by processor[%d,%d,%d]"
  • soft/giet_vm/giet_drivers/tim_driver.c

    r333 r426  
    223223#if NB_TIM_CHANNELS
    224224
    225     unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;
     225    unsigned int cluster_xy = _get_procid() >> P_WIDTH;
    226226
    227227    // acknowledge IRQ depending on type
  • soft/giet_vm/giet_drivers/tty_driver.c

    r350 r426  
    198198                  unsigned int channel )   // TTY channel
    199199{
    200     unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;
     200    unsigned int gpid       = _get_procid();
     201    unsigned int cluster_xy = gpid >> P_WIDTH;
    201202
    202203    // get TTY status
     
    225226unsigned int x              = cluster_xy >> Y_WIDTH;
    226227unsigned int y              = cluster_xy & ((1<<Y_WIDTH)-1);
    227 unsigned int lpid           = _get_procid() % NB_PROCS_MAX;
     228unsigned int lpid           = gpid & ((1<<P_WIDTH)-1);
    228229_puts("\n[IRQS DEBUG] Processor[");
    229230_putd(x );
Note: See TracChangeset for help on using the changeset viewer.