1640035a2SMahipal Challa /***********************license start************************************ 2640035a2SMahipal Challa * Copyright (c) 2003-2017 Cavium, Inc. 3640035a2SMahipal Challa * All rights reserved. 4640035a2SMahipal Challa * 5640035a2SMahipal Challa * License: one of 'Cavium License' or 'GNU General Public License Version 2' 6640035a2SMahipal Challa * 7640035a2SMahipal Challa * This file is provided under the terms of the Cavium License (see below) 8640035a2SMahipal Challa * or under the terms of GNU General Public License, Version 2, as 9640035a2SMahipal Challa * published by the Free Software Foundation. When using or redistributing 10640035a2SMahipal Challa * this file, you may do so under either license. 11640035a2SMahipal Challa * 12640035a2SMahipal Challa * Cavium License: Redistribution and use in source and binary forms, with 13640035a2SMahipal Challa * or without modification, are permitted provided that the following 14640035a2SMahipal Challa * conditions are met: 15640035a2SMahipal Challa * 16640035a2SMahipal Challa * * Redistributions of source code must retain the above copyright 17640035a2SMahipal Challa * notice, this list of conditions and the following disclaimer. 18640035a2SMahipal Challa * 19640035a2SMahipal Challa * * Redistributions in binary form must reproduce the above 20640035a2SMahipal Challa * copyright notice, this list of conditions and the following 21640035a2SMahipal Challa * disclaimer in the documentation and/or other materials provided 22640035a2SMahipal Challa * with the distribution. 23640035a2SMahipal Challa * 24640035a2SMahipal Challa * * Neither the name of Cavium Inc. nor the names of its contributors may be 25640035a2SMahipal Challa * used to endorse or promote products derived from this software without 26640035a2SMahipal Challa * specific prior written permission. 27640035a2SMahipal Challa * 28640035a2SMahipal Challa * This Software, including technical data, may be subject to U.S. export 29640035a2SMahipal Challa * control laws, including the U.S. Export Administration Act and its 30640035a2SMahipal Challa * associated regulations, and may be subject to export or import 31640035a2SMahipal Challa * regulations in other countries. 32640035a2SMahipal Challa * 33640035a2SMahipal Challa * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 34640035a2SMahipal Challa * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS 35640035a2SMahipal Challa * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH 36640035a2SMahipal Challa * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 37640035a2SMahipal Challa * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 38640035a2SMahipal Challa * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) 39640035a2SMahipal Challa * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A 40640035a2SMahipal Challa * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET 41640035a2SMahipal Challa * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE 42640035a2SMahipal Challa * ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES 43640035a2SMahipal Challa * WITH YOU. 44640035a2SMahipal Challa ***********************license end**************************************/ 45640035a2SMahipal Challa 46640035a2SMahipal Challa #ifndef __ZIP_DEVICE_H__ 47640035a2SMahipal Challa #define __ZIP_DEVICE_H__ 48640035a2SMahipal Challa 49640035a2SMahipal Challa #include <linux/types.h> 50640035a2SMahipal Challa #include "zip_main.h" 51640035a2SMahipal Challa 52640035a2SMahipal Challa struct sg_info { 53640035a2SMahipal Challa /* 54640035a2SMahipal Challa * Pointer to the input data when scatter_gather == 0 and 55640035a2SMahipal Challa * pointer to the input gather list buffer when scatter_gather == 1 56640035a2SMahipal Challa */ 57640035a2SMahipal Challa union zip_zptr_s *gather; 58640035a2SMahipal Challa 59640035a2SMahipal Challa /* 60640035a2SMahipal Challa * Pointer to the output data when scatter_gather == 0 and 61640035a2SMahipal Challa * pointer to the output scatter list buffer when scatter_gather == 1 62640035a2SMahipal Challa */ 63640035a2SMahipal Challa union zip_zptr_s *scatter; 64640035a2SMahipal Challa 65640035a2SMahipal Challa /* 66640035a2SMahipal Challa * Holds size of the output buffer pointed by scatter list 67640035a2SMahipal Challa * when scatter_gather == 1 68640035a2SMahipal Challa */ 69640035a2SMahipal Challa u64 scatter_buf_size; 70640035a2SMahipal Challa 71640035a2SMahipal Challa /* for gather data */ 72640035a2SMahipal Challa u64 gather_enable; 73640035a2SMahipal Challa 74640035a2SMahipal Challa /* for scatter data */ 75640035a2SMahipal Challa u64 scatter_enable; 76640035a2SMahipal Challa 77640035a2SMahipal Challa /* Number of gather list pointers for gather data */ 78640035a2SMahipal Challa u32 gbuf_cnt; 79640035a2SMahipal Challa 80640035a2SMahipal Challa /* Number of scatter list pointers for scatter data */ 81640035a2SMahipal Challa u32 sbuf_cnt; 82640035a2SMahipal Challa 83640035a2SMahipal Challa /* Buffers allocation state */ 84640035a2SMahipal Challa u8 alloc_state; 85640035a2SMahipal Challa }; 86640035a2SMahipal Challa 87640035a2SMahipal Challa /** 88640035a2SMahipal Challa * struct zip_state - Structure representing the required information related 89640035a2SMahipal Challa * to a command 90640035a2SMahipal Challa * @zip_cmd: Pointer to zip instruction structure 91640035a2SMahipal Challa * @result: Pointer to zip result structure 92640035a2SMahipal Challa * @ctx: Context pointer for inflate 93640035a2SMahipal Challa * @history: Decompression history pointer 94640035a2SMahipal Challa * @sginfo: Scatter-gather info structure 95640035a2SMahipal Challa */ 96640035a2SMahipal Challa struct zip_state { 97640035a2SMahipal Challa union zip_inst_s zip_cmd; 98640035a2SMahipal Challa union zip_zres_s result; 99640035a2SMahipal Challa union zip_zptr_s *ctx; 100640035a2SMahipal Challa union zip_zptr_s *history; 101640035a2SMahipal Challa struct sg_info sginfo; 102640035a2SMahipal Challa }; 103640035a2SMahipal Challa 104640035a2SMahipal Challa #define ZIP_CONTEXT_SIZE 2048 105640035a2SMahipal Challa #define ZIP_INFLATE_HISTORY_SIZE 32768 106640035a2SMahipal Challa #define ZIP_DEFLATE_HISTORY_SIZE 32768 107640035a2SMahipal Challa 108640035a2SMahipal Challa #endif 109