Path: blob/main/sys/contrib/ncsw/Peripherals/FM/fm_ipc.h
48375 views
/*1* Copyright 2008-2012 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/313233/**************************************************************************//**34@File fm_ipc.h3536@Description FM Inter-Partition prototypes, structures and definitions.37*//***************************************************************************/38#ifndef __FM_IPC_H39#define __FM_IPC_H4041#include "error_ext.h"42#include "std_ext.h"434445/**************************************************************************//**46@Group FM_grp Frame Manager API4748@Description FM API functions, definitions and enums4950@{51*//***************************************************************************/5253/**************************************************************************//**54@Group FM_IPC_grp FM Inter-Partition messaging Unit5556@Description FM Inter-Partition messaging unit API definitions and enums.5758@{59*//***************************************************************************/6061#if defined(__MWERKS__) && !defined(__GNUC__)62#pragma pack(push,1)63#endif /* defined(__MWERKS__) && ... */6465/**************************************************************************//**66@Description enum for defining MAC types67*//***************************************************************************/6869/**************************************************************************//**70@Description A structure of parameters for specifying a MAC.71*//***************************************************************************/72typedef _Packed struct73{74uint8_t id;75uint32_t enumType;76} _PackedType t_FmIpcMacParams;7778/**************************************************************************//**79@Description A structure of parameters for specifying a MAC.80*//***************************************************************************/81typedef _Packed struct82{83t_FmIpcMacParams macParams;84uint16_t maxFrameLength;85} _PackedType t_FmIpcMacMaxFrameParams;8687/**************************************************************************//**88@Description FM physical Address89*//***************************************************************************/90typedef _Packed struct t_FmIpcPhysAddr91{92volatile uint8_t high;93volatile uint32_t low;94} _PackedType t_FmIpcPhysAddr;959697typedef _Packed struct t_FmIpcPortOutInitParams {98uint8_t numOfTasks; /**< OUT */99uint8_t numOfExtraTasks; /**< OUT */100uint8_t numOfOpenDmas; /**< OUT */101uint8_t numOfExtraOpenDmas; /**< OUT */102uint32_t sizeOfFifo; /**< OUT */103uint32_t extraSizeOfFifo; /**< OUT */104t_FmIpcPhysAddr ipcPhysAddr; /**< OUT */105} _PackedType t_FmIpcPortOutInitParams;106107/**************************************************************************//**108@Description Structure for IPC communication during FM_PORT_Init.109*//***************************************************************************/110typedef _Packed struct t_FmIpcPortInInitParams {111uint8_t hardwarePortId; /**< IN. port Id */112uint32_t enumPortType; /**< IN. Port type */113uint8_t boolIndependentMode;/**< IN. TRUE if FM Port operates in independent mode */114uint16_t liodnOffset; /**< IN. Port's requested resource */115uint8_t numOfTasks; /**< IN. Port's requested resource */116uint8_t numOfExtraTasks; /**< IN. Port's requested resource */117uint8_t numOfOpenDmas; /**< IN. Port's requested resource */118uint8_t numOfExtraOpenDmas; /**< IN. Port's requested resource */119uint32_t sizeOfFifo; /**< IN. Port's requested resource */120uint32_t extraSizeOfFifo; /**< IN. Port's requested resource */121uint8_t deqPipelineDepth; /**< IN. Port's requested resource */122uint16_t maxFrameLength; /**< IN. Port's max frame length. */123uint16_t liodnBase; /**< IN. Irrelevant for P4080 rev 1.124LIODN base for this port, to be125used together with LIODN offset. */126} _PackedType t_FmIpcPortInInitParams;127128129/**************************************************************************//**130@Description Structure for IPC communication between port and FM131regarding tasks and open DMA resources management.132*//***************************************************************************/133typedef _Packed struct t_FmIpcPortRsrcParams {134uint8_t hardwarePortId; /**< IN. port Id */135uint32_t val; /**< IN. Port's requested resource */136uint32_t extra; /**< IN. Port's requested resource */137uint8_t boolInitialConfig;138} _PackedType t_FmIpcPortRsrcParams;139140141/**************************************************************************//**142@Description Structure for IPC communication between port and FM143regarding tasks and open DMA resources management.144*//***************************************************************************/145typedef _Packed struct t_FmIpcPortFifoParams {146t_FmIpcPortRsrcParams rsrcParams;147uint32_t enumPortType;148uint8_t boolIndependentMode;149uint8_t deqPipelineDepth;150uint8_t numOfPools;151uint16_t secondLargestBufSize;152uint16_t largestBufSize;153uint8_t boolInitialConfig;154} _PackedType t_FmIpcPortFifoParams;155156/**************************************************************************//**157@Description Structure for port-FM communication during FM_PORT_Free.158*//***************************************************************************/159typedef _Packed struct t_FmIpcPortFreeParams {160uint8_t hardwarePortId; /**< IN. port Id */161uint32_t enumPortType; /**< IN. Port type */162uint8_t deqPipelineDepth; /**< IN. Port's requested resource */163} _PackedType t_FmIpcPortFreeParams;164165/**************************************************************************//**166@Description Structure for defining DMA status167*//***************************************************************************/168typedef _Packed struct t_FmIpcDmaStatus {169uint8_t boolCmqNotEmpty; /**< Command queue is not empty */170uint8_t boolBusError; /**< Bus error occurred */171uint8_t boolReadBufEccError; /**< Double ECC error on buffer Read */172uint8_t boolWriteBufEccSysError; /**< Double ECC error on buffer write from system side */173uint8_t boolWriteBufEccFmError; /**< Double ECC error on buffer write from FM side */174uint8_t boolSinglePortEccError; /**< Single port ECC error from FM side */175} _PackedType t_FmIpcDmaStatus;176177typedef _Packed struct t_FmIpcRegisterIntr178{179uint8_t guestId; /* IN */180uint32_t event; /* IN */181} _PackedType t_FmIpcRegisterIntr;182183typedef _Packed struct t_FmIpcIsr184{185uint8_t boolErr; /* IN */186uint32_t pendingReg; /* IN */187} _PackedType t_FmIpcIsr;188189/**************************************************************************//**190@Description structure for returning FM parameters191*//***************************************************************************/192typedef _Packed struct t_FmIpcParams {193uint16_t fmClkFreq; /**< OUT: FM Clock frequency */194uint16_t fmMacClkFreq; /**< OUT: FM MAC clock frequence */195uint8_t majorRev; /**< OUT: FM Major revision */196uint8_t minorRev; /**< OUT: FM Minor revision */197} _PackedType t_FmIpcParams;198199200/**************************************************************************//**201@Description structure for returning Fman Ctrl Code revision information202*//***************************************************************************/203typedef _Packed struct t_FmIpcFmanCtrlCodeRevisionInfo {204uint16_t packageRev; /**< OUT: Package revision */205uint8_t majorRev; /**< OUT: Major revision */206uint8_t minorRev; /**< OUT: Minor revision */207} _PackedType t_FmIpcFmanCtrlCodeRevisionInfo;208209/**************************************************************************//**210@Description Structure for defining Fm number of Fman controlers211*//***************************************************************************/212typedef _Packed struct t_FmIpcPortNumOfFmanCtrls {213uint8_t hardwarePortId; /**< IN. port Id */214uint8_t numOfFmanCtrls; /**< IN. Port type */215t_FmFmanCtrl orFmanCtrl; /**< IN. fman controller for order restoration*/216} t_FmIpcPortNumOfFmanCtrls;217218/**************************************************************************//**219@Description structure for setting Fman contriller events220*//***************************************************************************/221typedef _Packed struct t_FmIpcFmanEvents {222uint8_t eventRegId; /**< IN: Fman controller event register id */223uint32_t enableEvents; /**< IN/OUT: required enabled events mask */224} _PackedType t_FmIpcFmanEvents;225226typedef _Packed struct t_FmIpcResourceAllocParams {227uint8_t guestId;228uint16_t base;229uint16_t num;230}_PackedType t_FmIpcResourceAllocParams;231232typedef _Packed struct t_FmIpcVspSetPortWindow {233uint8_t hardwarePortId;234uint8_t baseStorageProfile;235uint8_t log2NumOfProfiles;236}_PackedType t_FmIpcVspSetPortWindow;237238typedef _Packed struct t_FmIpcSetCongestionGroupPfcPriority {239uint32_t congestionGroupId;240uint8_t priorityBitMap;241}_PackedType t_FmIpcSetCongestionGroupPfcPriority;242243#define FM_IPC_MAX_REPLY_BODY_SIZE 20244#define FM_IPC_MAX_REPLY_SIZE (FM_IPC_MAX_REPLY_BODY_SIZE + sizeof(uint32_t))245#define FM_IPC_MAX_MSG_SIZE 30246247typedef _Packed struct t_FmIpcMsg248{249uint32_t msgId;250uint8_t msgBody[FM_IPC_MAX_MSG_SIZE];251} _PackedType t_FmIpcMsg;252253typedef _Packed struct t_FmIpcReply254{255uint32_t error;256uint8_t replyBody[FM_IPC_MAX_REPLY_BODY_SIZE];257} _PackedType t_FmIpcReply;258259#if defined(__MWERKS__) && !defined(__GNUC__)260#pragma pack(pop)261#endif /* defined(__MWERKS__) && ... */262263264/***************************************************************************/265/************************ FRONT-END-TO-BACK-END*****************************/266/***************************************************************************/267268/**************************************************************************//**269@Function FM_GET_TIMESTAMP_SCALE270271@Description Used by FM front-end.272273@Param[out] uint32_t Pointer274*//***************************************************************************/275#define FM_GET_TIMESTAMP_SCALE 1276277/**************************************************************************//**278@Function FM_GET_COUNTER279280@Description Used by FM front-end.281282@Param[in/out] t_FmIpcGetCounter Pointer283*//***************************************************************************/284#define FM_GET_COUNTER 2285286/**************************************************************************//**287@Function FM_GET_SET_PORT_PARAMS288289@Description Used by FM front-end for the PORT module in order to set and get290parameters in/from master FM module on FM PORT initialization time.291292@Param[in/out] t_FmIcPortInitParams Pointer293*//***************************************************************************/294#define FM_GET_SET_PORT_PARAMS 4295296/**************************************************************************//**297@Function FM_FREE_PORT298299@Description Used by FM front-end for the PORT module when a port is freed300to free all FM PORT resources.301302@Param[in] uint8_t Pointer303*//***************************************************************************/304#define FM_FREE_PORT 5305306/**************************************************************************//**307@Function FM_RESET_MAC308309@Description Used by front-end for the MAC module to reset the MAC registers310311@Param[in] t_FmIpcMacParams Pointer .312*//***************************************************************************/313#define FM_RESET_MAC 6314315/**************************************************************************//**316@Function FM_RESUME_STALLED_PORT317318@Description Used by FM front-end for the PORT module in order to319release a stalled FM Port.320321@Param[in] uint8_t Pointer322*//***************************************************************************/323#define FM_RESUME_STALLED_PORT 7324325/**************************************************************************//**326@Function FM_IS_PORT_STALLED327328@Description Used by FM front-end for the PORT module in order to check whether329an FM port is stalled.330331@Param[in/out] t_FmIcPortIsStalled Pointer332*//***************************************************************************/333#define FM_IS_PORT_STALLED 8334335/**************************************************************************//**336@Function FM_GET_PARAMS337338@Description Used by FM front-end for the PORT module in order to dump339return FM parameters.340341@Param[in] uint8_t Pointer342*//***************************************************************************/343#define FM_GET_PARAMS 10344345/**************************************************************************//**346@Function FM_REGISTER_INTR347348@Description Used by FM front-end to register an interrupt handler to349be called upon interrupt for guest.350351@Param[out] t_FmIpcRegisterIntr Pointer352*//***************************************************************************/353#define FM_REGISTER_INTR 11354355/**************************************************************************//**356@Function FM_DMA_STAT357358@Description Used by FM front-end to read the FM DMA status.359360@Param[out] t_FmIpcDmaStatus Pointer361*//***************************************************************************/362#define FM_DMA_STAT 13363364/**************************************************************************//**365@Function FM_ALLOC_FMAN_CTRL_EVENT_REG366367@Description Used by FM front-end to allocate event register.368369@Param[out] Event register id Pointer370*//***************************************************************************/371#define FM_ALLOC_FMAN_CTRL_EVENT_REG 14372373/**************************************************************************//**374@Function FM_FREE_FMAN_CTRL_EVENT_REG375376@Description Used by FM front-end to free locate event register.377378@Param[in] uint8_t Pointer - Event register id379*//***************************************************************************/380#define FM_FREE_FMAN_CTRL_EVENT_REG 15381382/**************************************************************************//**383@Function FM_SET_FMAN_CTRL_EVENTS_ENABLE384385@Description Used by FM front-end to enable events in the FPM386Fman controller event register.387388@Param[in] t_FmIpcFmanEvents Pointer389*//***************************************************************************/390#define FM_SET_FMAN_CTRL_EVENTS_ENABLE 16391392/**************************************************************************//**393@Function FM_SET_FMAN_CTRL_EVENTS_ENABLE394395@Description Used by FM front-end to enable events in the FPM396Fman controller event register.397398@Param[in/out] t_FmIpcFmanEvents Pointer399*//***************************************************************************/400#define FM_GET_FMAN_CTRL_EVENTS_ENABLE 17401402/**************************************************************************//**403@Function FM_SET_MAC_MAX_FRAME404405@Description Used by FM front-end to set MAC's MTU/RTU's in406back-end.407408@Param[in/out] t_FmIpcMacMaxFrameParams Pointer409*//***************************************************************************/410#define FM_SET_MAC_MAX_FRAME 18411412/**************************************************************************//**413@Function FM_GET_PHYS_MURAM_BASE414415@Description Used by FM front-end in order to get MURAM base address416417@Param[in/out] t_FmIpcPhysAddr Pointer418*//***************************************************************************/419#define FM_GET_PHYS_MURAM_BASE 19420421/**************************************************************************//**422@Function FM_MASTER_IS_ALIVE423424@Description Used by FM front-end in order to verify Master is up425426@Param[in/out] bool427*//***************************************************************************/428#define FM_MASTER_IS_ALIVE 20429430#define FM_ENABLE_RAM_ECC 21431#define FM_DISABLE_RAM_ECC 22432#define FM_SET_NUM_OF_FMAN_CTRL 23433#define FM_SET_SIZE_OF_FIFO 24434#define FM_SET_NUM_OF_TASKS 25435#define FM_SET_NUM_OF_OPEN_DMAS 26436#define FM_VSP_ALLOC 27437#define FM_VSP_FREE 28438#define FM_VSP_SET_PORT_WINDOW 29439#define FM_GET_FMAN_CTRL_CODE_REV 30440#define FM_SET_CONG_GRP_PFC_PRIO 31441#ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004442#define FM_10G_TX_ECC_WA 100443#endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */444445/***************************************************************************/446/************************ BACK-END-TO-FRONT-END*****************************/447/***************************************************************************/448449/**************************************************************************//**450@Function FM_GUEST_ISR451452@Description Used by FM back-end to report an interrupt to the front-end.453454@Param[out] t_FmIpcIsr Pointer455*//***************************************************************************/456#define FM_GUEST_ISR 1457458459460/** @} */ /* end of FM_IPC_grp group */461/** @} */ /* end of FM_grp group */462463464#endif /* __FM_IPC_H */465466467