xref: /openbmc/linux/include/linux/fsl/mc.h (revision 842ed298)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Freescale Management Complex (MC) bus public interface
4  *
5  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
6  * Copyright 2019-2020 NXP
7  * Author: German Rivera <German.Rivera@freescale.com>
8  *
9  */
10 #ifndef _FSL_MC_H_
11 #define _FSL_MC_H_
12 
13 #include <linux/device.h>
14 #include <linux/mod_devicetable.h>
15 #include <linux/interrupt.h>
16 
17 #define FSL_MC_VENDOR_FREESCALE	0x1957
18 
19 struct irq_domain;
20 struct msi_domain_info;
21 
22 struct fsl_mc_device;
23 struct fsl_mc_io;
24 
25 /**
26  * struct fsl_mc_driver - MC object device driver object
27  * @driver: Generic device driver
28  * @match_id_table: table of supported device matching Ids
29  * @probe: Function called when a device is added
30  * @remove: Function called when a device is removed
31  * @shutdown: Function called at shutdown time to quiesce the device
32  * @suspend: Function called when a device is stopped
33  * @resume: Function called when a device is resumed
34  *
35  * Generic DPAA device driver object for device drivers that are registered
36  * with a DPRC bus. This structure is to be embedded in each device-specific
37  * driver structure.
38  */
39 struct fsl_mc_driver {
40 	struct device_driver driver;
41 	const struct fsl_mc_device_id *match_id_table;
42 	int (*probe)(struct fsl_mc_device *dev);
43 	int (*remove)(struct fsl_mc_device *dev);
44 	void (*shutdown)(struct fsl_mc_device *dev);
45 	int (*suspend)(struct fsl_mc_device *dev, pm_message_t state);
46 	int (*resume)(struct fsl_mc_device *dev);
47 };
48 
49 #define to_fsl_mc_driver(_drv) \
50 	container_of(_drv, struct fsl_mc_driver, driver)
51 
52 /**
53  * enum fsl_mc_pool_type - Types of allocatable MC bus resources
54  *
55  * Entries in these enum are used as indices in the array of resource
56  * pools of an fsl_mc_bus object.
57  */
58 enum fsl_mc_pool_type {
59 	FSL_MC_POOL_DPMCP = 0x0,    /* corresponds to "dpmcp" in the MC */
60 	FSL_MC_POOL_DPBP,	    /* corresponds to "dpbp" in the MC */
61 	FSL_MC_POOL_DPCON,	    /* corresponds to "dpcon" in the MC */
62 	FSL_MC_POOL_IRQ,
63 
64 	/*
65 	 * NOTE: New resource pool types must be added before this entry
66 	 */
67 	FSL_MC_NUM_POOL_TYPES
68 };
69 
70 /**
71  * struct fsl_mc_resource - MC generic resource
72  * @type: type of resource
73  * @id: unique MC resource Id within the resources of the same type
74  * @data: pointer to resource-specific data if the resource is currently
75  * allocated, or NULL if the resource is not currently allocated.
76  * @parent_pool: pointer to the parent resource pool from which this
77  * resource is allocated from.
78  * @node: Node in the free list of the corresponding resource pool
79  *
80  * NOTE: This structure is to be embedded as a field of specific
81  * MC resource structures.
82  */
83 struct fsl_mc_resource {
84 	enum fsl_mc_pool_type type;
85 	s32 id;
86 	void *data;
87 	struct fsl_mc_resource_pool *parent_pool;
88 	struct list_head node;
89 };
90 
91 /**
92  * struct fsl_mc_device_irq - MC object device message-based interrupt
93  * @msi_desc: pointer to MSI descriptor allocated by fsl_mc_msi_alloc_descs()
94  * @mc_dev: MC object device that owns this interrupt
95  * @dev_irq_index: device-relative IRQ index
96  * @resource: MC generic resource associated with the interrupt
97  */
98 struct fsl_mc_device_irq {
99 	struct msi_desc *msi_desc;
100 	struct fsl_mc_device *mc_dev;
101 	u8 dev_irq_index;
102 	struct fsl_mc_resource resource;
103 };
104 
105 #define to_fsl_mc_irq(_mc_resource) \
106 	container_of(_mc_resource, struct fsl_mc_device_irq, resource)
107 
108 /* Opened state - Indicates that an object is open by at least one owner */
109 #define FSL_MC_OBJ_STATE_OPEN		0x00000001
110 /* Plugged state - Indicates that the object is plugged */
111 #define FSL_MC_OBJ_STATE_PLUGGED	0x00000002
112 
113 /**
114  * Shareability flag - Object flag indicating no memory shareability.
115  * the object generates memory accesses that are non coherent with other
116  * masters;
117  * user is responsible for proper memory handling through IOMMU configuration.
118  */
119 #define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY	0x0001
120 
121 /**
122  * struct fsl_mc_obj_desc - Object descriptor
123  * @type: Type of object: NULL terminated string
124  * @id: ID of logical object resource
125  * @vendor: Object vendor identifier
126  * @ver_major: Major version number
127  * @ver_minor:  Minor version number
128  * @irq_count: Number of interrupts supported by the object
129  * @region_count: Number of mappable regions supported by the object
130  * @state: Object state: combination of FSL_MC_OBJ_STATE_ states
131  * @label: Object label: NULL terminated string
132  * @flags: Object's flags
133  */
134 struct fsl_mc_obj_desc {
135 	char type[16];
136 	int id;
137 	u16 vendor;
138 	u16 ver_major;
139 	u16 ver_minor;
140 	u8 irq_count;
141 	u8 region_count;
142 	u32 state;
143 	char label[16];
144 	u16 flags;
145 };
146 
147 /**
148  * Bit masks for a MC object device (struct fsl_mc_device) flags
149  */
150 #define FSL_MC_IS_DPRC	0x0001
151 
152 /* Region flags */
153 /* Indicates that region can be mapped as cacheable */
154 #define FSL_MC_REGION_CACHEABLE	0x00000001
155 
156 /* Indicates that region can be mapped as shareable */
157 #define FSL_MC_REGION_SHAREABLE	0x00000002
158 
159 /**
160  * struct fsl_mc_device - MC object device object
161  * @dev: Linux driver model device object
162  * @dma_mask: Default DMA mask
163  * @flags: MC object device flags
164  * @icid: Isolation context ID for the device
165  * @mc_handle: MC handle for the corresponding MC object opened
166  * @mc_io: Pointer to MC IO object assigned to this device or
167  * NULL if none.
168  * @obj_desc: MC description of the DPAA device
169  * @regions: pointer to array of MMIO region entries
170  * @irqs: pointer to array of pointers to interrupts allocated to this device
171  * @resource: generic resource associated with this MC object device, if any.
172  * @driver_override: driver name to force a match
173  *
174  * Generic device object for MC object devices that are "attached" to a
175  * MC bus.
176  *
177  * NOTES:
178  * - For a non-DPRC object its icid is the same as its parent DPRC's icid.
179  * - The SMMU notifier callback gets invoked after device_add() has been
180  *   called for an MC object device, but before the device-specific probe
181  *   callback gets called.
182  * - DP_OBJ_DPRC objects are the only MC objects that have built-in MC
183  *   portals. For all other MC objects, their device drivers are responsible for
184  *   allocating MC portals for them by calling fsl_mc_portal_allocate().
185  * - Some types of MC objects (e.g., DP_OBJ_DPBP, DP_OBJ_DPCON) are
186  *   treated as resources that can be allocated/deallocated from the
187  *   corresponding resource pool in the object's parent DPRC, using the
188  *   fsl_mc_object_allocate()/fsl_mc_object_free() functions. These MC objects
189  *   are known as "allocatable" objects. For them, the corresponding
190  *   fsl_mc_device's 'resource' points to the associated resource object.
191  *   For MC objects that are not allocatable (e.g., DP_OBJ_DPRC, DP_OBJ_DPNI),
192  *   'resource' is NULL.
193  */
194 struct fsl_mc_device {
195 	struct device dev;
196 	u64 dma_mask;
197 	u16 flags;
198 	u32 icid;
199 	u16 mc_handle;
200 	struct fsl_mc_io *mc_io;
201 	struct fsl_mc_obj_desc obj_desc;
202 	struct resource *regions;
203 	struct fsl_mc_device_irq **irqs;
204 	struct fsl_mc_resource *resource;
205 	struct device_link *consumer_link;
206 	char   *driver_override;
207 };
208 
209 #define to_fsl_mc_device(_dev) \
210 	container_of(_dev, struct fsl_mc_device, dev)
211 
212 #define MC_CMD_NUM_OF_PARAMS	7
213 
214 struct mc_cmd_header {
215 	u8 src_id;
216 	u8 flags_hw;
217 	u8 status;
218 	u8 flags_sw;
219 	__le16 token;
220 	__le16 cmd_id;
221 };
222 
223 struct fsl_mc_command {
224 	__le64 header;
225 	__le64 params[MC_CMD_NUM_OF_PARAMS];
226 };
227 
228 enum mc_cmd_status {
229 	MC_CMD_STATUS_OK = 0x0, /* Completed successfully */
230 	MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */
231 	MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */
232 	MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */
233 	MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */
234 	MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */
235 	MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */
236 	MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */
237 	MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */
238 	MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */
239 	MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */
240 	MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */
241 };
242 
243 /*
244  * MC command flags
245  */
246 
247 /* High priority flag */
248 #define MC_CMD_FLAG_PRI		0x80
249 /* Command completion flag */
250 #define MC_CMD_FLAG_INTR_DIS	0x01
251 
252 static inline __le64 mc_encode_cmd_header(u16 cmd_id,
253 					  u32 cmd_flags,
254 					  u16 token)
255 {
256 	__le64 header = 0;
257 	struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header;
258 
259 	hdr->cmd_id = cpu_to_le16(cmd_id);
260 	hdr->token  = cpu_to_le16(token);
261 	hdr->status = MC_CMD_STATUS_READY;
262 	if (cmd_flags & MC_CMD_FLAG_PRI)
263 		hdr->flags_hw = MC_CMD_FLAG_PRI;
264 	if (cmd_flags & MC_CMD_FLAG_INTR_DIS)
265 		hdr->flags_sw = MC_CMD_FLAG_INTR_DIS;
266 
267 	return header;
268 }
269 
270 static inline u16 mc_cmd_hdr_read_token(struct fsl_mc_command *cmd)
271 {
272 	struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
273 	u16 token = le16_to_cpu(hdr->token);
274 
275 	return token;
276 }
277 
278 struct mc_rsp_create {
279 	__le32 object_id;
280 };
281 
282 struct mc_rsp_api_ver {
283 	__le16 major_ver;
284 	__le16 minor_ver;
285 };
286 
287 static inline u32 mc_cmd_read_object_id(struct fsl_mc_command *cmd)
288 {
289 	struct mc_rsp_create *rsp_params;
290 
291 	rsp_params = (struct mc_rsp_create *)cmd->params;
292 	return le32_to_cpu(rsp_params->object_id);
293 }
294 
295 static inline void mc_cmd_read_api_version(struct fsl_mc_command *cmd,
296 					   u16 *major_ver,
297 					   u16 *minor_ver)
298 {
299 	struct mc_rsp_api_ver *rsp_params;
300 
301 	rsp_params = (struct mc_rsp_api_ver *)cmd->params;
302 	*major_ver = le16_to_cpu(rsp_params->major_ver);
303 	*minor_ver = le16_to_cpu(rsp_params->minor_ver);
304 }
305 
306 /**
307  * Bit masks for a MC I/O object (struct fsl_mc_io) flags
308  */
309 #define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL	0x0001
310 
311 /**
312  * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command()
313  * @dev: device associated with this Mc I/O object
314  * @flags: flags for mc_send_command()
315  * @portal_size: MC command portal size in bytes
316  * @portal_phys_addr: MC command portal physical address
317  * @portal_virt_addr: MC command portal virtual address
318  * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal.
319  *
320  * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not
321  * set:
322  * @mutex: Mutex to serialize mc_send_command() calls that use the same MC
323  * portal, if the fsl_mc_io object was created with the
324  * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this
325  * fsl_mc_io object must be made only from non-atomic context.
326  *
327  * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is
328  * set:
329  * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC
330  * portal, if the fsl_mc_io object was created with the
331  * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this
332  * fsl_mc_io object can be made from atomic or non-atomic context.
333  */
334 struct fsl_mc_io {
335 	struct device *dev;
336 	u16 flags;
337 	u32 portal_size;
338 	phys_addr_t portal_phys_addr;
339 	void __iomem *portal_virt_addr;
340 	struct fsl_mc_device *dpmcp_dev;
341 	union {
342 		/*
343 		 * This field is only meaningful if the
344 		 * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set
345 		 */
346 		struct mutex mutex; /* serializes mc_send_command() */
347 
348 		/*
349 		 * This field is only meaningful if the
350 		 * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set
351 		 */
352 		raw_spinlock_t spinlock; /* serializes mc_send_command() */
353 	};
354 };
355 
356 int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd);
357 
358 #ifdef CONFIG_FSL_MC_BUS
359 #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type)
360 #else
361 /* If fsl-mc bus is not present device cannot belong to fsl-mc bus */
362 #define dev_is_fsl_mc(_dev) (0)
363 #endif
364 
365 /* Macro to check if a device is a container device */
366 #define fsl_mc_is_cont_dev(_dev) (to_fsl_mc_device(_dev)->flags & \
367 	FSL_MC_IS_DPRC)
368 
369 /* Macro to get the container device of a MC device */
370 #define fsl_mc_cont_dev(_dev) (fsl_mc_is_cont_dev(_dev) ? \
371 	(_dev) : (_dev)->parent)
372 
373 /*
374  * module_fsl_mc_driver() - Helper macro for drivers that don't do
375  * anything special in module init/exit.  This eliminates a lot of
376  * boilerplate.  Each module may only use this macro once, and
377  * calling it replaces module_init() and module_exit()
378  */
379 #define module_fsl_mc_driver(__fsl_mc_driver) \
380 	module_driver(__fsl_mc_driver, fsl_mc_driver_register, \
381 		      fsl_mc_driver_unregister)
382 
383 /*
384  * Macro to avoid include chaining to get THIS_MODULE
385  */
386 #define fsl_mc_driver_register(drv) \
387 	__fsl_mc_driver_register(drv, THIS_MODULE)
388 
389 int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
390 					  struct module *owner);
391 
392 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
393 
394 /**
395  * struct fsl_mc_version
396  * @major: Major version number: incremented on API compatibility changes
397  * @minor: Minor version number: incremented on API additions (that are
398  *		backward compatible); reset when major version is incremented
399  * @revision: Internal revision number: incremented on implementation changes
400  *		and/or bug fixes that have no impact on API
401  */
402 struct fsl_mc_version {
403 	u32 major;
404 	u32 minor;
405 	u32 revision;
406 };
407 
408 struct fsl_mc_version *fsl_mc_get_version(void);
409 
410 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
411 					u16 mc_io_flags,
412 					struct fsl_mc_io **new_mc_io);
413 
414 void fsl_mc_portal_free(struct fsl_mc_io *mc_io);
415 
416 int fsl_mc_portal_reset(struct fsl_mc_io *mc_io);
417 
418 int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
419 					enum fsl_mc_pool_type pool_type,
420 					struct fsl_mc_device **new_mc_adev);
421 
422 void fsl_mc_object_free(struct fsl_mc_device *mc_adev);
423 
424 struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode,
425 						struct msi_domain_info *info,
426 						struct irq_domain *parent);
427 
428 int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev);
429 
430 void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev);
431 
432 struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev);
433 
434 extern struct bus_type fsl_mc_bus_type;
435 
436 extern struct device_type fsl_mc_bus_dprc_type;
437 extern struct device_type fsl_mc_bus_dpni_type;
438 extern struct device_type fsl_mc_bus_dpio_type;
439 extern struct device_type fsl_mc_bus_dpsw_type;
440 extern struct device_type fsl_mc_bus_dpbp_type;
441 extern struct device_type fsl_mc_bus_dpcon_type;
442 extern struct device_type fsl_mc_bus_dpmcp_type;
443 extern struct device_type fsl_mc_bus_dpmac_type;
444 extern struct device_type fsl_mc_bus_dprtc_type;
445 extern struct device_type fsl_mc_bus_dpseci_type;
446 extern struct device_type fsl_mc_bus_dpdmux_type;
447 extern struct device_type fsl_mc_bus_dpdcei_type;
448 extern struct device_type fsl_mc_bus_dpaiop_type;
449 extern struct device_type fsl_mc_bus_dpci_type;
450 extern struct device_type fsl_mc_bus_dpdmai_type;
451 
452 static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev)
453 {
454 	return mc_dev->dev.type == &fsl_mc_bus_dprc_type;
455 }
456 
457 static inline bool is_fsl_mc_bus_dpni(const struct fsl_mc_device *mc_dev)
458 {
459 	return mc_dev->dev.type == &fsl_mc_bus_dpni_type;
460 }
461 
462 static inline bool is_fsl_mc_bus_dpio(const struct fsl_mc_device *mc_dev)
463 {
464 	return mc_dev->dev.type == &fsl_mc_bus_dpio_type;
465 }
466 
467 static inline bool is_fsl_mc_bus_dpsw(const struct fsl_mc_device *mc_dev)
468 {
469 	return mc_dev->dev.type == &fsl_mc_bus_dpsw_type;
470 }
471 
472 static inline bool is_fsl_mc_bus_dpdmux(const struct fsl_mc_device *mc_dev)
473 {
474 	return mc_dev->dev.type == &fsl_mc_bus_dpdmux_type;
475 }
476 
477 static inline bool is_fsl_mc_bus_dpbp(const struct fsl_mc_device *mc_dev)
478 {
479 	return mc_dev->dev.type == &fsl_mc_bus_dpbp_type;
480 }
481 
482 static inline bool is_fsl_mc_bus_dpcon(const struct fsl_mc_device *mc_dev)
483 {
484 	return mc_dev->dev.type == &fsl_mc_bus_dpcon_type;
485 }
486 
487 static inline bool is_fsl_mc_bus_dpmcp(const struct fsl_mc_device *mc_dev)
488 {
489 	return mc_dev->dev.type == &fsl_mc_bus_dpmcp_type;
490 }
491 
492 static inline bool is_fsl_mc_bus_dpmac(const struct fsl_mc_device *mc_dev)
493 {
494 	return mc_dev->dev.type == &fsl_mc_bus_dpmac_type;
495 }
496 
497 static inline bool is_fsl_mc_bus_dprtc(const struct fsl_mc_device *mc_dev)
498 {
499 	return mc_dev->dev.type == &fsl_mc_bus_dprtc_type;
500 }
501 
502 static inline bool is_fsl_mc_bus_dpseci(const struct fsl_mc_device *mc_dev)
503 {
504 	return mc_dev->dev.type == &fsl_mc_bus_dpseci_type;
505 }
506 
507 static inline bool is_fsl_mc_bus_dpdcei(const struct fsl_mc_device *mc_dev)
508 {
509 	return mc_dev->dev.type == &fsl_mc_bus_dpdcei_type;
510 }
511 
512 static inline bool is_fsl_mc_bus_dpaiop(const struct fsl_mc_device *mc_dev)
513 {
514 	return mc_dev->dev.type == &fsl_mc_bus_dpaiop_type;
515 }
516 
517 static inline bool is_fsl_mc_bus_dpci(const struct fsl_mc_device *mc_dev)
518 {
519 	return mc_dev->dev.type == &fsl_mc_bus_dpci_type;
520 }
521 
522 static inline bool is_fsl_mc_bus_dpdmai(const struct fsl_mc_device *mc_dev)
523 {
524 	return mc_dev->dev.type == &fsl_mc_bus_dpdmai_type;
525 }
526 
527 #define DPRC_RESET_OPTION_NON_RECURSIVE                0x00000001
528 int dprc_reset_container(struct fsl_mc_io *mc_io,
529 			 u32 cmd_flags,
530 			 u16 token,
531 			 int child_container_id,
532 			 u32 options);
533 
534 int dprc_scan_container(struct fsl_mc_device *mc_bus_dev,
535 			bool alloc_interrupts);
536 
537 void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev,
538 			 struct fsl_mc_obj_desc *obj_desc_array,
539 			 int num_child_objects_in_mc);
540 
541 int dprc_cleanup(struct fsl_mc_device *mc_dev);
542 
543 int dprc_setup(struct fsl_mc_device *mc_dev);
544 
545 /**
546  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
547  * IRQ pool
548  */
549 #define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS	256
550 
551 int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev,
552 			     unsigned int irq_count);
553 
554 void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev);
555 
556 /*
557  * Data Path Buffer Pool (DPBP) API
558  * Contains initialization APIs and runtime control APIs for DPBP
559  */
560 
561 int dpbp_open(struct fsl_mc_io *mc_io,
562 	      u32 cmd_flags,
563 	      int dpbp_id,
564 	      u16 *token);
565 
566 int dpbp_close(struct fsl_mc_io *mc_io,
567 	       u32 cmd_flags,
568 	       u16 token);
569 
570 int dpbp_enable(struct fsl_mc_io *mc_io,
571 		u32 cmd_flags,
572 		u16 token);
573 
574 int dpbp_disable(struct fsl_mc_io *mc_io,
575 		 u32 cmd_flags,
576 		 u16 token);
577 
578 int dpbp_reset(struct fsl_mc_io *mc_io,
579 	       u32 cmd_flags,
580 	       u16 token);
581 
582 /**
583  * struct dpbp_attr - Structure representing DPBP attributes
584  * @id:		DPBP object ID
585  * @bpid:	Hardware buffer pool ID; should be used as an argument in
586  *		acquire/release operations on buffers
587  */
588 struct dpbp_attr {
589 	int id;
590 	u16 bpid;
591 };
592 
593 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
594 			u32 cmd_flags,
595 			u16 token,
596 			struct dpbp_attr *attr);
597 
598 /* Data Path Concentrator (DPCON) API
599  * Contains initialization APIs and runtime control APIs for DPCON
600  */
601 
602 /**
603  * Use it to disable notifications; see dpcon_set_notification()
604  */
605 #define DPCON_INVALID_DPIO_ID		(int)(-1)
606 
607 int dpcon_open(struct fsl_mc_io *mc_io,
608 	       u32 cmd_flags,
609 	       int dpcon_id,
610 	       u16 *token);
611 
612 int dpcon_close(struct fsl_mc_io *mc_io,
613 		u32 cmd_flags,
614 		u16 token);
615 
616 int dpcon_enable(struct fsl_mc_io *mc_io,
617 		 u32 cmd_flags,
618 		 u16 token);
619 
620 int dpcon_disable(struct fsl_mc_io *mc_io,
621 		  u32 cmd_flags,
622 		  u16 token);
623 
624 int dpcon_reset(struct fsl_mc_io *mc_io,
625 		u32 cmd_flags,
626 		u16 token);
627 
628 /**
629  * struct dpcon_attr - Structure representing DPCON attributes
630  * @id: DPCON object ID
631  * @qbman_ch_id: Channel ID to be used by dequeue operation
632  * @num_priorities: Number of priorities for the DPCON channel (1-8)
633  */
634 struct dpcon_attr {
635 	int id;
636 	u16 qbman_ch_id;
637 	u8 num_priorities;
638 };
639 
640 int dpcon_get_attributes(struct fsl_mc_io *mc_io,
641 			 u32 cmd_flags,
642 			 u16 token,
643 			 struct dpcon_attr *attr);
644 
645 /**
646  * struct dpcon_notification_cfg - Structure representing notification params
647  * @dpio_id:	DPIO object ID; must be configured with a notification channel;
648  *	to disable notifications set it to 'DPCON_INVALID_DPIO_ID';
649  * @priority:	Priority selection within the DPIO channel; valid values
650  *		are 0-7, depending on the number of priorities in that channel
651  * @user_ctx:	User context value provided with each CDAN message
652  */
653 struct dpcon_notification_cfg {
654 	int dpio_id;
655 	u8 priority;
656 	u64 user_ctx;
657 };
658 
659 int dpcon_set_notification(struct fsl_mc_io *mc_io,
660 			   u32 cmd_flags,
661 			   u16 token,
662 			   struct dpcon_notification_cfg *cfg);
663 
664 #endif /* _FSL_MC_H_ */
665