xref: /dpdk/drivers/bus/fslmc/mc/fsl_dpio.h (revision 591200ef6f32b56adc367ebe3647cc3dbe9362db)
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2016-2023 NXP
5  *
6  */
7 #ifndef __FSL_DPIO_H
8 #define __FSL_DPIO_H
9 
10 #include <rte_compat.h>
11 
12 /* Data Path I/O Portal API
13  * Contains initialization APIs and runtime control APIs for DPIO
14  */
15 
16 struct fsl_mc_io;
17 
18 __rte_internal
19 int dpio_open(struct fsl_mc_io *mc_io,
20 	      uint32_t cmd_flags,
21 	      int dpio_id,
22 	      uint16_t *token);
23 
24 __rte_internal
25 int dpio_close(struct fsl_mc_io *mc_io,
26 	       uint32_t cmd_flags,
27 	       uint16_t token);
28 
29 /**
30  * enum dpio_channel_mode - DPIO notification channel mode
31  * @DPIO_NO_CHANNEL:	No support for notification channel
32  * @DPIO_LOCAL_CHANNEL:	Notifications on data availability can be received by a
33  *	dedicated channel in the DPIO; user should point the queue's
34  *	destination in the relevant interface to this DPIO
35  */
36 enum dpio_channel_mode {
37 	DPIO_NO_CHANNEL = 0,
38 	DPIO_LOCAL_CHANNEL = 1,
39 };
40 
41 /**
42  * struct dpio_cfg - Structure representing DPIO configuration
43  * @channel_mode:	Notification channel mode
44  * @num_priorities:	Number of priorities for the notification channel (1-8);
45  *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
46  */
47 struct dpio_cfg {
48 	enum dpio_channel_mode channel_mode;
49 	uint8_t num_priorities;
50 };
51 
52 
53 int dpio_create(struct fsl_mc_io *mc_io,
54 		uint16_t dprc_token,
55 		uint32_t cmd_flags,
56 		const struct dpio_cfg *cfg,
57 		uint32_t *obj_id);
58 
59 int dpio_destroy(struct fsl_mc_io *mc_io,
60 		 uint16_t dprc_token,
61 		 uint32_t cmd_flags,
62 		 uint32_t object_id);
63 
64 __rte_internal
65 int dpio_enable(struct fsl_mc_io *mc_io,
66 		uint32_t cmd_flags,
67 		uint16_t token);
68 
69 __rte_internal
70 int dpio_disable(struct fsl_mc_io *mc_io,
71 		 uint32_t cmd_flags,
72 		 uint16_t token);
73 
74 int dpio_is_enabled(struct fsl_mc_io *mc_io,
75 		    uint32_t cmd_flags,
76 		    uint16_t token,
77 		    int *en);
78 
79 __rte_internal
80 int dpio_reset(struct fsl_mc_io *mc_io,
81 	       uint32_t cmd_flags,
82 	       uint16_t token);
83 
84 __rte_internal
85 int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
86 				  uint32_t cmd_flags,
87 				  uint16_t token,
88 				  uint8_t sdest);
89 
90 __rte_internal
91 int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
92 				  uint32_t cmd_flags,
93 				  uint16_t token,
94 				  uint8_t *sdest);
95 
96 __rte_internal
97 int dpio_set_stashing_destination_by_core_id(struct fsl_mc_io *mc_io,
98 				  uint32_t cmd_flags,
99 				  uint16_t token,
100 				  uint8_t core_id);
101 
102 __rte_internal
103 int dpio_set_stashing_destination_source(struct fsl_mc_io *mc_io,
104 				  uint32_t cmd_flags,
105 				  uint16_t token,
106 				  uint8_t ss);
107 
108 __rte_internal
109 int dpio_get_stashing_destination_source(struct fsl_mc_io *mc_io,
110 				  uint32_t cmd_flags,
111 				  uint16_t token,
112 				  uint8_t *ss);
113 
114 __rte_internal
115 int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
116 				    uint32_t cmd_flags,
117 				    uint16_t token,
118 				    int dpcon_id,
119 				    uint8_t *channel_index);
120 
121 __rte_internal
122 int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
123 				       uint32_t cmd_flags,
124 				       uint16_t token,
125 				       int dpcon_id);
126 
127 /**
128  * struct dpio_attr - Structure representing DPIO attributes
129  * @id:				DPIO object ID
130  * @qbman_portal_ce_offset:	Offset of the software portal cache-enabled area
131  * @qbman_portal_ci_offset:	Offset of the software portal
132  *				cache-inhibited area
133  * @qbman_portal_id:		Software portal ID
134  * @channel_mode:		Notification channel mode
135  * @num_priorities:		Number of priorities for the notification
136  *				channel (1-8); relevant only if
137  *				'channel_mode = DPIO_LOCAL_CHANNEL'
138  * @qbman_version:		QBMAN version
139  */
140 struct dpio_attr {
141 	int id;
142 	uint64_t qbman_portal_ce_offset;
143 	uint64_t qbman_portal_ci_offset;
144 	uint16_t qbman_portal_id;
145 	enum dpio_channel_mode channel_mode;
146 	uint8_t num_priorities;
147 	uint32_t qbman_version;
148 	uint32_t clk;
149 };
150 
151 __rte_internal
152 int dpio_get_attributes(struct fsl_mc_io *mc_io,
153 			uint32_t cmd_flags,
154 			uint16_t token,
155 			struct dpio_attr *attr);
156 
157 int dpio_get_api_version(struct fsl_mc_io *mc_io,
158 			 uint32_t cmd_flags,
159 			 uint16_t *major_ver,
160 			 uint16_t *minor_ver);
161 
162 #endif /* __FSL_DPIO_H */
163