]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2019-2020 Broadcom | |
3 | * All rights reserved. | |
4 | */ | |
5 | ||
6 | #ifndef _TF_EM_H_ | |
7 | #define _TF_EM_H_ | |
8 | ||
9 | #include "tf_core.h" | |
10 | #include "tf_session.h" | |
11 | ||
12 | #define TF_HW_EM_KEY_MAX_SIZE 52 | |
13 | #define TF_EM_KEY_RECORD_SIZE 64 | |
14 | ||
15 | /** EEM Entry header | |
16 | * | |
17 | */ | |
18 | struct tf_eem_entry_hdr { | |
19 | uint32_t pointer; | |
20 | uint32_t word1; /* | |
21 | * The header is made up of two words, | |
22 | * this is the first word. This field has multiple | |
23 | * subfields, there is no suitable single name for | |
24 | * it so just going with word1. | |
25 | */ | |
26 | #define TF_LKUP_RECORD_VALID_SHIFT 31 | |
27 | #define TF_LKUP_RECORD_VALID_MASK 0x80000000 | |
28 | #define TF_LKUP_RECORD_L1_CACHEABLE_SHIFT 30 | |
29 | #define TF_LKUP_RECORD_L1_CACHEABLE_MASK 0x40000000 | |
30 | #define TF_LKUP_RECORD_STRENGTH_SHIFT 28 | |
31 | #define TF_LKUP_RECORD_STRENGTH_MASK 0x30000000 | |
32 | #define TF_LKUP_RECORD_RESERVED_SHIFT 17 | |
33 | #define TF_LKUP_RECORD_RESERVED_MASK 0x0FFE0000 | |
34 | #define TF_LKUP_RECORD_KEY_SIZE_SHIFT 8 | |
35 | #define TF_LKUP_RECORD_KEY_SIZE_MASK 0x0001FF00 | |
36 | #define TF_LKUP_RECORD_ACT_REC_SIZE_SHIFT 3 | |
37 | #define TF_LKUP_RECORD_ACT_REC_SIZE_MASK 0x000000F8 | |
38 | #define TF_LKUP_RECORD_ACT_REC_INT_SHIFT 2 | |
39 | #define TF_LKUP_RECORD_ACT_REC_INT_MASK 0x00000004 | |
40 | #define TF_LKUP_RECORD_EXT_FLOW_CTR_SHIFT 1 | |
41 | #define TF_LKUP_RECORD_EXT_FLOW_CTR_MASK 0x00000002 | |
42 | #define TF_LKUP_RECORD_ACT_PTR_MSB_SHIFT 0 | |
43 | #define TF_LKUP_RECORD_ACT_PTR_MSB_MASK 0x00000001 | |
44 | }; | |
45 | ||
46 | /** EEM Entry | |
47 | * Each EEM entry is 512-bit (64-bytes) | |
48 | */ | |
49 | struct tf_eem_64b_entry { | |
50 | /** Key is 448 bits - 56 bytes */ | |
51 | uint8_t key[TF_EM_KEY_RECORD_SIZE - sizeof(struct tf_eem_entry_hdr)]; | |
52 | /** Header is 8 bytes long */ | |
53 | struct tf_eem_entry_hdr hdr; | |
54 | }; | |
55 | ||
56 | /** | |
57 | * Allocates EEM Table scope | |
58 | * | |
59 | * [in] tfp | |
60 | * Pointer to TruFlow handle | |
61 | * | |
62 | * [in] parms | |
63 | * Pointer to input parameters | |
64 | * | |
65 | * Returns: | |
66 | * 0 - Success | |
67 | * -EINVAL - Parameter error | |
68 | * -ENOMEM - Out of memory | |
69 | */ | |
70 | int tf_alloc_eem_tbl_scope(struct tf *tfp, | |
71 | struct tf_alloc_tbl_scope_parms *parms); | |
72 | ||
73 | /** | |
74 | * Free's EEM Table scope control block | |
75 | * | |
76 | * [in] tfp | |
77 | * Pointer to TruFlow handle | |
78 | * | |
79 | * [in] parms | |
80 | * Pointer to input parameters | |
81 | * | |
82 | * Returns: | |
83 | * 0 - Success | |
84 | * -EINVAL - Parameter error | |
85 | */ | |
86 | int tf_free_eem_tbl_scope_cb(struct tf *tfp, | |
87 | struct tf_free_tbl_scope_parms *parms); | |
88 | ||
89 | /** | |
90 | * Function to search for table scope control block structure | |
91 | * with specified table scope ID. | |
92 | * | |
93 | * [in] session | |
94 | * Session to use for the search of the table scope control block | |
95 | * [in] tbl_scope_id | |
96 | * Table scope ID to search for | |
97 | * | |
98 | * Returns: | |
99 | * Pointer to the found table scope control block struct or NULL if | |
100 | * table scope control block struct not found | |
101 | */ | |
102 | struct tf_tbl_scope_cb *tbl_scope_cb_find(struct tf_session *session, | |
103 | uint32_t tbl_scope_id); | |
104 | ||
105 | int tf_insert_eem_entry(struct tf_session *session, | |
106 | struct tf_tbl_scope_cb *tbl_scope_cb, | |
107 | struct tf_insert_em_entry_parms *parms); | |
108 | ||
109 | int tf_delete_eem_entry(struct tf *tfp, | |
110 | struct tf_delete_em_entry_parms *parms); | |
111 | ||
112 | void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb, | |
113 | enum tf_dir dir, | |
114 | uint32_t offset, | |
115 | enum tf_em_table_type table_type); | |
116 | ||
117 | #endif /* _TF_EM_H_ */ |