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 */
39 /* struct zip_vqx_ena_s cn; */
43 * Register (NCB) zip_vq#_sbuf_addr
45 * ZIP VF Queue Starting Buffer Address Registers
46 * These registers set the buffer parameters for the instruction queues.
47 * When quiescent (i.e.
48 * outstanding doorbell count is 0), it is safe to rewrite this register
49 * to effectively reset the
50 * command buffer state machine.
51 * These registers must be programmed after software programs the
52 * corresponding ZIP_QUE()_SBUF_CTL.
56 struct zip_vqx_sbuf_addr_s {
57 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
58 uint64_t reserved_49_63 : 15;
61 #else /* Word 0 - Little Endian */
64 uint64_t reserved_49_63 : 15;
65 #endif /* Word 0 - End */
67 /* struct zip_vqx_sbuf_addr_s cn; */
68 } zip_vqx_sbuf_addr_t;
71 * Register (NCB) zip_que#_doorbell
73 * ZIP Queue Doorbell Registers
74 * Doorbells for the ZIP instruction queues.
78 struct zip_quex_doorbell_s {
79 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
80 uint64_t reserved_20_63 : 44;
81 uint64_t dbell_cnt : 20;
82 #else /* Word 0 - Little Endian */
83 uint64_t dbell_cnt : 20;
84 uint64_t reserved_20_63 : 44;
85 #endif /* Word 0 - End */
87 /* struct zip_quex_doorbell_s cn; */
88 } zip_quex_doorbell_t;
91 * Structure zip_nptr_s
93 * ZIP Instruction Next-Chunk-Buffer Pointer (NPTR) Structure
94 * This structure is used to chain all the ZIP instruction buffers
95 * together. ZIP instruction buffers are managed
96 * (allocated and released) by software.
100 struct zip_nptr_s_s {
101 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
103 #else /* Word 0 - Little Endian */
105 #endif /* Word 0 - End */
107 /* struct zip_nptr_s_s cn83xx; */
111 * generic ptr address
113 union zip_zptr_addr_s {
114 /** This field can be used to set/clear all bits, or do bitwise
115 * operations over the entire structure.
118 /** generic ptr address */
120 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
122 #else /* Word 0 - Little Endian */
124 #endif /* Word 0 - End */
131 union zip_zptr_ctl_s {
132 /** This field can be used to set/clear all bits, or do bitwise
133 * operations over the entire structure.
136 /** generic ptr ctl */
138 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
139 uint64_t reserved_112_127 : 16;
140 uint64_t length : 16;
141 uint64_t reserved_67_95 : 29;
144 uint64_t data_be : 1;
145 #else /* Word 1 - Little Endian */
146 uint64_t data_be : 1;
149 uint64_t reserved_67_95 : 29;
150 uint64_t length : 16;
151 uint64_t reserved_112_127 : 16;
152 #endif /* Word 1 - End */
158 * Structure zip_inst_s
160 * ZIP Instruction Structure
161 * Each ZIP instruction has 16 words (they are called IWORD0 to IWORD15
162 * within the structure).
165 /** This field can be used to set/clear all bits, or do bitwise
166 * operations over the entire structure.
169 /** ZIP Instruction Structure */
170 struct zip_inst_s_s {
171 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
172 /** Done interrupt */
173 uint64_t doneint : 1;
175 uint64_t reserved_56_62 : 7;
176 /** Total output length */
177 uint64_t totaloutputlength : 24;
179 uint64_t reserved_27_31 : 5;
186 /** Hash more-in-file */
188 /** Hash Algorithm and enable */
192 /** Compression speed/storage */
194 /** Compression coding */
196 /** End of input data */
198 /** Beginning of file */
200 // uint64_t reserved_3_4 : 2;
201 /** Comp/decomp operation */
207 /** History gather */
209 #else /* Word 0 - Little Endian */
213 //uint64_t reserved_3_4 : 2;
225 uint64_t reserved_27_31 : 5;
226 uint64_t totaloutputlength : 24;
227 uint64_t reserved_56_62 : 7;
228 uint64_t doneint : 1;
230 #endif /* Word 0 - End */
232 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
233 /** History length */
234 uint64_t historylength : 16;
236 uint64_t reserved_96_111 : 16;
237 /** adler/crc32 checksum*/
238 uint64_t adlercrc32 : 32;
239 #else /* Word 1 - Little Endian */
240 uint64_t adlercrc32 : 32;
241 uint64_t reserved_96_111 : 16;
242 uint64_t historylength : 16;
243 #endif /* Word 1 - End */
245 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
246 /** Decompression Context Pointer Address */
247 union zip_zptr_addr_s ctx_ptr_addr;
248 #else /* Word 2 - Little Endian */
249 union zip_zptr_addr_s ctx_ptr_addr;
250 #endif /* Word 2 - End */
252 #if defined(__BIG_ENDIAN_BITFIELD)
253 /** Decompression Context Pointer Control */
254 union zip_zptr_ctl_s ctx_ptr_ctl;
255 #else /* Word 3 - Little Endian */
256 union zip_zptr_ctl_s ctx_ptr_ctl;
257 #endif /* Word 3 - End */
259 #if defined(__BIG_ENDIAN_BITFIELD)
260 /** Decompression history pointer address */
261 union zip_zptr_addr_s his_ptr_addr;
262 #else /* Word 4 - Little Endian */
263 union zip_zptr_addr_s his_ptr_addr;
264 #endif /* Word 4 - End */
266 #if defined(__BIG_ENDIAN_BITFIELD)
267 /** Decompression history pointer control */
268 union zip_zptr_ctl_s his_ptr_ctl;
269 #else /* Word 5 - Little Endian */
270 union zip_zptr_ctl_s his_ptr_ctl;
271 #endif /* Word 5 - End */
273 #if defined(__BIG_ENDIAN_BITFIELD)
274 /** Input and compression history pointer address */
275 union zip_zptr_addr_s inp_ptr_addr;
276 #else /* Word 6 - Little Endian */
277 union zip_zptr_addr_s inp_ptr_addr;
278 #endif /* Word 6 - End */
280 #if defined(__BIG_ENDIAN_BITFIELD)
281 /** Input and compression history pointer control */
282 union zip_zptr_ctl_s inp_ptr_ctl;
283 #else /* Word 7 - Little Endian */
284 union zip_zptr_ctl_s inp_ptr_ctl;
285 #endif /* Word 7 - End */
287 #if defined(__BIG_ENDIAN_BITFIELD)
288 /** Output pointer address */
289 union zip_zptr_addr_s out_ptr_addr;
290 #else /* Word 8 - Little Endian */
291 union zip_zptr_addr_s out_ptr_addr;
292 #endif /* Word 8 - End */
294 #if defined(__BIG_ENDIAN_BITFIELD)
295 /** Output pointer control */
296 union zip_zptr_ctl_s out_ptr_ctl;
297 #else /* Word 9 - Little Endian */
298 union zip_zptr_ctl_s out_ptr_ctl;
299 #endif /* Word 9 - End */
301 #if defined(__BIG_ENDIAN_BITFIELD)
302 /** Result pointer address */
303 union zip_zptr_addr_s res_ptr_addr;
304 #else /* Word 10 - Little Endian */
305 union zip_zptr_addr_s res_ptr_addr;
306 #endif /* Word 10 - End */
308 #if defined(__BIG_ENDIAN_BITFIELD)
309 /** Result pointer control */
310 union zip_zptr_ctl_s res_ptr_ctl;
311 #else /* Word 11 - Little Endian */
312 union zip_zptr_ctl_s res_ptr_ctl;
313 #endif /* Word 11 - End */
315 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
317 uint64_t reserved_812_831 : 20;
318 /** SSO guest group */
324 #else /* Word 12 - Little Endian */
328 uint64_t reserved_812_831 : 20;
329 #endif /* Word 12 - End */
331 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
332 /** Work queue entry pointer */
333 uint64_t wq_ptr : 64;
334 #else /* Word 13 - Little Endian */
335 uint64_t wq_ptr : 64;
336 #endif /* Word 13 - End */
338 #if defined(__BIG_ENDIAN_BITFIELD)
340 uint64_t reserved_896_959 : 64;
341 #else /* Word 14 - Little Endian */
342 uint64_t reserved_896_959 : 64;
343 #endif /* Word 14 - End */
344 #if defined(__BIG_ENDIAN_BITFIELD)
345 /** Hash structure pointer */
346 uint64_t hash_ptr : 64;
347 #else /* Word 15 - Little Endian */
348 uint64_t hash_ptr : 64;
349 #endif /* Word 15 - End */
350 } /** ZIP 88xx Instruction Structure */zip88xx;
352 /** ZIP Instruction Structure */
353 struct zip_inst_s_cn83xx {
354 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
355 /** Done interrupt */
356 uint64_t doneint : 1;
358 uint64_t reserved_56_62 : 7;
359 /** Total output length */
360 uint64_t totaloutputlength : 24;
362 uint64_t reserved_27_31 : 5;
369 /** Hash more-in-file */
371 /** Hash Algorithm and enable */
375 /** Compression speed/storage */
377 /** Compression coding */
379 /** End of input data */
381 /** Beginning of file */
383 /** Comp/decomp operation */
389 /** History gather */
391 #else /* Word 0 - Little Endian */
406 uint64_t reserved_27_31 : 5;
407 uint64_t totaloutputlength : 24;
408 uint64_t reserved_56_62 : 7;
409 uint64_t doneint : 1;
410 #endif /* Word 0 - End */
411 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
412 /** History length */
413 uint64_t historylength : 16;
415 uint64_t reserved_96_111 : 16;
416 /** adler/crc32 checksum*/
417 uint64_t adlercrc32 : 32;
418 #else /* Word 1 - Little Endian */
419 uint64_t adlercrc32 : 32;
420 uint64_t reserved_96_111 : 16;
421 uint64_t historylength : 16;
422 #endif /* Word 1 - End */
423 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
424 /** Decompression Context Pointer Address */
425 union zip_zptr_addr_s ctx_ptr_addr;
426 #else /* Word 2 - Little Endian */
427 union zip_zptr_addr_s ctx_ptr_addr;
428 #endif /* Word 2 - End */
429 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
430 /** Decompression Context Pointer Control */
431 union zip_zptr_ctl_s ctx_ptr_ctl;
432 #else /* Word 3 - Little Endian */
433 union zip_zptr_ctl_s ctx_ptr_ctl;
434 #endif /* Word 3 - End */
435 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
436 /** Decompression history pointer address */
437 union zip_zptr_addr_s his_ptr_addr;
438 #else /* Word 4 - Little Endian */
439 union zip_zptr_addr_s his_ptr_addr;
440 #endif /* Word 4 - End */
441 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
442 /** Decompression history pointer control */
443 union zip_zptr_ctl_s his_ptr_ctl;
444 #else /* Word 5 - Little Endian */
445 union zip_zptr_ctl_s his_ptr_ctl;
446 #endif /* Word 5 - End */
447 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
448 /** Input and compression history pointer address */
449 union zip_zptr_addr_s inp_ptr_addr;
450 #else /* Word 6 - Little Endian */
451 union zip_zptr_addr_s inp_ptr_addr;
452 #endif /* Word 6 - End */
453 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
454 /** Input and compression history pointer control */
455 union zip_zptr_ctl_s inp_ptr_ctl;
456 #else /* Word 7 - Little Endian */
457 union zip_zptr_ctl_s inp_ptr_ctl;
458 #endif /* Word 7 - End */
459 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 8 - Big Endian */
460 /** Output pointer address */
461 union zip_zptr_addr_s out_ptr_addr;
462 #else /* Word 8 - Little Endian */
463 union zip_zptr_addr_s out_ptr_addr;
464 #endif /* Word 8 - End */
465 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 9 - Big Endian */
466 /** Output pointer control */
467 union zip_zptr_ctl_s out_ptr_ctl;
468 #else /* Word 9 - Little Endian */
469 union zip_zptr_ctl_s out_ptr_ctl;
470 #endif /* Word 9 - End */
471 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 10 - Big Endian */
472 /** Result pointer address */
473 union zip_zptr_addr_s res_ptr_addr;
474 #else /* Word 10 - Little Endian */
475 union zip_zptr_addr_s res_ptr_addr;
476 #endif /* Word 10 - End */
477 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 11 - Big Endian */
478 /** Result pointer control */
479 union zip_zptr_ctl_s res_ptr_ctl;
480 #else /* Word 11 - Little Endian */
481 union zip_zptr_ctl_s res_ptr_ctl;
482 #endif /* Word 11 - End */
483 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
485 uint64_t reserved_812_831 : 20;
486 /** SSO guest group */
492 #else /* Word 12 - Little Endian */
496 uint64_t reserved_812_831 : 20;
497 #endif /* Word 12 - End */
498 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
499 /** Work queue entry pointer */
500 uint64_t wq_ptr : 64;
501 #else /* Word 13 - Little Endian */
502 uint64_t wq_ptr : 64;
503 #endif /* Word 13 - End */
504 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 14 - Big Endian */
506 uint64_t reserved_896_959 : 64;
507 #else /* Word 14 - Little Endian */
508 uint64_t reserved_896_959 : 64;
509 #endif /* Word 14 - End */
510 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 15 - Big Endian */
511 /** Hash structure pointer */
512 uint64_t hash_ptr : 64;
513 #else /* Word 15 - Little Endian */
514 uint64_t hash_ptr : 64;
515 #endif /* Word 15 - End */
516 } /** ZIP 83xx Instruction Structure */s;
520 * Structure zip_zres_s
522 * ZIP Result Structure
523 * The ZIP coprocessor writes the result structure after it completes the
524 * invocation. The result structure is exactly 24 bytes, and each invocation
525 * of the ZIP coprocessor produces exactly one result structure.
528 /** This field can be used to set/clear all bits, or do bitwise
529 * operations over the entire structure.
532 /** ZIP Result Structure */
533 struct zip_zres_s_s {
534 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
535 /** crc32 checksum of uncompressed stream */
537 /** adler32 checksum of uncompressed stream*/
538 uint64_t adler32 : 32;
539 #else /* Word 0 - Little Endian */
540 uint64_t adler32 : 32;
542 #endif /* Word 0 - End */
543 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
544 /** Total numer of Bytes produced in output stream */
545 uint64_t totalbyteswritten : 32;
546 /** Total number of bytes processed from the input stream */
547 uint64_t totalbytesread : 32;
548 #else /* Word 1 - Little Endian */
549 uint64_t totalbytesread : 32;
550 uint64_t totalbyteswritten : 32;
551 #endif /* Word 1 - End */
552 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
553 /** Total number of compressed input bits
554 * consumed to decompress all blocks in the file
556 uint64_t totalbitsprocessed : 32;
558 uint64_t doneint : 1;
560 uint64_t reserved_155_158 : 4;
564 uint64_t reserved_151 : 1;
568 uint64_t reserved_137_143 : 7;
571 /** Completion/error code */
572 uint64_t compcode : 8;
573 #else /* Word 2 - Little Endian */
574 uint64_t compcode : 8;
576 uint64_t reserved_137_143 : 7;
578 uint64_t reserved_151 : 1;
580 uint64_t reserved_155_158 : 4;
581 uint64_t doneint : 1;
582 uint64_t totalbitsprocessed : 32;
583 #endif /* Word 2 - End */
584 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
586 uint64_t reserved_253_255 : 3;
587 /** Hash length in bytes */
588 uint64_t hshlen : 61;
589 #else /* Word 3 - Little Endian */
590 uint64_t hshlen : 61;
591 uint64_t reserved_253_255 : 3;
592 #endif /* Word 3 - End */
593 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
594 /** Double-word 0 of computed hash */
596 #else /* Word 4 - Little Endian */
598 #endif /* Word 4 - End */
599 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
600 /** Double-word 1 of computed hash */
602 #else /* Word 5 - Little Endian */
604 #endif /* Word 5 - End */
605 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
606 /** Double-word 2 of computed hash */
608 #else /* Word 6 - Little Endian */
610 #endif /* Word 6 - End */
611 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
612 /** Double-word 3 of computed hash */
614 #else /* Word 7 - Little Endian */
616 #endif /* Word 7 - End */
617 } /** ZIP Result Structure */s;
619 /* struct zip_zres_s_s cn83xx; */
623 * Structure zip_zptr_s
625 * ZIP Generic Pointer Structure
626 * This structure is the generic format of pointers in ZIP_INST_S.
629 /** This field can be used to set/clear all bits, or do bitwise
630 * operations over the entire structure.
633 /** ZIP Generic Pointer Structure */
634 struct zip_zptr_s_s {
635 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
636 /** Pointer to Data or scatter-gather list */
638 #else /* Word 0 - Little Endian */
640 #endif /* Word 0 - End */
641 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
643 uint64_t reserved_112_127 : 16;
644 /** Length of Data or scatter-gather list*/
645 uint64_t length : 16;
647 uint64_t reserved_67_95 : 29;
648 /** Full-block write */
650 /** No cache allocation */
653 uint64_t data_be : 1;
654 #else /* Word 1 - Little Endian */
655 uint64_t data_be : 1;
658 uint64_t reserved_67_95 : 29;
659 uint64_t length : 16;
660 uint64_t reserved_112_127 : 16;
661 #endif /* Word 1 - End */
662 } /** ZIP Generic Pointer Structure */s;
666 * Enumeration zip_comp_e
668 * ZIP Completion Enumeration
669 * Enumerates the values of ZIP_ZRES_S[COMPCODE].
671 #define ZIP_COMP_E_NOTDONE (0)
672 #define ZIP_COMP_E_SUCCESS (1)
673 #define ZIP_COMP_E_DTRUNC (2)
674 #define ZIP_COMP_E_DSTOP (3)
675 #define ZIP_COMP_E_ITRUNC (4)
676 #define ZIP_COMP_E_RBLOCK (5)
677 #define ZIP_COMP_E_NLEN (6)
678 #define ZIP_COMP_E_BADCODE (7)
679 #define ZIP_COMP_E_BADCODE2 (8)
680 #define ZIP_COMP_E_ZERO_LEN (9)
681 #define ZIP_COMP_E_PARITY (0xa)
682 #define ZIP_COMP_E_FATAL (0xb)
683 #define ZIP_COMP_E_TIMEOUT (0xc)
684 #define ZIP_COMP_E_INSTR_ERR (0xd)
685 #define ZIP_COMP_E_HCTX_ERR (0xe)
686 #define ZIP_COMP_E_STOP (3)
689 * Enumeration zip_op_e
691 * ZIP Operation Enumeration
692 * Enumerates ZIP_INST_S[OP].
695 #define ZIP_OP_E_DECOMP (0)
696 #define ZIP_OP_E_NOCOMP (1)
697 #define ZIP_OP_E_COMP (2)
700 * Enumeration zip compression levels
702 * ZIP Compression Level Enumeration
703 * Enumerates ZIP_INST_S[SS].
706 #define ZIP_COMP_E_LEVEL_MAX (0)
707 #define ZIP_COMP_E_LEVEL_MED (1)
708 #define ZIP_COMP_E_LEVEL_LOW (2)
709 #define ZIP_COMP_E_LEVEL_MIN (3)
711 #endif /* _RTE_ZIP_REGS_H_ */