• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
2 /* Copyright(c) 2014 - 2020 Intel Corporation */
3 #ifndef ADF_TRANSPORT_INTRN_H
4 #define ADF_TRANSPORT_INTRN_H
5 
6 #include <linux/interrupt.h>
7 #include <linux/spinlock_types.h>
8 #include "adf_transport.h"
9 
10 struct adf_etr_ring_debug_entry {
11 	char ring_name[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
12 	struct dentry *debug;
13 };
14 
15 struct adf_etr_ring_data {
16 	void *base_addr;
17 	atomic_t *inflights;
18 	adf_callback_fn callback;
19 	struct adf_etr_bank_data *bank;
20 	dma_addr_t dma_addr;
21 	struct adf_etr_ring_debug_entry *ring_debug;
22 	spinlock_t lock;	/* protects ring data struct */
23 	u16 head;
24 	u16 tail;
25 	u8 ring_number;
26 	u8 ring_size;
27 	u8 msg_size;
28 };
29 
30 struct adf_etr_bank_data {
31 	struct adf_etr_ring_data rings[ADF_ETR_MAX_RINGS_PER_BANK];
32 	struct tasklet_struct resp_handler;
33 	void __iomem *csr_addr;
34 	u32 irq_coalesc_timer;
35 	u32 bank_number;
36 	u16 ring_mask;
37 	u16 irq_mask;
38 	spinlock_t lock;	/* protects bank data struct */
39 	struct adf_accel_dev *accel_dev;
40 	struct dentry *bank_debug_dir;
41 	struct dentry *bank_debug_cfg;
42 };
43 
44 struct adf_etr_data {
45 	struct adf_etr_bank_data *banks;
46 	struct dentry *debug;
47 };
48 
49 void adf_response_handler(uintptr_t bank_addr);
50 #ifdef CONFIG_DEBUG_FS
51 #include <linux/debugfs.h>
52 int adf_bank_debugfs_add(struct adf_etr_bank_data *bank);
53 void adf_bank_debugfs_rm(struct adf_etr_bank_data *bank);
54 int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name);
55 void adf_ring_debugfs_rm(struct adf_etr_ring_data *ring);
56 #else
adf_bank_debugfs_add(struct adf_etr_bank_data * bank)57 static inline int adf_bank_debugfs_add(struct adf_etr_bank_data *bank)
58 {
59 	return 0;
60 }
61 
62 #define adf_bank_debugfs_rm(bank) do {} while (0)
63 
adf_ring_debugfs_add(struct adf_etr_ring_data * ring,const char * name)64 static inline int adf_ring_debugfs_add(struct adf_etr_ring_data *ring,
65 				       const char *name)
66 {
67 	return 0;
68 }
69 
70 #define adf_ring_debugfs_rm(ring) do {} while (0)
71 #endif
72 #endif
73