Index: soft/giet_vm/giet_drivers/bdv_driver.c
===================================================================
--- soft/giet_vm/giet_drivers/bdv_driver.c	(revision 413)
+++ soft/giet_vm/giet_drivers/bdv_driver.c	(revision 426)
@@ -120,18 +120,17 @@
                                  unsigned int       count) 
 {
-
-#if GIET_DEBUG_IOC_DRIVER
-unsigned int procid  = _get_procid();
-unsigned int cxy     = procid / NB_PROCS_MAX;
-unsigned int lpid    = procid % NB_PROCS_MAX;
-unsigned int x       = cxy >> Y_WIDTH;
-unsigned int y       = cxy & ((1<<Y_WIDTH) - 1);
-
+    unsigned int procid  = _get_procid();
+    unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
+    unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH) - 1);
+    unsigned int p       = procid & ((1<<P_WIDTH)-1);
+
+#if GIET_DEBUG_IOC_DRIVER
 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] enters at cycle %d\n"
+        " - to_mem  = %d\n"
         " - mode    = %d\n"
         " - paddr   = %l\n"
         " - sectors = %x\n"
         " - lba     = %x\n",
-        x, y, lpid, _get_proctime(), mode, buf_paddr, count, lba );
+        x, y, p, _get_proctime(), to_mem, mode, buf_paddr, count, lba );
 #endif
 
@@ -140,4 +139,9 @@
     // get the lock protecting BDV
     _get_lock(&_bdv_lock);
+
+#if GIET_DEBUG_IOC_DRIVER
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] get bdv_lock at cycle %d \n",
+        x, y, p, _get_proctime() );
+#endif
 
     // set device registers
@@ -146,8 +150,4 @@
     _bdv_set_register( BLOCK_DEVICE_COUNT     , count );
     _bdv_set_register( BLOCK_DEVICE_LBA       , lba );
-
-#if GIET_DEBUG_IOC_DRIVER
-_printf("\n[BDV DEBUG] _bdv_access() : config registers set\n");
-#endif
 
     // In BOOT mode, we launch transfer, and poll the BDV_STATUS 
@@ -160,5 +160,6 @@
 
 #if GIET_DEBUG_IOC_DRIVER
-_printf("\n[BDV DEBUG] _bdv_access() : transfer launched in polling mode\n");
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] launch transfer in polling mode\n",
+        x, y, p );
 #endif
         unsigned int status;
@@ -168,5 +169,6 @@
 
 #if GIET_DEBUG_IOC_DRIVER
-_printf("\n[BDV DEBUG] _bdv_access() : ... waiting on BDV_STATUS register ...\n");
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] wait on BDV_STATUS register ...\n",
+        x, y, p );
 #endif
         }
@@ -193,5 +195,4 @@
         unsigned int save_sr;
         unsigned int ltid = _get_current_task_id();
-        unsigned int gpid = _get_procid();
 
         // activates BDV interrupts
@@ -205,6 +206,6 @@
 
         // set _bdv_gtid and reset runnable 
-        _bdv_gtid = (gpid<<16) + ltid;
-        _set_task_slot( gpid, ltid, CTX_RUN_ID, 0 );  
+        _bdv_gtid = (procid<<16) + ltid;
+        _set_task_slot( x, y, p, ltid, CTX_RUN_ID, 0 );  
         
         // launch transfer
@@ -213,12 +214,21 @@
 
 #if GIET_DEBUG_IOC_DRIVER
-_printf("\n[BDV DEBUG] _bdv_access() : transfert lauched in interrupt mode\n");
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] launch transfer in interrupt mode\n",
+        x, y, p );
 #endif
         // deschedule task
         _ctx_switch();                      
 
+#if GIET_DEBUG_IOC_DRIVER
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] resume execution after descheduling\n",
+        x, y, p );
+#endif
         // restore SR
         _it_restore( &save_sr );
 
+#if GIET_DEBUG_IOC_DRIVER
+_printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] returns from _it_restore()\n",
+        x, y, p );
+#endif
         // analyse status
         error = ( (_bdv_status == BLOCK_DEVICE_READ_ERROR) ||
@@ -232,5 +242,5 @@
 #if GIET_DEBUG_IOC_DRIVER
 _printf("\n[BDV DEBUG] _bdv_access() : P[%d,%d,%d] exit at cycle %d / error = %d\n",
-        x, y, lpid, _get_proctime(), error );
+        x, y, p, _get_proctime(), error );
 #endif
 
@@ -333,28 +343,30 @@
 
     // identify task waiting on BDV
-    unsigned int rprocid     = _bdv_gtid>>16;
-    unsigned int ltid        = _bdv_gtid & 0xFFFF;
-    unsigned int remote_xy   = rprocid / NB_PROCS_MAX;
-    unsigned int remote_lpid = rprocid % NB_PROCS_MAX;
+    unsigned int remote_procid  = _bdv_gtid>>16;
+    unsigned int ltid           = _bdv_gtid & 0xFFFF;
+    unsigned int remote_cluster = remote_procid >> P_WIDTH;
+    unsigned int remote_x       = remote_cluster >> Y_WIDTH;
+    unsigned int remote_y       = remote_cluster & ((1<<Y_WIDTH)-1);
+    unsigned int remote_p       = remote_procid & ((1<<P_WIDTH)-1);
 
     // re-activates sleeping task
-    _set_task_slot( rprocid,     // global processor index
-                    ltid,        // local task index on processor
+    _set_task_slot( remote_x,
+                    remote_y,
+                    remote_p,
+                    ltid,        
                     CTX_RUN_ID,  // CTX_RUN slot 
                     1 );         // running
 
     // requires a context switch for remote processor running the waiting task 
-    _xcu_send_wti( remote_xy,    // remote cluster index
-                   remote_lpid,  // remote local processor index
+    _xcu_send_wti( remote_cluster,   
+                   remote_p, 
                    0 );          // don't force context switch if not idle
 
 #if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
-unsigned int procid     = _get_procid();
-unsigned int cluster_xy = procid / NB_PROCS_MAX;
-unsigned int lpid       = procid % NB_PROCS_MAX;
-unsigned int x              = cluster_xy >> Y_WIDTH;
-unsigned int y              = cluster_xy & ((1<<Y_WIDTH)-1);
-unsigned int rx             = remote_xy >> Y_WIDTH;
-unsigned int ry             = remote_xy & ((1<<Y_WIDTH)-1);
+unsigned int procid  = _get_procid();
+unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
+unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
+unsigned int p       = procid & ((1<<P_WIDTH)-1);
+
 _puts("\n[IRQS DEBUG] Processor[");
 _putd(x );
@@ -362,5 +374,5 @@
 _putd(y );
 _puts(",");
-_putd(lpid );
+_putd(p );
 _puts("] enters _bdv_isr() at cycle ");
 _putd(_get_proctime() );
@@ -368,9 +380,9 @@
 _putd(ltid );
 _puts(" running on processor[");
-_putd(rx );
+_putd(remote_x );
 _puts(",");
-_putd(ry );
+_putd(remore_y );
 _puts(",");
-_putd(remote_lpid );
+_putd(remote_p );
 _puts(" / bdv status = ");
 _putx(_bdv_status );
