cache_tx39.h revision 1.4 1 1.4 simonb /* $NetBSD: cache_tx39.h,v 1.4 2003/02/17 11:35:03 simonb Exp $ */
2 1.2 thorpej
3 1.2 thorpej /*-
4 1.2 thorpej * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 1.2 thorpej * All rights reserved.
6 1.2 thorpej *
7 1.2 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.2 thorpej * by UCHIYAMA Yasushi; and by Jason R. Thorpe.
9 1.2 thorpej *
10 1.2 thorpej * Redistribution and use in source and binary forms, with or without
11 1.2 thorpej * modification, are permitted provided that the following conditions
12 1.2 thorpej * are met:
13 1.2 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.2 thorpej * notice, this list of conditions and the following disclaimer.
15 1.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.2 thorpej * documentation and/or other materials provided with the distribution.
18 1.2 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.2 thorpej * must display the following acknowledgement:
20 1.2 thorpej * This product includes software developed by the NetBSD
21 1.2 thorpej * Foundation, Inc. and its contributors.
22 1.2 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2 thorpej * contributors may be used to endorse or promote products derived
24 1.2 thorpej * from this software without specific prior written permission.
25 1.2 thorpej *
26 1.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.2 thorpej */
38 1.2 thorpej
39 1.2 thorpej /*
40 1.2 thorpej * Cache definitions/operations for TX3900-style caches.
41 1.2 thorpej *
42 1.2 thorpej * XXX THIS IS NOT YET COMPLETE.
43 1.2 thorpej */
44 1.2 thorpej
45 1.2 thorpej #define CACHE_TX39_I 0
46 1.2 thorpej #define CACHE_TX39_D 1
47 1.2 thorpej
48 1.2 thorpej #define CACHEOP_TX3900_INDEX_INV (0 << 2) /* I */
49 1.2 thorpej #define CACHEOP_TX3900_ILRUC (1 << 2) /* I, D */
50 1.2 thorpej #define CACHEOP_TX3900_ILCKC (2 << 2) /* D */
51 1.2 thorpej #define CACHEOP_TX3900_HIT_INV (4 << 2) /* D */
52 1.2 thorpej
53 1.2 thorpej #define CACHEOP_TX3920_INDEX_INV CACHEOP_TX3900_INDEX_INV
54 1.2 thorpej #define CACHEOP_TX3920_INDEX_WB_INV (0 << 2) /* D */
55 1.2 thorpej #define CACHEOP_TX3920_ILRUC CACHEOP_TX3900_ILRUC
56 1.2 thorpej #define CACHEOP_TX3920_INDEX_LOAD_TAG (3 << 2) /* I, D */
57 1.2 thorpej #define CACHEOP_TX3920_HIT_INV (4 << 2) /* I, D */
58 1.2 thorpej #define CACHEOP_TX3920_HIT_WB_INV (5 << 2) /* D */
59 1.2 thorpej #define CACHEOP_TX3920_HIT_WB (6 << 2) /* D */
60 1.2 thorpej #define CACHEOP_TX3920_ISTTAG (7 << 2) /* I, D */
61 1.2 thorpej
62 1.4 simonb #if !defined(_LOCORE)
63 1.2 thorpej
64 1.2 thorpej /*
65 1.2 thorpej * cache_tx39_op_line:
66 1.2 thorpej *
67 1.2 thorpej * Perform the specified cache operation on a single line.
68 1.2 thorpej */
69 1.2 thorpej #define cache_op_tx39_line(va, op) \
70 1.2 thorpej do { \
71 1.2 thorpej __asm __volatile( \
72 1.2 thorpej ".set noreorder \n\t" \
73 1.2 thorpej ".set push \n\t" \
74 1.2 thorpej ".set mips3 \n\t" \
75 1.2 thorpej "cache %1, 0(%0) \n\t" \
76 1.2 thorpej ".set pop \n\t" \
77 1.2 thorpej ".set reorder" \
78 1.2 thorpej : \
79 1.2 thorpej : "r" (va), "i" (op) \
80 1.2 thorpej : "memory"); \
81 1.2 thorpej } while (/*CONSTCOND*/0)
82 1.2 thorpej
83 1.2 thorpej /*
84 1.2 thorpej * cache_tx39_op_32lines_4:
85 1.2 thorpej *
86 1.2 thorpej * Perform the specified cache operation on 32 4-byte
87 1.2 thorpej * cache lines.
88 1.2 thorpej */
89 1.2 thorpej #define cache_tx39_op_32lines_4(va, op) \
90 1.2 thorpej do { \
91 1.2 thorpej __asm __volatile( \
92 1.2 thorpej ".set noreorder \n\t" \
93 1.2 thorpej ".set push \n\t" \
94 1.2 thorpej ".set mips3 \n\t" \
95 1.2 thorpej "cache %1, 0x00(%0); cache %1, 0x04(%0); \n\t" \
96 1.2 thorpej "cache %1, 0x08(%0); cache %1, 0x0c(%0); \n\t" \
97 1.2 thorpej "cache %1, 0x10(%0); cache %1, 0x14(%0); \n\t" \
98 1.2 thorpej "cache %1, 0x18(%0); cache %1, 0x1c(%0); \n\t" \
99 1.2 thorpej "cache %1, 0x20(%0); cache %1, 0x24(%0); \n\t" \
100 1.2 thorpej "cache %1, 0x28(%0); cache %1, 0x2c(%0); \n\t" \
101 1.2 thorpej "cache %1, 0x30(%0); cache %1, 0x34(%0); \n\t" \
102 1.2 thorpej "cache %1, 0x38(%0); cache %1, 0x3c(%0); \n\t" \
103 1.2 thorpej "cache %1, 0x40(%0); cache %1, 0x44(%0); \n\t" \
104 1.2 thorpej "cache %1, 0x48(%0); cache %1, 0x4c(%0); \n\t" \
105 1.2 thorpej "cache %1, 0x50(%0); cache %1, 0x54(%0); \n\t" \
106 1.2 thorpej "cache %1, 0x58(%0); cache %1, 0x5c(%0); \n\t" \
107 1.2 thorpej "cache %1, 0x60(%0); cache %1, 0x64(%0); \n\t" \
108 1.2 thorpej "cache %1, 0x68(%0); cache %1, 0x6c(%0); \n\t" \
109 1.2 thorpej "cache %1, 0x70(%0); cache %1, 0x74(%0); \n\t" \
110 1.2 thorpej "cache %1, 0x78(%0); cache %1, 0x7c(%0); \n\t" \
111 1.2 thorpej ".set pop \n\t" \
112 1.2 thorpej ".set reorder" \
113 1.2 thorpej : \
114 1.2 thorpej : "r" (va), "i" (op) \
115 1.2 thorpej : "memory"); \
116 1.2 thorpej } while (/*CONSTCOND*/0)
117 1.2 thorpej
118 1.2 thorpej /*
119 1.2 thorpej * cache_tx39_op_32lines_16:
120 1.2 thorpej *
121 1.2 thorpej * Perform the specified cache operation on 32 16-byte
122 1.2 thorpej * cache lines.
123 1.2 thorpej */
124 1.2 thorpej #define cache_tx39_op_32lines_16(va, op) \
125 1.2 thorpej do { \
126 1.2 thorpej __asm __volatile( \
127 1.2 thorpej ".set noreorder \n\t" \
128 1.2 thorpej ".set push \n\t" \
129 1.2 thorpej ".set mips3 \n\t" \
130 1.2 thorpej "cache %1, 0x000(%0); cache %1, 0x010(%0); \n\t" \
131 1.2 thorpej "cache %1, 0x020(%0); cache %1, 0x030(%0); \n\t" \
132 1.2 thorpej "cache %1, 0x040(%0); cache %1, 0x050(%0); \n\t" \
133 1.2 thorpej "cache %1, 0x060(%0); cache %1, 0x070(%0); \n\t" \
134 1.2 thorpej "cache %1, 0x080(%0); cache %1, 0x090(%0); \n\t" \
135 1.2 thorpej "cache %1, 0x0a0(%0); cache %1, 0x0b0(%0); \n\t" \
136 1.2 thorpej "cache %1, 0x0c0(%0); cache %1, 0x0d0(%0); \n\t" \
137 1.2 thorpej "cache %1, 0x0e0(%0); cache %1, 0x0f0(%0); \n\t" \
138 1.2 thorpej "cache %1, 0x100(%0); cache %1, 0x110(%0); \n\t" \
139 1.2 thorpej "cache %1, 0x120(%0); cache %1, 0x130(%0); \n\t" \
140 1.2 thorpej "cache %1, 0x140(%0); cache %1, 0x150(%0); \n\t" \
141 1.2 thorpej "cache %1, 0x160(%0); cache %1, 0x170(%0); \n\t" \
142 1.2 thorpej "cache %1, 0x180(%0); cache %1, 0x190(%0); \n\t" \
143 1.2 thorpej "cache %1, 0x1a0(%0); cache %1, 0x1b0(%0); \n\t" \
144 1.2 thorpej "cache %1, 0x1c0(%0); cache %1, 0x1d0(%0); \n\t" \
145 1.2 thorpej "cache %1, 0x1e0(%0); cache %1, 0x1f0(%0); \n\t" \
146 1.2 thorpej ".set pop \n\t" \
147 1.2 thorpej ".set reorder" \
148 1.2 thorpej : \
149 1.2 thorpej : "r" (va), "i" (op) \
150 1.2 thorpej : "memory"); \
151 1.2 thorpej } while (/*CONSTCOND*/0)
152 1.2 thorpej
153 1.2 thorpej void tx3900_icache_sync_all_16(void);
154 1.2 thorpej void tx3900_icache_sync_range_16(vaddr_t, vsize_t);
155 1.2 thorpej
156 1.2 thorpej void tx3900_pdcache_wbinv_all_4(void);
157 1.2 thorpej
158 1.2 thorpej void tx3900_pdcache_inv_range_4(vaddr_t, vsize_t);
159 1.2 thorpej void tx3900_pdcache_wb_range_4(vaddr_t, vsize_t);
160 1.2 thorpej
161 1.2 thorpej void tx3920_icache_sync_all_16wb(void);
162 1.2 thorpej void tx3920_icache_sync_range_16wt(vaddr_t, vsize_t);
163 1.2 thorpej void tx3920_icache_sync_range_16wb(vaddr_t, vsize_t);
164 1.2 thorpej
165 1.2 thorpej void tx3920_pdcache_wbinv_all_16wt(void);
166 1.2 thorpej void tx3920_pdcache_wbinv_all_16wb(void);
167 1.2 thorpej void tx3920_pdcache_wbinv_range_16wb(vaddr_t, vsize_t);
168 1.2 thorpej
169 1.2 thorpej void tx3920_pdcache_inv_range_16(vaddr_t, vsize_t);
170 1.2 thorpej void tx3920_pdcache_wb_range_16wt(vaddr_t, vsize_t);
171 1.2 thorpej void tx3920_pdcache_wb_range_16wb(vaddr_t, vsize_t);
172 1.2 thorpej
173 1.2 thorpej void tx3900_icache_do_inv_index_16(vaddr_t, vsize_t);
174 1.2 thorpej void tx3920_icache_do_inv_16(vaddr_t, vsize_t);
175 1.2 thorpej
176 1.4 simonb #endif /* !_LOCORE */
177