[U-Boot] [PATCH] sh: avoid multiple definition errors with cache funcs

Nobuhiro Iwamatsu iwamatsu at nigauri.org
Tue Nov 8 06:38:09 CET 2011


Applied, thanks.

Best regards,
  Nobuhiro

2011/10/27 Mike Frysinger <vapier at gentoo.org>:
> Recent builds for SH4 boards fail with a lot of errors like:
>        cmd_mem.o: In function 'dcache_invalid_range':
>        include/asm/cache.h:25: multiple definition of 'dcache_invalid_range'
>        include/asm/cache.h:25: first defined here
>
> This is due to the funcs being defined in the header, but not static
> or inline or extern.  So move them to the sh4-specific cache.c file.
>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> ---
>  arch/sh/cpu/sh4/cache.c     |   22 ++++++++++++++++++++++
>  arch/sh/include/asm/cache.h |   24 +++---------------------
>  2 files changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c
> index 377005c..dc75e39 100644
> --- a/arch/sh/cpu/sh4/cache.c
> +++ b/arch/sh/cpu/sh4/cache.c
> @@ -106,3 +106,25 @@ int cache_control(unsigned int cmd)
>
>        return 0;
>  }
> +
> +void dcache_wback_range(u32 start, u32 end)
> +{
> +       u32 v;
> +
> +       start &= ~(L1_CACHE_BYTES - 1);
> +       for (v = start; v < end; v += L1_CACHE_BYTES) {
> +               asm volatile ("ocbwb     %0" :  /* no output */
> +                             : "m" (__m(v)));
> +       }
> +}
> +
> +void dcache_invalid_range(u32 start, u32 end)
> +{
> +       u32 v;
> +
> +       start &= ~(L1_CACHE_BYTES - 1);
> +       for (v = start; v < end; v += L1_CACHE_BYTES) {
> +               asm volatile ("ocbi     %0" :   /* no output */
> +                             : "m" (__m(v)));
> +       }
> +}
> diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
> index 6ffab4d..24941b3 100644
> --- a/arch/sh/include/asm/cache.h
> +++ b/arch/sh/include/asm/cache.h
> @@ -10,27 +10,9 @@ int cache_control(unsigned int cmd);
>  struct __large_struct { unsigned long buf[100]; };
>  #define __m(x) (*(struct __large_struct *)(x))
>
> -void dcache_wback_range(u32 start, u32 end)
> -{
> -       u32 v;
> -
> -       start &= ~(L1_CACHE_BYTES - 1);
> -       for (v = start; v < end; v += L1_CACHE_BYTES) {
> -               asm volatile ("ocbwb     %0" :  /* no output */
> -                             : "m" (__m(v)));
> -       }
> -}
> -
> -void dcache_invalid_range(u32 start, u32 end)
> -{
> -       u32 v;
> -
> -       start &= ~(L1_CACHE_BYTES - 1);
> -       for (v = start; v < end; v += L1_CACHE_BYTES) {
> -               asm volatile ("ocbi     %0" :   /* no output */
> -                             : "m" (__m(v)));
> -       }
> -}
> +void dcache_wback_range(u32 start, u32 end);
> +void dcache_invalid_range(u32 start, u32 end);
> +
>  #else
>
>  /*
> --
> 1.7.6.1
>
>



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6


More information about the U-Boot mailing list