Ignore:
Timestamp:
Apr 29, 2019, 7:25:09 PM (6 years ago)
Author:
alain
Message:

This version has been tested on the sort multithreaded application
for TSAR_IOB architectures ranging from 1 to 8 clusters.
It fixes three bigs bugs:
1) the dev_ioc device API has been modified: the dev_ioc_sync_read()
and dev_ioc_sync_write() function use now extended pointers on the
kernel buffer to access a mapper stored in any cluster.
2) the hal_uspace API has been modified: the hal_copy_to_uspace()
and hal_copy_from_uspace() functions use now a (cxy,ptr) couple
to identify the target buffer (equivalent to an extended pointer.
3) an implementation bug has been fixed in the assembly code contained
in the hal_copy_to_uspace() and hal_copy_from_uspace() functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_bdv.c

    r622 r626  
    5858void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp )
    5959{
    60     uint32_t   cmd_type;    // IOC_READ / IOC_WRITE / IOC_SYNC_READ
     60    uint32_t   cmd_type;    // IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE
    6161    uint32_t   lba;
    6262    uint32_t   count;
     
    8686    ioc_xp   = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );
    8787
    88 #if DEBUG_HAL_IOC_RX
    89 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) )
    90 printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / RX / cycle %d\n",
    91 __FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle );
    92 #endif
    93 
    94 #if DEBUG_HAL_IOC_TX
    95 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
    96 printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / TX / cycle %d\n",
    97 __FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle );
    98 #endif
     88    // decode command
     89    if     ( (cmd_type == IOC_READ)  || (cmd_type == IOC_SYNC_READ)  ) op = BDV_OP_READ;
     90    else if( (cmd_type == IOC_WRITE) || (cmd_type == IOC_SYNC_WRITE) ) op = BDV_OP_WRITE;
     91    else     assert( false , "illegal command" );
    9992
    10093    // get IOC device cluster and local pointer
     
    110103    uint32_t   buf_lsb = (uint32_t)(buf_xp);
    111104    uint32_t   buf_msb = (uint32_t)(buf_xp>>32);
     105
     106#if DEBUG_HAL_IOC_RX
     107if( DEBUG_HAL_IOC_RX < cycle )
     108printk("\n[%s] thread[%x,%x] enters / client[%x,%x] / cmd %d / lba %x / buf(%x,%x) / cycle %d\n",
     109__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid,
     110cmd_type, lba, buf_msb, buf_lsb, cycle );
     111#endif
     112
     113#if DEBUG_HAL_IOC_TX
     114if( DEBUG_HAL_IOC_TX < cycle )
     115printk("\n[%s] thread[%x,%x] enters / client[%x,%x] / cmd %d / lba %x / buf(%x,%x) / cycle %d\n",
     116__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid,
     117cmd_type, lba, buf_msb, buf_lsb, cycle );
     118#endif
    112119
    113120    // select operation
     
    143150            {
    144151                hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );
     152
     153#if DEBUG_HAL_IOC_RX
     154cycle = (uint32_t)hal_get_cycles();
     155if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type == IOC_SYNC_READ) )
     156printk("\n[%s] thread[%x,%x] exit after SYNC_READ for client thread[%x,%x] / cycle %d\n",
     157__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
     158#endif
     159
     160#if DEBUG_HAL_IOC_TX
     161cycle = (uint32_t)hal_get_cycles();
     162if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_SYNC_WRITE) )
     163printk("\n[%s] thread[%x,%x] exit after SYNC_WRITE for client thread[%x,%x] / cycle %d\n",
     164__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
     165#endif
    145166                break;
    146167            }
    147             else if( status == BDV_BUSY )   // non completed
     168            else if( status == BDV_BUSY )      // non completed
    148169            {
    149170                continue;
    150171            }
    151             else                            // error reported
     172            else                               // error reported
    152173            {
    153174                hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );
     
    170191#if DEBUG_HAL_IOC_RX
    171192if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) )
    172 printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching RX transfer\n",
     193printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching READ transfer\n",
    173194__FUNCTION__ , this->process->pid, this->trdid );
    174195#endif
     
    176197#if DEBUG_HAL_IOC_TX
    177198if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
    178 printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching TX transfer\n",
     199printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching WRITE transfer\n",
    179200__FUNCTION__ , this->process->pid, this->trdid );
    180201#endif
     
    184205        // exit critical section
    185206        hal_restore_irq( save_sr );
    186     }
    187207   
    188208#if DEBUG_HAL_IOC_RX
    189209cycle = (uint32_t)hal_get_cycles();
    190210if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE) )
    191 printk("\n[%s] thread[%x,%x] exit after RX for client thread[%x,%x] / cycle %d\n",
     211printk("\n[%s] thread[%x,%x] exit after READ for client thread[%x,%x] / cycle %d\n",
    192212__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
    193213#endif
     
    196216cycle = (uint32_t)hal_get_cycles();
    197217if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
    198 printk("\n[%s] thread[%x,%x] exit after TX for client thread[%x,%x] / cycle %d\n",
    199 __FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
    200 #endif
     218printk("\n[%s] thread[%x,%x] exit after WRITE for client thread[%x,%x] / cycle %d\n",
     219__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
     220#endif
     221
     222    }
    201223
    202224} // end soclib_bdv_cmd()
     
    263285    else
    264286    {
    265         assert( false , "IOC_SYNC_READ should not use IRQ" );
     287        assert( false , "illegal command %d", cmd_type );
    266288    }
    267289
Note: See TracChangeset for help on using the changeset viewer.