Ignore:
Timestamp:
Oct 5, 2018, 12:08:35 AM (6 years ago)
Author:
alain
Message:

Introduction of the soclib_mty driver for the TSAR-LETI architecture.

File:
1 edited

Legend:

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

    r522 r570  
    2727#include <dev_ioc.h>
    2828#include <soclib_hba.h>
    29 #include <spinlock.h>
    3029#include <thread.h>
    3130
     
    5150
    5251// spinlock protecting the command slot allocator
    53 __attribute__((section(".kdata")))
    54 spinlock_t         hba_lock;
     52// __attribute__((section(".kdata")))
     53// busylock_t         hba_lock;
    5554
    5655///////////////////////////////////////
     
    6968
    7069    // get block_size and block_count 
    71         uint32_t block_size  = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_SIZE_REG ) );
    72         uint32_t block_count = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_COUNT_REG ) );
     70        uint32_t block_size  = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_SIZE_REG ) );
     71        uint32_t block_count = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_COUNT_REG ) );
    7372
    7473    // set device descriptor extension
     
    7776
    7877    // activate HBA interrupts
    79     hal_remote_sw( XPTR( hba_cxy , hba_ptr + HBA_PXIE_REG ) , 0x1 );
     78    hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXIE_REG ) , 0x1 );
    8079
    8180        // reset SOCLIB_HBA driver global variable
     
    107106
    108107    // get command arguments and extended pointer on IOC device
    109     cmd_type  =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.type   ) );
    110     lba       =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba    ) );
    111     count     =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.count  ) );
    112     buf_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) );
    113     dev_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );
     108    cmd_type  =         hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.type   ) );
     109    lba       =         hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba    ) );
     110    count     =         hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.count  ) );
     111    buf_xp    = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) );
     112    dev_xp    = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );
    114113
    115114    // get IOC device cluster and local pointer
     
    118117
    119118    // get cluster and pointers for SOCLIB-HBA peripheral segment base
    120     xptr_t     hba_xp  = (xptr_t)hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) );
     119    xptr_t     hba_xp  = (xptr_t)hal_remote_l64( XPTR( dev_cxy , &dev_ptr->base ) );
    121120    cxy_t      hba_cxy = GET_CXY( hba_xp );
    122121    uint32_t * hba_ptr = GET_PTR( hba_xp );
     
    181180 
    182181            // set HBA_PXCI_REG to start transfer
    183             hal_remote_sw( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) , 1<<cmd_id );
     182            hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) , 1<<cmd_id );
    184183
    185184            // exit the while
     
    204203        while(1)
    205204        {
    206             pxis     = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );
    207             pxci     = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );
     205            pxis     = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );
     206            pxci     = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );
    208207            error    = (pxis & 0x40000000) >> 30;
    209208            fault_id = (pxis & 0x1F000000) >> 24;
     
    217216                if( error && (fault_id == cmd_id) )
    218217                {
    219                     hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );
     218                    hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );
    220219                }
    221220                else
    222221                {
    223                     hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );
     222                    hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );
    224223                }
    225224
     
    243242    // get extended pointer on client thread
    244243    xptr_t root      = XPTR( local_cxy , &chdev->wait_root );
    245     xptr_t client_xp = XLIST_FIRST_ELEMENT( root , thread_t , wait_list );
     244    xptr_t client_xp = XLIST_FIRST( root , thread_t , wait_list );
    246245
    247246    // get client thread cluster and local pointer
     
    254253
    255254    // get HBA_PXIS_REG and HBA_PXCI_REG current values
    256     uint32_t current_pxis = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );
    257     uint32_t current_pxci = hal_remote_lw( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );
     255    uint32_t current_pxis = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );
     256    uint32_t current_pxci = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );
    258257
    259258    uint32_t  error    = (current_pxis & 0x40000000) >> 30;
     
    273272            if( error && (iter == fault_id ) )
    274273            {
    275                 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 );
     274                hal_remote_s32( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 );
    276275            }
    277276            else
    278277            {
    279                 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 );
     278                hal_remote_s32( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 );
    280279            }
    281280
     
    286285
    287286    // reset HBA_PXIS_REG
    288     hal_remote_sw( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) , 0 );
     287    hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) , 0 );
    289288
    290289} // end soclib_hba_isr()
Note: See TracChangeset for help on using the changeset viewer.