adf_transport_internal.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. This file is provided under a dual BSD/GPLv2 license. When using or
  3. redistributing this file, you may do so under either license.
  4. GPL LICENSE SUMMARY
  5. Copyright(c) 2014 Intel Corporation.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License as
  8. published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. Contact Information:
  14. qat-linux@intel.com
  15. BSD LICENSE
  16. Copyright(c) 2014 Intel Corporation.
  17. Redistribution and use in source and binary forms, with or without
  18. modification, are permitted provided that the following conditions
  19. are met:
  20. * Redistributions of source code must retain the above copyright
  21. notice, this list of conditions and the following disclaimer.
  22. * Redistributions in binary form must reproduce the above copyright
  23. notice, this list of conditions and the following disclaimer in
  24. the documentation and/or other materials provided with the
  25. distribution.
  26. * Neither the name of Intel Corporation nor the names of its
  27. contributors may be used to endorse or promote products derived
  28. from this software without specific prior written permission.
  29. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. */
  41. #ifndef ADF_TRANSPORT_INTRN_H
  42. #define ADF_TRANSPORT_INTRN_H
  43. #include <linux/interrupt.h>
  44. #include <linux/spinlock_types.h>
  45. #include "adf_transport.h"
  46. struct adf_etr_ring_debug_entry {
  47. char ring_name[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
  48. struct dentry *debug;
  49. };
  50. struct adf_etr_ring_data {
  51. void *base_addr;
  52. atomic_t *inflights;
  53. spinlock_t lock; /* protects ring data struct */
  54. adf_callback_fn callback;
  55. struct adf_etr_bank_data *bank;
  56. dma_addr_t dma_addr;
  57. uint16_t head;
  58. uint16_t tail;
  59. uint8_t ring_number;
  60. uint8_t ring_size;
  61. uint8_t msg_size;
  62. uint8_t reserved;
  63. struct adf_etr_ring_debug_entry *ring_debug;
  64. } __packed;
  65. struct adf_etr_bank_data {
  66. struct adf_etr_ring_data rings[ADF_ETR_MAX_RINGS_PER_BANK];
  67. struct tasklet_struct resp_handler;
  68. void __iomem *csr_addr;
  69. struct adf_accel_dev *accel_dev;
  70. uint32_t irq_coalesc_timer;
  71. uint16_t ring_mask;
  72. uint16_t irq_mask;
  73. spinlock_t lock; /* protects bank data struct */
  74. struct dentry *bank_debug_dir;
  75. struct dentry *bank_debug_cfg;
  76. uint32_t bank_number;
  77. } __packed;
  78. struct adf_etr_data {
  79. struct adf_etr_bank_data *banks;
  80. struct dentry *debug;
  81. };
  82. void adf_response_handler(unsigned long bank_addr);
  83. #ifdef CONFIG_DEBUG_FS
  84. #include <linux/debugfs.h>
  85. int adf_bank_debugfs_add(struct adf_etr_bank_data *bank);
  86. void adf_bank_debugfs_rm(struct adf_etr_bank_data *bank);
  87. int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name);
  88. void adf_ring_debugfs_rm(struct adf_etr_ring_data *ring);
  89. #else
  90. static inline int adf_bank_debugfs_add(struct adf_etr_bank_data *bank)
  91. {
  92. return 0;
  93. }
  94. #define adf_bank_debugfs_rm(bank) do {} while (0)
  95. static inline int adf_ring_debugfs_add(struct adf_etr_ring_data *ring,
  96. const char *name)
  97. {
  98. return 0;
  99. }
  100. #define adf_ring_debugfs_rm(ring) do {} while (0)
  101. #endif
  102. #endif