Changeset 207


Ignore:
Timestamp:
Aug 16, 2012, 6:36:16 PM (12 years ago)
Author:
alain
Message:

Several bugs have been fixed to support TSAR multi-cluster architecture
such as the "tsarv4-generic_mmu" platform.

Location:
soft/giet_vm
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r206 r207  
    55DU=mipsel-unknown-elf-objdump
    66
    7 MAP_XML      = map.xml
     7MAP_XML      = 4c_1p_four.xml
    88
    99SYS_OBJS     = build/sys/vm_handler.o \
  • soft/giet_vm/boot/boot_init.c

    r205 r207  
    286286void boot_puts(const char *buffer)
    287287{
    288     unsigned int* tty_address = (unsigned int*)( (unsigned)&seg_tty_base +
    289                                      (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     288    unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base +
     289                                (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
    290290    unsigned int n;
    291291
     
    293293    {
    294294        if (buffer[n] == 0) break;
    295         tty_address[0] = (unsigned int)buffer[n];
     295        tty_address[TTY_WRITE] = (unsigned int)buffer[n];
    296296    }
    297    
    298297}
    299298////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/boot/reset.S

    r204 r207  
    6565    nop
    6666    mfc0        a0,     CP0_TIME
    67         jal             boot_putx
     67        jal             boot_putd
    6868        nop
    6969    la          a0,     boot_lf_string
     
    7676    mfc0        k0,     CP0_PROCID
    7777    andi        a0,     k0,     0xFFF
    78         jal             boot_putx
     78        jal             boot_putd
    7979    nop
    8080    la          a0,     boot_lf_string
  • soft/giet_vm/display/main.c

    r191 r207  
    88    unsigned char buf_in[128*128];
    99    unsigned char buf_out[128*128];
     10
    1011    unsigned int i;
    1112    unsigned int x;
     
    1415    while (base < 5 * NBLOCS)
    1516    {
    16 
    1717        giet_tty_printf("\n *** image %d *** at date = %d \n",
    1818                base / NBLOCS, giet_proctime());
     
    5050            giet_exit();
    5151        }
     52
    5253        x = giet_fb_completed();
    5354        if ( x )
  • soft/giet_vm/giet_config.h

    r204 r207  
    2525/* hardware parameters */
    2626
    27 #define NB_CLUSTERS             1                       /* number of clusters */
     27#define NB_CLUSTERS             4                       /* number of clusters */
    2828#define CLUSTER_SIZE            0x40000000      /* address increment between clusters */
    29 #define CLUSTER_IO_ID       0                   /* cluster containing non replicated peripherals */
     29#define CLUSTER_IO_ID       2                   /* cluster containing non replicated peripherals */
    3030       
    31 #define NB_PROCS_MAX        4                   /* max number of processors per cluster */
     31#define NB_PROCS_MAX        1                   /* max number of processors per cluster */
    3232#define NB_TIMERS_MAX           0                       /* max number of user timers per cluster */
    3333#define NB_DMAS_MAX                     1                       /* max number of DMA channels per cluster*/
    3434#define NB_TTYS                         8                       /* total number of TTY channels */
    35 #define NB_IOCS                         0                       /* total number of IOC channels */
    36 #define NB_NICS                         0                       /* total number of NIC channels */
     35#define NB_IOCS                         1                       /* total number of IOC channels */
     36#define NB_NICS                         8                       /* total number of NIC channels */
    3737
    3838/* software parameters */
  • soft/giet_vm/hello/main.c

    r199 r207  
    55        char                byte;
    66    unsigned int        proc = giet_procid();
    7     unsigned int*       illegal = 0xFFFFFFF0;
     7    unsigned int*       illegal = (unsigned int*)0xFFFFFFF0;
    88
    99        while (1)
  • soft/giet_vm/libs/mwmr_channel.c

    r200 r207  
    6262            :"$2", "$3", "$4");
    6363}
     64//////////////////////////////////////////////////////////////////////////////
     65//         nb_mwmr_write()
     66// This is a non-blocking function.
     67// The nitems parameter is the number of items to be transfered.
     68// The requested transfer is therefore (nitems * width) words.
     69// It takes the lock for exclusive access before testing the channel state.
     70// If there is not enough data in mwmr channel to read nitems,
     71// it reads as many items as possible, releases the lock, and returns
     72// the number of read items (it can be 0).
     73//////////////////////////////////////////////////////////////////////////////
     74unsigned int nb_mwmr_write( mwmr_channel_t*     mwmr,
     75                            unsigned int*               buffer,
     76                            unsigned int                nitems )
     77{
     78    unsigned int        x;
     79    unsigned int        spaces;         // number of empty slots (in words)
     80    unsigned int        nwords;         // requested transfer length (in words)
     81    unsigned int    depth;              // channel depth (in words)
     82    unsigned int    width;              // channel width (in words)
     83    unsigned int    sts;        // channel sts
     84    unsigned int    ptw;        // channel ptw
     85
     86    if(nitems == 0) return 0;
     87
     88    // get the lock
     89    mwmr_lock_acquire( &mwmr->lock );
     90
     91    // access fifo status
     92    depth  = mwmr->depth;
     93    width  = mwmr->width;
     94    sts    = mwmr->sts;
     95    ptw    = mwmr->ptw;
     96    spaces = depth - sts;
     97    nwords = width * nitems;
     98
     99    if( spaces >= nwords )      // transfer nitems, release lock and return
     100    {
     101        for ( x = 0 ; x < nwords ; x++ ) 
     102        {
     103            mwmr->data[ptw] = buffer[x];
     104            if ( (ptw + 1) == depth ) ptw = 0;
     105            else                      ptw = ptw + 1;
     106        }
     107        mwmr->sts  = mwmr->sts + nwords;
     108        mwmr->ptw  = ptw;
     109        mwmr->lock = 0;
     110        return nitems;
     111    }
     112   
     113    else if ( spaces < width )  // release lock and return
     114    {
     115        mwmr->lock = 0;
     116        return 0;
     117    }
     118    else        // transfer as many items as possible, release lock and return
     119    {
     120        nwords = (spaces/width) * width;        // integer number of items
     121        for ( x = 0 ; x < nwords ; x++ ) 
     122        {
     123            mwmr->data[ptw] = buffer[x];
     124            if ( (ptw + 1) == depth ) ptw = 0;
     125            else                      ptw = ptw + 1;
     126        }
     127        mwmr->sts  = sts + nwords;
     128        mwmr->ptw  = ptw;
     129        mwmr->lock = 0;
     130        return (nwords/width);
     131    }
     132} // end nb_mwmr_write()
    64133
    65134//////////////////////////////////////////////////////////////////////////////
     
    136205        for ( x = giet_rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
    137206    }
    138 }
     207} // end mwmr_write()
     208
     209//////////////////////////////////////////////////////////////////////////////
     210//         nb_mwmr_read()
     211// This is a non-blocking function.
     212// The nitems parameter is the number of items to be transfered.
     213// The requested transfer is therefore (nitems * width) words.
     214// It takes the lock for exclusive access before testing the channel state.
     215// If there is not enough data in mwmr channel to read nitems,
     216// it reads as many items as possible, releases the lock, and returns
     217// the number of read items (it can be 0).
     218//////////////////////////////////////////////////////////////////////////////
     219unsigned int nb_mwmr_read( mwmr_channel_t*      mwmr,
     220                           unsigned int*                buffer,
     221                           unsigned int                 nitems )
     222{
     223    unsigned int        x;
     224    unsigned int        nwords;         // requested transfer length (in words)
     225    unsigned int    depth;              // channel depth (in words)
     226    unsigned int    width;              // channel width (in words)
     227    unsigned int    sts;        // channel sts
     228    unsigned int    ptr;        // channel ptr
     229
     230    if(nitems == 0) return 0;
     231
     232    // get the lock
     233    mwmr_lock_acquire( &mwmr->lock );
     234
     235    // access fifo status
     236    depth  = mwmr->depth;
     237    width  = mwmr->width;
     238    sts    = mwmr->sts;
     239    ptr    = mwmr->ptr;
     240    nwords = width * nitems;
     241
     242    if( sts >= nwords )         // transfer nitems, release lock and return
     243    {
     244        for ( x = 0 ; x < nwords ; x++ ) 
     245        {
     246            buffer[x] = mwmr->data[ptr];
     247            if ( (ptr + 1) == depth ) ptr = 0;
     248            else                      ptr = ptr + 1;
     249        }
     250        mwmr->sts  = mwmr->sts - nwords;
     251        mwmr->ptr  = ptr;
     252        mwmr->lock = 0;
     253        return nitems;
     254    }
     255   
     256    else if ( sts < width )     // release lock and return
     257    {
     258        mwmr->lock = 0;
     259        return 0;
     260    }
     261    else        // transfer as many items as possible, release lock and return
     262    {
     263        nwords = (sts/width) * width;   // integer number of items
     264        for ( x = 0 ; x < nwords ; x++ ) 
     265        {
     266            buffer[x] = mwmr->data[ptr];
     267            if ( (ptr + 1) == depth ) ptr = 0;
     268            else                      ptr = ptr + 1;
     269        }
     270        mwmr->sts  = sts - nwords;
     271        mwmr->ptr  = ptr;
     272        mwmr->lock = 0;
     273        return (nwords/width);
     274    }
     275} // nb_mwmr_read()
    139276
    140277//////////////////////////////////////////////////////////////////////////////
     
    157294    unsigned int    width;              // channel width (in words)
    158295    unsigned int    sts;        // channel sts
    159     unsigned int    ptr;        // channel ptw
     296    unsigned int    ptr;        // channel ptr
    160297
    161298    if(nitems == 0) return;
     
    209346        for ( x = giet_rand()>>6 ; x > 0 ; x-- ) asm volatile ( "nop" );
    210347    }
    211 }
    212 
     348} // end mwmr_read()
     349
     350
  • soft/giet_vm/sys/common.c

    r199 r207  
    1313#include <ctx_handler.h>
    1414#include <drivers.h>
     15#include <hwr_mapping.h>
    1516#include <stdarg.h>
    1617
     
    153154////////////////////////////////////////////////////////////////////////////
    154155//    _puts()
    155 // display a string on TTY0 / used for system code debugand log
    156 ////////////////////////////////////////////////////////////////////////////
    157 void _puts(char *buffer)
    158 {
    159     unsigned int* tty_address = (unsigned int*)&seg_tty_base;
     156// display a string on TTY0 / used for system code debug and log
     157////////////////////////////////////////////////////////////////////////////
     158void _puts(char* buffer)
     159{
     160    unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base +
     161                                (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
    160162    unsigned int n;
    161163
     
    163165    {
    164166        if (buffer[n] == 0) break;
    165         tty_address[0] = (unsigned int)buffer[n];
     167        tty_address[TTY_WRITE] = (unsigned int)buffer[n];
    166168    }
    167169}
    168170////////////////////////////////////////////////////////////////////////////
    169 //    _putw()
     171//    _putx()
    170172// display an int (hexa) on TTY0 / used for system code debug and log
    171173////////////////////////////////////////////////////////////////////////////
    172 void _putw(unsigned int val)
     174void _putx(unsigned int val)
    173175{
    174176    static const char   HexaTab[] = "0123456789ABCDEF";
  • soft/giet_vm/sys/common.h

    r203 r207  
    3333
    3434void                            _puts(char *string);
    35 void                            _putw(unsigned int val);
     35void                            _putx(unsigned int val);
    3636void                            _putd(unsigned int val);
    3737
  • soft/giet_vm/sys/drivers.c

    r205 r207  
    231231    _get_lock(&_tty_put_lock);
    232232    _puts("\n[GIET ERROR] TTY index too large for task ");
    233     _putw( task_id );
     233    _putd( task_id );
    234234    _puts(" on processor ");
    235     _putw( proc_id );
     235    _putd( proc_id );
    236236    _puts("\n");
    237237    _release_lock(&_tty_put_lock);
     
    316316////////////////////////////////////////////////////////////////////////////////
    317317unsigned int _tty_get_char( unsigned int        tty_id,
    318                             char*           buffer )
     318                            unsigned char*  buffer )
    319319{
    320320    // checking argument
     
    731731//////////////////////////////////////////////////////////////////////////////////
    732732unsigned int _dma_reset_irq( unsigned int       cluster_id,
    733                              unsigned int       local_id )
     733                             unsigned int       channel_id )
    734734{
    735735    // parameters checking
    736736    if ( cluster_id >= NB_CLUSTERS ) return 1;
    737     if ( local_id >= NB_DMAS_MAX )  return 1;
     737    if ( channel_id >= NB_DMAS_MAX ) return 1;
    738738
    739739    // compute DMA base address
     
    741741                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
    742742
    743     dma_address[local_id*DMA_SPAN + DMA_RESET] = 0;                     
     743    dma_address[channel_id*DMA_SPAN + DMA_RESET] = 0;                   
    744744    return 0;
    745745}
     
    748748//////////////////////////////////////////////////////////////////////////////////
    749749unsigned int _dma_get_status( unsigned int      cluster_id,
    750                               unsigned int      local_id,
     750                              unsigned int      channel_id,
    751751                              unsigned int* status )
    752752{
    753753    // parameters checking
    754754    if ( cluster_id >= NB_CLUSTERS ) return 1;
    755     if ( local_id >= NB_DMAS_MAX )  return 1;
     755    if ( channel_id >= NB_DMAS_MAX ) return 1;
    756756
    757757    // compute DMA base address
    758758    unsigned int*       dma_address = (unsigned int*)( (char*)&seg_dma_base +
    759759                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
    760    
    761     *status = dma_address[local_id*DMA_SPAN + DMA_LEN];
     760
     761    *status = dma_address[channel_id*DMA_SPAN + DMA_LEN];
    762762    return 0;
    763763}
     
    839839// - user_vaddr : virtual base address of the memory buffer.
    840840// - length     : number of bytes to be transfered.
    841 // The memory buffer must be mapped in user address space and word-aligned.
     841// The user buffer must be mapped in user address space and word-aligned.
    842842// The user buffer length must be multiple of 4 bytes.
    843843// Me must compute the physical base addresses for both the frame buffer
    844844// and the user buffer before programming the DMA transfer.
    845 // The GIET being fully static, we don't need to split the transfer in 4Kbytes
     845// The GIET being fully static, we don't need to split the transfer in 4 Kbytes
    846846// pages, because the user buffer is contiguous in physical space.
    847847// Returns 0 if success, > 0 if error.
     
    871871    {
    872872        _get_lock(&_tty_put_lock);
    873         _puts("[GIET ERROR] in _fbdma_access() : user buffer not word aligned\n");
     873        _puts("\n[GIET ERROR] in _fbdma_access() : user buffer not word aligned\n");
    874874        _release_lock(&_tty_put_lock);
    875875        return 1;
     
    880880
    881881    // compute frame buffer pbase address
    882     unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + offset;
     882    unsigned int fb_vaddr = (unsigned int)&seg_fbf_base +
     883                            (CLUSTER_IO_ID * (unsigned int)CLUSTER_SIZE) + offset;
    883884
    884885    ko = _v2p_translate( (page_table_t*)user_ptab,
     
    891892    {
    892893        _get_lock(&_tty_put_lock);
    893         _puts("[GIET ERROR] in _fbdma_access() : frame buffer unmapped\n");
     894        _puts("\n[GIET ERROR] in _fbdma_access() : frame buffer unmapped\n");
    894895        _release_lock(&_tty_put_lock);
    895896        return 2;
     
    906907    {
    907908        _get_lock(&_tty_put_lock);
    908         _puts("[GIET ERROR] in _fbdma_access() : user buffer unmapped\n");
     909        _puts("\n[GIET ERROR] in _fbdma_access() : user buffer unmapped\n");
    909910        _release_lock(&_tty_put_lock);
    910911        return 3;
     
    920921    {
    921922        _get_lock(&_tty_put_lock);
    922         _puts("[GIET ERROR] in _fbdma_access() : user buffer not writable\n");
     923        _puts("\n[GIET ERROR] in _fbdma_access() : user buffer not writable\n");
    923924        _release_lock(&_tty_put_lock);
    924925        return 5;
  • soft/giet_vm/sys/drivers.h

    r204 r207  
    4141
    4242unsigned int _tty_get_char( unsigned int        tty_id,
    43                             char*                       buffer);
     43                            unsigned char*      buffer);
    4444
    4545///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/exc_handler.c

    r199 r207  
    7777    _puts( (char*)exc_type[type] );
    7878    _puts("\n - EPC       : ");
    79     _putw( _get_epc() );
     79    _putx( _get_epc() );
    8080    _puts("\n - BVAR      : ");
    81     _putw( _get_bvar() );
     81    _putx( _get_bvar() );
    8282    _puts("\n");
    8383
  • soft/giet_vm/sys/irq_handler.c

    r204 r207  
    8282// This ISR handles all IRQs generated by the multi-channels DMA controlers.
    8383// The multi_dma components can be distributed in the clusters.
    84 // The channel_id argument is the global DMA channel index.
    85 //     channel_id = cluster_id*NB_DMAS_MAX + loc_id
    86 // - The ISR saves the transfert status in _dma_status[channel_id].
     84// The channel_id argument is the local DMA channel index.
     85//     dma_global_id = cluster_id*NB_DMAS_MAX + channel_id
     86// - The ISR saves the transfert status in _dma_status[dma_global_id].
    8787// - It acknowledges the interrupt to reinitialize the DMA controler.
    88 // - it resets the synchronisation variable _dma_busy[channel_id].
     88// - it resets the synchronisation variable _dma_busy[dma_global_id].
    8989///////////////////////////////////////////////////////////////////////////////////
    9090void _isr_dma( unsigned int channel_id )
    9191{
    92     // compute cluster_id and loc_id
    93     unsigned int cluster_id = channel_id / NB_DMAS_MAX;
    94     unsigned int local_id   = channel_id % NB_DMAS_MAX;
     92    // compute cluster_id
     93    unsigned int cluster_id = _procid()/NB_PROCS_MAX;
     94
     95    // compute dma_global_id
     96    unsigned int dma_global_id = cluster_id*NB_DMAS_MAX + channel_id;
    9597
    9698    // save DMA channel status 
    97     if ( _dma_get_status(cluster_id, local_id, &_dma_status[channel_id]) )
     99    if ( _dma_get_status(cluster_id,
     100                         channel_id,
     101                         (unsigned int*)&_dma_status[dma_global_id] ) )
    98102    {
    99103        _get_lock(&_tty_put_lock);
     
    104108
    105109    // reset DMA channel irq
    106     if ( _dma_reset_irq(cluster_id, local_id) )
     110    if ( _dma_reset_irq( cluster_id,
     111                         channel_id) )
    107112    {
    108113        _get_lock(&_tty_put_lock);
     
    113118
    114119    // release DMA channel
    115     _dma_done[channel_id] = 1; 
     120    _dma_done[dma_global_id] = 1; 
    116121}
    117122
     
    125130{
    126131     // save status & reset IRQ
    127     if ( _ioc_get_status( &_ioc_status ) )
     132    if ( _ioc_get_status( (unsigned int*)&_ioc_status ) )
    128133    {
    129134        _get_lock(&_tty_put_lock);
     
    143148// These timers are distributed in all clusters, and can be implemented
    144149// in a vci_multi_timer component, or in a vci_xicu component.
    145 // The timer_id argument is a global index:
    146 //     timer_id = cluster_id*(NB_TIMERS_MAX+NB_PROCS_MAX) + local_id
    147 // The user timer local index is (loc_id - NB_PROCS_MAX).
    148 //
     150// The timer_id argument is the user timer local index.
     151//     timer_globa_id = cluster_id*(NB_TIMERS_MAX) + timer_id
    149152// The ISR acknowledges the IRQ and registers the event in the proper entry
    150153// of the _timer_event[] array, and a log message is displayed on kernel terminal.
     
    152155void _isr_timer(unsigned int timer_id)
    153156{
    154 
    155     unsigned int cluster_id = timer_id / (NB_TIMERS_MAX + NB_PROCS_MAX);
    156     unsigned int local_id   = timer_id % (NB_TIMERS_MAX + NB_PROCS_MAX);
    157 
    158     // checking timer type
    159     if (local_id < NB_PROCS_MAX )
    160     {
    161         _get_lock(&_tty_put_lock);
    162         _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n");
    163         _release_lock(&_tty_put_lock);
    164         return;
    165     }
     157    // compute cluster_id
     158    unsigned int cluster_id = _procid()/NB_PROCS_MAX;
    166159
    167160    // aknowledge IRQ
    168     if ( _timer_reset_irq( cluster_id, local_id ) )
     161    if ( _timer_reset_irq( cluster_id,
     162                           NB_PROCS_MAX + timer_id ) )
    169163    {
    170164        _get_lock(&_tty_put_lock);
     
    176170#if NB_TIMERS_MAX
    177171    // register the event
    178     _timer_event[(cluster_id*NB_TIMERS_MAX) + (loc_id - NB_PROCS_MAX)] = 1;
     172    unsigned int timer_global_id = cluster_id*NB_TIMERS_MAX + timer_id;
     173    _user_timer_event[timer_global_id] = 1;
    179174#endif
    180175
    181176    // display a message on TTY 0
    182177    _get_lock(&_tty_put_lock);
    183     _puts("[GIET] User Timer IRQ at cycle ");
     178    _puts("\n[GIET] User Timer IRQ at cycle ");
    184179    _putd( _proctime() );
    185     _puts(" / index = ");
    186     _putd(timer_id);
     180    _puts("\n - cluster_id = ");
     181    _putd( cluster_id );
     182    _puts("\n - timer_id   = ");
     183    _putd( timer_id );
    187184    _puts("\n");
    188185    _release_lock(&_tty_put_lock);
     
    194191// signaling that a character is available.
    195192// There is one single multi_tty component controling all TTYs,
    196 // and the tty_id // argument is the global TTY index.
     193// and the tty_id argument is the global TTY index.
    197194// There is one communication buffer _tty_buf[tty_id] per terminal.
    198195// The sychronisation variable _tty_full[tty_id], is set by the ISR,
     
    203200{
    204201    // save character and reset IRQ
    205     if ( _tty_get_char( tty_id, &_tty_get_buf[tty_id] ) )
     202    if ( _tty_get_char( tty_id,
     203                        (unsigned char*)&_tty_get_buf[tty_id] ) )
    206204    {
    207205        _get_lock(&_tty_put_lock);
  • soft/giet_vm/sys/kernel_init.c

    r203 r207  
    5454{
    5555    // compute cluster and local processor index
    56     unsigned int        proc_id    = _procid();
    57     unsigned int    cluster_id = proc_id / NB_PROCS_MAX;
    58     unsigned int    lpid       = proc_id % NB_PROCS_MAX;
     56    unsigned int        global_pid = _procid();
     57    unsigned int    cluster_id = global_pid / NB_PROCS_MAX;
     58    unsigned int    proc_id    = global_pid % NB_PROCS_MAX;
     59
     60    // Step 0 : Compute number of tasks allocated to proc
     61
     62    unsigned int tasks = _get_tasks_number();
     63
     64#if GIET_DEBUG_INIT
     65_get_lock(&_tty_put_lock);
     66_puts("\n[GIET DEBUG] step 0 for processor ");
     67_putd( global_pid );
     68_puts(" : tasks = ");
     69_putd( tasks );
     70_puts("\n");
     71_release_lock(&_tty_put_lock);
     72#endif
    5973
    6074    // step 1 : Initialise scheduler physical addresses array
    61 
    62     // get scheduler physical address from register
     75    //          get scheduler physical address (from CP0 register)
     76
    6377    static_scheduler_t*         psched = (static_scheduler_t*)_get_sched();
    64     _schedulers_paddr[proc_id]     = psched;
     78    _schedulers_paddr[global_pid]  = psched;
    6579
    6680#if GIET_DEBUG_INIT
    6781_get_lock(&_tty_put_lock);
    6882_puts("\n[GIET DEBUG] step 1 for processor ");
    69 _putd( proc_id );
     83_putd( global_pid );
    7084_puts(" / scheduler pbase = ");
    71 _putw( (unsigned int)psched );
    72 _puts("\n");
    73 _release_lock(&_tty_put_lock);
    74 #endif
    75 
     85_putx( (unsigned int)psched );
     86_puts("\n");
     87_release_lock(&_tty_put_lock);
     88#endif
    7689
    7790    // step 2 : initialise page table addresse arrays
     
    8093
    8194    unsigned int ltid;
    82     unsigned int tasks = _get_tasks_number();
    8395
    8496    for ( ltid = 0 ; ltid < tasks ; ltid++ )
     
    94106_get_lock(&_tty_put_lock);
    95107_puts("\n[GIET DEBUG] step 2 for processor ");
    96 _putd( proc_id );
     108_putd( global_pid );
    97109_puts(" / vspace ");
    98110_putd( vspace_id );
    99111_puts("\n- ptab vbase = ");
    100 _putw( ptab_vaddr );
     112_putx( ptab_vaddr );
    101113_puts("\n- ptab pbase = ");
    102 _putw( ptab_paddr );
     114_putx( ptab_paddr );
    103115_puts("\n");
    104116_release_lock(&_tty_put_lock);
     
    129141        }
    130142    }
    131     _icu_set_mask( cluster_id, lpid, hwi_mask, 0 ); // set HWI_MASK
    132     _icu_set_mask( cluster_id, lpid, pti_mask, 1 );     // set PTI_MASK
     143    _icu_set_mask( cluster_id, proc_id, hwi_mask, 0 ); // set HWI_MASK
     144    _icu_set_mask( cluster_id, proc_id, pti_mask, 1 );  // set PTI_MASK
    133145   
    134146#if GIET_DEBUG_INIT
    135147_get_lock(&_tty_put_lock);
    136148_puts("\n[GIET DEBUG] step 3 for processor ");
    137 _putd( proc_id );
     149_putd( global_pid );
    138150_puts("\n - ICU HWI_MASK = ");
    139 _putw( hwi_mask );
     151_putx( hwi_mask );
    140152_puts("\n - ICU PTI_MASK = ");
    141 _putw( pti_mask );
    142 _puts("\n");
    143 _release_lock(&_tty_put_lock);
    144 #endif
    145 
     153_putx( pti_mask );
     154_puts("\n");
     155_release_lock(&_tty_put_lock);
     156#endif
    146157
    147158    // step 4 : start TICK timer if more than one task
     
    155166_get_lock(&_tty_put_lock);
    156167_puts("\n[GIET DEBUG] Step 4 for processor ");
    157 _putd( proc_id );
     168_putd( global_pid );
    158169_puts(" / context switch activated\n");
    159170_release_lock(&_tty_put_lock);
     
    169180    _set_context_slot( IDLE_TASK_INDEX, CTX_RUN_ID,  1 );
    170181    _set_context_slot( IDLE_TASK_INDEX, CTX_SR_ID,   0xFF03 );
    171     _set_context_slot( IDLE_TASK_INDEX, CTX_SP_ID,   (unsigned int)&_idle_stack[proc_id] + 64 );
     182    _set_context_slot( IDLE_TASK_INDEX, CTX_SP_ID,   (unsigned int)&_idle_stack[global_pid] + 64 );
    172183    _set_context_slot( IDLE_TASK_INDEX, CTX_RA_ID,   (unsigned int)&_ctx_eret );
    173184    _set_context_slot( IDLE_TASK_INDEX, CTX_EPC_ID,  (unsigned int)&_ctx_idle );
     
    178189_get_lock(&_tty_put_lock);
    179190_puts("\n[GIET DEBUG] Step 5 for processor ");
    180 _putd( proc_id );
     191_putd( global_pid );
    181192_puts(" / idle task context set\n");
    182193_release_lock(&_tty_put_lock);
     
    195206        _get_lock( &_tty_put_lock );
    196207        _puts("\n [GIET WARNING] No task allocated to processor ");
    197         _putw( proc_id );
     208        _putd( global_pid );
    198209        _puts(" => idle\n");
    199210        _release_lock ( &_tty_put_lock );
     
    212223_get_lock(&_tty_put_lock);
    213224_puts("\n[GIET DEBUG] step 6 for processor ");
    214 _putd( proc_id );
     225_putd( global_pid );
    215226_puts(" / registers initialised \n");
    216227_puts("- sp   = ");
    217 _putw( sp_value );
     228_putx( sp_value );
    218229_puts("\n");
    219230_puts("- sr   = ");
    220 _putw( sr_value );
     231_putx( sr_value );
    221232_puts("\n");
    222233_puts("- ptpr = ");
    223 _putw( ptpr_value<<13 );
     234_putx( ptpr_value<<13 );
    224235_puts("\n");
    225236_puts("- epc  = ");
    226 _putw( epc_value );
     237_putx( epc_value );
    227238_puts("\n");
    228239_release_lock(&_tty_put_lock);
  • soft/giet_vm/sys/sys_handler.c

    r204 r207  
    6666    _puts("\n\n!!! Undefined System Call !!!\n");
    6767    _puts("\nEPC = ");
    68     _putw( epc );
     68    _putx( epc );
    6969    _exit();
    7070}
  • soft/giet_vm/sys/vm_handler.c

    r189 r207  
    4545        _puts("\n[GIET ERROR] in iommu_add_pte2 function\n");
    4646        _puts("the IOMMU PT1 entry is not mapped / ix1 = ");
    47         _putw( ix1 );
     47        _putx( ix1 );
    4848        _puts("\n");
    4949        _exit();
     
    7676        _puts("\n[GIET ERROR] in iommu_inval_pte2 function\n");
    7777        _puts("the IOMMU PT1 entry is not mapped / ix1 = ");
    78         _putw( ix1 );
     78        _putx( ix1 );
    7979        _puts("\n");
    8080        _exit();
     
    105105    unsigned int    ix1 = vpn >> 9;
    106106    unsigned int    ix2 = vpn & 0x1FF;
    107 
     107/*
     108_puts("\n\n********************** entering v2p_translate");
     109_puts("\n - pt    = ");
     110_putx( (unsigned int)pt );
     111_puts("\n - vpn   = ");
     112_putx( vpn << 12 );
     113_puts("\n - ptba  = ");
     114_putx( pt->pt1[ix1] << 12 ) ;
     115_puts("\n - &pte2 = ");
     116_putx( (pt->pt1[ix1] << 12) + 8*ix2 );
     117_puts("\n - flags = ");
     118_putx( *(unsigned int*)((pt->pt1[ix1] << 12) + 8*ix2) );
     119_puts("\n");
     120*/
    108121    // check PTE1 mapping
    109122    if ( (pt->pt1[ix1] & PTE_V) == 0 )
Note: See TracChangeset for help on using the changeset viewer.