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