Changeset 911 for trunk/softs


Ignore:
Timestamp:
Jan 2, 2015, 1:03:52 PM (10 years ago)
Author:
alain
Message:

The reset_buf_invalidate() function has been modified
to comply with the removing of the hard lock in the vci_mem_cache configuration interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/tsar_boot/drivers/reset_inval.c

    r758 r911  
    1717enum memc_registers
    1818{
    19     MCC_LOCK      = 0,
    20     MCC_ADDR_LO   = 1,
    21     MCC_ADDR_HI   = 2,
    22     MCC_LENGTH    = 3,
    23     MCC_CMD       = 4
     19    MCC_ADDR_LO   = 0,
     20    MCC_ADDR_HI   = 1,
     21    MCC_LENGTH    = 2,
     22    MCC_CMD       = 3
    2423};
    2524
     
    3332/**
    3433 * \brief Invalidate all data cache lines corresponding to a memory buffer
    35  *        (identified by an address and a size) in L2 cache.
    36  */
    37 void reset_mcc_invalidate (void* const buffer, size_t size)
    38 {
    39     // get the hard lock assuring exclusive access to MEMC
    40     while (ioread32(&mcc_address[MCC_LOCK]));
    41 
    42     // write invalidate paremeters on the memory cache this preloader
    43     // use only the cluster 0 and then the HI bits are not used
    44 
    45     iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer);
    46     iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0);
    47     iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size);
    48     iowrite32(&mcc_address[MCC_CMD]    , (unsigned int) MCC_CMD_INVAL);
    49 
    50     // release the lock protecting MEMC
    51     iowrite32(&mcc_address[MCC_LOCK], (unsigned int) 0);
    52 }
    53 
    54 /**
    55  * \brief Invalidate all data cache lines corresponding to a memory buffer
    5634 *        (identified by an address and a size) in L1 cache and L2 cache.
    5735 */
     
    6038    unsigned int i;
    6139
    62     /*
    63      * iterate on cache lines containing target buffer to invalidate them
    64      */
     40    // iterate on L1 cache lines containing target buffer
    6541    for (i = 0; i <= size; i += CACHE_LINE_SIZE)
    6642    {
     
    7349    }
    7450
    75     if (inval_memc) reset_mcc_invalidate(buffer, size);
     51    if (inval_memc)
     52    {
     53        // this preloader uses only the cluster 0
     54        // It does not use the ADDR_HI bits, and does not take
     55        // any lock for exclusive access to MCC
     56        iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer);
     57        iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0);
     58        iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size);
     59        iowrite32(&mcc_address[MCC_CMD]    , (unsigned int) MCC_CMD_INVAL);
     60    }
    7661}
    7762
Note: See TracChangeset for help on using the changeset viewer.