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