1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (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 Inc. 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 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
49 * Header file for the zip (deflate) block
51 * <hr>$Revision: 70030 $<hr>
54 #ifndef __CVMX_ZIP_H__
55 #define __CVMX_ZIP_H__
64 #ifdef __BIG_ENDIAN_BITFIELD
66 uint64_t full_block_write : 1;
67 uint64_t no_l2_alloc : 1;
68 uint64_t little_endian : 1;
74 uint64_t little_endian : 1;
75 uint64_t no_l2_alloc : 1;
76 uint64_t full_block_write : 1;
81 #define CVMX_ZIP_PTR_MAX_LEN ((1 << 16) - 1)
85 CVMX_ZIP_COMPLETION_NOTDONE = 0,
86 CVMX_ZIP_COMPLETION_SUCCESS = 1,
87 CVMX_ZIP_COMPLETION_OTRUNC = 2,
88 CVMX_ZIP_COMPLETION_STOP = 3,
89 CVMX_ZIP_COMPLETION_ITRUNC = 4,
90 CVMX_ZIP_COMPLETION_RBLOCK = 5,
91 CVMX_ZIP_COMPLETION_NLEN = 6,
92 CVMX_ZIP_COMPLETION_BADCODE = 7,
93 CVMX_ZIP_COMPLETION_BADCODE2 = 8,
94 CVMX_ZIP_COMPLETION_ZERO_LEN = 9,
95 CVMX_ZIP_COMPLETION_PARITY = 10,
96 CVMX_ZIP_COMPLETION_FATAL = 11
97 } cvmx_zip_completion_code_t;
104 #ifdef __BIG_ENDIAN_BITFIELD
113 #ifdef __BIG_ENDIAN_BITFIELD
114 uint64_t totalbyteswritten : 32;
115 uint64_t totalbytesread : 32;
117 uint64_t totalbytesread : 32;
118 uint64_t totalbyteswritten : 32;
122 #ifdef __BIG_ENDIAN_BITFIELD
123 uint64_t totalbitsprocessed : 32; // decompression only
124 uint64_t unused20 : 5;
125 uint64_t exnum : 3; // compression only
126 uint64_t unused21 : 1;
127 uint64_t exbits : 7; // compression only
128 uint64_t unused22 : 7;
129 uint64_t eof : 1; // decompression only
130 cvmx_zip_completion_code_t completioncode : 8; // If polling, SW should set this to zero and wait for non-zero
132 cvmx_zip_completion_code_t completioncode : 8; // If polling, SW should set this to zero and wait for non-zero
133 uint64_t eof : 1; // decompression only
134 uint64_t unused22 : 7;
135 uint64_t exbits : 7; // compression only
136 uint64_t unused21 : 1;
137 uint64_t exnum : 3; // compression only
138 uint64_t unused20 : 5;
139 uint64_t totalbitsprocessed : 32; // decompression only
149 #ifdef __BIG_ENDIAN_BITFIELD
150 uint64_t unused00 : 8;
151 uint64_t totaloutputlength : 24;
152 uint64_t unused01 : 5;
154 uint64_t unused02 : 1;
156 uint64_t unused03 : 4;
159 uint64_t forcefixed : 1;
160 uint64_t forcedynamic : 1;
163 uint64_t compress : 1;
164 uint64_t unused04 : 1;
165 uint64_t dscatter : 1;
166 uint64_t dgather : 1;
167 uint64_t hgather : 1;
169 uint64_t hgather : 1;
170 uint64_t dgather : 1;
171 uint64_t dscatter : 1;
172 uint64_t unused04 : 1;
173 uint64_t compress : 1;
176 uint64_t forcedynamic : 1;
177 uint64_t forcefixed : 1;
180 uint64_t unused03 : 4;
182 uint64_t unused02 : 1;
184 uint64_t unused01 : 5;
185 uint64_t totaloutputlength : 24;
186 uint64_t unused00 : 8;
190 #ifdef __BIG_ENDIAN_BITFIELD
191 uint64_t historylength : 16;
192 uint64_t unused10 : 16;
193 uint64_t adler32 : 32;
195 uint64_t adler32 : 32;
196 uint64_t unused10 : 16;
197 uint64_t historylength : 16;
201 cvmx_zip_ptr_t ctx_ptr;
204 cvmx_zip_ptr_t hist_ptr;
207 cvmx_zip_ptr_t in_ptr;
210 cvmx_zip_ptr_t out_ptr;
213 cvmx_zip_ptr_t result_ptr;
216 cvmx_zip_ptr_t wq_ptr;
219 } cvmx_zip_command_t;
223 * Initialize the ZIP block
225 * @return Zero on success, negative on failure
227 int cvmx_zip_initialize(void);
230 * Initialize the ZIP QUEUE buffer
232 * @param queue : ZIP instruction queue
233 * @param zcoremask : ZIP coremask to use for this queue
235 * @return Zero on success, negative on failure
237 int cvmx_zip_queue_initialize(int queue, int zcoremask);
240 * Shutdown the ZIP block. ZIP must be idle when
241 * this function is called.
243 * @return Zero on success, negative on failure
245 int cvmx_zip_shutdown(void);
248 * Shutdown the ZIP block for a queue. ZIP must be idle when
249 * this function is called.
251 * @param queue Zip instruction queue of the command
253 * @return Zero on success, negative on failure
255 int cvmx_zip_queue_shutdown(int queue);
258 * Submit a command to the ZIP block
260 * @param command Zip command to submit
262 * @return Zero on success, negative on failure
264 int cvmx_zip_submit(cvmx_zip_command_t *command);
267 * Submit a command to the ZIP block
269 * @param command Zip command to submit
270 * @param queue Zip instruction queue of the command
272 * @return Zero on success, negative on failure
274 int cvmx_zip_queue_submit(cvmx_zip_command_t *command, int queue);
276 /* CSR typedefs have been moved to cvmx-zip-defs.h */
282 #endif /* __CVMX_ZIP_H__ */