[rtems commit] bsps/arm: Fix invalidate instruction cache

Sebastian Huber sebh at rtems.org
Wed Sep 10 09:21:28 UTC 2014


Module:    rtems
Branch:    master
Commit:    4768ae0feb0d6fdfa02fbd7a8c0e9965efd505e9
Changeset: http://git.rtems.org/rtems/commit/?id=4768ae0feb0d6fdfa02fbd7a8c0e9965efd505e9

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Sep 10 11:10:04 2014 +0200

bsps/arm: Fix invalidate instruction cache

Do not invalidate the entire L2 cache since it is a uniform cache in
_CPU_cache_invalidate_entire_instruction().  For consitency do not touch
the L2 cache even for the range function
_CPU_cache_invalidate_instruction_range().

---

 c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h |   35 +--------------------
 1 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h b/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
index 577fd2f..f88608a 100644
--- a/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
+++ b/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
@@ -1485,45 +1485,14 @@ _CPU_cache_unfreeze_data( void )
 }
 
 static inline void 
-_CPU_cache_invalidate_instruction_range(
-  const void *i_addr,
-  size_t      n_bytes
-)
+_CPU_cache_invalidate_instruction_range( const void *i_addr, size_t n_bytes)
 {
-  if ( n_bytes != 0 ) {
-    uint32_t       adx       = (uint32_t) i_addr
-      & ~CACHE_L2C_310_DATA_LINE_MASK;
-    const uint32_t ADDR_LAST =
-    (uint32_t)( (size_t)i_addr + n_bytes - 1 );
-    uint32_t       block_end =
-      CACHE_MIN( ADDR_LAST, adx + CACHE_MAX_LOCKING_BYTES );
-
-    /* Invalidate L2 cache lines */
-    for (;
-         adx      <= ADDR_LAST;
-         adx       = block_end + 1,
-         block_end = CACHE_MIN( ADDR_LAST, adx + CACHE_MAX_LOCKING_BYTES )) {
-      cache_l2c_310_invalidate_range(
-        adx,
-        block_end
-      );
-    }
-
-    arm_cache_l1_invalidate_instruction_range(
-      i_addr,
-      n_bytes
-    );
-  }
+  arm_cache_l1_invalidate_instruction_range( i_addr, n_bytes );
 }
 
 static inline void 
 _CPU_cache_invalidate_entire_instruction( void )
 {
-  rtems_interrupt_lock_context lock_context;
-
-  rtems_interrupt_lock_acquire( &l2c_310_cache_lock, &lock_context );
-  cache_l2c_310_invalidate_entire();
-  rtems_interrupt_lock_release( &l2c_310_cache_lock, &lock_context );
   arm_cache_l1_invalidate_entire_instruction();
 }
 



More information about the vc mailing list