Changeset 496


Ignore:
Timestamp:
Feb 8, 2015, 1:12:23 PM (9 years ago)
Author:
alain
Message:

1) Introduce access functions to MMC intrumentation registers.
2) Use _printf for error or debug messages.

Location:
soft/giet_vm/giet_drivers
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/bdv_driver.c

    r469 r496  
    2727///////////////////////////////////////////////////////////////////////////////
    2828
     29__attribute__((section(".kdata")))
    2930spin_lock_t  _bdv_lock __attribute__((aligned(64)));
     31
     32__attribute__((section(".kdata")))
    3033unsigned int _bdv_status;
     34
     35__attribute__((section(".kdata")))
    3136unsigned int _bdv_gtid;
    3237
     
    132137_puts(",");
    133138_putd( p );
    134 _puts("] launch transfer in polling mode\n");
     139_puts("] launch transfer in polling mode at cycle ");
     140_putd( _get_proctime() );
     141_puts("\n");
    135142#endif
    136143        unsigned int status;
     
    196203_puts(",");
    197204_putd( p );
    198 _puts("] launch transfer in nterrupt mode\n");
     205_puts("] launch transfer in interrupt mode at cycle ");
     206_putd( _get_proctime() );
     207_puts("\n");
    199208#endif
    200209
     
    350359_putd(remote_x );
    351360_puts(",");
    352 _putd(remore_y );
     361_putd(remote_y );
    353362_puts(",");
    354363_putd(remote_p );
  • soft/giet_vm/giet_drivers/bdv_driver.h

    r456 r496  
    4848#define _GIET_BDV_DRIVER_H_
    4949
    50 #include "locks.h"
     50#include "kernel_locks.h"
    5151
    5252///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/dma_driver.c

    r481 r496  
    4848// in the DMA component contained in cluster "cluster_xy"
    4949///////////////////////////////////////////////////////////////////////////////
     50
     51#if NB_DMA_CHANNELS > 0
    5052static
    5153unsigned int _dma_get_register( unsigned int cluster_xy, // cluster index
     
    6163    return ioread32( (void*)vaddr );
    6264}
     65#endif
    6366
    6467///////////////////////////////////////////////////////////////////////////////
     
    6669// in the DMA component contained in cluster "cluster_xy"
    6770///////////////////////////////////////////////////////////////////////////////
     71
     72#if NB_DMA_CHANNELS > 0
    6873static
    6974void _dma_set_register( unsigned int cluster_xy,       // cluster index
     
    8085    iowrite32( (void*)vaddr, value );
    8186}
     87#endif
    8288
    8389////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r481 r496  
    6767///////////////////////////////////////////////////////////////////////////////
    6868
    69 #define in_unckdata __attribute__((section (".unckdata")))
    70 
    71 in_unckdata volatile unsigned int _ioc_iommu_ix1 = 0;
    72 in_unckdata volatile unsigned int _ioc_iommu_npages;
     69__attribute__((section (".kdata")))
     70volatile unsigned int _ioc_iommu_ix1 = 0;
     71
     72__attribute__((section (".kdata")))
     73volatile unsigned int _ioc_iommu_npages;
    7374
    7475///////////////////////////////////////////////////////////////////////////////
     
    9697unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    9798unsigned int p       = procid & ((1<<P_WIDTH)-1);
    98 _puts("\n[IOC DEBUG] _ioc_access() : P[");
    99 _putd( x );
    100 _puts(",");
    101 _putd( y );
    102 _puts(",");
    103 _putd( p );
    104 _puts("] enters at cycle ");
    105 _putd( _get_proctime() );
    106 _puts("\n - channel  = ");
    107 _putd( channel );
    108 _puts("\n - mode     = ");
    109 _putd( mode );
    110 _puts("\n - vaddr    = ");
    111 _putx( buf_vaddr );
    112 _puts("\n - sectors  = ");
    113 _putd( count );
    114 _puts("\n - lba      = ");
    115 _putx( lba );
    116 _puts("\n");
     99_printf("\n[IOC DEBUG] _ioc_access() : P[%d,%d,%d] enters at cycle %d\n"
     100        " - channel  = %d\n"
     101        " - mode     = %d\n"
     102        " - vaddr    = %x\n"
     103        " - sectors  = %d\n"
     104        " - lba      = %x\n",
     105        x, y , p, _get_proctime(), channel, mode, buf_vaddr, count, lba );
    117106#endif
    118107
     
    140129
    141130    // computing memory buffer physical address
    142     if ( (mode == IOC_BOOT_MODE) && ((_get_mmu_mode() & 0x4) == 0) ) // identity mapping
     131    if ( (mode == IOC_BOOT_MODE) && ((_get_mmu_mode() & 0x4) == 0) ) // identity
    143132    {
    144133        buf_paddr = (paddr_t)buf_vaddr;
    145134    }
    146     else                                                    // V2P translation required
     135    else                                                 // V2P translation required
    147136    {
    148137        // get page table virtual address
     
    280269#elif ( USE_IOC_RDK )
    281270
    282     return rdk_get_status();
     271    return _rdk_get_status();
    283272
    284273#endif
  • soft/giet_vm/giet_drivers/ioc_driver.h

    r437 r496  
    1 ///////////////////////////////////////////////////////////////////////////////////
     1///////////////////////////////////////////////////////////////////////////////
    22// File     : ioc_driver.h
    33// Date     : 01/11/2013
    44// Author   : alain greiner
    55// Copyright (c) UPMC-LIP6
    6 ///////////////////////////////////////////////////////////////////////////////////
     6///////////////////////////////////////////////////////////////////////////////
    77// The ioc_driver.c and ioc_driver.h files are part ot the GIET-VM kernel.
    88//
     
    6969// The user buffer is unmapped by the _ioc_completed() function when
    7070// the transfer is completed.
    71 ///////////////////////////////////////////////////////////////////////////////////
     71///////////////////////////////////////////////////////////////////////////////
    7272
    7373#ifndef _GIET_IOC_DRIVER_H_
    7474#define _GIET_IOC_DRIVER_H_
    7575
    76 ///////////////////////////////////////////////////////////////////////////////////
     76///////////////////////////////////////////////////////////////////////////////
    7777// IOC (vci_block device) registers offsets
    78 ///////////////////////////////////////////////////////////////////////////////////
     78///////////////////////////////////////////////////////////////////////////////
    7979
    8080enum IOC_driver_modes
     
    8585};
    8686
    87 ///////////////////////////////////////////////////////////////////////////////////
    88 // IOC global variables (generic disk controller)
    89 ///////////////////////////////////////////////////////////////////////////////////
     87///////////////////////////////////////////////////////////////////////////////
     88//      External global variables
     89///////////////////////////////////////////////////////////////////////////////
    9090
    9191extern volatile unsigned int _ioc_iommu_ix1;
    9292extern volatile unsigned int _ioc_iommu_npages;
    9393
    94 ///////////////////////////////////////////////////////////////////////////////////
     94///////////////////////////////////////////////////////////////////////////////
    9595//      External functions                           
    96 ///////////////////////////////////////////////////////////////////////////////////
     96///////////////////////////////////////////////////////////////////////////////
    9797
    9898///////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/mmc_driver.c

    r481 r496  
    99#include <mmc_driver.h>
    1010#include <tty0.h>
    11 #include <locks.h>
     11#include <kernel_locks.h>
    1212#include <utils.h>
    1313
     
    3737# error: You must define PERI_CLUSTER_INCREMENT in the hard_config.h file
    3838#endif
     39
     40///////////////////////////////////////////////////////////////////////////////
     41// Distributed locks protecting MMC components (one per cluster)
     42///////////////////////////////////////////////////////////////////////////////
     43
     44__attribute__((section(".kdata")))
     45spin_lock_t  _mmc_lock[X_SIZE][Y_SIZE]  __attribute__((aligned(64)));
    3946
    4047///////////////////////////////////////////////////////////////////////////////
     
    8794    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
    8895    {
    89         _puts("\n[GIET ERROR] in _memc_inval() : illegal cluster coordinates\n");
     96        _puts("\n[GIET ERROR] in _mmc_inval() : illegal cluster coordinates\n");
    9097        _exit();
    9198    }
    9299
    93     // get the hard queuing lock protecting exclusive access to MEMC
     100    // get the lock protecting exclusive access to MEMC
    94101    _spin_lock_acquire( &_mmc_lock[x][y] );
    95102
    96103    // write inval arguments
    97     _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_LO   , (unsigned int)buf_paddr );
    98     _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32) );
    99     _mmc_set_register( cluster_xy , 0 , MEMC_BUF_LENGTH, buf_length );
    100     _mmc_set_register( cluster_xy , 0 , MEMC_CMD_TYPE  , MEMC_CMD_INVAL );
     104    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_LO   , (unsigned int)buf_paddr );
     105    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32) );
     106    _mmc_set_register(cluster_xy, 0, MEMC_BUF_LENGTH, buf_length );
     107    _mmc_set_register(cluster_xy, 0, MEMC_CMD_TYPE  , MEMC_CMD_INVAL );
    101108
    102109    // release the lock
     
    116123    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
    117124    {
    118         _puts( "\n[GIET ERROR] in _memc_sync() : illegal cluster coordinates");
     125        _puts( "\n[GIET ERROR] in _mmc_sync() : illegal cluster coordinates");
    119126        _exit();
    120127    }
    121128
    122     // get the hard queuing lock protecting exclusive access to MEMC
     129    // get the lock protecting exclusive access to MEMC
    123130    _spin_lock_acquire( &_mmc_lock[x][y] );
    124131
     
    131138    // release the lock
    132139    _spin_lock_release( &_mmc_lock[x][y] );
     140}
     141
     142/////////////////////////////////////////////
     143unsigned int _mmc_instrument( unsigned int x,
     144                              unsigned int y,
     145                              unsigned int reg )
     146{
     147    // parameters checking
     148    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
     149    {
     150        _puts( "\n[GIET ERROR] in _mmc_instrument() : illegal cluster coordinates");
     151        _exit();
     152    }
     153
     154    unsigned int cluster_xy = (x << Y_WIDTH) + y;
     155    return( _mmc_get_register(cluster_xy , 1 , reg) );
    133156}
    134157
  • soft/giet_vm/giet_drivers/mmc_driver.h

    r483 r496  
    1010
    1111#include <hard_config.h>
    12 #include <locks.h>
     12#include <kernel_locks.h>
    1313
    1414///////////////////////////////////////////////////////////////////////////////////
    1515// TSAR Memory Cache configuration registers offsets and commands
    1616///////////////////////////////////////////////////////////////////////////////////
     17
     18enum SoclibMemCacheFunc
     19{
     20    MEMC_CONFIG = 0,
     21    MEMC_INSTRM = 1,
     22    MEMC_RERROR = 2,
     23
     24    MEMC_FUNC_SPAN = 0x200
     25};
    1726
    1827enum SoclibMemCacheConfigRegs
     
    3140};
    3241
     42enum SoclibMemCacheInstrRegs {
     43
     44    // NUMBER OF LOCAL TRANSACTIONS ON DIRECT NETWORK
     45
     46    MEMC_LOCAL_READ_LO   = 0x00,
     47    MEMC_LOCAL_READ_HI   = 0x01,
     48    MEMC_LOCAL_WRITE_LO  = 0x02,
     49    MEMC_LOCAL_WRITE_HI  = 0x03,
     50    MEMC_LOCAL_LL_LO     = 0x04,
     51    MEMC_LOCAL_LL_HI     = 0x05,
     52    MEMC_LOCAL_SC_LO     = 0x06,
     53    MEMC_LOCAL_SC_HI     = 0x07,
     54    MEMC_LOCAL_CAS_LO    = 0x08,
     55    MEMC_LOCAL_CAS_HI    = 0x09,
     56
     57    // NUMBER OF REMOTE TRANSACTIONS ON DIRECT NETWORK
     58
     59    MEMC_REMOTE_READ_LO  = 0x10,
     60    MEMC_REMOTE_READ_HI  = 0x11,
     61    MEMC_REMOTE_WRITE_LO = 0x12,
     62    MEMC_REMOTE_WRITE_HI = 0x13,
     63    MEMC_REMOTE_LL_LO    = 0x14,
     64    MEMC_REMOTE_LL_HI    = 0x15,
     65    MEMC_REMOTE_SC_LO    = 0x16,
     66    MEMC_REMOTE_SC_HI    = 0x17,
     67    MEMC_REMOTE_CAS_LO   = 0x18,
     68    MEMC_REMOTE_CAS_HI   = 0x19,
     69
     70    // COST OF TRANSACTIONS ON DIRECT NETWORK
     71
     72    MEMC_COST_READ_LO    = 0x20,
     73    MEMC_COST_READ_HI    = 0x21,
     74    MEMC_COST_WRITE_LO   = 0x22,
     75    MEMC_COST_WRITE_HI   = 0x23,
     76    MEMC_COST_LL_LO      = 0x24,
     77    MEMC_COST_LL_HI      = 0x25,
     78    MEMC_COST_SC_LO      = 0x26,
     79    MEMC_COST_SC_HI      = 0x27,
     80    MEMC_COST_CAS_LO     = 0x28,
     81    MEMC_COST_CAS_HI     = 0x29,
     82
     83    // NUMBER OF LOCAL TRANSACTIONS ON CC NETWORK
     84
     85    MEMC_LOCAL_MUPDATE_LO  = 0x40,
     86    MEMC_LOCAL_MUPDATE_HI  = 0x41,
     87    MEMC_LOCAL_MINVAL_LO   = 0x42,
     88    MEMC_LOCAL_MINVAL_HI   = 0x43,
     89    MEMC_LOCAL_CLEANUP_LO  = 0x44,
     90    MEMC_LOCAL_CLEANUP_HI  = 0x45,
     91
     92    // NUMBER OF REMOTE TRANSACTIONS ON CC NETWORK
     93
     94    MEMC_REMOTE_MUPDATE_LO = 0x50,
     95    MEMC_REMOTE_MUPDATE_HI = 0x51,
     96    MEMC_REMOTE_MINVAL_LO  = 0x52,
     97    MEMC_REMOTE_MINVAL_HI  = 0x53,
     98    MEMC_REMOTE_CLEANUP_LO = 0x54,
     99    MEMC_REMOTE_CLEANUP_HI = 0x55,
     100
     101    // COST OF TRANSACTIONS ON CC NETWORK
     102
     103    MEMC_COST_MUPDATE_LO   = 0x60,
     104    MEMC_COST_MUPDATE_HI   = 0x61,
     105    MEMC_COST_MINVAL_LO    = 0x62,
     106    MEMC_COST_MINVAL_HI    = 0x63,
     107    MEMC_COST_CLEANUP_LO   = 0x64,
     108    MEMC_COST_CLEANUP_HI   = 0x65,
     109
     110    // TOTAL
     111
     112    MEMC_TOTAL_MUPDATE_LO  = 0x68,
     113    MEMC_TOTAL_MUPDATE_HI  = 0x69,
     114    MEMC_TOTAL_MINVAL_LO   = 0x6A,
     115    MEMC_TOTAL_MINVAL_HI   = 0x6B,
     116    MEMC_TOTAL_BINVAL_LO   = 0x6C,
     117    MEMC_TOTAL_BINVAL_HI   = 0x6D,
     118};
     119
    33120#define MMC_REG(func,idx) ((func<<7)|idx)
    34 
    35 ///////////////////////////////////////////////////////////////////////////////
    36 // Distributed locks protecting MMC components (one per cluster)
    37 ///////////////////////////////////////////////////////////////////////////////
    38 
    39 spin_lock_t  _mmc_lock[X_SIZE][Y_SIZE]  __attribute__((aligned(64)));
    40121
    41122///////////////////////////////////////////////////////////////////////////////////
    42123// MEMC access functions (for TSAR architecture)
    43124///////////////////////////////////////////////////////////////////////////////////
     125
     126extern unsigned int _mmc_instrument( unsigned int x,
     127                                     unsigned int y,
     128                                     unsigned int reg );
    44129
    45130extern void _mmc_inval( unsigned long long buf_paddr,
  • soft/giet_vm/giet_drivers/tty_driver.c

    r469 r496  
    1717# error: You must define SEG_TTY_BASE in the hard_config.h file
    1818#endif
     19
     20////////////////////////////////////////////////////////////////////////////////////
     21//               global variables
     22////////////////////////////////////////////////////////////////////////////////////
     23
     24__attribute__((section(".kdata")))
     25unsigned int   _tty_rx_buf[NB_TTY_CHANNELS];
     26
     27__attribute__((section(".kdata")))
     28unsigned int   _tty_rx_full[NB_TTY_CHANNELS];
    1929
    2030////////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/tty_driver.h

    r469 r496  
    2525
    2626#include "hard_config.h"
    27 #include "locks.h"
     27#include "kernel_locks.h"
    2828
    2929///////////////////////////////////////////////////////////////////////////////////
     
    4040    TTY_SPAN    = 4,
    4141};
    42 
    43 ////////////////////////////////////////////////////////////////////////////////////
    44 //                   global variables
    45 // These variables must be defined both in boot code and in kernel_init code.
    46 ////////////////////////////////////////////////////////////////////////////////////
    47 
    48 extern sbt_lock_t     _tty_tx_lock[NB_TTY_CHANNELS];
    49 
    50 extern unsigned int   _tty_rx_buf[NB_TTY_CHANNELS];
    51 extern unsigned int   _tty_rx_full[NB_TTY_CHANNELS];
    5242
    5343//////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/xcu_driver.c

    r490 r496  
    101101    else
    102102    {
    103         _puts("[GIET ERROR] _xcu_set_mask() receives illegal IRQ type\n");
     103        _printf("[GIET ERROR] _xcu_set_mask() receives illegal IRQ type\n");
    104104        _exit();
    105105    }
     
    108108
    109109#else
    110     _puts("[GIET ERROR] _xcu_set_mask() should not be used if USE_XCU not set\n");
     110    _printf("[GIET ERROR] _xcu_set_mask() should not be used if USE_XCU not set\n");
    111111    _exit();
    112112#endif
     
    155155 
    156156#else
    157     _puts("[GIET ERROR] _xcu_get_index should not be used if USE_XCU is not set\n");
     157    _printf("[GIET ERROR] _xcu_get_index should not be used if USE_XCU is not set\n");
    158158    _exit();
    159159#endif
     
    176176
    177177#else
    178     _puts("[GIET ERROR] _xcu_send_wti() should not be used if USE_XCU is not set\n");
     178    _printf("[GIET ERROR] _xcu_send_wti() should not be used if USE_XCU is not set\n");
    179179    _exit();
    180180#endif
     
    221221
    222222#else
    223     _puts("[GIET ERROR] in _xcu_get_wti_value() USE_XCU is not set\n");
     223    _printf("[GIET ERROR] in _xcu_get_wti_value() USE_XCU is not set\n");
    224224    _exit();
    225225#endif
     
    236236
    237237#else
    238     _puts("[GIET ERROR] in _xcu_get_wti_address() USE_XCU is not set\n");
     238    _printf("[GIET ERROR] in _xcu_get_wti_address() USE_XCU is not set\n");
    239239    _exit();
    240240#endif
     
    256256
    257257#else
    258     _puts("[GIET ERROR] in _xcu_timer_start() USE_XCU is not set\n");
     258    _printf("[GIET ERROR] in _xcu_timer_start() USE_XCU is not set\n");
    259259    _exit();
    260260#endif
     
    275275
    276276#else
    277     _puts("[GIET ERROR] in _xcu_timer_stop() USE_XCU is not set\n");
     277    _printf("[GIET ERROR] in _xcu_timer_stop() USE_XCU is not set\n");
    278278    _exit();
    279279#endif
Note: See TracChangeset for help on using the changeset viewer.