Changeset 249 for soft/giet_vm/sys


Ignore:
Timestamp:
Jul 18, 2013, 6:33:38 PM (11 years ago)
Author:
alain
Message:

Various modifications to support IO Bridge,
and MEMC configuration interface.

Location:
soft/giet_vm/sys
Files:
4 edited

Legend:

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

    r238 r249  
    2828extern _ld_symbol_t seg_fbf_base;
    2929extern _ld_symbol_t seg_ioc_base;
     30extern _ld_symbol_t seg_mmc_base;
     31
    3032extern _ld_symbol_t seg_mapping_base;
    3133extern _ld_symbol_t seg_kernel_pt_base;
  • soft/giet_vm/sys/drivers.c

    r246 r249  
    4141// - seg_cma_base
    4242// - seg_iob_base
     43// - seg_mmc_base
    4344//
    4445///////////////////////////////////////////////////////////////////////////////////
     
    5758#endif
    5859
     60#if (NB_CLUSTERS > 256)
     61# error: NB_CLUSTERS cannot be larger than 256!
     62#endif
     63
    5964#if !defined(NB_PROCS_MAX)
    6065# error: You must define NB_PROCS_MAX in the hard_config.h file
     
    6974#endif
    7075
     76#if !defined(GIET_USE_IOMMU)
     77# error: You must define GIET_USE_IOMMU in the giet_config.h file
     78#endif
     79
    7180#if !defined(NB_TTY_CHANNELS)
    7281# error: You must define NB_TTY_CHANNELS in the hard_config.h file
     
    121130#endif
    122131
    123 #if !defined( IOMMU_ACTIVE )
    124 # error: You must define IOMMU_ACTIVE in the hard_config.h file
     132#if !defined( USE_IOB )
     133# error: You must define USE_IOB in the hard_config.h file
    125134#endif
    126135
     
    314323
    315324    _get_lock(&_tty_put_lock);
    316     if (tty_id == 0xFFFFFFFF) {
    317         _puts("\n[GIET ERROR] no TTY assigned to the task ");
    318     }
    319     else {
    320         _puts("\n[GIET ERROR] TTY index too large for task ");
    321     }
     325    if (tty_id == 0xFFFFFFFF) _puts("\n[GIET ERROR] no TTY assigned to the task ");
     326    else                      _puts("\n[GIET ERROR] TTY index too large for task ");
    322327    _putd(task_id);
    323328    _puts(" on processor ");
     
    671676        if (ix2 == 0) ppn_first = ppn;
    672677
    673         if (IOMMU_ACTIVE) // the user buffer must be remapped in the I/0 space
     678        if ( GIET_USE_IOMMU && USE_IOB ) // user buffer remapped in the I/0 space
    674679        {
    675680            // check buffer length < 2 Mbytes
     
    710715    _ioc_iommu_npages = (user_vpn_max - user_vpn_min) + 1;
    711716
    712     // invalidate data cache in case of memory write
     717    // invalidate local data cache in case of memory write
    713718    if (to_mem) _dcache_buf_invalidate((void *) user_vaddr, length);
    714719
     
    737742#endif
    738743
     744    // Invalidate L2 cache if IO Bridge is used
     745    if ( to_mem && USE_IOB ) _memc_inval( buf_paddr, length );
     746   
    739747    // get the lock on ioc device
    740748    _get_lock(&_ioc_lock);
    741749
    742750    // peripheral configuration 
    743     if ( IOMMU_ACTIVE )
     751    if ( GIET_USE_IOMMU && USE_IOB )
    744752    {
    745753        ioc_address[BLOCK_DEVICE_BUFFER] = buf_xaddr;
     
    791799
    792800    // unmap the buffer from IOMMU page table if IOMMU is activated
    793     if (IOMMU_ACTIVE)
     801    if ( GIET_USE_IOMMU && USE_IOB )
    794802    {
    795803        unsigned int * iob_address = (unsigned int *) &seg_iob_base;
     
    11071115    if ( ix2 == 0 ) ppn_first = ppn;
    11081116
    1109     if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
     1117    if ( GIET_USE_IOMMU && USE_IOB )    // user buffer remapped in the I/0 space
    11101118    {
    11111119    // check buffer length < 2 Mbytes
     
    14441452}
    14451453
     1454//////////////////////////////////////////////////////////////////////////////////
     1455//     VciMemCache driver
     1456//////////////////////////////////////////////////////////////////////////////////
     1457// The VciMemCache device can be accessed through a configuration interface.
     1458// as a set of uncached, memory mapped registers.
     1459///////////////////////////////////////////////////////////////////////////////////
     1460
     1461///////////////////////////////////////////////////////////////////////////////////
     1462// _memc_inval()
     1463// This function invalidate all cache lines covering a memory buffer defined
     1464// by the physical base address, and the length.
     1465// The buffer address MSB are used to compute the cluster index.
     1466///////////////////////////////////////////////////////////////////////////////////
     1467void _memc_inval( paddr_t      buf_paddr,
     1468                  unsigned int buf_length )
     1469{
     1470    unsigned int cluster_id    = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS));
     1471
     1472    unsigned int * mmc_address = (unsigned int *) ((char *) &seg_mmc_base +
     1473                                                   (cluster_id * GIET_CLUSTER_INCREMENT));
     1474
     1475    // get the lock protecting exclusive access to MEMC
     1476    while ( mmc_address[MEMC_LOCK] ) { asm volatile("nop"); }
     1477
     1478    // write inval arguments
     1479    mmc_address[MEMC_ADDR_LO]    = (unsigned int)buf_paddr;
     1480    mmc_address[MEMC_ADDR_HI]    = (unsigned int)(buf_paddr>>32);
     1481    mmc_address[MEMC_BUF_LENGTH] = buf_length;
     1482    mmc_address[MEMC_CMD_TYPE]   = MEMC_CMD_INVAL;
     1483
     1484    // release the lock protecting MEMC
     1485    mmc_address[MEMC_LOCK] = 0;
     1486}
    14461487///////////////////////////////////////////////////////////////////////////////////
    14471488// _heap_info()
  • soft/giet_vm/sys/drivers.h

    r246 r249  
    88#ifndef _GIET_SYS_DRIVERS_H_
    99#define _GIET_SYS_DRIVERS_H_
    10 
    1110
    1211///////////////////////////////////////////////////////////////////////////////////
     
    113112unsigned int _gcd_read( unsigned int register_index, unsigned int * buffer);
    114113
     114///////////////////////////////////////////////////////////////////////////////////
     115// MEMC access functions
     116///////////////////////////////////////////////////////////////////////////////////
     117
     118void _memc_inval( unsigned long long buf_paddr, unsigned int buf_length);
     119void _memc_sync(  unsigned long long buf_paddr, unsigned int buf_length);
    115120
    116121///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/vm_handler.c

    r246 r249  
    2929        unsigned int ix2,
    3030        unsigned int ppn,
    31         unsigned int flags) {
     31        unsigned int flags)
     32{
    3233    unsigned int ptba;
    3334    unsigned int * pt_ppn;
     
    3839
    3940    // get ptba and update PT2
    40     if ((pt->pt1[ix1] & PTE_V) == 0)
     41    if ((pt->pt1[ix1] & PTE_V) == 0) 
    4142    {
     43        _get_lock(&_tty_put_lock);
    4244        _puts("\n[GIET ERROR] in iommu_add_pte2 function\n");
    4345        _puts("the IOMMU PT1 entry is not mapped / ix1 = ");
    4446        _putx( ix1 );
    4547        _puts("\n");
     48        _release_lock(&_tty_put_lock);
    4649        _exit();
    4750    }
    48     else {
     51    else
     52    {
    4953        ptba = pt->pt1[ix1] << 12;
    5054        pt_flags = (unsigned int *) (ptba + 8 * ix2);
Note: See TracChangeset for help on using the changeset viewer.