eal: remove sys/queue.h from public headers
[dpdk.git] / drivers / net / bnxt / tf_core / tf_device.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2021 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_DEVICE_H_
7 #define _TF_DEVICE_H_
8
9 #include "tf_core.h"
10 #include "tf_identifier.h"
11 #include "tf_tbl.h"
12 #include "tf_tcam.h"
13 #ifdef TF_TCAM_SHARED
14 #include "tf_tcam_shared.h"
15 #endif
16 #include "tf_if_tbl.h"
17 #include "tf_global_cfg.h"
18
19 struct tf;
20 struct tf_session;
21
22 /**
23  * The Device module provides a general device template. A supported
24  * device type should implement one or more of the listed function
25  * pointers according to its capabilities.
26  *
27  * If a device function pointer is NULL the device capability is not
28  * supported.
29  */
30
31 /**
32  * TF device information
33  */
34 struct tf_dev_info {
35         enum tf_device_type type;
36         const struct tf_dev_ops *ops;
37 };
38
39 /**
40  * @page device Device
41  *
42  * @ref tf_dev_bind
43  *
44  * @ref tf_dev_unbind
45  */
46
47 /**
48  * Device bind handles the initialization of the specified device
49  * type.
50  *
51  * [in] tfp
52  *   Pointer to TF handle
53  *
54  * [in] type
55  *   Device type
56  *
57  * [in] resources
58  *   Pointer to resource allocation information
59  *
60  * [in] wc_num_slices
61  *   Number of slices per row for WC
62  *
63  * [out] dev_handle
64  *   Device handle
65  *
66  * Returns
67  *   - (0) if successful.
68  *   - (-EINVAL) parameter failure.
69  *   - (-ENODEV) no such device supported.
70  */
71 int tf_dev_bind(struct tf *tfp,
72                 enum tf_device_type type,
73                 bool shadow_copy,
74                 struct tf_session_resources *resources,
75                 uint16_t wc_num_slices,
76                 struct tf_dev_info *dev_handle);
77
78 /**
79  * Device release handles cleanup of the device specific information.
80  *
81  * [in] tfp
82  *   Pointer to TF handle
83  *
84  * [in] dev_handle
85  *   Device handle
86  *
87  * Returns
88  *   - (0) if successful.
89  *   - (-EINVAL) parameter failure.
90  *   - (-ENODEV) no such device supported.
91  */
92 int tf_dev_unbind(struct tf *tfp,
93                   struct tf_dev_info *dev_handle);
94
95 int
96 tf_dev_bind_ops(enum tf_device_type type,
97                 struct tf_dev_info *dev_handle);
98
99 /**
100  * Truflow device specific function hooks structure
101  *
102  * The following device hooks can be defined; unless noted otherwise,
103  * they are optional and can be filled with a null pointer. The
104  * purpose of these hooks is to support Truflow device operations for
105  * different device variants.
106  */
107 struct tf_dev_ops {
108         /**
109          * Retrieves the MAX number of resource types that the device
110          * supports.
111          *
112          * [in] tfp
113          *   Pointer to TF handle
114          *
115          * [out] max_types
116          *   Pointer to MAX number of types the device supports
117          *
118          * Returns
119          *   - (0) if successful.
120          *   - (-EINVAL) on failure.
121          */
122         int (*tf_dev_get_max_types)(struct tf *tfp,
123                                     uint16_t *max_types);
124
125         /**
126          * Retrieves the string description for the CFA resource
127          * type
128          *
129          * [in] tfp
130          *   Pointer to TF handle
131          *
132          * [in] resource_id
133          *   HCAPI cfa resource type id
134          *
135          * [out] resource_str
136          *   Pointer to a string
137          *
138          * Returns
139          *   - (0) if successful.
140          *   - (-EINVAL) on failure.
141          */
142         int (*tf_dev_get_resource_str)(struct tf *tfp,
143                                        uint16_t resource_id,
144                                        const char **resource_str);
145
146         /**
147          * Set the WC TCAM slice information that the device
148          * supports.
149          *
150          * [in] tfp
151          *   Pointer to TF handle
152          *
153          * [in] num_slices_per_row
154          *   Number of slices per row the device supports
155          *
156          * Returns
157          *   - (0) if successful.
158          *   - (-EINVAL) on failure.
159          */
160         int (*tf_dev_set_tcam_slice_info)(struct tf *tfp,
161                                           enum tf_wc_num_slice num_slices_per_row);
162
163         /**
164          * Retrieves the WC TCAM slice information that the device
165          * supports.
166          *
167          * [in] tfp
168          *   Pointer to TF handle
169          *
170          * [in] type
171          *   TCAM table type
172          *
173          * [in] key_sz
174          *   Key size
175          *
176          * [out] num_slices_per_row
177          *   Pointer to number of slices per row the device supports
178          *
179          * Returns
180          *   - (0) if successful.
181          *   - (-EINVAL) on failure.
182          */
183         int (*tf_dev_get_tcam_slice_info)(struct tf *tfp,
184                                           enum tf_tcam_tbl_type type,
185                                           uint16_t key_sz,
186                                           uint16_t *num_slices_per_row);
187
188         /**
189          * Allocation of an identifier element.
190          *
191          * This API allocates the specified identifier element from a
192          * device specific identifier DB. The allocated element is
193          * returned.
194          *
195          * [in] tfp
196          *   Pointer to TF handle
197          *
198          * [in] parms
199          *   Pointer to identifier allocation parameters
200          *
201          * Returns
202          *   - (0) if successful.
203          *   - (-EINVAL) on failure.
204          */
205         int (*tf_dev_alloc_ident)(struct tf *tfp,
206                                   struct tf_ident_alloc_parms *parms);
207
208         /**
209          * Free of an identifier element.
210          *
211          * This API free's a previous allocated identifier element from a
212          * device specific identifier DB.
213          *
214          * [in] tfp
215          *   Pointer to TF handle
216          *
217          * [in] parms
218          *   Pointer to identifier free parameters
219          *
220          * Returns
221          *   - (0) if successful.
222          *   - (-EINVAL) on failure.
223          */
224         int (*tf_dev_free_ident)(struct tf *tfp,
225                                  struct tf_ident_free_parms *parms);
226
227         /**
228          * Search of an identifier element.
229          *
230          * This API search the specified identifier element from a
231          * device specific identifier shadow DB. The allocated element
232          * is returned.
233          *
234          * [in] tfp
235          *   Pointer to TF handle
236          *
237          * [in] parms
238          *   Pointer to identifier search parameters
239          *
240          * Returns
241          *   - (0) if successful.
242          *   - (-EINVAL) on failure.
243          */
244         int (*tf_dev_search_ident)(struct tf *tfp,
245                                    struct tf_ident_search_parms *parms);
246
247         /**
248          * Retrieves the identifier resource info.
249          *
250          * This API retrieves the identifier resource info from the rm db.
251          *
252          * [in] tfp
253          *   Pointer to TF handle
254          *
255          * [in] parms
256          *   Pointer to identifier info
257          *
258          * Returns
259          *   - (0) if successful.
260          *   - (-EINVAL) on failure.
261          */
262         int (*tf_dev_get_ident_resc_info)(struct tf *tfp,
263                                           struct tf_identifier_resource_info *parms);
264
265         /**
266          * Indicates whether the index table type is SRAM managed
267          *
268          * [in] tfp
269          *   Pointer to TF handle
270          *
271          * [in] type
272          *   Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD
273          *
274          * Returns
275          *   - (0) if the table is not managed by the SRAM manager
276          *   - (1) if the table is managed by the SRAM manager
277          */
278         bool (*tf_dev_is_sram_managed)(struct tf *tfp,
279                                        enum tf_tbl_type tbl_type);
280
281         /**
282          * Get SRAM table information.
283          *
284          * Converts an internal RM allocated element offset to
285          * a user address and vice versa.
286          *
287          * [in] tfp
288          *   Pointer to TF handle
289          *
290          * [in] type
291          *   Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD
292          *
293          * [in/out] base
294          *   Pointer to the base address of the associated table type.
295          *
296          * [in/out] shift
297          *   Pointer to any shift required for the associated table type.
298          *
299          * Returns
300          *   - (0) if successful.
301          *   - (-EINVAL) on failure.
302          */
303         int (*tf_dev_get_tbl_info)(struct tf *tfp,
304                                    void *tbl_db,
305                                    enum tf_tbl_type type,
306                                    uint16_t *base,
307                                    uint16_t *shift);
308
309         /**
310          * Allocation of an index table type element.
311          *
312          * This API allocates the specified table type element from a
313          * device specific table type DB. The allocated element is
314          * returned.
315          *
316          * [in] tfp
317          *   Pointer to TF handle
318          *
319          * [in] parms
320          *   Pointer to table allocation parameters
321          *
322          * Returns
323          *   - (0) if successful.
324          *   - (-EINVAL) on failure.
325          */
326         int (*tf_dev_alloc_tbl)(struct tf *tfp,
327                                 struct tf_tbl_alloc_parms *parms);
328
329         /**
330          * Allocation of an SRAM index table type element.
331          *
332          * This API allocates the specified table type element from a
333          * device specific table type DB. The allocated element is
334          * returned.
335          *
336          * [in] tfp
337          *   Pointer to TF handle
338          *
339          * [in] parms
340          *   Pointer to table allocation parameters
341          *
342          * Returns
343          *   - (0) if successful.
344          *   - (-EINVAL) on failure.
345          */
346         int (*tf_dev_alloc_sram_tbl)(struct tf *tfp,
347                                      struct tf_tbl_alloc_parms *parms);
348         /**
349          * Allocation of a external table type element.
350          *
351          * This API allocates the specified table type element from a
352          * device specific table type DB. The allocated element is
353          * returned.
354          *
355          * [in] tfp
356          *   Pointer to TF handle
357          *
358          * [in] parms
359          *   Pointer to table allocation parameters
360          *
361          * Returns
362          *   - (0) if successful.
363          *   - (-EINVAL) on failure.
364          */
365         int (*tf_dev_alloc_ext_tbl)(struct tf *tfp,
366                                     struct tf_tbl_alloc_parms *parms);
367
368         /**
369          * Free of a table type element.
370          *
371          * This API free's a previous allocated table type element from a
372          * device specific table type DB.
373          *
374          * [in] tfp
375          *   Pointer to TF handle
376          *
377          * [in] parms
378          *   Pointer to table free parameters
379          *
380          * Returns
381          *   - (0) if successful.
382          *   - (-EINVAL) on failure.
383          */
384         int (*tf_dev_free_tbl)(struct tf *tfp,
385                                struct tf_tbl_free_parms *parms);
386         /**
387          * Free of an SRAM table type element.
388          *
389          * This API free's a previous allocated table type element from a
390          * device specific table type DB.
391          *
392          * [in] tfp
393          *   Pointer to TF handle
394          *
395          * [in] parms
396          *   Pointer to table free parameters
397          *
398          * Returns
399          *   - (0) if successful.
400          *   - (-EINVAL) on failure.
401          */
402         int (*tf_dev_free_sram_tbl)(struct tf *tfp,
403                                     struct tf_tbl_free_parms *parms);
404         /**
405          * Free of a external table type element.
406          *
407          * This API free's a previous allocated table type element from a
408          * device specific table type DB.
409          *
410          * [in] tfp
411          *   Pointer to TF handle
412          *
413          * [in] parms
414          *   Pointer to table free parameters
415          *
416          * Returns
417          *   - (0) if successful.
418          *   - (-EINVAL) on failure.
419          */
420         int (*tf_dev_free_ext_tbl)(struct tf *tfp,
421                                    struct tf_tbl_free_parms *parms);
422
423         /**
424          * Sets the specified table type element.
425          *
426          * This API sets the specified element data by invoking the
427          * firmware.
428          *
429          * [in] tfp
430          *   Pointer to TF handle
431          *
432          * [in] parms
433          *   Pointer to table set parameters
434          *
435          * Returns
436          *   - (0) if successful.
437          *   - (-EINVAL) on failure.
438          */
439         int (*tf_dev_set_tbl)(struct tf *tfp,
440                               struct tf_tbl_set_parms *parms);
441
442         /**
443          * Sets the specified external table type element.
444          *
445          * This API sets the specified element data by invoking the
446          * firmware.
447          *
448          * [in] tfp
449          *   Pointer to TF handle
450          *
451          * [in] parms
452          *   Pointer to table set parameters
453          *
454          * Returns
455          *   - (0) if successful.
456          *   - (-EINVAL) on failure.
457          */
458         int (*tf_dev_set_ext_tbl)(struct tf *tfp,
459                                   struct tf_tbl_set_parms *parms);
460
461         /**
462          * Sets the specified SRAM table type element.
463          *
464          * This API sets the specified element data by invoking the
465          * firmware.
466          *
467          * [in] tfp
468          *   Pointer to TF handle
469          *
470          * [in] parms
471          *   Pointer to table set parameters
472          *
473          * Returns
474          *   - (0) if successful.
475          *   - (-EINVAL) on failure.
476          */
477         int (*tf_dev_set_sram_tbl)(struct tf *tfp,
478                                    struct tf_tbl_set_parms *parms);
479
480         /**
481          * Retrieves the specified table type element.
482          *
483          * This API retrieves the specified element data by invoking the
484          * firmware.
485          *
486          * [in] tfp
487          *   Pointer to TF handle
488          *
489          * [in] parms
490          *   Pointer to table get parameters
491          *
492          * Returns
493          *   - (0) if successful.
494          *   - (-EINVAL) on failure.
495          */
496         int (*tf_dev_get_tbl)(struct tf *tfp,
497                               struct tf_tbl_get_parms *parms);
498
499         /**
500          * Retrieves the specified SRAM table type element.
501          *
502          * This API retrieves the specified element data by invoking the
503          * firmware.
504          *
505          * [in] tfp
506          *   Pointer to TF handle
507          *
508          * [in] parms
509          *   Pointer to table get parameters
510          *
511          * Returns
512          *   - (0) if successful.
513          *   - (-EINVAL) on failure.
514          */
515         int (*tf_dev_get_sram_tbl)(struct tf *tfp,
516                                    struct tf_tbl_get_parms *parms);
517
518         /**
519          * Retrieves the specified table type element using 'bulk'
520          * mechanism.
521          *
522          * This API retrieves the specified element data by invoking the
523          * firmware.
524          *
525          * [in] tfp
526          *   Pointer to TF handle
527          *
528          * [in] parms
529          *   Pointer to table get bulk parameters
530          *
531          * Returns
532          *   - (0) if successful.
533          *   - (-EINVAL) on failure.
534          */
535         int (*tf_dev_get_bulk_tbl)(struct tf *tfp,
536                                    struct tf_tbl_get_bulk_parms *parms);
537
538         /**
539          * Retrieves the specified SRAM table type element using 'bulk'
540          * mechanism.
541          *
542          * This API retrieves the specified element data by invoking the
543          * firmware.
544          *
545          * [in] tfp
546          *   Pointer to TF handle
547          *
548          * [in] parms
549          *   Pointer to table get bulk parameters
550          *
551          * Returns
552          *   - (0) if successful.
553          *   - (-EINVAL) on failure.
554          */
555         int (*tf_dev_get_bulk_sram_tbl)(struct tf *tfp,
556                                         struct tf_tbl_get_bulk_parms *parms);
557
558         /**
559          * Gets the increment value to add to the shared session resource
560          * start offset by for each count in the "stride"
561          *
562          * [in] tfp
563          *   Pointer to TF handle
564          *
565          * [in] parms
566          *   Pointer to get shared tbl increment parameters
567          *
568          * Returns
569          *   - (0) if successful.
570          *   - (-EINVAL) on failure.
571          */
572         int (*tf_dev_get_shared_tbl_increment)(struct tf *tfp,
573                                 struct tf_get_shared_tbl_increment_parms *parms);
574
575         /**
576          * Retrieves the table resource info.
577          *
578          * This API retrieves the table resource info from the rm db.
579          *
580          * [in] tfp
581          *   Pointer to TF handle
582          *
583          * [in] parms
584          *   Pointer to tbl info
585          *
586          * Returns
587          *   - (0) if successful.
588          *   - (-EINVAL) on failure.
589          */
590         int (*tf_dev_get_tbl_resc_info)(struct tf *tfp,
591                                          struct tf_tbl_resource_info *parms);
592
593         /**
594          * Allocation of a tcam element.
595          *
596          * This API allocates the specified tcam element from a device
597          * specific tcam DB. The allocated element is returned.
598          *
599          * [in] tfp
600          *   Pointer to TF handle
601          *
602          * [in] parms
603          *   Pointer to tcam allocation parameters
604          *
605          * Returns
606          *   - (0) if successful.
607          *   - (-EINVAL) on failure.
608          */
609         int (*tf_dev_alloc_tcam)(struct tf *tfp,
610                                  struct tf_tcam_alloc_parms *parms);
611
612         /**
613          * Free of a tcam element.
614          *
615          * This API free's a previous allocated tcam element from a
616          * device specific tcam DB.
617          *
618          * [in] tfp
619          *   Pointer to TF handle
620          *
621          * [in] parms
622          *   Pointer to tcam free parameters
623          *
624          * Returns
625          *   - (0) if successful.
626          *   - (-EINVAL) on failure.
627          */
628         int (*tf_dev_free_tcam)(struct tf *tfp,
629                                 struct tf_tcam_free_parms *parms);
630
631         /**
632          * Searches for the specified tcam element in a shadow DB.
633          *
634          * This API searches for the specified tcam element in a
635          * device specific shadow DB. If the element is found the
636          * reference count for the element is updated. If the element
637          * is not found a new element is allocated from the tcam DB
638          * and then inserted into the shadow DB.
639          *
640          * [in] tfp
641          *   Pointer to TF handle
642          *
643          * [in] parms
644          *   Pointer to tcam allocation and search parameters
645          *
646          * Returns
647          *   - (0) if successful.
648          *   - (-EINVAL) on failure.
649          */
650         int (*tf_dev_alloc_search_tcam)
651                         (struct tf *tfp,
652                         struct tf_tcam_alloc_search_parms *parms);
653
654         /**
655          * Sets the specified tcam element.
656          *
657          * This API sets the specified element data by invoking the
658          * firmware.
659          *
660          * [in] tfp
661          *   Pointer to TF handle
662          *
663          * [in] parms
664          *   Pointer to tcam set parameters
665          *
666          * Returns
667          *   - (0) if successful.
668          *   - (-EINVAL) on failure.
669          */
670         int (*tf_dev_set_tcam)(struct tf *tfp,
671                                struct tf_tcam_set_parms *parms);
672
673         /**
674          * Retrieves the specified tcam element.
675          *
676          * This API retrieves the specified element data by invoking the
677          * firmware.
678          *
679          * [in] tfp
680          *   Pointer to TF handle
681          *
682          * [in] parms
683          *   Pointer to tcam get parameters
684          *
685          * Returns
686          *   - (0) if successful.
687          *   - (-EINVAL) on failure.
688          */
689         int (*tf_dev_get_tcam)(struct tf *tfp,
690                                struct tf_tcam_get_parms *parms);
691
692 #ifdef TF_TCAM_SHARED
693         /**
694          * Move TCAM shared entries
695          *
696          * [in] tfp
697          *   Pointer to TF handle
698          *
699          * [in] parms
700          *   Pointer to parameters
701          *
702          *    returns:
703          *    0       - Success
704          *    -EINVAL - Error
705          */
706         int (*tf_dev_move_tcam)(struct tf *tfp,
707                                struct tf_move_tcam_shared_entries_parms *parms);
708
709         /**
710          * Move TCAM shared entries
711          *
712          * [in] tfp
713          *   Pointer to TF handle
714          *
715          * [in] parms
716          *   Pointer to parameters
717          *
718          *    returns:
719          *    0       - Success
720          *    -EINVAL - Error
721          */
722         int (*tf_dev_clear_tcam)(struct tf *tfp,
723                               struct tf_clear_tcam_shared_entries_parms *parms);
724
725 #endif /* TF_TCAM_SHARED */
726
727         /**
728          * Retrieves the tcam resource info.
729          *
730          * This API retrieves the tcam resource info from the rm db.
731          *
732          * [in] tfp
733          *   Pointer to TF handle
734          *
735          * [in] parms
736          *   Pointer to tcam info
737          *
738          * Returns
739          *   - (0) if successful.
740          *   - (-EINVAL) on failure.
741          */
742         int (*tf_dev_get_tcam_resc_info)(struct tf *tfp,
743                                          struct tf_tcam_resource_info *parms);
744
745         /**
746          * Insert EM hash entry API
747          *
748          * [in] tfp
749          *   Pointer to TF handle
750          *
751          * [in] parms
752          *   Pointer to E/EM insert parameters
753          *
754          *  Returns:
755          *    0       - Success
756          *    -EINVAL - Error
757          */
758         int (*tf_dev_insert_int_em_entry)(struct tf *tfp,
759                                           struct tf_insert_em_entry_parms *parms);
760
761         /**
762          * Delete EM hash entry API
763          *
764          * [in] tfp
765          *   Pointer to TF handle
766          *
767          * [in] parms
768          *   Pointer to E/EM delete parameters
769          *
770          *    returns:
771          *    0       - Success
772          *    -EINVAL - Error
773          */
774         int (*tf_dev_delete_int_em_entry)(struct tf *tfp,
775                                           struct tf_delete_em_entry_parms *parms);
776
777         /**
778          * Move EM hash entry API
779          *
780          * [in] tfp
781          *   Pointer to TF handle
782          *
783          * [in] parms
784          *   Pointer to E/EM move parameters
785          *
786          *    returns:
787          *    0       - Success
788          *    -EINVAL - Error
789          */
790         int (*tf_dev_move_int_em_entry)(struct tf *tfp,
791                                         struct tf_move_em_entry_parms *parms);
792
793         /**
794          * Insert EEM hash entry API
795          *
796          * [in] tfp
797          *   Pointer to TF handle
798          *
799          * [in] parms
800          *   Pointer to E/EM insert parameters
801          *
802          *  Returns:
803          *    0       - Success
804          *    -EINVAL - Error
805          */
806         int (*tf_dev_insert_ext_em_entry)(struct tf *tfp,
807                                           struct tf_insert_em_entry_parms *parms);
808
809         /**
810          * Delete EEM hash entry API
811          *
812          * [in] tfp
813          *   Pointer to TF handle
814          *
815          * [in] parms
816          *   Pointer to E/EM delete parameters
817          *
818          *    returns:
819          *    0       - Success
820          *    -EINVAL - Error
821          */
822         int (*tf_dev_delete_ext_em_entry)(struct tf *tfp,
823                                           struct tf_delete_em_entry_parms *parms);
824
825         /**
826          * Retrieves the em resource info.
827          *
828          * This API retrieves the em resource info from the rm db.
829          *
830          * [in] tfp
831          *   Pointer to TF handle
832          *
833          * [in] parms
834          *   Pointer to em info
835          *
836          * Returns
837          *   - (0) if successful.
838          *   - (-EINVAL) on failure.
839          */
840         int (*tf_dev_get_em_resc_info)(struct tf *tfp,
841                                        struct tf_em_resource_info *parms);
842
843         /**
844          * Move EEM hash entry API
845          *
846          *   Pointer to E/EM move parameters
847          *
848          * [in] tfp
849          *   Pointer to TF handle
850          *
851          * [in] parms
852          *   Pointer to em info
853          *
854          *    returns:
855          *    0       - Success
856          *    -EINVAL - Error
857          */
858         int (*tf_dev_move_ext_em_entry)(struct tf *tfp,
859                                         struct tf_move_em_entry_parms *parms);
860
861         /**
862          * Allocate EEM table scope
863          *
864          * [in] tfp
865          *   Pointer to TF handle
866          *
867          * [in] parms
868          *   Pointer to table scope alloc parameters
869          *
870          *    returns:
871          *    0       - Success
872          *    -EINVAL - Error
873          */
874         int (*tf_dev_alloc_tbl_scope)(struct tf *tfp,
875                                       struct tf_alloc_tbl_scope_parms *parms);
876         /**
877          * Map EEM parif
878          *
879          * [in] tfp
880          *   Pointer to TF handle
881          *
882          * [in] pf
883          * PF associated with the table scope
884          *
885          * [in] parif_bitmask
886          * Bitmask of PARIFs to enable
887          *
888          * [in/out] pointer to the parif_2_pf data to be updated
889          *
890          * [in/out] pointer to the parif_2_pf mask to be updated
891          *
892          * [in] sz_in_bytes - number of bytes to be written
893          *
894          *    returns:
895          *    0       - Success
896          *    -EINVAL - Error
897          */
898         int (*tf_dev_map_parif)(struct tf *tfp,
899                                 uint16_t parif_bitmask,
900                                 uint16_t pf,
901                                 uint8_t *data,
902                                 uint8_t *mask,
903                                 uint16_t sz_in_bytes);
904         /**
905          * Map EEM table scope
906          *
907          * [in] tfp
908          *   Pointer to TF handle
909          *
910          * [in] parms
911          *   Pointer to table scope map parameters
912          *
913          *    returns:
914          *    0       - Success
915          *    -EINVAL - Error
916          */
917         int (*tf_dev_map_tbl_scope)(struct tf *tfp,
918                                     struct tf_map_tbl_scope_parms *parms);
919
920         /**
921          * Free EEM table scope
922          *
923          * [in] tfp
924          *   Pointer to TF handle
925          *
926          * [in] parms
927          *   Pointer to table scope free parameters
928          *
929          *    returns:
930          *    0       - Success
931          *    -EINVAL - Error
932          */
933         int (*tf_dev_free_tbl_scope)(struct tf *tfp,
934                                      struct tf_free_tbl_scope_parms *parms);
935
936         /**
937          * Sets the specified interface table type element.
938          *
939          * This API sets the specified element data by invoking the
940          * firmware.
941          *
942          * [in] tfp
943          *   Pointer to TF handle
944          *
945          * [in] parms
946          *   Pointer to interface table set parameters
947          *
948          * Returns
949          *   - (0) if successful.
950          *   - (-EINVAL) on failure.
951          */
952         int (*tf_dev_set_if_tbl)(struct tf *tfp,
953                                  struct tf_if_tbl_set_parms *parms);
954
955         /**
956          * Retrieves the specified interface table type element.
957          *
958          * This API retrieves the specified element data by invoking the
959          * firmware.
960          *
961          * [in] tfp
962          *   Pointer to TF handle
963          *
964          * [in] parms
965          *   Pointer to table get parameters
966          *
967          * Returns
968          *   - (0) if successful.
969          *   - (-EINVAL) on failure.
970          */
971         int (*tf_dev_get_if_tbl)(struct tf *tfp,
972                                  struct tf_if_tbl_get_parms *parms);
973
974         /**
975          * Update global cfg
976          *
977          * [in] tfp
978          *   Pointer to TF handle
979          *
980          * [in] parms
981          *   Pointer to global cfg parameters
982          *
983          *    returns:
984          *    0       - Success
985          *    -EINVAL - Error
986          */
987         int (*tf_dev_set_global_cfg)(struct tf *tfp,
988                                      struct tf_global_cfg_parms *parms);
989
990         /**
991          * Get global cfg
992          *
993          * [in] tfp
994          *   Pointer to TF handle
995          *
996          * [in] parms
997          *   Pointer to global cfg parameters
998          *
999          *    returns:
1000          *    0       - Success
1001          *    -EINVAL - Error
1002          */
1003         int (*tf_dev_get_global_cfg)(struct tf *tfp,
1004                                      struct tf_global_cfg_parms *parms);
1005
1006         /**
1007          * Get mailbox
1008          *
1009          *    returns:
1010          *      mailbox
1011          */
1012         int (*tf_dev_get_mailbox)(void);
1013
1014         /**
1015          * Convert length in bit to length in byte and align to word.
1016          * The word length depends on device type.
1017          *
1018          * [in] size
1019          *   Size in bit
1020          *
1021          * Returns
1022          *   Size in byte
1023          */
1024         int (*tf_dev_word_align)(uint16_t size);
1025
1026         /**
1027          * Hash key using crc32 and lookup3
1028          *
1029          * [in] key_data
1030          *   Pointer to key
1031          *
1032          * [in] bitlen
1033          *   Number of key bits
1034          *
1035          * Returns
1036          *   Hashes
1037          */
1038         uint64_t (*tf_dev_cfa_key_hash)(uint64_t *key_data,
1039                                           uint16_t bitlen);
1040 };
1041
1042 /**
1043  * Supported device operation structures
1044  */
1045 extern const struct tf_dev_ops tf_dev_ops_p4_init;
1046 extern const struct tf_dev_ops tf_dev_ops_p4;
1047 extern const struct tf_dev_ops tf_dev_ops_p58_init;
1048 extern const struct tf_dev_ops tf_dev_ops_p58;
1049
1050 #endif /* _TF_DEVICE_H_ */