1 /* Copyright (c) 2008-2012 Freescale Semiconductor, Inc
2  * All rights reserved.
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 Freescale Semiconductor nor the
12  *       names of its 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 Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 
34 /**************************************************************************//**
35  @File          fm_ext.h
36 
37  @Description   FM Application Programming Interface.
38 *//***************************************************************************/
39 #ifndef __FM_EXT
40 #define __FM_EXT
41 
42 #include "error_ext.h"
43 #include "std_ext.h"
44 #include "dpaa_ext.h"
45 #include "fsl_fman_sp.h"
46 
47 /**************************************************************************//**
48  @Group         FM_grp Frame Manager API
49 
50  @Description   FM API functions, definitions and enums.
51 
52  @{
53 *//***************************************************************************/
54 
55 /**************************************************************************//**
56  @Group         FM_lib_grp FM library
57 
58  @Description   FM API functions, definitions and enums.
59 
60                 The FM module is the main driver module and is a mandatory module
61                 for FM driver users. This module must be initialized first prior
62                 to any other drivers modules.
63                 The FM is a "singleton" module. It is responsible of the common
64                 HW modules: FPM, DMA, common QMI and common BMI initializations and
65                 run-time control routines. This module must be initialized always
66                 when working with any of the FM modules.
67                 NOTE - We assume that the FM library will be initialized only by core No. 0!
68 
69  @{
70 *//***************************************************************************/
71 
72 /**************************************************************************//**
73  @Description   Enum for defining port types
74 *//***************************************************************************/
75 typedef enum e_FmPortType {
76     e_FM_PORT_TYPE_OH_OFFLINE_PARSING = 0,  /**< Offline parsing port */
77     e_FM_PORT_TYPE_RX,                      /**< 1G Rx port */
78     e_FM_PORT_TYPE_RX_10G,                  /**< 10G Rx port */
79     e_FM_PORT_TYPE_TX,                      /**< 1G Tx port */
80     e_FM_PORT_TYPE_TX_10G,                  /**< 10G Tx port */
81     e_FM_PORT_TYPE_DUMMY
82 } e_FmPortType;
83 
84 /**************************************************************************//**
85  @Collection    General FM defines
86 *//***************************************************************************/
87 #define FM_MAX_NUM_OF_PARTITIONS    64      /**< Maximum number of partitions */
88 #define FM_PHYS_ADDRESS_SIZE        6       /**< FM Physical address size */
89 /* @} */
90 
91 
92 #if defined(__MWERKS__) && !defined(__GNUC__)
93 #pragma pack(push,1)
94 #endif /* defined(__MWERKS__) && ... */
95 
96 /**************************************************************************//**
97  @Description   FM physical Address
98 *//***************************************************************************/
99 typedef _Packed struct t_FmPhysAddr {
100     volatile uint8_t    high;         /**< High part of the physical address */
101     volatile uint32_t   low;          /**< Low part of the physical address */
102 } _PackedType t_FmPhysAddr;
103 
104 /**************************************************************************//**
105  @Description   Parse results memory layout
106 *//***************************************************************************/
107 typedef _Packed struct t_FmPrsResult {
108     volatile uint8_t     lpid;               /**< Logical port id */
109     volatile uint8_t     shimr;              /**< Shim header result  */
110     volatile uint16_t    l2r;                /**< Layer 2 result */
111     volatile uint16_t    l3r;                /**< Layer 3 result */
112     volatile uint8_t     l4r;                /**< Layer 4 result */
113     volatile uint8_t     cplan;              /**< Classification plan id */
114     volatile uint16_t    nxthdr;             /**< Next Header  */
115     volatile uint16_t    cksum;              /**< Running-sum */
116     volatile uint16_t    flags_frag_off;     /**< Flags & fragment-offset field of the last IP-header */
117     volatile uint8_t     route_type;         /**< Routing type field of a IPv6 routing extension header */
118     volatile uint8_t     rhp_ip_valid;       /**< Routing Extension Header Present; last bit is IP valid */
119     volatile uint8_t     shim_off[2];        /**< Shim offset */
120     volatile uint8_t     ip_pid_off;         /**< IP PID (last IP-proto) offset */
121     volatile uint8_t     eth_off;            /**< ETH offset */
122     volatile uint8_t     llc_snap_off;       /**< LLC_SNAP offset */
123     volatile uint8_t     vlan_off[2];        /**< VLAN offset */
124     volatile uint8_t     etype_off;          /**< ETYPE offset */
125     volatile uint8_t     pppoe_off;          /**< PPP offset */
126     volatile uint8_t     mpls_off[2];        /**< MPLS offset */
127     volatile uint8_t     ip_off[2];          /**< IP offset */
128     volatile uint8_t     gre_off;            /**< GRE offset */
129     volatile uint8_t     l4_off;             /**< Layer 4 offset */
130     volatile uint8_t     nxthdr_off;         /**< Parser end point */
131 } _PackedType t_FmPrsResult;
132 
133 /**************************************************************************//**
134  @Collection   FM Parser results
135 *//***************************************************************************/
136 #define FM_PR_L2_VLAN_STACK         0x00000100  /**< Parse Result: VLAN stack */
137 #define FM_PR_L2_ETHERNET           0x00008000  /**< Parse Result: Ethernet*/
138 #define FM_PR_L2_VLAN               0x00004000  /**< Parse Result: VLAN */
139 #define FM_PR_L2_LLC_SNAP           0x00002000  /**< Parse Result: LLC_SNAP */
140 #define FM_PR_L2_MPLS               0x00001000  /**< Parse Result: MPLS */
141 #define FM_PR_L2_PPPoE              0x00000800  /**< Parse Result: PPPoE */
142 /* @} */
143 
144 /**************************************************************************//**
145  @Collection   FM Frame descriptor macros
146 *//***************************************************************************/
147 #define FM_FD_CMD_FCO                   0x80000000  /**< Frame queue Context Override */
148 #define FM_FD_CMD_RPD                   0x40000000  /**< Read Prepended Data */
149 #define FM_FD_CMD_UPD                   0x20000000  /**< Update Prepended Data */
150 #define FM_FD_CMD_DTC                   0x10000000  /**< Do L4 Checksum */
151 #define FM_FD_CMD_DCL4C                 0x10000000  /**< Didn't calculate L4 Checksum */
152 #define FM_FD_CMD_CFQ                   0x00ffffff  /**< Confirmation Frame Queue */
153 
154 #define FM_FD_ERR_UNSUPPORTED_FORMAT    0x04000000  /**< Not for Rx-Port! Unsupported Format */
155 #define FM_FD_ERR_LENGTH                0x02000000  /**< Not for Rx-Port! Length Error */
156 #define FM_FD_ERR_DMA                   0x01000000  /**< DMA Data error */
157 
158 #define FM_FD_IPR                       0x00000001  /**< IPR frame (not error) */
159 
160 #define FM_FD_ERR_IPR_NCSP              (0x00100000 | FM_FD_IPR)    /**< IPR non-consistent-sp */
161 #define FM_FD_ERR_IPR                   (0x00200000 | FM_FD_IPR)    /**< IPR error */
162 #define FM_FD_ERR_IPR_TO                (0x00300000 | FM_FD_IPR)    /**< IPR timeout */
163 
164 #ifdef FM_CAPWAP_SUPPORT
165 #define FM_FD_ERR_CRE                   0x00200000
166 #define FM_FD_ERR_CHE                   0x00100000
167 #endif /* FM_CAPWAP_SUPPORT */
168 
169 #define FM_FD_ERR_PHYSICAL              0x00080000  /**< Rx FIFO overflow, FCS error, code error, running disparity
170                                                          error (SGMII and TBI modes), FIFO parity error. PHY
171                                                          Sequence error, PHY error control character detected. */
172 #define FM_FD_ERR_SIZE                  0x00040000  /**< Frame too long OR Frame size exceeds max_length_frame  */
173 #define FM_FD_ERR_CLS_DISCARD           0x00020000  /**< classification discard */
174 #define FM_FD_ERR_EXTRACTION            0x00008000  /**< Extract Out of Frame */
175 #define FM_FD_ERR_NO_SCHEME             0x00004000  /**< No Scheme Selected */
176 #define FM_FD_ERR_KEYSIZE_OVERFLOW      0x00002000  /**< Keysize Overflow */
177 #define FM_FD_ERR_COLOR_RED             0x00000800  /**< Frame color is red */
178 #define FM_FD_ERR_COLOR_YELLOW          0x00000400  /**< Frame color is yellow */
179 #define FM_FD_ERR_ILL_PLCR              0x00000200  /**< Illegal Policer Profile selected */
180 #define FM_FD_ERR_PLCR_FRAME_LEN        0x00000100  /**< Policer frame length error */
181 #define FM_FD_ERR_PRS_TIMEOUT           0x00000080  /**< Parser Time out Exceed */
182 #define FM_FD_ERR_PRS_ILL_INSTRUCT      0x00000040  /**< Invalid Soft Parser instruction */
183 #define FM_FD_ERR_PRS_HDR_ERR           0x00000020  /**< Header error was identified during parsing */
184 #define FM_FD_ERR_BLOCK_LIMIT_EXCEEDED  0x00000008  /**< Frame parsed beyind 256 first bytes */
185 
186 #define FM_FD_TX_STATUS_ERR_MASK        (FM_FD_ERR_UNSUPPORTED_FORMAT   | \
187                                          FM_FD_ERR_LENGTH               | \
188                                          FM_FD_ERR_DMA) /**< TX Error FD bits */
189 
190 #define FM_FD_RX_STATUS_ERR_MASK        (FM_FD_ERR_UNSUPPORTED_FORMAT   | \
191                                          FM_FD_ERR_LENGTH               | \
192                                          FM_FD_ERR_DMA                  | \
193                                          FM_FD_ERR_IPR                  | \
194                                          FM_FD_ERR_IPR_TO               | \
195                                          FM_FD_ERR_IPR_NCSP             | \
196                                          FM_FD_ERR_PHYSICAL             | \
197                                          FM_FD_ERR_SIZE                 | \
198                                          FM_FD_ERR_CLS_DISCARD          | \
199                                          FM_FD_ERR_COLOR_RED            | \
200                                          FM_FD_ERR_COLOR_YELLOW         | \
201                                          FM_FD_ERR_ILL_PLCR             | \
202                                          FM_FD_ERR_PLCR_FRAME_LEN       | \
203                                          FM_FD_ERR_EXTRACTION           | \
204                                          FM_FD_ERR_NO_SCHEME            | \
205                                          FM_FD_ERR_KEYSIZE_OVERFLOW     | \
206                                          FM_FD_ERR_PRS_TIMEOUT          | \
207                                          FM_FD_ERR_PRS_ILL_INSTRUCT     | \
208                                          FM_FD_ERR_PRS_HDR_ERR          | \
209                                          FM_FD_ERR_BLOCK_LIMIT_EXCEEDED) /**< RX Error FD bits */
210 
211 #define FM_FD_RX_STATUS_ERR_NON_FM      0x00400000  /**< non Frame-Manager error */
212 /* @} */
213 
214 /**************************************************************************//**
215  @Description   Context A
216 *//***************************************************************************/
217 typedef _Packed struct t_FmContextA {
218     volatile uint32_t    command;   /**< ContextA Command */
219     volatile uint8_t     res0[4];   /**< ContextA Reserved bits */
220 } _PackedType t_FmContextA;
221 
222 /**************************************************************************//**
223  @Description   Context B
224 *//***************************************************************************/
225 typedef uint32_t t_FmContextB;
226 
227 /**************************************************************************//**
228  @Collection   Special Operation options
229 *//***************************************************************************/
230 typedef uint32_t fmSpecialOperations_t;                 /**< typedef for defining Special Operation options */
231 
232 #define  FM_SP_OP_IPSEC                     0x80000000  /**< activate features that related to IPSec (e.g fix Eth-type) */
233 #define  FM_SP_OP_IPSEC_UPDATE_UDP_LEN      0x40000000  /**< update the UDP-Len after Encryption */
234 #define  FM_SP_OP_IPSEC_MANIP               0x20000000  /**< handle the IPSec-manip options */
235 #define  FM_SP_OP_RPD                       0x10000000  /**< Set the RPD bit */
236 #define  FM_SP_OP_DCL4C                     0x08000000  /**< Set the DCL4C bit */
237 #define  FM_SP_OP_CHECK_SEC_ERRORS          0x04000000  /**< Check SEC errors */
238 #define  FM_SP_OP_CLEAR_RPD                 0x02000000  /**< Clear the RPD bit */
239 #define  FM_SP_OP_CAPWAP_DTLS_ENC           0x01000000  /**< activate features that related to CAPWAP-DTLS post Encryption */
240 #define  FM_SP_OP_CAPWAP_DTLS_DEC           0x00800000  /**< activate features that related to CAPWAP-DTLS post Decryption */
241 #define  FM_SP_OP_IPSEC_NO_ETH_HDR          0x00400000  /**< activate features that related to IPSec without Eth hdr */
242 /* @} */
243 
244 /**************************************************************************//**
245  @Collection   Context A macros
246 *//***************************************************************************/
247 #define FM_CONTEXTA_OVERRIDE_MASK       0x80000000
248 #define FM_CONTEXTA_ICMD_MASK           0x40000000
249 #define FM_CONTEXTA_A1_VALID_MASK       0x20000000
250 #define FM_CONTEXTA_MACCMD_MASK         0x00ff0000
251 #define FM_CONTEXTA_MACCMD_VALID_MASK   0x00800000
252 #define FM_CONTEXTA_MACCMD_SECURED_MASK 0x00100000
253 #define FM_CONTEXTA_MACCMD_SC_MASK      0x000f0000
254 #define FM_CONTEXTA_A1_MASK             0x0000ffff
255 
256 #define FM_CONTEXTA_GET_OVERRIDE(contextA)                 ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_OVERRIDE_MASK) >> (31-0))
257 #define FM_CONTEXTA_GET_ICMD(contextA)                     ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_ICMD_MASK) >> (31-1))
258 #define FM_CONTEXTA_GET_A1_VALID(contextA)                 ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_A1_VALID_MASK) >> (31-2))
259 #define FM_CONTEXTA_GET_A1(contextA)                       ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_A1_MASK) >> (31-31))
260 #define FM_CONTEXTA_GET_MACCMD(contextA)                   ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_MASK) >> (31-15))
261 #define FM_CONTEXTA_GET_MACCMD_VALID(contextA)             ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_VALID_MASK) >> (31-8))
262 #define FM_CONTEXTA_GET_MACCMD_SECURED(contextA)           ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_SECURED_MASK) >> (31-11))
263 #define FM_CONTEXTA_GET_MACCMD_SECURE_CHANNEL(contextA)    ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_SC_MASK) >> (31-15))
264 
265 #define FM_CONTEXTA_SET_OVERRIDE(contextA,val)              (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_OVERRIDE_MASK) | (((uint32_t)(val) << (31-0)) & FM_CONTEXTA_OVERRIDE_MASK) ))
266 #define FM_CONTEXTA_SET_ICMD(contextA,val)                  (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_ICMD_MASK) | (((val) << (31-1)) & FM_CONTEXTA_ICMD_MASK) ))
267 #define FM_CONTEXTA_SET_A1_VALID(contextA,val)              (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_A1_VALID_MASK) | (((val) << (31-2)) & FM_CONTEXTA_A1_VALID_MASK) ))
268 #define FM_CONTEXTA_SET_A1(contextA,val)                    (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_A1_MASK) | (((val) << (31-31)) & FM_CONTEXTA_A1_MASK) ))
269 #define FM_CONTEXTA_SET_MACCMD(contextA,val)                (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_MASK) | (((val) << (31-15)) & FM_CONTEXTA_MACCMD_MASK) ))
270 #define FM_CONTEXTA_SET_MACCMD_VALID(contextA,val)          (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_VALID_MASK) | (((val) << (31-8)) & FM_CONTEXTA_MACCMD_VALID_MASK) ))
271 #define FM_CONTEXTA_SET_MACCMD_SECURED(contextA,val)        (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_SECURED_MASK) | (((val) << (31-11)) & FM_CONTEXTA_MACCMD_SECURED_MASK) ))
272 #define FM_CONTEXTA_SET_MACCMD_SECURE_CHANNEL(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_SC_MASK) | (((val) << (31-15)) & FM_CONTEXTA_MACCMD_SC_MASK) ))
273 /* @} */
274 
275 /**************************************************************************//**
276  @Collection   Context B macros
277 *//***************************************************************************/
278 #define FM_CONTEXTB_FQID_MASK               0x00ffffff
279 
280 #define FM_CONTEXTB_GET_FQID(contextB)      (*((t_FmContextB *)contextB) & FM_CONTEXTB_FQID_MASK)
281 #define FM_CONTEXTB_SET_FQID(contextB,val)  (*((t_FmContextB *)contextB) = ((*((t_FmContextB *)contextB) & ~FM_CONTEXTB_FQID_MASK) | ((val) & FM_CONTEXTB_FQID_MASK)))
282 /* @} */
283 
284 #if defined(__MWERKS__) && !defined(__GNUC__)
285 #pragma pack(pop)
286 #endif /* defined(__MWERKS__) && ... */
287 
288 
289 /**************************************************************************//**
290  @Description   FM Exceptions
291 *//***************************************************************************/
292 typedef enum e_FmExceptions {
293     e_FM_EX_DMA_BUS_ERROR = 0,          /**< DMA bus error. */
294     e_FM_EX_DMA_READ_ECC,               /**< Read Buffer ECC error (Valid for FM rev < 6)*/
295     e_FM_EX_DMA_SYSTEM_WRITE_ECC,       /**< Write Buffer ECC error on system side (Valid for FM rev < 6)*/
296     e_FM_EX_DMA_FM_WRITE_ECC,           /**< Write Buffer ECC error on FM side (Valid for FM rev < 6)*/
297     e_FM_EX_DMA_SINGLE_PORT_ECC,        /**< Single Port ECC error on FM side (Valid for FM rev > 6)*/
298     e_FM_EX_FPM_STALL_ON_TASKS,         /**< Stall of tasks on FPM */
299     e_FM_EX_FPM_SINGLE_ECC,             /**< Single ECC on FPM. */
300     e_FM_EX_FPM_DOUBLE_ECC,             /**< Double ECC error on FPM ram access */
301     e_FM_EX_QMI_SINGLE_ECC,             /**< Single ECC on QMI. */
302     e_FM_EX_QMI_DOUBLE_ECC,             /**< Double bit ECC occurred on QMI */
303     e_FM_EX_QMI_DEQ_FROM_UNKNOWN_PORTID,/**< Dequeue from unknown port id */
304     e_FM_EX_BMI_LIST_RAM_ECC,           /**< Linked List RAM ECC error */
305     e_FM_EX_BMI_STORAGE_PROFILE_ECC,    /**< Storage Profile ECC Error */
306     e_FM_EX_BMI_STATISTICS_RAM_ECC,     /**< Statistics Count RAM ECC Error Enable */
307     e_FM_EX_BMI_DISPATCH_RAM_ECC,       /**< Dispatch RAM ECC Error Enable */
308     e_FM_EX_IRAM_ECC,                   /**< Double bit ECC occurred on IRAM*/
309     e_FM_EX_MURAM_ECC                   /**< Double bit ECC occurred on MURAM*/
310 } e_FmExceptions;
311 
312 /**************************************************************************//**
313  @Description   Enum for defining port DMA swap mode
314 *//***************************************************************************/
315 typedef enum e_FmDmaSwapOption {
316     e_FM_DMA_NO_SWP = FMAN_DMA_NO_SWP,          /**< No swap, transfer data as is.*/
317     e_FM_DMA_SWP_PPC_LE = FMAN_DMA_SWP_PPC_LE,  /**< The transferred data should be swapped
318                                                 in PowerPc Little Endian mode. */
319     e_FM_DMA_SWP_BE = FMAN_DMA_SWP_BE           /**< The transferred data should be swapped
320                                                 in Big Endian mode */
321 } e_FmDmaSwapOption;
322 
323 /**************************************************************************//**
324  @Description   Enum for defining port DMA cache attributes
325 *//***************************************************************************/
326 typedef enum e_FmDmaCacheOption {
327     e_FM_DMA_NO_STASH = FMAN_DMA_NO_STASH,      /**< Cacheable, no Allocate (No Stashing) */
328     e_FM_DMA_STASH = FMAN_DMA_STASH             /**< Cacheable and Allocate (Stashing on) */
329 } e_FmDmaCacheOption;
330 
331 
332 /**************************************************************************//**
333  @Group         FM_init_grp FM Initialization Unit
334 
335  @Description   FM Initialization Unit
336 
337                 Initialization Flow
338                 Initialization of the FM Module will be carried out by the application
339                 according to the following sequence:
340                 -  Calling the configuration routine with basic parameters.
341                 -  Calling the advance initialization routines to change driver's defaults.
342                 -  Calling the initialization routine.
343 
344  @{
345 *//***************************************************************************/
346 
347 /**************************************************************************//**
348  @Function      t_FmExceptionsCallback
349 
350  @Description   Exceptions user callback routine, will be called upon an
351                 exception passing the exception identification.
352 
353  @Param[in]     h_App      - User's application descriptor.
354  @Param[in]     exception  - The exception.
355 *//***************************************************************************/
356 typedef void (t_FmExceptionsCallback)(t_Handle          h_App,
357                                       e_FmExceptions    exception);
358 
359 
360 /**************************************************************************//**
361  @Function      t_FmBusErrorCallback
362 
363  @Description   Bus error user callback routine, will be called upon a
364                 bus error, passing parameters describing the errors and the owner.
365 
366  @Param[in]     h_App       - User's application descriptor.
367  @Param[in]     portType    - Port type (e_FmPortType)
368  @Param[in]     portId      - Port id - relative to type.
369  @Param[in]     addr        - Address that caused the error
370  @Param[in]     tnum        - Owner of error
371  @Param[in]     liodn       - Logical IO device number
372 *//***************************************************************************/
373 typedef void (t_FmBusErrorCallback) (t_Handle        h_App,
374                                      e_FmPortType    portType,
375                                      uint8_t         portId,
376                                      uint64_t        addr,
377                                      uint8_t         tnum,
378                                      uint16_t        liodn);
379 
380 /**************************************************************************//**
381  @Description   A structure for defining buffer prefix area content.
382 *//***************************************************************************/
383 typedef struct t_FmBufferPrefixContent {
384     uint16_t    privDataSize;       /**< Number of bytes to be left at the beginning
385                                          of the external buffer; Note that the private-area will
386                                          start from the base of the buffer address. */
387     bool        passPrsResult;      /**< TRUE to pass the parse result to/from the FM;
388                                          User may use FM_PORT_GetBufferPrsResult() in order to
389                                          get the parser-result from a buffer. */
390     bool        passTimeStamp;      /**< TRUE to pass the timeStamp to/from the FM
391                                          User may use FM_PORT_GetBufferTimeStamp() in order to
392                                          get the parser-result from a buffer. */
393     bool        passHashResult;     /**< TRUE to pass the KG hash result to/from the FM
394                                          User may use FM_PORT_GetBufferHashResult() in order to
395                                          get the parser-result from a buffer. */
396     bool        passAllOtherPCDInfo;/**< Add all other Internal-Context information:
397                                          AD, hash-result, key, etc. */
398     uint16_t    dataAlign;          /**< 0 to use driver's default alignment [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
399                                          other value for selecting a data alignment (must be a power of 2);
400                                          if write optimization is used, must be >= 16. */
401     uint8_t     manipExtraSpace;    /**< Maximum extra size needed (insertion-size minus removal-size);
402                                          Note that this field impacts the size of the buffer-prefix
403                                          (i.e. it pushes the data offset);
404                                          This field is irrelevant if DPAA_VERSION==10 */
405 } t_FmBufferPrefixContent;
406 
407 /**************************************************************************//**
408  @Description   A structure of information about each of the external
409                 buffer pools used by a port or storage-profile.
410 *//***************************************************************************/
411 typedef struct t_FmExtPoolParams {
412     uint8_t                 id;     /**< External buffer pool id */
413     uint16_t                size;   /**< External buffer pool buffer size */
414 } t_FmExtPoolParams;
415 
416 /**************************************************************************//**
417  @Description   A structure for informing the driver about the external
418                 buffer pools allocated in the BM and used by a port or a
419                 storage-profile.
420 *//***************************************************************************/
421 typedef struct t_FmExtPools {
422     uint8_t                 numOfPoolsUsed;     /**< Number of pools use by this port */
423     t_FmExtPoolParams       extBufPool[FM_PORT_MAX_NUM_OF_EXT_POOLS];
424                                                 /**< Parameters for each port */
425 } t_FmExtPools;
426 
427 /**************************************************************************//**
428  @Description   A structure for defining backup BM Pools.
429 *//***************************************************************************/
430 typedef struct t_FmBackupBmPools {
431     uint8_t     numOfBackupPools;       /**< Number of BM backup pools -
432                                              must be smaller than the total number of
433                                              pools defined for the specified port.*/
434     uint8_t     poolIds[FM_PORT_MAX_NUM_OF_EXT_POOLS];
435                                         /**< numOfBackupPools pool id's, specifying which
436                                              pools should be used only as backup. Pool
437                                              id's specified here must be a subset of the
438                                              pools used by the specified port.*/
439 } t_FmBackupBmPools;
440 
441 /**************************************************************************//**
442  @Description   A structure for defining BM pool depletion criteria
443 *//***************************************************************************/
444 typedef struct t_FmBufPoolDepletion {
445     bool        poolsGrpModeEnable;                 /**< select mode in which pause frames will be sent after
446                                                          a number of pools (all together!) are depleted */
447     uint8_t     numOfPools;                         /**< the number of depleted pools that will invoke
448                                                          pause frames transmission. */
449     bool        poolsToConsider[BM_MAX_NUM_OF_POOLS];
450                                                     /**< For each pool, TRUE if it should be considered for
451                                                          depletion (Note - this pool must be used by this port!). */
452     bool        singlePoolModeEnable;               /**< select mode in which pause frames will be sent after
453                                                          a single-pool is depleted; */
454     bool        poolsToConsiderForSingleMode[BM_MAX_NUM_OF_POOLS];
455                                                     /**< For each pool, TRUE if it should be considered for
456                                                          depletion (Note - this pool must be used by this port!) */
457 #if (DPAA_VERSION >= 11)
458     bool        pfcPrioritiesEn[FM_MAX_NUM_OF_PFC_PRIORITIES];
459                                                     /**< This field is used by the MAC as the Priority Enable Vector in the PFC frame which is transmitted */
460 #endif /* (DPAA_VERSION >= 11) */
461 } t_FmBufPoolDepletion;
462 
463 /**************************************************************************//**
464  @Description   A Structure for defining Ucode patch for loading.
465 *//***************************************************************************/
466 typedef struct t_FmFirmwareParams {
467     uint32_t                size;                   /**< Size of uCode */
468     uint32_t                *p_Code;                /**< A pointer to the uCode */
469 } t_FmFirmwareParams;
470 
471 /**************************************************************************//**
472  @Description   A Structure for defining FM initialization parameters
473 *//***************************************************************************/
474 typedef struct t_FmParams {
475     uint8_t                 fmId;                   /**< Index of the FM */
476     uint8_t                 guestId;                /**< FM Partition Id */
477     uintptr_t               baseAddr;               /**< A pointer to base of memory mapped FM registers (virtual);
478                                                          this field is optional when the FM runs in "guest-mode"
479                                                          (i.e. guestId != NCSW_MASTER_ID); in that case, the driver will
480                                                          use the memory-map instead of calling the IPC where possible;
481                                                          NOTE that this should include ALL common registers of the FM including
482                                                          the PCD registers area (i.e. until the VSP pages - 880KB). */
483     t_Handle                h_FmMuram;              /**< A handle of an initialized MURAM object,
484                                                          to be used by the FM. */
485     uint16_t                fmClkFreq;              /**< In Mhz;
486                                                          Relevant when FM not runs in "guest-mode". */
487     uint16_t                fmMacClkRatio;          /**< FM MAC Clock ratio, for backward comparability:
488                                                                      when fmMacClkRatio = 0, ratio is 2:1
489                                                                      when fmMacClkRatio = 1, ratio is 1:1  */
490     t_FmExceptionsCallback  *f_Exception;           /**< An application callback routine to handle exceptions;
491                                                          Relevant when FM not runs in "guest-mode". */
492     t_FmBusErrorCallback    *f_BusError;            /**< An application callback routine to handle exceptions;
493                                                          Relevant when FM not runs in "guest-mode". */
494     t_Handle                h_App;                  /**< A handle to an application layer object; This handle will
495                                                          be passed by the driver upon calling the above callbacks;
496                                                          Relevant when FM not runs in "guest-mode". */
497     uintptr_t               irq;                    /**< FM interrupt source for normal events;
498                                                          Relevant when FM not runs in "guest-mode". */
499     uintptr_t               errIrq;                 /**< FM interrupt source for errors;
500                                                          Relevant when FM not runs in "guest-mode". */
501     t_FmFirmwareParams      firmware;               /**< The firmware parameters structure;
502                                                          Relevant when FM not runs in "guest-mode". */
503 
504 #if (DPAA_VERSION >= 11)
505     uintptr_t               vspBaseAddr;            /**< A pointer to base of memory mapped FM VSP registers (virtual);
506                                                          i.e. up to 24KB, depending on the specific chip. */
507     uint8_t                 partVSPBase;            /**< The first Virtual-Storage-Profile-id dedicated to this partition.
508                                                          NOTE: this parameter relevant only when working with multiple partitions. */
509     uint8_t                 partNumOfVSPs;          /**< Number of VSPs dedicated to this partition.
510                                                          NOTE: this parameter relevant only when working with multiple partitions. */
511 #endif /* (DPAA_VERSION >= 11) */
512 } t_FmParams;
513 
514 
515 /**************************************************************************//**
516  @Function      FM_Config
517 
518  @Description   Creates the FM module and returns its handle (descriptor).
519                 This descriptor must be passed as first parameter to all other
520                 FM function calls.
521 
522                 No actual initialization or configuration of FM hardware is
523                 done by this routine. All FM parameters get default values that
524                 may be changed by calling one or more of the advance config routines.
525 
526  @Param[in]     p_FmParams  - A pointer to a data structure of mandatory FM parameters
527 
528  @Return        A handle to the FM object, or NULL for Failure.
529 *//***************************************************************************/
530 t_Handle FM_Config(t_FmParams *p_FmParams);
531 
532 /**************************************************************************//**
533  @Function      FM_Init
534 
535  @Description   Initializes the FM module by defining the software structure
536                 and configuring the hardware registers.
537 
538  @Param[in]     h_Fm - FM module descriptor
539 
540  @Return        E_OK on success; Error code otherwise.
541 *//***************************************************************************/
542 t_Error FM_Init(t_Handle h_Fm);
543 
544 /**************************************************************************//**
545  @Function      FM_Free
546 
547  @Description   Frees all resources that were assigned to FM module.
548 
549                 Calling this routine invalidates the descriptor.
550 
551  @Param[in]     h_Fm - FM module descriptor
552 
553  @Return        E_OK on success; Error code otherwise.
554 *//***************************************************************************/
555 t_Error FM_Free(t_Handle h_Fm);
556 
557 
558 /**************************************************************************//**
559  @Group         FM_advanced_init_grp    FM Advanced Configuration Unit
560 
561  @Description   Advanced configuration routines are optional routines that may
562                 be called in order to change the default driver settings.
563 
564                 Note: Advanced configuration routines are not available for guest partition.
565  @{
566 *//***************************************************************************/
567 
568 /**************************************************************************//**
569  @Description   Enum for selecting DMA debug mode
570 *//***************************************************************************/
571 typedef enum e_FmDmaDbgCntMode {
572     e_FM_DMA_DBG_NO_CNT             = 0,    /**< No counting */
573     e_FM_DMA_DBG_CNT_DONE,                  /**< Count DONE commands */
574     e_FM_DMA_DBG_CNT_COMM_Q_EM,             /**< count command queue emergency signals */
575     e_FM_DMA_DBG_CNT_INT_READ_EM,           /**< Count Internal Read buffer emergency signal */
576     e_FM_DMA_DBG_CNT_INT_WRITE_EM,          /**< Count Internal Write buffer emergency signal */
577     e_FM_DMA_DBG_CNT_FPM_WAIT,              /**< Count FPM WAIT signal */
578     e_FM_DMA_DBG_CNT_SIGLE_BIT_ECC,         /**< Single bit ECC errors. */
579     e_FM_DMA_DBG_CNT_RAW_WAR_PROT           /**< Number of times there was a need for RAW & WAR protection. */
580 } e_FmDmaDbgCntMode;
581 
582 /**************************************************************************//**
583  @Description   Enum for selecting DMA Cache Override
584 *//***************************************************************************/
585 typedef enum e_FmDmaCacheOverride {
586     e_FM_DMA_NO_CACHE_OR = 0,               /**< No override of the Cache field */
587     e_FM_DMA_NO_STASH_DATA,                 /**< Data should not be stashed in system level cache */
588     e_FM_DMA_MAY_STASH_DATA,                /**< Data may be stashed in system level cache */
589     e_FM_DMA_STASH_DATA                     /**< Data should be stashed in system level cache */
590 } e_FmDmaCacheOverride;
591 
592 /**************************************************************************//**
593  @Description   Enum for selecting DMA External Bus Priority
594 *//***************************************************************************/
595 typedef enum e_FmDmaExtBusPri {
596     e_FM_DMA_EXT_BUS_NORMAL = 0,            /**< Normal priority */
597     e_FM_DMA_EXT_BUS_EBS,                   /**< AXI extended bus service priority */
598     e_FM_DMA_EXT_BUS_SOS,                   /**< AXI sos priority */
599     e_FM_DMA_EXT_BUS_EBS_AND_SOS            /**< AXI ebs + sos priority */
600 } e_FmDmaExtBusPri;
601 
602 /**************************************************************************//**
603  @Description   Enum for choosing the field that will be output on AID
604 *//***************************************************************************/
605 typedef enum e_FmDmaAidMode {
606     e_FM_DMA_AID_OUT_PORT_ID = 0,           /**< 4 LSB of PORT_ID */
607     e_FM_DMA_AID_OUT_TNUM                   /**< 4 LSB of TNUM */
608 } e_FmDmaAidMode;
609 
610 /**************************************************************************//**
611  @Description   Enum for selecting FPM Catastrophic error behavior
612 *//***************************************************************************/
613 typedef enum e_FmCatastrophicErr {
614     e_FM_CATASTROPHIC_ERR_STALL_PORT = 0,   /**< Port_ID is stalled (only reset can release it) */
615     e_FM_CATASTROPHIC_ERR_STALL_TASK        /**< Only erroneous task is stalled */
616 } e_FmCatastrophicErr;
617 
618 /**************************************************************************//**
619  @Description   Enum for selecting FPM DMA Error behavior
620 *//***************************************************************************/
621 typedef enum e_FmDmaErr {
622     e_FM_DMA_ERR_CATASTROPHIC = 0,          /**< Dma error is treated as a catastrophic
623                                                  error (e_FmCatastrophicErr)*/
624     e_FM_DMA_ERR_REPORT                     /**< Dma error is just reported */
625 } e_FmDmaErr;
626 
627 /**************************************************************************//**
628  @Description   Enum for selecting DMA Emergency level by BMI emergency signal
629 *//***************************************************************************/
630 typedef enum e_FmDmaEmergencyLevel {
631     e_FM_DMA_EM_EBS = 0,                    /**< EBS emergency */
632     e_FM_DMA_EM_SOS                         /**< SOS emergency */
633 } e_FmDmaEmergencyLevel;
634 
635 /**************************************************************************//**
636  @Collection   Enum for selecting DMA Emergency options
637 *//***************************************************************************/
638 typedef uint32_t fmEmergencyBus_t;          /**< DMA emergency options */
639 
640 #define  FM_DMA_MURAM_READ_EMERGENCY        0x00800000    /**< Enable emergency for MURAM1 */
641 #define  FM_DMA_MURAM_WRITE_EMERGENCY       0x00400000    /**< Enable emergency for MURAM2 */
642 #define  FM_DMA_EXT_BUS_EMERGENCY           0x00100000    /**< Enable emergency for external bus */
643 /* @} */
644 
645 /**************************************************************************//**
646  @Description   A structure for defining DMA emergency level
647 *//***************************************************************************/
648 typedef struct t_FmDmaEmergency {
649     fmEmergencyBus_t        emergencyBusSelect;             /**< An OR of the busses where emergency
650                                                                  should be enabled */
651     e_FmDmaEmergencyLevel   emergencyLevel;                 /**< EBS/SOS */
652 } t_FmDmaEmergency;
653 
654 /**************************************************************************//*
655  @Description   structure for defining FM threshold
656 *//***************************************************************************/
657 typedef struct t_FmThresholds {
658     uint8_t                 dispLimit;                      /**< The number of times a frames may
659                                                                  be passed in the FM before assumed to
660                                                                  be looping. */
661     uint8_t                 prsDispTh;                      /**< This is the number pf packets that may be
662                                                                  queued in the parser dispatch queue*/
663     uint8_t                 plcrDispTh;                     /**< This is the number pf packets that may be
664                                                                  queued in the policer dispatch queue*/
665     uint8_t                 kgDispTh;                       /**< This is the number pf packets that may be
666                                                                  queued in the keygen dispatch queue*/
667     uint8_t                 bmiDispTh;                      /**< This is the number pf packets that may be
668                                                                  queued in the BMI dispatch queue*/
669     uint8_t                 qmiEnqDispTh;                   /**< This is the number pf packets that may be
670                                                                  queued in the QMI enqueue dispatch queue*/
671     uint8_t                 qmiDeqDispTh;                   /**< This is the number pf packets that may be
672                                                                  queued in the QMI dequeue dispatch queue*/
673     uint8_t                 fmCtl1DispTh;                   /**< This is the number pf packets that may be
674                                                                  queued in fmCtl1 dispatch queue*/
675     uint8_t                 fmCtl2DispTh;                   /**< This is the number pf packets that may be
676                                                                  queued in fmCtl2 dispatch queue*/
677 } t_FmThresholds;
678 
679 /**************************************************************************//*
680  @Description   structure for defining DMA thresholds
681 *//***************************************************************************/
682 typedef struct t_FmDmaThresholds {
683     uint8_t                     assertEmergency;            /**< When this value is reached,
684                                                                  assert emergency (Threshold)*/
685     uint8_t                     clearEmergency;             /**< After emergency is asserted, it is held
686                                                                  until this value is reached (Hystheresis) */
687 } t_FmDmaThresholds;
688 
689 /**************************************************************************//**
690  @Function      t_FmResetOnInitOverrideCallback
691 
692  @Description   FMan specific reset on init user callback routine,
693                 will be used to override the standard FMan reset on init procedure
694 
695  @Param[in]     h_Fm  - FMan handler
696 *//***************************************************************************/
697 typedef void (t_FmResetOnInitOverrideCallback)(t_Handle h_Fm);
698 
699 /**************************************************************************//**
700  @Function      FM_ConfigResetOnInit
701 
702  @Description   Define whether to reset the FM before initialization.
703                 Change the default configuration [DEFAULT_resetOnInit].
704 
705  @Param[in]     h_Fm                A handle to an FM Module.
706  @Param[in]     enable              When TRUE, FM will be reset before any initialization.
707 
708  @Return        E_OK on success; Error code otherwise.
709 
710  @Cautions      Allowed only following FM_Config() and before FM_Init().
711                 This routine should NOT be called from guest-partition
712                 (i.e. guestId != NCSW_MASTER_ID)
713 *//***************************************************************************/
714 t_Error FM_ConfigResetOnInit(t_Handle h_Fm, bool enable);
715 
716 /**************************************************************************//**
717  @Function      FM_ConfigResetOnInitOverrideCallback
718 
719  @Description   Define a special reset of FM before initialization.
720                 Change the default configuration [DEFAULT_resetOnInitOverrideCallback].
721 
722  @Param[in]     h_Fm                	A handle to an FM Module.
723  @Param[in]     f_ResetOnInitOverride   FM specific reset on init user callback routine.
724 
725  @Return        E_OK on success; Error code otherwise.
726 
727  @Cautions      Allowed only following FM_Config() and before FM_Init().
728                 This routine should NOT be called from guest-partition
729                 (i.e. guestId != NCSW_MASTER_ID)
730 *//***************************************************************************/
731 t_Error FM_ConfigResetOnInitOverrideCallback(t_Handle h_Fm, t_FmResetOnInitOverrideCallback *f_ResetOnInitOverride);
732 
733 /**************************************************************************//**
734  @Function      FM_ConfigTotalFifoSize
735 
736  @Description   Define Total FIFO size for the whole FM.
737                 Calling this routine changes the total Fifo size in the internal driver
738                 data base from its default configuration [DEFAULT_totalFifoSize]
739 
740  @Param[in]     h_Fm                A handle to an FM Module.
741  @Param[in]     totalFifoSize       The selected new value.
742 
743  @Return        E_OK on success; Error code otherwise.
744 
745  @Cautions      Allowed only following FM_Config() and before FM_Init().
746                 This routine should NOT be called from guest-partition
747                 (i.e. guestId != NCSW_MASTER_ID)
748 *//***************************************************************************/
749 t_Error FM_ConfigTotalFifoSize(t_Handle h_Fm, uint32_t totalFifoSize);
750 
751  /**************************************************************************//**
752  @Function      FM_ConfigDmaCacheOverride
753 
754  @Description   Define cache override mode.
755                 Calling this routine changes the cache override mode
756                 in the internal driver data base from its default configuration [DEFAULT_cacheOverride]
757 
758  @Param[in]     h_Fm            A handle to an FM Module.
759  @Param[in]     cacheOverride   The selected new value.
760 
761  @Return        E_OK on success; Error code otherwise.
762 
763  @Cautions      Allowed only following FM_Config() and before FM_Init().
764                 This routine should NOT be called from guest-partition
765                 (i.e. guestId != NCSW_MASTER_ID)
766 *//***************************************************************************/
767 t_Error FM_ConfigDmaCacheOverride(t_Handle h_Fm, e_FmDmaCacheOverride cacheOverride);
768 
769 /**************************************************************************//**
770  @Function      FM_ConfigDmaAidOverride
771 
772  @Description   Define DMA AID override mode.
773                 Calling this routine changes the AID override mode
774                 in the internal driver data base from its default configuration  [DEFAULT_aidOverride]
775 
776  @Param[in]     h_Fm            A handle to an FM Module.
777  @Param[in]     aidOverride     The selected new value.
778 
779  @Return        E_OK on success; Error code otherwise.
780 
781  @Cautions      Allowed only following FM_Config() and before FM_Init().
782                 This routine should NOT be called from guest-partition
783                 (i.e. guestId != NCSW_MASTER_ID)
784 *//***************************************************************************/
785 t_Error FM_ConfigDmaAidOverride(t_Handle h_Fm, bool aidOverride);
786 
787 /**************************************************************************//**
788  @Function      FM_ConfigDmaAidMode
789 
790  @Description   Define DMA AID  mode.
791                 Calling this routine changes the AID  mode in the internal
792                 driver data base from its default configuration [DEFAULT_aidMode]
793 
794  @Param[in]     h_Fm            A handle to an FM Module.
795  @Param[in]     aidMode         The selected new value.
796 
797  @Return        E_OK on success; Error code otherwise.
798 
799  @Cautions      Allowed only following FM_Config() and before FM_Init().
800                 This routine should NOT be called from guest-partition
801                 (i.e. guestId != NCSW_MASTER_ID)
802 *//***************************************************************************/
803 t_Error FM_ConfigDmaAidMode(t_Handle h_Fm, e_FmDmaAidMode aidMode);
804 
805 /**************************************************************************//**
806  @Function      FM_ConfigDmaAxiDbgNumOfBeats
807 
808  @Description   Define DMA AXI number of beats.
809                 Calling this routine changes the AXI number of beats in the internal
810                 driver data base from its default configuration [DEFAULT_axiDbgNumOfBeats]
811 
812  @Param[in]     h_Fm                A handle to an FM Module.
813  @Param[in]     axiDbgNumOfBeats    The selected new value.
814 
815  @Return        E_OK on success; Error code otherwise.
816 
817  @Cautions      Allowed only following FM_Config() and before FM_Init().
818                 This routine should NOT be called from guest-partition
819                 (i.e. guestId != NCSW_MASTER_ID)
820 *//***************************************************************************/
821 t_Error FM_ConfigDmaAxiDbgNumOfBeats(t_Handle h_Fm, uint8_t axiDbgNumOfBeats);
822 
823 /**************************************************************************//**
824  @Function      FM_ConfigDmaCamNumOfEntries
825 
826  @Description   Define number of CAM entries.
827                 Calling this routine changes the number of CAM entries in the internal
828                 driver data base from its default configuration [DEFAULT_dmaCamNumOfEntries].
829 
830  @Param[in]     h_Fm            A handle to an FM Module.
831  @Param[in]     numOfEntries    The selected new value.
832 
833  @Return        E_OK on success; Error code otherwise.
834 
835  @Cautions      Allowed only following FM_Config() and before FM_Init().
836                 This routine should NOT be called from guest-partition
837                 (i.e. guestId != NCSW_MASTER_ID)
838 *//***************************************************************************/
839 t_Error FM_ConfigDmaCamNumOfEntries(t_Handle h_Fm, uint8_t numOfEntries);
840 
841 /**************************************************************************//**
842  @Function      FM_ConfigEnableCounters
843 
844  @Description   Obsolete, always return E_OK.
845 
846  @Param[in]     h_Fm    A handle to an FM Module.
847 
848  @Return        E_OK on success; Error code otherwise.
849 *//***************************************************************************/
850 t_Error FM_ConfigEnableCounters(t_Handle h_Fm);
851 
852 /**************************************************************************//**
853  @Function      FM_ConfigDmaDbgCounter
854 
855  @Description   Define DMA debug counter.
856                 Calling this routine changes the number of the DMA debug counter in the internal
857                 driver data base from its default configuration [DEFAULT_dmaDbgCntMode].
858 
859  @Param[in]     h_Fm                A handle to an FM Module.
860  @Param[in]     fmDmaDbgCntMode     An enum selecting the debug counter mode.
861 
862  @Return        E_OK on success; Error code otherwise.
863 
864  @Cautions      Allowed only following FM_Config() and before FM_Init().
865                 This routine should NOT be called from guest-partition
866                 (i.e. guestId != NCSW_MASTER_ID)
867 *//***************************************************************************/
868 t_Error FM_ConfigDmaDbgCounter(t_Handle h_Fm, e_FmDmaDbgCntMode fmDmaDbgCntMode);
869 
870 /**************************************************************************//**
871  @Function      FM_ConfigDmaStopOnBusErr
872 
873  @Description   Define bus error behavior.
874                 Calling this routine changes the bus error behavior definition
875                 in the internal driver data base from its default
876                 configuration [DEFAULT_dmaStopOnBusError].
877 
878  @Param[in]     h_Fm    A handle to an FM Module.
879  @Param[in]     stop    TRUE to stop on bus error, FALSE to continue.
880 
881  @Return        E_OK on success; Error code otherwise.
882 
883  @Cautions      Allowed only following FM_Config() and before FM_Init().
884                 Only if bus error is enabled.
885                 This routine should NOT be called from guest-partition
886                 (i.e. guestId != NCSW_MASTER_ID)
887 *//***************************************************************************/
888 t_Error FM_ConfigDmaStopOnBusErr(t_Handle h_Fm, bool stop);
889 
890 /**************************************************************************//**
891  @Function      FM_ConfigDmaEmergency
892 
893  @Description   Define DMA emergency.
894                 Calling this routine changes the DMA emergency definition
895                 in the internal driver data base from its default
896                 configuration where's it's disabled.
897 
898  @Param[in]     h_Fm        A handle to an FM Module.
899  @Param[in]     p_Emergency An OR mask of all required options.
900 
901  @Return        E_OK on success; Error code otherwise.
902 
903  @Cautions      Allowed only following FM_Config() and before FM_Init().
904                 This routine should NOT be called from guest-partition
905                 (i.e. guestId != NCSW_MASTER_ID)
906 *//***************************************************************************/
907 t_Error FM_ConfigDmaEmergency(t_Handle h_Fm, t_FmDmaEmergency *p_Emergency);
908 
909 /**************************************************************************//**
910  @Function      FM_ConfigDmaErr
911 
912  @Description   DMA error treatment.
913                 Calling this routine changes the DMA error treatment
914                 in the internal driver data base from its default
915                 configuration [DEFAULT_dmaErr].
916 
917  @Param[in]     h_Fm    A handle to an FM Module.
918  @Param[in]     dmaErr  The selected new choice.
919 
920  @Return        E_OK on success; Error code otherwise.
921 
922  @Cautions      Allowed only following FM_Config() and before FM_Init().
923                 This routine should NOT be called from guest-partition
924                 (i.e. guestId != NCSW_MASTER_ID)
925 *//***************************************************************************/
926 t_Error FM_ConfigDmaErr(t_Handle h_Fm, e_FmDmaErr dmaErr);
927 
928 /**************************************************************************//**
929  @Function      FM_ConfigCatastrophicErr
930 
931  @Description   Define FM behavior on catastrophic error.
932                 Calling this routine changes the FM behavior on catastrophic
933                 error in the internal driver data base from its default
934                 [DEFAULT_catastrophicErr].
935 
936  @Param[in]     h_Fm                A handle to an FM Module.
937  @Param[in]     catastrophicErr     The selected new choice.
938 
939  @Return        E_OK on success; Error code otherwise.
940 
941  @Cautions      Allowed only following FM_Config() and before FM_Init().
942                 This routine should NOT be called from guest-partition
943                 (i.e. guestId != NCSW_MASTER_ID)
944 *//***************************************************************************/
945 t_Error FM_ConfigCatastrophicErr(t_Handle h_Fm, e_FmCatastrophicErr catastrophicErr);
946 
947 /**************************************************************************//**
948  @Function      FM_ConfigEnableMuramTestMode
949 
950  @Description   Enable MURAM test mode.
951                 Calling this routine changes the internal driver data base
952                 from its default selection of test mode where it's disabled.
953                 This routine is only avaiable on old FM revisions (FMan v2).
954 
955  @Param[in]     h_Fm    A handle to an FM Module.
956 
957  @Return        E_OK on success; Error code otherwise.
958 
959  @Cautions      Allowed only following FM_Config() and before FM_Init().
960                 This routine should NOT be called from guest-partition
961                 (i.e. guestId != NCSW_MASTER_ID)
962 *//***************************************************************************/
963 t_Error FM_ConfigEnableMuramTestMode(t_Handle h_Fm);
964 
965 /**************************************************************************//**
966  @Function      FM_ConfigEnableIramTestMode
967 
968  @Description   Enable IRAM test mode.
969                 Calling this routine changes the internal driver data base
970                 from its default selection of test mode where it's disabled.
971                 This routine is only avaiable on old FM revisions (FMan v2).
972 
973  @Param[in]     h_Fm    A handle to an FM Module.
974 
975  @Return        E_OK on success; Error code otherwise.
976 
977  @Cautions      Allowed only following FM_Config() and before FM_Init().
978                 This routine should NOT be called from guest-partition
979                 (i.e. guestId != NCSW_MASTER_ID)
980 *//***************************************************************************/
981 t_Error FM_ConfigEnableIramTestMode(t_Handle h_Fm);
982 
983 /**************************************************************************//**
984  @Function      FM_ConfigHaltOnExternalActivation
985 
986  @Description   Define FM behavior on external halt activation.
987                 Calling this routine changes the FM behavior on external halt
988                 activation in the internal driver data base from its default
989                 [DEFAULT_haltOnExternalActivation].
990 
991  @Param[in]     h_Fm            A handle to an FM Module.
992  @Param[in]     enable          TRUE to enable halt on external halt
993                                 activation.
994 
995  @Return        E_OK on success; Error code otherwise.
996 
997  @Cautions      Allowed only following FM_Config() and before FM_Init().
998                 This routine should NOT be called from guest-partition
999                 (i.e. guestId != NCSW_MASTER_ID)
1000 *//***************************************************************************/
1001 t_Error FM_ConfigHaltOnExternalActivation(t_Handle h_Fm, bool enable);
1002 
1003 /**************************************************************************//**
1004  @Function      FM_ConfigHaltOnUnrecoverableEccError
1005 
1006  @Description   Define FM behavior on external halt activation.
1007                 Calling this routine changes the FM behavior on unrecoverable
1008                 ECC error in the internal driver data base from its default
1009                 [DEFAULT_haltOnUnrecoverableEccError].
1010                 This routine is only avaiable on old FM revisions (FMan v2).
1011 
1012  @Param[in]     h_Fm            A handle to an FM Module.
1013  @Param[in]     enable          TRUE to enable halt on unrecoverable Ecc error
1014 
1015  @Return        E_OK on success; Error code otherwise.
1016 
1017  @Cautions      Allowed only following FM_Config() and before FM_Init().
1018                 This routine should NOT be called from guest-partition
1019                 (i.e. guestId != NCSW_MASTER_ID)
1020 *//***************************************************************************/
1021 t_Error FM_ConfigHaltOnUnrecoverableEccError(t_Handle h_Fm, bool enable);
1022 
1023 /**************************************************************************//**
1024  @Function      FM_ConfigException
1025 
1026  @Description   Define FM exceptions.
1027                 Calling this routine changes the exceptions defaults in the
1028                 internal driver data base where all exceptions are enabled.
1029 
1030  @Param[in]     h_Fm            A handle to an FM Module.
1031  @Param[in]     exception       The exception to be selected.
1032  @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.
1033 
1034  @Return        E_OK on success; Error code otherwise.
1035 
1036  @Cautions      Allowed only following FM_Config() and before FM_Init().
1037                 This routine should NOT be called from guest-partition
1038                 (i.e. guestId != NCSW_MASTER_ID)
1039 *//***************************************************************************/
1040 t_Error FM_ConfigException(t_Handle h_Fm, e_FmExceptions exception, bool enable);
1041 
1042 /**************************************************************************//**
1043  @Function      FM_ConfigExternalEccRamsEnable
1044 
1045  @Description   Select external ECC enabling.
1046                 Calling this routine changes the ECC enabling control in the internal
1047                 driver data base from its default [DEFAULT_externalEccRamsEnable].
1048                 When this option is enabled Rams ECC enabling is not effected
1049                 by FM_EnableRamsEcc/FM_DisableRamsEcc, but by a JTAG.
1050 
1051  @Param[in]     h_Fm            A handle to an FM Module.
1052  @Param[in]     enable          TRUE to enable this option.
1053 
1054  @Return        E_OK on success; Error code otherwise.
1055 
1056  @Cautions      Allowed only following FM_Config() and before FM_Init().
1057                 This routine should NOT be called from guest-partition
1058                 (i.e. guestId != NCSW_MASTER_ID)
1059 *//***************************************************************************/
1060 t_Error FM_ConfigExternalEccRamsEnable(t_Handle h_Fm, bool enable);
1061 
1062 /**************************************************************************//**
1063  @Function      FM_ConfigTnumAgingPeriod
1064 
1065  @Description   Define Tnum aging period.
1066                 Calling this routine changes the Tnum aging of dequeue TNUMs
1067                 in the QMI in the internal driver data base from its default
1068                 [DEFAULT_tnumAgingPeriod].
1069 
1070  @Param[in]     h_Fm                A handle to an FM Module.
1071  @Param[in]     tnumAgingPeriod     Tnum Aging Period in microseconds.
1072                                     Note that period is recalculated in units of
1073                                     64 FM clocks. Driver will pick the closest
1074                                     possible period.
1075 
1076  @Return        E_OK on success; Error code otherwise.
1077 
1078  @Cautions      Allowed only following FM_Config() and before FM_Init().
1079                 This routine should NOT be called from guest-partition
1080                 (i.e. guestId != NCSW_MASTER_ID)
1081                 NOTE that if some MAC is configured for PFC, '0' value is NOT
1082                 allowed.
1083 *//***************************************************************************/
1084 t_Error FM_ConfigTnumAgingPeriod(t_Handle h_Fm, uint16_t tnumAgingPeriod);
1085 
1086 /**************************************************************************//*
1087  @Function      FM_ConfigDmaEmergencySmoother
1088 
1089  @Description   Define DMA emergency smoother.
1090                 Calling this routine changes the definition of the minimum
1091                 amount of DATA beats transferred on the AXI READ and WRITE
1092                 ports before lowering the emergency level.
1093                 By default smoother is disabled.
1094 
1095  @Param[in]     h_Fm            A handle to an FM Module.
1096  @Param[in]     emergencyCnt    emergency switching counter.
1097 
1098  @Return        E_OK on success; Error code otherwise.
1099 
1100  @Cautions      Allowed only following FM_Config() and before FM_Init().
1101                 This routine should NOT be called from guest-partition
1102                 (i.e. guestId != NCSW_MASTER_ID)
1103 *//***************************************************************************/
1104 t_Error FM_ConfigDmaEmergencySmoother(t_Handle h_Fm, uint32_t emergencyCnt);
1105 
1106 /**************************************************************************//*
1107  @Function      FM_ConfigThresholds
1108 
1109  @Description   Calling this routine changes the internal driver data base
1110                 from its default FM threshold configuration:
1111                     dispLimit:    [DEFAULT_dispLimit]
1112                     prsDispTh:    [DEFAULT_prsDispTh]
1113                     plcrDispTh:   [DEFAULT_plcrDispTh]
1114                     kgDispTh:     [DEFAULT_kgDispTh]
1115                     bmiDispTh:    [DEFAULT_bmiDispTh]
1116                     qmiEnqDispTh: [DEFAULT_qmiEnqDispTh]
1117                     qmiDeqDispTh: [DEFAULT_qmiDeqDispTh]
1118                     fmCtl1DispTh: [DEFAULT_fmCtl1DispTh]
1119                     fmCtl2DispTh: [DEFAULT_fmCtl2DispTh]
1120 
1121 
1122  @Param[in]     h_Fm            A handle to an FM Module.
1123  @Param[in]     p_FmThresholds  A structure of threshold parameters.
1124 
1125  @Return        E_OK on success; Error code otherwise.
1126 
1127  @Cautions      Allowed only following FM_Config() and before FM_Init().
1128                 This routine should NOT be called from guest-partition
1129                 (i.e. guestId != NCSW_MASTER_ID)
1130 *//***************************************************************************/
1131 t_Error FM_ConfigThresholds(t_Handle h_Fm, t_FmThresholds *p_FmThresholds);
1132 
1133 /**************************************************************************//*
1134  @Function      FM_ConfigDmaSosEmergencyThreshold
1135 
1136  @Description   Calling this routine changes the internal driver data base
1137                 from its default dma SOS emergency configuration [DEFAULT_dmaSosEmergency]
1138 
1139  @Param[in]     h_Fm                A handle to an FM Module.
1140  @Param[in]     dmaSosEmergency     The selected new value.
1141 
1142  @Return        E_OK on success; Error code otherwise.
1143 
1144  @Cautions      Allowed only following FM_Config() and before FM_Init().
1145                 This routine should NOT be called from guest-partition
1146                 (i.e. guestId != NCSW_MASTER_ID)
1147 *//***************************************************************************/
1148 t_Error FM_ConfigDmaSosEmergencyThreshold(t_Handle h_Fm, uint32_t dmaSosEmergency);
1149 
1150 /**************************************************************************//*
1151  @Function      FM_ConfigDmaWriteBufThresholds
1152 
1153  @Description   Calling this routine changes the internal driver data base
1154                 from its default configuration of DMA write buffer threshold
1155                 assertEmergency: [DEFAULT_dmaWriteIntBufLow]
1156                 clearEmergency:  [DEFAULT_dmaWriteIntBufHigh]
1157                 This routine is only avaiable on old FM revisions (FMan v2).
1158 
1159  @Param[in]     h_Fm                A handle to an FM Module.
1160  @Param[in]     p_FmDmaThresholds   A structure of thresholds to define emergency behavior -
1161                                     When 'assertEmergency' value is reached, emergency is asserted,
1162                                     then it is held until 'clearEmergency' value is reached.
1163 
1164  @Return        E_OK on success; Error code otherwise.
1165 
1166  @Cautions      Allowed only following FM_Config() and before FM_Init().
1167                 This routine should NOT be called from guest-partition
1168                 (i.e. guestId != NCSW_MASTER_ID)
1169 *//***************************************************************************/
1170 t_Error FM_ConfigDmaWriteBufThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
1171 
1172  /**************************************************************************//*
1173  @Function      FM_ConfigDmaCommQThresholds
1174 
1175  @Description   Calling this routine changes the internal driver data base
1176                 from its default configuration of DMA command queue threshold
1177                 assertEmergency: [DEFAULT_dmaCommQLow]
1178                 clearEmergency:  [DEFAULT_dmaCommQHigh]
1179 
1180  @Param[in]     h_Fm                A handle to an FM Module.
1181  @Param[in]     p_FmDmaThresholds   A structure of thresholds to define emergency behavior -
1182                                     When 'assertEmergency' value is reached, emergency is asserted,
1183                                     then it is held until 'clearEmergency' value is reached..
1184 
1185  @Return        E_OK on success; Error code otherwise.
1186 
1187  @Cautions      Allowed only following FM_Config() and before FM_Init().
1188                 This routine should NOT be called from guest-partition
1189                 (i.e. guestId != NCSW_MASTER_ID)
1190 *//***************************************************************************/
1191 t_Error FM_ConfigDmaCommQThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
1192 
1193 /**************************************************************************//*
1194  @Function      FM_ConfigDmaReadBufThresholds
1195 
1196  @Description   Calling this routine changes the internal driver data base
1197                 from its default configuration of DMA read buffer threshold
1198                 assertEmergency: [DEFAULT_dmaReadIntBufLow]
1199                 clearEmergency:  [DEFAULT_dmaReadIntBufHigh]
1200                 This routine is only avaiable on old FM revisions (FMan v2).
1201 
1202  @Param[in]     h_Fm                A handle to an FM Module.
1203  @Param[in]     p_FmDmaThresholds   A structure of thresholds to define emergency behavior -
1204                                     When 'assertEmergency' value is reached, emergency is asserted,
1205                                     then it is held until 'clearEmergency' value is reached..
1206 
1207  @Return        E_OK on success; Error code otherwise.
1208 
1209  @Cautions      Allowed only following FM_Config() and before FM_Init().
1210                 This routine should NOT be called from guest-partition
1211                 (i.e. guestId != NCSW_MASTER_ID)
1212 *//***************************************************************************/
1213 t_Error FM_ConfigDmaReadBufThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
1214 
1215 /**************************************************************************//*
1216  @Function      FM_ConfigDmaWatchdog
1217 
1218  @Description   Calling this routine changes the internal driver data base
1219                 from its default watchdog configuration, which is disabled
1220                 [DEFAULT_dmaWatchdog].
1221 
1222  @Param[in]     h_Fm            A handle to an FM Module.
1223  @Param[in]     watchDogValue   The selected new value - in microseconds.
1224 
1225  @Return        E_OK on success; Error code otherwise.
1226 
1227  @Cautions      Allowed only following FM_Config() and before FM_Init().
1228                 This routine should NOT be called from guest-partition
1229                 (i.e. guestId != NCSW_MASTER_ID)
1230 *//***************************************************************************/
1231 t_Error FM_ConfigDmaWatchdog(t_Handle h_Fm, uint32_t watchDogValue);
1232 
1233 /** @} */ /* end of FM_advanced_init_grp group */
1234 /** @} */ /* end of FM_init_grp group */
1235 
1236 
1237 /**************************************************************************//**
1238  @Group         FM_runtime_control_grp FM Runtime Control Unit
1239 
1240  @Description   FM Runtime control unit API functions, definitions and enums.
1241                 The FM driver provides a set of control routines.
1242                 These routines may only be called after the module was fully
1243                 initialized (both configuration and initialization routines were
1244                 called). They are typically used to get information from hardware
1245                 (status, counters/statistics, revision etc.), to modify a current
1246                 state or to force/enable a required action. Run-time control may
1247                 be called whenever necessary and as many times as needed.
1248  @{
1249 *//***************************************************************************/
1250 
1251 /**************************************************************************//**
1252  @Collection   General FM defines.
1253 *//***************************************************************************/
1254 #define FM_MAX_NUM_OF_VALID_PORTS   (FM_MAX_NUM_OF_OH_PORTS +       \
1255                                      FM_MAX_NUM_OF_1G_RX_PORTS +    \
1256                                      FM_MAX_NUM_OF_10G_RX_PORTS +   \
1257                                      FM_MAX_NUM_OF_1G_TX_PORTS +    \
1258                                      FM_MAX_NUM_OF_10G_TX_PORTS)      /**< Number of available FM ports */
1259 /* @} */
1260 
1261 /**************************************************************************//*
1262  @Description   A Structure for Port bandwidth requirement. Port is identified
1263                 by type and relative id.
1264 *//***************************************************************************/
1265 typedef struct t_FmPortBandwidth {
1266     e_FmPortType        type;           /**< FM port type */
1267     uint8_t             relativePortId; /**< Type relative port id */
1268     uint8_t             bandwidth;      /**< bandwidth - (in term of percents) */
1269 } t_FmPortBandwidth;
1270 
1271 /**************************************************************************//*
1272  @Description   A Structure containing an array of Port bandwidth requirements.
1273                 The user should state the ports requiring bandwidth in terms of
1274                 percentage - i.e. all port's bandwidths in the array must add
1275                 up to 100.
1276 *//***************************************************************************/
1277 typedef struct t_FmPortsBandwidthParams {
1278     uint8_t             numOfPorts;         /**< The number of relevant ports, which is the
1279                                                  number of valid entries in the array below */
1280     t_FmPortBandwidth   portsBandwidths[FM_MAX_NUM_OF_VALID_PORTS];
1281                                             /**< for each port, it's bandwidth (all port's
1282                                                  bandwidths must add up to 100.*/
1283 } t_FmPortsBandwidthParams;
1284 
1285 /**************************************************************************//**
1286  @Description   DMA Emergency control on MURAM
1287 *//***************************************************************************/
1288 typedef enum e_FmDmaMuramPort {
1289     e_FM_DMA_MURAM_PORT_WRITE,              /**< MURAM write port */
1290     e_FM_DMA_MURAM_PORT_READ                /**< MURAM read port */
1291 } e_FmDmaMuramPort;
1292 
1293 /**************************************************************************//**
1294  @Description   Enum for defining FM counters
1295 *//***************************************************************************/
1296 typedef enum e_FmCounters {
1297     e_FM_COUNTERS_ENQ_TOTAL_FRAME = 0,              /**< QMI total enqueued frames counter */
1298     e_FM_COUNTERS_DEQ_TOTAL_FRAME,                  /**< QMI total dequeued frames counter */
1299     e_FM_COUNTERS_DEQ_0,                            /**< QMI 0 frames from QMan counter */
1300     e_FM_COUNTERS_DEQ_1,                            /**< QMI 1 frames from QMan counter */
1301     e_FM_COUNTERS_DEQ_2,                            /**< QMI 2 frames from QMan counter */
1302     e_FM_COUNTERS_DEQ_3,                            /**< QMI 3 frames from QMan counter */
1303     e_FM_COUNTERS_DEQ_FROM_DEFAULT,                 /**< QMI dequeue from default queue counter */
1304     e_FM_COUNTERS_DEQ_FROM_CONTEXT,                 /**< QMI dequeue from FQ context counter */
1305     e_FM_COUNTERS_DEQ_FROM_FD,                      /**< QMI dequeue from FD command field counter */
1306     e_FM_COUNTERS_DEQ_CONFIRM                       /**< QMI dequeue confirm counter */
1307 } e_FmCounters;
1308 
1309 /**************************************************************************//**
1310  @Description   A Structure for returning FM revision information
1311 *//***************************************************************************/
1312 typedef struct t_FmRevisionInfo {
1313     uint8_t         majorRev;               /**< Major revision */
1314     uint8_t         minorRev;               /**< Minor revision */
1315 } t_FmRevisionInfo;
1316 
1317 /**************************************************************************//**
1318  @Description   A Structure for returning FM ctrl code revision information
1319 *//***************************************************************************/
1320 typedef struct t_FmCtrlCodeRevisionInfo {
1321     uint16_t        packageRev;             /**< Package revision */
1322     uint8_t         majorRev;               /**< Major revision */
1323     uint8_t         minorRev;               /**< Minor revision */
1324 } t_FmCtrlCodeRevisionInfo;
1325 
1326 /**************************************************************************//**
1327  @Description   A Structure for defining DMA status
1328 *//***************************************************************************/
1329 typedef struct t_FmDmaStatus {
1330     bool    cmqNotEmpty;            /**< Command queue is not empty */
1331     bool    busError;               /**< Bus error occurred */
1332     bool    readBufEccError;        /**< Double ECC error on buffer Read (Valid for FM rev < 6)*/
1333     bool    writeBufEccSysError;    /**< Double ECC error on buffer write from system side (Valid for FM rev < 6)*/
1334     bool    writeBufEccFmError;     /**< Double ECC error on buffer write from FM side (Valid for FM rev < 6) */
1335     bool    singlePortEccError;     /**< Single Port ECC error from FM side (Valid for FM rev >= 6)*/
1336 } t_FmDmaStatus;
1337 
1338 /**************************************************************************//**
1339  @Description   A Structure for obtaining FM controller monitor values
1340 *//***************************************************************************/
1341 typedef struct t_FmCtrlMon {
1342     uint8_t percentCnt[2];          /**< Percentage value */
1343 } t_FmCtrlMon;
1344 
1345 
1346 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1347 /**************************************************************************//**
1348  @Function      FM_DumpRegs
1349 
1350  @Description   Dumps all FM registers
1351 
1352  @Param[in]     h_Fm      A handle to an FM Module.
1353 
1354  @Return        E_OK on success;
1355 
1356  @Cautions      Allowed only following FM_Init().
1357 *//***************************************************************************/
1358 t_Error FM_DumpRegs(t_Handle h_Fm);
1359 #endif /* (defined(DEBUG_ERRORS) && ... */
1360 
1361 /**************************************************************************//**
1362  @Function      FM_SetException
1363 
1364  @Description   Calling this routine enables/disables the specified exception.
1365 
1366  @Param[in]     h_Fm            A handle to an FM Module.
1367  @Param[in]     exception       The exception to be selected.
1368  @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.
1369 
1370  @Return        E_OK on success; Error code otherwise.
1371 
1372  @Cautions      Allowed only following FM_Init().
1373                 This routine should NOT be called from guest-partition
1374                 (i.e. guestId != NCSW_MASTER_ID)
1375 *//***************************************************************************/
1376 t_Error FM_SetException(t_Handle h_Fm, e_FmExceptions exception, bool enable);
1377 
1378 /**************************************************************************//**
1379  @Function      FM_EnableRamsEcc
1380 
1381  @Description   Enables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1382                 MURAM, Parser, Keygen, Policer, etc.
1383                 Note:
1384                 If FM_ConfigExternalEccRamsEnable was called to enable external
1385                 setting of ECC, this routine effects IRAM ECC only.
1386                 This routine is also called by the driver if an ECC exception is
1387                 enabled.
1388 
1389  @Param[in]     h_Fm            A handle to an FM Module.
1390 
1391  @Return        E_OK on success; Error code otherwise.
1392 
1393  @Cautions      Allowed only following FM_Config() and before FM_Init().
1394                 This routine should NOT be called from guest-partition
1395                 (i.e. guestId != NCSW_MASTER_ID)
1396 *//***************************************************************************/
1397 t_Error FM_EnableRamsEcc(t_Handle h_Fm);
1398 
1399 /**************************************************************************//**
1400  @Function      FM_DisableRamsEcc
1401 
1402  @Description   Disables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1403                 MURAM, Parser, Keygen, Policer, etc.
1404                 Note:
1405                 If FM_ConfigExternalEccRamsEnable was called to enable external
1406                 setting of ECC, this routine effects IRAM ECC only.
1407                 In opposed to FM_EnableRamsEcc, this routine must be called
1408                 explicitly to disable all Rams ECC.
1409 
1410  @Param[in]     h_Fm            A handle to an FM Module.
1411 
1412  @Return        E_OK on success; Error code otherwise.
1413 
1414  @Cautions      Allowed only following FM_Config() and before FM_Init().
1415                 This routine should NOT be called from guest-partition
1416                 (i.e. guestId != NCSW_MASTER_ID)
1417 *//***************************************************************************/
1418 t_Error FM_DisableRamsEcc(t_Handle h_Fm);
1419 
1420 /**************************************************************************//**
1421  @Function      FM_GetRevision
1422 
1423  @Description   Returns the FM revision
1424 
1425  @Param[in]     h_Fm                A handle to an FM Module.
1426  @Param[out]    p_FmRevisionInfo    A structure of revision information parameters.
1427 
1428  @Return        E_OK on success; Error code otherwise.
1429 
1430  @Cautions      Allowed only following FM_Init().
1431 *//***************************************************************************/
1432 t_Error  FM_GetRevision(t_Handle h_Fm, t_FmRevisionInfo *p_FmRevisionInfo);
1433 
1434 /**************************************************************************//**
1435  @Function      FM_GetFmanCtrlCodeRevision
1436 
1437  @Description   Returns the Fman controller code revision
1438 
1439  @Param[in]     h_Fm                A handle to an FM Module.
1440  @Param[out]    p_RevisionInfo      A structure of revision information parameters.
1441 
1442  @Return        E_OK on success; Error code otherwise.
1443 
1444  @Cautions      Allowed only following FM_Init().
1445 *//***************************************************************************/
1446 t_Error FM_GetFmanCtrlCodeRevision(t_Handle h_Fm, t_FmCtrlCodeRevisionInfo *p_RevisionInfo);
1447 
1448 /**************************************************************************//**
1449  @Function      FM_GetCounter
1450 
1451  @Description   Reads one of the FM counters.
1452 
1453  @Param[in]     h_Fm        A handle to an FM Module.
1454  @Param[in]     counter     The requested counter.
1455 
1456  @Return        Counter's current value.
1457 
1458  @Cautions      Allowed only following FM_Init().
1459                 Note that it is user's responsibility to call this routine only
1460                 for enabled counters, and there will be no indication if a
1461                 disabled counter is accessed.
1462 *//***************************************************************************/
1463 uint32_t  FM_GetCounter(t_Handle h_Fm, e_FmCounters counter);
1464 
1465 /**************************************************************************//**
1466  @Function      FM_ModifyCounter
1467 
1468  @Description   Sets a value to an enabled counter. Use "0" to reset the counter.
1469 
1470  @Param[in]     h_Fm        A handle to an FM Module.
1471  @Param[in]     counter     The requested counter.
1472  @Param[in]     val         The requested value to be written into the counter.
1473 
1474  @Return        E_OK on success; Error code otherwise.
1475 
1476  @Cautions      Allowed only following FM_Init().
1477                 This routine should NOT be called from guest-partition
1478                 (i.e. guestId != NCSW_MASTER_ID)
1479 *//***************************************************************************/
1480 t_Error  FM_ModifyCounter(t_Handle h_Fm, e_FmCounters counter, uint32_t val);
1481 
1482 /**************************************************************************//**
1483  @Function      FM_Resume
1484 
1485  @Description   Release FM after halt FM command or after unrecoverable ECC error.
1486 
1487  @Param[in]     h_Fm        A handle to an FM Module.
1488 
1489  @Return        E_OK on success; Error code otherwise.
1490 
1491  @Cautions      Allowed only following FM_Init().
1492                 This routine should NOT be called from guest-partition
1493                 (i.e. guestId != NCSW_MASTER_ID)
1494 *//***************************************************************************/
1495 void FM_Resume(t_Handle h_Fm);
1496 
1497 /**************************************************************************//**
1498  @Function      FM_SetDmaEmergency
1499 
1500  @Description   Manual emergency set
1501 
1502  @Param[in]     h_Fm        A handle to an FM Module.
1503  @Param[in]     muramPort   MURAM direction select.
1504  @Param[in]     enable      TRUE to manually enable emergency, FALSE to disable.
1505 
1506  @Return        None.
1507 
1508  @Cautions      Allowed only following FM_Init().
1509                 This routine should NOT be called from guest-partition
1510                 (i.e. guestId != NCSW_MASTER_ID)
1511 *//***************************************************************************/
1512 void FM_SetDmaEmergency(t_Handle h_Fm, e_FmDmaMuramPort muramPort, bool enable);
1513 
1514 /**************************************************************************//**
1515  @Function      FM_SetDmaExtBusPri
1516 
1517  @Description   Set the DMA external bus priority
1518 
1519  @Param[in]     h_Fm    A handle to an FM Module.
1520  @Param[in]     pri     External bus priority select
1521 
1522  @Return        None.
1523 
1524  @Cautions      Allowed only following FM_Init().
1525                 This routine should NOT be called from guest-partition
1526                 (i.e. guestId != NCSW_MASTER_ID)
1527 *//***************************************************************************/
1528 void FM_SetDmaExtBusPri(t_Handle h_Fm, e_FmDmaExtBusPri pri);
1529 
1530 /**************************************************************************//**
1531  @Function      FM_GetDmaStatus
1532 
1533  @Description   Reads the DMA current status
1534 
1535  @Param[in]     h_Fm            A handle to an FM Module.
1536  @Param[out]    p_FmDmaStatus   A structure of DMA status parameters.
1537 
1538  @Cautions      Allowed only following FM_Init().
1539 *//***************************************************************************/
1540 void FM_GetDmaStatus(t_Handle h_Fm, t_FmDmaStatus *p_FmDmaStatus);
1541 
1542 /**************************************************************************//**
1543  @Function      FM_ErrorIsr
1544 
1545  @Description   FM interrupt-service-routine for errors.
1546 
1547  @Param[in]     h_Fm            A handle to an FM Module.
1548 
1549  @Return        E_OK on success; E_EMPTY if no errors found in register, other
1550                 error code otherwise.
1551 
1552  @Cautions      Allowed only following FM_Init().
1553                 This routine should NOT be called from guest-partition
1554                 (i.e. guestId != NCSW_MASTER_ID)
1555 *//***************************************************************************/
1556 t_Error FM_ErrorIsr(t_Handle h_Fm);
1557 
1558 /**************************************************************************//**
1559  @Function      FM_EventIsr
1560 
1561  @Description   FM interrupt-service-routine for normal events.
1562 
1563  @Param[in]     h_Fm            A handle to an FM Module.
1564 
1565  @Cautions      Allowed only following FM_Init().
1566                 This routine should NOT be called from guest-partition
1567                 (i.e. guestId != NCSW_MASTER_ID)
1568 *//***************************************************************************/
1569 void FM_EventIsr(t_Handle h_Fm);
1570 
1571 /**************************************************************************//**
1572  @Function      FM_GetSpecialOperationCoding
1573 
1574  @Description   Return a specific coding according to the input mask.
1575 
1576  @Param[in]     h_Fm            A handle to an FM Module.
1577  @Param[in]     spOper          special operation mask.
1578  @Param[out]    p_SpOperCoding  special operation code.
1579 
1580  @Return        E_OK on success; Error code otherwise.
1581 
1582  @Cautions      Allowed only following FM_Init().
1583 *//***************************************************************************/
1584 t_Error FM_GetSpecialOperationCoding(t_Handle               h_Fm,
1585                                      fmSpecialOperations_t  spOper,
1586                                      uint8_t                *p_SpOperCoding);
1587 
1588 /**************************************************************************//**
1589  @Function      FM_CtrlMonStart
1590 
1591  @Description   Start monitoring utilization of all available FM controllers.
1592 
1593                 In order to obtain FM controllers utilization the following sequence
1594                 should be used:
1595                 -# FM_CtrlMonStart()
1596                 -# FM_CtrlMonStop()
1597                 -# FM_CtrlMonGetCounters() - issued for each FM controller
1598 
1599  @Param[in]     h_Fm            A handle to an FM Module.
1600 
1601  @Return        E_OK on success; Error code otherwise.
1602 
1603  @Cautions      Allowed only following FM_Init().
1604                 This routine should NOT be called from guest-partition
1605                 (i.e. guestId != NCSW_MASTER_ID).
1606 *//***************************************************************************/
1607 t_Error FM_CtrlMonStart(t_Handle h_Fm);
1608 
1609 /**************************************************************************//**
1610  @Function      FM_CtrlMonStop
1611 
1612  @Description   Stop monitoring utilization of all available FM controllers.
1613 
1614                 In order to obtain FM controllers utilization the following sequence
1615                 should be used:
1616                 -# FM_CtrlMonStart()
1617                 -# FM_CtrlMonStop()
1618                 -# FM_CtrlMonGetCounters() - issued for each FM controller
1619 
1620  @Param[in]     h_Fm            A handle to an FM Module.
1621 
1622  @Return        E_OK on success; Error code otherwise.
1623 
1624  @Cautions      Allowed only following FM_Init().
1625                 This routine should NOT be called from guest-partition
1626                 (i.e. guestId != NCSW_MASTER_ID).
1627 *//***************************************************************************/
1628 t_Error FM_CtrlMonStop(t_Handle h_Fm);
1629 
1630 /**************************************************************************//**
1631  @Function      FM_CtrlMonGetCounters
1632 
1633  @Description   Obtain FM controller utilization parameters.
1634 
1635                 In order to obtain FM controllers utilization the following sequence
1636                 should be used:
1637                 -# FM_CtrlMonStart()
1638                 -# FM_CtrlMonStop()
1639                 -# FM_CtrlMonGetCounters() - issued for each FM controller
1640 
1641  @Param[in]     h_Fm            A handle to an FM Module.
1642  @Param[in]     fmCtrlIndex     FM Controller index for that utilization results
1643                                 are requested.
1644  @Param[in]     p_Mon           Pointer to utilization results structure.
1645 
1646  @Return        E_OK on success; Error code otherwise.
1647 
1648  @Cautions      Allowed only following FM_Init().
1649                 This routine should NOT be called from guest-partition
1650                 (i.e. guestId != NCSW_MASTER_ID).
1651 *//***************************************************************************/
1652 t_Error FM_CtrlMonGetCounters(t_Handle h_Fm, uint8_t fmCtrlIndex, t_FmCtrlMon *p_Mon);
1653 
1654 
1655 /**************************************************************************//*
1656  @Function      FM_ForceIntr
1657 
1658  @Description   Causes an interrupt event on the requested source.
1659 
1660  @Param[in]     h_Fm            A handle to an FM Module.
1661  @Param[in]     exception       An exception to be forced.
1662 
1663  @Return        E_OK on success; Error code if the exception is not enabled,
1664                 or is not able to create interrupt.
1665 
1666  @Cautions      Allowed only following FM_Init().
1667                 This routine should NOT be called from guest-partition
1668                 (i.e. guestId != NCSW_MASTER_ID)
1669 *//***************************************************************************/
1670 t_Error FM_ForceIntr (t_Handle h_Fm, e_FmExceptions exception);
1671 
1672 /**************************************************************************//*
1673  @Function      FM_SetPortsBandwidth
1674 
1675  @Description   Sets relative weights between ports when accessing common resources.
1676 
1677  @Param[in]     h_Fm                A handle to an FM Module.
1678  @Param[in]     p_PortsBandwidth    A structure of ports bandwidths in percentage, i.e.
1679                                     total must equal 100.
1680 
1681  @Return        E_OK on success; Error code otherwise.
1682 
1683  @Cautions      Allowed only following FM_Init().
1684                 This routine should NOT be called from guest-partition
1685                 (i.e. guestId != NCSW_MASTER_ID)
1686 *//***************************************************************************/
1687 t_Error FM_SetPortsBandwidth(t_Handle h_Fm, t_FmPortsBandwidthParams *p_PortsBandwidth);
1688 
1689 /**************************************************************************//*
1690  @Function      FM_GetMuramHandle
1691 
1692  @Description   Gets the corresponding MURAM handle
1693 
1694  @Param[in]     h_Fm                A handle to an FM Module.
1695 
1696  @Return        MURAM handle; NULL otherwise.
1697 
1698  @Cautions      Allowed only following FM_Init().
1699                 This routine should NOT be called from guest-partition
1700                 (i.e. guestId != NCSW_MASTER_ID)
1701 *//***************************************************************************/
1702 t_Handle FM_GetMuramHandle(t_Handle h_Fm);
1703 
1704 /** @} */ /* end of FM_runtime_control_grp group */
1705 /** @} */ /* end of FM_lib_grp group */
1706 /** @} */ /* end of FM_grp group */
1707 
1708 
1709 #ifdef NCSW_BACKWARD_COMPATIBLE_API
1710 typedef t_FmFirmwareParams          t_FmPcdFirmwareParams;
1711 typedef t_FmBufferPrefixContent     t_FmPortBufferPrefixContent;
1712 typedef t_FmExtPoolParams           t_FmPortExtPoolParams;
1713 typedef t_FmExtPools                t_FmPortExtPools;
1714 typedef t_FmBackupBmPools           t_FmPortBackupBmPools;
1715 typedef t_FmBufPoolDepletion        t_FmPortBufPoolDepletion;
1716 typedef e_FmDmaSwapOption           e_FmPortDmaSwapOption;
1717 typedef e_FmDmaCacheOption          e_FmPortDmaCacheOption;
1718 
1719 #define FM_CONTEXTA_GET_OVVERIDE    FM_CONTEXTA_GET_OVERRIDE
1720 #define FM_CONTEXTA_SET_OVVERIDE    FM_CONTEXTA_SET_OVERRIDE
1721 
1722 #define e_FM_EX_BMI_PIPELINE_ECC    e_FM_EX_BMI_STORAGE_PROFILE_ECC
1723 #define e_FM_PORT_DMA_NO_SWP        e_FM_DMA_NO_SWP
1724 #define e_FM_PORT_DMA_SWP_PPC_LE    e_FM_DMA_SWP_PPC_LE
1725 #define e_FM_PORT_DMA_SWP_BE        e_FM_DMA_SWP_BE
1726 #define e_FM_PORT_DMA_NO_STASH      e_FM_DMA_NO_STASH
1727 #define e_FM_PORT_DMA_STASH         e_FM_DMA_STASH
1728 #endif /* NCSW_BACKWARD_COMPATIBLE_API */
1729 
1730 
1731 #endif /* __FM_EXT */
1732