blob: 7eaa8894649f66b68bdede3d28f1206e0c9998cc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH64_CACHE_H
2#define __ASM_SH64_CACHE_H
3
4/*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * include/asm-sh64/cache.h
10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 * Copyright (C) 2003, 2004 Paul Mundt
13 *
14 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#define L1_CACHE_SHIFT 5
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Paul Mundtd7525422007-11-08 19:00:27 +090018/* Valid and Dirty bits */
19#define SH_CACHE_VALID (1LL<<0)
20#define SH_CACHE_UPDATED (1LL<<57)
21
Paul Mundt76168c22007-11-10 20:01:51 +090022/* Unimplemented compat bits.. */
23#define SH_CACHE_COMBINED 0
24#define SH_CACHE_ASSOC 0
25
Paul Mundtd7525422007-11-08 19:00:27 +090026/* Cache flags */
27#define SH_CACHE_MODE_WT (1LL<<0)
28#define SH_CACHE_MODE_WB (1LL<<1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30/*
31 * Control Registers.
32 */
33#define ICCR_BASE 0x01600000 /* Instruction Cache Control Register */
34#define ICCR_REG0 0 /* Register 0 offset */
35#define ICCR_REG1 1 /* Register 1 offset */
36#define ICCR0 ICCR_BASE+ICCR_REG0
37#define ICCR1 ICCR_BASE+ICCR_REG1
38
39#define ICCR0_OFF 0x0 /* Set ICACHE off */
40#define ICCR0_ON 0x1 /* Set ICACHE on */
41#define ICCR0_ICI 0x2 /* Invalidate all in IC */
42
43#define ICCR1_NOLOCK 0x0 /* Set No Locking */
44
45#define OCCR_BASE 0x01E00000 /* Operand Cache Control Register */
46#define OCCR_REG0 0 /* Register 0 offset */
47#define OCCR_REG1 1 /* Register 1 offset */
48#define OCCR0 OCCR_BASE+OCCR_REG0
49#define OCCR1 OCCR_BASE+OCCR_REG1
50
51#define OCCR0_OFF 0x0 /* Set OCACHE off */
52#define OCCR0_ON 0x1 /* Set OCACHE on */
53#define OCCR0_OCI 0x2 /* Invalidate all in OC */
54#define OCCR0_WT 0x4 /* Set OCACHE in WT Mode */
55#define OCCR0_WB 0x0 /* Set OCACHE in WB Mode */
56
57#define OCCR1_NOLOCK 0x0 /* Set No Locking */
58
Linus Torvalds1da177e2005-04-16 15:20:36 -070059/*
60 * SH-5
61 * A bit of description here, for neff=32.
62 *
63 * |<--- tag (19 bits) --->|
64 * +-----------------------------+-----------------+------+----------+------+
65 * | | | ways |set index |offset|
66 * +-----------------------------+-----------------+------+----------+------+
67 * ^ 2 bits 8 bits 5 bits
68 * +- Bit 31
69 *
70 * Cacheline size is based on offset: 5 bits = 32 bytes per line
71 * A cache line is identified by a tag + set but OCACHETAG/ICACHETAG
72 * have a broader space for registers. These are outlined by
73 * CACHE_?C_*_STEP below.
74 *
75 */
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077/* Instruction cache */
78#define CACHE_IC_ADDRESS_ARRAY 0x01000000
79
80/* Operand Cache */
81#define CACHE_OC_ADDRESS_ARRAY 0x01800000
82
83/* These declarations relate to cache 'synonyms' in the operand cache. A
84 'synonym' occurs where effective address bits overlap between those used for
85 indexing the cache sets and those passed to the MMU for translation. In the
86 case of SH5-101 & SH5-103, only bit 12 is affected for 4k pages. */
87
88#define CACHE_OC_N_SYNBITS 1 /* Number of synonym bits */
89#define CACHE_OC_SYN_SHIFT 12
90/* Mask to select synonym bit(s) */
91#define CACHE_OC_SYN_MASK (((1UL<<CACHE_OC_N_SYNBITS)-1)<<CACHE_OC_SYN_SHIFT)
92
Linus Torvalds1da177e2005-04-16 15:20:36 -070093/*
94 * Instruction cache can't be invalidated based on physical addresses.
95 * No Instruction Cache defines required, then.
96 */
97
98#endif /* __ASM_SH64_CACHE_H */