1 /* SPDX-License-Identifier: GPL-2.0
2 * Marvell OcteonTX CPT driver
4 * Copyright (C) 2019 Marvell International Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #ifndef __OTX_CPT_HW_TYPES_H
12 #define __OTX_CPT_HW_TYPES_H
14 #include <linux/types.h>
17 #define OTX_CPT_PCI_PF_DEVICE_ID 0xa040
18 #define OTX_CPT_PCI_VF_DEVICE_ID 0xa041
20 #define OTX_CPT_PCI_PF_SUBSYS_ID 0xa340
21 #define OTX_CPT_PCI_VF_SUBSYS_ID 0xa341
23 /* Configuration and status registers are in BAR0 on OcteonTX platform */
24 #define OTX_CPT_PF_PCI_CFG_BAR 0
25 #define OTX_CPT_VF_PCI_CFG_BAR 0
27 #define OTX_CPT_BAR_E_CPTX_VFX_BAR0_OFFSET(a, b) \
28 (0x000020000000ll + 0x1000000000ll * (a) + 0x100000ll * (b))
29 #define OTX_CPT_BAR_E_CPTX_VFX_BAR0_SIZE 0x400000
31 /* Mailbox interrupts offset */
32 #define OTX_CPT_PF_MBOX_INT 3
33 #define OTX_CPT_PF_INT_VEC_E_MBOXX(x, a) ((x) + (a))
34 /* Number of MSIX supported in PF */
35 #define OTX_CPT_PF_MSIX_VECTORS 4
36 /* Maximum supported microcode groups */
37 #define OTX_CPT_MAX_ENGINE_GROUPS 8
39 /* CPT instruction size in bytes */
40 #define OTX_CPT_INST_SIZE 64
41 /* CPT queue next chunk pointer size in bytes */
42 #define OTX_CPT_NEXT_CHUNK_PTR_SIZE 8
44 /* OcteonTX CPT VF MSIX vectors and their offsets */
45 #define OTX_CPT_VF_MSIX_VECTORS 2
46 #define OTX_CPT_VF_INTR_MBOX_MASK BIT(0)
47 #define OTX_CPT_VF_INTR_DOVF_MASK BIT(1)
48 #define OTX_CPT_VF_INTR_IRDE_MASK BIT(2)
49 #define OTX_CPT_VF_INTR_NWRP_MASK BIT(3)
50 #define OTX_CPT_VF_INTR_SERR_MASK BIT(4)
52 /* OcteonTX CPT PF registers */
53 #define OTX_CPT_PF_CONSTANTS (0x0ll)
54 #define OTX_CPT_PF_RESET (0x100ll)
55 #define OTX_CPT_PF_DIAG (0x120ll)
56 #define OTX_CPT_PF_BIST_STATUS (0x160ll)
57 #define OTX_CPT_PF_ECC0_CTL (0x200ll)
58 #define OTX_CPT_PF_ECC0_FLIP (0x210ll)
59 #define OTX_CPT_PF_ECC0_INT (0x220ll)
60 #define OTX_CPT_PF_ECC0_INT_W1S (0x230ll)
61 #define OTX_CPT_PF_ECC0_ENA_W1S (0x240ll)
62 #define OTX_CPT_PF_ECC0_ENA_W1C (0x250ll)
63 #define OTX_CPT_PF_MBOX_INTX(b) (0x400ll | (u64)(b) << 3)
64 #define OTX_CPT_PF_MBOX_INT_W1SX(b) (0x420ll | (u64)(b) << 3)
65 #define OTX_CPT_PF_MBOX_ENA_W1CX(b) (0x440ll | (u64)(b) << 3)
66 #define OTX_CPT_PF_MBOX_ENA_W1SX(b) (0x460ll | (u64)(b) << 3)
67 #define OTX_CPT_PF_EXEC_INT (0x500ll)
68 #define OTX_CPT_PF_EXEC_INT_W1S (0x520ll)
69 #define OTX_CPT_PF_EXEC_ENA_W1C (0x540ll)
70 #define OTX_CPT_PF_EXEC_ENA_W1S (0x560ll)
71 #define OTX_CPT_PF_GX_EN(b) (0x600ll | (u64)(b) << 3)
72 #define OTX_CPT_PF_EXEC_INFO (0x700ll)
73 #define OTX_CPT_PF_EXEC_BUSY (0x800ll)
74 #define OTX_CPT_PF_EXEC_INFO0 (0x900ll)
75 #define OTX_CPT_PF_EXEC_INFO1 (0x910ll)
76 #define OTX_CPT_PF_INST_REQ_PC (0x10000ll)
77 #define OTX_CPT_PF_INST_LATENCY_PC (0x10020ll)
78 #define OTX_CPT_PF_RD_REQ_PC (0x10040ll)
79 #define OTX_CPT_PF_RD_LATENCY_PC (0x10060ll)
80 #define OTX_CPT_PF_RD_UC_PC (0x10080ll)
81 #define OTX_CPT_PF_ACTIVE_CYCLES_PC (0x10100ll)
82 #define OTX_CPT_PF_EXE_CTL (0x4000000ll)
83 #define OTX_CPT_PF_EXE_STATUS (0x4000008ll)
84 #define OTX_CPT_PF_EXE_CLK (0x4000010ll)
85 #define OTX_CPT_PF_EXE_DBG_CTL (0x4000018ll)
86 #define OTX_CPT_PF_EXE_DBG_DATA (0x4000020ll)
87 #define OTX_CPT_PF_EXE_BIST_STATUS (0x4000028ll)
88 #define OTX_CPT_PF_EXE_REQ_TIMER (0x4000030ll)
89 #define OTX_CPT_PF_EXE_MEM_CTL (0x4000038ll)
90 #define OTX_CPT_PF_EXE_PERF_CTL (0x4001000ll)
91 #define OTX_CPT_PF_EXE_DBG_CNTX(b) (0x4001100ll | (u64)(b) << 3)
92 #define OTX_CPT_PF_EXE_PERF_EVENT_CNT (0x4001180ll)
93 #define OTX_CPT_PF_EXE_EPCI_INBX_CNT(b) (0x4001200ll | (u64)(b) << 3)
94 #define OTX_CPT_PF_EXE_EPCI_OUTBX_CNT(b) (0x4001240ll | (u64)(b) << 3)
95 #define OTX_CPT_PF_ENGX_UCODE_BASE(b) (0x4002000ll | (u64)(b) << 3)
96 #define OTX_CPT_PF_QX_CTL(b) (0x8000000ll | (u64)(b) << 20)
97 #define OTX_CPT_PF_QX_GMCTL(b) (0x8000020ll | (u64)(b) << 20)
98 #define OTX_CPT_PF_QX_CTL2(b) (0x8000100ll | (u64)(b) << 20)
99 #define OTX_CPT_PF_VFX_MBOXX(b, c) (0x8001000ll | (u64)(b) << 20 | \
102 /* OcteonTX CPT VF registers */
103 #define OTX_CPT_VQX_CTL(b) (0x100ll | (u64)(b) << 20)
104 #define OTX_CPT_VQX_SADDR(b) (0x200ll | (u64)(b) << 20)
105 #define OTX_CPT_VQX_DONE_WAIT(b) (0x400ll | (u64)(b) << 20)
106 #define OTX_CPT_VQX_INPROG(b) (0x410ll | (u64)(b) << 20)
107 #define OTX_CPT_VQX_DONE(b) (0x420ll | (u64)(b) << 20)
108 #define OTX_CPT_VQX_DONE_ACK(b) (0x440ll | (u64)(b) << 20)
109 #define OTX_CPT_VQX_DONE_INT_W1S(b) (0x460ll | (u64)(b) << 20)
110 #define OTX_CPT_VQX_DONE_INT_W1C(b) (0x468ll | (u64)(b) << 20)
111 #define OTX_CPT_VQX_DONE_ENA_W1S(b) (0x470ll | (u64)(b) << 20)
112 #define OTX_CPT_VQX_DONE_ENA_W1C(b) (0x478ll | (u64)(b) << 20)
113 #define OTX_CPT_VQX_MISC_INT(b) (0x500ll | (u64)(b) << 20)
114 #define OTX_CPT_VQX_MISC_INT_W1S(b) (0x508ll | (u64)(b) << 20)
115 #define OTX_CPT_VQX_MISC_ENA_W1S(b) (0x510ll | (u64)(b) << 20)
116 #define OTX_CPT_VQX_MISC_ENA_W1C(b) (0x518ll | (u64)(b) << 20)
117 #define OTX_CPT_VQX_DOORBELL(b) (0x600ll | (u64)(b) << 20)
118 #define OTX_CPT_VFX_PF_MBOXX(b, c) (0x1000ll | ((b) << 20) | ((c) << 3))
121 * Enumeration otx_cpt_ucode_error_code_e
123 * Enumerates ucode errors
125 enum otx_cpt_ucode_error_code_e {
126 CPT_NO_UCODE_ERROR = 0x00,
127 ERR_OPCODE_UNSUPPORTED = 0x01,
130 ERR_SCATTER_GATHER_WRITE_LENGTH = 0x02,
131 ERR_SCATTER_GATHER_LIST = 0x03,
132 ERR_SCATTER_GATHER_NOT_SUPPORTED = 0x04,
137 * Enumeration otx_cpt_comp_e
139 * CPT OcteonTX Completion Enumeration
140 * Enumerates the values of CPT_RES_S[COMPCODE].
142 enum otx_cpt_comp_e {
143 CPT_COMP_E_NOTDONE = 0x00,
144 CPT_COMP_E_GOOD = 0x01,
145 CPT_COMP_E_FAULT = 0x02,
146 CPT_COMP_E_SWERR = 0x03,
147 CPT_COMP_E_HWERR = 0x04,
148 CPT_COMP_E_LAST_ENTRY = 0x05
152 * Enumeration otx_cpt_vf_int_vec_e
154 * CPT OcteonTX VF MSI-X Vector Enumeration
155 * Enumerates the MSI-X interrupt vectors.
157 enum otx_cpt_vf_int_vec_e {
158 CPT_VF_INT_VEC_E_MISC = 0x00,
159 CPT_VF_INT_VEC_E_DONE = 0x01
163 * Structure cpt_inst_s
165 * CPT Instruction Structure
166 * This structure specifies the instruction layout. Instructions are
167 * stored in memory as little-endian unless CPT()_PF_Q()_CTL[INST_BE] is set.
170 * doneint:1 Done interrupt.
171 * 0 = No interrupts related to this instruction.
172 * 1 = When the instruction completes, CPT()_VQ()_DONE[DONE] will be
173 * incremented,and based on the rules described there an interrupt may
176 * res_addr [127: 64] Result IOVA.
177 * If nonzero, specifies where to write CPT_RES_S.
178 * If zero, no result structure will be written.
179 * Address must be 16-byte aligned.
180 * Bits <63:49> are ignored by hardware; software should use a
181 * sign-extended bit <48> for forward compatibility.
183 * grp:10 [171:162] If [WQ_PTR] is nonzero, the SSO guest-group to use when
184 * CPT submits work SSO.
185 * For the SSO to not discard the add-work request, FPA_PF_MAP() must map
186 * [GRP] and CPT()_PF_Q()_GMCTL[GMID] as valid.
187 * tt:2 [161:160] If [WQ_PTR] is nonzero, the SSO tag type to use when CPT
188 * submits work to SSO
189 * tag:32 [159:128] If [WQ_PTR] is nonzero, the SSO tag to use when CPT
190 * submits work to SSO.
192 * wq_ptr [255:192] If [WQ_PTR] is nonzero, it is a pointer to a
193 * work-queue entry that CPT submits work to SSO after all context,
194 * output data, and result write operations are visible to other
195 * CNXXXX units and the cores. Bits <2:0> must be zero.
196 * Bits <63:49> are ignored by hardware; software should
197 * use a sign-extended bit <48> for forward compatibility.
199 * Bits <63:49>, <2:0> are ignored by hardware, treated as always 0x0.
201 * ei0; [319:256] Engine instruction word 0. Passed to the AE/SE.
203 * ei1; [383:320] Engine instruction word 1. Passed to the AE/SE.
205 * ei2; [447:384] Engine instruction word 1. Passed to the AE/SE.
207 * ei3; [511:448] Engine instruction word 1. Passed to the AE/SE.
210 union otx_cpt_inst_s {
214 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
215 u64 reserved_17_63:47;
217 u64 reserved_0_15:16;
218 #else /* Word 0 - Little Endian */
219 u64 reserved_0_15:16;
221 u64 reserved_17_63:47;
222 #endif /* Word 0 - End */
224 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
225 u64 reserved_172_191:20;
229 #else /* Word 2 - Little Endian */
233 u64 reserved_172_191:20;
234 #endif /* Word 2 - End */
244 * Structure cpt_res_s
246 * CPT Result Structure
247 * The CPT coprocessor writes the result structure after it completes a
248 * CPT_INST_S instruction. The result structure is exactly 16 bytes, and
249 * each instruction completion produces exactly one result structure.
251 * This structure is stored in memory as little-endian unless
252 * CPT()_PF_Q()_CTL[INST_BE] is set.
255 * doneint:1 [16:16] Done interrupt. This bit is copied from the
256 * corresponding instruction's CPT_INST_S[DONEINT].
257 * compcode:8 [7:0] Indicates completion/error status of the CPT coprocessor
258 * for the associated instruction, as enumerated by CPT_COMP_E.
259 * Core software may write the memory location containing [COMPCODE] to
260 * 0x0 before ringing the doorbell, and then poll for completion by
261 * checking for a nonzero value.
262 * Once the core observes a nonzero [COMPCODE] value in this case,the CPT
263 * coprocessor will have also completed L2/DRAM write operations.
268 union otx_cpt_res_s {
271 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
272 u64 reserved_17_63:47;
276 #else /* Word 0 - Little Endian */
280 u64 reserved_17_63:47;
281 #endif /* Word 0 - End */
287 * Register (NCB) otx_cpt#_pf_bist_status
289 * CPT PF Control Bist Status Register
290 * This register has the BIST status of memories. Each bit is the BIST result
291 * of an individual memory (per bit, 0 = pass and 1 = fail).
292 * otx_cptx_pf_bist_status_s
294 * bstatus [29:0](RO/H) BIST status. One bit per memory, enumerated by
297 union otx_cptx_pf_bist_status {
299 struct otx_cptx_pf_bist_status_s {
300 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
301 u64 reserved_30_63:34;
303 #else /* Word 0 - Little Endian */
305 u64 reserved_30_63:34;
306 #endif /* Word 0 - End */
311 * Register (NCB) otx_cpt#_pf_constants
313 * CPT PF Constants Register
314 * This register contains implementation-related parameters of CPT in CNXXXX.
315 * otx_cptx_pf_constants_s
317 * reserved_40_63:24 [63:40] Reserved.
318 * epcis:8 [39:32](RO) Number of EPCI busses.
319 * grps:8 [31:24](RO) Number of engine groups implemented.
320 * ae:8 [23:16](RO/H) Number of AEs. In CNXXXX, for CPT0 returns 0x0,
321 * for CPT1 returns 0x18, or less if there are fuse-disables.
322 * se:8 [15:8](RO/H) Number of SEs. In CNXXXX, for CPT0 returns 0x30,
323 * or less if there are fuse-disables, for CPT1 returns 0x0.
324 * vq:8 [7:0](RO) Number of VQs.
326 union otx_cptx_pf_constants {
328 struct otx_cptx_pf_constants_s {
329 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
330 u64 reserved_40_63:24;
336 #else /* Word 0 - Little Endian */
342 u64 reserved_40_63:24;
343 #endif /* Word 0 - End */
348 * Register (NCB) otx_cpt#_pf_exe_bist_status
350 * CPT PF Engine Bist Status Register
351 * This register has the BIST status of each engine. Each bit is the
352 * BIST result of an individual engine (per bit, 0 = pass and 1 = fail).
353 * otx_cptx_pf_exe_bist_status_s
355 * reserved_48_63:16 [63:48] reserved
356 * bstatus:48 [47:0](RO/H) BIST status. One bit per engine.
359 union otx_cptx_pf_exe_bist_status {
361 struct otx_cptx_pf_exe_bist_status_s {
362 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
363 u64 reserved_48_63:16;
365 #else /* Word 0 - Little Endian */
367 u64 reserved_48_63:16;
368 #endif /* Word 0 - End */
373 * Register (NCB) otx_cpt#_pf_q#_ctl
375 * CPT Queue Control Register
376 * This register configures queues. This register should be changed only
377 * when quiescent (see CPT()_VQ()_INPROG[INFLIGHT]).
378 * otx_cptx_pf_qx_ctl_s
380 * reserved_60_63:4 [63:60] reserved.
381 * aura:12; [59:48](R/W) Guest-aura for returning this queue's
382 * instruction-chunk buffers to FPA. Only used when [INST_FREE] is set.
383 * For the FPA to not discard the request, FPA_PF_MAP() must map
384 * [AURA] and CPT()_PF_Q()_GMCTL[GMID] as valid.
385 * reserved_45_47:3 [47:45] reserved.
386 * size:13 [44:32](R/W) Command-buffer size, in number of 64-bit words per
387 * command buffer segment. Must be 8*n + 1, where n is the number of
388 * instructions per buffer segment.
389 * reserved_11_31:21 [31:11] Reserved.
390 * cont_err:1 [10:10](R/W) Continue on error.
391 * 0 = When CPT()_VQ()_MISC_INT[NWRP], CPT()_VQ()_MISC_INT[IRDE] or
392 * CPT()_VQ()_MISC_INT[DOVF] are set by hardware or software via
393 * CPT()_VQ()_MISC_INT_W1S, then CPT()_VQ()_CTL[ENA] is cleared. Due to
394 * pipelining, additional instructions may have been processed between the
395 * instruction causing the error and the next instruction in the disabled
396 * queue (the instruction at CPT()_VQ()_SADDR).
397 * 1 = Ignore errors and continue processing instructions.
398 * For diagnostic use only.
399 * inst_free:1 [9:9](R/W) Instruction FPA free. When set, when CPT reaches the
400 * end of an instruction chunk, that chunk will be freed to the FPA.
401 * inst_be:1 [8:8](R/W) Instruction big-endian control. When set, instructions,
402 * instruction next chunk pointers, and result structures are stored in
403 * big-endian format in memory.
404 * iqb_ldwb:1 [7:7](R/W) Instruction load don't write back.
405 * 0 = The hardware issues NCB transient load (LDT) towards the cache,
406 * which if the line hits and is is dirty will cause the line to be
407 * written back before being replaced.
408 * 1 = The hardware issues NCB LDWB read-and-invalidate command towards
409 * the cache when fetching the last word of instructions; as a result the
410 * line will not be written back when replaced. This improves
411 * performance, but software must not read the instructions after they are
412 * posted to the hardware. Reads that do not consume the last word of a
413 * cache line always use LDI.
414 * reserved_4_6:3 [6:4] Reserved.
415 * grp:3; [3:1](R/W) Engine group.
416 * pri:1; [0:0](R/W) Queue priority.
417 * 1 = This queue has higher priority. Round-robin between higher
419 * 0 = This queue has lower priority. Round-robin between lower
422 union otx_cptx_pf_qx_ctl {
424 struct otx_cptx_pf_qx_ctl_s {
425 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
426 u64 reserved_60_63:4;
428 u64 reserved_45_47:3;
430 u64 reserved_11_31:21;
438 #else /* Word 0 - Little Endian */
446 u64 reserved_11_31:21;
448 u64 reserved_45_47:3;
450 u64 reserved_60_63:4;
451 #endif /* Word 0 - End */
456 * Register (NCB) otx_cpt#_vq#_saddr
458 * CPT Queue Starting Buffer Address Registers
459 * These registers set the instruction buffer starting address.
460 * otx_cptx_vqx_saddr_s
462 * reserved_49_63:15 [63:49] Reserved.
463 * ptr:43 [48:6](R/W/H) Instruction buffer IOVA <48:6> (64-byte aligned).
464 * When written, it is the initial buffer starting address; when read,
465 * it is the next read pointer to be requested from L2C. The PTR field
466 * is overwritten with the next pointer each time that the command buffer
467 * segment is exhausted. New commands will then be read from the newly
468 * specified command buffer pointer.
469 * reserved_0_5:6 [5:0] Reserved.
472 union otx_cptx_vqx_saddr {
474 struct otx_cptx_vqx_saddr_s {
475 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
476 u64 reserved_49_63:15;
479 #else /* Word 0 - Little Endian */
482 u64 reserved_49_63:15;
483 #endif /* Word 0 - End */
488 * Register (NCB) otx_cpt#_vq#_misc_ena_w1s
490 * CPT Queue Misc Interrupt Enable Set Register
491 * This register sets interrupt enable bits.
492 * otx_cptx_vqx_misc_ena_w1s_s
494 * reserved_5_63:59 [63:5] Reserved.
495 * swerr:1 [4:4](R/W1S/H) Reads or sets enable for
496 * CPT(0..1)_VQ(0..63)_MISC_INT[SWERR].
497 * nwrp:1 [3:3](R/W1S/H) Reads or sets enable for
498 * CPT(0..1)_VQ(0..63)_MISC_INT[NWRP].
499 * irde:1 [2:2](R/W1S/H) Reads or sets enable for
500 * CPT(0..1)_VQ(0..63)_MISC_INT[IRDE].
501 * dovf:1 [1:1](R/W1S/H) Reads or sets enable for
502 * CPT(0..1)_VQ(0..63)_MISC_INT[DOVF].
503 * mbox:1 [0:0](R/W1S/H) Reads or sets enable for
504 * CPT(0..1)_VQ(0..63)_MISC_INT[MBOX].
507 union otx_cptx_vqx_misc_ena_w1s {
509 struct otx_cptx_vqx_misc_ena_w1s_s {
510 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
511 u64 reserved_5_63:59;
517 #else /* Word 0 - Little Endian */
523 u64 reserved_5_63:59;
524 #endif /* Word 0 - End */
529 * Register (NCB) otx_cpt#_vq#_doorbell
531 * CPT Queue Doorbell Registers
532 * Doorbells for the CPT instruction queues.
533 * otx_cptx_vqx_doorbell_s
535 * reserved_20_63:44 [63:20] Reserved.
536 * dbell_cnt:20 [19:0](R/W/H) Number of instruction queue 64-bit words to add
537 * to the CPT instruction doorbell count. Readback value is the the
538 * current number of pending doorbell requests. If counter overflows
539 * CPT()_VQ()_MISC_INT[DBELL_DOVF] is set. To reset the count back to
540 * zero, write one to clear CPT()_VQ()_MISC_INT_ENA_W1C[DBELL_DOVF],
541 * then write a value of 2^20 minus the read [DBELL_CNT], then write one
542 * to CPT()_VQ()_MISC_INT_W1C[DBELL_DOVF] and
543 * CPT()_VQ()_MISC_INT_ENA_W1S[DBELL_DOVF]. Must be a multiple of 8.
544 * All CPT instructions are 8 words and require a doorbell count of
547 union otx_cptx_vqx_doorbell {
549 struct otx_cptx_vqx_doorbell_s {
550 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
551 u64 reserved_20_63:44;
553 #else /* Word 0 - Little Endian */
555 u64 reserved_20_63:44;
556 #endif /* Word 0 - End */
561 * Register (NCB) otx_cpt#_vq#_inprog
563 * CPT Queue In Progress Count Registers
564 * These registers contain the per-queue instruction in flight registers.
565 * otx_cptx_vqx_inprog_s
567 * reserved_8_63:56 [63:8] Reserved.
568 * inflight:8 [7:0](RO/H) Inflight count. Counts the number of instructions
569 * for the VF for which CPT is fetching, executing or responding to
570 * instructions. However this does not include any interrupts that are
571 * awaiting software handling (CPT()_VQ()_DONE[DONE] != 0x0).
572 * A queue may not be reconfigured until:
573 * 1. CPT()_VQ()_CTL[ENA] is cleared by software.
574 * 2. [INFLIGHT] is polled until equals to zero.
576 union otx_cptx_vqx_inprog {
578 struct otx_cptx_vqx_inprog_s {
579 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
580 u64 reserved_8_63:56;
582 #else /* Word 0 - Little Endian */
584 u64 reserved_8_63:56;
585 #endif /* Word 0 - End */
590 * Register (NCB) otx_cpt#_vq#_misc_int
592 * CPT Queue Misc Interrupt Register
593 * These registers contain the per-queue miscellaneous interrupts.
594 * otx_cptx_vqx_misc_int_s
596 * reserved_5_63:59 [63:5] Reserved.
597 * swerr:1 [4:4](R/W1C/H) Software error from engines.
598 * nwrp:1 [3:3](R/W1C/H) NCB result write response error.
599 * irde:1 [2:2](R/W1C/H) Instruction NCB read response error.
600 * dovf:1 [1:1](R/W1C/H) Doorbell overflow.
601 * mbox:1 [0:0](R/W1C/H) PF to VF mailbox interrupt. Set when
602 * CPT()_VF()_PF_MBOX(0) is written.
605 union otx_cptx_vqx_misc_int {
607 struct otx_cptx_vqx_misc_int_s {
608 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
609 u64 reserved_5_63:59;
615 #else /* Word 0 - Little Endian */
621 u64 reserved_5_63:59;
622 #endif /* Word 0 - End */
627 * Register (NCB) otx_cpt#_vq#_done_ack
629 * CPT Queue Done Count Ack Registers
630 * This register is written by software to acknowledge interrupts.
631 * otx_cptx_vqx_done_ack_s
633 * reserved_20_63:44 [63:20] Reserved.
634 * done_ack:20 [19:0](R/W/H) Number of decrements to CPT()_VQ()_DONE[DONE].
635 * Reads CPT()_VQ()_DONE[DONE]. Written by software to acknowledge
636 * interrupts. If CPT()_VQ()_DONE[DONE] is still nonzero the interrupt
637 * will be re-sent if the conditions described in CPT()_VQ()_DONE[DONE]
641 union otx_cptx_vqx_done_ack {
643 struct otx_cptx_vqx_done_ack_s {
644 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
645 u64 reserved_20_63:44;
647 #else /* Word 0 - Little Endian */
649 u64 reserved_20_63:44;
650 #endif /* Word 0 - End */
655 * Register (NCB) otx_cpt#_vq#_done
657 * CPT Queue Done Count Registers
658 * These registers contain the per-queue instruction done count.
661 * reserved_20_63:44 [63:20] Reserved.
662 * done:20 [19:0](R/W/H) Done count. When CPT_INST_S[DONEINT] set and that
663 * instruction completes, CPT()_VQ()_DONE[DONE] is incremented when the
664 * instruction finishes. Write to this field are for diagnostic use only;
665 * instead software writes CPT()_VQ()_DONE_ACK with the number of
666 * decrements for this field.
667 * Interrupts are sent as follows:
668 * * When CPT()_VQ()_DONE[DONE] = 0, then no results are pending, the
669 * interrupt coalescing timer is held to zero, and an interrupt is not
671 * * When CPT()_VQ()_DONE[DONE] != 0, then the interrupt coalescing timer
672 * counts. If the counter is >= CPT()_VQ()_DONE_WAIT[TIME_WAIT]*1024, or
673 * CPT()_VQ()_DONE[DONE] >= CPT()_VQ()_DONE_WAIT[NUM_WAIT], i.e. enough
674 * time has passed or enough results have arrived, then the interrupt is
676 * * When CPT()_VQ()_DONE_ACK is written (or CPT()_VQ()_DONE is written
677 * but this is not typical), the interrupt coalescing timer restarts.
678 * Note after decrementing this interrupt equation is recomputed,
679 * for example if CPT()_VQ()_DONE[DONE] >= CPT()_VQ()_DONE_WAIT[NUM_WAIT]
680 * and because the timer is zero, the interrupt will be resent immediately.
681 * (This covers the race case between software acknowledging an interrupt
682 * and a result returning.)
683 * * When CPT()_VQ()_DONE_ENA_W1S[DONE] = 0, interrupts are not sent,
684 * but the counting described above still occurs.
685 * Since CPT instructions complete out-of-order, if software is using
686 * completion interrupts the suggested scheme is to request a DONEINT on
687 * each request, and when an interrupt arrives perform a "greedy" scan for
688 * completions; even if a later command is acknowledged first this will
689 * not result in missing a completion.
690 * Software is responsible for making sure [DONE] does not overflow;
691 * for example by insuring there are not more than 2^20-1 instructions in
692 * flight that may request interrupts.
695 union otx_cptx_vqx_done {
697 struct otx_cptx_vqx_done_s {
698 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
699 u64 reserved_20_63:44;
701 #else /* Word 0 - Little Endian */
703 u64 reserved_20_63:44;
704 #endif /* Word 0 - End */
709 * Register (NCB) otx_cpt#_vq#_done_wait
711 * CPT Queue Done Interrupt Coalescing Wait Registers
712 * Specifies the per queue interrupt coalescing settings.
713 * cptx_vqx_done_wait_s
715 * reserved_48_63:16 [63:48] Reserved.
716 * time_wait:16; [47:32](R/W) Time hold-off. When CPT()_VQ()_DONE[DONE] = 0
717 * or CPT()_VQ()_DONE_ACK is written a timer is cleared. When the timer
718 * reaches [TIME_WAIT]*1024 then interrupt coalescing ends.
719 * see CPT()_VQ()_DONE[DONE]. If 0x0, time coalescing is disabled.
720 * reserved_20_31:12 [31:20] Reserved.
721 * num_wait:20 [19:0](R/W) Number of messages hold-off.
722 * When CPT()_VQ()_DONE[DONE] >= [NUM_WAIT] then interrupt coalescing ends
723 * see CPT()_VQ()_DONE[DONE]. If 0x0, same behavior as 0x1.
726 union otx_cptx_vqx_done_wait {
728 struct otx_cptx_vqx_done_wait_s {
729 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
730 u64 reserved_48_63:16;
732 u64 reserved_20_31:12;
734 #else /* Word 0 - Little Endian */
736 u64 reserved_20_31:12;
738 u64 reserved_48_63:16;
739 #endif /* Word 0 - End */
744 * Register (NCB) otx_cpt#_vq#_done_ena_w1s
746 * CPT Queue Done Interrupt Enable Set Registers
747 * Write 1 to these registers will enable the DONEINT interrupt for the queue.
748 * cptx_vqx_done_ena_w1s_s
750 * reserved_1_63:63 [63:1] Reserved.
751 * done:1 [0:0](R/W1S/H) Write 1 will enable DONEINT for this queue.
752 * Write 0 has no effect. Read will return the enable bit.
754 union otx_cptx_vqx_done_ena_w1s {
756 struct otx_cptx_vqx_done_ena_w1s_s {
757 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
758 u64 reserved_1_63:63;
760 #else /* Word 0 - Little Endian */
762 u64 reserved_1_63:63;
763 #endif /* Word 0 - End */
768 * Register (NCB) otx_cpt#_vq#_ctl
770 * CPT VF Queue Control Registers
771 * This register configures queues. This register should be changed (other than
772 * clearing [ENA]) only when quiescent (see CPT()_VQ()_INPROG[INFLIGHT]).
775 * reserved_1_63:63 [63:1] Reserved.
776 * ena:1 [0:0](R/W/H) Enables the logical instruction queue.
777 * See also CPT()_PF_Q()_CTL[CONT_ERR] and CPT()_VQ()_INPROG[INFLIGHT].
778 * 1 = Queue is enabled.
779 * 0 = Queue is disabled.
781 union otx_cptx_vqx_ctl {
783 struct otx_cptx_vqx_ctl_s {
784 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
785 u64 reserved_1_63:63;
787 #else /* Word 0 - Little Endian */
789 u64 reserved_1_63:63;
790 #endif /* Word 0 - End */
795 * Error Address/Error Codes
797 * In the event of a severe error, microcode writes an 8-byte Error Code
798 * value (ECODE) to host memory at the Rptr address specified by the host
799 * system (in the 64-byte request).
802 * [63:56](R) 8-bit completion code
803 * [55:48](R) Number of the core that reported the severe error
804 * [47:0] Lower 6 bytes of M-Inst word2. Used to assist in uniquely
805 * identifying which specific instruction caused the error. This assumes
806 * that each instruction has a unique result location (RPTR), at least
807 * for a given period of time.
809 union otx_cpt_error_code {
811 struct otx_cpt_error_code_s {
812 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
816 #else /* Word 0 - Little Endian */
820 #endif /* Word 0 - End */
824 #endif /*__OTX_CPT_HW_TYPES_H */