xref: /freebsd/sys/contrib/ncsw/Peripherals/FM/fm_ipc.h (revision acc1a9ef)
1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /**************************************************************************//**
34  @File          fm_ipc.h
35 
36  @Description   FM Inter-Partition prototypes, structures and definitions.
37 *//***************************************************************************/
38 #ifndef __FM_IPC_H
39 #define __FM_IPC_H
40 
41 #include "error_ext.h"
42 #include "std_ext.h"
43 
44 
45 /**************************************************************************//**
46  @Group         FM_grp Frame Manager API
47 
48  @Description   FM API functions, definitions and enums
49 
50  @{
51 *//***************************************************************************/
52 
53 /**************************************************************************//**
54  @Group         FM_IPC_grp FM Inter-Partition messaging Unit
55 
56  @Description   FM Inter-Partition messaging unit API definitions and enums.
57 
58  @{
59 *//***************************************************************************/
60 
61 #if defined(__MWERKS__) && !defined(__GNUC__)
62 #pragma pack(push,1)
63 #endif /* defined(__MWERKS__) && ... */
64 #define MEM_MAP_START
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  @Description   Structure for IPC communication during FM_PORT_Init.
99 *//***************************************************************************/
100 typedef _Packed struct t_FmIpcPortInInitParams {
101     uint8_t             hardwarePortId;     /**< IN. port Id */
102     uint32_t            enumPortType;       /**< IN. Port type */
103     uint8_t             boolIndependentMode;/**< IN. TRUE if FM Port operates in independent mode */
104     uint16_t            liodnOffset;        /**< IN. Port's requested resource */
105     uint8_t             numOfTasks;         /**< IN. Port's requested resource */
106     uint8_t             numOfExtraTasks;    /**< IN. Port's requested resource */
107     uint8_t             numOfOpenDmas;      /**< IN. Port's requested resource */
108     uint8_t             numOfExtraOpenDmas; /**< IN. Port's requested resource */
109     uint32_t            sizeOfFifo;         /**< IN. Port's requested resource */
110     uint32_t            extraSizeOfFifo;    /**< IN. Port's requested resource */
111     uint8_t             deqPipelineDepth;   /**< IN. Port's requested resource */
112     uint16_t            liodnBase;          /**< IN. Irrelevant for P4080 rev 1.
113                                                  LIODN base for this port, to be
114                                                  used together with LIODN offset. */
115 } _PackedType t_FmIpcPortInInitParams;
116 
117 
118 /**************************************************************************//**
119  @Description   Structure for IPC communication between port and FM
120                 regarding tasks and open DMA resources management.
121 *//***************************************************************************/
122 typedef _Packed struct t_FmIpcPortRsrcParams {
123     uint8_t             hardwarePortId;     /**< IN. port Id */
124     uint32_t            val;                /**< IN. Port's requested resource */
125     uint32_t            extra;              /**< IN. Port's requested resource */
126     uint8_t             boolInitialConfig;
127 } _PackedType t_FmIpcPortRsrcParams;
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_FmIpcPortFifoParams {
135     t_FmIpcPortRsrcParams   rsrcParams;
136     uint32_t                enumPortType;
137     uint8_t                 boolIndependentMode;
138     uint8_t                 deqPipelineDepth;
139     uint8_t                 numOfPools;
140     uint16_t                secondLargestBufSize;
141     uint16_t                largestBufSize;
142     uint8_t                 boolInitialConfig;
143 } _PackedType t_FmIpcPortFifoParams;
144 
145 /**************************************************************************//**
146  @Description   Structure for port-FM communication during FM_PORT_Free.
147 *//***************************************************************************/
148 typedef _Packed struct t_FmIpcPortFreeParams {
149     uint8_t             hardwarePortId;         /**< IN. port Id */
150     uint32_t            enumPortType;           /**< IN. Port type */
151 #ifdef FM_QMI_DEQ_OPTIONS_SUPPORT
152     uint8_t             deqPipelineDepth;       /**< IN. Port's requested resource */
153 #endif /* FM_QMI_DEQ_OPTIONS_SUPPORT */
154 } _PackedType t_FmIpcPortFreeParams;
155 
156 /**************************************************************************//**
157  @Description   Structure for defining DMA status
158 *//***************************************************************************/
159 typedef _Packed struct t_FmIpcDmaStatus {
160     uint8_t    boolCmqNotEmpty;            /**< Command queue is not empty */
161     uint8_t    boolBusError;               /**< Bus error occurred */
162     uint8_t    boolReadBufEccError;        /**< Double ECC error on buffer Read */
163     uint8_t    boolWriteBufEccSysError;    /**< Double ECC error on buffer write from system side */
164     uint8_t    boolWriteBufEccFmError;     /**< Double ECC error on buffer write from FM side */
165 } _PackedType t_FmIpcDmaStatus;
166 
167 typedef _Packed struct t_FmIpcRegisterIntr
168 {
169     uint8_t         guestId;        /* IN */
170     uint32_t        event;          /* IN */
171 } _PackedType t_FmIpcRegisterIntr;
172 
173 typedef _Packed struct t_FmIpcIsr
174 {
175     uint8_t         boolErr;        /* IN */
176     uint32_t        pendingReg;     /* IN */
177 } _PackedType t_FmIpcIsr;
178 
179 /**************************************************************************//**
180  @Description   structure for returning revision information
181 *//***************************************************************************/
182 typedef _Packed struct t_FmIpcRevisionInfo {
183     uint8_t         majorRev;               /**< OUT: Major revision */
184     uint8_t         minorRev;               /**< OUT: Minor revision */
185 } _PackedType t_FmIpcRevisionInfo;
186 
187 /**************************************************************************//**
188  @Description   Structure for defining Fm number of Fman controlers
189 *//***************************************************************************/
190 typedef _Packed struct t_FmIpcPortNumOfFmanCtrls {
191     uint8_t             hardwarePortId;         /**< IN. port Id */
192     uint8_t             numOfFmanCtrls;         /**< IN. Port type */
193 } t_FmIpcPortNumOfFmanCtrls;
194 
195 /**************************************************************************//**
196  @Description   structure for setting Fman contriller events
197 *//***************************************************************************/
198 typedef _Packed struct t_FmIpcFmanEvents {
199     uint8_t         eventRegId;               /**< IN: Fman controller event register id */
200     uint32_t        enableEvents;             /**< IN/OUT: required enabled events mask */
201 } _PackedType t_FmIpcFmanEvents;
202 
203 #define FM_IPC_MAX_REPLY_BODY_SIZE  16
204 #define FM_IPC_MAX_REPLY_SIZE       (FM_IPC_MAX_REPLY_BODY_SIZE + sizeof(uint32_t))
205 #define FM_IPC_MAX_MSG_SIZE         30
206 typedef _Packed struct t_FmIpcMsg
207 {
208     uint32_t    msgId;
209     uint8_t     msgBody[FM_IPC_MAX_MSG_SIZE];
210 } _PackedType t_FmIpcMsg;
211 
212 typedef _Packed struct t_FmIpcReply
213 {
214     uint32_t    error;
215     uint8_t     replyBody[FM_IPC_MAX_REPLY_BODY_SIZE];
216 } _PackedType t_FmIpcReply;
217 
218 #define MEM_MAP_END
219 #if defined(__MWERKS__) && !defined(__GNUC__)
220 #pragma pack(pop)
221 #endif /* defined(__MWERKS__) && ... */
222 
223 
224 /***************************************************************************/
225 /************************ FRONT-END-TO-BACK-END*****************************/
226 /***************************************************************************/
227 
228 /**************************************************************************//**
229  @Function      FM_GET_TIMESTAMP_SCALE
230 
231  @Description   Used by FM front-end.
232 
233  @Param[out]    uint32_t Pointer
234 *//***************************************************************************/
235 #define FM_GET_TIMESTAMP_SCALE      1
236 
237 /**************************************************************************//**
238  @Function      FM_GET_COUNTER
239 
240  @Description   Used by FM front-end.
241 
242  @Param[in/out] t_FmIpcGetCounter Pointer
243 *//***************************************************************************/
244 #define FM_GET_COUNTER              2
245 
246 /**************************************************************************//**
247  @Function      FM_DUMP_REGS
248 
249  @Description   Used by FM front-end for the PORT module in order to set and get
250                 parameters in/from master FM module on FM PORT initialization time.
251 
252  @Param         None
253 *//***************************************************************************/
254 #define FM_DUMP_REGS                3
255 
256 /**************************************************************************//**
257  @Function      FM_GET_SET_PORT_PARAMS
258 
259  @Description   Used by FM front-end for the PORT module in order to set and get
260                 parameters in/from master FM module on FM PORT initialization time.
261 
262  @Param[in/out] t_FmIcPortInitParams Pointer
263 *//***************************************************************************/
264 #define FM_GET_SET_PORT_PARAMS      4
265 
266 /**************************************************************************//**
267  @Function      FM_FREE_PORT
268 
269  @Description   Used by FM front-end for the PORT module when a port is freed
270                 to free all FM PORT resources.
271 
272  @Param[in]     uint8_t Pointer
273 *//***************************************************************************/
274 #define FM_FREE_PORT                5
275 
276 /**************************************************************************//**
277  @Function      FM_RESET_MAC
278 
279  @Description   Used by front-end for the MAC module to reset the MAC registers
280 
281  @Param[in]     t_FmIpcMacParams Pointer .
282 *//***************************************************************************/
283 #define FM_RESET_MAC                6
284 
285 /**************************************************************************//**
286  @Function      FM_RESUME_STALLED_PORT
287 
288  @Description   Used by FM front-end for the PORT module in order to
289                 release a stalled FM Port.
290 
291  @Param[in]     uint8_t Pointer
292 *//***************************************************************************/
293 #define FM_RESUME_STALLED_PORT      7
294 
295 /**************************************************************************//**
296  @Function      FM_IS_PORT_STALLED
297 
298  @Description   Used by FM front-end for the PORT module in order to check whether
299                 an FM port is stalled.
300 
301  @Param[in/out] t_FmIcPortIsStalled Pointer
302 *//***************************************************************************/
303 #define FM_IS_PORT_STALLED          8
304 
305 /**************************************************************************//**
306  @Function      FM_DUMP_PORT_REGS
307 
308  @Description   Used by FM front-end for the PORT module in order to dump
309                 all port registers.
310 
311  @Param[in]     uint8_t Pointer
312 *//***************************************************************************/
313 #define FM_DUMP_PORT_REGS           9
314 
315 /**************************************************************************//**
316  @Function      FM_GET_REV
317 
318  @Description   Used by FM front-end for the PORT module in order to dump
319                 all port registers.
320 
321  @Param[in]     uint8_t Pointer
322 *//***************************************************************************/
323 #define FM_GET_REV                  10
324 
325 /**************************************************************************//**
326  @Function      FM_REGISTER_INTR
327 
328  @Description   Used by FM front-end to register an interrupt handler to
329                 be called upon interrupt for guest.
330 
331  @Param[out]    t_FmIpcRegisterIntr Pointer
332 *//***************************************************************************/
333 #define FM_REGISTER_INTR            11
334 
335 /**************************************************************************//**
336  @Function      FM_GET_CLK_FREQ
337 
338  @Description   Used by FM Front-end to read the FM clock frequency.
339 
340  @Param[out]    uint32_t Pointer
341 *//***************************************************************************/
342 #define FM_GET_CLK_FREQ             12
343 
344 /**************************************************************************//**
345  @Function      FM_DMA_STAT
346 
347  @Description   Used by FM front-end to read the FM DMA status.
348 
349  @Param[out]    t_FmIpcDmaStatus Pointer
350 *//***************************************************************************/
351 #define FM_DMA_STAT                 13
352 
353 /**************************************************************************//**
354  @Function      FM_ALLOC_FMAN_CTRL_EVENT_REG
355 
356  @Description   Used by FM front-end to allocate event register.
357 
358  @Param[out]    Event register id Pointer
359 *//***************************************************************************/
360 #define FM_ALLOC_FMAN_CTRL_EVENT_REG 14
361 
362 /**************************************************************************//**
363  @Function      FM_FREE_FMAN_CTRL_EVENT_REG
364 
365  @Description   Used by FM front-end to free locate event register.
366 
367  @Param[in]    uint8_t Pointer - Event register id
368 *//***************************************************************************/
369 #define FM_FREE_FMAN_CTRL_EVENT_REG 15
370 
371 /**************************************************************************//**
372  @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE
373 
374  @Description   Used by FM front-end to enable events in the FPM
375                 Fman controller event register.
376 
377  @Param[in]    t_FmIpcFmanEvents Pointer
378 *//***************************************************************************/
379 #define FM_SET_FMAN_CTRL_EVENTS_ENABLE 16
380 
381 /**************************************************************************//**
382  @Function      FM_SET_FMAN_CTRL_EVENTS_ENABLE
383 
384  @Description   Used by FM front-end to enable events in the FPM
385                 Fman controller event register.
386 
387  @Param[in/out] t_FmIpcFmanEvents Pointer
388 *//***************************************************************************/
389 #define FM_GET_FMAN_CTRL_EVENTS_ENABLE 17
390 
391 /**************************************************************************//**
392  @Function      FM_SET_MAC_MAX_FRAME
393 
394  @Description   Used by FM front-end to set MAC's MTU/RTU's in
395                 back-end.
396 
397  @Param[in/out] t_FmIpcMacMaxFrameParams Pointer
398 *//***************************************************************************/
399 #define FM_SET_MAC_MAX_FRAME 18
400 
401 /**************************************************************************//**
402  @Function      FM_GET_PHYS_MURAM_BASE
403 
404  @Description   Used by FM front-end in order to get MURAM base address
405 
406  @Param[in/out] t_FmIpcPhysAddr Pointer
407 *//***************************************************************************/
408 #define FM_GET_PHYS_MURAM_BASE  19
409 
410 /**************************************************************************//**
411  @Function      FM_MASTER_IS_ALIVE
412 
413  @Description   Used by FM front-end in order to verify Master is up
414 
415  @Param[in/out] bool
416 *//***************************************************************************/
417 #define FM_MASTER_IS_ALIVE          20
418 
419 #define FM_ENABLE_RAM_ECC           21
420 #define FM_DISABLE_RAM_ECC          22
421 #define FM_SET_NUM_OF_FMAN_CTRL     23
422 #define FM_SET_SIZE_OF_FIFO         24
423 #define FM_SET_NUM_OF_TASKS         25
424 #define FM_SET_NUM_OF_OPEN_DMAS     26
425 
426 #ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
427 #define FM_10G_TX_ECC_WA            100
428 #endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */
429 
430 /***************************************************************************/
431 /************************ BACK-END-TO-FRONT-END*****************************/
432 /***************************************************************************/
433 
434 /**************************************************************************//**
435  @Function      FM_GUEST_ISR
436 
437  @Description   Used by FM back-end to report an interrupt to the front-end.
438 
439  @Param[out]    t_FmIpcIsr Pointer
440 *//***************************************************************************/
441 #define FM_GUEST_ISR                1
442 
443 
444 
445 /** @} */ /* end of FM_IPC_grp group */
446 /** @} */ /* end of FM_grp group */
447 
448 
449 #endif /* __FM_IPC_H */
450