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.h

    r614 r626  
    22 * dev_ioc.h - IOC (Block Device Controler) generic device API definition.
    33 *
    4  * Author  Alain Greiner    (2016,2017,2018)
     4 * Author  Alain Greiner    (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    4444 * - SYNC_WRITE : move blocks from memory to device, with a busy waiting policy.
    4545
    46  * A READ or WRITE operation requires dynamic ressource allocation. The calling thread
     46 * The READ or WRITE operations require dynamic ressource allocation. The calling thread
    4747 * is descheduled, and the work is done by the server thread associated to IOC device.
    4848 * The general scenario is detailed below.
     
    6666 *
    6767 * The SYNC_READ and SYNC_WRITE operations are used by the kernel in the initialisation
    68  * phase. These operations do not not use the IOC device waiting queue, the server thread,
    69  * and the IOC IRQ, but implement a busy-waiting policy for the calling thread.
     68 * phase, to update the FAT (both the FAT mapper and the FAT on IOC device), or to update
     69 * a directory on IOC device when a new file is created.
     70 * - These synchronous operations do not not use the IOC device waiting queue,
     71 *   the server thread, and the IOC IRQ, but implement a busy-waiting policy
     72 *   for the calling thread.
     73 * - As the work
    7074 *****************************************************************************************/
    7175
     
    119123}
    120124ioc_command_t;
     125
     126/******************************************************************************************
     127 * This function returns a printable string for a IOC command type.
     128 ******************************************************************************************
     129 * @ cmd  : command type.
     130 * @ return pointer on string.
     131 *****************************************************************************************/
     132char * dev_ioc_cmd_str( cmd_type_t cmd );
    121133
    122134/******************************************************************************************
     
    138150 * registered in the device pending request queue, and the calling thread is descheduled,
    139151 * waiting on transfer completion. It will be resumed by the IRQ signaling completion.
    140  * It must be called in the client cluster.
     152 * It must be called by a local thread.
    141153 ******************************************************************************************
    142154 * @ buffer    : local pointer on target buffer in memory (must be block aligned).
    143155 * @ lba       : first block index on device.
    144156 * @ count     : number of blocks to transfer.
    145  * @ returns 0 if success / returns EINVAL if error.
     157 * @ returns 0 if success / returns -1 if error.
    146158 *****************************************************************************************/
    147159error_t dev_ioc_read( uint8_t      * buffer,
     
    154166 * registered in the device pending request queue, and the calling thread is descheduled,
    155167 * waiting on transfer completion. It will be resumed by the IRQ signaling completion.
    156  * It must be called in the client cluster.
     168 * It must be called by a local thread.
    157169 ******************************************************************************************
    158170 * @ buffer    : local pointer on source buffer in memory (must be block aligned).
    159171 * @ lba       : first block index on device.
    160172 * @ count     : number of blocks to transfer.
    161  * @ returns 0 if success / returns EINVAL if error.
     173 * @ returns 0 if success / returns -1 if error.
    162174 *****************************************************************************************/
    163175error_t dev_ioc_write( uint8_t      * buffer,
     
    167179/******************************************************************************************
    168180 * This blocking function moves one or several contiguous blocks of data
    169  * from the block device to a local memory buffer.
     181 * from the block device to a - possibly remote - memory buffer.
    170182 * It does  not uses the IOC device waiting queue and server thread, and does not use
    171183 * the IOC IRQ, but call directly the relevant IOC driver, implementing a busy-waiting
    172184 * policy for the calling thread.
    173  * It must be called in the client cluster.
    174  ******************************************************************************************
    175  * @ buffer    : local pointer on target buffer in memory (must be block aligned).
    176  * @ lba       : first block index on device.
    177  * @ count     : number of blocks to transfer.
    178  * @ returns 0 if success / returns EINVAL if error.
    179  *****************************************************************************************/
    180 error_t dev_ioc_sync_read( uint8_t      * buffer,
     185 * It can be called by a thread running in any cluster.
     186 ******************************************************************************************
     187 * @ buffer_xp : extended pointer on target buffer in memory (must be block aligned).
     188 * @ lba       : first block index on device.
     189 * @ count     : number of blocks to transfer.
     190 * @ returns 0 if success / returns -1 if error.
     191 *****************************************************************************************/
     192error_t dev_ioc_sync_read( xptr_t         buffer_xp,
    181193                           uint32_t       lba,
    182194                           uint32_t       count );
     
    184196/******************************************************************************************
    185197 * This blocking function moves one or several contiguous blocks of data
    186  * from a local memory buffer to the block device.
     198 * from a - possibly remote - memory buffer to the block device.
    187199 * It does  not uses the IOC device waiting queue and server thread, and does not use
    188200 * the IOC IRQ, but call directly the relevant IOC driver, implementing a busy-waiting
    189201 * policy for the calling thread.
    190  * It must be called in the client cluster.
    191  ******************************************************************************************
    192  * @ buffer    : local pointer on source buffer in memory (must be block aligned).
    193  * @ lba       : first block index on device.
    194  * @ count     : number of blocks to transfer.
    195  * @ returns 0 if success / returns EINVAL if error.
    196  *****************************************************************************************/
    197 error_t dev_ioc_sync_write( uint8_t      * buffer,
     202 * It can be called by a thread running in any cluster.
     203 ******************************************************************************************
     204 * @ buffer_xp : extended pointer on source buffer in memory (must be block aligned).
     205 * @ lba       : first block index on device.
     206 * @ count     : number of blocks to transfer.
     207 * @ returns 0 if success / returns -1 if error.
     208 *****************************************************************************************/
     209error_t dev_ioc_sync_write( xptr_t         buffer_xp,
    198210                            uint32_t       lba,
    199211                            uint32_t       count );
Note: See TracChangeset for help on using the changeset viewer.