cache_tx39.h revision 1.7 1 1.7 matt /* $NetBSD: cache_tx39.h,v 1.7 2016/07/11 16:15:35 matt 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 *
19 1.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.2 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.2 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.2 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.2 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.2 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.2 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.2 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.2 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.2 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.2 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.2 thorpej */
31 1.2 thorpej
32 1.2 thorpej /*
33 1.2 thorpej * Cache definitions/operations for TX3900-style caches.
34 1.2 thorpej *
35 1.2 thorpej * XXX THIS IS NOT YET COMPLETE.
36 1.2 thorpej */
37 1.2 thorpej
38 1.2 thorpej #define CACHE_TX39_I 0
39 1.2 thorpej #define CACHE_TX39_D 1
40 1.2 thorpej
41 1.2 thorpej #define CACHEOP_TX3900_INDEX_INV (0 << 2) /* I */
42 1.2 thorpej #define CACHEOP_TX3900_ILRUC (1 << 2) /* I, D */
43 1.2 thorpej #define CACHEOP_TX3900_ILCKC (2 << 2) /* D */
44 1.2 thorpej #define CACHEOP_TX3900_HIT_INV (4 << 2) /* D */
45 1.2 thorpej
46 1.2 thorpej #define CACHEOP_TX3920_INDEX_INV CACHEOP_TX3900_INDEX_INV
47 1.2 thorpej #define CACHEOP_TX3920_INDEX_WB_INV (0 << 2) /* D */
48 1.2 thorpej #define CACHEOP_TX3920_ILRUC CACHEOP_TX3900_ILRUC
49 1.2 thorpej #define CACHEOP_TX3920_INDEX_LOAD_TAG (3 << 2) /* I, D */
50 1.2 thorpej #define CACHEOP_TX3920_HIT_INV (4 << 2) /* I, D */
51 1.2 thorpej #define CACHEOP_TX3920_HIT_WB_INV (5 << 2) /* D */
52 1.2 thorpej #define CACHEOP_TX3920_HIT_WB (6 << 2) /* D */
53 1.2 thorpej #define CACHEOP_TX3920_ISTTAG (7 << 2) /* I, D */
54 1.2 thorpej
55 1.4 simonb #if !defined(_LOCORE)
56 1.2 thorpej
57 1.2 thorpej /*
58 1.2 thorpej * cache_tx39_op_line:
59 1.2 thorpej *
60 1.2 thorpej * Perform the specified cache operation on a single line.
61 1.2 thorpej */
62 1.2 thorpej #define cache_op_tx39_line(va, op) \
63 1.2 thorpej do { \
64 1.5 perry __asm volatile( \
65 1.2 thorpej ".set noreorder \n\t" \
66 1.2 thorpej ".set push \n\t" \
67 1.2 thorpej ".set mips3 \n\t" \
68 1.2 thorpej "cache %1, 0(%0) \n\t" \
69 1.2 thorpej ".set pop \n\t" \
70 1.2 thorpej ".set reorder" \
71 1.2 thorpej : \
72 1.2 thorpej : "r" (va), "i" (op) \
73 1.2 thorpej : "memory"); \
74 1.2 thorpej } while (/*CONSTCOND*/0)
75 1.2 thorpej
76 1.2 thorpej /*
77 1.2 thorpej * cache_tx39_op_32lines_4:
78 1.2 thorpej *
79 1.2 thorpej * Perform the specified cache operation on 32 4-byte
80 1.2 thorpej * cache lines.
81 1.2 thorpej */
82 1.2 thorpej #define cache_tx39_op_32lines_4(va, op) \
83 1.2 thorpej do { \
84 1.5 perry __asm volatile( \
85 1.2 thorpej ".set noreorder \n\t" \
86 1.2 thorpej ".set push \n\t" \
87 1.2 thorpej ".set mips3 \n\t" \
88 1.2 thorpej "cache %1, 0x00(%0); cache %1, 0x04(%0); \n\t" \
89 1.2 thorpej "cache %1, 0x08(%0); cache %1, 0x0c(%0); \n\t" \
90 1.2 thorpej "cache %1, 0x10(%0); cache %1, 0x14(%0); \n\t" \
91 1.2 thorpej "cache %1, 0x18(%0); cache %1, 0x1c(%0); \n\t" \
92 1.2 thorpej "cache %1, 0x20(%0); cache %1, 0x24(%0); \n\t" \
93 1.2 thorpej "cache %1, 0x28(%0); cache %1, 0x2c(%0); \n\t" \
94 1.2 thorpej "cache %1, 0x30(%0); cache %1, 0x34(%0); \n\t" \
95 1.2 thorpej "cache %1, 0x38(%0); cache %1, 0x3c(%0); \n\t" \
96 1.2 thorpej "cache %1, 0x40(%0); cache %1, 0x44(%0); \n\t" \
97 1.2 thorpej "cache %1, 0x48(%0); cache %1, 0x4c(%0); \n\t" \
98 1.2 thorpej "cache %1, 0x50(%0); cache %1, 0x54(%0); \n\t" \
99 1.2 thorpej "cache %1, 0x58(%0); cache %1, 0x5c(%0); \n\t" \
100 1.2 thorpej "cache %1, 0x60(%0); cache %1, 0x64(%0); \n\t" \
101 1.2 thorpej "cache %1, 0x68(%0); cache %1, 0x6c(%0); \n\t" \
102 1.2 thorpej "cache %1, 0x70(%0); cache %1, 0x74(%0); \n\t" \
103 1.2 thorpej "cache %1, 0x78(%0); cache %1, 0x7c(%0); \n\t" \
104 1.2 thorpej ".set pop \n\t" \
105 1.2 thorpej ".set reorder" \
106 1.2 thorpej : \
107 1.2 thorpej : "r" (va), "i" (op) \
108 1.2 thorpej : "memory"); \
109 1.2 thorpej } while (/*CONSTCOND*/0)
110 1.2 thorpej
111 1.2 thorpej /*
112 1.2 thorpej * cache_tx39_op_32lines_16:
113 1.2 thorpej *
114 1.2 thorpej * Perform the specified cache operation on 32 16-byte
115 1.2 thorpej * cache lines.
116 1.2 thorpej */
117 1.2 thorpej #define cache_tx39_op_32lines_16(va, op) \
118 1.2 thorpej do { \
119 1.5 perry __asm volatile( \
120 1.2 thorpej ".set noreorder \n\t" \
121 1.2 thorpej ".set push \n\t" \
122 1.2 thorpej ".set mips3 \n\t" \
123 1.2 thorpej "cache %1, 0x000(%0); cache %1, 0x010(%0); \n\t" \
124 1.2 thorpej "cache %1, 0x020(%0); cache %1, 0x030(%0); \n\t" \
125 1.2 thorpej "cache %1, 0x040(%0); cache %1, 0x050(%0); \n\t" \
126 1.2 thorpej "cache %1, 0x060(%0); cache %1, 0x070(%0); \n\t" \
127 1.2 thorpej "cache %1, 0x080(%0); cache %1, 0x090(%0); \n\t" \
128 1.2 thorpej "cache %1, 0x0a0(%0); cache %1, 0x0b0(%0); \n\t" \
129 1.2 thorpej "cache %1, 0x0c0(%0); cache %1, 0x0d0(%0); \n\t" \
130 1.2 thorpej "cache %1, 0x0e0(%0); cache %1, 0x0f0(%0); \n\t" \
131 1.2 thorpej "cache %1, 0x100(%0); cache %1, 0x110(%0); \n\t" \
132 1.2 thorpej "cache %1, 0x120(%0); cache %1, 0x130(%0); \n\t" \
133 1.2 thorpej "cache %1, 0x140(%0); cache %1, 0x150(%0); \n\t" \
134 1.2 thorpej "cache %1, 0x160(%0); cache %1, 0x170(%0); \n\t" \
135 1.2 thorpej "cache %1, 0x180(%0); cache %1, 0x190(%0); \n\t" \
136 1.2 thorpej "cache %1, 0x1a0(%0); cache %1, 0x1b0(%0); \n\t" \
137 1.2 thorpej "cache %1, 0x1c0(%0); cache %1, 0x1d0(%0); \n\t" \
138 1.2 thorpej "cache %1, 0x1e0(%0); cache %1, 0x1f0(%0); \n\t" \
139 1.2 thorpej ".set pop \n\t" \
140 1.2 thorpej ".set reorder" \
141 1.2 thorpej : \
142 1.2 thorpej : "r" (va), "i" (op) \
143 1.2 thorpej : "memory"); \
144 1.2 thorpej } while (/*CONSTCOND*/0)
145 1.2 thorpej
146 1.2 thorpej void tx3900_icache_sync_all_16(void);
147 1.7 matt void tx3900_icache_sync_range_16(register_t, vsize_t);
148 1.2 thorpej
149 1.2 thorpej void tx3900_pdcache_wbinv_all_4(void);
150 1.2 thorpej
151 1.7 matt void tx3900_pdcache_inv_range_4(register_t, vsize_t);
152 1.7 matt void tx3900_pdcache_wb_range_4(register_t, vsize_t);
153 1.2 thorpej
154 1.2 thorpej void tx3920_icache_sync_all_16wb(void);
155 1.7 matt void tx3920_icache_sync_range_16wt(register_t, vsize_t);
156 1.7 matt void tx3920_icache_sync_range_16wb(register_t, vsize_t);
157 1.2 thorpej
158 1.2 thorpej void tx3920_pdcache_wbinv_all_16wt(void);
159 1.2 thorpej void tx3920_pdcache_wbinv_all_16wb(void);
160 1.7 matt void tx3920_pdcache_wbinv_range_16wb(register_t, vsize_t);
161 1.2 thorpej
162 1.7 matt void tx3920_pdcache_inv_range_16(register_t, vsize_t);
163 1.7 matt void tx3920_pdcache_wb_range_16wt(register_t, vsize_t);
164 1.7 matt void tx3920_pdcache_wb_range_16wb(register_t, vsize_t);
165 1.2 thorpej
166 1.2 thorpej void tx3900_icache_do_inv_index_16(vaddr_t, vsize_t);
167 1.7 matt void tx3920_icache_do_inv_16(register_t, vsize_t);
168 1.2 thorpej
169 1.4 simonb #endif /* !_LOCORE */
170