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_ioc.c

    r619 r626  
    22 * dev_ioc.c - IOC (Block Device Controler) generic device API implementation.
    33 *
    4  * Author  Alain Greiner    (2016,2017,2018)
     4 * Author  Alain Greiner    (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3636
    3737extern chdev_directory_t  chdev_dir;     // allocated in kernel_init.c
     38
     39////////////////////////////////////////
     40char * dev_ioc_cmd_str( cmd_type_t cmd )
     41{
     42    if     ( cmd == IOC_READ       )  return "READ";
     43    else if( cmd == IOC_WRITE      )  return "WRITE";
     44    else if( cmd == IOC_SYNC_READ  )  return "SYNC_READ";
     45    else if( cmd == IOC_SYNC_WRITE )  return "SYNC_WRITE";
     46    else                              return "undefined";
     47}
    3848
    3949//////////////////////////////////
     
    192202////////////////////////////////////i/////////////////////////////////////////////
    193203error_t dev_ioc_sync_access( uint32_t   cmd_type,
    194                              uint8_t  * buffer,
     204                             xptr_t     buffer_xp,
    195205                             uint32_t   lba,
    196206                             uint32_t   count )
     
    202212    if( chdev_dir.iob )
    203213    {
    204         if (cmd_type == IOC_SYNC_READ) dev_mmc_inval( XPTR(local_cxy,buffer) , count<<9 );
    205         else                           dev_mmc_sync ( XPTR(local_cxy,buffer) , count<<9 );
     214        if (cmd_type == IOC_SYNC_READ) dev_mmc_inval( buffer_xp , count<<9 );
     215        else                           dev_mmc_sync ( buffer_xp , count<<9 );
    206216    }
    207217
     
    215225    this->ioc_cmd.dev_xp    = ioc_xp;
    216226    this->ioc_cmd.type      = cmd_type;
    217     this->ioc_cmd.buf_xp    = XPTR( local_cxy , buffer );
     227    this->ioc_cmd.buf_xp    = buffer_xp;
    218228    this->ioc_cmd.lba       = lba;
    219229    this->ioc_cmd.count     = count;
     
    241251    return this->ioc_cmd.error;
    242252
    243 }  // end ioc_sync_access()
    244 
    245 /////////////////////////////////////////////
    246 error_t dev_ioc_sync_read( uint8_t  * buffer,
     253}  // end dev_ioc_sync_access()
     254
     255////////////////////////////////////////////////
     256error_t dev_ioc_sync_read( xptr_t     buffer_xp,
    247257                           uint32_t   lba,
    248258                           uint32_t   count )
     
    253263uint32_t   cycle = (uint32_t)hal_get_cycles();
    254264if( DEBUG_DEV_IOC_RX < cycle )
    255 printk("\n[%s] thread[%x,%x] : lba  %x / buffer %x / cycle %d\n",
    256 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle );
    257 #endif
    258 
    259     return dev_ioc_sync_access( IOC_SYNC_READ , buffer , lba , count );
     265printk("\n[%s] thread[%x,%x] : lba  %x / buffer(%x,%x) / count %d / cycle %d\n",
     266__FUNCTION__ , this->process->pid, this->trdid,
     267lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle );
     268#endif
     269
     270    return dev_ioc_sync_access( IOC_SYNC_READ , buffer_xp , lba , count );
    260271}
    261272
    262 //////////////////////////////////////////////
    263 error_t dev_ioc_sync_write( uint8_t  * buffer,
     273/////////////////////////////////////////////////
     274error_t dev_ioc_sync_write( xptr_t     buffer_xp,
    264275                            uint32_t   lba,
    265276                            uint32_t   count )
    266277{
    267278
    268 #if DEBUG_DEV_IOC_RX
    269 thread_t * this  = CURRENT_THREAD;
    270 uint32_t   cycle = (uint32_t)hal_get_cycles();
    271 if( DEBUG_DEV_IOC_RX < cycle )
    272 printk("\n[%s] thread[%x,%x] enters / lba  %x / buffer %x / cycle %d\n",
    273 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle );
    274 #endif
    275 
    276     return dev_ioc_sync_access( IOC_SYNC_WRITE , buffer , lba , count );
     279#if DEBUG_DEV_IOC_TX
     280thread_t * this  = CURRENT_THREAD;
     281uint32_t   cycle = (uint32_t)hal_get_cycles();
     282if( DEBUG_DEV_IOC_TX < cycle )
     283printk("\n[%s] thread[%x,%x] : lba  %x / buffer(%x,%x) / count %d / cycle %d\n",
     284__FUNCTION__ , this->process->pid, this->trdid,
     285lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle );
     286#endif
     287
     288    return dev_ioc_sync_access( IOC_SYNC_WRITE , buffer_xp , lba , count );
    277289}
    278290
Note: See TracChangeset for help on using the changeset viewer.