6cc14a661cacdb5f70ca9dda7cd4b6b1b76cdcd2
[deb_dpdk.git] / drivers / crypto / dpaa2_sec / mc / fsl_dpseci.h
1 /*-
2  * This file is provided under a dual BSD/GPLv2 license. When using or
3  * redistributing this file, you may do so under either license.
4  *
5  *   BSD LICENSE
6  *
7  * Copyright 2013-2016 Freescale Semiconductor Inc.
8  * Copyright 2016 NXP.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the above-listed copyright holders nor the
18  * names of any contributors may be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  *   GPL LICENSE SUMMARY
22  *
23  * ALTERNATIVELY, this software may be distributed under the terms of the
24  * GNU General Public License ("GPL") as published by the Free Software
25  * Foundation, either version 2 of that License or (at your option) any
26  * later version.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
32  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40
41 #ifndef __FSL_DPSECI_H
42 #define __FSL_DPSECI_H
43
44 /* Data Path SEC Interface API
45  * Contains initialization APIs and runtime control APIs for DPSECI
46  */
47
48 struct fsl_mc_io;
49
50 /**
51  * General DPSECI macros
52  */
53
54 /**
55  * Maximum number of Tx/Rx priorities per DPSECI object
56  */
57 #define DPSECI_PRIO_NUM         8
58
59 /**
60  * All queues considered; see dpseci_set_rx_queue()
61  */
62 #define DPSECI_ALL_QUEUES       (uint8_t)(-1)
63
64 /**
65  * dpseci_open() - Open a control session for the specified object
66  * This function can be used to open a control session for an
67  * already created object; an object may have been declared in
68  * the DPL or by calling the dpseci_create() function.
69  * This function returns a unique authentication token,
70  * associated with the specific object ID and the specific MC
71  * portal; this token must be used in all subsequent commands for
72  * this specific object.
73  *
74  * @param       mc_io           Pointer to MC portal's I/O object
75  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
76  * @param       dpseci_id       DPSECI unique ID
77  * @param       token           Returned token; use in subsequent API calls
78  *
79  * @return:
80  *   - Return '0' on Success.
81  *   - Return Error code otherwise.
82  */
83 int
84 dpseci_open(struct fsl_mc_io *mc_io,
85             uint32_t cmd_flags,
86             int dpseci_id,
87             uint16_t *token);
88
89 /**
90  * dpseci_close() - Close the control session of the object
91  * After this function is called, no further operations are
92  * allowed on the object without opening a new control session.
93  *
94  * @param       mc_io           Pointer to MC portal's I/O object
95  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
96  * @param       token           Token of DPSECI object
97  *
98  * @return:
99  *   - Return '0' on Success.
100  *   - Return Error code otherwise.
101  */
102 int
103 dpseci_close(struct fsl_mc_io *mc_io,
104              uint32_t cmd_flags,
105              uint16_t token);
106
107 /**
108  * struct dpseci_cfg - Structure representing DPSECI configuration
109  */
110 struct dpseci_cfg {
111         uint8_t num_tx_queues;  /* num of queues towards the SEC */
112         uint8_t num_rx_queues;  /* num of queues back from the SEC */
113         uint8_t priorities[DPSECI_PRIO_NUM];
114         /**< Priorities for the SEC hardware processing;
115          * each place in the array is the priority of the tx queue
116          * towards the SEC,
117          * valid priorities are configured with values 1-8;
118          */
119 };
120
121 /**
122  * dpseci_create() - Create the DPSECI object
123  * Create the DPSECI object, allocate required resources and
124  * perform required initialization.
125  *
126  * The object can be created either by declaring it in the
127  * DPL file, or by calling this function.
128  *
129  * The function accepts an authentication token of a parent
130  * container that this object should be assigned to. The token
131  * can be '0' so the object will be assigned to the default container.
132  * The newly created object can be opened with the returned
133  * object id and using the container's associated tokens and MC portals.
134  *
135  * @param       mc_io         Pointer to MC portal's I/O object
136  * @param       dprc_token    Parent container token; '0' for default container
137  * @param       cmd_flags     Command flags; one or more of 'MC_CMD_FLAG_'
138  * @param       cfg           Configuration structure
139  * @param       obj_id        returned object id
140  *
141  * @return:
142  *   - Return '0' on Success.
143  *   - Return Error code otherwise.
144  */
145 int
146 dpseci_create(struct fsl_mc_io *mc_io,
147               uint16_t dprc_token,
148               uint32_t cmd_flags,
149               const struct dpseci_cfg *cfg,
150               uint32_t *obj_id);
151
152 /**
153  * dpseci_destroy() - Destroy the DPSECI object and release all its resources.
154  * The function accepts the authentication token of the parent container that
155  * created the object (not the one that currently owns the object). The object
156  * is searched within parent using the provided 'object_id'.
157  * All tokens to the object must be closed before calling destroy.
158  *
159  * @param       mc_io         Pointer to MC portal's I/O object
160  * @param       dprc_token    Parent container token; '0' for default container
161  * @param       cmd_flags     Command flags; one or more of 'MC_CMD_FLAG_'
162  * @param       object_id     The object id; it must be a valid id within the
163  *                            container that created this object;
164  *
165  * @return:
166  *   - Return '0' on Success.
167  *   - Return Error code otherwise.
168  */
169 int
170 dpseci_destroy(struct fsl_mc_io *mc_io,
171                uint16_t dprc_token,
172                uint32_t cmd_flags,
173                uint32_t object_id);
174
175 /**
176  * dpseci_enable() - Enable the DPSECI, allow sending and receiving frames.
177  * @param       mc_io           Pointer to MC portal's I/O object
178  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
179  * @param       token           Token of DPSECI object
180  *
181  * @return:
182  *   - Return '0' on Success.
183  *   - Return Error code otherwise.
184  */
185 int
186 dpseci_enable(struct fsl_mc_io *mc_io,
187               uint32_t cmd_flags,
188               uint16_t token);
189
190 /**
191  * dpseci_disable() - Disable the DPSECI, stop sending and receiving frames.
192  * @param       mc_io           Pointer to MC portal's I/O object
193  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
194  * @param       token           Token of DPSECI object
195  *
196  * @return:
197  *   - Return '0' on Success.
198  *   - Return Error code otherwise.
199  */
200 int
201 dpseci_disable(struct fsl_mc_io *mc_io,
202                uint32_t cmd_flags,
203                uint16_t token);
204
205 /**
206  * dpseci_is_enabled() - Check if the DPSECI is enabled.
207  * @param       mc_io           Pointer to MC portal's I/O object
208  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
209  * @param       token           Token of DPSECI object
210  * @param       en              Returns '1' if object is enabled; '0' otherwise
211  *
212  * @return:
213  *   - Return '0' on Success.
214  *   - Return Error code otherwise.
215  */
216 int
217 dpseci_is_enabled(struct fsl_mc_io *mc_io,
218                   uint32_t cmd_flags,
219                   uint16_t token,
220                   int *en);
221
222 /**
223  * dpseci_reset() - Reset the DPSECI, returns the object to initial state.
224  * @param       mc_io           Pointer to MC portal's I/O object
225  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
226  * @param       token           Token of DPSECI object
227  *
228  * @return:
229  *   - Return '0' on Success.
230  *   - Return Error code otherwise.
231  */
232 int
233 dpseci_reset(struct fsl_mc_io *mc_io,
234              uint32_t cmd_flags,
235              uint16_t token);
236
237 /**
238  * struct dpseci_irq_cfg - IRQ configuration
239  */
240 struct dpseci_irq_cfg {
241         uint64_t addr;
242         /* Address that must be written to signal a message-based interrupt */
243         uint32_t val;
244         /* Value to write into irq_addr address */
245         int irq_num;
246         /* A user defined number associated with this IRQ */
247 };
248
249 /**
250  * dpseci_set_irq() - Set IRQ information for the DPSECI to trigger an interrupt
251  * @param       mc_io           Pointer to MC portal's I/O object
252  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
253  * @param       token           Token of DPSECI object
254  * @param       irq_index       Identifies the interrupt index to configure
255  * @param       irq_cfg         IRQ configuration
256  *
257  * @return:
258  *   - Return '0' on Success.
259  *   - Return Error code otherwise.
260  */
261 int
262 dpseci_set_irq(struct fsl_mc_io *mc_io,
263                uint32_t cmd_flags,
264                uint16_t token,
265                uint8_t irq_index,
266                struct dpseci_irq_cfg *irq_cfg);
267
268 /**
269  * dpseci_get_irq() - Get IRQ information from the DPSECI
270  *
271  * @param       mc_io           Pointer to MC portal's I/O object
272  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
273  * @param       token           Token of DPSECI object
274  * @param       irq_index       The interrupt index to configure
275  * @param       type            Interrupt type: 0 represents message interrupt
276  *                              type (both irq_addr and irq_val are valid)
277  * @param       irq_cfg         IRQ attributes
278  *
279  * @return:
280  *   - Return '0' on Success.
281  *   - Return Error code otherwise.
282  */
283 int
284 dpseci_get_irq(struct fsl_mc_io *mc_io,
285                uint32_t cmd_flags,
286                uint16_t token,
287                uint8_t irq_index,
288                int *type,
289                struct dpseci_irq_cfg *irq_cfg);
290
291 /**
292  * dpseci_set_irq_enable() - Set overall interrupt state.
293  * Allows GPP software to control when interrupts are generated.
294  * Each interrupt can have up to 32 causes.  The enable/disable control's the
295  * overall interrupt state. if the interrupt is disabled no causes will cause
296  * an interrupt
297  *
298  * @param       mc_io           Pointer to MC portal's I/O object
299  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
300  * @param       token           Token of DPSECI object
301  * @param       irq_index       The interrupt index to configure
302  * @param       en              Interrupt state - enable = 1, disable = 0
303  *
304  * @return:
305  *   - Return '0' on Success.
306  *   - Return Error code otherwise.
307  */
308 int
309 dpseci_set_irq_enable(struct fsl_mc_io *mc_io,
310                       uint32_t cmd_flags,
311                       uint16_t token,
312                       uint8_t irq_index,
313                       uint8_t en);
314
315 /**
316  * dpseci_get_irq_enable() - Get overall interrupt state
317  * @param       mc_io           Pointer to MC portal's I/O object
318  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
319  * @param       token           Token of DPSECI object
320  * @param       irq_index       The interrupt index to configure
321  * @param       en              Returned Interrupt state - enable = 1,
322  *                              disable = 0
323  *
324  * @return:
325  *   - Return '0' on Success.
326  *   - Return Error code otherwise.
327  */
328 int
329 dpseci_get_irq_enable(struct fsl_mc_io *mc_io,
330                       uint32_t cmd_flags,
331                       uint16_t token,
332                       uint8_t irq_index,
333                       uint8_t *en);
334
335 /**
336  * dpseci_set_irq_mask() - Set interrupt mask.
337  * Every interrupt can have up to 32 causes and the interrupt model supports
338  * masking/unmasking each cause independently
339  *
340  * @param       mc_io           Pointer to MC portal's I/O object
341  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
342  * @param       token           Token of DPSECI object
343  * @param       irq_index       The interrupt index to configure
344  * @param       mask            event mask to trigger interrupt;
345  *                              each bit:
346  *                                      0 = ignore event
347  *                                      1 = consider event for asserting IRQ
348  *
349  * @return:
350  *   - Return '0' on Success.
351  *   - Return Error code otherwise.
352  */
353 int
354 dpseci_set_irq_mask(struct fsl_mc_io *mc_io,
355                     uint32_t cmd_flags,
356                     uint16_t token,
357                     uint8_t irq_index,
358                     uint32_t mask);
359
360 /**
361  * dpseci_get_irq_mask() - Get interrupt mask.
362  * Every interrupt can have up to 32 causes and the interrupt model supports
363  * masking/unmasking each cause independently
364  *
365  * @param       mc_io           Pointer to MC portal's I/O object
366  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
367  * @param       token           Token of DPSECI object
368  * @param       irq_index       The interrupt index to configure
369  * @param       mask            Returned event mask to trigger interrupt
370  *
371  * @return:
372  *   - Return '0' on Success.
373  *   - Return Error code otherwise.
374  */
375 int
376 dpseci_get_irq_mask(struct fsl_mc_io *mc_io,
377                     uint32_t cmd_flags,
378                     uint16_t token,
379                     uint8_t irq_index,
380                     uint32_t *mask);
381
382 /**
383  * dpseci_get_irq_status() - Get the current status of any pending interrupts
384  * @param       mc_io           Pointer to MC portal's I/O object
385  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
386  * @param       token           Token of DPSECI object
387  * @param       irq_index       The interrupt index to configure
388  * @param       status          Returned interrupts status - one bit per cause:
389  *                                      0 = no interrupt pending
390  *                                      1 = interrupt pending
391  *
392  * @return:
393  *   - Return '0' on Success.
394  *   - Return Error code otherwise.
395  */
396 int
397 dpseci_get_irq_status(struct fsl_mc_io *mc_io,
398                       uint32_t cmd_flags,
399                       uint16_t token,
400                       uint8_t irq_index,
401                       uint32_t *status);
402
403 /**
404  * dpseci_clear_irq_status() - Clear a pending interrupt's status
405  * @param       mc_io           Pointer to MC portal's I/O object
406  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
407  * @param       token           Token of DPSECI object
408  * @param       irq_index       The interrupt index to configure
409  * @param       status          bits to clear (W1C) - one bit per cause:
410  *                                      0 = don't change
411  *                                      1 = clear status bit
412  *
413  * @return:
414  *   - Return '0' on Success.
415  *   - Return Error code otherwise.
416  */
417 int
418 dpseci_clear_irq_status(struct fsl_mc_io *mc_io,
419                         uint32_t cmd_flags,
420                         uint16_t token,
421                         uint8_t irq_index,
422                         uint32_t status);
423
424 /**
425  * struct dpseci_attr - Structure representing DPSECI attributes
426  * @param       id: DPSECI object ID
427  * @param       num_tx_queues: number of queues towards the SEC
428  * @param       num_rx_queues: number of queues back from the SEC
429  */
430 struct dpseci_attr {
431         int id;                 /* DPSECI object ID */
432         uint8_t num_tx_queues;  /* number of queues towards the SEC */
433         uint8_t num_rx_queues;  /* number of queues back from the SEC */
434 };
435
436 /**
437  * dpseci_get_attributes() - Retrieve DPSECI attributes.
438  * @param       mc_io           Pointer to MC portal's I/O object
439  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
440  * @param       token           Token of DPSECI object
441  * @param       attr            Returned object's attributes
442  *
443  * @return:
444  *   - Return '0' on Success.
445  *   - Return Error code otherwise.
446  */
447 int
448 dpseci_get_attributes(struct fsl_mc_io *mc_io,
449                       uint32_t cmd_flags,
450                       uint16_t token,
451                       struct dpseci_attr *attr);
452
453 /**
454  * enum dpseci_dest - DPSECI destination types
455  * @DPSECI_DEST_NONE: Unassigned destination; The queue is set in parked mode
456  *              and does not generate FQDAN notifications; user is expected to
457  *              dequeue from the queue based on polling or other user-defined
458  *              method
459  * @DPSECI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
460  *              notifications to the specified DPIO; user is expected to dequeue
461  *              from the queue only after notification is received
462  * @DPSECI_DEST_DPCON: The queue is set in schedule mode and does not generate
463  *              FQDAN notifications, but is connected to the specified DPCON
464  *              object; user is expected to dequeue from the DPCON channel
465  */
466 enum dpseci_dest {
467         DPSECI_DEST_NONE = 0,
468         DPSECI_DEST_DPIO = 1,
469         DPSECI_DEST_DPCON = 2
470 };
471
472 /**
473  * struct dpseci_dest_cfg - Structure representing DPSECI destination parameters
474  */
475 struct dpseci_dest_cfg {
476         enum dpseci_dest dest_type; /* Destination type */
477         int dest_id;
478         /* Either DPIO ID or DPCON ID, depending on the destination type */
479         uint8_t priority;
480         /* Priority selection within the DPIO or DPCON channel; valid values
481          * are 0-1 or 0-7, depending on the number of priorities in that
482          * channel; not relevant for 'DPSECI_DEST_NONE' option
483          */
484 };
485
486 /**
487  * DPSECI queue modification options
488  */
489
490 /**
491  * Select to modify the user's context associated with the queue
492  */
493 #define DPSECI_QUEUE_OPT_USER_CTX               0x00000001
494
495 /**
496  * Select to modify the queue's destination
497  */
498 #define DPSECI_QUEUE_OPT_DEST                   0x00000002
499
500 /**
501  * Select to modify the queue's order preservation
502  */
503 #define DPSECI_QUEUE_OPT_ORDER_PRESERVATION     0x00000004
504
505 /**
506  * struct dpseci_rx_queue_cfg - DPSECI RX queue configuration
507  */
508 struct dpseci_rx_queue_cfg {
509         uint32_t options;
510         /* Flags representing the suggested modifications to the queue;
511          * Use any combination of 'DPSECI_QUEUE_OPT_<X>' flags
512          */
513         int order_preservation_en;
514         /* order preservation configuration for the rx queue
515          * valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in
516          * 'options'
517          */
518         uint64_t user_ctx;
519         /* User context value provided in the frame descriptor of each
520          * dequeued frame;
521          * valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options'
522          */
523         struct dpseci_dest_cfg dest_cfg;
524         /* Queue destination parameters;
525          * valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options'
526          */
527 };
528
529 /**
530  * dpseci_set_rx_queue() - Set Rx queue configuration
531  * @param       mc_io           Pointer to MC portal's I/O object
532  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
533  * @param       token           Token of DPSECI object
534  * @param       queue           Select the queue relative to number of
535  *                              priorities configured at DPSECI creation; use
536  *                              DPSECI_ALL_QUEUES to configure all Rx queues
537  *                              identically.
538  * @param       cfg             Rx queue configuration
539  *
540  * @return:
541  *   - Return '0' on Success.
542  *   - Return Error code otherwise.
543  */
544 int
545 dpseci_set_rx_queue(struct fsl_mc_io *mc_io,
546                     uint32_t cmd_flags,
547                     uint16_t token,
548                     uint8_t queue,
549                     const struct dpseci_rx_queue_cfg *cfg);
550
551 /**
552  * struct dpseci_rx_queue_attr - Structure representing attributes of Rx queues
553  */
554 struct dpseci_rx_queue_attr {
555         uint64_t user_ctx;
556         /* User context value provided in the frame descriptor of
557          * each dequeued frame
558          */
559         int order_preservation_en;
560         /* Status of the order preservation configuration on the queue */
561         struct dpseci_dest_cfg  dest_cfg;
562         /* Queue destination configuration */
563         uint32_t fqid;
564         /* Virtual FQID value to be used for dequeue operations */
565 };
566
567 /**
568  * dpseci_get_rx_queue() - Retrieve Rx queue attributes.
569  * @param       mc_io           Pointer to MC portal's I/O object
570  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
571  * @param       token           Token of DPSECI object
572  * @param       queue           Select the queue relative to number of
573  *                              priorities configured at DPSECI creation
574  * @param       attr            Returned Rx queue attributes
575  *
576  * @return:
577  *   - Return '0' on Success.
578  *   - Return Error code otherwise.
579  */
580 int
581 dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
582                     uint32_t cmd_flags,
583                     uint16_t token,
584                     uint8_t queue,
585                     struct dpseci_rx_queue_attr *attr);
586
587 /**
588  * struct dpseci_tx_queue_attr - Structure representing attributes of Tx queues
589  */
590 struct dpseci_tx_queue_attr {
591         uint32_t fqid;
592         /* Virtual FQID to be used for sending frames to SEC hardware */
593         uint8_t priority;
594         /* SEC hardware processing priority for the queue */
595 };
596
597 /**
598  * dpseci_get_tx_queue() - Retrieve Tx queue attributes.
599  * @param       mc_io           Pointer to MC portal's I/O object
600  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
601  * @param       token           Token of DPSECI object
602  * @param       queue           Select the queue relative to number of
603  *                              priorities configured at DPSECI creation
604  * @param       attr            Returned Tx queue attributes
605  *
606  * @return:
607  *   - Return '0' on Success.
608  *   - Return Error code otherwise.
609  */
610 int
611 dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
612                     uint32_t cmd_flags,
613                     uint16_t token,
614                     uint8_t queue,
615                     struct dpseci_tx_queue_attr *attr);
616
617 /**
618  * struct dpseci_sec_attr - Structure representing attributes of the SEC
619  *                      hardware accelerator
620  */
621
622 struct dpseci_sec_attr {
623         uint16_t ip_id;         /* ID for SEC */
624         uint8_t major_rev;      /* Major revision number for SEC */
625         uint8_t minor_rev;      /* Minor revision number for SEC */
626         uint8_t era;            /* SEC Era */
627         uint8_t deco_num;
628         /* The number of copies of the DECO that are implemented in
629          * this version of SEC
630          */
631         uint8_t zuc_auth_acc_num;
632         /* The number of copies of ZUCA that are implemented in this
633          * version of SEC
634          */
635         uint8_t zuc_enc_acc_num;
636         /* The number of copies of ZUCE that are implemented in this
637          * version of SEC
638          */
639         uint8_t snow_f8_acc_num;
640         /* The number of copies of the SNOW-f8 module that are
641          * implemented in this version of SEC
642          */
643         uint8_t snow_f9_acc_num;
644         /* The number of copies of the SNOW-f9 module that are
645          * implemented in this version of SEC
646          */
647         uint8_t crc_acc_num;
648         /* The number of copies of the CRC module that are implemented
649          * in this version of SEC
650          */
651         uint8_t pk_acc_num;
652         /* The number of copies of the Public Key module that are
653          * implemented in this version of SEC
654          */
655         uint8_t kasumi_acc_num;
656         /* The number of copies of the Kasumi module that are
657          * implemented in this version of SEC
658          */
659         uint8_t rng_acc_num;
660         /* The number of copies of the Random Number Generator that are
661          * implemented in this version of SEC
662          */
663         uint8_t md_acc_num;
664         /* The number of copies of the MDHA (Hashing module) that are
665          * implemented in this version of SEC
666          */
667         uint8_t arc4_acc_num;
668         /* The number of copies of the ARC4 module that are implemented
669          * in this version of SEC
670          */
671         uint8_t des_acc_num;
672         /* The number of copies of the DES module that are implemented
673          * in this version of SEC
674          */
675         uint8_t aes_acc_num;
676         /* The number of copies of the AES module that are implemented
677          * in this version of SEC
678          */
679 };
680
681 /**
682  * dpseci_get_sec_attr() - Retrieve SEC accelerator attributes.
683  * @param       mc_io           Pointer to MC portal's I/O object
684  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
685  * @param       token           Token of DPSECI object
686  * @param       attr            Returned SEC attributes
687  *
688  * @return:
689  *   - Return '0' on Success.
690  *   - Return Error code otherwise.
691  */
692 int
693 dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
694                     uint32_t cmd_flags,
695                     uint16_t token,
696                     struct dpseci_sec_attr *attr);
697
698 /**
699  * struct dpseci_sec_counters - Structure representing global SEC counters and
700  *                              not per dpseci counters
701  */
702 struct dpseci_sec_counters {
703         uint64_t dequeued_requests; /* Number of Requests Dequeued */
704         uint64_t ob_enc_requests;   /* Number of Outbound Encrypt Requests */
705         uint64_t ib_dec_requests;   /* Number of Inbound Decrypt Requests */
706         uint64_t ob_enc_bytes;      /* Number of Outbound Bytes Encrypted */
707         uint64_t ob_prot_bytes;     /* Number of Outbound Bytes Protected */
708         uint64_t ib_dec_bytes;      /* Number of Inbound Bytes Decrypted */
709         uint64_t ib_valid_bytes;    /* Number of Inbound Bytes Validated */
710 };
711
712 /**
713  * dpseci_get_sec_counters() - Retrieve SEC accelerator counters.
714  * @param       mc_io           Pointer to MC portal's I/O object
715  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
716  * @param       token           Token of DPSECI object
717  * @param       counters        Returned SEC counters
718  *
719  * @return:
720  *   - Return '0' on Success.
721  *   - Return Error code otherwise.
722  */
723 int
724 dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
725                         uint32_t cmd_flags,
726                         uint16_t token,
727                         struct dpseci_sec_counters *counters);
728
729 /**
730  * dpseci_get_api_version() - Get Data Path SEC Interface API version
731  * @param       mc_io           Pointer to MC portal's I/O object
732  * @param       cmd_flags       Command flags; one or more of 'MC_CMD_FLAG_'
733  * @param       major_ver       Major version of data path sec API
734  * @param       minor_ver       Minor version of data path sec API
735  *
736  * @return:
737  *   - Return '0' on Success.
738  *   - Return Error code otherwise.
739  */
740 int
741 dpseci_get_api_version(struct fsl_mc_io *mc_io,
742                        uint32_t cmd_flags,
743                        uint16_t *major_ver,
744                        uint16_t *minor_ver);
745
746 #endif /* __FSL_DPSECI_H */