Ignore:
Timestamp:
Mar 3, 2014, 5:11:06 PM (10 years ago)
Author:
cfuguet
Message:

Introducing a RAMDISK driver in the preloader.

When using RAMDISK, execute the make command with the flags
SOCLIB=1 and RAMDISK=1. The RDK_PADDR_BASE variable must
also be set on the conf/<platform>/defs_platform.h

These modifications are backward compatibles. Therefore,
when no using RAMDISK, none modifications applied on the
platform configuration file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/tsar_boot/src/reset_utils.c

    r586 r653  
    99#include <reset_utils.h>
    1010
    11 /*****************************************
     11/********************************************************************
    1212 * proctime()
    1313 *
    1414 * Returns processor local time.
    15  ****************************************/
     15 ********************************************************************/
    1616inline unsigned int proctime()
    1717{
     
    2121}
    2222
    23 /*****************************************
     23/********************************************************************
    2424 * memcpy( _dst, _src, size )
    2525 *
     
    3030 * \param size   : Number of bytes to transfer
    3131 *
    32  ****************************************/
     32 ********************************************************************/
    3333void * memcpy(void *_dst, const void *_src, unsigned int size)
    3434{
     
    5252}
    5353
    54 /*****************************************
     54/********************************************************************
    5555 * memset( _dst, value, size )
    5656 *
     
    6161 * \param size   : Number of bytes to initialize
    6262 *
    63  ****************************************/
     63 ********************************************************************/
    6464void * memset(void *_dst, const int value, unsigned int size)
    6565{
     
    7171}
    7272
    73 /*****************************************
     73/********************************************************************
    7474 * reset_print_elf_phdr( elf_phdr_ptr )
    7575 *
     
    7878 * \param elf_phdr_ptr : Pointer to the ELF program header to print
    7979 *
    80  ****************************************/
     80 ********************************************************************/
    8181void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr)
    8282{
     
    106106}
    107107
     108
     109/********************************************************************
     110 * reset_mcc_inval()
     111 *
     112 * Invalidate all data cache lines corresponding to a memory buffer
     113 * (identified by an address and a size) in L2 cache.
     114 ********************************************************************/
     115#if USE_IOB
     116void reset_mcc_invalidate ( const void * buffer,
     117                            unsigned int size)
     118{
     119    unsigned int * mcc_address = (unsigned int *)MCC_PADDR_BASE;
     120
     121    // get the hard lock assuring exclusive access to MEMC
     122    while (ioread32(&mcc_address[MCC_LOCK]));
     123
     124    // write invalidate paremeters on the memory cache this preloader
     125    // use only the cluster 0 and then the HI bits are not used
     126   
     127    iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer);
     128    iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0);
     129    iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size);
     130    iowrite32(&mcc_address[MCC_CMD]    , (unsigned int) MCC_CMD_INVAL);
     131
     132    // release the lock protecting MEMC
     133    iowrite32(&mcc_address[MCC_LOCK], (unsigned int) 0);
     134}
     135#endif
     136
     137/********************************************************************
     138 * reset_dcache_buf_invalidate()
     139 *
     140 * Invalidate all data cache lines corresponding to a memory buffer
     141 * (identified by an address and a size) in L1 cache and L2 cache.
     142 ********************************************************************/
     143#if (CACHE_COHERENCE == 0) || USE_IOB
     144void reset_buf_invalidate ( const void * buffer,
     145                            unsigned int line_size,
     146                            unsigned int size)
     147{
     148    unsigned int i;
     149
     150    // iterate on cache lines
     151    for (i = 0; i <= size; i += line_size)
     152    {
     153        asm volatile(
     154            " cache %0, %1"
     155            :// no outputs
     156            :"i" (0x11), "R" (*((unsigned char *) buffer + i))
     157            );
     158    }
     159
     160#if USE_IOB
     161    reset_mcc_invalidate(buffer, count * 512);
     162#endif
     163}
     164#endif
     165
    108166// vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracChangeset for help on using the changeset viewer.