1 /***********************license start***************
2  * Author: Cavium Networks
3  *
4  * Contact: support@caviumnetworks.com
5  * This file is part of the OCTEON SDK
6  *
7  * Copyright (c) 2003-2017 Cavium, Inc.
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License, Version 2, as
11  * published by the Free Software Foundation.
12  *
13  * This file is distributed in the hope that it will be useful, but
14  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16  * NONINFRINGEMENT.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this file; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  * or visit http://www.gnu.org/licenses/.
23  *
24  * This file may also be available under a different license from Cavium.
25  * Contact Cavium Networks for more information
26  ***********************license end**************************************/
27 
28 #ifndef __CVMX_L2C_DEFS_H__
29 #define __CVMX_L2C_DEFS_H__
30 
31 #include <uapi/asm/bitfield.h>
32 
33 #define CVMX_L2C_DBG (CVMX_ADD_IO_SEG(0x0001180080000030ull))
34 #define CVMX_L2C_CFG (CVMX_ADD_IO_SEG(0x0001180080000000ull))
35 #define CVMX_L2C_CTL (CVMX_ADD_IO_SEG(0x0001180080800000ull))
36 #define CVMX_L2C_ERR_TDTX(block_id)					       \
37 	(CVMX_ADD_IO_SEG(0x0001180080A007E0ull) + ((block_id) & 3) * 0x40000ull)
38 #define CVMX_L2C_ERR_TTGX(block_id)					       \
39 	(CVMX_ADD_IO_SEG(0x0001180080A007E8ull) + ((block_id) & 3) * 0x40000ull)
40 #define CVMX_L2C_LCKBASE (CVMX_ADD_IO_SEG(0x0001180080000058ull))
41 #define CVMX_L2C_LCKOFF (CVMX_ADD_IO_SEG(0x0001180080000060ull))
42 #define CVMX_L2C_PFCTL (CVMX_ADD_IO_SEG(0x0001180080000090ull))
43 #define CVMX_L2C_PFCX(offset) (CVMX_ADD_IO_SEG(0x0001180080000098ull) +	       \
44 		((offset) & 3) * 8)
45 #define CVMX_L2C_PFC0 CVMX_L2C_PFCX(0)
46 #define CVMX_L2C_PFC1 CVMX_L2C_PFCX(1)
47 #define CVMX_L2C_PFC2 CVMX_L2C_PFCX(2)
48 #define CVMX_L2C_PFC3 CVMX_L2C_PFCX(3)
49 #define CVMX_L2C_SPAR0 (CVMX_ADD_IO_SEG(0x0001180080000068ull))
50 #define CVMX_L2C_SPAR1 (CVMX_ADD_IO_SEG(0x0001180080000070ull))
51 #define CVMX_L2C_SPAR2 (CVMX_ADD_IO_SEG(0x0001180080000078ull))
52 #define CVMX_L2C_SPAR3 (CVMX_ADD_IO_SEG(0x0001180080000080ull))
53 #define CVMX_L2C_SPAR4 (CVMX_ADD_IO_SEG(0x0001180080000088ull))
54 #define CVMX_L2C_TADX_PFCX(offset, block_id)				       \
55 		(CVMX_ADD_IO_SEG(0x0001180080A00400ull) + (((offset) & 3) +    \
56 		((block_id) & 7) * 0x8000ull) * 8)
57 #define CVMX_L2C_TADX_PFC0(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00400ull) + \
58 		((block_id) & 3) * 0x40000ull)
59 #define CVMX_L2C_TADX_PFC1(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00408ull) + \
60 		((block_id) & 3) * 0x40000ull)
61 #define CVMX_L2C_TADX_PFC2(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00410ull) + \
62 		((block_id) & 3) * 0x40000ull)
63 #define CVMX_L2C_TADX_PFC3(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00418ull) + \
64 		((block_id) & 3) * 0x40000ull)
65 #define CVMX_L2C_TADX_PRF(offset) (CVMX_ADD_IO_SEG(0x0001180080A00008ull)    + \
66 		((offset) & 7) * 0x40000ull)
67 #define CVMX_L2C_TADX_TAG(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00010ull)  + \
68 		((block_id) & 3) * 0x40000ull)
69 #define CVMX_L2C_WPAR_IOBX(offset) (CVMX_ADD_IO_SEG(0x0001180080840200ull)   + \
70 		((offset) & 1) * 8)
71 #define CVMX_L2C_WPAR_PPX(offset) (CVMX_ADD_IO_SEG(0x0001180080840000ull)    + \
72 		((offset) & 31) * 8)
73 
74 
75 union cvmx_l2c_err_tdtx {
76 	uint64_t u64;
77 	struct cvmx_l2c_err_tdtx_s {
78 		__BITFIELD_FIELD(uint64_t dbe:1,
79 		__BITFIELD_FIELD(uint64_t sbe:1,
80 		__BITFIELD_FIELD(uint64_t vdbe:1,
81 		__BITFIELD_FIELD(uint64_t vsbe:1,
82 		__BITFIELD_FIELD(uint64_t syn:10,
83 		__BITFIELD_FIELD(uint64_t reserved_22_49:28,
84 		__BITFIELD_FIELD(uint64_t wayidx:18,
85 		__BITFIELD_FIELD(uint64_t reserved_2_3:2,
86 		__BITFIELD_FIELD(uint64_t type:2,
87 		;)))))))))
88 	} s;
89 };
90 
91 union cvmx_l2c_err_ttgx {
92 	uint64_t u64;
93 	struct cvmx_l2c_err_ttgx_s {
94 		__BITFIELD_FIELD(uint64_t dbe:1,
95 		__BITFIELD_FIELD(uint64_t sbe:1,
96 		__BITFIELD_FIELD(uint64_t noway:1,
97 		__BITFIELD_FIELD(uint64_t reserved_56_60:5,
98 		__BITFIELD_FIELD(uint64_t syn:6,
99 		__BITFIELD_FIELD(uint64_t reserved_22_49:28,
100 		__BITFIELD_FIELD(uint64_t wayidx:15,
101 		__BITFIELD_FIELD(uint64_t reserved_2_6:5,
102 		__BITFIELD_FIELD(uint64_t type:2,
103 		;)))))))))
104 	} s;
105 };
106 
107 union cvmx_l2c_cfg {
108 	uint64_t u64;
109 	struct cvmx_l2c_cfg_s {
110 		__BITFIELD_FIELD(uint64_t reserved_20_63:44,
111 		__BITFIELD_FIELD(uint64_t bstrun:1,
112 		__BITFIELD_FIELD(uint64_t lbist:1,
113 		__BITFIELD_FIELD(uint64_t xor_bank:1,
114 		__BITFIELD_FIELD(uint64_t dpres1:1,
115 		__BITFIELD_FIELD(uint64_t dpres0:1,
116 		__BITFIELD_FIELD(uint64_t dfill_dis:1,
117 		__BITFIELD_FIELD(uint64_t fpexp:4,
118 		__BITFIELD_FIELD(uint64_t fpempty:1,
119 		__BITFIELD_FIELD(uint64_t fpen:1,
120 		__BITFIELD_FIELD(uint64_t idxalias:1,
121 		__BITFIELD_FIELD(uint64_t mwf_crd:4,
122 		__BITFIELD_FIELD(uint64_t rsp_arb_mode:1,
123 		__BITFIELD_FIELD(uint64_t rfb_arb_mode:1,
124 		__BITFIELD_FIELD(uint64_t lrf_arb_mode:1,
125 		;)))))))))))))))
126 	} s;
127 };
128 
129 union cvmx_l2c_ctl {
130 	uint64_t u64;
131 	struct cvmx_l2c_ctl_s {
132 		__BITFIELD_FIELD(uint64_t reserved_30_63:34,
133 		__BITFIELD_FIELD(uint64_t sepcmt:1,
134 		__BITFIELD_FIELD(uint64_t rdf_fast:1,
135 		__BITFIELD_FIELD(uint64_t disstgl2i:1,
136 		__BITFIELD_FIELD(uint64_t l2dfsbe:1,
137 		__BITFIELD_FIELD(uint64_t l2dfdbe:1,
138 		__BITFIELD_FIELD(uint64_t discclk:1,
139 		__BITFIELD_FIELD(uint64_t maxvab:4,
140 		__BITFIELD_FIELD(uint64_t maxlfb:4,
141 		__BITFIELD_FIELD(uint64_t rsp_arb_mode:1,
142 		__BITFIELD_FIELD(uint64_t xmc_arb_mode:1,
143 		__BITFIELD_FIELD(uint64_t ef_ena:1,
144 		__BITFIELD_FIELD(uint64_t ef_cnt:7,
145 		__BITFIELD_FIELD(uint64_t vab_thresh:4,
146 		__BITFIELD_FIELD(uint64_t disecc:1,
147 		__BITFIELD_FIELD(uint64_t disidxalias:1,
148 		;))))))))))))))))
149 	} s;
150 };
151 
152 union cvmx_l2c_dbg {
153 	uint64_t u64;
154 	struct cvmx_l2c_dbg_s {
155 		__BITFIELD_FIELD(uint64_t reserved_15_63:49,
156 		__BITFIELD_FIELD(uint64_t lfb_enum:4,
157 		__BITFIELD_FIELD(uint64_t lfb_dmp:1,
158 		__BITFIELD_FIELD(uint64_t ppnum:4,
159 		__BITFIELD_FIELD(uint64_t set:3,
160 		__BITFIELD_FIELD(uint64_t finv:1,
161 		__BITFIELD_FIELD(uint64_t l2d:1,
162 		__BITFIELD_FIELD(uint64_t l2t:1,
163 		;))))))))
164 	} s;
165 };
166 
167 union cvmx_l2c_pfctl {
168 	uint64_t u64;
169 	struct cvmx_l2c_pfctl_s {
170 		__BITFIELD_FIELD(uint64_t reserved_36_63:28,
171 		__BITFIELD_FIELD(uint64_t cnt3rdclr:1,
172 		__BITFIELD_FIELD(uint64_t cnt2rdclr:1,
173 		__BITFIELD_FIELD(uint64_t cnt1rdclr:1,
174 		__BITFIELD_FIELD(uint64_t cnt0rdclr:1,
175 		__BITFIELD_FIELD(uint64_t cnt3ena:1,
176 		__BITFIELD_FIELD(uint64_t cnt3clr:1,
177 		__BITFIELD_FIELD(uint64_t cnt3sel:6,
178 		__BITFIELD_FIELD(uint64_t cnt2ena:1,
179 		__BITFIELD_FIELD(uint64_t cnt2clr:1,
180 		__BITFIELD_FIELD(uint64_t cnt2sel:6,
181 		__BITFIELD_FIELD(uint64_t cnt1ena:1,
182 		__BITFIELD_FIELD(uint64_t cnt1clr:1,
183 		__BITFIELD_FIELD(uint64_t cnt1sel:6,
184 		__BITFIELD_FIELD(uint64_t cnt0ena:1,
185 		__BITFIELD_FIELD(uint64_t cnt0clr:1,
186 		__BITFIELD_FIELD(uint64_t cnt0sel:6,
187 		;)))))))))))))))))
188 	} s;
189 };
190 
191 union cvmx_l2c_tadx_prf {
192 	uint64_t u64;
193 	struct cvmx_l2c_tadx_prf_s {
194 		__BITFIELD_FIELD(uint64_t reserved_32_63:32,
195 		__BITFIELD_FIELD(uint64_t cnt3sel:8,
196 		__BITFIELD_FIELD(uint64_t cnt2sel:8,
197 		__BITFIELD_FIELD(uint64_t cnt1sel:8,
198 		__BITFIELD_FIELD(uint64_t cnt0sel:8,
199 		;)))))
200 	} s;
201 };
202 
203 union cvmx_l2c_tadx_tag {
204 	uint64_t u64;
205 	struct cvmx_l2c_tadx_tag_s {
206 		__BITFIELD_FIELD(uint64_t reserved_46_63:18,
207 		__BITFIELD_FIELD(uint64_t ecc:6,
208 		__BITFIELD_FIELD(uint64_t reserved_36_39:4,
209 		__BITFIELD_FIELD(uint64_t tag:19,
210 		__BITFIELD_FIELD(uint64_t reserved_4_16:13,
211 		__BITFIELD_FIELD(uint64_t use:1,
212 		__BITFIELD_FIELD(uint64_t valid:1,
213 		__BITFIELD_FIELD(uint64_t dirty:1,
214 		__BITFIELD_FIELD(uint64_t lock:1,
215 		;)))))))))
216 	} s;
217 };
218 
219 union cvmx_l2c_lckbase {
220 	uint64_t u64;
221 	struct cvmx_l2c_lckbase_s {
222 		__BITFIELD_FIELD(uint64_t reserved_31_63:33,
223 		__BITFIELD_FIELD(uint64_t lck_base:27,
224 		__BITFIELD_FIELD(uint64_t reserved_1_3:3,
225 		__BITFIELD_FIELD(uint64_t lck_ena:1,
226 		;))))
227 	} s;
228 };
229 
230 union cvmx_l2c_lckoff {
231 	uint64_t u64;
232 	struct cvmx_l2c_lckoff_s {
233 		__BITFIELD_FIELD(uint64_t reserved_10_63:54,
234 		__BITFIELD_FIELD(uint64_t lck_offset:10,
235 		;))
236 	} s;
237 };
238 
239 #endif
240