109 lines · c
1/***********************license start************************************2 * Copyright (c) 2003-2017 Cavium, Inc.3 * All rights reserved.4 *5 * License: one of 'Cavium License' or 'GNU General Public License Version 2'6 *7 * This file is provided under the terms of the Cavium License (see below)8 * or under the terms of GNU General Public License, Version 2, as9 * published by the Free Software Foundation. When using or redistributing10 * this file, you may do so under either license.11 *12 * Cavium License: Redistribution and use in source and binary forms, with13 * or without modification, are permitted provided that the following14 * conditions are met:15 *16 * * Redistributions of source code must retain the above copyright17 * notice, this list of conditions and the following disclaimer.18 *19 * * Redistributions in binary form must reproduce the above20 * copyright notice, this list of conditions and the following21 * disclaimer in the documentation and/or other materials provided22 * with the distribution.23 *24 * * Neither the name of Cavium Inc. nor the names of its contributors may be25 * used to endorse or promote products derived from this software without26 * specific prior written permission.27 *28 * This Software, including technical data, may be subject to U.S. export29 * control laws, including the U.S. Export Administration Act and its30 * associated regulations, and may be subject to export or import31 * regulations in other countries.32 *33 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"34 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS35 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH36 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY37 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT38 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY)39 * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A40 * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET41 * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE42 * ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES43 * WITH YOU.44 ***********************license end**************************************/45 46#ifndef __ZIP_DEVICE_H__47#define __ZIP_DEVICE_H__48 49#include <linux/types.h>50#include "zip_main.h"51 52struct sg_info {53 /*54 * Pointer to the input data when scatter_gather == 0 and55 * pointer to the input gather list buffer when scatter_gather == 156 */57 union zip_zptr_s *gather;58 59 /*60 * Pointer to the output data when scatter_gather == 0 and61 * pointer to the output scatter list buffer when scatter_gather == 162 */63 union zip_zptr_s *scatter;64 65 /*66 * Holds size of the output buffer pointed by scatter list67 * when scatter_gather == 168 */69 u64 scatter_buf_size;70 71 /* for gather data */72 u64 gather_enable;73 74 /* for scatter data */75 u64 scatter_enable;76 77 /* Number of gather list pointers for gather data */78 u32 gbuf_cnt;79 80 /* Number of scatter list pointers for scatter data */81 u32 sbuf_cnt;82 83 /* Buffers allocation state */84 u8 alloc_state;85};86 87/**88 * struct zip_state - Structure representing the required information related89 * to a command90 * @zip_cmd: Pointer to zip instruction structure91 * @result: Pointer to zip result structure92 * @ctx: Context pointer for inflate93 * @history: Decompression history pointer94 * @sginfo: Scatter-gather info structure95 */96struct zip_state {97 union zip_inst_s zip_cmd;98 union zip_zres_s result;99 union zip_zptr_s *ctx;100 union zip_zptr_s *history;101 struct sg_info sginfo;102};103 104#define ZIP_CONTEXT_SIZE 2048105#define ZIP_INFLATE_HISTORY_SIZE 32768106#define ZIP_DEFLATE_HISTORY_SIZE 32768107 108#endif109