[PATCH 2/2] bsp/sparc: Flush only instruction cache

Joel Sherrill joel.sherrill at oarcorp.com
Thu Jul 3 15:58:49 UTC 2014


OK except one style comment.
On 7/3/2014 4:39 AM, Daniel Cederman wrote:
> The flush instruction on LEON flushes both the data and the instruction
> cache. Flushing of just the instruction cache can be done by setting
> the "flush instruction cache" bit in the cache control register.
> ---
>  c/src/lib/libbsp/sparc/leon3/include/cache_.h |    4 +++-
>  c/src/lib/libbsp/sparc/leon3/include/leon.h   |    1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/c/src/lib/libbsp/sparc/leon3/include/cache_.h b/c/src/lib/libbsp/sparc/leon3/include/cache_.h
> index 70c1e2c..8339114 100644
> --- a/c/src/lib/libbsp/sparc/leon3/include/cache_.h
> +++ b/c/src/lib/libbsp/sparc/leon3/include/cache_.h
> @@ -134,7 +134,9 @@ static inline void _CPU_cache_unfreeze_data(void)
>  
>  static inline void _CPU_cache_invalidate_entire_instruction(void)
>  {
> -  __asm__ volatile ("flush");
> +  uint32_t cache_reg = leon3_get_cache_control_register();
Please add a blank line after the variable declaration.
> +  cache_reg |= LEON3_REG_CACHE_CTRL_FI;
> +  leon3_set_cache_control_register(cache_reg);
>  }
>  
>  static inline void _CPU_cache_invalidate_instruction_range(
> diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
> index a62ad29..bc3cdde 100644
> --- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
> +++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
> @@ -90,6 +90,7 @@ extern "C" {
>   *  The following defines the bits in the LEON Cache Control Register.
>   */
>  #define LEON3_REG_CACHE_CTRL_DS      0x00800000 /* Data cache snooping */
> +#define LEON3_REG_CACHE_CTRL_FI      0x00200000 /* Flush instruction cache */
>  
>  /* LEON3 Interrupt Controller */
>  extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs;

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the devel mailing list