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 */
67 struct zip_vqx_sbuf_addr_s9x {
68 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
69 uint64_t reserved_53_63 : 11;
72 #else /* Word 0 - Little Endian */
75 uint64_t reserved_53_63 : 11;
76 #endif /* Word 0 - End */
78 } zip_vqx_sbuf_addr_t;
81 * Register (NCB) zip_que#_doorbell
83 * ZIP Queue Doorbell Registers
84 * Doorbells for the ZIP instruction queues.
88 struct zip_quex_doorbell_s {
89 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
90 uint64_t reserved_20_63 : 44;
91 uint64_t dbell_cnt : 20;
92 #else /* Word 0 - Little Endian */
93 uint64_t dbell_cnt : 20;
94 uint64_t reserved_20_63 : 44;
95 #endif /* Word 0 - End */
97 } zip_quex_doorbell_t;
100 * Structure zip_nptr_s
102 * ZIP Instruction Next-Chunk-Buffer Pointer (NPTR) Structure
103 * This structure is used to chain all the ZIP instruction buffers
104 * together. ZIP instruction buffers are managed
105 * (allocated and released) by software.
109 struct zip_nptr_s_s {
110 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
112 #else /* Word 0 - Little Endian */
114 #endif /* Word 0 - End */
119 * generic ptr address
121 union zip_zptr_addr_s {
122 /** This field can be used to set/clear all bits, or do bitwise
123 * operations over the entire structure.
126 /** generic ptr address */
128 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
130 #else /* Word 0 - Little Endian */
132 #endif /* Word 0 - End */
139 union zip_zptr_ctl_s {
140 /** This field can be used to set/clear all bits, or do bitwise
141 * operations over the entire structure.
144 /** generic ptr ctl */
146 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
147 uint64_t reserved_112_127 : 16;
148 uint64_t length : 16;
149 uint64_t reserved_67_95 : 29;
152 uint64_t data_be : 1;
153 #else /* Word 1 - Little Endian */
154 uint64_t data_be : 1;
157 uint64_t reserved_67_95 : 29;
158 uint64_t length : 16;
159 uint64_t reserved_112_127 : 16;
160 #endif /* Word 1 - End */
166 * Structure zip_inst_s
168 * ZIP Instruction Structure
169 * Each ZIP instruction has 16 words (they are called IWORD0 to IWORD15
170 * within the structure).
173 /** This field can be used to set/clear all bits, or do bitwise
174 * operations over the entire structure.
177 /** ZIP Instruction Structure */
178 struct zip_inst_s_s {
179 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
180 /** Done interrupt */
181 uint64_t doneint : 1;
183 uint64_t reserved_56_62 : 7;
184 /** Total output length */
185 uint64_t totaloutputlength : 24;
187 uint64_t reserved_27_31 : 5;
194 /** Hash more-in-file */
196 /** Hash Algorithm and enable */
200 /** Compression speed/storage */
202 /** Compression coding */
204 /** End of input data */
206 /** Beginning of file */
208 /** Comp/decomp operation */
214 /** History gather */
216 #else /* Word 0 - Little Endian */
231 uint64_t reserved_27_31 : 5;
232 uint64_t totaloutputlength : 24;
233 uint64_t reserved_56_62 : 7;
234 uint64_t doneint : 1;
236 #endif /* Word 0 - End */
238 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
239 /** History length */
240 uint64_t historylength : 16;
242 uint64_t reserved_96_111 : 16;
243 /** adler/crc32 checksum*/
244 uint64_t adlercrc32 : 32;
245 #else /* Word 1 - Little Endian */
246 uint64_t adlercrc32 : 32;
247 uint64_t reserved_96_111 : 16;
248 uint64_t historylength : 16;
249 #endif /* Word 1 - End */
251 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
252 /** Decompression Context Pointer Address */
253 union zip_zptr_addr_s ctx_ptr_addr;
254 #else /* Word 2 - Little Endian */
255 union zip_zptr_addr_s ctx_ptr_addr;
256 #endif /* Word 2 - End */
258 #if defined(__BIG_ENDIAN_BITFIELD)
259 /** Decompression Context Pointer Control */
260 union zip_zptr_ctl_s ctx_ptr_ctl;
261 #else /* Word 3 - Little Endian */
262 union zip_zptr_ctl_s ctx_ptr_ctl;
263 #endif /* Word 3 - End */
265 #if defined(__BIG_ENDIAN_BITFIELD)
266 /** Decompression history pointer address */
267 union zip_zptr_addr_s his_ptr_addr;
268 #else /* Word 4 - Little Endian */
269 union zip_zptr_addr_s his_ptr_addr;
270 #endif /* Word 4 - End */
272 #if defined(__BIG_ENDIAN_BITFIELD)
273 /** Decompression history pointer control */
274 union zip_zptr_ctl_s his_ptr_ctl;
275 #else /* Word 5 - Little Endian */
276 union zip_zptr_ctl_s his_ptr_ctl;
277 #endif /* Word 5 - End */
279 #if defined(__BIG_ENDIAN_BITFIELD)
280 /** Input and compression history pointer address */
281 union zip_zptr_addr_s inp_ptr_addr;
282 #else /* Word 6 - Little Endian */
283 union zip_zptr_addr_s inp_ptr_addr;
284 #endif /* Word 6 - End */
286 #if defined(__BIG_ENDIAN_BITFIELD)
287 /** Input and compression history pointer control */
288 union zip_zptr_ctl_s inp_ptr_ctl;
289 #else /* Word 7 - Little Endian */
290 union zip_zptr_ctl_s inp_ptr_ctl;
291 #endif /* Word 7 - End */
293 #if defined(__BIG_ENDIAN_BITFIELD)
294 /** Output pointer address */
295 union zip_zptr_addr_s out_ptr_addr;
296 #else /* Word 8 - Little Endian */
297 union zip_zptr_addr_s out_ptr_addr;
298 #endif /* Word 8 - End */
300 #if defined(__BIG_ENDIAN_BITFIELD)
301 /** Output pointer control */
302 union zip_zptr_ctl_s out_ptr_ctl;
303 #else /* Word 9 - Little Endian */
304 union zip_zptr_ctl_s out_ptr_ctl;
305 #endif /* Word 9 - End */
307 #if defined(__BIG_ENDIAN_BITFIELD)
308 /** Result pointer address */
309 union zip_zptr_addr_s res_ptr_addr;
310 #else /* Word 10 - Little Endian */
311 union zip_zptr_addr_s res_ptr_addr;
312 #endif /* Word 10 - End */
314 #if defined(__BIG_ENDIAN_BITFIELD)
315 /** Result pointer control */
316 union zip_zptr_ctl_s res_ptr_ctl;
317 #else /* Word 11 - Little Endian */
318 union zip_zptr_ctl_s res_ptr_ctl;
319 #endif /* Word 11 - End */
321 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
323 uint64_t reserved_812_831 : 20;
324 /** SSO guest group */
330 #else /* Word 12 - Little Endian */
334 uint64_t reserved_812_831 : 20;
335 #endif /* Word 12 - End */
337 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
338 /** Work queue entry pointer */
339 uint64_t wq_ptr : 64;
340 #else /* Word 13 - Little Endian */
341 uint64_t wq_ptr : 64;
342 #endif /* Word 13 - End */
344 #if defined(__BIG_ENDIAN_BITFIELD)
346 uint64_t reserved_896_959 : 64;
347 #else /* Word 14 - Little Endian */
348 uint64_t reserved_896_959 : 64;
349 #endif /* Word 14 - End */
350 #if defined(__BIG_ENDIAN_BITFIELD)
351 /** Hash structure pointer */
352 uint64_t hash_ptr : 64;
353 #else /* Word 15 - Little Endian */
354 uint64_t hash_ptr : 64;
355 #endif /* Word 15 - End */
356 } /** ZIP 88xx Instruction Structure */zip88xx;
358 /** ZIP Instruction Structure */
359 struct zip_inst_s_cn83xx {
360 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
361 /** Done interrupt */
362 uint64_t doneint : 1;
364 uint64_t reserved_56_62 : 7;
365 /** Total output length */
366 uint64_t totaloutputlength : 24;
368 uint64_t reserved_27_31 : 5;
375 /** Hash more-in-file */
377 /** Hash Algorithm and enable */
381 /** Compression speed/storage */
383 /** Compression coding */
385 /** End of input data */
387 /** Beginning of file */
389 /** Comp/decomp operation */
395 /** History gather */
397 #else /* Word 0 - Little Endian */
412 uint64_t reserved_27_31 : 5;
413 uint64_t totaloutputlength : 24;
414 uint64_t reserved_56_62 : 7;
415 uint64_t doneint : 1;
416 #endif /* Word 0 - End */
417 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
418 /** History length */
419 uint64_t historylength : 16;
421 uint64_t reserved_96_111 : 16;
422 /** adler/crc32 checksum*/
423 uint64_t adlercrc32 : 32;
424 #else /* Word 1 - Little Endian */
425 uint64_t adlercrc32 : 32;
426 uint64_t reserved_96_111 : 16;
427 uint64_t historylength : 16;
428 #endif /* Word 1 - End */
429 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
430 /** Decompression Context Pointer Address */
431 union zip_zptr_addr_s ctx_ptr_addr;
432 #else /* Word 2 - Little Endian */
433 union zip_zptr_addr_s ctx_ptr_addr;
434 #endif /* Word 2 - End */
435 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
436 /** Decompression Context Pointer Control */
437 union zip_zptr_ctl_s ctx_ptr_ctl;
438 #else /* Word 3 - Little Endian */
439 union zip_zptr_ctl_s ctx_ptr_ctl;
440 #endif /* Word 3 - End */
441 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
442 /** Decompression history pointer address */
443 union zip_zptr_addr_s his_ptr_addr;
444 #else /* Word 4 - Little Endian */
445 union zip_zptr_addr_s his_ptr_addr;
446 #endif /* Word 4 - End */
447 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
448 /** Decompression history pointer control */
449 union zip_zptr_ctl_s his_ptr_ctl;
450 #else /* Word 5 - Little Endian */
451 union zip_zptr_ctl_s his_ptr_ctl;
452 #endif /* Word 5 - End */
453 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
454 /** Input and compression history pointer address */
455 union zip_zptr_addr_s inp_ptr_addr;
456 #else /* Word 6 - Little Endian */
457 union zip_zptr_addr_s inp_ptr_addr;
458 #endif /* Word 6 - End */
459 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
460 /** Input and compression history pointer control */
461 union zip_zptr_ctl_s inp_ptr_ctl;
462 #else /* Word 7 - Little Endian */
463 union zip_zptr_ctl_s inp_ptr_ctl;
464 #endif /* Word 7 - End */
465 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 8 - Big Endian */
466 /** Output pointer address */
467 union zip_zptr_addr_s out_ptr_addr;
468 #else /* Word 8 - Little Endian */
469 union zip_zptr_addr_s out_ptr_addr;
470 #endif /* Word 8 - End */
471 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 9 - Big Endian */
472 /** Output pointer control */
473 union zip_zptr_ctl_s out_ptr_ctl;
474 #else /* Word 9 - Little Endian */
475 union zip_zptr_ctl_s out_ptr_ctl;
476 #endif /* Word 9 - End */
477 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 10 - Big Endian */
478 /** Result pointer address */
479 union zip_zptr_addr_s res_ptr_addr;
480 #else /* Word 10 - Little Endian */
481 union zip_zptr_addr_s res_ptr_addr;
482 #endif /* Word 10 - End */
483 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 11 - Big Endian */
484 /** Result pointer control */
485 union zip_zptr_ctl_s res_ptr_ctl;
486 #else /* Word 11 - Little Endian */
487 union zip_zptr_ctl_s res_ptr_ctl;
488 #endif /* Word 11 - End */
489 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 12 - Big Endian */
491 uint64_t reserved_812_831 : 20;
492 /** SSO guest group */
498 #else /* Word 12 - Little Endian */
502 uint64_t reserved_812_831 : 20;
503 #endif /* Word 12 - End */
504 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 13 - Big Endian */
505 /** Work queue entry pointer */
506 uint64_t wq_ptr : 64;
507 #else /* Word 13 - Little Endian */
508 uint64_t wq_ptr : 64;
509 #endif /* Word 13 - End */
510 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 14 - Big Endian */
512 uint64_t reserved_896_959 : 64;
513 #else /* Word 14 - Little Endian */
514 uint64_t reserved_896_959 : 64;
515 #endif /* Word 14 - End */
516 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 15 - Big Endian */
517 /** Hash structure pointer */
518 uint64_t hash_ptr : 64;
519 #else /* Word 15 - Little Endian */
520 uint64_t hash_ptr : 64;
521 #endif /* Word 15 - End */
522 } /** ZIP 83xx Instruction Structure */s;
526 * Structure zip_zres_s
528 * ZIP Result Structure
529 * The ZIP coprocessor writes the result structure after it completes the
530 * invocation. The result structure is exactly 24 bytes, and each invocation
531 * of the ZIP coprocessor produces exactly one result structure.
534 /** This field can be used to set/clear all bits, or do bitwise
535 * operations over the entire structure.
538 /** ZIP Result Structure */
539 struct zip_zres_s_s {
540 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
541 /** crc32 checksum of uncompressed stream */
543 /** adler32 checksum of uncompressed stream*/
544 uint64_t adler32 : 32;
545 #else /* Word 0 - Little Endian */
546 uint64_t adler32 : 32;
548 #endif /* Word 0 - End */
549 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
550 /** Total numer of Bytes produced in output stream */
551 uint64_t totalbyteswritten : 32;
552 /** Total number of bytes processed from the input stream */
553 uint64_t totalbytesread : 32;
554 #else /* Word 1 - Little Endian */
555 uint64_t totalbytesread : 32;
556 uint64_t totalbyteswritten : 32;
557 #endif /* Word 1 - End */
558 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 2 - Big Endian */
559 /** Total number of compressed input bits
560 * consumed to decompress all blocks in the file
562 uint64_t totalbitsprocessed : 32;
564 uint64_t doneint : 1;
566 uint64_t reserved_155_158 : 4;
570 uint64_t reserved_151 : 1;
574 uint64_t reserved_137_143 : 7;
577 /** Completion/error code */
578 uint64_t compcode : 8;
579 #else /* Word 2 - Little Endian */
580 uint64_t compcode : 8;
582 uint64_t reserved_137_143 : 7;
584 uint64_t reserved_151 : 1;
586 uint64_t reserved_155_158 : 4;
587 uint64_t doneint : 1;
588 uint64_t totalbitsprocessed : 32;
589 #endif /* Word 2 - End */
590 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 3 - Big Endian */
592 uint64_t reserved_253_255 : 3;
593 /** Hash length in bytes */
594 uint64_t hshlen : 61;
595 #else /* Word 3 - Little Endian */
596 uint64_t hshlen : 61;
597 uint64_t reserved_253_255 : 3;
598 #endif /* Word 3 - End */
599 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 4 - Big Endian */
600 /** Double-word 0 of computed hash */
602 #else /* Word 4 - Little Endian */
604 #endif /* Word 4 - End */
605 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 5 - Big Endian */
606 /** Double-word 1 of computed hash */
608 #else /* Word 5 - Little Endian */
610 #endif /* Word 5 - End */
611 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 6 - Big Endian */
612 /** Double-word 2 of computed hash */
614 #else /* Word 6 - Little Endian */
616 #endif /* Word 6 - End */
617 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 7 - Big Endian */
618 /** Double-word 3 of computed hash */
620 #else /* Word 7 - Little Endian */
622 #endif /* Word 7 - End */
623 } /** ZIP Result Structure */s;
627 * Structure zip_zptr_s
629 * ZIP Generic Pointer Structure
630 * This structure is the generic format of pointers in ZIP_INST_S.
633 /** This field can be used to set/clear all bits, or do bitwise
634 * operations over the entire structure.
637 /** ZIP Generic Pointer Structure */
638 struct zip_zptr_s_s {
639 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
640 /** Pointer to Data or scatter-gather list */
642 #else /* Word 0 - Little Endian */
644 #endif /* Word 0 - End */
645 #if defined(__BIG_ENDIAN_BITFIELD) /* Word 1 - Big Endian */
647 uint64_t reserved_112_127 : 16;
648 /** Length of Data or scatter-gather list*/
649 uint64_t length : 16;
651 uint64_t reserved_67_95 : 29;
652 /** Full-block write */
654 /** No cache allocation */
657 uint64_t data_be : 1;
658 #else /* Word 1 - Little Endian */
659 uint64_t data_be : 1;
662 uint64_t reserved_67_95 : 29;
663 uint64_t length : 16;
664 uint64_t reserved_112_127 : 16;
665 #endif /* Word 1 - End */
666 } /** ZIP Generic Pointer Structure */s;
670 * Enumeration zip_comp_e
672 * ZIP Completion Enumeration
673 * Enumerates the values of ZIP_ZRES_S[COMPCODE].
675 #define ZIP_COMP_E_NOTDONE (0)
676 #define ZIP_COMP_E_SUCCESS (1)
677 #define ZIP_COMP_E_DTRUNC (2)
678 #define ZIP_COMP_E_DSTOP (3)
679 #define ZIP_COMP_E_ITRUNC (4)
680 #define ZIP_COMP_E_RBLOCK (5)
681 #define ZIP_COMP_E_NLEN (6)
682 #define ZIP_COMP_E_BADCODE (7)
683 #define ZIP_COMP_E_BADCODE2 (8)
684 #define ZIP_COMP_E_ZERO_LEN (9)
685 #define ZIP_COMP_E_PARITY (0xa)
686 #define ZIP_COMP_E_FATAL (0xb)
687 #define ZIP_COMP_E_TIMEOUT (0xc)
688 #define ZIP_COMP_E_INSTR_ERR (0xd)
689 #define ZIP_COMP_E_HCTX_ERR (0xe)
690 #define ZIP_COMP_E_STOP (3)
693 * Enumeration zip_op_e
695 * ZIP Operation Enumeration
696 * Enumerates ZIP_INST_S[OP].
699 #define ZIP_OP_E_DECOMP (0)
700 #define ZIP_OP_E_NOCOMP (1)
701 #define ZIP_OP_E_COMP (2)
704 * Enumeration zip compression levels
706 * ZIP Compression Level Enumeration
707 * Enumerates ZIP_INST_S[SS].
710 #define ZIP_COMP_E_LEVEL_MAX (0)
711 #define ZIP_COMP_E_LEVEL_MED (1)
712 #define ZIP_COMP_E_LEVEL_LOW (2)
713 #define ZIP_COMP_E_LEVEL_MIN (3)
715 #endif /* _RTE_ZIP_REGS_H_ */