Ignore:
Timestamp:
Mar 28, 2014, 10:48:51 AM (10 years ago)
Author:
alain
Message:

Bug fix in both _tty_rx_isr() and _bdv_isr():
The ISR must do nothing it the status indicates that
there is no pending ISR.

Location:
soft/giet_vm/giet_drivers
Files:
6 edited

Legend:

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

    r295 r297  
    304304    unsigned int lpid       = procid % NB_PROCS_MAX;
    305305
    306     // acknowledge WTI in local XCU if required
    307     unsigned int value;
    308     if ( irq_type == IRQ_TYPE_WTI ) _xcu_get_wti_value( cluster_xy, irq_id, &value );
    309 
    310     // save status in _bdv_status variable and reset IRQ
    311     _bdv_status = _bdv_get_register( BLOCK_DEVICE_STATUS );
     306    // get BDV status (and reset IRQ)
     307    unsigned int status =  _bdv_get_register( BLOCK_DEVICE_STATUS );
     308
     309    // check status: does nothing if IDLE or BUSY
     310    if ( (status == BLOCK_DEVICE_IDLE) ||
     311         (status == BLOCK_DEVICE_BUSY) )   return;
     312 
     313    // reset WTI in XCU if WTI type
     314    if ( irq_type == IRQ_TYPE_WTI )
     315    {
     316        unsigned int value;
     317        _xcu_get_wti_value( cluster_xy, irq_id, &value );
     318    }
     319   
     320    // save status in kernel buffer _bdv_status
     321    _bdv_status = status;
    312322
    313323    // identify task waiting on BDV
     
    315325    unsigned int ltid       = _bdv_gtid & 0xFFFF;
    316326    unsigned int remote_xy  = rprocid / NB_PROCS_MAX;
     327
     328    // re-activates sleeping task
     329    _set_task_slot( rprocid,     // global processor index
     330                    ltid,        // local task index on processor
     331                    CTX_RUN_ID,  // CTX_RUN slot
     332                    1 );         // running
     333
     334    // requires a context switch for remote processor running the waiting task
     335    _xcu_send_wti( remote_xy,    // cluster index
     336                   lpid,         // local processor index
     337                   0 );          // don't force context switch if not idle
    317338
    318339#if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
     
    343364#endif
    344365
    345     // re-activates sleeping task
    346     _set_task_slot( rprocid,     // global processor index
    347                     ltid,        // local task index on processor
    348                     CTX_RUN_ID,  // CTX_RUN slot
    349                     1 );         // running
    350 
    351     // requires a context switch for remote processor running the waiting task
    352     _xcu_send_wti( remote_xy,    // cluster index
    353                    lpid,         // local processor index
    354                    0 );          // don't force context switch if not idle
    355366}
    356367
  • soft/giet_vm/giet_drivers/fbf_driver.c

    r295 r297  
    258258    {
    259259        // SYNC request for channel descriptor
    260         _memc_sync( desc_paddr, 32 );
     260        _mmc_sync( desc_paddr, 32 );
    261261    }
    262262
     
    320320        {
    321321            // INVAL L2 cache for the channel descriptor,
    322             _memc_inval( _fb_cma_desc_paddr[channel_id], 32 );
     322            _mmc_inval( _fb_cma_desc_paddr[channel_id], 32 );
    323323
    324324            // INVAL L1 cache for the channel descriptor,
     
    339339        // SYNC request for the user buffer because
    340340        // this buffer will be read from XRAM by the CMA component
    341         _memc_sync( buf_paddr, _fb_cma_channel[channel_id].length );
     341        _mmc_sync( buf_paddr, _fb_cma_channel[channel_id].length );
    342342    }
    343343
     
    356356        // SYNC request for the channel descriptor, because
    357357        // it will be read in XRAM by the CMA component
    358         _memc_sync( _fb_cma_desc_paddr[channel_id], 32 );
     358        _mmc_sync( _fb_cma_desc_paddr[channel_id], 32 );
    359359    }
    360360
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r295 r297  
    286286
    287287        // L2 cache (only if IOB used)
    288         if ( USE_IOB ) _memc_inval( buf_paddr, length );
     288        if ( USE_IOB ) _mmc_inval( buf_paddr, length );
    289289    }
    290290    else         // memory read : update data caches
     
    293293
    294294        // L2 cache (only if IOB used)
    295         if ( USE_IOB ) _memc_sync( buf_paddr, length );
     295        if ( USE_IOB ) _mmc_sync( buf_paddr, length );
    296296    }
    297297
  • soft/giet_vm/giet_drivers/mmc_driver.c

    r295 r297  
    4141
    4242///////////////////////////////////////////////////////////////////////////////////
    43 // _memc_inval()
    4443// This function invalidates all cache lines covering a memory buffer defined
    4544// by the physical base address, and the length.
    4645// The buffer address MSB are used to compute the cluster index.
    4746///////////////////////////////////////////////////////////////////////////////////
    48 void _memc_inval( paddr_t      buf_paddr,
    49                   unsigned int buf_length )
     47void _mmc_inval( paddr_t      buf_paddr,
     48                 unsigned int buf_length )
    5049{
    5150    // compute cluster coordinates
     
    7877}
    7978///////////////////////////////////////////////////////////////////////////////////
    80 // _memc_sync()
    8179// This function copies to external RAM all cache lines covering a memory buffer
    8280// defined by the physical base address, and the length, if they are dirty.
    8381// The buffer address MSB are used to compute the cluster index.
    8482///////////////////////////////////////////////////////////////////////////////////
    85 void _memc_sync( paddr_t      buf_paddr,
    86                  unsigned int buf_length )
     83void _mmc_sync( paddr_t      buf_paddr,
     84                unsigned int buf_length )
    8785{
    8886    // compute cluster coordinates
     
    115113}
    116114
     115//////////////////////////////////////////////////////////////////////////////////
     116// This ISR access the vci_mem_cache component to get the faulty physical
     117// address and the associated SRCID. It must also acknowledge the IRQ.
     118//
     119// TODO implement...
     120//////////////////////////////////////////////////////////////////////////////////
     121void _mmc_isr( unsigned int irq_type,  // should be HWI
     122               unsigned int irq_id,    // index returned by ICU
     123               unsigned int channel )  // unused
     124{
     125    _printf("[GIET ERROR] MMC IRQ received, but _mmc_isr() not implemented...\n");
     126}
     127
     128
     129
    117130// Local Variables:
    118131// tab-width: 4
  • soft/giet_vm/giet_drivers/mmc_driver.h

    r258 r297  
    3333///////////////////////////////////////////////////////////////////////////////////
    3434
    35 extern void _memc_inval( unsigned long long buf_paddr,
    36                          unsigned int buf_length );
     35extern void _mmc_inval( unsigned long long buf_paddr,
     36                        unsigned int buf_length );
    3737
    38 extern void _memc_sync(  unsigned long long buf_paddr,
    39                          unsigned int buf_length);
     38extern void _mmc_sync(  unsigned long long buf_paddr,
     39                        unsigned int buf_length);
     40
     41extern void _mmc_isr( unsigned int irq_type,
     42                      unsigned int irq_id,
     43                      unsigned int channel );
    4044
    4145///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/tty_driver.c

    r295 r297  
    170170
    171171///////////////////////////////////////////////////////////////////////////////////
    172 // This ISR handles the IRQ signaling that the RX buffer is full.
     172// This ISR handles the IRQ signaling that the RX buffer is not empty.
    173173// IT can be an HWI or an SWI.
    174 // There is one single multi_tty component controling all channels.
    175174// There is one communication buffer _tty_rx_buf[i] and one synchronisation
    176175// variable _tty_rx_full[i] per channel.
    177 // A character is lost if the buffer is full when the ISR is executed.
     176// Does nothing if the TTY_RX buffer is empty, or if the kernel buffer is full
     177// when the ISR is called.
    178178///////////////////////////////////////////////////////////////////////////////////
    179179void _tty_rx_isr( unsigned int irq_type,   // HWI / WTI
     
    183183    unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;
    184184
    185     if ( irq_type == IRQ_TYPE_WTI )   // reset SWI in XCU if required
     185    // get TTY status
     186    unsigned int status = _tty_get_register( channel, TTY_STATUS );
     187
     188    // check both TTY status and kernel buffer status:
     189    // does nothing if kernel buffer full or tty_buffer empty
     190    if ( ((status & 0x1) == 0) ||
     191         (_tty_rx_full[channel] != 0) )  return;
     192 
     193    // reset WTI in XCU if WTI type
     194    if ( irq_type == IRQ_TYPE_WTI )
    186195    {
    187196        unsigned int value;
    188197        _xcu_get_wti_value( cluster_xy, irq_id, &value );
    189198    }
    190      
    191     // get character and reset TTY IRQ
    192     _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ );
     199
     200    // transfer character to kernel buffer and acknowledge TTY IRQ
     201    _tty_rx_buf[channel]  = _tty_get_register( channel, TTY_READ );
     202
     203    // set kernel buffer status
     204    asm volatile( "sync" );
     205    _tty_rx_full[channel] = 1;
    193206
    194207#if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
     
    209222#endif
    210223
    211     // signals character available
    212     _tty_rx_full[channel] = 1;
    213224}
    214225
Note: See TracChangeset for help on using the changeset viewer.