1*640035a2SMahipal Challa /***********************license start************************************ 2*640035a2SMahipal Challa * Copyright (c) 2003-2017 Cavium, Inc. 3*640035a2SMahipal Challa * All rights reserved. 4*640035a2SMahipal Challa * 5*640035a2SMahipal Challa * License: one of 'Cavium License' or 'GNU General Public License Version 2' 6*640035a2SMahipal Challa * 7*640035a2SMahipal Challa * This file is provided under the terms of the Cavium License (see below) 8*640035a2SMahipal Challa * or under the terms of GNU General Public License, Version 2, as 9*640035a2SMahipal Challa * published by the Free Software Foundation. When using or redistributing 10*640035a2SMahipal Challa * this file, you may do so under either license. 11*640035a2SMahipal Challa * 12*640035a2SMahipal Challa * Cavium License: Redistribution and use in source and binary forms, with 13*640035a2SMahipal Challa * or without modification, are permitted provided that the following 14*640035a2SMahipal Challa * conditions are met: 15*640035a2SMahipal Challa * 16*640035a2SMahipal Challa * * Redistributions of source code must retain the above copyright 17*640035a2SMahipal Challa * notice, this list of conditions and the following disclaimer. 18*640035a2SMahipal Challa * 19*640035a2SMahipal Challa * * Redistributions in binary form must reproduce the above 20*640035a2SMahipal Challa * copyright notice, this list of conditions and the following 21*640035a2SMahipal Challa * disclaimer in the documentation and/or other materials provided 22*640035a2SMahipal Challa * with the distribution. 23*640035a2SMahipal Challa * 24*640035a2SMahipal Challa * * Neither the name of Cavium Inc. nor the names of its contributors may be 25*640035a2SMahipal Challa * used to endorse or promote products derived from this software without 26*640035a2SMahipal Challa * specific prior written permission. 27*640035a2SMahipal Challa * 28*640035a2SMahipal Challa * This Software, including technical data, may be subject to U.S. export 29*640035a2SMahipal Challa * control laws, including the U.S. Export Administration Act and its 30*640035a2SMahipal Challa * associated regulations, and may be subject to export or import 31*640035a2SMahipal Challa * regulations in other countries. 32*640035a2SMahipal Challa * 33*640035a2SMahipal Challa * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 34*640035a2SMahipal Challa * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS 35*640035a2SMahipal Challa * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH 36*640035a2SMahipal Challa * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 37*640035a2SMahipal Challa * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 38*640035a2SMahipal Challa * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) 39*640035a2SMahipal Challa * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A 40*640035a2SMahipal Challa * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET 41*640035a2SMahipal Challa * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE 42*640035a2SMahipal Challa * ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES 43*640035a2SMahipal Challa * WITH YOU. 44*640035a2SMahipal Challa ***********************license end**************************************/ 45*640035a2SMahipal Challa 46*640035a2SMahipal Challa #ifndef __ZIP_DEVICE_H__ 47*640035a2SMahipal Challa #define __ZIP_DEVICE_H__ 48*640035a2SMahipal Challa 49*640035a2SMahipal Challa #include <linux/types.h> 50*640035a2SMahipal Challa #include "zip_main.h" 51*640035a2SMahipal Challa 52*640035a2SMahipal Challa struct sg_info { 53*640035a2SMahipal Challa /* 54*640035a2SMahipal Challa * Pointer to the input data when scatter_gather == 0 and 55*640035a2SMahipal Challa * pointer to the input gather list buffer when scatter_gather == 1 56*640035a2SMahipal Challa */ 57*640035a2SMahipal Challa union zip_zptr_s *gather; 58*640035a2SMahipal Challa 59*640035a2SMahipal Challa /* 60*640035a2SMahipal Challa * Pointer to the output data when scatter_gather == 0 and 61*640035a2SMahipal Challa * pointer to the output scatter list buffer when scatter_gather == 1 62*640035a2SMahipal Challa */ 63*640035a2SMahipal Challa union zip_zptr_s *scatter; 64*640035a2SMahipal Challa 65*640035a2SMahipal Challa /* 66*640035a2SMahipal Challa * Holds size of the output buffer pointed by scatter list 67*640035a2SMahipal Challa * when scatter_gather == 1 68*640035a2SMahipal Challa */ 69*640035a2SMahipal Challa u64 scatter_buf_size; 70*640035a2SMahipal Challa 71*640035a2SMahipal Challa /* for gather data */ 72*640035a2SMahipal Challa u64 gather_enable; 73*640035a2SMahipal Challa 74*640035a2SMahipal Challa /* for scatter data */ 75*640035a2SMahipal Challa u64 scatter_enable; 76*640035a2SMahipal Challa 77*640035a2SMahipal Challa /* Number of gather list pointers for gather data */ 78*640035a2SMahipal Challa u32 gbuf_cnt; 79*640035a2SMahipal Challa 80*640035a2SMahipal Challa /* Number of scatter list pointers for scatter data */ 81*640035a2SMahipal Challa u32 sbuf_cnt; 82*640035a2SMahipal Challa 83*640035a2SMahipal Challa /* Buffers allocation state */ 84*640035a2SMahipal Challa u8 alloc_state; 85*640035a2SMahipal Challa }; 86*640035a2SMahipal Challa 87*640035a2SMahipal Challa /** 88*640035a2SMahipal Challa * struct zip_state - Structure representing the required information related 89*640035a2SMahipal Challa * to a command 90*640035a2SMahipal Challa * @zip_cmd: Pointer to zip instruction structure 91*640035a2SMahipal Challa * @result: Pointer to zip result structure 92*640035a2SMahipal Challa * @ctx: Context pointer for inflate 93*640035a2SMahipal Challa * @history: Decompression history pointer 94*640035a2SMahipal Challa * @sginfo: Scatter-gather info structure 95*640035a2SMahipal Challa */ 96*640035a2SMahipal Challa struct zip_state { 97*640035a2SMahipal Challa union zip_inst_s zip_cmd; 98*640035a2SMahipal Challa union zip_zres_s result; 99*640035a2SMahipal Challa union zip_zptr_s *ctx; 100*640035a2SMahipal Challa union zip_zptr_s *history; 101*640035a2SMahipal Challa struct sg_info sginfo; 102*640035a2SMahipal Challa }; 103*640035a2SMahipal Challa 104*640035a2SMahipal Challa #define ZIP_CONTEXT_SIZE 2048 105*640035a2SMahipal Challa #define ZIP_INFLATE_HISTORY_SIZE 32768 106*640035a2SMahipal Challa #define ZIP_DEFLATE_HISTORY_SIZE 32768 107*640035a2SMahipal Challa 108*640035a2SMahipal Challa #endif 109