162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  arch/arm/include/asm/glue-cache.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 1999-2002 Russell King
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef ASM_GLUE_CACHE_H
862306a36Sopenharmony_ci#define ASM_GLUE_CACHE_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <asm/glue.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci *	Cache Model
1462306a36Sopenharmony_ci *	===========
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci#undef _CACHE
1762306a36Sopenharmony_ci#undef MULTI_CACHE
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#if defined(CONFIG_CPU_CACHE_V4)
2062306a36Sopenharmony_ci# ifdef _CACHE
2162306a36Sopenharmony_ci#  define MULTI_CACHE 1
2262306a36Sopenharmony_ci# else
2362306a36Sopenharmony_ci#  define _CACHE v4
2462306a36Sopenharmony_ci# endif
2562306a36Sopenharmony_ci#endif
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
2862306a36Sopenharmony_ci    defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \
2962306a36Sopenharmony_ci    defined(CONFIG_CPU_ARM1026)
3062306a36Sopenharmony_ci# define MULTI_CACHE 1
3162306a36Sopenharmony_ci#endif
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#if defined(CONFIG_CPU_FA526)
3462306a36Sopenharmony_ci# ifdef _CACHE
3562306a36Sopenharmony_ci#  define MULTI_CACHE 1
3662306a36Sopenharmony_ci# else
3762306a36Sopenharmony_ci#  define _CACHE fa
3862306a36Sopenharmony_ci# endif
3962306a36Sopenharmony_ci#endif
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#if defined(CONFIG_CPU_ARM926T)
4262306a36Sopenharmony_ci# ifdef _CACHE
4362306a36Sopenharmony_ci#  define MULTI_CACHE 1
4462306a36Sopenharmony_ci# else
4562306a36Sopenharmony_ci#  define _CACHE arm926
4662306a36Sopenharmony_ci# endif
4762306a36Sopenharmony_ci#endif
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#if defined(CONFIG_CPU_ARM940T)
5062306a36Sopenharmony_ci# ifdef _CACHE
5162306a36Sopenharmony_ci#  define MULTI_CACHE 1
5262306a36Sopenharmony_ci# else
5362306a36Sopenharmony_ci#  define _CACHE arm940
5462306a36Sopenharmony_ci# endif
5562306a36Sopenharmony_ci#endif
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#if defined(CONFIG_CPU_ARM946E)
5862306a36Sopenharmony_ci# ifdef _CACHE
5962306a36Sopenharmony_ci#  define MULTI_CACHE 1
6062306a36Sopenharmony_ci# else
6162306a36Sopenharmony_ci#  define _CACHE arm946
6262306a36Sopenharmony_ci# endif
6362306a36Sopenharmony_ci#endif
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#if defined(CONFIG_CPU_CACHE_V4WB)
6662306a36Sopenharmony_ci# ifdef _CACHE
6762306a36Sopenharmony_ci#  define MULTI_CACHE 1
6862306a36Sopenharmony_ci# else
6962306a36Sopenharmony_ci#  define _CACHE v4wb
7062306a36Sopenharmony_ci# endif
7162306a36Sopenharmony_ci#endif
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#if defined(CONFIG_CPU_XSCALE)
7462306a36Sopenharmony_ci# ifdef _CACHE
7562306a36Sopenharmony_ci#  define MULTI_CACHE 1
7662306a36Sopenharmony_ci# else
7762306a36Sopenharmony_ci#  define _CACHE xscale
7862306a36Sopenharmony_ci# endif
7962306a36Sopenharmony_ci#endif
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#if defined(CONFIG_CPU_XSC3)
8262306a36Sopenharmony_ci# ifdef _CACHE
8362306a36Sopenharmony_ci#  define MULTI_CACHE 1
8462306a36Sopenharmony_ci# else
8562306a36Sopenharmony_ci#  define _CACHE xsc3
8662306a36Sopenharmony_ci# endif
8762306a36Sopenharmony_ci#endif
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#if defined(CONFIG_CPU_MOHAWK)
9062306a36Sopenharmony_ci# ifdef _CACHE
9162306a36Sopenharmony_ci#  define MULTI_CACHE 1
9262306a36Sopenharmony_ci# else
9362306a36Sopenharmony_ci#  define _CACHE mohawk
9462306a36Sopenharmony_ci# endif
9562306a36Sopenharmony_ci#endif
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#if defined(CONFIG_CPU_FEROCEON)
9862306a36Sopenharmony_ci# define MULTI_CACHE 1
9962306a36Sopenharmony_ci#endif
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
10262306a36Sopenharmony_ci# ifdef _CACHE
10362306a36Sopenharmony_ci#  define MULTI_CACHE 1
10462306a36Sopenharmony_ci# else
10562306a36Sopenharmony_ci#  define _CACHE v6
10662306a36Sopenharmony_ci# endif
10762306a36Sopenharmony_ci#endif
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#if defined(CONFIG_CPU_V7)
11062306a36Sopenharmony_ci# ifdef _CACHE
11162306a36Sopenharmony_ci#  define MULTI_CACHE 1
11262306a36Sopenharmony_ci# else
11362306a36Sopenharmony_ci#  define _CACHE v7
11462306a36Sopenharmony_ci# endif
11562306a36Sopenharmony_ci#endif
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#if defined(CONFIG_CACHE_B15_RAC)
11862306a36Sopenharmony_ci# define MULTI_CACHE 1
11962306a36Sopenharmony_ci#endif
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#if defined(CONFIG_CPU_V7M)
12262306a36Sopenharmony_ci#  define MULTI_CACHE 1
12362306a36Sopenharmony_ci#endif
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci#if !defined(_CACHE) && !defined(MULTI_CACHE)
12662306a36Sopenharmony_ci#error Unknown cache maintenance model
12762306a36Sopenharmony_ci#endif
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#ifndef __ASSEMBLER__
13062306a36Sopenharmony_cistatic inline void nop_flush_icache_all(void) { }
13162306a36Sopenharmony_cistatic inline void nop_flush_kern_cache_all(void) { }
13262306a36Sopenharmony_cistatic inline void nop_flush_kern_cache_louis(void) { }
13362306a36Sopenharmony_cistatic inline void nop_flush_user_cache_all(void) { }
13462306a36Sopenharmony_cistatic inline void nop_flush_user_cache_range(unsigned long a,
13562306a36Sopenharmony_ci		unsigned long b, unsigned int c) { }
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_cistatic inline void nop_coherent_kern_range(unsigned long a, unsigned long b) { }
13862306a36Sopenharmony_cistatic inline int nop_coherent_user_range(unsigned long a,
13962306a36Sopenharmony_ci		unsigned long b) { return 0; }
14062306a36Sopenharmony_cistatic inline void nop_flush_kern_dcache_area(void *a, size_t s) { }
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_cistatic inline void nop_dma_flush_range(const void *a, const void *b) { }
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_cistatic inline void nop_dma_map_area(const void *s, size_t l, int f) { }
14562306a36Sopenharmony_cistatic inline void nop_dma_unmap_area(const void *s, size_t l, int f) { }
14662306a36Sopenharmony_ci#endif
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#ifndef MULTI_CACHE
14962306a36Sopenharmony_ci#define __cpuc_flush_icache_all		__glue(_CACHE,_flush_icache_all)
15062306a36Sopenharmony_ci#define __cpuc_flush_kern_all		__glue(_CACHE,_flush_kern_cache_all)
15162306a36Sopenharmony_ci#define __cpuc_flush_kern_louis		__glue(_CACHE,_flush_kern_cache_louis)
15262306a36Sopenharmony_ci#define __cpuc_flush_user_all		__glue(_CACHE,_flush_user_cache_all)
15362306a36Sopenharmony_ci#define __cpuc_flush_user_range		__glue(_CACHE,_flush_user_cache_range)
15462306a36Sopenharmony_ci#define __cpuc_coherent_kern_range	__glue(_CACHE,_coherent_kern_range)
15562306a36Sopenharmony_ci#define __cpuc_coherent_user_range	__glue(_CACHE,_coherent_user_range)
15662306a36Sopenharmony_ci#define __cpuc_flush_dcache_area	__glue(_CACHE,_flush_kern_dcache_area)
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define dmac_flush_range		__glue(_CACHE,_dma_flush_range)
15962306a36Sopenharmony_ci#endif
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#endif
162