1 /* Copyright (c) 2008-2012 Freescale Semiconductor, Inc
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.
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
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.
34 /**************************************************************************//**
37 @Description FM Application Programming Interface.
38 *//***************************************************************************/
42 #include "error_ext.h"
45 #include "fsl_fman_sp.h"
47 /**************************************************************************//**
48 @Group FM_grp Frame Manager API
50 @Description FM API functions, definitions and enums.
53 *//***************************************************************************/
55 /**************************************************************************//**
56 @Group FM_lib_grp FM library
58 @Description FM API functions, definitions and enums.
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!
70 *//***************************************************************************/
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 */
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 */
92 #if defined(__MWERKS__) && !defined(__GNUC__)
94 #endif /* defined(__MWERKS__) && ... */
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;
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;
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 */
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 */
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 */
158 #define FM_FD_IPR 0x00000001 /**< IPR frame (not error) */
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 */
164 #ifdef FM_CAPWAP_SUPPORT
165 #define FM_FD_ERR_CRE 0x00200000
166 #define FM_FD_ERR_CHE 0x00100000
167 #endif /* FM_CAPWAP_SUPPORT */
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 */
186 #define FM_FD_TX_STATUS_ERR_MASK (FM_FD_ERR_UNSUPPORTED_FORMAT | \
188 FM_FD_ERR_DMA) /**< TX Error FD bits */
190 #define FM_FD_RX_STATUS_ERR_MASK (FM_FD_ERR_UNSUPPORTED_FORMAT | \
195 FM_FD_ERR_IPR_NCSP | \
196 FM_FD_ERR_PHYSICAL | \
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 */
211 #define FM_FD_RX_STATUS_ERR_NON_FM 0x00400000 /**< non Frame-Manager error */
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;
222 /**************************************************************************//**
223 @Description Context B
224 *//***************************************************************************/
225 typedef uint32_t t_FmContextB;
227 /**************************************************************************//**
228 @Collection Special Operation options
229 *//***************************************************************************/
230 typedef uint32_t fmSpecialOperations_t; /**< typedef for defining Special Operation options */
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 */
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
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))
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) ))
275 /**************************************************************************//**
276 @Collection Context B macros
277 *//***************************************************************************/
278 #define FM_CONTEXTB_FQID_MASK 0x00ffffff
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)))
284 #if defined(__MWERKS__) && !defined(__GNUC__)
286 #endif /* defined(__MWERKS__) && ... */
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*/
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 */
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;
332 /**************************************************************************//**
333 @Group FM_init_grp FM Initialization Unit
335 @Description FM Initialization Unit
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.
345 *//***************************************************************************/
347 /**************************************************************************//**
348 @Function t_FmExceptionsCallback
350 @Description Exceptions user callback routine, will be called upon an
351 exception passing the exception identification.
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);
360 /**************************************************************************//**
361 @Function t_FmBusErrorCallback
363 @Description Bus error user callback routine, will be called upon a
364 bus error, passing parameters describing the errors and the owner.
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,
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;
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 */
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
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 */
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.*/
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;
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;
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". */
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) */
515 /**************************************************************************//**
518 @Description Creates the FM module and returns its handle (descriptor).
519 This descriptor must be passed as first parameter to all other
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.
526 @Param[in] p_FmParams - A pointer to a data structure of mandatory FM parameters
528 @Return A handle to the FM object, or NULL for Failure.
529 *//***************************************************************************/
530 t_Handle FM_Config(t_FmParams *p_FmParams);
532 /**************************************************************************//**
535 @Description Initializes the FM module by defining the software structure
536 and configuring the hardware registers.
538 @Param[in] h_Fm - FM module descriptor
540 @Return E_OK on success; Error code otherwise.
541 *//***************************************************************************/
542 t_Error FM_Init(t_Handle h_Fm);
544 /**************************************************************************//**
547 @Description Frees all resources that were assigned to FM module.
549 Calling this routine invalidates the descriptor.
551 @Param[in] h_Fm - FM module descriptor
553 @Return E_OK on success; Error code otherwise.
554 *//***************************************************************************/
555 t_Error FM_Free(t_Handle h_Fm);
558 /**************************************************************************//**
559 @Group FM_advanced_init_grp FM Advanced Configuration Unit
561 @Description Advanced configuration routines are optional routines that may
562 be called in order to change the default driver settings.
564 Note: Advanced configuration routines are not available for guest partition.
566 *//***************************************************************************/
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. */
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;
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 */
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 */
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;
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 */
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;
635 /**************************************************************************//**
636 @Collection Enum for selecting DMA Emergency options
637 *//***************************************************************************/
638 typedef uint32_t fmEmergencyBus_t; /**< DMA emergency options */
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 */
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
651 e_FmDmaEmergencyLevel emergencyLevel; /**< EBS/SOS */
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
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*/
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) */
689 /**************************************************************************//**
690 @Function t_FmResetOnInitOverrideCallback
692 @Description FMan specific reset on init user callback routine,
693 will be used to override the standard FMan reset on init procedure
695 @Param[in] h_Fm - FMan handler
696 *//***************************************************************************/
697 typedef void (t_FmResetOnInitOverrideCallback)(t_Handle h_Fm);
699 /**************************************************************************//**
700 @Function FM_ConfigResetOnInit
702 @Description Define whether to reset the FM before initialization.
703 Change the default configuration [DEFAULT_resetOnInit].
705 @Param[in] h_Fm A handle to an FM Module.
706 @Param[in] enable When TRUE, FM will be reset before any initialization.
708 @Return E_OK on success; Error code otherwise.
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);
716 /**************************************************************************//**
717 @Function FM_ConfigResetOnInitOverrideCallback
719 @Description Define a special reset of FM before initialization.
720 Change the default configuration [DEFAULT_resetOnInitOverrideCallback].
722 @Param[in] h_Fm A handle to an FM Module.
723 @Param[in] f_ResetOnInitOverride FM specific reset on init user callback routine.
725 @Return E_OK on success; Error code otherwise.
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);
733 /**************************************************************************//**
734 @Function FM_ConfigTotalFifoSize
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]
740 @Param[in] h_Fm A handle to an FM Module.
741 @Param[in] totalFifoSize The selected new value.
743 @Return E_OK on success; Error code otherwise.
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);
751 /**************************************************************************//**
752 @Function FM_ConfigDmaCacheOverride
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]
758 @Param[in] h_Fm A handle to an FM Module.
759 @Param[in] cacheOverride The selected new value.
761 @Return E_OK on success; Error code otherwise.
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);
769 /**************************************************************************//**
770 @Function FM_ConfigDmaAidOverride
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]
776 @Param[in] h_Fm A handle to an FM Module.
777 @Param[in] aidOverride The selected new value.
779 @Return E_OK on success; Error code otherwise.
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);
787 /**************************************************************************//**
788 @Function FM_ConfigDmaAidMode
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]
794 @Param[in] h_Fm A handle to an FM Module.
795 @Param[in] aidMode The selected new value.
797 @Return E_OK on success; Error code otherwise.
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);
805 /**************************************************************************//**
806 @Function FM_ConfigDmaAxiDbgNumOfBeats
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]
812 @Param[in] h_Fm A handle to an FM Module.
813 @Param[in] axiDbgNumOfBeats The selected new value.
815 @Return E_OK on success; Error code otherwise.
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);
823 /**************************************************************************//**
824 @Function FM_ConfigDmaCamNumOfEntries
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].
830 @Param[in] h_Fm A handle to an FM Module.
831 @Param[in] numOfEntries The selected new value.
833 @Return E_OK on success; Error code otherwise.
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);
841 /**************************************************************************//**
842 @Function FM_ConfigEnableCounters
844 @Description Obsolete, always return E_OK.
846 @Param[in] h_Fm A handle to an FM Module.
848 @Return E_OK on success; Error code otherwise.
849 *//***************************************************************************/
850 t_Error FM_ConfigEnableCounters(t_Handle h_Fm);
852 /**************************************************************************//**
853 @Function FM_ConfigDmaDbgCounter
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].
859 @Param[in] h_Fm A handle to an FM Module.
860 @Param[in] fmDmaDbgCntMode An enum selecting the debug counter mode.
862 @Return E_OK on success; Error code otherwise.
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);
870 /**************************************************************************//**
871 @Function FM_ConfigDmaStopOnBusErr
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].
878 @Param[in] h_Fm A handle to an FM Module.
879 @Param[in] stop TRUE to stop on bus error, FALSE to continue.
881 @Return E_OK on success; Error code otherwise.
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);
890 /**************************************************************************//**
891 @Function FM_ConfigDmaEmergency
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.
898 @Param[in] h_Fm A handle to an FM Module.
899 @Param[in] p_Emergency An OR mask of all required options.
901 @Return E_OK on success; Error code otherwise.
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);
909 /**************************************************************************//**
910 @Function FM_ConfigDmaErr
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].
917 @Param[in] h_Fm A handle to an FM Module.
918 @Param[in] dmaErr The selected new choice.
920 @Return E_OK on success; Error code otherwise.
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);
928 /**************************************************************************//**
929 @Function FM_ConfigCatastrophicErr
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].
936 @Param[in] h_Fm A handle to an FM Module.
937 @Param[in] catastrophicErr The selected new choice.
939 @Return E_OK on success; Error code otherwise.
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);
947 /**************************************************************************//**
948 @Function FM_ConfigEnableMuramTestMode
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).
955 @Param[in] h_Fm A handle to an FM Module.
957 @Return E_OK on success; Error code otherwise.
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);
965 /**************************************************************************//**
966 @Function FM_ConfigEnableIramTestMode
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).
973 @Param[in] h_Fm A handle to an FM Module.
975 @Return E_OK on success; Error code otherwise.
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);
983 /**************************************************************************//**
984 @Function FM_ConfigHaltOnExternalActivation
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].
991 @Param[in] h_Fm A handle to an FM Module.
992 @Param[in] enable TRUE to enable halt on external halt
995 @Return E_OK on success; Error code otherwise.
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);
1003 /**************************************************************************//**
1004 @Function FM_ConfigHaltOnUnrecoverableEccError
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).
1012 @Param[in] h_Fm A handle to an FM Module.
1013 @Param[in] enable TRUE to enable halt on unrecoverable Ecc error
1015 @Return E_OK on success; Error code otherwise.
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);
1023 /**************************************************************************//**
1024 @Function FM_ConfigException
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.
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.
1034 @Return E_OK on success; Error code otherwise.
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);
1042 /**************************************************************************//**
1043 @Function FM_ConfigExternalEccRamsEnable
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.
1051 @Param[in] h_Fm A handle to an FM Module.
1052 @Param[in] enable TRUE to enable this option.
1054 @Return E_OK on success; Error code otherwise.
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);
1062 /**************************************************************************//**
1063 @Function FM_ConfigTnumAgingPeriod
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].
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
1076 @Return E_OK on success; Error code otherwise.
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
1083 *//***************************************************************************/
1084 t_Error FM_ConfigTnumAgingPeriod(t_Handle h_Fm, uint16_t tnumAgingPeriod);
1086 /**************************************************************************//*
1087 @Function FM_ConfigDmaEmergencySmoother
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.
1095 @Param[in] h_Fm A handle to an FM Module.
1096 @Param[in] emergencyCnt emergency switching counter.
1098 @Return E_OK on success; Error code otherwise.
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);
1106 /**************************************************************************//*
1107 @Function FM_ConfigThresholds
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]
1122 @Param[in] h_Fm A handle to an FM Module.
1123 @Param[in] p_FmThresholds A structure of threshold parameters.
1125 @Return E_OK on success; Error code otherwise.
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);
1133 /**************************************************************************//*
1134 @Function FM_ConfigDmaSosEmergencyThreshold
1136 @Description Calling this routine changes the internal driver data base
1137 from its default dma SOS emergency configuration [DEFAULT_dmaSosEmergency]
1139 @Param[in] h_Fm A handle to an FM Module.
1140 @Param[in] dmaSosEmergency The selected new value.
1142 @Return E_OK on success; Error code otherwise.
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);
1150 /**************************************************************************//*
1151 @Function FM_ConfigDmaWriteBufThresholds
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).
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.
1164 @Return E_OK on success; Error code otherwise.
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);
1172 /**************************************************************************//*
1173 @Function FM_ConfigDmaCommQThresholds
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]
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..
1185 @Return E_OK on success; Error code otherwise.
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);
1193 /**************************************************************************//*
1194 @Function FM_ConfigDmaReadBufThresholds
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).
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..
1207 @Return E_OK on success; Error code otherwise.
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);
1215 /**************************************************************************//*
1216 @Function FM_ConfigDmaWatchdog
1218 @Description Calling this routine changes the internal driver data base
1219 from its default watchdog configuration, which is disabled
1220 [DEFAULT_dmaWatchdog].
1222 @Param[in] h_Fm A handle to an FM Module.
1223 @Param[in] watchDogValue The selected new value - in microseconds.
1225 @Return E_OK on success; Error code otherwise.
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);
1233 /** @} */ /* end of FM_advanced_init_grp group */
1234 /** @} */ /* end of FM_init_grp group */
1237 /**************************************************************************//**
1238 @Group FM_runtime_control_grp FM Runtime Control Unit
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.
1249 *//***************************************************************************/
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 */
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;
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
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;
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 */
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 */
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 */
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;
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)*/
1338 /**************************************************************************//**
1339 @Description A Structure for obtaining FM controller monitor values
1340 *//***************************************************************************/
1341 typedef struct t_FmCtrlMon {
1342 uint8_t percentCnt[2]; /**< Percentage value */
1346 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1347 /**************************************************************************//**
1348 @Function FM_DumpRegs
1350 @Description Dumps all FM registers
1352 @Param[in] h_Fm A handle to an FM Module.
1354 @Return E_OK on success;
1356 @Cautions Allowed only following FM_Init().
1357 *//***************************************************************************/
1358 t_Error FM_DumpRegs(t_Handle h_Fm);
1359 #endif /* (defined(DEBUG_ERRORS) && ... */
1361 /**************************************************************************//**
1362 @Function FM_SetException
1364 @Description Calling this routine enables/disables the specified exception.
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.
1370 @Return E_OK on success; Error code otherwise.
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);
1378 /**************************************************************************//**
1379 @Function FM_EnableRamsEcc
1381 @Description Enables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1382 MURAM, Parser, Keygen, Policer, etc.
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
1389 @Param[in] h_Fm A handle to an FM Module.
1391 @Return E_OK on success; Error code otherwise.
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);
1399 /**************************************************************************//**
1400 @Function FM_DisableRamsEcc
1402 @Description Disables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1403 MURAM, Parser, Keygen, Policer, etc.
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.
1410 @Param[in] h_Fm A handle to an FM Module.
1412 @Return E_OK on success; Error code otherwise.
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);
1420 /**************************************************************************//**
1421 @Function FM_GetRevision
1423 @Description Returns the FM revision
1425 @Param[in] h_Fm A handle to an FM Module.
1426 @Param[out] p_FmRevisionInfo A structure of revision information parameters.
1428 @Return E_OK on success; Error code otherwise.
1430 @Cautions Allowed only following FM_Init().
1431 *//***************************************************************************/
1432 t_Error FM_GetRevision(t_Handle h_Fm, t_FmRevisionInfo *p_FmRevisionInfo);
1434 /**************************************************************************//**
1435 @Function FM_GetFmanCtrlCodeRevision
1437 @Description Returns the Fman controller code revision
1439 @Param[in] h_Fm A handle to an FM Module.
1440 @Param[out] p_RevisionInfo A structure of revision information parameters.
1442 @Return E_OK on success; Error code otherwise.
1444 @Cautions Allowed only following FM_Init().
1445 *//***************************************************************************/
1446 t_Error FM_GetFmanCtrlCodeRevision(t_Handle h_Fm, t_FmCtrlCodeRevisionInfo *p_RevisionInfo);
1448 /**************************************************************************//**
1449 @Function FM_GetCounter
1451 @Description Reads one of the FM counters.
1453 @Param[in] h_Fm A handle to an FM Module.
1454 @Param[in] counter The requested counter.
1456 @Return Counter's current value.
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);
1465 /**************************************************************************//**
1466 @Function FM_ModifyCounter
1468 @Description Sets a value to an enabled counter. Use "0" to reset the counter.
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.
1474 @Return E_OK on success; Error code otherwise.
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);
1482 /**************************************************************************//**
1485 @Description Release FM after halt FM command or after unrecoverable ECC error.
1487 @Param[in] h_Fm A handle to an FM Module.
1489 @Return E_OK on success; Error code otherwise.
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);
1497 /**************************************************************************//**
1498 @Function FM_SetDmaEmergency
1500 @Description Manual emergency set
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.
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);
1514 /**************************************************************************//**
1515 @Function FM_SetDmaExtBusPri
1517 @Description Set the DMA external bus priority
1519 @Param[in] h_Fm A handle to an FM Module.
1520 @Param[in] pri External bus priority select
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);
1530 /**************************************************************************//**
1531 @Function FM_GetDmaStatus
1533 @Description Reads the DMA current status
1535 @Param[in] h_Fm A handle to an FM Module.
1536 @Param[out] p_FmDmaStatus A structure of DMA status parameters.
1538 @Cautions Allowed only following FM_Init().
1539 *//***************************************************************************/
1540 void FM_GetDmaStatus(t_Handle h_Fm, t_FmDmaStatus *p_FmDmaStatus);
1542 /**************************************************************************//**
1543 @Function FM_ErrorIsr
1545 @Description FM interrupt-service-routine for errors.
1547 @Param[in] h_Fm A handle to an FM Module.
1549 @Return E_OK on success; E_EMPTY if no errors found in register, other
1550 error code otherwise.
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);
1558 /**************************************************************************//**
1559 @Function FM_EventIsr
1561 @Description FM interrupt-service-routine for normal events.
1563 @Param[in] h_Fm A handle to an FM Module.
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);
1571 /**************************************************************************//**
1572 @Function FM_GetSpecialOperationCoding
1574 @Description Return a specific coding according to the input mask.
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.
1580 @Return E_OK on success; Error code otherwise.
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);
1588 /**************************************************************************//**
1589 @Function FM_CtrlMonStart
1591 @Description Start monitoring utilization of all available FM controllers.
1593 In order to obtain FM controllers utilization the following sequence
1595 -# FM_CtrlMonStart()
1597 -# FM_CtrlMonGetCounters() - issued for each FM controller
1599 @Param[in] h_Fm A handle to an FM Module.
1601 @Return E_OK on success; Error code otherwise.
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);
1609 /**************************************************************************//**
1610 @Function FM_CtrlMonStop
1612 @Description Stop monitoring utilization of all available FM controllers.
1614 In order to obtain FM controllers utilization the following sequence
1616 -# FM_CtrlMonStart()
1618 -# FM_CtrlMonGetCounters() - issued for each FM controller
1620 @Param[in] h_Fm A handle to an FM Module.
1622 @Return E_OK on success; Error code otherwise.
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);
1630 /**************************************************************************//**
1631 @Function FM_CtrlMonGetCounters
1633 @Description Obtain FM controller utilization parameters.
1635 In order to obtain FM controllers utilization the following sequence
1637 -# FM_CtrlMonStart()
1639 -# FM_CtrlMonGetCounters() - issued for each FM controller
1641 @Param[in] h_Fm A handle to an FM Module.
1642 @Param[in] fmCtrlIndex FM Controller index for that utilization results
1644 @Param[in] p_Mon Pointer to utilization results structure.
1646 @Return E_OK on success; Error code otherwise.
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);
1655 /**************************************************************************//*
1656 @Function FM_ForceIntr
1658 @Description Causes an interrupt event on the requested source.
1660 @Param[in] h_Fm A handle to an FM Module.
1661 @Param[in] exception An exception to be forced.
1663 @Return E_OK on success; Error code if the exception is not enabled,
1664 or is not able to create interrupt.
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);
1672 /**************************************************************************//*
1673 @Function FM_SetPortsBandwidth
1675 @Description Sets relative weights between ports when accessing common resources.
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.
1681 @Return E_OK on success; Error code otherwise.
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);
1689 /**************************************************************************//*
1690 @Function FM_GetMuramHandle
1692 @Description Gets the corresponding MURAM handle
1694 @Param[in] h_Fm A handle to an FM Module.
1696 @Return MURAM handle; NULL otherwise.
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);
1704 /** @} */ /* end of FM_runtime_control_grp group */
1705 /** @} */ /* end of FM_lib_grp group */
1706 /** @} */ /* end of FM_grp group */
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;
1719 #define FM_CONTEXTA_GET_OVVERIDE FM_CONTEXTA_GET_OVERRIDE
1720 #define FM_CONTEXTA_SET_OVVERIDE FM_CONTEXTA_SET_OVERRIDE
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 */
1731 #endif /* __FM_EXT */