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

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

Location:
trunk/hal/tsar_mips32/core
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_context.c

    r492 r570  
    195195
    196196    // get ppn of remote child process page table
    197     uint32_t    pt_ppn = hal_remote_lw( XPTR(child_cxy , &process->vmm.gpt.ppn) );
     197    uint32_t    pt_ppn = hal_remote_l32( XPTR(child_cxy , &process->vmm.gpt.ppn) );
    198198
    199199    // save CPU registers in local CPU context
     
    245245    hal_cpu_context_init( thread );
    246246
    247     // restore CPU registers ... and jump
     247    // restore CPU registers ... and jump to user code
    248248    hal_do_cpu_restore( (hal_cpu_context_t *)thread->cpu_context );
    249249
     
    263263
    264264    // get relevant context slots values
    265     uint32_t sp_29   = hal_remote_lw( XPTR( cxy , &ctx->sp_29   ) );
    266     uint32_t ra_31   = hal_remote_lw( XPTR( cxy , &ctx->ra_31   ) );
    267     uint32_t c0_sr   = hal_remote_lw( XPTR( cxy , &ctx->c0_sr   ) );
    268     uint32_t c0_epc  = hal_remote_lw( XPTR( cxy , &ctx->c0_epc  ) );
    269     uint32_t c0_th   = hal_remote_lw( XPTR( cxy , &ctx->c0_th   ) );
    270     uint32_t c2_ptpr = hal_remote_lw( XPTR( cxy , &ctx->c2_ptpr ) );
    271     uint32_t c2_mode = hal_remote_lw( XPTR( cxy , &ctx->c2_mode ) );
     265    uint32_t sp_29   = hal_remote_l32( XPTR( cxy , &ctx->sp_29   ) );
     266    uint32_t ra_31   = hal_remote_l32( XPTR( cxy , &ctx->ra_31   ) );
     267    uint32_t c0_sr   = hal_remote_l32( XPTR( cxy , &ctx->c0_sr   ) );
     268    uint32_t c0_epc  = hal_remote_l32( XPTR( cxy , &ctx->c0_epc  ) );
     269    uint32_t c0_th   = hal_remote_l32( XPTR( cxy , &ctx->c0_th   ) );
     270    uint32_t c2_ptpr = hal_remote_l32( XPTR( cxy , &ctx->c2_ptpr ) );
     271    uint32_t c2_mode = hal_remote_l32( XPTR( cxy , &ctx->c2_mode ) );
    272272   
    273273    printk("\n***** CPU context for thread %x in process %x / cycle %d\n"
  • trunk/hal/tsar_mips32/core/hal_drivers.c

    r550 r570  
    2626
    2727#include <soclib_tty.h>
    28 #include <soclib_mtty.h>
     28#include <soclib_mty.h>
    2929#include <soclib_pic.h>
    3030#include <soclib_iob.h>
    3131#include <soclib_bdv.h>
    3232#include <soclib_hba.h>
    33 #include <soclib_sdc.h>
    3433#include <soclib_mmc.h>
    3534#include <soclib_nic.h>
     
    5150                           uint32_t   impl )
    5251{
    53     switch (impl) {
    54     case IMPL_TXT_TTY : {
     52    if( impl ==  IMPL_TXT_TTY )
     53    {
    5554        soclib_tty_init( txt );
    56         break;
    5755    }
    58     case IMPL_TXT_MTY : {
    59         soclib_mtty_init( txt );
    60         break;
     56    else if (impl == IMPL_TXT_MTY )
     57    {
     58        soclib_mty_init( txt );
    6159    }
    62     default : {
    63         assert( false, "bad implementation" );
    64     }
     60    else
     61    {
     62        assert( false, "undefined implementation" );
    6563    }
    6664}
     
    7472                           uint32_t   impl )
    7573{
    76     assert( (impl == IMPL_PIC_SCL), "bad implementation" );
     74    assert( (impl == IMPL_PIC_SCL), "undefined implementation" );
    7775
    7876        soclib_pic_init( pic );
     
    9795                           uint32_t   impl )
    9896{
    99         assert( (impl == IMPL_IOB_TSR), "bad implementation" );
     97        assert( (impl == IMPL_IOB_TSR), "undefined implementation" );
    10098
    10199        soclib_iob_init( iob );
     
    126124                soclib_hba_init( ioc );
    127125        }
    128         else if (impl == IMPL_IOC_SPI)
    129     {
    130                 soclib_sdc_init( ioc );
    131         }
     126//      else if (impl == IMPL_IOC_SPI)
     127//  {
     128//              soclib_sdc_init( ioc );
     129//      }
    132130    else
    133131    {
     
    144142                           uint32_t   impl )
    145143{
    146         assert( (impl == IMPL_MMC_TSR), "bad implementation" );
     144        assert( (impl == IMPL_MMC_TSR), "undefined implementation" );
    147145 
    148146    soclib_mmc_init( mmc );
     
    157155                           uint32_t   impl )
    158156{
    159         assert( (impl == IMPL_NIC_CBF), "bad implementation" );
     157        assert( (impl == IMPL_NIC_CBF), "undefined implementation" );
    160158 
    161159    soclib_nic_init( nic );
     
    170168                           uint32_t   impl )
    171169{
    172         assert( (impl == IMPL_DMA_SCL), "bad implementation" );
     170        assert( (impl == IMPL_DMA_SCL), "undefined implementation" );
    173171 
    174172    soclib_dma_init( dma );
  • trunk/hal/tsar_mips32/core/hal_exception.c

    r527 r570  
    3535#include <syscalls.h>
    3636#include <shared_syscalls.h>
    37 #include <remote_spinlock.h>
     37#include <remote_busylock.h>
    3838#include <hal_kentry.h>
    39 
    4039#include <hal_exception.h>
    4140
     
    340339                                error_t    error )
    341340{
    342     uint32_t    save_sr;
    343341    core_t    * core    = this->core;
    344342    process_t * process = this->process;
     
    353351
    354352    // get TXT0 lock in busy waiting mode
    355     remote_spinlock_lock_busy( lock_xp , &save_sr );
     353    remote_busylock_acquire( lock_xp );
    356354
    357355    if( error == EXCP_USER_ERROR )
     
    366364    }
    367365
    368         nolock_printk("local locks = %d / remote locks = %d / blocked_vector = %X\n\n",
    369     this->local_locks, this->remote_locks, this->blocked );
     366        nolock_printk("busylocks = %d / blocked_vector = %X / flags = %X\n\n",
     367    this->busylocks, this->blocked, this->flags );
    370368
    371369    nolock_printk("c0_cr   %X  c0_epc  %X  c0_sr  %X  c0_th  %X\n",
     
    394392
    395393    // release the lock
    396     remote_spinlock_unlock_busy( lock_xp , save_sr );
     394    remote_busylock_release( lock_xp );
    397395
    398396}  // end hal_exception_dump()
  • trunk/hal/tsar_mips32/core/hal_gpt.c

    r492 r570  
    799799
    800800    // get src_pte1
    801     src_pte1 = hal_remote_lw( XPTR( src_cxy , &src_pt1[ix1] ) );
     801    src_pte1 = hal_remote_l32( XPTR( src_cxy , &src_pt1[ix1] ) );
    802802
    803803    // do nothing if src_pte1 not MAPPED or not SMALL
     
    844844
    845845        // get attr and ppn from SRC_PT2
    846         src_pte2_attr = hal_remote_lw( XPTR( src_cxy , &src_pt2[2 * ix2]     ) );
    847         src_pte2_ppn  = hal_remote_lw( XPTR( src_cxy , &src_pt2[2 * ix2 + 1] ) );
     846        src_pte2_attr = hal_remote_l32( XPTR( src_cxy , &src_pt2[2 * ix2]     ) );
     847        src_pte2_ppn  = hal_remote_l32( XPTR( src_cxy , &src_pt2[2 * ix2 + 1] ) );
    848848
    849849        // do nothing if src_pte2 not MAPPED
     
    10011001
    10021002        // get PTE1 value
    1003         pte1 = hal_remote_lw( XPTR( gpt_cxy , &pt1[ix1] ) );
     1003        pte1 = hal_remote_l32( XPTR( gpt_cxy , &pt1[ix1] ) );
    10041004
    10051005        // only MAPPED & SMALL PTEs are modified
     
    10141014 
    10151015            // get current PTE2 attributes
    1016             attr = hal_remote_lw( XPTR( gpt_cxy , &pt2[2*ix2] ) );
     1016            attr = hal_remote_l32( XPTR( gpt_cxy , &pt2[2*ix2] ) );
    10171017
    10181018            // only MAPPED PTEs are modified       
     
    10201020            {
    10211021                attr = (attr | TSAR_MMU_COW) & (~TSAR_MMU_WRITABLE);
    1022                 hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , attr );
     1022                hal_remote_s32( XPTR( gpt_cxy , &pt2[2*ix2] ) , attr );
    10231023            }
    10241024        }
     
    10631063
    10641064    // get PTE1 value
    1065     pte1 = hal_remote_lw( XPTR( gpt_cxy , &pt1[ix1] ) );
     1065    pte1 = hal_remote_l32( XPTR( gpt_cxy , &pt1[ix1] ) );
    10661066
    10671067    if( (pte1 & TSAR_MMU_MAPPED) == 0 ) return;
     
    10731073
    10741074    // reset PTE2
    1075         hal_remote_sw( XPTR( gpt_cxy, &pt2[2 * ix2]     ) , 0 );
     1075        hal_remote_s32( XPTR( gpt_cxy, &pt2[2 * ix2]     ) , 0 );
    10761076        hal_fence();
    10771077
    10781078    // set PTE2 in this order
    1079         hal_remote_sw( XPTR( gpt_cxy, &pt2[2 * ix2 + 1] ) , ppn );
     1079        hal_remote_s32( XPTR( gpt_cxy, &pt2[2 * ix2 + 1] ) , ppn );
    10801080        hal_fence();
    1081         hal_remote_sw( XPTR( gpt_cxy, &pt2[2 * ix2]     ) , tsar_attr );
     1081        hal_remote_s32( XPTR( gpt_cxy, &pt2[2 * ix2]     ) , tsar_attr );
    10821082        hal_fence();
    10831083
  • trunk/hal/tsar_mips32/core/hal_macros.h

    r469 r570  
    2828//     User-side, hardware dependant, macros definition.
    2929//
    30 //   Any architecture specific implementation must implement thes macros.
     30//   Any architecture specific implementation must implement these macros.
    3131//////////////////////////////////////////////////////////////////////////////////////////
    3232
  • trunk/hal/tsar_mips32/core/hal_ppm.c

    r457 r570  
    2727#include <hal_special.h>
    2828#include <printk.h>
    29 #include <spinlock.h>
     29#include <busylock.h>
    3030#include <process.h>
    3131#include <ppm.h>
     
    4646//////////////////////////////////////////////////////////////////////////////////////////
    4747
     48
    4849///////////////////////////////////////////
    4950error_t  hal_ppm_init( boot_info_t * info )
     
    5960
    6061        // initialize lock protecting the free_pages[] lists
    61         spinlock_init( &ppm->free_lock );
     62        busylock_init( &ppm->free_lock , LOCK_PPM_FREE );
    6263
    6364        // initialize lock protecting the dirty_pages list
    64         spinlock_init( &ppm->dirty_lock );
     65        queuelock_init( &ppm->dirty_lock , LOCK_PPM_DIRTY );
    6566
    6667        // initialize all free_pages[] lists as empty
  • trunk/hal/tsar_mips32/core/hal_remote.c

    r501 r570  
    5454
    5555/////////////////////////////////
    56 void hal_remote_sw( xptr_t    xp,
     56void hal_remote_s32( xptr_t    xp,
    5757                    uint32_t  data )
    5858{
     
    8080
    8181//////////////////////////////////
    82 void hal_remote_swd( xptr_t    xp,
     82void hal_remote_s64( xptr_t    xp,
    8383                     uint64_t  data )
    8484{
     
    113113                     void *      pt )
    114114{
    115     hal_remote_sw ( xp , (uint32_t)pt );
     115    hal_remote_s32 ( xp , (uint32_t)pt );
    116116}
    117117
     
    143143
    144144////////////////////////////////////
    145 uint32_t hal_remote_lw( xptr_t  xp )
     145uint32_t hal_remote_l32( xptr_t  xp )
    146146{
    147147        uint32_t data;
     
    169169
    170170/////////////////////////////////////
    171 uint64_t hal_remote_lwd( xptr_t  xp )
     171uint64_t hal_remote_l64( xptr_t  xp )
    172172{
    173173    uint32_t data_lsb;
     
    200200void * hal_remote_lpt( xptr_t    xp )
    201201{
    202     return (void *)hal_remote_lw ( xp );
     202    return (void *)hal_remote_l32 ( xp );
    203203}
    204204
  • trunk/hal/tsar_mips32/core/hal_special.c

    r481 r570  
    3232struct thread_s;
    3333
    34 //////////////////////////
     34////////////////////////////////
    3535inline gid_t hal_get_gid( void )
    3636{
     
    4242}
    4343
    44 /////////////////////////////
     44///////////////////////////////////
    4545inline reg_t hal_time_stamp( void )
    4646{
     
    5252}
    5353
    54 /////////////////////////
     54///////////////////////////////
    5555inline reg_t hal_get_sr( void )
    5656{
     
    6262}
    6363
    64 /////////////////////////
     64///////////////////////////////
    6565uint64_t hal_get_cycles( void )
    6666{
     
    9494}
    9595
    96 /////////////////////////////////////////////////
     96///////////////////////////////////////////////////////
    9797inline struct thread_s * hal_get_current_thread( void )
    9898{
     
    110110}
    111111
    112 /////////////////////
     112///////////////////////////
    113113void hal_fpu_enable( void )
    114114{
     
    127127}
    128128
    129 //////////////////////
     129////////////////////////////
    130130void hal_fpu_disable( void )
    131131{
     
    145145}
    146146
    147 ////////////////////////
     147//////////////////////////////
    148148uint32_t hal_get_stack( void )
    149149{
     
    168168}
    169169
    170 ////////////////////////////
     170//////////////////////////////////
    171171uint32_t hal_get_bad_vaddr( void )
    172172{
     
    201201}
    202202
    203 ////////////////
    204 void hal_fence( void )
     203/////////////////////////////
     204inline void hal_fence( void )
    205205{
    206206        asm volatile ("sync");
    207207}
    208208
    209 ////////////////
    210 void hal_rdbar( void )
     209/////////////////////////////
     210inline void hal_rdbar( void )
    211211{
    212212        asm volatile( "" ::: "memory" );
    213213}
    214214
    215 /////////////////////
     215///////////////////////////
    216216void hal_core_sleep( void )
    217217{
  • trunk/hal/tsar_mips32/core/hal_vmm.c

    r457 r570  
    6464    }
    6565
    66     // get lock protecting the VSL to found the "kentry" vseg
    67     remote_rwlock_wr_lock( XPTR( local_cxy , &vmm->vsegs_lock ) );
     66    // get extended pointer on lock protecting the VSL
     67    xptr_t lock_xp = XPTR( local_cxy , &vmm->vsegs_lock );
    6868
    69     // scan the VSL
     69    // get VSL lock
     70    remote_rwlock_wr_acquire( lock_xp );
     71
     72    // scan the VSL to found the "kentry" vseg
    7073    xptr_t         root_xp = XPTR( local_cxy , &vmm->vsegs_root );
    7174    xptr_t         iter_xp;
    7275    xptr_t         vseg_xp;
    7376    vseg_t       * vseg;
    74     bool_t         found = false;
     77    bool_t         found = false;
     78 
    7579    XLIST_FOREACH( root_xp , iter_xp )
    7680    {
     
    8791    }
    8892
    89     // release the lock protecting the VSL
    90     remote_rwlock_wr_unlock( XPTR( local_cxy , &vmm->vsegs_lock ) );
     93    // release the VSL lock
     94    remote_rwlock_wr_release( lock_xp );
    9195
    9296    if( found == false ) return error;
Note: See TracChangeset for help on using the changeset viewer.