xref: /freebsd/sys/contrib/ncsw/Peripherals/FM/fm_ipc.h (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
1 /*
2  * Copyright 2008-2012 Freescale Semiconductor Inc.
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_ipc.h
36 
37  @Description   FM Inter-Partition prototypes, structures and definitions.
38 *//***************************************************************************/
39 #ifndef __FM_IPC_H
40 #define __FM_IPC_H
41 
42 #include "error_ext.h"
43 #include "std_ext.h"
44 
45 
46 /**************************************************************************//**
47  @Group         FM_grp Frame Manager API
48 
49  @Description   FM API functions, definitions and enums
50 
51  @{
52 *//***************************************************************************/
53 
54 /**************************************************************************//**
55  @Group         FM_IPC_grp FM Inter-Partition messaging Unit
56 
57  @Description   FM Inter-Partition messaging unit API definitions and enums.
58 
59  @{
60 *//***************************************************************************/
61 
62 #if defined(__MWERKS__) && !defined(__GNUC__)
63 #pragma pack(push,1)
64 #endif /* defined(__MWERKS__) && ... */
65 
66 /**************************************************************************//**
67  @Description   enum for defining MAC types
68 *//***************************************************************************/
69 
70 /**************************************************************************//**
71  @Description   A structure of parameters for specifying a MAC.
72 *//***************************************************************************/
73 typedef _Packed struct
74 {
75     uint8_t         id;
76     uint32_t        enumType;
77 } _PackedType t_FmIpcMacParams;
78 
79 /**************************************************************************//**
80  @Description   A structure of parameters for specifying a MAC.
81 *//***************************************************************************/
82 typedef _Packed struct
83 {
84     t_FmIpcMacParams    macParams;
85     uint16_t            maxFrameLength;
86 } _PackedType t_FmIpcMacMaxFrameParams;
87 
88 /**************************************************************************//**
89  @Description   FM physical Address
90 *//***************************************************************************/
91 typedef _Packed struct t_FmIpcPhysAddr
92 {
93     volatile uint8_t    high;
94     volatile uint32_t   low;
95 } _PackedType t_FmIpcPhysAddr;
96 
97 
98 typedef _Packed struct t_FmIpcPortOutInitParams {
99     uint8_t             numOfTasks;         /**< OUT */
100     uint8_t             numOfExtraTasks;    /**< OUT */
101     uint8_t             numOfOpenDmas;      /**< OUT */
102     uint8_t             numOfExtraOpenDmas; /**< OUT */
103     uint32_t            sizeOfFifo;         /**< OUT */
104     uint32_t            extraSizeOfFifo;    /**< OUT */
105     t_FmIpcPhysAddr     ipcPhysAddr;        /**< OUT */
106 } _PackedType t_FmIpcPortOutInitParams;
107 
108 /**************************************************************************//**
109  @Description   Structure for IPC communication during FM_PORT_Init.
110 *//***************************************************************************/
111 typedef _Packed struct t_FmIpcPortInInitParams {
112     uint8_t             hardwarePortId;     /**< IN. port Id */
113     uint32_t            enumPortType;       /**< IN. Port type */
114     uint8_t             boolIndependentMode;/**< IN. TRUE if FM Port operates in independent mode */
115     uint16_t            liodnOffset;        /**< IN. Port's requested resource */
116     uint8_t             numOfTasks;         /**< IN. Port's requested resource */
117     uint8_t             numOfExtraTasks;    /**< IN. Port's requested resource */
118     uint8_t             numOfOpenDmas;      /**< IN. Port's requested resource */
119     uint8_t             numOfExtraOpenDmas; /**< IN. Port's requested resource */
120     uint32_t            sizeOfFifo;         /**< IN. Port's requested resource */
121     uint32_t            extraSizeOfFifo;    /**< IN. Port's requested resource */
122     uint8_t             deqPipelineDepth;   /**< IN. Port's requested resource */
123     uint16_t            maxFrameLength;     /**< IN. Port's max frame length. */
124     uint16_t            liodnBase;          /**< IN. Irrelevant for P4080 rev 1.
125                                                  LIODN base for this port, to be
126                                                  used together with LIODN offset. */
127 } _PackedType t_FmIpcPortInInitParams;
128 
129 
130 /**************************************************************************//**
131  @Description   Structure for IPC communication between port and FM
132                 regarding tasks and open DMA resources management.
133 *//***************************************************************************/
134 typedef _Packed struct t_FmIpcPortRsrcParams {
135     uint8_t             hardwarePortId;     /**< IN. port Id */
136     uint32_t            val;                /**< IN. Port's requested resource */
137     uint32_t            extra;              /**< IN. Port's requested resource */
138     uint8_t             boolInitialConfig;
139 } _PackedType t_FmIpcPortRsrcParams;
140 
141 
142 /**************************************************************************//**
143  @Description   Structure for IPC communication between port and FM
144                 regarding tasks and open DMA resources management.
145 *//***************************************************************************/
146 typedef _Packed struct t_FmIpcPortFifoParams {
147     t_FmIpcPortRsrcParams   rsrcParams;
148     uint32_t                enumPortType;
149     uint8_t                 boolIndependentMode;
150     uint8_t                 deqPipelineDepth;
151     uint8_t                 numOfPools;
152     uint16_t                secondLargestBufSize;
153     uint16_t                largestBufSize;
154     uint8_t                 boolInitialConfig;
155 } _PackedType t_FmIpcPortFifoParams;
156 
157 /**************************************************************************//**
158  @Description   Structure for port-FM communication during FM_PORT_Free.
159 *//***************************************************************************/
160 typedef _Packed struct t_FmIpcPortFreeParams {
161     uint8_t             hardwarePortId;         /**< IN. port Id */
162     uint32_t            enumPortType;           /**< IN. Port type */
163     uint8_t             deqPipelineDepth;       /**< IN. Port's requested resource */
164 } _PackedType t_FmIpcPortFreeParams;
165 
166 /**************************************************************************//**
167  @Description   Structure for defining DMA status
168 *//***************************************************************************/
169 typedef _Packed struct t_FmIpcDmaStatus {
170     uint8_t    boolCmqNotEmpty;            /**< Command queue is not empty */
171     uint8_t    boolBusError;               /**< Bus error occurred */
172     uint8_t    boolReadBufEccError;        /**< Double ECC error on buffer Read */
173     uint8_t    boolWriteBufEccSysError;    /**< Double ECC error on buffer write from system side */
174     uint8_t    boolWriteBufEccFmError;     /**< Double ECC error on buffer write from FM side */
175     uint8_t    boolSinglePortEccError;     /**< Single port ECC error from FM side */
176 } _PackedType t_FmIpcDmaStatus;
177 
178 typedef _Packed struct t_FmIpcRegisterIntr
179 {
180     uint8_t         guestId;        /* IN */
181     uint32_t        event;          /* IN */
182 } _PackedType t_FmIpcRegisterIntr;
183 
184 typedef _Packed struct t_FmIpcIsr
185 {
186     uint8_t         boolErr;        /* IN */
187     uint32_t        pendingReg;     /* IN */
188 } _PackedType t_FmIpcIsr;
189 
190 /**************************************************************************//**
191  @Description   structure for returning FM parameters
192 *//***************************************************************************/
193 typedef _Packed struct t_FmIpcParams {
194     uint16_t        fmClkFreq;              /**< OUT: FM Clock frequency */
195     uint16_t        fmMacClkFreq;           /**< OUT: FM MAC clock frequence */
196     uint8_t         majorRev;               /**< OUT: FM Major revision */
197     uint8_t         minorRev;               /**< OUT: FM Minor revision */
198 } _PackedType t_FmIpcParams;
199 
200 
201 /**************************************************************************//**
202  @Description   structure for returning Fman Ctrl Code revision information
203 *//***************************************************************************/
204 typedef _Packed struct t_FmIpcFmanCtrlCodeRevisionInfo {
205     uint16_t        packageRev;             /**< OUT: Package revision */
206     uint8_t         majorRev;               /**< OUT: Major revision */
207     uint8_t         minorRev;               /**< OUT: Minor revision */
208 } _PackedType t_FmIpcFmanCtrlCodeRevisionInfo;
209 
210 /**************************************************************************//**
211  @Description   Structure for defining Fm number of Fman controlers
212 *//***************************************************************************/
213 typedef _Packed struct t_FmIpcPortNumOfFmanCtrls {
214     uint8_t             hardwarePortId;         /**< IN. port Id */
215     uint8_t             numOfFmanCtrls;         /**< IN. Port type */
216     t_FmFmanCtrl        orFmanCtrl;             /**< IN. fman controller for order restoration*/
217 } t_FmIpcPortNumOfFmanCtrls;
218 
219 /**************************************************************************//**
220  @Description   structure for setting Fman contriller events
221 *//***************************************************************************/
222 typedef _Packed struct t_FmIpcFmanEvents {
223     uint8_t     eventRegId;               /**< IN: Fman controller event register id */
224     uint32_t    enableEvents;             /**< IN/OUT: required enabled events mask */
225 } _PackedType t_FmIpcFmanEvents;
226 
227 typedef _Packed struct t_FmIpcResourceAllocParams {
228     uint8_t     guestId;
229     uint16_t    base;
230     uint16_t    num;
231 }_PackedType t_FmIpcResourceAllocParams;
232 
233 typedef _Packed struct t_FmIpcVspSetPortWindow {
234     uint8_t     hardwarePortId;
235     uint8_t     baseStorageProfile;
236     uint8_t     log2NumOfProfiles;
237 }_PackedType t_FmIpcVspSetPortWindow;
238 
239 typedef _Packed struct t_FmIpcSetCongestionGroupPfcPriority {
240     uint32_t     congestionGroupId;
241     uint8_t      priorityBitMap;
242 }_PackedType t_FmIpcSetCongestionGroupPfcPriority;
243 
244 #define FM_IPC_MAX_REPLY_BODY_SIZE  20
245 #define FM_IPC_MAX_REPLY_SIZE       (FM_IPC_MAX_REPLY_BODY_SIZE + sizeof(uint32_t))
246 #define FM_IPC_MAX_MSG_SIZE         30
247 
248 typedef _Packed struct t_FmIpcMsg
249 {
250     uint32_t    msgId;
251     uint8_t     msgBody[FM_IPC_MAX_MSG_SIZE];
252 } _PackedType t_FmIpcMsg;
253 
254 typedef _Packed struct t_FmIpcReply
255 {
256     uint32_t    error;
257     uint8_t     replyBody[FM_IPC_MAX_REPLY_BODY_SIZE];
258 } _PackedType t_FmIpcReply;
259 
260 #if defined(__MWERKS__) && !defined(__GNUC__)
261 #pragma pack(pop)
262 #endif /* defined(__MWERKS__) && ... */
263 
264 
265 /***************************************************************************/
266 /************************ FRONT-END-TO-BACK-END*****************************/
267 /***************************************************************************/
268 
269 /**************************************************************************//**
270  @Function      FM_GET_TIMESTAMP_SCALE
271 
272  @Description   Used by FM front-end.
273 
274  @Param[out]    uint32_t Pointer
275 *//***************************************************************************/
276 #define FM_GET_TIMESTAMP_SCALE      1
277 
278 /**************************************************************************//**
279  @Function      FM_GET_COUNTER
280 
281  @Description   Used by FM front-end.
282 
283  @Param[in/out] t_FmIpcGetCounter Pointer
284 *//***************************************************************************/
285 #define FM_GET_COUNTER              2
286 
287 /**************************************************************************//**
288  @Function      FM_GET_SET_PORT_PARAMS
289 
290  @Description   Used by FM front-end for the PORT module in order to set and get
291                 parameters in/from master FM module on FM PORT initialization time.
292 
293  @Param[in/out] t_FmIcPortInitParams Pointer
294 *//***************************************************************************/
295 #define FM_GET_SET_PORT_PARAMS      4
296 
297 /**************************************************************************//**
298  @Function      FM_FREE_PORT
299 
300  @Description   Used by FM front-end for the PORT module when a port is freed
301                 to free all FM PORT resources.
302 
303  @Param[in]     uint8_t Pointer
304 *//***************************************************************************/
305 #define FM_FREE_PORT                5
306 
307 /**************************************************************************//**
308  @Function      FM_RESET_MAC
309 
310  @Description   Used by front-end for the MAC module to reset the MAC registers
311 
312  @Param[in]     t_FmIpcMacParams Pointer .
313 *//***************************************************************************/
314 #define FM_RESET_MAC                6
315 
316 /**************************************************************************//**
317  @Function      FM_RESUME_STALLED_PORT
318 
319  @Description   Used by FM front-end for the PORT module in order to
320                 release a stalled FM Port.
321 
322  @Param[in]     uint8_t Pointer
323 *//***************************************************************************/
324 #define FM_RESUME_STALLED_PORT      7
325 
326 /**************************************************************************//**
327  @Function      FM_IS_PORT_STALLED
328 
329  @Description   Used by FM front-end for the PORT module in order to check whether
330                 an FM port is stalled.
331 
332  @Param[in/out] t_FmIcPortIsStalled Pointer
333 *//***************************************************************************/
334 #define FM_IS_PORT_STALLED          8
335 
336 /**************************************************************************//**
337  @Function      FM_GET_PARAMS
338 
339  @Description   Used by FM front-end for the PORT module in order to dump
340                 return FM parameters.
341 
342  @Param[in]     uint8_t Pointer
343 *//***************************************************************************/
344 #define FM_GET_PARAMS                  10
345 
346 /**************************************************************************//**
347  @Function      FM_REGISTER_INTR
348 
349  @Description   Used by FM front-end to register an interrupt handler to
350                 be called upon interrupt for guest.
351 
352  @Param[out]    t_FmIpcRegisterIntr Pointer
353 *//***************************************************************************/
354 #define FM_REGISTER_INTR            11
355 
356 /**************************************************************************//**
357  @Function      FM_DMA_STAT
358 
359  @Description   Used by FM front-end to read the FM DMA status.
360 
361  @Param[out]    t_FmIpcDmaStatus Pointer
362 *//***************************************************************************/
363 #define FM_DMA_STAT                 13
364 
365 /**************************************************************************//**
366  @Function      FM_ALLOC_FMAN_CTRL_EVENT_REG
367 
368  @Description   Used by FM front-end to allocate event register.
369 
370  @Param[out]    Event register id Pointer
371 *//***************************************************************************/
372 #define FM_ALLOC_FMAN_CTRL_EVENT_REG 14
373 
374 /**************************************************************************//**
375  @Function      FM_FREE_FMAN_CTRL_EVENT_REG
376 
377  @Description   Used by FM front-end to free locate event register.
378 
379  @Param[in]    uint8_t Pointer - Event register id
380 *//***************************************************************************/
381 #define FM_FREE_FMAN_CTRL_EVENT_REG 15
382 
383 /**************************************************************************//**
384  @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE
385 
386  @Description   Used by FM front-end to enable events in the FPM
387                 Fman controller event register.
388 
389  @Param[in]    t_FmIpcFmanEvents Pointer
390 *//***************************************************************************/
391 #define FM_SET_FMAN_CTRL_EVENTS_ENABLE 16
392 
393 /**************************************************************************//**
394  @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE
395 
396  @Description   Used by FM front-end to enable events in the FPM
397                 Fman controller event register.
398 
399  @Param[in/out] t_FmIpcFmanEvents Pointer
400 *//***************************************************************************/
401 #define FM_GET_FMAN_CTRL_EVENTS_ENABLE 17
402 
403 /**************************************************************************//**
404  @Function      FM_SET_MAC_MAX_FRAME
405 
406  @Description   Used by FM front-end to set MAC's MTU/RTU's in
407                 back-end.
408 
409  @Param[in/out] t_FmIpcMacMaxFrameParams Pointer
410 *//***************************************************************************/
411 #define FM_SET_MAC_MAX_FRAME 18
412 
413 /**************************************************************************//**
414  @Function      FM_GET_PHYS_MURAM_BASE
415 
416  @Description   Used by FM front-end in order to get MURAM base address
417 
418  @Param[in/out] t_FmIpcPhysAddr Pointer
419 *//***************************************************************************/
420 #define FM_GET_PHYS_MURAM_BASE  19
421 
422 /**************************************************************************//**
423  @Function      FM_MASTER_IS_ALIVE
424 
425  @Description   Used by FM front-end in order to verify Master is up
426 
427  @Param[in/out] bool
428 *//***************************************************************************/
429 #define FM_MASTER_IS_ALIVE          20
430 
431 #define FM_ENABLE_RAM_ECC           21
432 #define FM_DISABLE_RAM_ECC          22
433 #define FM_SET_NUM_OF_FMAN_CTRL     23
434 #define FM_SET_SIZE_OF_FIFO         24
435 #define FM_SET_NUM_OF_TASKS         25
436 #define FM_SET_NUM_OF_OPEN_DMAS     26
437 #define FM_VSP_ALLOC                27
438 #define FM_VSP_FREE                 28
439 #define FM_VSP_SET_PORT_WINDOW      29
440 #define FM_GET_FMAN_CTRL_CODE_REV   30
441 #define FM_SET_CONG_GRP_PFC_PRIO    31
442 #ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
443 #define FM_10G_TX_ECC_WA            100
444 #endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */
445 
446 /***************************************************************************/
447 /************************ BACK-END-TO-FRONT-END*****************************/
448 /***************************************************************************/
449 
450 /**************************************************************************//**
451  @Function      FM_GUEST_ISR
452 
453  @Description   Used by FM back-end to report an interrupt to the front-end.
454 
455  @Param[out]    t_FmIpcIsr Pointer
456 *//***************************************************************************/
457 #define FM_GUEST_ISR                1
458 
459 
460 
461 /** @} */ /* end of FM_IPC_grp group */
462 /** @} */ /* end of FM_grp group */
463 
464 
465 #endif /* __FM_IPC_H */
466