Ignore:
Timestamp:
Apr 29, 2019, 7:25:09 PM (5 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/kernel/devices/dev_mmc.c

    r605 r626  
    108108
    109109    // get buffer cluster and local pointer
    110     cxy_t  buf_cxy = GET_CXY( buf_xp );
    111     void * buf_ptr = GET_PTR( buf_xp );
     110    cxy_t     buf_cxy = GET_CXY( buf_xp );
     111    uint8_t * buf_ptr = GET_PTR( buf_xp );
    112112   
    113     assert( (((intptr_t)buf_ptr & (CONFIG_CACHE_LINE_SIZE -1)) == 0) ,
    114              "buffer not aligned on cache line" );
     113    // force buffer align
     114    uint32_t  delta = (uint32_t)buf_ptr & (CONFIG_CACHE_LINE_SIZE - 1);
     115    uint8_t * base  = buf_ptr - delta;
     116    uint32_t  size  = buf_size + delta;
    115117
    116118    // store command arguments in thread descriptor
    117119    this->mmc_cmd.dev_xp    = chdev_dir.mmc[buf_cxy];
    118120    this->mmc_cmd.type      = MMC_CC_INVAL;
    119     this->mmc_cmd.buf_ptr   = buf_ptr;
    120     this->mmc_cmd.buf_size  = buf_size;
     121    this->mmc_cmd.buf_ptr   = base;
     122    this->mmc_cmd.buf_size  = size;
    121123
    122124    // call MMC driver
     
    152154    void * buf_ptr = GET_PTR( buf_xp );
    153155   
    154     assert( (((intptr_t)buf_ptr & (CONFIG_CACHE_LINE_SIZE -1)) == 0) ,
    155              "buffer not aligned on cache line" );
     156    // force buffer align
     157    uint32_t  delta = (uint32_t)buf_ptr & (CONFIG_CACHE_LINE_SIZE - 1);
     158    uint8_t * base  = buf_ptr - delta;
     159    uint32_t  size  = buf_size + delta;
    156160
    157161    // store command arguments in thread descriptor
    158162    this->mmc_cmd.dev_xp    = chdev_dir.mmc[buf_cxy];
    159163    this->mmc_cmd.type      = MMC_CC_SYNC;
    160     this->mmc_cmd.buf_ptr   = buf_ptr;
    161     this->mmc_cmd.buf_size  = buf_size;
     164    this->mmc_cmd.buf_ptr   = base;
     165    this->mmc_cmd.buf_size  = size;
    162166
    163167    // call MMC driver
Note: See TracChangeset for help on using the changeset viewer.