zip_device.h 3.7 KB

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