xref: /openbmc/linux/arch/xtensa/include/asm/cache.h (revision c95baf12f5077419db01313ab61c2aac007d40cd)
1367b8112SChris Zankel /*
2367b8112SChris Zankel  * include/asm-xtensa/cache.h
3367b8112SChris Zankel  *
4367b8112SChris Zankel  * This file is subject to the terms and conditions of the GNU General Public
5367b8112SChris Zankel  * License.  See the file "COPYING" in the main directory of this archive
6367b8112SChris Zankel  * for more details.
7367b8112SChris Zankel  *
8367b8112SChris Zankel  * (C) 2001 - 2005 Tensilica Inc.
9367b8112SChris Zankel  */
10367b8112SChris Zankel 
11367b8112SChris Zankel #ifndef _XTENSA_CACHE_H
12367b8112SChris Zankel #define _XTENSA_CACHE_H
13367b8112SChris Zankel 
148f8d5745SMax Filippov #include <asm/core.h>
15367b8112SChris Zankel 
16367b8112SChris Zankel #define L1_CACHE_SHIFT	XCHAL_DCACHE_LINEWIDTH
17367b8112SChris Zankel #define L1_CACHE_BYTES	XCHAL_DCACHE_LINESIZE
18367b8112SChris Zankel #define SMP_CACHE_BYTES	L1_CACHE_BYTES
19367b8112SChris Zankel 
20367b8112SChris Zankel #define DCACHE_WAY_SIZE	(XCHAL_DCACHE_SIZE/XCHAL_DCACHE_WAYS)
21367b8112SChris Zankel #define ICACHE_WAY_SIZE	(XCHAL_ICACHE_SIZE/XCHAL_ICACHE_WAYS)
22367b8112SChris Zankel #define DCACHE_WAY_SHIFT (XCHAL_DCACHE_SETWIDTH + XCHAL_DCACHE_LINEWIDTH)
23367b8112SChris Zankel #define ICACHE_WAY_SHIFT (XCHAL_ICACHE_SETWIDTH + XCHAL_ICACHE_LINEWIDTH)
24367b8112SChris Zankel 
25367b8112SChris Zankel /* Maximum cache size per way. */
26367b8112SChris Zankel #if DCACHE_WAY_SIZE >= ICACHE_WAY_SIZE
27367b8112SChris Zankel # define CACHE_WAY_SIZE DCACHE_WAY_SIZE
28367b8112SChris Zankel #else
29367b8112SChris Zankel # define CACHE_WAY_SIZE ICACHE_WAY_SIZE
30367b8112SChris Zankel #endif
31367b8112SChris Zankel 
32a6eb9fe1SFUJITA Tomonori #define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
33367b8112SChris Zankel 
34*7af710d9SMax Filippov /*
35*7af710d9SMax Filippov  * R/O after init is actually writable, it cannot go to .rodata
36*7af710d9SMax Filippov  * according to vmlinux linker script.
37*7af710d9SMax Filippov  */
38*7af710d9SMax Filippov #define __ro_after_init __read_mostly
39*7af710d9SMax Filippov 
40367b8112SChris Zankel #endif	/* _XTENSA_CACHE_H */
41