1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Cavium, Inc
5 #ifndef _RTE_OCTEONTX_ZIP_REGS_H_
6 #define _RTE_OCTEONTX_ZIP_REGS_H_
12 * ZIP compression coding Enumeration
13 * Enumerates ZIP_INST_S[CC].
23 * Register (NCB) zip_vq#_ena
25 * ZIP VF Queue Enable Register
26 * If a queue is disabled, ZIP CTL stops fetching instructions from the queue.
30 struct zip_vqx_ena_s {
31 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
32 uint64_t reserved_1_63 : 63;
34 #else /* Word 0 - Little Endian */
36 uint64_t reserved_1_63 : 63;
37 #endif /* Word 0 - End */
42 * Register (NCB) zip_vq#_sbuf_addr
44 * ZIP VF Queue Starting Buffer Address Registers
45 * These registers set the buffer parameters for the instruction queues.
46 * When quiescent (i.e.
47 * outstanding doorbell count is 0), it is safe to rewrite this register
48 * to effectively reset the
49 * command buffer state machine.
50 * These registers must be programmed after software programs the
51 * corresponding ZIP_QUE()_SBUF_CTL.
55 struct zip_vqx_sbuf_addr_s {
56 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
57 uint64_t reserved_49_63 : 15;
60 #else /* Word 0 - Little Endian */
63 uint64_t reserved_49_63 : 15;
64 #endif /* Word 0 - End */
66 } zip_vqx_sbuf_addr_t;
69 * Register (NCB) zip_que#_doorbell
71 * ZIP Queue Doorbell Registers
72 * Doorbells for the ZIP instruction queues.
76 struct zip_quex_doorbell_s {
77 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
78 uint64_t reserved_20_63 : 44;
79 uint64_t dbell_cnt : 20;
80 #else /* Word 0 - Little Endian */
81 uint64_t dbell_cnt : 20;
82 uint64_t reserved_20_63 : 44;
83 #endif /* Word 0 - End */
85 } zip_quex_doorbell_t;
88 * Structure zip_nptr_s
90 * ZIP Instruction Next-Chunk-Buffer Pointer (NPTR) Structure
91 * This structure is used to chain all the ZIP instruction buffers
92 * together. ZIP instruction buffers are managed
93 * (allocated and released) by software.
98 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
100 #else /* Word 0 - Little Endian */
102 #endif /* Word 0 - End */
107 * generic ptr address
109 union zip_zptr_addr_s {
110 /** This field can be used to set/clear all bits, or do bitwise
111 * operations over the entire structure.
114 /** generic ptr address */
116 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
118 #else /* Word 0 - Little Endian */
120 #endif /* Word 0 - End */
127 union zip_zptr_ctl_s {
128 /** This field can be used to set/clear all bits, or do bitwise
129 * operations over the entire structure.
132 /** generic ptr ctl */
134 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
135 uint64_t reserved_112_127 : 16;
136 uint64_t length : 16;
137 uint64_t reserved_67_95 : 29;
140 uint64_t data_be : 1;
141 #else /* Word 1 - Little Endian */
142 uint64_t data_be : 1;
145 uint64_t reserved_67_95 : 29;
146 uint64_t length : 16;
147 uint64_t reserved_112_127 : 16;
148 #endif /* Word 1 - End */
154 * Structure zip_inst_s
156 * ZIP Instruction Structure
157 * Each ZIP instruction has 16 words (they are called IWORD0 to IWORD15
158 * within the structure).
161 /** This field can be used to set/clear all bits, or do bitwise
162 * operations over the entire structure.
165 /** ZIP Instruction Structure */
166 struct zip_inst_s_s {
167 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
168 /** Done interrupt */
169 uint64_t doneint : 1;
171 uint64_t reserved_56_62 : 7;
172 /** Total output length */
173 uint64_t totaloutputlength : 24;
175 uint64_t reserved_27_31 : 5;
182 /** Hash more-in-file */
184 /** Hash Algorithm and enable */
188 /** Compression speed/storage */
190 /** Compression coding */
192 /** End of input data */
194 /** Beginning of file */
196 /** Comp/decomp operation */
202 /** History gather */
204 #else /* Word 0 - Little Endian */
219 uint64_t reserved_27_31 : 5;
220 uint64_t totaloutputlength : 24;
221 uint64_t reserved_56_62 : 7;
222 uint64_t doneint : 1;
224 #endif /* Word 0 - End */
226 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
227 /** History length */
228 uint64_t historylength : 16;
230 uint64_t reserved_96_111 : 16;
231 /** adler/crc32 checksum*/
232 uint64_t adlercrc32 : 32;
233 #else /* Word 1 - Little Endian */
234 uint64_t adlercrc32 : 32;
235 uint64_t reserved_96_111 : 16;
236 uint64_t historylength : 16;
237 #endif /* Word 1 - End */
239 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
240 /** Decompression Context Pointer Address */
241 union zip_zptr_addr_s ctx_ptr_addr;
242 #else /* Word 2 - Little Endian */
243 union zip_zptr_addr_s ctx_ptr_addr;
244 #endif /* Word 2 - End */
246 #if defined(__BIG_ENDIAN_BITFIELD)
247 /** Decompression Context Pointer Control */
248 union zip_zptr_ctl_s ctx_ptr_ctl;
249 #else /* Word 3 - Little Endian */
250 union zip_zptr_ctl_s ctx_ptr_ctl;
251 #endif /* Word 3 - End */
253 #if defined(__BIG_ENDIAN_BITFIELD)
254 /** Decompression history pointer address */
255 union zip_zptr_addr_s his_ptr_addr;
256 #else /* Word 4 - Little Endian */
257 union zip_zptr_addr_s his_ptr_addr;
258 #endif /* Word 4 - End */
260 #if defined(__BIG_ENDIAN_BITFIELD)
261 /** Decompression history pointer control */
262 union zip_zptr_ctl_s his_ptr_ctl;
263 #else /* Word 5 - Little Endian */
264 union zip_zptr_ctl_s his_ptr_ctl;
265 #endif /* Word 5 - End */
267 #if defined(__BIG_ENDIAN_BITFIELD)
268 /** Input and compression history pointer address */
269 union zip_zptr_addr_s inp_ptr_addr;
270 #else /* Word 6 - Little Endian */
271 union zip_zptr_addr_s inp_ptr_addr;
272 #endif /* Word 6 - End */
274 #if defined(__BIG_ENDIAN_BITFIELD)
275 /** Input and compression history pointer control */
276 union zip_zptr_ctl_s inp_ptr_ctl;
277 #else /* Word 7 - Little Endian */
278 union zip_zptr_ctl_s inp_ptr_ctl;
279 #endif /* Word 7 - End */
281 #if defined(__BIG_ENDIAN_BITFIELD)
282 /** Output pointer address */
283 union zip_zptr_addr_s out_ptr_addr;
284 #else /* Word 8 - Little Endian */
285 union zip_zptr_addr_s out_ptr_addr;
286 #endif /* Word 8 - End */
288 #if defined(__BIG_ENDIAN_BITFIELD)
289 /** Output pointer control */
290 union zip_zptr_ctl_s out_ptr_ctl;
291 #else /* Word 9 - Little Endian */
292 union zip_zptr_ctl_s out_ptr_ctl;
293 #endif /* Word 9 - End */
295 #if defined(__BIG_ENDIAN_BITFIELD)
296 /** Result pointer address */
297 union zip_zptr_addr_s res_ptr_addr;
298 #else /* Word 10 - Little Endian */
299 union zip_zptr_addr_s res_ptr_addr;
300 #endif /* Word 10 - End */
302 #if defined(__BIG_ENDIAN_BITFIELD)
303 /** Result pointer control */
304 union zip_zptr_ctl_s res_ptr_ctl;
305 #else /* Word 11 - Little Endian */
306 union zip_zptr_ctl_s res_ptr_ctl;
307 #endif /* Word 11 - End */
309 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
311 uint64_t reserved_812_831 : 20;
312 /** SSO guest group */
318 #else /* Word 12 - Little Endian */
322 uint64_t reserved_812_831 : 20;
323 #endif /* Word 12 - End */
325 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
326 /** Work queue entry pointer */
327 uint64_t wq_ptr : 64;
328 #else /* Word 13 - Little Endian */
329 uint64_t wq_ptr : 64;
330 #endif /* Word 13 - End */
332 #if defined(__BIG_ENDIAN_BITFIELD)
334 uint64_t reserved_896_959 : 64;
335 #else /* Word 14 - Little Endian */
336 uint64_t reserved_896_959 : 64;
337 #endif /* Word 14 - End */
338 #if defined(__BIG_ENDIAN_BITFIELD)
339 /** Hash structure pointer */
340 uint64_t hash_ptr : 64;
341 #else /* Word 15 - Little Endian */
342 uint64_t hash_ptr : 64;
343 #endif /* Word 15 - End */
344 } /** ZIP 88xx Instruction Structure */zip88xx;
346 /** ZIP Instruction Structure */
347 struct zip_inst_s_cn83xx {
348 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
349 /** Done interrupt */
350 uint64_t doneint : 1;
352 uint64_t reserved_56_62 : 7;
353 /** Total output length */
354 uint64_t totaloutputlength : 24;
356 uint64_t reserved_27_31 : 5;
363 /** Hash more-in-file */
365 /** Hash Algorithm and enable */
369 /** Compression speed/storage */
371 /** Compression coding */
373 /** End of input data */
375 /** Beginning of file */
377 /** Comp/decomp operation */
383 /** History gather */
385 #else /* Word 0 - Little Endian */
400 uint64_t reserved_27_31 : 5;
401 uint64_t totaloutputlength : 24;
402 uint64_t reserved_56_62 : 7;
403 uint64_t doneint : 1;
404 #endif /* Word 0 - End */
405 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
406 /** History length */
407 uint64_t historylength : 16;
409 uint64_t reserved_96_111 : 16;
410 /** adler/crc32 checksum*/
411 uint64_t adlercrc32 : 32;
412 #else /* Word 1 - Little Endian */
413 uint64_t adlercrc32 : 32;
414 uint64_t reserved_96_111 : 16;
415 uint64_t historylength : 16;
416 #endif /* Word 1 - End */
417 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
418 /** Decompression Context Pointer Address */
419 union zip_zptr_addr_s ctx_ptr_addr;
420 #else /* Word 2 - Little Endian */
421 union zip_zptr_addr_s ctx_ptr_addr;
422 #endif /* Word 2 - End */
423 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
424 /** Decompression Context Pointer Control */
425 union zip_zptr_ctl_s ctx_ptr_ctl;
426 #else /* Word 3 - Little Endian */
427 union zip_zptr_ctl_s ctx_ptr_ctl;
428 #endif /* Word 3 - End */
429 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
430 /** Decompression history pointer address */
431 union zip_zptr_addr_s his_ptr_addr;
432 #else /* Word 4 - Little Endian */
433 union zip_zptr_addr_s his_ptr_addr;
434 #endif /* Word 4 - End */
435 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
436 /** Decompression history pointer control */
437 union zip_zptr_ctl_s his_ptr_ctl;
438 #else /* Word 5 - Little Endian */
439 union zip_zptr_ctl_s his_ptr_ctl;
440 #endif /* Word 5 - End */
441 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
442 /** Input and compression history pointer address */
443 union zip_zptr_addr_s inp_ptr_addr;
444 #else /* Word 6 - Little Endian */
445 union zip_zptr_addr_s inp_ptr_addr;
446 #endif /* Word 6 - End */
447 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
448 /** Input and compression history pointer control */
449 union zip_zptr_ctl_s inp_ptr_ctl;
450 #else /* Word 7 - Little Endian */
451 union zip_zptr_ctl_s inp_ptr_ctl;
452 #endif /* Word 7 - End */
453 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 8 - Big Endian */
454 /** Output pointer address */
455 union zip_zptr_addr_s out_ptr_addr;
456 #else /* Word 8 - Little Endian */
457 union zip_zptr_addr_s out_ptr_addr;
458 #endif /* Word 8 - End */
459 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 9 - Big Endian */
460 /** Output pointer control */
461 union zip_zptr_ctl_s out_ptr_ctl;
462 #else /* Word 9 - Little Endian */
463 union zip_zptr_ctl_s out_ptr_ctl;
464 #endif /* Word 9 - End */
465 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 10 - Big Endian */
466 /** Result pointer address */
467 union zip_zptr_addr_s res_ptr_addr;
468 #else /* Word 10 - Little Endian */
469 union zip_zptr_addr_s res_ptr_addr;
470 #endif /* Word 10 - End */
471 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 11 - Big Endian */
472 /** Result pointer control */
473 union zip_zptr_ctl_s res_ptr_ctl;
474 #else /* Word 11 - Little Endian */
475 union zip_zptr_ctl_s res_ptr_ctl;
476 #endif /* Word 11 - End */
477 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
479 uint64_t reserved_812_831 : 20;
480 /** SSO guest group */
486 #else /* Word 12 - Little Endian */
490 uint64_t reserved_812_831 : 20;
491 #endif /* Word 12 - End */
492 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
493 /** Work queue entry pointer */
494 uint64_t wq_ptr : 64;
495 #else /* Word 13 - Little Endian */
496 uint64_t wq_ptr : 64;
497 #endif /* Word 13 - End */
498 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 14 - Big Endian */
500 uint64_t reserved_896_959 : 64;
501 #else /* Word 14 - Little Endian */
502 uint64_t reserved_896_959 : 64;
503 #endif /* Word 14 - End */
504 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 15 - Big Endian */
505 /** Hash structure pointer */
506 uint64_t hash_ptr : 64;
507 #else /* Word 15 - Little Endian */
508 uint64_t hash_ptr : 64;
509 #endif /* Word 15 - End */
510 } /** ZIP 83xx Instruction Structure */s;
514 * Structure zip_zres_s
516 * ZIP Result Structure
517 * The ZIP coprocessor writes the result structure after it completes the
518 * invocation. The result structure is exactly 24 bytes, and each invocation
519 * of the ZIP coprocessor produces exactly one result structure.
522 /** This field can be used to set/clear all bits, or do bitwise
523 * operations over the entire structure.
526 /** ZIP Result Structure */
527 struct zip_zres_s_s {
528 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
529 /** crc32 checksum of uncompressed stream */
531 /** adler32 checksum of uncompressed stream*/
532 uint64_t adler32 : 32;
533 #else /* Word 0 - Little Endian */
534 uint64_t adler32 : 32;
536 #endif /* Word 0 - End */
537 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
538 /** Total numer of Bytes produced in output stream */
539 uint64_t totalbyteswritten : 32;
540 /** Total number of bytes processed from the input stream */
541 uint64_t totalbytesread : 32;
542 #else /* Word 1 - Little Endian */
543 uint64_t totalbytesread : 32;
544 uint64_t totalbyteswritten : 32;
545 #endif /* Word 1 - End */
546 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
547 /** Total number of compressed input bits
548 * consumed to decompress all blocks in the file
550 uint64_t totalbitsprocessed : 32;
552 uint64_t doneint : 1;
554 uint64_t reserved_155_158 : 4;
558 uint64_t reserved_151 : 1;
562 uint64_t reserved_137_143 : 7;
565 /** Completion/error code */
566 uint64_t compcode : 8;
567 #else /* Word 2 - Little Endian */
568 uint64_t compcode : 8;
570 uint64_t reserved_137_143 : 7;
572 uint64_t reserved_151 : 1;
574 uint64_t reserved_155_158 : 4;
575 uint64_t doneint : 1;
576 uint64_t totalbitsprocessed : 32;
577 #endif /* Word 2 - End */
578 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
580 uint64_t reserved_253_255 : 3;
581 /** Hash length in bytes */
582 uint64_t hshlen : 61;
583 #else /* Word 3 - Little Endian */
584 uint64_t hshlen : 61;
585 uint64_t reserved_253_255 : 3;
586 #endif /* Word 3 - End */
587 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
588 /** Double-word 0 of computed hash */
590 #else /* Word 4 - Little Endian */
592 #endif /* Word 4 - End */
593 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
594 /** Double-word 1 of computed hash */
596 #else /* Word 5 - Little Endian */
598 #endif /* Word 5 - End */
599 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
600 /** Double-word 2 of computed hash */
602 #else /* Word 6 - Little Endian */
604 #endif /* Word 6 - End */
605 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
606 /** Double-word 3 of computed hash */
608 #else /* Word 7 - Little Endian */
610 #endif /* Word 7 - End */
611 } /** ZIP Result Structure */s;
615 * Structure zip_zptr_s
617 * ZIP Generic Pointer Structure
618 * This structure is the generic format of pointers in ZIP_INST_S.
621 /** This field can be used to set/clear all bits, or do bitwise
622 * operations over the entire structure.
625 /** ZIP Generic Pointer Structure */
626 struct zip_zptr_s_s {
627 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
628 /** Pointer to Data or scatter-gather list */
630 #else /* Word 0 - Little Endian */
632 #endif /* Word 0 - End */
633 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
635 uint64_t reserved_112_127 : 16;
636 /** Length of Data or scatter-gather list*/
637 uint64_t length : 16;
639 uint64_t reserved_67_95 : 29;
640 /** Full-block write */
642 /** No cache allocation */
645 uint64_t data_be : 1;
646 #else /* Word 1 - Little Endian */
647 uint64_t data_be : 1;
650 uint64_t reserved_67_95 : 29;
651 uint64_t length : 16;
652 uint64_t reserved_112_127 : 16;
653 #endif /* Word 1 - End */
654 } /** ZIP Generic Pointer Structure */s;
658 * Enumeration zip_comp_e
660 * ZIP Completion Enumeration
661 * Enumerates the values of ZIP_ZRES_S[COMPCODE].
663 #define ZIP_COMP_E_NOTDONE (0)
664 #define ZIP_COMP_E_SUCCESS (1)
665 #define ZIP_COMP_E_DTRUNC (2)
666 #define ZIP_COMP_E_DSTOP (3)
667 #define ZIP_COMP_E_ITRUNC (4)
668 #define ZIP_COMP_E_RBLOCK (5)
669 #define ZIP_COMP_E_NLEN (6)
670 #define ZIP_COMP_E_BADCODE (7)
671 #define ZIP_COMP_E_BADCODE2 (8)
672 #define ZIP_COMP_E_ZERO_LEN (9)
673 #define ZIP_COMP_E_PARITY (0xa)
674 #define ZIP_COMP_E_FATAL (0xb)
675 #define ZIP_COMP_E_TIMEOUT (0xc)
676 #define ZIP_COMP_E_INSTR_ERR (0xd)
677 #define ZIP_COMP_E_HCTX_ERR (0xe)
678 #define ZIP_COMP_E_STOP (3)
681 * Enumeration zip_op_e
683 * ZIP Operation Enumeration
684 * Enumerates ZIP_INST_S[OP].
687 #define ZIP_OP_E_DECOMP (0)
688 #define ZIP_OP_E_NOCOMP (1)
689 #define ZIP_OP_E_COMP (2)
692 * Enumeration zip compression levels
694 * ZIP Compression Level Enumeration
695 * Enumerates ZIP_INST_S[SS].
698 #define ZIP_COMP_E_LEVEL_MAX (0)
699 #define ZIP_COMP_E_LEVEL_MED (1)
700 #define ZIP_COMP_E_LEVEL_LOW (2)
701 #define ZIP_COMP_E_LEVEL_MIN (3)
703 #endif /* _RTE_ZIP_REGS_H_ */