Changeset 215 for soft/giet_vm/sys


Ignore:
Timestamp:
Sep 17, 2012, 10:47:46 AM (12 years ago)
Author:
karaoui
Message:

New components are now mandotory in the XML description:

The files giet_vsegs.ld and hard_config.h are now autogenerated by the xml2bin tool.

Location:
soft/giet_vm/sys
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/common.c

    r207 r215  
    158158void _puts(char* buffer)
    159159{
    160     unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base +
    161                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     160    unsigned int* tty_address = (unsigned int*) &seg_tty_base;
    162161    unsigned int n;
    163162
  • soft/giet_vm/sys/drivers.c

    r213 r215  
    1717//
    1818// The following global parameters must be defined in the giet_config.h file:
    19 // - CLUSTER_IO_ID
    2019// - CLUSTER_SIZE
    2120// - NB_CLUSTERS   
     
    4847
    4948#if !defined(NB_CLUSTERS)
    50 # error: You must define NB_CLUSTERS in 'giet_config.h' file
     49# error: You must define NB_CLUSTERS in the configs file
    5150#endif
    5251
    5352#if !defined(NB_PROCS_MAX)
    54 # error: You must define NB_PROCS_MAX in 'giet_config.h' file
     53# error: You must define NB_PROCS_MAX in the configs file
    5554#endif
    5655
     
    6059
    6160#if !defined(CLUSTER_SIZE)
    62 # error: You must define CLUSTER_SIZE in 'giet_config.h' file
     61# error: You must define CLUSTER_SIZE in the configs file
    6362#endif
    6463
    6564#if !defined(NB_TTYS)
    66 # error: You must define NB_TTYS in 'giet_config.h' file
     65# error: You must define NB_TTYS in the configs file
    6766#endif
    6867
     
    8483
    8584#if !defined(NB_IOCS)
    86 # error: You must define NB_IOCS in 'giet_config.h' file
     85# error: You must define NB_IOCS in the configs file
    8786#endif
    8887
    8988#if ( NB_IOCS > 1 )
    9089# error: NB_IOCS cannot be larger than 1
     90#endif
     91
     92#if !defined( USE_XICU )
     93# error: You must define USE_XICU in the configs file
     94#endif
     95
     96#if !defined( IOMMU_ACTIVE )
     97# error: You must define IOMMU_ACTIVE in the configs file
    9198#endif
    9299
     
    98105//////////////////////////////////////////////////////////////////////////////
    99106// The timers can be implemented in a vci_timer component or in a vci_xicu
    100 // component (depending on the GIET_USE_XICU parameter).
     107// component (depending on the USE_XICU parameter).
    101108// There is one timer (or xicu) component per cluster.
    102109// There is two types of timers:
     
    132139    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    133140
    134 #if GIET_USE_XICU
     141#if USE_XICU
    135142    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    136143                                  (cluster_id * CLUSTER_SIZE) );
     
    160167    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    161168
    162 #if GIET_USE_XICU
     169#if USE_XICU
    163170    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    164171                                  (cluster_id * CLUSTER_SIZE) );
     
    189196    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    190197
    191 #if GIET_USE_XICU
     198#if USE_XICU
    192199    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    193200                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
     
    260267    }
    261268
    262     unsigned int*       tty_address = (unsigned int*)( (char*)&seg_tty_base +
    263                                   (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     269    unsigned int*       tty_address = (unsigned int*) &seg_tty_base;
    264270
    265271    for (nwritten = 0; nwritten < length; nwritten++)
     
    322328
    323329    // compute terminal base address
    324     unsigned int *tty_address = (unsigned int*)( (char*)&seg_tty_base +
    325                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     330    unsigned int *tty_address = (unsigned int*) &seg_tty_base;
    326331
    327332    *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ];
     
    355360    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base +
    356361                                (cluster_id * (unsigned)CLUSTER_SIZE) );
    357 #if GIET_USE_XICU
     362#if USE_XICU
    358363    if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
    359364    else            icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value;
     
    381386    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base +
    382387                                (cluster_id * (unsigned)CLUSTER_SIZE) );
    383 #if GIET_USE_XICU
     388#if USE_XICU
    384389    unsigned int prio   = icu_address[XICU_REG(XICU_PRIO, proc_id)];
    385390    unsigned int pti_ok = (prio & 0x00000001);
     
    420425        return 1;
    421426
    422     unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base +
    423                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     427    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
    424428
    425429    gcd_address[register_index] = value; // write word
     
    438442        return 1;
    439443
    440     unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base +
    441                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     444    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
    442445
    443446    *buffer = gcd_address[register_index]; // read word
     
    530533    if ( (unsigned int)user_vaddr & 0x3 ) return 1;
    531534
    532     unsigned int*       ioc_address = (unsigned int*)( (char*)&seg_ioc_base +
    533                                   (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     535    unsigned int*       ioc_address = (unsigned int*) &seg_ioc_base ;
    534536
    535537    unsigned int        block_size   = ioc_address[BLOCK_DEVICE_BLOCK_SIZE];
     
    561563        if ( ix2 == 0 ) ppn_first = ppn;
    562564
    563         if ( GIET_IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
     565        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
    564566        {
    565567            // check buffer length < 2 Mbytes
     
    588590
    589591    // compute buffer base address for IOC depending on IOMMU activation
    590     if ( GIET_IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
     592    if ( IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
    591593    else                     addr = (ppn_first << 12) | (user_vaddr & 0xFFF);
    592594
     
    622624
    623625    // unmap the buffer from IOMMU page table if IOMMU is activated
    624     if ( GIET_IOMMU_ACTIVE )
    625     {
    626         unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base +
    627                                     (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     626    if ( IOMMU_ACTIVE )
     627    {
     628        unsigned int* iob_address = (unsigned int*) &seg_iob_base;
    628629
    629630        for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ )
     
    691692{
    692693    // get IOC base address
    693     unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base +
    694                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     694    unsigned int* ioc_address = (unsigned int*) &seg_ioc_base;
    695695
    696696    *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ
     
    891891
    892892    // compute frame buffer pbase address
    893     unsigned int fb_vaddr = (unsigned int)&seg_fbf_base +
    894                             (CLUSTER_IO_ID * (unsigned int)CLUSTER_SIZE) + offset;
     893    unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + offset;
    895894
    896895    ko = _v2p_translate( (page_table_t*)user_ptab,
     
    962961        if ( ix2 == 0 ) ppn_first = ppn;
    963962
    964         if ( GIET_IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
     963        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
    965964        {
    966965            // check buffer length < 2 Mbytes
     
    10711070   
    10721071    // unmap the buffer from IOMMU page table if IOMMU is activated
    1073     if ( GIET_IOMMU_ACTIVE )
    1074     {
    1075         unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base +
    1076                                     (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     1072    if ( IOMMU_ACTIVE )
     1073    {
     1074        unsigned int* iob_address = (unsigned int*) &seg_iob_base;
    10771075
    10781076        unsigned int  ix1         = _dma_iommu_ix1 + dma_id;
  • soft/giet_vm/sys/irq_handler.c

    r213 r215  
    1818#include <ctx_handler.h>
    1919#include <hwr_mapping.h>
     20
     21#if NB_TIMERS_MAX
     22extern volatile unsigned char _user_timer_event[NB_CLUSTERS*NB_TIMERS_MAX] ;
     23#endif
    2024
    2125///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/kernel_init.c

    r207 r215  
    4848unsigned int                    _idle_stack[NB_CLUSTERS*NB_PROCS_MAX*64];
    4949
     50void _sys_exit()
     51{
     52    while(1);
     53}
     54
    5055//////////////////////////////////////////////////////////////////////////////////
    5156// This function is the entry point for the last step of the boot sequence.
     
    127132    unsigned int pti_mask = 0;
    128133
     134    unsigned int isr_switch_channel = 0xFFFFFFFF;
     135
    129136    for ( irq_id = 0 ; irq_id < 32 ; irq_id++ )
    130137    {
     
    136143             hwi_mask = hwi_mask | 0x1<< irq_id;
    137144        }
    138         else if ( (isr == ISR_SWITCH) || (isr == ISR_TIMER) )
     145        else if ( (isr == ISR_SWITCH) )
    139146        {
     147            pti_mask = pti_mask | 0x1<< irq_id;
     148            isr_switch_channel = irq_id;
     149        }
     150        else if ( (isr == ISR_TIMER) )
     151        {
    140152            pti_mask = pti_mask | 0x1<< irq_id;
    141153        }
     
    159171    if ( tasks > 1 )
    160172    {
     173        if(isr_switch_channel == 0xFFFFFFFF)
     174        {
     175            _puts("\n[GIET ERROR] ISR_SWITCH not found on proc ");
     176            _putd( proc_id);
     177            _puts("\n");
     178            _sys_exit();
     179        }
    161180        _timer_start( cluster_id,
    162                       proc_id,
     181                      isr_switch_channel,
    163182                      GIET_TICK_VALUE );
    164183       
  • soft/giet_vm/sys/sys_handler.c

    r207 r215  
    139139}
    140140
    141 /////////////////////////////////////////////////////////////////////////////
    142 // _vobj_get_vbase()
    143 // This function writes in vobj_buffer the virtual base address of a vobj
    144 // identified by the (vspace_name / vobj_name ) couple.
    145 // The vobj_type argument is redundant, and for checking purpose.
    146 // returns 0: success, else: failed.
    147 /////////////////////////////////////////////////////////////////////////////
    148 unsigned int _vobj_get_vbase( char*                     vspace_name,
    149                               char*                     vobj_name,
    150                               unsigned int      vobj_type,
    151                               unsigned int* vobj_vaddr )
     141int _get_vobj( char* vspace_name, char* vobj_name, unsigned int vobj_type, mapping_vobj_t** res_vobj)
    152142{
    153143    mapping_header_t* header = (mapping_header_t*)&seg_mapping_base;
     
    175165                        return -1;                                                      //wrong type
    176166
    177                     *vobj_vaddr = (unsigned int)vobj[vobj_id].vaddr;
     167                    *res_vobj = &vobj[vobj_id];
     168
    178169                    return 0;
    179170                }
     
    182173    }
    183174    return -2;          //not found
    184 }
    185 
     175
     176}
     177/////////////////////////////////////////////////////////////////////////////
     178// _vobj_get_vbase()
     179// This function writes in vobj_vaddr the virtual base address of a vobj
     180// identified by the (vspace_name / vobj_name ) couple.
     181// The vobj_type argument is here only for the purpose of checking .
     182// returns 0: success, else: failed.
     183/////////////////////////////////////////////////////////////////////////////
     184unsigned int _vobj_get_vbase( char*                     vspace_name,
     185                              char*                     vobj_name,
     186                              unsigned int      vobj_type,
     187                              unsigned int* vobj_vaddr )
     188{
     189    mapping_vobj_t*   res_vobj;
     190    unsigned int ret;
     191    if( (ret = _get_vobj(vspace_name, vobj_name, vobj_type, &res_vobj)) )
     192    {
     193        return ret;
     194    }
     195   
     196    *vobj_vaddr = res_vobj->vaddr;
     197
     198    return 0;
     199}
     200
     201/////////////////////////////////////////////////////////////////////////////
     202// _vobj_get_length()
     203// This function writes in vobj_length the virtual base address of a vobj
     204// identified by the (vspace_name / vobj_name ) couple.
     205// The vobj_type argument is here only for the purpose of checking .
     206// returns 0: success, else: failed.
     207/////////////////////////////////////////////////////////////////////////////
     208unsigned int _vobj_get_length(char*                     vspace_name,
     209                              char*                     vobj_name,
     210                              unsigned int      vobj_type,
     211                              unsigned int* vobj_length )
     212{
     213
     214    mapping_vobj_t*   res_vobj;
     215    unsigned int ret;
     216    if( (ret = _get_vobj(vspace_name, vobj_name, vobj_type, &res_vobj)) )
     217    {
     218        return ret;
     219    }
     220   
     221    *vobj_length = res_vobj->length;
     222
     223    return 0;
     224}
Note: See TracChangeset for help on using the changeset viewer.