18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * include/asm-xtensa/cache.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci * for more details.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * (C) 2001 - 2005 Tensilica Inc.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _XTENSA_CACHE_H
128c2ecf20Sopenharmony_ci#define _XTENSA_CACHE_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <asm/core.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define L1_CACHE_SHIFT	XCHAL_DCACHE_LINEWIDTH
178c2ecf20Sopenharmony_ci#define L1_CACHE_BYTES	XCHAL_DCACHE_LINESIZE
188c2ecf20Sopenharmony_ci#define SMP_CACHE_BYTES	L1_CACHE_BYTES
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define DCACHE_WAY_SIZE	(XCHAL_DCACHE_SIZE/XCHAL_DCACHE_WAYS)
218c2ecf20Sopenharmony_ci#define ICACHE_WAY_SIZE	(XCHAL_ICACHE_SIZE/XCHAL_ICACHE_WAYS)
228c2ecf20Sopenharmony_ci#define DCACHE_WAY_SHIFT (XCHAL_DCACHE_SETWIDTH + XCHAL_DCACHE_LINEWIDTH)
238c2ecf20Sopenharmony_ci#define ICACHE_WAY_SHIFT (XCHAL_ICACHE_SETWIDTH + XCHAL_ICACHE_LINEWIDTH)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Maximum cache size per way. */
268c2ecf20Sopenharmony_ci#if DCACHE_WAY_SIZE >= ICACHE_WAY_SIZE
278c2ecf20Sopenharmony_ci# define CACHE_WAY_SIZE DCACHE_WAY_SIZE
288c2ecf20Sopenharmony_ci#else
298c2ecf20Sopenharmony_ci# define CACHE_WAY_SIZE ICACHE_WAY_SIZE
308c2ecf20Sopenharmony_ci#endif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * R/O after init is actually writable, it cannot go to .rodata
368c2ecf20Sopenharmony_ci * according to vmlinux linker script.
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_ci#define __ro_after_init __read_mostly
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif	/* _XTENSA_CACHE_H */
41