1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 /* Copyright(c) 2007-2022 Intel Corporation */ 3 /* $FreeBSD$ */ 4 #ifndef ADF_TRANSPORT_INTRN_H 5 #define ADF_TRANSPORT_INTRN_H 6 7 #include "adf_transport.h" 8 9 struct adf_etr_ring_debug_entry { 10 char ring_name[ADF_CFG_MAX_KEY_LEN_IN_BYTES]; 11 struct sysctl_oid *debug; 12 }; 13 14 struct adf_etr_ring_data { 15 void *base_addr; 16 atomic_t *inflights; 17 struct mtx lock; /* protects ring data struct */ 18 adf_callback_fn callback; 19 struct adf_etr_bank_data *bank; 20 bus_addr_t dma_addr; 21 uint16_t head; 22 uint16_t tail; 23 uint8_t ring_number; 24 uint8_t ring_size; 25 uint8_t msg_size; 26 uint8_t reserved; 27 struct adf_etr_ring_debug_entry *ring_debug; 28 struct bus_dmamem dma_mem; 29 u32 csr_tail_offset; 30 u32 max_inflights; 31 }; 32 33 struct adf_etr_bank_data { 34 struct adf_etr_ring_data *rings; 35 struct task resp_handler; 36 struct resource *csr_addr; 37 struct adf_accel_dev *accel_dev; 38 uint32_t irq_coalesc_timer; 39 uint16_t ring_mask; 40 uint16_t irq_mask; 41 struct mtx lock; /* protects bank data struct */ 42 struct sysctl_oid *bank_debug_dir; 43 struct sysctl_oid *bank_debug_cfg; 44 uint32_t bank_number; 45 }; 46 47 struct adf_etr_data { 48 struct adf_etr_bank_data *banks; 49 struct sysctl_oid *debug; 50 }; 51 52 void adf_response_handler(uintptr_t bank_addr); 53 int adf_handle_response(struct adf_etr_ring_data *ring, u32 quota); 54 int adf_bank_debugfs_add(struct adf_etr_bank_data *bank); 55 void adf_bank_debugfs_rm(struct adf_etr_bank_data *bank); 56 int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name); 57 void adf_ring_debugfs_rm(struct adf_etr_ring_data *ring); 58 #endif 59