summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm_ipc.h
blob: 7ce36a767e253c6d429fd6bcc990ae95a55e8b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
/*
 * Copyright 2008-2012 Freescale Semiconductor Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Freescale Semiconductor nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 *
 * ALTERNATIVELY, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") as published by the Free Software
 * Foundation, either version 2 of that License or (at your option) any
 * later version.
 *
 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


/**************************************************************************//**
 @File          fm_ipc.h

 @Description   FM Inter-Partition prototypes, structures and definitions.
*//***************************************************************************/
#ifndef __FM_IPC_H
#define __FM_IPC_H

#include "error_ext.h"
#include "std_ext.h"


/**************************************************************************//**
 @Group         FM_grp Frame Manager API

 @Description   FM API functions, definitions and enums

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Group         FM_IPC_grp FM Inter-Partition messaging Unit

 @Description   FM Inter-Partition messaging unit API definitions and enums.

 @{
*//***************************************************************************/

#if defined(__MWERKS__) && !defined(__GNUC__)
#pragma pack(push,1)
#endif /* defined(__MWERKS__) && ... */

/**************************************************************************//**
 @Description   enum for defining MAC types
*//***************************************************************************/

/**************************************************************************//**
 @Description   A structure of parameters for specifying a MAC.
*//***************************************************************************/
typedef _Packed struct
{
    uint8_t         id;
    uint32_t        enumType;
} _PackedType t_FmIpcMacParams;

/**************************************************************************//**
 @Description   A structure of parameters for specifying a MAC.
*//***************************************************************************/
typedef _Packed struct
{
    t_FmIpcMacParams    macParams;
    uint16_t            maxFrameLength;
} _PackedType t_FmIpcMacMaxFrameParams;

/**************************************************************************//**
 @Description   FM physical Address
*//***************************************************************************/
typedef _Packed struct t_FmIpcPhysAddr
{
    volatile uint8_t    high;
    volatile uint32_t   low;
} _PackedType t_FmIpcPhysAddr;


typedef _Packed struct t_FmIpcPortOutInitParams {
    uint8_t             numOfTasks;         /**< OUT */
    uint8_t             numOfExtraTasks;    /**< OUT */
    uint8_t             numOfOpenDmas;      /**< OUT */
    uint8_t             numOfExtraOpenDmas; /**< OUT */
    uint32_t            sizeOfFifo;         /**< OUT */
    uint32_t            extraSizeOfFifo;    /**< OUT */
    t_FmIpcPhysAddr     ipcPhysAddr;        /**< OUT */
} _PackedType t_FmIpcPortOutInitParams;

/**************************************************************************//**
 @Description   Structure for IPC communication during FM_PORT_Init.
*//***************************************************************************/
typedef _Packed struct t_FmIpcPortInInitParams {
    uint8_t             hardwarePortId;     /**< IN. port Id */
    uint32_t            enumPortType;       /**< IN. Port type */
    uint8_t             boolIndependentMode;/**< IN. TRUE if FM Port operates in independent mode */
    uint16_t            liodnOffset;        /**< IN. Port's requested resource */
    uint8_t             numOfTasks;         /**< IN. Port's requested resource */
    uint8_t             numOfExtraTasks;    /**< IN. Port's requested resource */
    uint8_t             numOfOpenDmas;      /**< IN. Port's requested resource */
    uint8_t             numOfExtraOpenDmas; /**< IN. Port's requested resource */
    uint32_t            sizeOfFifo;         /**< IN. Port's requested resource */
    uint32_t            extraSizeOfFifo;    /**< IN. Port's requested resource */
    uint8_t             deqPipelineDepth;   /**< IN. Port's requested resource */
    uint16_t            maxFrameLength;     /**< IN. Port's max frame length. */
    uint16_t            liodnBase;          /**< IN. Irrelevant for P4080 rev 1.
                                                 LIODN base for this port, to be
                                                 used together with LIODN offset. */
} _PackedType t_FmIpcPortInInitParams;


/**************************************************************************//**
 @Description   Structure for IPC communication between port and FM
                regarding tasks and open DMA resources management.
*//***************************************************************************/
typedef _Packed struct t_FmIpcPortRsrcParams {
    uint8_t             hardwarePortId;     /**< IN. port Id */
    uint32_t            val;                /**< IN. Port's requested resource */
    uint32_t            extra;              /**< IN. Port's requested resource */
    uint8_t             boolInitialConfig;
} _PackedType t_FmIpcPortRsrcParams;


/**************************************************************************//**
 @Description   Structure for IPC communication between port and FM
                regarding tasks and open DMA resources management.
*//***************************************************************************/
typedef _Packed struct t_FmIpcPortFifoParams {
    t_FmIpcPortRsrcParams   rsrcParams;
    uint32_t                enumPortType;
    uint8_t                 boolIndependentMode;
    uint8_t                 deqPipelineDepth;
    uint8_t                 numOfPools;
    uint16_t                secondLargestBufSize;
    uint16_t                largestBufSize;
    uint8_t                 boolInitialConfig;
} _PackedType t_FmIpcPortFifoParams;

/**************************************************************************//**
 @Description   Structure for port-FM communication during FM_PORT_Free.
*//***************************************************************************/
typedef _Packed struct t_FmIpcPortFreeParams {
    uint8_t             hardwarePortId;         /**< IN. port Id */
    uint32_t            enumPortType;           /**< IN. Port type */
    uint8_t             deqPipelineDepth;       /**< IN. Port's requested resource */
} _PackedType t_FmIpcPortFreeParams;

/**************************************************************************//**
 @Description   Structure for defining DMA status
*//***************************************************************************/
typedef _Packed struct t_FmIpcDmaStatus {
    uint8_t    boolCmqNotEmpty;            /**< Command queue is not empty */
    uint8_t    boolBusError;               /**< Bus error occurred */
    uint8_t    boolReadBufEccError;        /**< Double ECC error on buffer Read */
    uint8_t    boolWriteBufEccSysError;    /**< Double ECC error on buffer write from system side */
    uint8_t    boolWriteBufEccFmError;     /**< Double ECC error on buffer write from FM side */
    uint8_t    boolSinglePortEccError;     /**< Single port ECC error from FM side */
} _PackedType t_FmIpcDmaStatus;

typedef _Packed struct t_FmIpcRegisterIntr
{
    uint8_t         guestId;        /* IN */
    uint32_t        event;          /* IN */
} _PackedType t_FmIpcRegisterIntr;

typedef _Packed struct t_FmIpcIsr
{
    uint8_t         boolErr;        /* IN */
    uint32_t        pendingReg;     /* IN */
} _PackedType t_FmIpcIsr;

/**************************************************************************//**
 @Description   structure for returning FM parameters
*//***************************************************************************/
typedef _Packed struct t_FmIpcParams {
    uint16_t        fmClkFreq;              /**< OUT: FM Clock frequency */
    uint16_t        fmMacClkFreq;           /**< OUT: FM MAC clock frequence */
    uint8_t         majorRev;               /**< OUT: FM Major revision */
    uint8_t         minorRev;               /**< OUT: FM Minor revision */
} _PackedType t_FmIpcParams;


/**************************************************************************//**
 @Description   structure for returning Fman Ctrl Code revision information
*//***************************************************************************/
typedef _Packed struct t_FmIpcFmanCtrlCodeRevisionInfo {
    uint16_t        packageRev;             /**< OUT: Package revision */
    uint8_t         majorRev;               /**< OUT: Major revision */
    uint8_t         minorRev;               /**< OUT: Minor revision */
} _PackedType t_FmIpcFmanCtrlCodeRevisionInfo;

/**************************************************************************//**
 @Description   Structure for defining Fm number of Fman controlers
*//***************************************************************************/
typedef _Packed struct t_FmIpcPortNumOfFmanCtrls {
    uint8_t             hardwarePortId;         /**< IN. port Id */
    uint8_t             numOfFmanCtrls;         /**< IN. Port type */
    t_FmFmanCtrl        orFmanCtrl;             /**< IN. fman controller for order restoration*/
} t_FmIpcPortNumOfFmanCtrls;

/**************************************************************************//**
 @Description   structure for setting Fman contriller events
*//***************************************************************************/
typedef _Packed struct t_FmIpcFmanEvents {
    uint8_t     eventRegId;               /**< IN: Fman controller event register id */
    uint32_t    enableEvents;             /**< IN/OUT: required enabled events mask */
} _PackedType t_FmIpcFmanEvents;

typedef _Packed struct t_FmIpcResourceAllocParams {
    uint8_t     guestId;
    uint16_t    base;
    uint16_t    num;
}_PackedType t_FmIpcResourceAllocParams;

typedef _Packed struct t_FmIpcVspSetPortWindow {
    uint8_t     hardwarePortId;
    uint8_t     baseStorageProfile;
    uint8_t     log2NumOfProfiles;
}_PackedType t_FmIpcVspSetPortWindow;

typedef _Packed struct t_FmIpcSetCongestionGroupPfcPriority {
    uint32_t     congestionGroupId;
    uint8_t      priorityBitMap;
}_PackedType t_FmIpcSetCongestionGroupPfcPriority;

#define FM_IPC_MAX_REPLY_BODY_SIZE  20
#define FM_IPC_MAX_REPLY_SIZE       (FM_IPC_MAX_REPLY_BODY_SIZE + sizeof(uint32_t))
#define FM_IPC_MAX_MSG_SIZE         30

typedef _Packed struct t_FmIpcMsg
{
    uint32_t    msgId;
    uint8_t     msgBody[FM_IPC_MAX_MSG_SIZE];
} _PackedType t_FmIpcMsg;

typedef _Packed struct t_FmIpcReply
{
    uint32_t    error;
    uint8_t     replyBody[FM_IPC_MAX_REPLY_BODY_SIZE];
} _PackedType t_FmIpcReply;

#if defined(__MWERKS__) && !defined(__GNUC__)
#pragma pack(pop)
#endif /* defined(__MWERKS__) && ... */


/***************************************************************************/
/************************ FRONT-END-TO-BACK-END*****************************/
/***************************************************************************/

/**************************************************************************//**
 @Function      FM_GET_TIMESTAMP_SCALE

 @Description   Used by FM front-end.

 @Param[out]    uint32_t Pointer
*//***************************************************************************/
#define FM_GET_TIMESTAMP_SCALE      1

/**************************************************************************//**
 @Function      FM_GET_COUNTER

 @Description   Used by FM front-end.

 @Param[in/out] t_FmIpcGetCounter Pointer
*//***************************************************************************/
#define FM_GET_COUNTER              2

/**************************************************************************//**
 @Function      FM_GET_SET_PORT_PARAMS

 @Description   Used by FM front-end for the PORT module in order to set and get
                parameters in/from master FM module on FM PORT initialization time.

 @Param[in/out] t_FmIcPortInitParams Pointer
*//***************************************************************************/
#define FM_GET_SET_PORT_PARAMS      4

/**************************************************************************//**
 @Function      FM_FREE_PORT

 @Description   Used by FM front-end for the PORT module when a port is freed
                to free all FM PORT resources.

 @Param[in]     uint8_t Pointer
*//***************************************************************************/
#define FM_FREE_PORT                5

/**************************************************************************//**
 @Function      FM_RESET_MAC

 @Description   Used by front-end for the MAC module to reset the MAC registers

 @Param[in]     t_FmIpcMacParams Pointer .
*//***************************************************************************/
#define FM_RESET_MAC                6

/**************************************************************************//**
 @Function      FM_RESUME_STALLED_PORT

 @Description   Used by FM front-end for the PORT module in order to
                release a stalled FM Port.

 @Param[in]     uint8_t Pointer
*//***************************************************************************/
#define FM_RESUME_STALLED_PORT      7

/**************************************************************************//**
 @Function      FM_IS_PORT_STALLED

 @Description   Used by FM front-end for the PORT module in order to check whether
                an FM port is stalled.

 @Param[in/out] t_FmIcPortIsStalled Pointer
*//***************************************************************************/
#define FM_IS_PORT_STALLED          8

/**************************************************************************//**
 @Function      FM_GET_PARAMS

 @Description   Used by FM front-end for the PORT module in order to dump
                return FM parameters.

 @Param[in]     uint8_t Pointer
*//***************************************************************************/
#define FM_GET_PARAMS                  10

/**************************************************************************//**
 @Function      FM_REGISTER_INTR

 @Description   Used by FM front-end to register an interrupt handler to
                be called upon interrupt for guest.

 @Param[out]    t_FmIpcRegisterIntr Pointer
*//***************************************************************************/
#define FM_REGISTER_INTR            11

/**************************************************************************//**
 @Function      FM_DMA_STAT

 @Description   Used by FM front-end to read the FM DMA status.

 @Param[out]    t_FmIpcDmaStatus Pointer
*//***************************************************************************/
#define FM_DMA_STAT                 13

/**************************************************************************//**
 @Function      FM_ALLOC_FMAN_CTRL_EVENT_REG

 @Description   Used by FM front-end to allocate event register.

 @Param[out]    Event register id Pointer
*//***************************************************************************/
#define FM_ALLOC_FMAN_CTRL_EVENT_REG 14

/**************************************************************************//**
 @Function      FM_FREE_FMAN_CTRL_EVENT_REG

 @Description   Used by FM front-end to free locate event register.

 @Param[in]    uint8_t Pointer - Event register id
*//***************************************************************************/
#define FM_FREE_FMAN_CTRL_EVENT_REG 15

/**************************************************************************//**
 @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE

 @Description   Used by FM front-end to enable events in the FPM
                Fman controller event register.

 @Param[in]    t_FmIpcFmanEvents Pointer
*//***************************************************************************/
#define FM_SET_FMAN_CTRL_EVENTS_ENABLE 16

/**************************************************************************//**
 @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE

 @Description   Used by FM front-end to enable events in the FPM
                Fman controller event register.

 @Param[in/out] t_FmIpcFmanEvents Pointer
*//***************************************************************************/
#define FM_GET_FMAN_CTRL_EVENTS_ENABLE 17

/**************************************************************************//**
 @Function      FM_SET_MAC_MAX_FRAME

 @Description   Used by FM front-end to set MAC's MTU/RTU's in
                back-end.

 @Param[in/out] t_FmIpcMacMaxFrameParams Pointer
*//***************************************************************************/
#define FM_SET_MAC_MAX_FRAME 18

/**************************************************************************//**
 @Function      FM_GET_PHYS_MURAM_BASE

 @Description   Used by FM front-end in order to get MURAM base address

 @Param[in/out] t_FmIpcPhysAddr Pointer
*//***************************************************************************/
#define FM_GET_PHYS_MURAM_BASE  19

/**************************************************************************//**
 @Function      FM_MASTER_IS_ALIVE

 @Description   Used by FM front-end in order to verify Master is up

 @Param[in/out] bool
*//***************************************************************************/
#define FM_MASTER_IS_ALIVE          20

#define FM_ENABLE_RAM_ECC           21
#define FM_DISABLE_RAM_ECC          22
#define FM_SET_NUM_OF_FMAN_CTRL     23
#define FM_SET_SIZE_OF_FIFO         24
#define FM_SET_NUM_OF_TASKS         25
#define FM_SET_NUM_OF_OPEN_DMAS     26
#define FM_VSP_ALLOC                27
#define FM_VSP_FREE                 28
#define FM_VSP_SET_PORT_WINDOW      29
#define FM_GET_FMAN_CTRL_CODE_REV   30
#define FM_SET_CONG_GRP_PFC_PRIO    31
#ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
#define FM_10G_TX_ECC_WA            100
#endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */

/***************************************************************************/
/************************ BACK-END-TO-FRONT-END*****************************/
/***************************************************************************/

/**************************************************************************//**
 @Function      FM_GUEST_ISR

 @Description   Used by FM back-end to report an interrupt to the front-end.

 @Param[out]    t_FmIpcIsr Pointer
*//***************************************************************************/
#define FM_GUEST_ISR                1



/** @} */ /* end of FM_IPC_grp group */
/** @} */ /* end of FM_grp group */


#endif /* __FM_IPC_H */