1 /***********************license start***************
2 * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
35 * For any questions regarding licensing please contact marketing@caviumnetworks.com
37 ***********************license end**************************************/
47 * Header file for the zip (deflate) block
49 * <hr>$Revision: 41586 $<hr>
52 #ifndef __CVMX_ZIP_H__
53 #define __CVMX_ZIP_H__
62 #if __BYTE_ORDER == __BIG_ENDIAN
64 uint64_t full_block_write : 1;
65 uint64_t no_l2_alloc : 1;
66 uint64_t little_endian : 1;
72 uint64_t little_endian : 1;
73 uint64_t no_l2_alloc : 1;
74 uint64_t full_block_write : 1;
79 #define CVMX_ZIP_PTR_MAX_LEN ((1 << 16) - 1)
83 CVMX_ZIP_COMPLETION_NOTDONE = 0,
84 CVMX_ZIP_COMPLETION_SUCCESS = 1,
85 CVMX_ZIP_COMPLETION_OTRUNC = 2,
86 CVMX_ZIP_COMPLETION_STOP = 3,
87 CVMX_ZIP_COMPLETION_ITRUNC = 4,
88 CVMX_ZIP_COMPLETION_RBLOCK = 5,
89 CVMX_ZIP_COMPLETION_NLEN = 6,
90 CVMX_ZIP_COMPLETION_BADCODE = 7,
91 CVMX_ZIP_COMPLETION_BADCODE2 = 8,
92 CVMX_ZIP_COMPLETION_ZERO_LEN = 9,
93 CVMX_ZIP_COMPLETION_PARITY = 10
94 } cvmx_zip_completion_code_t;
101 #if __BYTE_ORDER == __BIG_ENDIAN
110 #if __BYTE_ORDER == __BIG_ENDIAN
111 uint64_t totalbyteswritten : 32;
112 uint64_t totalbytesread : 32;
114 uint64_t totalbytesread : 32;
115 uint64_t totalbyteswritten : 32;
119 #if __BYTE_ORDER == __BIG_ENDIAN
120 uint64_t totalbitsprocessed : 32; // decompression only
121 uint64_t unused20 : 5;
122 uint64_t exnum : 3; // compression only
123 uint64_t unused21 : 1;
124 uint64_t exbits : 7; // compression only
125 uint64_t unused22 : 7;
126 uint64_t eof : 1; // decompression only
127 cvmx_zip_completion_code_t completioncode : 8; // If polling, SW should set this to zero and wait for non-zero
129 cvmx_zip_completion_code_t completioncode : 8; // If polling, SW should set this to zero and wait for non-zero
130 uint64_t eof : 1; // decompression only
131 uint64_t unused22 : 7;
132 uint64_t exbits : 7; // compression only
133 uint64_t unused21 : 1;
134 uint64_t exnum : 3; // compression only
135 uint64_t unused20 : 5;
136 uint64_t totalbitsprocessed : 32; // decompression only
146 #if __BYTE_ORDER == __BIG_ENDIAN
147 uint64_t unused00 : 8;
148 uint64_t totaloutputlength : 24;
149 uint64_t unused01 : 5;
151 uint64_t unused02 : 1;
153 uint64_t unused03 : 6;
155 uint64_t forcefixed : 1;
156 uint64_t forcedynamic : 1;
159 uint64_t compress : 1;
160 uint64_t unused04 : 1;
161 uint64_t dscatter : 1;
162 uint64_t dgather : 1;
163 uint64_t hgather : 1;
165 uint64_t hgather : 1;
166 uint64_t dgather : 1;
167 uint64_t dscatter : 1;
168 uint64_t unused04 : 1;
169 uint64_t compress : 1;
172 uint64_t forcedynamic : 1;
173 uint64_t forcefixed : 1;
175 uint64_t unused03 : 6;
177 uint64_t unused02 : 1;
179 uint64_t unused01 : 5;
180 uint64_t totaloutputlength : 24;
181 uint64_t unused00 : 8;
185 #if __BYTE_ORDER == __BIG_ENDIAN
186 uint64_t historylength : 16;
187 uint64_t unused10 : 16;
188 uint64_t adler32 : 32;
190 uint64_t adler32 : 32;
191 uint64_t unused10 : 16;
192 uint64_t historylength : 16;
196 cvmx_zip_ptr_t ctx_ptr;
199 cvmx_zip_ptr_t hist_ptr;
202 cvmx_zip_ptr_t in_ptr;
205 cvmx_zip_ptr_t out_ptr;
208 cvmx_zip_ptr_t result_ptr;
211 cvmx_zip_ptr_t wq_ptr;
214 } cvmx_zip_command_t;
218 * Initialize the ZIP block
220 * @return Zero on success, negative on failure
222 int cvmx_zip_initialize(void);
225 * Shutdown the ZIP block. ZIP must be idle when
226 * this function is called.
228 * @return Zero on success, negative on failure
230 int cvmx_zip_shutdown(void);
233 * Submit a command to the ZIP block
235 * @param command Zip command to submit
237 * @return Zero on success, negative on failure
239 int cvmx_zip_submit(cvmx_zip_command_t *command);
241 /* CSR typedefs have been moved to cvmx-csr-*.h */
247 #endif /* __CVMX_ZIP_H__ */