xref: /openbmc/linux/arch/sh/include/asm/cache.h (revision f15cbe6f1a4b4d9df59142fc8e4abb973302cf44)
1*f15cbe6fSPaul Mundt /* $Id: cache.h,v 1.6 2004/03/11 18:08:05 lethal Exp $
2*f15cbe6fSPaul Mundt  *
3*f15cbe6fSPaul Mundt  * include/asm-sh/cache.h
4*f15cbe6fSPaul Mundt  *
5*f15cbe6fSPaul Mundt  * Copyright 1999 (C) Niibe Yutaka
6*f15cbe6fSPaul Mundt  * Copyright 2002, 2003 (C) Paul Mundt
7*f15cbe6fSPaul Mundt  */
8*f15cbe6fSPaul Mundt #ifndef __ASM_SH_CACHE_H
9*f15cbe6fSPaul Mundt #define __ASM_SH_CACHE_H
10*f15cbe6fSPaul Mundt #ifdef __KERNEL__
11*f15cbe6fSPaul Mundt 
12*f15cbe6fSPaul Mundt #include <linux/init.h>
13*f15cbe6fSPaul Mundt #include <cpu/cache.h>
14*f15cbe6fSPaul Mundt 
15*f15cbe6fSPaul Mundt #define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
16*f15cbe6fSPaul Mundt 
17*f15cbe6fSPaul Mundt #define __read_mostly __attribute__((__section__(".data.read_mostly")))
18*f15cbe6fSPaul Mundt 
19*f15cbe6fSPaul Mundt #ifndef __ASSEMBLY__
20*f15cbe6fSPaul Mundt struct cache_info {
21*f15cbe6fSPaul Mundt 	unsigned int ways;		/* Number of cache ways */
22*f15cbe6fSPaul Mundt 	unsigned int sets;		/* Number of cache sets */
23*f15cbe6fSPaul Mundt 	unsigned int linesz;		/* Cache line size (bytes) */
24*f15cbe6fSPaul Mundt 
25*f15cbe6fSPaul Mundt 	unsigned int way_size;		/* sets * line size */
26*f15cbe6fSPaul Mundt 
27*f15cbe6fSPaul Mundt 	/*
28*f15cbe6fSPaul Mundt 	 * way_incr is the address offset for accessing the next way
29*f15cbe6fSPaul Mundt 	 * in memory mapped cache array ops.
30*f15cbe6fSPaul Mundt 	 */
31*f15cbe6fSPaul Mundt 	unsigned int way_incr;
32*f15cbe6fSPaul Mundt 	unsigned int entry_shift;
33*f15cbe6fSPaul Mundt 	unsigned int entry_mask;
34*f15cbe6fSPaul Mundt 
35*f15cbe6fSPaul Mundt 	/*
36*f15cbe6fSPaul Mundt 	 * Compute a mask which selects the address bits which overlap between
37*f15cbe6fSPaul Mundt 	 * 1. those used to select the cache set during indexing
38*f15cbe6fSPaul Mundt 	 * 2. those in the physical page number.
39*f15cbe6fSPaul Mundt 	 */
40*f15cbe6fSPaul Mundt 	unsigned int alias_mask;
41*f15cbe6fSPaul Mundt 
42*f15cbe6fSPaul Mundt 	unsigned int n_aliases;		/* Number of aliases */
43*f15cbe6fSPaul Mundt 
44*f15cbe6fSPaul Mundt 	unsigned long flags;
45*f15cbe6fSPaul Mundt };
46*f15cbe6fSPaul Mundt 
47*f15cbe6fSPaul Mundt int __init detect_cpu_and_cache_system(void);
48*f15cbe6fSPaul Mundt 
49*f15cbe6fSPaul Mundt #endif /* __ASSEMBLY__ */
50*f15cbe6fSPaul Mundt #endif /* __KERNEL__ */
51*f15cbe6fSPaul Mundt #endif /* __ASM_SH_CACHE_H */
52