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