qatreg.h revision 1.1.8.2 1 1.1.8.2 martin /* $NetBSD: qatreg.h,v 1.1.8.2 2020/04/13 08:04:46 martin Exp $ */
2 1.1.8.2 martin
3 1.1.8.2 martin /*
4 1.1.8.2 martin * Copyright (c) 2019 Internet Initiative Japan, Inc.
5 1.1.8.2 martin * All rights reserved.
6 1.1.8.2 martin *
7 1.1.8.2 martin * Redistribution and use in source and binary forms, with or without
8 1.1.8.2 martin * modification, are permitted provided that the following conditions
9 1.1.8.2 martin * are met:
10 1.1.8.2 martin * 1. Redistributions of source code must retain the above copyright
11 1.1.8.2 martin * notice, this list of conditions and the following disclaimer.
12 1.1.8.2 martin * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.8.2 martin * notice, this list of conditions and the following disclaimer in the
14 1.1.8.2 martin * documentation and/or other materials provided with the distribution.
15 1.1.8.2 martin *
16 1.1.8.2 martin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.1.8.2 martin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1.8.2 martin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1.8.2 martin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.1.8.2 martin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.1.8.2 martin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.1.8.2 martin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.1.8.2 martin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.1.8.2 martin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.1.8.2 martin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.1.8.2 martin * POSSIBILITY OF SUCH DAMAGE.
27 1.1.8.2 martin */
28 1.1.8.2 martin
29 1.1.8.2 martin /*
30 1.1.8.2 martin * Copyright(c) 2007-2019 Intel Corporation. All rights reserved.
31 1.1.8.2 martin *
32 1.1.8.2 martin * Redistribution and use in source and binary forms, with or without
33 1.1.8.2 martin * modification, are permitted provided that the following conditions
34 1.1.8.2 martin * are met:
35 1.1.8.2 martin *
36 1.1.8.2 martin * * Redistributions of source code must retain the above copyright
37 1.1.8.2 martin * notice, this list of conditions and the following disclaimer.
38 1.1.8.2 martin * * Redistributions in binary form must reproduce the above copyright
39 1.1.8.2 martin * notice, this list of conditions and the following disclaimer in
40 1.1.8.2 martin * the documentation and/or other materials provided with the
41 1.1.8.2 martin * distribution.
42 1.1.8.2 martin * * Neither the name of Intel Corporation nor the names of its
43 1.1.8.2 martin * contributors may be used to endorse or promote products derived
44 1.1.8.2 martin * from this software without specific prior written permission.
45 1.1.8.2 martin *
46 1.1.8.2 martin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47 1.1.8.2 martin * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48 1.1.8.2 martin * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49 1.1.8.2 martin * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50 1.1.8.2 martin * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 1.1.8.2 martin * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52 1.1.8.2 martin * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53 1.1.8.2 martin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54 1.1.8.2 martin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55 1.1.8.2 martin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56 1.1.8.2 martin * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 1.1.8.2 martin */
58 1.1.8.2 martin
59 1.1.8.2 martin #ifndef _DEV_PCI_QATREG_H_
60 1.1.8.2 martin #define _DEV_PCI_QATREG_H_
61 1.1.8.2 martin
62 1.1.8.2 martin /* Limits */
63 1.1.8.2 martin #define MAX_NUM_AE 0x10
64 1.1.8.2 martin #define MAX_NUM_ACCEL 6 /* XXX DH89XXCL? */
65 1.1.8.2 martin #define MAX_AE 0x18
66 1.1.8.2 martin #define MAX_AE_CTX 8
67 1.1.8.2 martin #define MAX_ARB 4
68 1.1.8.2 martin
69 1.1.8.2 martin #define MAX_USTORE_PER_SEG 0x8000 /* 16k * 2 */
70 1.1.8.2 martin #define MAX_USTORE MAX_USTORE_PER_SEG
71 1.1.8.2 martin
72 1.1.8.2 martin #define MAX_AE_PER_ACCEL 4 /* XXX */
73 1.1.8.2 martin #define MAX_BANK_PER_ACCEL 16 /* XXX */
74 1.1.8.2 martin #define MAX_RING_PER_BANK 16
75 1.1.8.2 martin
76 1.1.8.2 martin #define MAX_XFER_REG 128
77 1.1.8.2 martin #define MAX_GPR_REG 128
78 1.1.8.2 martin #define MAX_NN_REG 128
79 1.1.8.2 martin #define MAX_LMEM_REG 1024
80 1.1.8.2 martin #define MAX_INP_STATE 16
81 1.1.8.2 martin #define MAX_CAM_REG 16
82 1.1.8.2 martin #define MAX_FIFO_QWADDR 160
83 1.1.8.2 martin
84 1.1.8.2 martin #define MAX_EXEC_INST 100
85 1.1.8.2 martin #define UWORD_CPYBUF_SIZE 1024 /* micro-store copy buffer (bytes) */
86 1.1.8.2 martin #define INVLD_UWORD 0xffffffffffull /* invalid micro-instruction */
87 1.1.8.2 martin #define AEV2_PACKED_UWORD_BYTES 6 /* version 2 packed uword size */
88 1.1.8.2 martin #define UWORD_MASK 0xbffffffffffull /* micro-word mask without parity */
89 1.1.8.2 martin
90 1.1.8.2 martin #define AE_ALL_CTX 0xff
91 1.1.8.2 martin
92 1.1.8.2 martin /* PCIe configuration space paramter */
93 1.1.8.2 martin #define NO_PCI_REG (-1)
94 1.1.8.2 martin #define NO_REG_OFFSET 0
95 1.1.8.2 martin
96 1.1.8.2 martin #define MAX_BARS 3
97 1.1.8.2 martin
98 1.1.8.2 martin /* Fuse Control */
99 1.1.8.2 martin #define FUSECTL_REG 0x40
100 1.1.8.2 martin #define FUSECTL_MASK __BIT(31)
101 1.1.8.2 martin
102 1.1.8.2 martin #define LEGFUSE_REG 0x4c
103 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_CIPHER_SLICE __BIT(0)
104 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_AUTH_SLICE __BIT(1)
105 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_PKE_SLICE __BIT(2)
106 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_COMPRESS_SLICE __BIT(3)
107 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_LZS_SLICE __BIT(4)
108 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_EIA3_SLICE __BIT(5)
109 1.1.8.2 martin #define LEGFUSE_ACCEL_MASK_SHA3_SLICE __BIT(6)
110 1.1.8.2 martin
111 1.1.8.2 martin /* -------------------------------------------------------------------------- */
112 1.1.8.2 martin /* PETRINGCSR region */
113 1.1.8.2 martin
114 1.1.8.2 martin /* ETR parameters */
115 1.1.8.2 martin #define ETR_MAX_RINGS_PER_BANK 16
116 1.1.8.2 martin
117 1.1.8.2 martin /* ETR registers */
118 1.1.8.2 martin #define ETR_RING_CONFIG 0x0000
119 1.1.8.2 martin #define ETR_RING_LBASE 0x0040
120 1.1.8.2 martin #define ETR_RING_UBASE 0x0080
121 1.1.8.2 martin #define ETR_RING_HEAD_OFFSET 0x00C0
122 1.1.8.2 martin #define ETR_RING_TAIL_OFFSET 0x0100
123 1.1.8.2 martin #define ETR_RING_STAT 0x0140
124 1.1.8.2 martin #define ETR_UO_STAT 0x0148
125 1.1.8.2 martin #define ETR_E_STAT 0x014C
126 1.1.8.2 martin #define ETR_NE_STAT 0x0150
127 1.1.8.2 martin #define ETR_NF_STAT 0x0154
128 1.1.8.2 martin #define ETR_F_STAT 0x0158
129 1.1.8.2 martin #define ETR_C_STAT 0x015C
130 1.1.8.2 martin #define ETR_INT_EN 0x016C
131 1.1.8.2 martin #define ETR_INT_REG 0x0170
132 1.1.8.2 martin #define ETR_INT_SRCSEL 0x0174
133 1.1.8.2 martin #define ETR_INT_SRCSEL_2 0x0178
134 1.1.8.2 martin #define ETR_INT_COL_EN 0x017C
135 1.1.8.2 martin #define ETR_INT_COL_CTL 0x0180
136 1.1.8.2 martin #define ETR_AP_NF_MASK 0x2000
137 1.1.8.2 martin #define ETR_AP_NF_DEST 0x2020
138 1.1.8.2 martin #define ETR_AP_NE_MASK 0x2040
139 1.1.8.2 martin #define ETR_AP_NE_DEST 0x2060
140 1.1.8.2 martin #define ETR_AP_DELAY 0x2080
141 1.1.8.2 martin
142 1.1.8.2 martin /* ARB registers */
143 1.1.8.2 martin #define ARB_OFFSET 0x30000
144 1.1.8.2 martin #define ARB_REG_SIZE 0x4
145 1.1.8.2 martin #define ARB_WTR_SIZE 0x20
146 1.1.8.2 martin #define ARB_REG_SLOT 0x1000
147 1.1.8.2 martin #define ARB_WTR_OFFSET 0x010
148 1.1.8.2 martin #define ARB_RO_EN_OFFSET 0x090
149 1.1.8.2 martin #define ARB_WRK_2_SER_MAP_OFFSET 0x180
150 1.1.8.2 martin #define ARB_RINGSRVARBEN_OFFSET 0x19c
151 1.1.8.2 martin
152 1.1.8.2 martin /* Ring Config */
153 1.1.8.2 martin #define ETR_RING_CONFIG_LATE_HEAD_POINTER_MODE __BIT(31)
154 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_FULL_WM __BITS(14, 10)
155 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_EMPTY_WM __BITS(9, 5)
156 1.1.8.2 martin #define ETR_RING_CONFIG_RING_SIZE __BITS(4, 0)
157 1.1.8.2 martin
158 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_0 0x00
159 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_4 0x01
160 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_8 0x02
161 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_16 0x03
162 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_32 0x04
163 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_64 0x05
164 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_128 0x06
165 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_256 0x07
166 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_512 0x08
167 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_1K 0x09
168 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_2K 0x0A
169 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_4K 0x0B
170 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_8K 0x0C
171 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_16K 0x0D
172 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_32K 0x0E
173 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_64K 0x0F
174 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_128K 0x10
175 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_256K 0x11
176 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_512K 0x12
177 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_1M 0x13
178 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_2M 0x14
179 1.1.8.2 martin #define ETR_RING_CONFIG_NEAR_WM_4M 0x15
180 1.1.8.2 martin
181 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_64 0x00
182 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_128 0x01
183 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_256 0x02
184 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_512 0x03
185 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_1K 0x04
186 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_2K 0x05
187 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_4K 0x06
188 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_8K 0x07
189 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_16K 0x08
190 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_32K 0x09
191 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_64K 0x0A
192 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_128K 0x0B
193 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_256K 0x0C
194 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_512K 0x0D
195 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_1M 0x0E
196 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_2M 0x0F
197 1.1.8.2 martin #define ETR_RING_CONFIG_SIZE_4M 0x10
198 1.1.8.2 martin
199 1.1.8.2 martin /* Default Ring Config is Nearly Full = Full and Nearly Empty = Empty */
200 1.1.8.2 martin #define ETR_RING_CONFIG_BUILD(size) \
201 1.1.8.2 martin (__SHIFTIN(ETR_RING_CONFIG_NEAR_WM_0, \
202 1.1.8.2 martin ETR_RING_CONFIG_NEAR_FULL_WM) | \
203 1.1.8.2 martin __SHIFTIN(ETR_RING_CONFIG_NEAR_WM_0, \
204 1.1.8.2 martin ETR_RING_CONFIG_NEAR_EMPTY_WM) | \
205 1.1.8.2 martin __SHIFTIN((size), ETR_RING_CONFIG_RING_SIZE))
206 1.1.8.2 martin
207 1.1.8.2 martin /* Response Ring Configuration */
208 1.1.8.2 martin #define ETR_RING_CONFIG_BUILD_RESP(size, wm_nf, wm_ne) \
209 1.1.8.2 martin (__SHIFTIN((wm_nf), ETR_RING_CONFIG_NEAR_FULL_WM) | \
210 1.1.8.2 martin __SHIFTIN((wm_ne), ETR_RING_CONFIG_NEAR_EMPTY_WM) | \
211 1.1.8.2 martin __SHIFTIN((size), ETR_RING_CONFIG_RING_SIZE))
212 1.1.8.2 martin
213 1.1.8.2 martin /* Ring Base */
214 1.1.8.2 martin #define ETR_RING_BASE_BUILD(addr, size) \
215 1.1.8.2 martin (((addr) >> 6) & (0xFFFFFFFFFFFFFFFFULL << (size)))
216 1.1.8.2 martin
217 1.1.8.2 martin #define ETR_INT_REG_CLEAR_MASK 0xffff
218 1.1.8.2 martin
219 1.1.8.2 martin /* Initial bank Interrupt Source mask */
220 1.1.8.2 martin #define ETR_INT_SRCSEL_MASK 0x44444444UL
221 1.1.8.2 martin
222 1.1.8.2 martin #define ETR_INT_SRCSEL_NEXT_OFFSET 4
223 1.1.8.2 martin
224 1.1.8.2 martin #define ETR_RINGS_PER_INT_SRCSEL 8
225 1.1.8.2 martin
226 1.1.8.2 martin #define ETR_INT_COL_CTL_ENABLE __BIT(31)
227 1.1.8.2 martin
228 1.1.8.2 martin #define ETR_AP_NF_MASK_INIT 0xAAAAAAAA
229 1.1.8.2 martin #define ETR_AP_NE_MASK_INIT 0x55555555
230 1.1.8.2 martin
231 1.1.8.2 martin /* Autopush destination AE bit */
232 1.1.8.2 martin #define ETR_AP_DEST_ENABLE __BIT(7)
233 1.1.8.2 martin #define ETR_AP_DEST_AE __BITS(6, 2)
234 1.1.8.2 martin #define ETR_AP_DEST_MAILBOX __BITS(1, 0)
235 1.1.8.2 martin
236 1.1.8.2 martin /* Autopush destination enable bit */
237 1.1.8.2 martin
238 1.1.8.2 martin /* Autopush CSR Offset */
239 1.1.8.2 martin #define ETR_AP_BANK_OFFSET 4
240 1.1.8.2 martin
241 1.1.8.2 martin /* Autopush maximum rings per bank */
242 1.1.8.2 martin #define ETR_MAX_RINGS_PER_AP_BANK 32
243 1.1.8.2 martin
244 1.1.8.2 martin /* Maximum mailbox per acclerator */
245 1.1.8.2 martin #define ETR_MAX_MAILBOX_PER_ACCELERATOR 4
246 1.1.8.2 martin
247 1.1.8.2 martin /* Maximum AEs per mailbox */
248 1.1.8.2 martin #define ETR_MAX_AE_PER_MAILBOX 4
249 1.1.8.2 martin
250 1.1.8.2 martin /* Macro to get the ring's autopush bank number */
251 1.1.8.2 martin #define ETR_RING_AP_BANK_NUMBER(ring) ((ring) >> 5)
252 1.1.8.2 martin
253 1.1.8.2 martin /* Macro to get the ring's autopush mailbox number */
254 1.1.8.2 martin #define ETR_RING_AP_MAILBOX_NUMBER(ring) \
255 1.1.8.2 martin (ETR_RING_AP_BANK_NUMBER(ring) % ETR_MAX_MAILBOX_PER_ACCELERATOR)
256 1.1.8.2 martin
257 1.1.8.2 martin /* Macro to get the ring number in the autopush bank */
258 1.1.8.2 martin #define ETR_RING_NUMBER_IN_AP_BANK(ring) \
259 1.1.8.2 martin ((ring) % ETR_MAX_RINGS_PER_AP_BANK)
260 1.1.8.2 martin
261 1.1.8.2 martin #define ETR_RING_EMPTY_ENTRY_SIG (0x7F7F7F7F)
262 1.1.8.2 martin
263 1.1.8.2 martin /* -------------------------------------------------------------------------- */
264 1.1.8.2 martin /* CAP_GLOBAL_CTL region */
265 1.1.8.2 martin
266 1.1.8.2 martin #define FCU_CTRL 0x8c0
267 1.1.8.2 martin #define FCU_CTRL_CMD_NOOP 0
268 1.1.8.2 martin #define FCU_CTRL_CMD_AUTH 1
269 1.1.8.2 martin #define FCU_CTRL_CMD_LOAD 2
270 1.1.8.2 martin #define FCU_CTRL_CMD_START 3
271 1.1.8.2 martin #define FCU_CTRL_AE __BITS(8, 31)
272 1.1.8.2 martin
273 1.1.8.2 martin #define FCU_STATUS 0x8c4
274 1.1.8.2 martin #define FCU_STATUS_STS __BITS(0, 2)
275 1.1.8.2 martin #define FCU_STATUS_STS_NO 0
276 1.1.8.2 martin #define FCU_STATUS_STS_VERI_DONE 1
277 1.1.8.2 martin #define FCU_STATUS_STS_LOAD_DONE 2
278 1.1.8.2 martin #define FCU_STATUS_STS_VERI_FAIL 3
279 1.1.8.2 martin #define FCU_STATUS_STS_LOAD_FAIL 4
280 1.1.8.2 martin #define FCU_STATUS_STS_BUSY 5
281 1.1.8.2 martin #define FCU_STATUS_AUTHFWLD __BIT(8)
282 1.1.8.2 martin #define FCU_STATUS_DONE __BIT(9)
283 1.1.8.2 martin #define FCU_STATUS_LOADED_AE __BITS(22, 31)
284 1.1.8.2 martin
285 1.1.8.2 martin #define FCU_STATUS1 0x8c8
286 1.1.8.2 martin
287 1.1.8.2 martin #define FCU_DRAM_ADDR_LO 0x8cc
288 1.1.8.2 martin #define FCU_DRAM_ADDR_HI 0x8d0
289 1.1.8.2 martin #define FCU_RAMBASE_ADDR_HI 0x8d4
290 1.1.8.2 martin #define FCU_RAMBASE_ADDR_LO 0x8d8
291 1.1.8.2 martin
292 1.1.8.2 martin #define FW_AUTH_WAIT_PERIOD 10
293 1.1.8.2 martin #define FW_AUTH_MAX_RETRY 300
294 1.1.8.2 martin
295 1.1.8.2 martin #define CAP_GLOBAL_CTL_BASE 0xa00
296 1.1.8.2 martin #define CAP_GLOBAL_CTL_MISC CAP_GLOBAL_CTL_BASE + 0x04
297 1.1.8.2 martin #define CAP_GLOBAL_CTL_MISC_TIMESTAMP_EN __BIT(7)
298 1.1.8.2 martin #define CAP_GLOBAL_CTL_RESET CAP_GLOBAL_CTL_BASE + 0x0c
299 1.1.8.2 martin #define CAP_GLOBAL_CTL_RESET_MASK __BITS(31, 26)
300 1.1.8.2 martin #define CAP_GLOBAL_CTL_RESET_ACCEL_MASK __BITS(25, 20)
301 1.1.8.2 martin #define CAP_GLOBAL_CTL_RESET_AE_MASK __BITS(19, 0)
302 1.1.8.2 martin #define CAP_GLOBAL_CTL_CLK_EN CAP_GLOBAL_CTL_BASE + 0x50
303 1.1.8.2 martin #define CAP_GLOBAL_CTL_CLK_EN_ACCEL_MASK __BITS(25, 20)
304 1.1.8.2 martin #define CAP_GLOBAL_CTL_CLK_EN_AE_MASK __BITS(19, 0)
305 1.1.8.2 martin
306 1.1.8.2 martin /* -------------------------------------------------------------------------- */
307 1.1.8.2 martin /* AE region */
308 1.1.8.2 martin #define UPC_MASK 0x1ffff
309 1.1.8.2 martin #define USTORE_SIZE QAT_16K
310 1.1.8.2 martin
311 1.1.8.2 martin #define AE_LOCAL_AE_MASK __BITS(31, 12)
312 1.1.8.2 martin #define AE_LOCAL_CSR_MASK __BITS(9, 0)
313 1.1.8.2 martin
314 1.1.8.2 martin /* AE_LOCAL registers */
315 1.1.8.2 martin /* Control Store Address Register */
316 1.1.8.2 martin #define USTORE_ADDRESS 0x000
317 1.1.8.2 martin #define USTORE_ADDRESS_ECS __BIT(31)
318 1.1.8.2 martin
319 1.1.8.2 martin #define USTORE_ECC_BIT_0 44
320 1.1.8.2 martin #define USTORE_ECC_BIT_1 45
321 1.1.8.2 martin #define USTORE_ECC_BIT_2 46
322 1.1.8.2 martin #define USTORE_ECC_BIT_3 47
323 1.1.8.2 martin #define USTORE_ECC_BIT_4 48
324 1.1.8.2 martin #define USTORE_ECC_BIT_5 49
325 1.1.8.2 martin #define USTORE_ECC_BIT_6 50
326 1.1.8.2 martin
327 1.1.8.2 martin /* Control Store Data Lower Register */
328 1.1.8.2 martin #define USTORE_DATA_LOWER 0x004
329 1.1.8.2 martin /* Control Store Data Upper Register */
330 1.1.8.2 martin #define USTORE_DATA_UPPER 0x008
331 1.1.8.2 martin /* Control Store Error Status Register */
332 1.1.8.2 martin #define USTORE_ERROR_STATUS 0x00c
333 1.1.8.2 martin /* Arithmetic Logic Unit Output Register */
334 1.1.8.2 martin #define ALU_OUT 0x010
335 1.1.8.2 martin /* Context Arbiter Control Register */
336 1.1.8.2 martin #define CTX_ARB_CNTL 0x014
337 1.1.8.2 martin #define CTX_ARB_CNTL_INIT 0x00000000
338 1.1.8.2 martin /* Context Enables Register */
339 1.1.8.2 martin #define CTX_ENABLES 0x018
340 1.1.8.2 martin #define CTX_ENABLES_INIT 0
341 1.1.8.2 martin #define CTX_ENABLES_INUSE_CONTEXTS __BIT(31)
342 1.1.8.2 martin #define CTX_ENABLES_CNTL_STORE_PARITY_ERROR __BIT(29)
343 1.1.8.2 martin #define CTX_ENABLES_CNTL_STORE_PARITY_ENABLE __BIT(28)
344 1.1.8.2 martin #define CTX_ENABLES_BREAKPOINT __BIT(27)
345 1.1.8.2 martin #define CTX_ENABLES_PAR_ERR __BIT(25)
346 1.1.8.2 martin #define CTX_ENABLES_NN_MODE __BIT(20)
347 1.1.8.2 martin #define CTX_ENABLES_NN_RING_EMPTY __BIT(18)
348 1.1.8.2 martin #define CTX_ENABLES_LMADDR_1_GLOBAL __BIT(17)
349 1.1.8.2 martin #define CTX_ENABLES_LMADDR_0_GLOBAL __BIT(16)
350 1.1.8.2 martin #define CTX_ENABLES_ENABLE __BITS(15,8)
351 1.1.8.2 martin
352 1.1.8.2 martin #define CTX_ENABLES_IGNORE_W1C_MASK \
353 1.1.8.2 martin (~(CTX_ENABLES_PAR_ERR | \
354 1.1.8.2 martin CTX_ENABLES_BREAKPOINT | \
355 1.1.8.2 martin CTX_ENABLES_CNTL_STORE_PARITY_ERROR))
356 1.1.8.2 martin
357 1.1.8.2 martin /* cycles from CTX_ENABLE high to CTX entering executing state */
358 1.1.8.2 martin #define CYCLES_FROM_READY2EXE 8
359 1.1.8.2 martin
360 1.1.8.2 martin /* Condition Code Enable Register */
361 1.1.8.2 martin #define CC_ENABLE 0x01c
362 1.1.8.2 martin #define CC_ENABLE_INIT 0x2000
363 1.1.8.2 martin
364 1.1.8.2 martin /* CSR Context Pointer Register */
365 1.1.8.2 martin #define CSR_CTX_POINTER 0x020
366 1.1.8.2 martin #define CSR_CTX_POINTER_CONTEXT __BITS(2,0)
367 1.1.8.2 martin /* Register Error Status Register */
368 1.1.8.2 martin #define REG_ERROR_STATUS 0x030
369 1.1.8.2 martin /* Indirect Context Status Register */
370 1.1.8.2 martin #define CTX_STS_INDIRECT 0x040
371 1.1.8.2 martin #define CTX_STS_INDIRECT_UPC_INIT 0x00000000
372 1.1.8.2 martin
373 1.1.8.2 martin /* Active Context Status Register */
374 1.1.8.2 martin #define ACTIVE_CTX_STATUS 0x044
375 1.1.8.2 martin #define ACTIVE_CTX_STATUS_ABO __BIT(31)
376 1.1.8.2 martin #define ACTIVE_CTX_STATUS_ACNO __BITS(0, 2)
377 1.1.8.2 martin /* Indirect Context Signal Events Register */
378 1.1.8.2 martin #define CTX_SIG_EVENTS_INDIRECT 0x048
379 1.1.8.2 martin #define CTX_SIG_EVENTS_INDIRECT_INIT 0x00000001
380 1.1.8.2 martin /* Active Context Signal Events Register */
381 1.1.8.2 martin #define CTX_SIG_EVENTS_ACTIVE 0x04c
382 1.1.8.2 martin /* Indirect Context Wakeup Events Register */
383 1.1.8.2 martin #define CTX_WAKEUP_EVENTS_INDIRECT 0x050
384 1.1.8.2 martin #define CTX_WAKEUP_EVENTS_INDIRECT_VOLUNTARY 0x00000001
385 1.1.8.2 martin #define CTX_WAKEUP_EVENTS_INDIRECT_SLEEP 0x00010000
386 1.1.8.2 martin
387 1.1.8.2 martin #define CTX_WAKEUP_EVENTS_INDIRECT_INIT 0x00000001
388 1.1.8.2 martin
389 1.1.8.2 martin /* Active Context Wakeup Events Register */
390 1.1.8.2 martin #define CTX_WAKEUP_EVENTS_ACTIVE 0x054
391 1.1.8.2 martin /* Indirect Context Future Count Register */
392 1.1.8.2 martin #define CTX_FUTURE_COUNT_INDIRECT 0x058
393 1.1.8.2 martin /* Active Context Future Count Register */
394 1.1.8.2 martin #define CTX_FUTURE_COUNT_ACTIVE 0x05c
395 1.1.8.2 martin /* Indirect Local Memory Address 0 Register */
396 1.1.8.2 martin #define LM_ADDR_0_INDIRECT 0x060
397 1.1.8.2 martin /* Active Local Memory Address 0 Register */
398 1.1.8.2 martin #define LM_ADDR_0_ACTIVE 0x064
399 1.1.8.2 martin /* Indirect Local Memory Address 1 Register */
400 1.1.8.2 martin #define LM_ADDR_1_INDIRECT 0x068
401 1.1.8.2 martin /* Active Local Memory Address 1 Register */
402 1.1.8.2 martin #define LM_ADDR_1_ACTIVE 0x06c
403 1.1.8.2 martin /* Byte Index Register */
404 1.1.8.2 martin #define BYTE_INDEX 0x070
405 1.1.8.2 martin /* Indirect Local Memory Address 0 Byte Index Register */
406 1.1.8.2 martin #define INDIRECT_LM_ADDR_0_BYTE_INDEX 0x0e0
407 1.1.8.2 martin /* Active Local Memory Address 0 Byte Index Register */
408 1.1.8.2 martin #define ACTIVE_LM_ADDR_0_BYTE_INDEX 0x0e4
409 1.1.8.2 martin /* Indirect Local Memory Address 1 Byte Index Register */
410 1.1.8.2 martin #define INDIRECT_LM_ADDR_1_BYTE_INDEX 0x0e8
411 1.1.8.2 martin /* Active Local Memory Address 1 Byte Index Register */
412 1.1.8.2 martin #define ACTIVE_LM_ADDR_1_BYTE_INDEX 0x0ec
413 1.1.8.2 martin /* Transfer Index Concatenated with Byte Index Register */
414 1.1.8.2 martin #define T_INDEX_BYTE_INDEX 0x0f4
415 1.1.8.2 martin /* Transfer Index Register */
416 1.1.8.2 martin #define T_INDEX 0x074
417 1.1.8.2 martin /* Indirect Future Count Signal Signal Register */
418 1.1.8.2 martin #define FUTURE_COUNT_SIGNAL_INDIRECT 0x078
419 1.1.8.2 martin /* Active Context Future Count Register */
420 1.1.8.2 martin #define FUTURE_COUNT_SIGNAL_ACTIVE 0x07c
421 1.1.8.2 martin /* Next Neighbor Put Register */
422 1.1.8.2 martin #define NN_PUT 0x080
423 1.1.8.2 martin /* Next Neighbor Get Register */
424 1.1.8.2 martin #define NN_GET 0x084
425 1.1.8.2 martin /* Timestamp Low Register */
426 1.1.8.2 martin #define TIMESTAMP_LOW 0x0c0
427 1.1.8.2 martin /* Timestamp High Register */
428 1.1.8.2 martin #define TIMESTAMP_HIGH 0x0c4
429 1.1.8.2 martin /* Next Neighbor Signal Register */
430 1.1.8.2 martin #define NEXT_NEIGHBOR_SIGNAL 0x100
431 1.1.8.2 martin /* Previous Neighbor Signal Register */
432 1.1.8.2 martin #define PREV_NEIGHBOR_SIGNAL 0x104
433 1.1.8.2 martin /* Same AccelEngine Signal Register */
434 1.1.8.2 martin #define SAME_AE_SIGNAL 0x108
435 1.1.8.2 martin /* Cyclic Redundancy Check Remainder Register */
436 1.1.8.2 martin #define CRC_REMAINDER 0x140
437 1.1.8.2 martin /* Profile Count Register */
438 1.1.8.2 martin #define PROFILE_COUNT 0x144
439 1.1.8.2 martin /* Pseudorandom Number Register */
440 1.1.8.2 martin #define PSEUDO_RANDOM_NUMBER 0x148
441 1.1.8.2 martin /* Signature Enable Register */
442 1.1.8.2 martin #define SIGNATURE_ENABLE 0x150
443 1.1.8.2 martin /* Miscellaneous Control Register */
444 1.1.8.2 martin #define AE_MISC_CONTROL 0x160
445 1.1.8.2 martin #define AE_MISC_CONTROL_PARITY_ENABLE __BIT(24)
446 1.1.8.2 martin #define AE_MISC_CONTROL_FORCE_BAD_PARITY __BIT(23)
447 1.1.8.2 martin #define AE_MISC_CONTROL_ONE_CTX_RELOAD __BIT(22)
448 1.1.8.2 martin #define AE_MISC_CONTROL_CS_RELOAD __BITS(21, 20)
449 1.1.8.2 martin #define AE_MISC_CONTROL_SHARE_CS __BIT(2)
450 1.1.8.2 martin /* Control Store Address 1 Register */
451 1.1.8.2 martin #define USTORE_ADDRESS1 0x158
452 1.1.8.2 martin /* Local CSR Status Register */
453 1.1.8.2 martin #define LOCAL_CSR_STATUS 0x180
454 1.1.8.2 martin #define LOCAL_CSR_STATUS_STATUS 0x1
455 1.1.8.2 martin /* NULL Register */
456 1.1.8.2 martin #define NULL_CSR 0x3fc
457 1.1.8.2 martin
458 1.1.8.2 martin /* AE_XFER macros */
459 1.1.8.2 martin #define AE_XFER_AE_MASK __BITS(31, 12)
460 1.1.8.2 martin #define AE_XFER_CSR_MASK __BITS(9, 2)
461 1.1.8.2 martin
462 1.1.8.2 martin #define AEREG_BAD_REGADDR 0xffff /* bad register address */
463 1.1.8.2 martin
464 1.1.8.2 martin /* -------------------------------------------------------------------------- */
465 1.1.8.2 martin
466 1.1.8.2 martin #define SSMWDT(i) ((i) * 0x4000 + 0x54)
467 1.1.8.2 martin #define SSMWDTPKE(i) ((i) * 0x4000 + 0x58)
468 1.1.8.2 martin #define INTSTATSSM(i) ((i) * 0x4000 + 0x04)
469 1.1.8.2 martin #define INTSTATSSM_SHANGERR __BIT(13)
470 1.1.8.2 martin #define PPERR(i) ((i) * 0x4000 + 0x08)
471 1.1.8.2 martin #define PPERRID(i) ((i) * 0x4000 + 0x0C)
472 1.1.8.2 martin #define CERRSSMSH(i) ((i) * 0x4000 + 0x10)
473 1.1.8.2 martin #define UERRSSMSH(i) ((i) * 0x4000 + 0x18)
474 1.1.8.2 martin #define UERRSSMSHAD(i) ((i) * 0x4000 + 0x1C)
475 1.1.8.2 martin #define SLICEHANGSTATUS(i) ((i) * 0x4000 + 0x4C)
476 1.1.8.2 martin #define SLICE_HANG_AUTH0_MASK __BIT(0)
477 1.1.8.2 martin #define SLICE_HANG_AUTH1_MASK __BIT(1)
478 1.1.8.2 martin #define SLICE_HANG_CPHR0_MASK __BIT(4)
479 1.1.8.2 martin #define SLICE_HANG_CPHR1_MASK __BIT(5)
480 1.1.8.2 martin #define SLICE_HANG_CMP0_MASK __BIT(8)
481 1.1.8.2 martin #define SLICE_HANG_CMP1_MASK __BIT(9)
482 1.1.8.2 martin #define SLICE_HANG_XLT0_MASK __BIT(12)
483 1.1.8.2 martin #define SLICE_HANG_XLT1_MASK __BIT(13)
484 1.1.8.2 martin #define SLICE_HANG_MMP0_MASK __BIT(16)
485 1.1.8.2 martin #define SLICE_HANG_MMP1_MASK __BIT(17)
486 1.1.8.2 martin #define SLICE_HANG_MMP2_MASK __BIT(18)
487 1.1.8.2 martin #define SLICE_HANG_MMP3_MASK __BIT(19)
488 1.1.8.2 martin #define SLICE_HANG_MMP4_MASK __BIT(20)
489 1.1.8.2 martin
490 1.1.8.2 martin #define SHINTMASKSSM(i) ((i) * 0x4000 + 0x1018)
491 1.1.8.2 martin #define ENABLE_SLICE_HANG 0x000000
492 1.1.8.2 martin #define MAX_MMP (5)
493 1.1.8.2 martin #define MMP_BASE(i) ((i) * 0x1000 % 0x3800)
494 1.1.8.2 martin #define CERRSSMMMP(i, n) ((i) * 0x4000 + MMP_BASE(n) + 0x380)
495 1.1.8.2 martin #define UERRSSMMMP(i, n) ((i) * 0x4000 + MMP_BASE(n) + 0x388)
496 1.1.8.2 martin #define UERRSSMMMPAD(i, n) ((i) * 0x4000 + MMP_BASE(n) + 0x38C)
497 1.1.8.2 martin
498 1.1.8.2 martin #define CPP_CFC_ERR_STATUS (0x30000 + 0xC04)
499 1.1.8.2 martin #define CPP_CFC_ERR_PPID (0x30000 + 0xC08)
500 1.1.8.2 martin
501 1.1.8.2 martin #define ERRSOU0 (0x3A000 + 0x00)
502 1.1.8.2 martin #define ERRSOU1 (0x3A000 + 0x04)
503 1.1.8.2 martin #define ERRSOU2 (0x3A000 + 0x08)
504 1.1.8.2 martin #define ERRSOU3 (0x3A000 + 0x0C)
505 1.1.8.2 martin #define ERRSOU4 (0x3A000 + 0xD0)
506 1.1.8.2 martin #define ERRSOU5 (0x3A000 + 0xD8)
507 1.1.8.2 martin #define ERRMSK0 (0x3A000 + 0x10)
508 1.1.8.2 martin #define ERRMSK1 (0x3A000 + 0x14)
509 1.1.8.2 martin #define ERRMSK2 (0x3A000 + 0x18)
510 1.1.8.2 martin #define ERRMSK3 (0x3A000 + 0x1C)
511 1.1.8.2 martin #define ERRMSK4 (0x3A000 + 0xD4)
512 1.1.8.2 martin #define ERRMSK5 (0x3A000 + 0xDC)
513 1.1.8.2 martin #define EMSK3_CPM0_MASK __BIT(2)
514 1.1.8.2 martin #define EMSK3_CPM1_MASK __BIT(3)
515 1.1.8.2 martin #define EMSK5_CPM2_MASK __BIT(16)
516 1.1.8.2 martin #define EMSK5_CPM3_MASK __BIT(17)
517 1.1.8.2 martin #define EMSK5_CPM4_MASK __BIT(18)
518 1.1.8.2 martin #define RICPPINTSTS (0x3A000 + 0x114)
519 1.1.8.2 martin #define RIERRPUSHID (0x3A000 + 0x118)
520 1.1.8.2 martin #define RIERRPULLID (0x3A000 + 0x11C)
521 1.1.8.2 martin
522 1.1.8.2 martin #define TICPPINTSTS (0x3A400 + 0x13C)
523 1.1.8.2 martin #define TIERRPUSHID (0x3A400 + 0x140)
524 1.1.8.2 martin #define TIERRPULLID (0x3A400 + 0x144)
525 1.1.8.2 martin #define SECRAMUERR (0x3AC00 + 0x04)
526 1.1.8.2 martin #define SECRAMUERRAD (0x3AC00 + 0x0C)
527 1.1.8.2 martin #define CPPMEMTGTERR (0x3AC00 + 0x10)
528 1.1.8.2 martin #define ERRPPID (0x3AC00 + 0x14)
529 1.1.8.2 martin
530 1.1.8.2 martin #define ADMINMSGUR 0x3a574
531 1.1.8.2 martin #define ADMINMSGLR 0x3a578
532 1.1.8.2 martin #define MAILBOX_BASE 0x20970
533 1.1.8.2 martin #define MAILBOX_STRIDE 0x1000
534 1.1.8.2 martin #define ADMINMSG_LEN 32
535 1.1.8.2 martin
536 1.1.8.2 martin /* -------------------------------------------------------------------------- */
537 1.1.8.2 martin static const uint8_t mailbox_const_tab[1024] __aligned(1024) = {
538 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
539 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
540 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
541 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
542 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
543 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
544 1.1.8.2 martin 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00,
545 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
546 1.1.8.2 martin 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
547 1.1.8.2 martin 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01,
548 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
549 1.1.8.2 martin 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00,
550 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13,
551 1.1.8.2 martin 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00,
552 1.1.8.2 martin 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
553 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
554 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
555 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
556 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
557 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
558 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
559 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
560 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
561 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
562 1.1.8.2 martin 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76,
563 1.1.8.2 martin 0x54, 0x32, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
564 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab,
565 1.1.8.2 martin 0x89, 0x98, 0xba, 0xdc, 0xfe, 0x10, 0x32, 0x54, 0x76, 0xc3, 0xd2, 0xe1, 0xf0,
566 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
567 1.1.8.2 martin 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
568 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x05, 0x9e,
569 1.1.8.2 martin 0xd8, 0x36, 0x7c, 0xd5, 0x07, 0x30, 0x70, 0xdd, 0x17, 0xf7, 0x0e, 0x59, 0x39,
570 1.1.8.2 martin 0xff, 0xc0, 0x0b, 0x31, 0x68, 0x58, 0x15, 0x11, 0x64, 0xf9, 0x8f, 0xa7, 0xbe,
571 1.1.8.2 martin 0xfa, 0x4f, 0xa4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
572 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x09, 0xe6, 0x67, 0xbb, 0x67, 0xae,
573 1.1.8.2 martin 0x85, 0x3c, 0x6e, 0xf3, 0x72, 0xa5, 0x4f, 0xf5, 0x3a, 0x51, 0x0e, 0x52, 0x7f,
574 1.1.8.2 martin 0x9b, 0x05, 0x68, 0x8c, 0x1f, 0x83, 0xd9, 0xab, 0x5b, 0xe0, 0xcd, 0x19, 0x05,
575 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
576 1.1.8.2 martin 0x00, 0x00, 0xcb, 0xbb, 0x9d, 0x5d, 0xc1, 0x05, 0x9e, 0xd8, 0x62, 0x9a, 0x29,
577 1.1.8.2 martin 0x2a, 0x36, 0x7c, 0xd5, 0x07, 0x91, 0x59, 0x01, 0x5a, 0x30, 0x70, 0xdd, 0x17,
578 1.1.8.2 martin 0x15, 0x2f, 0xec, 0xd8, 0xf7, 0x0e, 0x59, 0x39, 0x67, 0x33, 0x26, 0x67, 0xff,
579 1.1.8.2 martin 0xc0, 0x0b, 0x31, 0x8e, 0xb4, 0x4a, 0x87, 0x68, 0x58, 0x15, 0x11, 0xdb, 0x0c,
580 1.1.8.2 martin 0x2e, 0x0d, 0x64, 0xf9, 0x8f, 0xa7, 0x47, 0xb5, 0x48, 0x1d, 0xbe, 0xfa, 0x4f,
581 1.1.8.2 martin 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
582 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x6a, 0x09, 0xe6, 0x67, 0xf3, 0xbc, 0xc9, 0x08, 0xbb,
583 1.1.8.2 martin 0x67, 0xae, 0x85, 0x84, 0xca, 0xa7, 0x3b, 0x3c, 0x6e, 0xf3, 0x72, 0xfe, 0x94,
584 1.1.8.2 martin 0xf8, 0x2b, 0xa5, 0x4f, 0xf5, 0x3a, 0x5f, 0x1d, 0x36, 0xf1, 0x51, 0x0e, 0x52,
585 1.1.8.2 martin 0x7f, 0xad, 0xe6, 0x82, 0xd1, 0x9b, 0x05, 0x68, 0x8c, 0x2b, 0x3e, 0x6c, 0x1f,
586 1.1.8.2 martin 0x1f, 0x83, 0xd9, 0xab, 0xfb, 0x41, 0xbd, 0x6b, 0x5b, 0xe0, 0xcd, 0x19, 0x13,
587 1.1.8.2 martin 0x7e, 0x21, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
588 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
589 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
590 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
591 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
592 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
593 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
594 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
595 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
596 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
597 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
598 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
599 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
600 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
601 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
602 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
603 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
604 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
605 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
606 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
607 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
608 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
609 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
611 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
612 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
613 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
614 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
615 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
616 1.1.8.2 martin 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
617 1.1.8.2 martin
618 1.1.8.2 martin /* -------------------------------------------------------------------------- */
619 1.1.8.2 martin /* Microcode */
620 1.1.8.2 martin
621 1.1.8.2 martin /* Clear GPR of AE */
622 1.1.8.2 martin static const uint64_t ae_clear_gprs_inst[] = {
623 1.1.8.2 martin 0x0F0000C0000ull, /* .0 l0000!val = 0 ; immed[l0000!val, 0x0] */
624 1.1.8.2 martin 0x0F000000380ull, /* .1 l0000!count = 128 ; immed[l0000!count, 0x80] */
625 1.1.8.2 martin 0x0D805000011ull, /* .2 br!=ctx[0, ctx_init#] */
626 1.1.8.2 martin 0x0FC082C0300ull, /* .3 local_csr_wr[nn_put, 0] */
627 1.1.8.2 martin 0x0F0000C0300ull, /* .4 nop */
628 1.1.8.2 martin 0x0F0000C0300ull, /* .5 nop */
629 1.1.8.2 martin 0x0F0000C0300ull, /* .6 nop */
630 1.1.8.2 martin 0x0F0000C0300ull, /* .7 nop */
631 1.1.8.2 martin 0x0A0643C0000ull, /* .8 init_nn#:alu[*n$index++, --, b, l0000!val] */
632 1.1.8.2 martin 0x0BAC0000301ull, /* .9 alu[l0000!count, l0000!count, -, 1] */
633 1.1.8.2 martin 0x0D802000101ull, /* .10 bne[init_nn#] */
634 1.1.8.2 martin 0x0F0000C0001ull, /* .11 l0000!indx = 0 ; immed[l0000!indx, 0x0] */
635 1.1.8.2 martin 0x0FC066C0001ull, /* .12 local_csr_wr[active_lm_addr_0, l0000!indx];
636 1.1.8.2 martin * put indx to lm_addr */
637 1.1.8.2 martin 0x0F0000C0300ull, /* .13 nop */
638 1.1.8.2 martin 0x0F0000C0300ull, /* .14 nop */
639 1.1.8.2 martin 0x0F0000C0300ull, /* .15 nop */
640 1.1.8.2 martin 0x0F000400300ull, /* .16 l0000!count = 1024 ; immed[l0000!count, 0x400] */
641 1.1.8.2 martin 0x0A0610C0000ull, /* .17 init_lm#:alu[*l$index0++, --, b, l0000!val] */
642 1.1.8.2 martin 0x0BAC0000301ull, /* .18 alu[l0000!count, l0000!count, -, 1] */
643 1.1.8.2 martin 0x0D804400101ull, /* .19 bne[init_lm#] */
644 1.1.8.2 martin 0x0A0580C0000ull, /* .20 ctx_init#:alu[$l0000!xfers[0], --, b, l0000!val] */
645 1.1.8.2 martin 0x0A0581C0000ull, /* .21 alu[$l0000!xfers[1], --, b, l0000!val] */
646 1.1.8.2 martin 0x0A0582C0000ull, /* .22 alu[$l0000!xfers[2], --, b, l0000!val] */
647 1.1.8.2 martin 0x0A0583C0000ull, /* .23 alu[$l0000!xfers[3], --, b, l0000!val] */
648 1.1.8.2 martin 0x0A0584C0000ull, /* .24 alu[$l0000!xfers[4], --, b, l0000!val] */
649 1.1.8.2 martin 0x0A0585C0000ull, /* .25 alu[$l0000!xfers[5], --, b, l0000!val] */
650 1.1.8.2 martin 0x0A0586C0000ull, /* .26 alu[$l0000!xfers[6], --, b, l0000!val] */
651 1.1.8.2 martin 0x0A0587C0000ull, /* .27 alu[$l0000!xfers[7], --, b, l0000!val] */
652 1.1.8.2 martin 0x0A0588C0000ull, /* .28 alu[$l0000!xfers[8], --, b, l0000!val] */
653 1.1.8.2 martin 0x0A0589C0000ull, /* .29 alu[$l0000!xfers[9], --, b, l0000!val] */
654 1.1.8.2 martin 0x0A058AC0000ull, /* .30 alu[$l0000!xfers[10], --, b, l0000!val] */
655 1.1.8.2 martin 0x0A058BC0000ull, /* .31 alu[$l0000!xfers[11], --, b, l0000!val] */
656 1.1.8.2 martin 0x0A058CC0000ull, /* .32 alu[$l0000!xfers[12], --, b, l0000!val] */
657 1.1.8.2 martin 0x0A058DC0000ull, /* .33 alu[$l0000!xfers[13], --, b, l0000!val] */
658 1.1.8.2 martin 0x0A058EC0000ull, /* .34 alu[$l0000!xfers[14], --, b, l0000!val] */
659 1.1.8.2 martin 0x0A058FC0000ull, /* .35 alu[$l0000!xfers[15], --, b, l0000!val] */
660 1.1.8.2 martin 0x0A05C0C0000ull, /* .36 alu[$l0000!xfers[16], --, b, l0000!val] */
661 1.1.8.2 martin 0x0A05C1C0000ull, /* .37 alu[$l0000!xfers[17], --, b, l0000!val] */
662 1.1.8.2 martin 0x0A05C2C0000ull, /* .38 alu[$l0000!xfers[18], --, b, l0000!val] */
663 1.1.8.2 martin 0x0A05C3C0000ull, /* .39 alu[$l0000!xfers[19], --, b, l0000!val] */
664 1.1.8.2 martin 0x0A05C4C0000ull, /* .40 alu[$l0000!xfers[20], --, b, l0000!val] */
665 1.1.8.2 martin 0x0A05C5C0000ull, /* .41 alu[$l0000!xfers[21], --, b, l0000!val] */
666 1.1.8.2 martin 0x0A05C6C0000ull, /* .42 alu[$l0000!xfers[22], --, b, l0000!val] */
667 1.1.8.2 martin 0x0A05C7C0000ull, /* .43 alu[$l0000!xfers[23], --, b, l0000!val] */
668 1.1.8.2 martin 0x0A05C8C0000ull, /* .44 alu[$l0000!xfers[24], --, b, l0000!val] */
669 1.1.8.2 martin 0x0A05C9C0000ull, /* .45 alu[$l0000!xfers[25], --, b, l0000!val] */
670 1.1.8.2 martin 0x0A05CAC0000ull, /* .46 alu[$l0000!xfers[26], --, b, l0000!val] */
671 1.1.8.2 martin 0x0A05CBC0000ull, /* .47 alu[$l0000!xfers[27], --, b, l0000!val] */
672 1.1.8.2 martin 0x0A05CCC0000ull, /* .48 alu[$l0000!xfers[28], --, b, l0000!val] */
673 1.1.8.2 martin 0x0A05CDC0000ull, /* .49 alu[$l0000!xfers[29], --, b, l0000!val] */
674 1.1.8.2 martin 0x0A05CEC0000ull, /* .50 alu[$l0000!xfers[30], --, b, l0000!val] */
675 1.1.8.2 martin 0x0A05CFC0000ull, /* .51 alu[$l0000!xfers[31], --, b, l0000!val] */
676 1.1.8.2 martin 0x0A0400C0000ull, /* .52 alu[l0000!gprega[0], --, b, l0000!val] */
677 1.1.8.2 martin 0x0B0400C0000ull, /* .53 alu[l0000!gpregb[0], --, b, l0000!val] */
678 1.1.8.2 martin 0x0A0401C0000ull, /* .54 alu[l0000!gprega[1], --, b, l0000!val] */
679 1.1.8.2 martin 0x0B0401C0000ull, /* .55 alu[l0000!gpregb[1], --, b, l0000!val] */
680 1.1.8.2 martin 0x0A0402C0000ull, /* .56 alu[l0000!gprega[2], --, b, l0000!val] */
681 1.1.8.2 martin 0x0B0402C0000ull, /* .57 alu[l0000!gpregb[2], --, b, l0000!val] */
682 1.1.8.2 martin 0x0A0403C0000ull, /* .58 alu[l0000!gprega[3], --, b, l0000!val] */
683 1.1.8.2 martin 0x0B0403C0000ull, /* .59 alu[l0000!gpregb[3], --, b, l0000!val] */
684 1.1.8.2 martin 0x0A0404C0000ull, /* .60 alu[l0000!gprega[4], --, b, l0000!val] */
685 1.1.8.2 martin 0x0B0404C0000ull, /* .61 alu[l0000!gpregb[4], --, b, l0000!val] */
686 1.1.8.2 martin 0x0A0405C0000ull, /* .62 alu[l0000!gprega[5], --, b, l0000!val] */
687 1.1.8.2 martin 0x0B0405C0000ull, /* .63 alu[l0000!gpregb[5], --, b, l0000!val] */
688 1.1.8.2 martin 0x0A0406C0000ull, /* .64 alu[l0000!gprega[6], --, b, l0000!val] */
689 1.1.8.2 martin 0x0B0406C0000ull, /* .65 alu[l0000!gpregb[6], --, b, l0000!val] */
690 1.1.8.2 martin 0x0A0407C0000ull, /* .66 alu[l0000!gprega[7], --, b, l0000!val] */
691 1.1.8.2 martin 0x0B0407C0000ull, /* .67 alu[l0000!gpregb[7], --, b, l0000!val] */
692 1.1.8.2 martin 0x0A0408C0000ull, /* .68 alu[l0000!gprega[8], --, b, l0000!val] */
693 1.1.8.2 martin 0x0B0408C0000ull, /* .69 alu[l0000!gpregb[8], --, b, l0000!val] */
694 1.1.8.2 martin 0x0A0409C0000ull, /* .70 alu[l0000!gprega[9], --, b, l0000!val] */
695 1.1.8.2 martin 0x0B0409C0000ull, /* .71 alu[l0000!gpregb[9], --, b, l0000!val] */
696 1.1.8.2 martin 0x0A040AC0000ull, /* .72 alu[l0000!gprega[10], --, b, l0000!val] */
697 1.1.8.2 martin 0x0B040AC0000ull, /* .73 alu[l0000!gpregb[10], --, b, l0000!val] */
698 1.1.8.2 martin 0x0A040BC0000ull, /* .74 alu[l0000!gprega[11], --, b, l0000!val] */
699 1.1.8.2 martin 0x0B040BC0000ull, /* .75 alu[l0000!gpregb[11], --, b, l0000!val] */
700 1.1.8.2 martin 0x0A040CC0000ull, /* .76 alu[l0000!gprega[12], --, b, l0000!val] */
701 1.1.8.2 martin 0x0B040CC0000ull, /* .77 alu[l0000!gpregb[12], --, b, l0000!val] */
702 1.1.8.2 martin 0x0A040DC0000ull, /* .78 alu[l0000!gprega[13], --, b, l0000!val] */
703 1.1.8.2 martin 0x0B040DC0000ull, /* .79 alu[l0000!gpregb[13], --, b, l0000!val] */
704 1.1.8.2 martin 0x0A040EC0000ull, /* .80 alu[l0000!gprega[14], --, b, l0000!val] */
705 1.1.8.2 martin 0x0B040EC0000ull, /* .81 alu[l0000!gpregb[14], --, b, l0000!val] */
706 1.1.8.2 martin 0x0A040FC0000ull, /* .82 alu[l0000!gprega[15], --, b, l0000!val] */
707 1.1.8.2 martin 0x0B040FC0000ull, /* .83 alu[l0000!gpregb[15], --, b, l0000!val] */
708 1.1.8.2 martin 0x0D81581C010ull, /* .84 br=ctx[7, exit#] */
709 1.1.8.2 martin 0x0E000010000ull, /* .85 ctx_arb[kill], any */
710 1.1.8.2 martin 0x0E000010000ull, /* .86 exit#:ctx_arb[kill], any */
711 1.1.8.2 martin };
712 1.1.8.2 martin
713 1.1.8.2 martin static const uint64_t ae_inst_4b[] = {
714 1.1.8.2 martin 0x0F0400C0000ull, /* .0 immed_w0[l0000!indx, 0] */
715 1.1.8.2 martin 0x0F4400C0000ull, /* .1 immed_w1[l0000!indx, 0] */
716 1.1.8.2 martin 0x0F040000300ull, /* .2 immed_w0[l0000!myvalue, 0x0] */
717 1.1.8.2 martin 0x0F440000300ull, /* .3 immed_w1[l0000!myvalue, 0x0] */
718 1.1.8.2 martin 0x0FC066C0000ull, /* .4 local_csr_wr[active_lm_addr_0,
719 1.1.8.2 martin l0000!indx]; put indx to lm_addr */
720 1.1.8.2 martin 0x0F0000C0300ull, /* .5 nop */
721 1.1.8.2 martin 0x0F0000C0300ull, /* .6 nop */
722 1.1.8.2 martin 0x0F0000C0300ull, /* .7 nop */
723 1.1.8.2 martin 0x0A021000000ull, /* .8 alu[*l$index0++, --, b, l0000!myvalue] */
724 1.1.8.2 martin };
725 1.1.8.2 martin
726 1.1.8.2 martin static const uint64_t ae_inst_1b[] = {
727 1.1.8.2 martin 0x0F0400C0000ull, /* .0 immed_w0[l0000!indx, 0] */
728 1.1.8.2 martin 0x0F4400C0000ull, /* .1 immed_w1[l0000!indx, 0] */
729 1.1.8.2 martin 0x0F040000300ull, /* .2 immed_w0[l0000!myvalue, 0x0] */
730 1.1.8.2 martin 0x0F440000300ull, /* .3 immed_w1[l0000!myvalue, 0x0] */
731 1.1.8.2 martin 0x0FC066C0000ull, /* .4 local_csr_wr[active_lm_addr_0,
732 1.1.8.2 martin l0000!indx]; put indx to lm_addr */
733 1.1.8.2 martin 0x0F0000C0300ull, /* .5 nop */
734 1.1.8.2 martin 0x0F0000C0300ull, /* .6 nop */
735 1.1.8.2 martin 0x0F0000C0300ull, /* .7 nop */
736 1.1.8.2 martin 0x0A000180000ull, /* .8 alu[l0000!val, --, b, *l$index0] */
737 1.1.8.2 martin 0x09080000200ull, /* .9 alu_shf[l0000!myvalue, --, b,
738 1.1.8.2 martin l0000!myvalue, <<24 ] */
739 1.1.8.2 martin 0x08180280201ull, /* .10 alu_shf[l0000!val1, --, b, l0000!val, <<8 ] */
740 1.1.8.2 martin 0x08080280102ull, /* .11 alu_shf[l0000!val1, --, b, l0000!val1 , >>8 ] */
741 1.1.8.2 martin 0x0BA00100002ull, /* .12 alu[l0000!val2, l0000!val1, or, l0000!myvalue] */
742 1.1.8.2 martin
743 1.1.8.2 martin };
744 1.1.8.2 martin
745 1.1.8.2 martin static const uint64_t ae_inst_2b[] = {
746 1.1.8.2 martin 0x0F0400C0000ull, /* .0 immed_w0[l0000!indx, 0] */
747 1.1.8.2 martin 0x0F4400C0000ull, /* .1 immed_w1[l0000!indx, 0] */
748 1.1.8.2 martin 0x0F040000300ull, /* .2 immed_w0[l0000!myvalue, 0x0] */
749 1.1.8.2 martin 0x0F440000300ull, /* .3 immed_w1[l0000!myvalue, 0x0] */
750 1.1.8.2 martin 0x0FC066C0000ull, /* .4 local_csr_wr[active_lm_addr_0,
751 1.1.8.2 martin l0000!indx]; put indx to lm_addr */
752 1.1.8.2 martin 0x0F0000C0300ull, /* .5 nop */
753 1.1.8.2 martin 0x0F0000C0300ull, /* .6 nop */
754 1.1.8.2 martin 0x0F0000C0300ull, /* .7 nop */
755 1.1.8.2 martin 0x0A000180000ull, /* .8 alu[l0000!val, --, b, *l$index0] */
756 1.1.8.2 martin 0x09100000200ull, /* .9 alu_shf[l0000!myvalue, --, b,
757 1.1.8.2 martin l0000!myvalue, <<16 ] */
758 1.1.8.2 martin 0x08100280201ull, /* .10 alu_shf[l0000!val1, --, b, l0000!val, <<16 ] */
759 1.1.8.2 martin 0x08100280102ull, /* .11 alu_shf[l0000!val1, --, b, l0000!val1 , >>16 ] */
760 1.1.8.2 martin 0x0BA00100002ull, /* .12 alu[l0000!val2, l0000!val1, or, l0000!myvalue] */
761 1.1.8.2 martin };
762 1.1.8.2 martin
763 1.1.8.2 martin static const uint64_t ae_inst_3b[] = {
764 1.1.8.2 martin 0x0F0400C0000ull, /* .0 immed_w0[l0000!indx, 0] */
765 1.1.8.2 martin 0x0F4400C0000ull, /* .1 immed_w1[l0000!indx, 0] */
766 1.1.8.2 martin 0x0F040000300ull, /* .2 immed_w0[l0000!myvalue, 0x0] */
767 1.1.8.2 martin 0x0F440000300ull, /* .3 immed_w1[l0000!myvalue, 0x0] */
768 1.1.8.2 martin 0x0FC066C0000ull, /* .4 local_csr_wr[active_lm_addr_0,
769 1.1.8.2 martin l0000!indx]; put indx to lm_addr */
770 1.1.8.2 martin 0x0F0000C0300ull, /* .5 nop */
771 1.1.8.2 martin 0x0F0000C0300ull, /* .6 nop */
772 1.1.8.2 martin 0x0F0000C0300ull, /* .7 nop */
773 1.1.8.2 martin 0x0A000180000ull, /* .8 alu[l0000!val, --, b, *l$index0] */
774 1.1.8.2 martin 0x09180000200ull, /* .9 alu_shf[l0000!myvalue, --,
775 1.1.8.2 martin b, l0000!myvalue, <<8 ] */
776 1.1.8.2 martin 0x08080280201ull, /* .10 alu_shf[l0000!val1, --, b, l0000!val, <<24 ] */
777 1.1.8.2 martin 0x08180280102ull, /* .11 alu_shf[l0000!val1, --, b, l0000!val1 , >>24 ] */
778 1.1.8.2 martin 0x0BA00100002ull, /* .12 alu[l0000!val2, l0000!val1, or, l0000!myvalue] */
779 1.1.8.2 martin };
780 1.1.8.2 martin
781 1.1.8.2 martin /* micro-instr fixup */
782 1.1.8.2 martin #define INSERT_IMMED_GPRA_CONST(inst, const_val) \
783 1.1.8.2 martin inst = (inst & 0xFFFF00C03FFull) | \
784 1.1.8.2 martin ((((const_val) << 12) & 0x0FF00000ull) | \
785 1.1.8.2 martin (((const_val) << 10) & 0x0003FC00ull))
786 1.1.8.2 martin #define INSERT_IMMED_GPRB_CONST(inst, const_val) \
787 1.1.8.2 martin inst = (inst & 0xFFFF00FFF00ull) | \
788 1.1.8.2 martin ((((const_val) << 12) & 0x0FF00000ull) | \
789 1.1.8.2 martin (((const_val) << 0) & 0x000000FFull))
790 1.1.8.2 martin
791 1.1.8.2 martin enum aereg_type {
792 1.1.8.2 martin AEREG_NO_DEST, /* no destination */
793 1.1.8.2 martin AEREG_GPA_REL, /* general-purpose A register under relative mode */
794 1.1.8.2 martin AEREG_GPA_ABS, /* general-purpose A register under absolute mode */
795 1.1.8.2 martin AEREG_GPB_REL, /* general-purpose B register under relative mode */
796 1.1.8.2 martin AEREG_GPB_ABS, /* general-purpose B register under absolute mode */
797 1.1.8.2 martin AEREG_SR_REL, /* sram register under relative mode */
798 1.1.8.2 martin AEREG_SR_RD_REL, /* sram read register under relative mode */
799 1.1.8.2 martin AEREG_SR_WR_REL, /* sram write register under relative mode */
800 1.1.8.2 martin AEREG_SR_ABS, /* sram register under absolute mode */
801 1.1.8.2 martin AEREG_SR_RD_ABS, /* sram read register under absolute mode */
802 1.1.8.2 martin AEREG_SR_WR_ABS, /* sram write register under absolute mode */
803 1.1.8.2 martin AEREG_SR0_SPILL, /* sram0 spill register */
804 1.1.8.2 martin AEREG_SR1_SPILL, /* sram1 spill register */
805 1.1.8.2 martin AEREG_SR2_SPILL, /* sram2 spill register */
806 1.1.8.2 martin AEREG_SR3_SPILL, /* sram3 spill register */
807 1.1.8.2 martin AEREG_SR0_MEM_ADDR, /* sram0 memory address register */
808 1.1.8.2 martin AEREG_SR1_MEM_ADDR, /* sram1 memory address register */
809 1.1.8.2 martin AEREG_SR2_MEM_ADDR, /* sram2 memory address register */
810 1.1.8.2 martin AEREG_SR3_MEM_ADDR, /* sram3 memory address register */
811 1.1.8.2 martin AEREG_DR_REL, /* dram register under relative mode */
812 1.1.8.2 martin AEREG_DR_RD_REL, /* dram read register under relative mode */
813 1.1.8.2 martin AEREG_DR_WR_REL, /* dram write register under relative mode */
814 1.1.8.2 martin AEREG_DR_ABS, /* dram register under absolute mode */
815 1.1.8.2 martin AEREG_DR_RD_ABS, /* dram read register under absolute mode */
816 1.1.8.2 martin AEREG_DR_WR_ABS, /* dram write register under absolute mode */
817 1.1.8.2 martin AEREG_DR_MEM_ADDR, /* dram memory address register */
818 1.1.8.2 martin AEREG_LMEM, /* local memory */
819 1.1.8.2 martin AEREG_LMEM0, /* local memory bank0 */
820 1.1.8.2 martin AEREG_LMEM1, /* local memory bank1 */
821 1.1.8.2 martin AEREG_LMEM_SPILL, /* local memory spill */
822 1.1.8.2 martin AEREG_LMEM_ADDR, /* local memory address */
823 1.1.8.2 martin AEREG_NEIGH_REL, /* next neighbour register under relative mode */
824 1.1.8.2 martin AEREG_NEIGH_INDX, /* next neighbour register under index mode */
825 1.1.8.2 martin AEREG_SIG_REL, /* signal register under relative mode */
826 1.1.8.2 martin AEREG_SIG_INDX, /* signal register under index mode */
827 1.1.8.2 martin AEREG_SIG_DOUBLE, /* signal register */
828 1.1.8.2 martin AEREG_SIG_SINGLE, /* signal register */
829 1.1.8.2 martin AEREG_SCRATCH_MEM_ADDR, /* scratch memory address */
830 1.1.8.2 martin AEREG_UMEM0, /* ustore memory bank0 */
831 1.1.8.2 martin AEREG_UMEM1, /* ustore memory bank1 */
832 1.1.8.2 martin AEREG_UMEM_SPILL, /* ustore memory spill */
833 1.1.8.2 martin AEREG_UMEM_ADDR, /* ustore memory address */
834 1.1.8.2 martin AEREG_DR1_MEM_ADDR, /* dram segment1 address */
835 1.1.8.2 martin AEREG_SR0_IMPORTED, /* sram segment0 imported data */
836 1.1.8.2 martin AEREG_SR1_IMPORTED, /* sram segment1 imported data */
837 1.1.8.2 martin AEREG_SR2_IMPORTED, /* sram segment2 imported data */
838 1.1.8.2 martin AEREG_SR3_IMPORTED, /* sram segment3 imported data */
839 1.1.8.2 martin AEREG_DR_IMPORTED, /* dram segment0 imported data */
840 1.1.8.2 martin AEREG_DR1_IMPORTED, /* dram segment1 imported data */
841 1.1.8.2 martin AEREG_SCRATCH_IMPORTED, /* scratch imported data */
842 1.1.8.2 martin AEREG_XFER_RD_ABS, /* transfer read register under absolute mode */
843 1.1.8.2 martin AEREG_XFER_WR_ABS, /* transfer write register under absolute mode */
844 1.1.8.2 martin AEREG_CONST_VALUE, /* const alue */
845 1.1.8.2 martin AEREG_ADDR_TAKEN, /* address taken */
846 1.1.8.2 martin AEREG_OPTIMIZED_AWAY, /* optimized away */
847 1.1.8.2 martin AEREG_SHRAM_ADDR, /* shared ram0 address */
848 1.1.8.2 martin AEREG_SHRAM1_ADDR, /* shared ram1 address */
849 1.1.8.2 martin AEREG_SHRAM2_ADDR, /* shared ram2 address */
850 1.1.8.2 martin AEREG_SHRAM3_ADDR, /* shared ram3 address */
851 1.1.8.2 martin AEREG_SHRAM4_ADDR, /* shared ram4 address */
852 1.1.8.2 martin AEREG_SHRAM5_ADDR, /* shared ram5 address */
853 1.1.8.2 martin AEREG_ANY = 0xffff /* any register */
854 1.1.8.2 martin };
855 1.1.8.2 martin #define AEREG_SR_INDX AEREG_SR_ABS
856 1.1.8.2 martin /* sram transfer register under index mode */
857 1.1.8.2 martin #define AEREG_DR_INDX AEREG_DR_ABS
858 1.1.8.2 martin /* dram transfer register under index mode */
859 1.1.8.2 martin #define AEREG_NEIGH_ABS AEREG_NEIGH_INDX
860 1.1.8.2 martin /* next neighbor register under absolute mode */
861 1.1.8.2 martin
862 1.1.8.2 martin
863 1.1.8.2 martin #define QAT_2K 0x0800
864 1.1.8.2 martin #define QAT_4K 0x1000
865 1.1.8.2 martin #define QAT_6K 0x1800
866 1.1.8.2 martin #define QAT_8K 0x2000
867 1.1.8.2 martin #define QAT_16K 0x4000
868 1.1.8.2 martin
869 1.1.8.2 martin #define MOF_OBJ_ID_LEN 8
870 1.1.8.2 martin #define MOF_FID 0x00666f6d
871 1.1.8.2 martin #define MOF_MIN_VER 0x1
872 1.1.8.2 martin #define MOF_MAJ_VER 0x0
873 1.1.8.2 martin #define SYM_OBJS "SYM_OBJS" /* symbol object string */
874 1.1.8.2 martin #define UOF_OBJS "UOF_OBJS" /* uof object string */
875 1.1.8.2 martin #define SUOF_OBJS "SUF_OBJS" /* suof object string */
876 1.1.8.2 martin #define SUOF_IMAG "SUF_IMAG" /* suof chunk ID string */
877 1.1.8.2 martin
878 1.1.8.2 martin #define UOF_STRT "UOF_STRT" /* string table section ID */
879 1.1.8.2 martin #define UOF_GTID "UOF_GTID" /* GTID section ID */
880 1.1.8.2 martin #define UOF_IMAG "UOF_IMAG" /* image section ID */
881 1.1.8.2 martin #define UOF_IMEM "UOF_IMEM" /* import section ID */
882 1.1.8.2 martin #define UOF_MSEG "UOF_MSEG" /* memory section ID */
883 1.1.8.2 martin
884 1.1.8.2 martin #define CRC_POLY 0x1021
885 1.1.8.2 martin #define CRC_WIDTH 16
886 1.1.8.2 martin #define CRC_BITMASK(x) (1L << (x))
887 1.1.8.2 martin #define CRC_WIDTHMASK(width) ((((1L<<(width-1))-1L)<<1)|1L)
888 1.1.8.2 martin
889 1.1.8.2 martin struct mof_file_hdr {
890 1.1.8.2 martin u_int mfh_fid;
891 1.1.8.2 martin u_int mfh_csum;
892 1.1.8.2 martin char mfh_min_ver;
893 1.1.8.2 martin char mfh_maj_ver;
894 1.1.8.2 martin u_short mfh_reserved;
895 1.1.8.2 martin u_short mfh_max_chunks;
896 1.1.8.2 martin u_short mfh_num_chunks;
897 1.1.8.2 martin };
898 1.1.8.2 martin
899 1.1.8.2 martin struct mof_file_chunk_hdr {
900 1.1.8.2 martin char mfch_id[MOF_OBJ_ID_LEN];
901 1.1.8.2 martin uint64_t mfch_offset;
902 1.1.8.2 martin uint64_t mfch_size;
903 1.1.8.2 martin };
904 1.1.8.2 martin
905 1.1.8.2 martin struct mof_uof_hdr {
906 1.1.8.2 martin u_short muh_max_chunks;
907 1.1.8.2 martin u_short muh_num_chunks;
908 1.1.8.2 martin u_int muh_reserved;
909 1.1.8.2 martin };
910 1.1.8.2 martin
911 1.1.8.2 martin struct mof_uof_chunk_hdr {
912 1.1.8.2 martin char much_id[MOF_OBJ_ID_LEN]; /* should be UOF_IMAG */
913 1.1.8.2 martin uint64_t much_offset; /* uof image */
914 1.1.8.2 martin uint64_t much_size; /* uof image size */
915 1.1.8.2 martin u_int much_name; /* uof name string-table offset */
916 1.1.8.2 martin u_int much_reserved;
917 1.1.8.2 martin };
918 1.1.8.2 martin
919 1.1.8.2 martin #define UOF_MAX_NUM_OF_AE 16 /* maximum number of AE */
920 1.1.8.2 martin
921 1.1.8.2 martin #define UOF_OBJ_ID_LEN 8 /* length of object ID */
922 1.1.8.2 martin #define UOF_FIELD_POS_SIZE 12 /* field postion size */
923 1.1.8.2 martin #define MIN_UOF_SIZE 24 /* minimum .uof file size */
924 1.1.8.2 martin #define UOF_FID 0xc6c2 /* uof magic number */
925 1.1.8.2 martin #define UOF_MIN_VER 0x11
926 1.1.8.2 martin #define UOF_MAJ_VER 0x4
927 1.1.8.2 martin
928 1.1.8.2 martin struct uof_file_hdr {
929 1.1.8.2 martin u_short ufh_id; /* file id and endian indicator */
930 1.1.8.2 martin u_short ufh_reserved1; /* reserved for future use */
931 1.1.8.2 martin char ufh_min_ver; /* file format minor version */
932 1.1.8.2 martin char ufh_maj_ver; /* file format major version */
933 1.1.8.2 martin u_short ufh_reserved2; /* reserved for future use */
934 1.1.8.2 martin u_short ufh_max_chunks; /* max chunks in file */
935 1.1.8.2 martin u_short ufh_num_chunks; /* num of actual chunks */
936 1.1.8.2 martin };
937 1.1.8.2 martin
938 1.1.8.2 martin struct uof_file_chunk_hdr {
939 1.1.8.2 martin char ufch_id[UOF_OBJ_ID_LEN]; /* chunk identifier */
940 1.1.8.2 martin u_int ufch_csum; /* chunk checksum */
941 1.1.8.2 martin u_int ufch_offset; /* offset of the chunk in the file */
942 1.1.8.2 martin u_int ufch_size; /* size of the chunk */
943 1.1.8.2 martin };
944 1.1.8.2 martin
945 1.1.8.2 martin struct uof_obj_hdr {
946 1.1.8.2 martin u_int uoh_cpu_type; /* CPU type */
947 1.1.8.2 martin u_short uoh_min_cpu_ver; /* starting CPU version */
948 1.1.8.2 martin u_short uoh_max_cpu_ver; /* ending CPU version */
949 1.1.8.2 martin short uoh_max_chunks; /* max chunks in chunk obj */
950 1.1.8.2 martin short uoh_num_chunks; /* num of actual chunks */
951 1.1.8.2 martin u_int uoh_reserved1;
952 1.1.8.2 martin u_int uoh_reserved2;
953 1.1.8.2 martin };
954 1.1.8.2 martin
955 1.1.8.2 martin struct uof_chunk_hdr {
956 1.1.8.2 martin char uch_id[UOF_OBJ_ID_LEN];
957 1.1.8.2 martin u_int uch_offset;
958 1.1.8.2 martin u_int uch_size;
959 1.1.8.2 martin };
960 1.1.8.2 martin
961 1.1.8.2 martin struct uof_str_tab {
962 1.1.8.2 martin u_int ust_table_len; /* length of table */
963 1.1.8.2 martin u_int ust_reserved; /* reserved for future use */
964 1.1.8.2 martin uint64_t ust_strings; /* pointer to string table.
965 1.1.8.2 martin * NULL terminated strings */
966 1.1.8.2 martin };
967 1.1.8.2 martin
968 1.1.8.2 martin #define AE_MODE_RELOAD_CTX_SHARED __BIT(12)
969 1.1.8.2 martin #define AE_MODE_SHARED_USTORE __BIT(11)
970 1.1.8.2 martin #define AE_MODE_LMEM1 __BIT(9)
971 1.1.8.2 martin #define AE_MODE_LMEM0 __BIT(8)
972 1.1.8.2 martin #define AE_MODE_NN_MODE __BITS(7, 4)
973 1.1.8.2 martin #define AE_MODE_CTX_MODE __BITS(3, 0)
974 1.1.8.2 martin
975 1.1.8.2 martin #define AE_MODE_NN_MODE_NEIGH 0
976 1.1.8.2 martin #define AE_MODE_NN_MODE_SELF 1
977 1.1.8.2 martin #define AE_MODE_NN_MODE_DONTCARE 0xff
978 1.1.8.2 martin
979 1.1.8.2 martin struct uof_image {
980 1.1.8.2 martin u_int ui_name; /* image name */
981 1.1.8.2 martin u_int ui_ae_assigned; /* AccelEngines assigned */
982 1.1.8.2 martin u_int ui_ctx_assigned; /* AccelEngine contexts assigned */
983 1.1.8.2 martin u_int ui_cpu_type; /* cpu type */
984 1.1.8.2 martin u_int ui_entry_address; /* entry uaddress */
985 1.1.8.2 martin u_int ui_fill_pattern[2]; /* uword fill value */
986 1.1.8.2 martin u_int ui_reloadable_size; /* size of reloadable ustore section */
987 1.1.8.2 martin
988 1.1.8.2 martin u_char ui_sensitivity; /*
989 1.1.8.2 martin * case sensitivity: 0 = insensitive,
990 1.1.8.2 martin * 1 = sensitive
991 1.1.8.2 martin */
992 1.1.8.2 martin u_char ui_reserved; /* reserved for future use */
993 1.1.8.2 martin u_short ui_ae_mode; /*
994 1.1.8.2 martin * unused<15:14>, legacyMode<13>,
995 1.1.8.2 martin * reloadCtxShared<12>, sharedUstore<11>,
996 1.1.8.2 martin * ecc<10>, locMem1<9>, locMem0<8>,
997 1.1.8.2 martin * nnMode<7:4>, ctx<3:0>
998 1.1.8.2 martin */
999 1.1.8.2 martin
1000 1.1.8.2 martin u_short ui_max_ver; /* max cpu ver on which the image can run */
1001 1.1.8.2 martin u_short ui_min_ver; /* min cpu ver on which the image can run */
1002 1.1.8.2 martin
1003 1.1.8.2 martin u_short ui_image_attrib; /* image attributes */
1004 1.1.8.2 martin u_short ui_reserved2; /* reserved for future use */
1005 1.1.8.2 martin
1006 1.1.8.2 martin u_short ui_num_page_regions; /* number of page regions */
1007 1.1.8.2 martin u_short ui_num_pages; /* number of pages */
1008 1.1.8.2 martin
1009 1.1.8.2 martin u_int ui_reg_tab; /* offset to register table */
1010 1.1.8.2 martin u_int ui_init_reg_sym_tab; /* reg/sym init table */
1011 1.1.8.2 martin u_int ui_sbreak_tab; /* offset to sbreak table */
1012 1.1.8.2 martin
1013 1.1.8.2 martin u_int ui_app_metadata; /* application meta-data */
1014 1.1.8.2 martin /* ui_npages of code page follows this header */
1015 1.1.8.2 martin };
1016 1.1.8.2 martin
1017 1.1.8.2 martin struct uof_obj_table {
1018 1.1.8.2 martin u_int uot_nentries; /* number of table entries */
1019 1.1.8.2 martin /* uot_nentries of object follows */
1020 1.1.8.2 martin };
1021 1.1.8.2 martin
1022 1.1.8.2 martin struct uof_ae_reg {
1023 1.1.8.2 martin u_int uar_name; /* reg name string-table offset */
1024 1.1.8.2 martin u_int uar_vis_name; /* reg visible name string-table offset */
1025 1.1.8.2 martin u_short uar_type; /* reg type */
1026 1.1.8.2 martin u_short uar_addr; /* reg address */
1027 1.1.8.2 martin u_short uar_access_mode; /* uof_RegAccessMode_T: read/write/both/undef */
1028 1.1.8.2 martin u_char uar_visible; /* register visibility */
1029 1.1.8.2 martin u_char uar_reserved1; /* reserved for future use */
1030 1.1.8.2 martin u_short uar_ref_count; /* number of contiguous registers allocated */
1031 1.1.8.2 martin u_short uar_reserved2; /* reserved for future use */
1032 1.1.8.2 martin u_int uar_xoid; /* xfer order ID */
1033 1.1.8.2 martin };
1034 1.1.8.2 martin
1035 1.1.8.2 martin enum uof_value_kind {
1036 1.1.8.2 martin UNDEF_VAL, /* undefined value */
1037 1.1.8.2 martin CHAR_VAL, /* character value */
1038 1.1.8.2 martin SHORT_VAL, /* short value */
1039 1.1.8.2 martin INT_VAL, /* integer value */
1040 1.1.8.2 martin STR_VAL, /* string value */
1041 1.1.8.2 martin STRTAB_VAL, /* string table value */
1042 1.1.8.2 martin NUM_VAL, /* number value */
1043 1.1.8.2 martin EXPR_VAL /* expression value */
1044 1.1.8.2 martin };
1045 1.1.8.2 martin
1046 1.1.8.2 martin enum uof_init_type {
1047 1.1.8.2 martin INIT_EXPR,
1048 1.1.8.2 martin INIT_REG,
1049 1.1.8.2 martin INIT_REG_CTX,
1050 1.1.8.2 martin INIT_EXPR_ENDIAN_SWAP
1051 1.1.8.2 martin };
1052 1.1.8.2 martin
1053 1.1.8.2 martin struct uof_init_reg_sym {
1054 1.1.8.2 martin u_int uirs_name; /* symbol name */
1055 1.1.8.2 martin char uirs_init_type; /* 0=expr, 1=register, 2=ctxReg,
1056 1.1.8.2 martin * 3=expr_endian_swap */
1057 1.1.8.2 martin char uirs_value_type; /* EXPR_VAL, STRTAB_VAL */
1058 1.1.8.2 martin char uirs_reg_type; /* register type: ae_reg_type */
1059 1.1.8.2 martin u_char uirs_ctx; /* AE context when initType=2 */
1060 1.1.8.2 martin u_int uirs_addr_offset; /* reg address, or sym-value offset */
1061 1.1.8.2 martin u_int uirs_value; /* integer value, or expression */
1062 1.1.8.2 martin };
1063 1.1.8.2 martin
1064 1.1.8.2 martin struct uof_sbreak {
1065 1.1.8.2 martin u_int us_page_num; /* page number */
1066 1.1.8.2 martin u_int us_virt_uaddr; /* virt uaddress */
1067 1.1.8.2 martin u_char us_sbreak_type; /* sbreak type */
1068 1.1.8.2 martin u_char us_reg_type; /* register type: ae_reg_type */
1069 1.1.8.2 martin u_short us_reserved1; /* reserved for future use */
1070 1.1.8.2 martin u_int us_addr_offset; /* branch target address or offset
1071 1.1.8.2 martin * to be used with the reg value to
1072 1.1.8.2 martin * calculate the target address */
1073 1.1.8.2 martin u_int us_reg_rddr; /* register address */
1074 1.1.8.2 martin };
1075 1.1.8.2 martin struct uof_code_page {
1076 1.1.8.2 martin u_int ucp_page_region; /* page associated region */
1077 1.1.8.2 martin u_int ucp_page_num; /* code-page number */
1078 1.1.8.2 martin u_char ucp_def_page; /* default page indicator */
1079 1.1.8.2 martin u_char ucp_reserved2; /* reserved for future use */
1080 1.1.8.2 martin u_short ucp_reserved1; /* reserved for future use */
1081 1.1.8.2 martin u_int ucp_beg_vaddr; /* starting virtual uaddr */
1082 1.1.8.2 martin u_int ucp_beg_paddr; /* starting physical uaddr */
1083 1.1.8.2 martin u_int ucp_neigh_reg_tab; /* offset to neighbour-reg table */
1084 1.1.8.2 martin u_int ucp_uc_var_tab; /* offset to uC var table */
1085 1.1.8.2 martin u_int ucp_imp_var_tab; /* offset to import var table */
1086 1.1.8.2 martin u_int ucp_imp_expr_tab; /* offset to import expression table */
1087 1.1.8.2 martin u_int ucp_code_area; /* offset to code area */
1088 1.1.8.2 martin };
1089 1.1.8.2 martin
1090 1.1.8.2 martin struct uof_code_area {
1091 1.1.8.2 martin u_int uca_num_micro_words; /* number of micro words */
1092 1.1.8.2 martin u_int uca_uword_block_tab; /* offset to ublock table */
1093 1.1.8.2 martin };
1094 1.1.8.2 martin
1095 1.1.8.2 martin struct uof_uword_block {
1096 1.1.8.2 martin u_int uub_start_addr; /* start address */
1097 1.1.8.2 martin u_int uub_num_words; /* number of microwords */
1098 1.1.8.2 martin u_int uub_uword_offset; /* offset to the uwords */
1099 1.1.8.2 martin u_int uub_reserved; /* reserved for future use */
1100 1.1.8.2 martin };
1101 1.1.8.2 martin
1102 1.1.8.2 martin struct uof_uword_fixup {
1103 1.1.8.2 martin u_int uuf_name; /* offset to string table */
1104 1.1.8.2 martin u_int uuf_uword_address; /* micro word address */
1105 1.1.8.2 martin u_int uuf_expr_value; /* string table offset of expr string, or value */
1106 1.1.8.2 martin u_char uuf_val_type; /* VALUE_UNDEF, VALUE_NUM, VALUE_EXPR */
1107 1.1.8.2 martin u_char uuf_value_attrs; /* bit<0> (Scope: 0=global, 1=local),
1108 1.1.8.2 martin * bit<1> (init: 0=no, 1=yes) */
1109 1.1.8.2 martin u_short uuf_reserved1; /* reserved for future use */
1110 1.1.8.2 martin char uuf_field_attrs[UOF_FIELD_POS_SIZE];
1111 1.1.8.2 martin /* field pos, size, and right shift value */
1112 1.1.8.2 martin };
1113 1.1.8.2 martin
1114 1.1.8.2 martin struct uof_import_var {
1115 1.1.8.2 martin u_int uiv_name; /* import var name string-table offset */
1116 1.1.8.2 martin u_char uiv_value_attrs; /* bit<0> (Scope: 0=global),
1117 1.1.8.2 martin * bit<1> (init: 0=no, 1=yes) */
1118 1.1.8.2 martin u_char uiv_reserved1; /* reserved for future use */
1119 1.1.8.2 martin u_short uiv_reserved2; /* reserved for future use */
1120 1.1.8.2 martin uint64_t uiv_value; /* 64-bit imported value */
1121 1.1.8.2 martin };
1122 1.1.8.2 martin
1123 1.1.8.2 martin struct uof_mem_val_attr {
1124 1.1.8.2 martin u_int umva_byte_offset; /* byte-offset from the allocated memory */
1125 1.1.8.2 martin u_int umva_value; /* memory value */
1126 1.1.8.2 martin };
1127 1.1.8.2 martin
1128 1.1.8.2 martin enum uof_mem_region {
1129 1.1.8.2 martin SRAM_REGION, /* SRAM region */
1130 1.1.8.2 martin DRAM_REGION, /* DRAM0 region */
1131 1.1.8.2 martin DRAM1_REGION, /* DRAM1 region */
1132 1.1.8.2 martin LMEM_REGION, /* local memory region */
1133 1.1.8.2 martin SCRATCH_REGION, /* SCRATCH region */
1134 1.1.8.2 martin UMEM_REGION, /* micro-store region */
1135 1.1.8.2 martin RAM_REGION, /* RAM region */
1136 1.1.8.2 martin SHRAM_REGION, /* shared memory-0 region */
1137 1.1.8.2 martin SHRAM1_REGION, /* shared memory-1 region */
1138 1.1.8.2 martin SHRAM2_REGION, /* shared memory-2 region */
1139 1.1.8.2 martin SHRAM3_REGION, /* shared memory-3 region */
1140 1.1.8.2 martin SHRAM4_REGION, /* shared memory-4 region */
1141 1.1.8.2 martin SHRAM5_REGION /* shared memory-5 region */
1142 1.1.8.2 martin };
1143 1.1.8.2 martin
1144 1.1.8.2 martin #define UOF_SCOPE_GLOBAL 0
1145 1.1.8.2 martin #define UOF_SCOPE_LOCAL 1
1146 1.1.8.2 martin
1147 1.1.8.2 martin struct uof_init_mem {
1148 1.1.8.2 martin u_int uim_sym_name; /* symbol name */
1149 1.1.8.2 martin char uim_region; /* memory region -- uof_mem_region */
1150 1.1.8.2 martin char uim_scope; /* visibility scope */
1151 1.1.8.2 martin u_short uim_reserved1; /* reserved for future use */
1152 1.1.8.2 martin u_int uim_addr; /* memory address */
1153 1.1.8.2 martin u_int uim_num_bytes; /* number of bytes */
1154 1.1.8.2 martin u_int uim_num_val_attr; /* number of values attributes */
1155 1.1.8.2 martin
1156 1.1.8.2 martin /* uim_num_val_attr of uof_mem_val_attr follows this header */
1157 1.1.8.2 martin };
1158 1.1.8.2 martin
1159 1.1.8.2 martin struct uof_var_mem_seg {
1160 1.1.8.2 martin u_int uvms_sram_base; /* SRAM memory segment base addr */
1161 1.1.8.2 martin u_int uvms_sram_size; /* SRAM segment size bytes */
1162 1.1.8.2 martin u_int uvms_sram_alignment; /* SRAM segment alignment bytes */
1163 1.1.8.2 martin u_int uvms_sdram_base; /* DRAM0 memory segment base addr */
1164 1.1.8.2 martin u_int uvms_sdram_size; /* DRAM0 segment size bytes */
1165 1.1.8.2 martin u_int uvms_sdram_alignment; /* DRAM0 segment alignment bytes */
1166 1.1.8.2 martin u_int uvms_sdram1_base; /* DRAM1 memory segment base addr */
1167 1.1.8.2 martin u_int uvms_sdram1_size; /* DRAM1 segment size bytes */
1168 1.1.8.2 martin u_int uvms_sdram1_alignment; /* DRAM1 segment alignment bytes */
1169 1.1.8.2 martin u_int uvms_scratch_base; /* SCRATCH memory segment base addr */
1170 1.1.8.2 martin u_int uvms_scratch_size; /* SCRATCH segment size bytes */
1171 1.1.8.2 martin u_int uvms_scratch_alignment; /* SCRATCH segment alignment bytes */
1172 1.1.8.2 martin };
1173 1.1.8.2 martin
1174 1.1.8.2 martin #define SUOF_OBJ_ID_LEN 8
1175 1.1.8.2 martin #define SUOF_FID 0x53554f46
1176 1.1.8.2 martin #define SUOF_MAJ_VER 0x0
1177 1.1.8.2 martin #define SUOF_MIN_VER 0x1
1178 1.1.8.2 martin #define SIMG_AE_INIT_SEQ_LEN (50 * sizeof(unsigned long long))
1179 1.1.8.2 martin #define SIMG_AE_INSTS_LEN (0x4000 * sizeof(unsigned long long))
1180 1.1.8.2 martin #define CSS_FWSK_MODULUS_LEN 256
1181 1.1.8.2 martin #define CSS_FWSK_EXPONENT_LEN 4
1182 1.1.8.2 martin #define CSS_FWSK_PAD_LEN 252
1183 1.1.8.2 martin #define CSS_FWSK_PUB_LEN (CSS_FWSK_MODULUS_LEN + \
1184 1.1.8.2 martin CSS_FWSK_EXPONENT_LEN + \
1185 1.1.8.2 martin CSS_FWSK_PAD_LEN)
1186 1.1.8.2 martin #define CSS_SIGNATURE_LEN 256
1187 1.1.8.2 martin #define CSS_AE_IMG_LEN (sizeof(struct simg_ae_mode) + \
1188 1.1.8.2 martin SIMG_AE_INIT_SEQ_LEN + \
1189 1.1.8.2 martin SIMG_AE_INSTS_LEN)
1190 1.1.8.2 martin #define CSS_AE_SIMG_LEN (sizeof(struct css_hdr) + \
1191 1.1.8.2 martin CSS_FWSK_PUB_LEN + \
1192 1.1.8.2 martin CSS_SIGNATURE_LEN + \
1193 1.1.8.2 martin CSS_AE_IMG_LEN)
1194 1.1.8.2 martin #define AE_IMG_OFFSET (sizeof(struct css_hdr) + \
1195 1.1.8.2 martin CSS_FWSK_MODULUS_LEN + \
1196 1.1.8.2 martin CSS_FWSK_EXPONENT_LEN + \
1197 1.1.8.2 martin CSS_SIGNATURE_LEN)
1198 1.1.8.2 martin #define CSS_MAX_IMAGE_LEN 0x40000
1199 1.1.8.2 martin
1200 1.1.8.2 martin struct fw_auth_desc {
1201 1.1.8.2 martin u_int fad_img_len;
1202 1.1.8.2 martin u_int fad_reserved;
1203 1.1.8.2 martin u_int fad_css_hdr_high;
1204 1.1.8.2 martin u_int fad_css_hdr_low;
1205 1.1.8.2 martin u_int fad_img_high;
1206 1.1.8.2 martin u_int fad_img_low;
1207 1.1.8.2 martin u_int fad_signature_high;
1208 1.1.8.2 martin u_int fad_signature_low;
1209 1.1.8.2 martin u_int fad_fwsk_pub_high;
1210 1.1.8.2 martin u_int fad_fwsk_pub_low;
1211 1.1.8.2 martin u_int fad_img_ae_mode_data_high;
1212 1.1.8.2 martin u_int fad_img_ae_mode_data_low;
1213 1.1.8.2 martin u_int fad_img_ae_init_data_high;
1214 1.1.8.2 martin u_int fad_img_ae_init_data_low;
1215 1.1.8.2 martin u_int fad_img_ae_insts_high;
1216 1.1.8.2 martin u_int fad_img_ae_insts_low;
1217 1.1.8.2 martin };
1218 1.1.8.2 martin
1219 1.1.8.2 martin struct auth_chunk {
1220 1.1.8.2 martin struct fw_auth_desc ac_fw_auth_desc;
1221 1.1.8.2 martin uint64_t ac_chunk_size;
1222 1.1.8.2 martin uint64_t ac_chunk_bus_addr;
1223 1.1.8.2 martin };
1224 1.1.8.2 martin
1225 1.1.8.2 martin enum css_fwtype {
1226 1.1.8.2 martin CSS_AE_FIRMWARE = 0,
1227 1.1.8.2 martin CSS_MMP_FIRMWARE = 1
1228 1.1.8.2 martin };
1229 1.1.8.2 martin
1230 1.1.8.2 martin struct css_hdr {
1231 1.1.8.2 martin u_int css_module_type;
1232 1.1.8.2 martin u_int css_header_len;
1233 1.1.8.2 martin u_int css_header_ver;
1234 1.1.8.2 martin u_int css_module_id;
1235 1.1.8.2 martin u_int css_module_vendor;
1236 1.1.8.2 martin u_int css_date;
1237 1.1.8.2 martin u_int css_size;
1238 1.1.8.2 martin u_int css_key_size;
1239 1.1.8.2 martin u_int css_module_size;
1240 1.1.8.2 martin u_int css_exponent_size;
1241 1.1.8.2 martin u_int css_fw_type;
1242 1.1.8.2 martin u_int css_reserved[21];
1243 1.1.8.2 martin };
1244 1.1.8.2 martin
1245 1.1.8.2 martin struct simg_ae_mode {
1246 1.1.8.2 martin u_int sam_file_id;
1247 1.1.8.2 martin u_short sam_maj_ver;
1248 1.1.8.2 martin u_short sam_min_ver;
1249 1.1.8.2 martin u_int sam_dev_type;
1250 1.1.8.2 martin u_short sam_devmax_ver;
1251 1.1.8.2 martin u_short sam_devmin_ver;
1252 1.1.8.2 martin u_int sam_ae_mask;
1253 1.1.8.2 martin u_int sam_ctx_enables;
1254 1.1.8.2 martin char sam_fw_type;
1255 1.1.8.2 martin char sam_ctx_mode;
1256 1.1.8.2 martin char sam_nn_mode;
1257 1.1.8.2 martin char sam_lm0_mode;
1258 1.1.8.2 martin char sam_lm1_mode;
1259 1.1.8.2 martin char sam_scs_mode;
1260 1.1.8.2 martin char sam_lm2_mode;
1261 1.1.8.2 martin char sam_lm3_mode;
1262 1.1.8.2 martin char sam_tindex_mode;
1263 1.1.8.2 martin u_char sam_reserved[7];
1264 1.1.8.2 martin char sam_simg_name[256];
1265 1.1.8.2 martin char sam_appmeta_data[256];
1266 1.1.8.2 martin };
1267 1.1.8.2 martin
1268 1.1.8.2 martin struct suof_file_hdr {
1269 1.1.8.2 martin u_int sfh_file_id;
1270 1.1.8.2 martin u_int sfh_check_sum;
1271 1.1.8.2 martin char sfh_min_ver;
1272 1.1.8.2 martin char sfh_maj_ver;
1273 1.1.8.2 martin char sfh_fw_type;
1274 1.1.8.2 martin char sfh_reserved;
1275 1.1.8.2 martin u_short sfh_max_chunks;
1276 1.1.8.2 martin u_short sfh_num_chunks;
1277 1.1.8.2 martin };
1278 1.1.8.2 martin
1279 1.1.8.2 martin struct suof_chunk_hdr {
1280 1.1.8.2 martin char sch_chunk_id[SUOF_OBJ_ID_LEN];
1281 1.1.8.2 martin uint64_t sch_offset;
1282 1.1.8.2 martin uint64_t sch_size;
1283 1.1.8.2 martin };
1284 1.1.8.2 martin
1285 1.1.8.2 martin struct suof_str_tab {
1286 1.1.8.2 martin u_int sst_tab_length;
1287 1.1.8.2 martin u_int sst_strings;
1288 1.1.8.2 martin };
1289 1.1.8.2 martin
1290 1.1.8.2 martin struct suof_obj_hdr {
1291 1.1.8.2 martin u_int soh_img_length;
1292 1.1.8.2 martin u_int soh_reserved;
1293 1.1.8.2 martin };
1294 1.1.8.2 martin
1295 1.1.8.2 martin /* -------------------------------------------------------------------------- */
1296 1.1.8.2 martin /* accel */
1297 1.1.8.2 martin
1298 1.1.8.2 martin enum fw_slice {
1299 1.1.8.2 martin FW_SLICE_NULL = 0, /* NULL slice type */
1300 1.1.8.2 martin FW_SLICE_CIPHER = 1, /* CIPHER slice type */
1301 1.1.8.2 martin FW_SLICE_AUTH = 2, /* AUTH slice type */
1302 1.1.8.2 martin FW_SLICE_DRAM_RD = 3, /* DRAM_RD Logical slice type */
1303 1.1.8.2 martin FW_SLICE_DRAM_WR = 4, /* DRAM_WR Logical slice type */
1304 1.1.8.2 martin FW_SLICE_COMP = 5, /* Compression slice type */
1305 1.1.8.2 martin FW_SLICE_XLAT = 6, /* Translator slice type */
1306 1.1.8.2 martin FW_SLICE_DELIMITER /* End delimiter */
1307 1.1.8.2 martin };
1308 1.1.8.2 martin #define MAX_FW_SLICE FW_SLICE_DELIMITER
1309 1.1.8.2 martin
1310 1.1.8.2 martin #define QAT_OPTIMAL_ALIGN_SHIFT 6
1311 1.1.8.2 martin #define QAT_OPTIMAL_ALIGN (1 << QAT_OPTIMAL_ALIGN_SHIFT)
1312 1.1.8.2 martin
1313 1.1.8.2 martin enum hw_auth_algo {
1314 1.1.8.2 martin HW_AUTH_ALGO_NULL = 0, /* Null hashing */
1315 1.1.8.2 martin HW_AUTH_ALGO_SHA1 = 1, /* SHA1 hashing */
1316 1.1.8.2 martin HW_AUTH_ALGO_MD5 = 2, /* MD5 hashing */
1317 1.1.8.2 martin HW_AUTH_ALGO_SHA224 = 3, /* SHA-224 hashing */
1318 1.1.8.2 martin HW_AUTH_ALGO_SHA256 = 4, /* SHA-256 hashing */
1319 1.1.8.2 martin HW_AUTH_ALGO_SHA384 = 5, /* SHA-384 hashing */
1320 1.1.8.2 martin HW_AUTH_ALGO_SHA512 = 6, /* SHA-512 hashing */
1321 1.1.8.2 martin HW_AUTH_ALGO_AES_XCBC_MAC = 7, /* AES-XCBC-MAC hashing */
1322 1.1.8.2 martin HW_AUTH_ALGO_AES_CBC_MAC = 8, /* AES-CBC-MAC hashing */
1323 1.1.8.2 martin HW_AUTH_ALGO_AES_F9 = 9, /* AES F9 hashing */
1324 1.1.8.2 martin HW_AUTH_ALGO_GALOIS_128 = 10, /* Galois 128 bit hashing */
1325 1.1.8.2 martin HW_AUTH_ALGO_GALOIS_64 = 11, /* Galois 64 hashing */
1326 1.1.8.2 martin HW_AUTH_ALGO_KASUMI_F9 = 12, /* Kasumi F9 hashing */
1327 1.1.8.2 martin HW_AUTH_ALGO_SNOW_3G_UIA2 = 13, /* UIA2/SNOW_3H F9 hashing */
1328 1.1.8.2 martin HW_AUTH_ALGO_ZUC_3G_128_EIA3 = 14,
1329 1.1.8.2 martin HW_AUTH_RESERVED_1 = 15,
1330 1.1.8.2 martin HW_AUTH_RESERVED_2 = 16,
1331 1.1.8.2 martin HW_AUTH_ALGO_SHA3_256 = 17,
1332 1.1.8.2 martin HW_AUTH_RESERVED_3 = 18,
1333 1.1.8.2 martin HW_AUTH_ALGO_SHA3_512 = 19,
1334 1.1.8.2 martin HW_AUTH_ALGO_DELIMITER = 20
1335 1.1.8.2 martin };
1336 1.1.8.2 martin
1337 1.1.8.2 martin enum hw_auth_mode {
1338 1.1.8.2 martin HW_AUTH_MODE0,
1339 1.1.8.2 martin HW_AUTH_MODE1,
1340 1.1.8.2 martin HW_AUTH_MODE2,
1341 1.1.8.2 martin HW_AUTH_MODE_DELIMITER
1342 1.1.8.2 martin };
1343 1.1.8.2 martin
1344 1.1.8.2 martin struct hw_auth_config {
1345 1.1.8.2 martin uint32_t config;
1346 1.1.8.2 martin /* Configuration used for setting up the slice */
1347 1.1.8.2 martin uint32_t reserved;
1348 1.1.8.2 martin /* Reserved */
1349 1.1.8.2 martin };
1350 1.1.8.2 martin
1351 1.1.8.2 martin #define HW_AUTH_CONFIG_SHA3_ALGO __BITS(22, 23)
1352 1.1.8.2 martin #define HW_AUTH_CONFIG_SHA3_PADDING __BIT(16)
1353 1.1.8.2 martin #define HW_AUTH_CONFIG_CMPLEN __BITS(14, 8)
1354 1.1.8.2 martin /* The length of the digest if the QAT is to the check*/
1355 1.1.8.2 martin #define HW_AUTH_CONFIG_MODE __BITS(7, 4)
1356 1.1.8.2 martin #define HW_AUTH_CONFIG_ALGO __BITS(3, 0)
1357 1.1.8.2 martin
1358 1.1.8.2 martin #define HW_AUTH_CONFIG_BUILD(mode, algo, cmp_len) \
1359 1.1.8.2 martin __SHIFTIN(mode, HW_AUTH_CONFIG_MODE) | \
1360 1.1.8.2 martin __SHIFTIN(algo, HW_AUTH_CONFIG_ALGO) | \
1361 1.1.8.2 martin __SHIFTIN(cmp_len, HW_AUTH_CONFIG_CMPLEN)
1362 1.1.8.2 martin
1363 1.1.8.2 martin struct hw_auth_counter {
1364 1.1.8.2 martin uint32_t counter; /* Counter value */
1365 1.1.8.2 martin uint32_t reserved; /* Reserved */
1366 1.1.8.2 martin };
1367 1.1.8.2 martin
1368 1.1.8.2 martin struct hw_auth_setup {
1369 1.1.8.2 martin struct hw_auth_config auth_config;
1370 1.1.8.2 martin /* Configuration word for the auth slice */
1371 1.1.8.2 martin struct hw_auth_counter auth_counter;
1372 1.1.8.2 martin /* Auth counter value for this request */
1373 1.1.8.2 martin };
1374 1.1.8.2 martin
1375 1.1.8.2 martin #define HW_NULL_STATE1_SZ 32
1376 1.1.8.2 martin #define HW_MD5_STATE1_SZ 16
1377 1.1.8.2 martin #define HW_SHA1_STATE1_SZ 20
1378 1.1.8.2 martin #define HW_SHA224_STATE1_SZ 32
1379 1.1.8.2 martin #define HW_SHA256_STATE1_SZ 32
1380 1.1.8.2 martin #define HW_SHA3_256_STATE1_SZ 32
1381 1.1.8.2 martin #define HW_SHA384_STATE1_SZ 64
1382 1.1.8.2 martin #define HW_SHA512_STATE1_SZ 64
1383 1.1.8.2 martin #define HW_SHA3_512_STATE1_SZ 64
1384 1.1.8.2 martin #define HW_SHA3_224_STATE1_SZ 28
1385 1.1.8.2 martin #define HW_SHA3_384_STATE1_SZ 48
1386 1.1.8.2 martin #define HW_AES_XCBC_MAC_STATE1_SZ 16
1387 1.1.8.2 martin #define HW_AES_CBC_MAC_STATE1_SZ 16
1388 1.1.8.2 martin #define HW_AES_F9_STATE1_SZ 32
1389 1.1.8.2 martin #define HW_KASUMI_F9_STATE1_SZ 16
1390 1.1.8.2 martin #define HW_GALOIS_128_STATE1_SZ 16
1391 1.1.8.2 martin #define HW_SNOW_3G_UIA2_STATE1_SZ 8
1392 1.1.8.2 martin #define HW_ZUC_3G_EIA3_STATE1_SZ 8
1393 1.1.8.2 martin #define HW_NULL_STATE2_SZ 32
1394 1.1.8.2 martin #define HW_MD5_STATE2_SZ 16
1395 1.1.8.2 martin #define HW_SHA1_STATE2_SZ 20
1396 1.1.8.2 martin #define HW_SHA224_STATE2_SZ 32
1397 1.1.8.2 martin #define HW_SHA256_STATE2_SZ 32
1398 1.1.8.2 martin #define HW_SHA3_256_STATE2_SZ 0
1399 1.1.8.2 martin #define HW_SHA384_STATE2_SZ 64
1400 1.1.8.2 martin #define HW_SHA512_STATE2_SZ 64
1401 1.1.8.2 martin #define HW_SHA3_512_STATE2_SZ 0
1402 1.1.8.2 martin #define HW_SHA3_224_STATE2_SZ 0
1403 1.1.8.2 martin #define HW_SHA3_384_STATE2_SZ 0
1404 1.1.8.2 martin #define HW_AES_XCBC_MAC_KEY_SZ 16
1405 1.1.8.2 martin #define HW_AES_CBC_MAC_KEY_SZ 16
1406 1.1.8.2 martin #define HW_AES_CCM_CBC_E_CTR0_SZ 16
1407 1.1.8.2 martin #define HW_F9_IK_SZ 16
1408 1.1.8.2 martin #define HW_F9_FK_SZ 16
1409 1.1.8.2 martin #define HW_KASUMI_F9_STATE2_SZ (HW_F9_IK_SZ + HW_F9_FK_SZ)
1410 1.1.8.2 martin #define HW_AES_F9_STATE2_SZ HW_KASUMI_F9_STATE2_SZ
1411 1.1.8.2 martin #define HW_SNOW_3G_UIA2_STATE2_SZ 24
1412 1.1.8.2 martin #define HW_ZUC_3G_EIA3_STATE2_SZ 32
1413 1.1.8.2 martin #define HW_GALOIS_H_SZ 16
1414 1.1.8.2 martin #define HW_GALOIS_LEN_A_SZ 8
1415 1.1.8.2 martin #define HW_GALOIS_E_CTR0_SZ 16
1416 1.1.8.2 martin
1417 1.1.8.2 martin struct hw_auth_sha512 {
1418 1.1.8.2 martin struct hw_auth_setup inner_setup;
1419 1.1.8.2 martin /* Inner loop configuration word for the slice */
1420 1.1.8.2 martin uint8_t state1[HW_SHA512_STATE1_SZ];
1421 1.1.8.2 martin /* Slice state1 variable */
1422 1.1.8.2 martin struct hw_auth_setup outer_setup;
1423 1.1.8.2 martin /* Outer configuration word for the slice */
1424 1.1.8.2 martin uint8_t state2[HW_SHA512_STATE2_SZ];
1425 1.1.8.2 martin /* Slice state2 variable */
1426 1.1.8.2 martin };
1427 1.1.8.2 martin
1428 1.1.8.2 martin union hw_auth_algo_blk {
1429 1.1.8.2 martin struct hw_auth_sha512 max;
1430 1.1.8.2 martin /* This is the largest possible auth setup block size */
1431 1.1.8.2 martin };
1432 1.1.8.2 martin
1433 1.1.8.2 martin enum hw_cipher_algo {
1434 1.1.8.2 martin HW_CIPHER_ALGO_NULL = 0, /* Null ciphering */
1435 1.1.8.2 martin HW_CIPHER_ALGO_DES = 1, /* DES ciphering */
1436 1.1.8.2 martin HW_CIPHER_ALGO_3DES = 2, /* 3DES ciphering */
1437 1.1.8.2 martin HW_CIPHER_ALGO_AES128 = 3, /* AES-128 ciphering */
1438 1.1.8.2 martin HW_CIPHER_ALGO_AES192 = 4, /* AES-192 ciphering */
1439 1.1.8.2 martin HW_CIPHER_ALGO_AES256 = 5, /* AES-256 ciphering */
1440 1.1.8.2 martin HW_CIPHER_ALGO_ARC4 = 6, /* ARC4 ciphering */
1441 1.1.8.2 martin HW_CIPHER_ALGO_KASUMI = 7, /* Kasumi */
1442 1.1.8.2 martin HW_CIPHER_ALGO_SNOW_3G_UEA2 = 8, /* Snow_3G */
1443 1.1.8.2 martin HW_CIPHER_ALGO_ZUC_3G_128_EEA3 = 9,
1444 1.1.8.2 martin HW_CIPHER_DELIMITER = 10 /* Delimiter type */
1445 1.1.8.2 martin };
1446 1.1.8.2 martin
1447 1.1.8.2 martin enum hw_cipher_mode {
1448 1.1.8.2 martin HW_CIPHER_ECB_MODE = 0, /* ECB mode */
1449 1.1.8.2 martin HW_CIPHER_CBC_MODE = 1, /* CBC more */
1450 1.1.8.2 martin HW_CIPHER_CTR_MODE = 2, /* CTR mode */
1451 1.1.8.2 martin HW_CIPHER_F8_MODE = 3, /* F8 mode */
1452 1.1.8.2 martin HW_CIPHER_XTS_MODE = 6,
1453 1.1.8.2 martin HW_CIPHER_MODE_DELIMITER = 7 /* Delimiter type */
1454 1.1.8.2 martin };
1455 1.1.8.2 martin
1456 1.1.8.2 martin struct hw_cipher_config {
1457 1.1.8.2 martin uint32_t val; /* Cipher slice configuration */
1458 1.1.8.2 martin uint32_t reserved; /* Reserved */
1459 1.1.8.2 martin };
1460 1.1.8.2 martin
1461 1.1.8.2 martin #define CIPHER_CONFIG_CONVERT __BIT(9)
1462 1.1.8.2 martin #define CIPHER_CONFIG_DIR __BIT(8)
1463 1.1.8.2 martin #define CIPHER_CONFIG_MODE __BITS(7, 4)
1464 1.1.8.2 martin #define CIPHER_CONFIG_ALGO __BITS(3, 0)
1465 1.1.8.2 martin #define HW_CIPHER_CONFIG_BUILD(mode, algo, convert, dir) \
1466 1.1.8.2 martin __SHIFTIN(mode, CIPHER_CONFIG_MODE) | \
1467 1.1.8.2 martin __SHIFTIN(algo, CIPHER_CONFIG_ALGO) | \
1468 1.1.8.2 martin __SHIFTIN(convert, CIPHER_CONFIG_CONVERT) | \
1469 1.1.8.2 martin __SHIFTIN(dir, CIPHER_CONFIG_DIR)
1470 1.1.8.2 martin
1471 1.1.8.2 martin enum hw_cipher_dir {
1472 1.1.8.2 martin HW_CIPHER_ENCRYPT = 0, /* encryption is required */
1473 1.1.8.2 martin HW_CIPHER_DECRYPT = 1, /* decryption is required */
1474 1.1.8.2 martin };
1475 1.1.8.2 martin
1476 1.1.8.2 martin enum hw_cipher_convert {
1477 1.1.8.2 martin HW_CIPHER_NO_CONVERT = 0, /* no key convert is required*/
1478 1.1.8.2 martin HW_CIPHER_KEY_CONVERT = 1, /* key conversion is required*/
1479 1.1.8.2 martin };
1480 1.1.8.2 martin
1481 1.1.8.2 martin #define CIPHER_MODE_F8_KEY_SZ_MULT 2
1482 1.1.8.2 martin #define CIPHER_MODE_XTS_KEY_SZ_MULT 2
1483 1.1.8.2 martin
1484 1.1.8.2 martin #define HW_DES_BLK_SZ 8
1485 1.1.8.2 martin #define HW_3DES_BLK_SZ 8
1486 1.1.8.2 martin #define HW_NULL_BLK_SZ 8
1487 1.1.8.2 martin #define HW_AES_BLK_SZ 16
1488 1.1.8.2 martin #define HW_KASUMI_BLK_SZ 8
1489 1.1.8.2 martin #define HW_SNOW_3G_BLK_SZ 8
1490 1.1.8.2 martin #define HW_ZUC_3G_BLK_SZ 8
1491 1.1.8.2 martin #define HW_NULL_KEY_SZ 256
1492 1.1.8.2 martin #define HW_DES_KEY_SZ 8
1493 1.1.8.2 martin #define HW_3DES_KEY_SZ 24
1494 1.1.8.2 martin #define HW_AES_128_KEY_SZ 16
1495 1.1.8.2 martin #define HW_AES_192_KEY_SZ 24
1496 1.1.8.2 martin #define HW_AES_256_KEY_SZ 32
1497 1.1.8.2 martin #define HW_AES_128_F8_KEY_SZ (HW_AES_128_KEY_SZ * \
1498 1.1.8.2 martin CIPHER_MODE_F8_KEY_SZ_MULT)
1499 1.1.8.2 martin #define HW_AES_192_F8_KEY_SZ (HW_AES_192_KEY_SZ * \
1500 1.1.8.2 martin CIPHER_MODE_F8_KEY_SZ_MULT)
1501 1.1.8.2 martin #define HW_AES_256_F8_KEY_SZ (HW_AES_256_KEY_SZ * \
1502 1.1.8.2 martin CIPHER_MODE_F8_KEY_SZ_MULT)
1503 1.1.8.2 martin #define HW_AES_128_XTS_KEY_SZ (HW_AES_128_KEY_SZ * \
1504 1.1.8.2 martin CIPHER_MODE_XTS_KEY_SZ_MULT)
1505 1.1.8.2 martin #define HW_AES_256_XTS_KEY_SZ (HW_AES_256_KEY_SZ * \
1506 1.1.8.2 martin CIPHER_MODE_XTS_KEY_SZ_MULT)
1507 1.1.8.2 martin #define HW_KASUMI_KEY_SZ 16
1508 1.1.8.2 martin #define HW_KASUMI_F8_KEY_SZ (HW_KASUMI_KEY_SZ * \
1509 1.1.8.2 martin CIPHER_MODE_F8_KEY_SZ_MULT)
1510 1.1.8.2 martin #define HW_AES_128_XTS_KEY_SZ (HW_AES_128_KEY_SZ * \
1511 1.1.8.2 martin CIPHER_MODE_XTS_KEY_SZ_MULT)
1512 1.1.8.2 martin #define HW_AES_256_XTS_KEY_SZ (HW_AES_256_KEY_SZ * \
1513 1.1.8.2 martin CIPHER_MODE_XTS_KEY_SZ_MULT)
1514 1.1.8.2 martin #define HW_ARC4_KEY_SZ 256
1515 1.1.8.2 martin #define HW_SNOW_3G_UEA2_KEY_SZ 16
1516 1.1.8.2 martin #define HW_SNOW_3G_UEA2_IV_SZ 16
1517 1.1.8.2 martin #define HW_ZUC_3G_EEA3_KEY_SZ 16
1518 1.1.8.2 martin #define HW_ZUC_3G_EEA3_IV_SZ 16
1519 1.1.8.2 martin #define HW_MODE_F8_NUM_REG_TO_CLEAR 2
1520 1.1.8.2 martin
1521 1.1.8.2 martin struct hw_cipher_aes256_f8 {
1522 1.1.8.2 martin struct hw_cipher_config cipher_config;
1523 1.1.8.2 martin /* Cipher configuration word for the slice set to
1524 1.1.8.2 martin * AES-256 and the F8 mode */
1525 1.1.8.2 martin uint8_t key[HW_AES_256_F8_KEY_SZ];
1526 1.1.8.2 martin /* Cipher key */
1527 1.1.8.2 martin };
1528 1.1.8.2 martin
1529 1.1.8.2 martin union hw_cipher_algo_blk {
1530 1.1.8.2 martin struct hw_cipher_aes256_f8 max; /* AES-256 F8 Cipher */
1531 1.1.8.2 martin /* This is the largest possible cipher setup block size */
1532 1.1.8.2 martin };
1533 1.1.8.2 martin
1534 1.1.8.2 martin struct flat_buffer_desc {
1535 1.1.8.2 martin uint32_t data_len_in_bytes;
1536 1.1.8.2 martin uint32_t reserved;
1537 1.1.8.2 martin uint64_t phy_buffer;
1538 1.1.8.2 martin };
1539 1.1.8.2 martin
1540 1.1.8.2 martin struct buffer_list_desc {
1541 1.1.8.2 martin uint64_t resrvd;
1542 1.1.8.2 martin uint32_t num_buffers;
1543 1.1.8.2 martin uint32_t reserved;
1544 1.1.8.2 martin struct flat_buffer_desc phy_buffers[];
1545 1.1.8.2 martin };
1546 1.1.8.2 martin
1547 1.1.8.2 martin /* -------------------------------------------------------------------------- */
1548 1.1.8.2 martin /* look aside */
1549 1.1.8.2 martin
1550 1.1.8.2 martin enum fw_la_cmd_id {
1551 1.1.8.2 martin FW_LA_CMD_CIPHER, /* Cipher Request */
1552 1.1.8.2 martin FW_LA_CMD_AUTH, /* Auth Request */
1553 1.1.8.2 martin FW_LA_CMD_CIPHER_HASH, /* Cipher-Hash Request */
1554 1.1.8.2 martin FW_LA_CMD_HASH_CIPHER, /* Hash-Cipher Request */
1555 1.1.8.2 martin FW_LA_CMD_TRNG_GET_RANDOM, /* TRNG Get Random Request */
1556 1.1.8.2 martin FW_LA_CMD_TRNG_TEST, /* TRNG Test Request */
1557 1.1.8.2 martin FW_LA_CMD_SSL3_KEY_DERIVE, /* SSL3 Key Derivation Request */
1558 1.1.8.2 martin FW_LA_CMD_TLS_V1_1_KEY_DERIVE, /* TLS Key Derivation Request */
1559 1.1.8.2 martin FW_LA_CMD_TLS_V1_2_KEY_DERIVE, /* TLS Key Derivation Request */
1560 1.1.8.2 martin FW_LA_CMD_MGF1, /* MGF1 Request */
1561 1.1.8.2 martin FW_LA_CMD_AUTH_PRE_COMP, /* Auth Pre-Compute Request */
1562 1.1.8.2 martin #if 0 /* incompatible between qat 1.5 and 1.7 */
1563 1.1.8.2 martin FW_LA_CMD_CIPHER_CIPHER, /* Cipher-Cipher Request */
1564 1.1.8.2 martin FW_LA_CMD_HASH_HASH, /* Hash-Hash Request */
1565 1.1.8.2 martin FW_LA_CMD_CIPHER_PRE_COMP, /* Auth Pre-Compute Request */
1566 1.1.8.2 martin #endif
1567 1.1.8.2 martin FW_LA_CMD_DELIMITER, /* Delimiter type */
1568 1.1.8.2 martin };
1569 1.1.8.2 martin
1570 1.1.8.2 martin #endif
1571