xref: /dpdk/drivers/bus/fslmc/mc/fsl_dpio.h (revision 68a03efeed657e6e05f281479b33b51102797e15)
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2016-2017 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 int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
91 				  uint32_t cmd_flags,
92 				  uint16_t token,
93 				  uint8_t *sdest);
94 
95 __rte_internal
96 int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
97 				    uint32_t cmd_flags,
98 				    uint16_t token,
99 				    int dpcon_id,
100 				    uint8_t *channel_index);
101 
102 __rte_internal
103 int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
104 				       uint32_t cmd_flags,
105 				       uint16_t token,
106 				       int dpcon_id);
107 
108 /**
109  * struct dpio_attr - Structure representing DPIO attributes
110  * @id:				DPIO object ID
111  * @qbman_portal_ce_offset:	Offset of the software portal cache-enabled area
112  * @qbman_portal_ci_offset:	Offset of the software portal
113  *				cache-inhibited area
114  * @qbman_portal_id:		Software portal ID
115  * @channel_mode:		Notification channel mode
116  * @num_priorities:		Number of priorities for the notification
117  *				channel (1-8); relevant only if
118  *				'channel_mode = DPIO_LOCAL_CHANNEL'
119  * @qbman_version:		QBMAN version
120  */
121 struct dpio_attr {
122 	int id;
123 	uint64_t qbman_portal_ce_offset;
124 	uint64_t qbman_portal_ci_offset;
125 	uint16_t qbman_portal_id;
126 	enum dpio_channel_mode channel_mode;
127 	uint8_t num_priorities;
128 	uint32_t qbman_version;
129 	uint32_t clk;
130 };
131 
132 __rte_internal
133 int dpio_get_attributes(struct fsl_mc_io *mc_io,
134 			uint32_t cmd_flags,
135 			uint16_t token,
136 			struct dpio_attr *attr);
137 
138 int dpio_get_api_version(struct fsl_mc_io *mc_io,
139 			 uint32_t cmd_flags,
140 			 uint16_t *major_ver,
141 			 uint16_t *minor_ver);
142 
143 #endif /* __FSL_DPIO_H */
144