123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- /****************************************************************
- ****************************************************************
- ** **
- ** (C)Copyright 2005-2006, American Megatrends Inc. **
- ** **
- ** All Rights Reserved. **
- ** **
- ** 6145-F, Northbelt Parkway, Norcross, **
- ** **
- ** Georgia - 30071, USA. Phone-(770)-246-8600. **
- ** **
- ****************************************************************
- ****************************************************************/
- /*****************************************************************
- *
- * MsgHndlr.h
- * Message Handler.
- *
- * Author: Govind Kothandapani <govindk@ami.com>
- * : Rama Bisa <ramab@ami.com>
- * : Basavaraj Astekar <basavaraja@ami.com>
- * : Bakka Ravinder Reddy <bakkar@ami.com>
- *
- *****************************************************************/
- #ifndef MSG_HNDLR_H
- #define MSG_HNDLR_H
- #include "com_Message.h"
- #include "com_IPMIDefs.h"
- #pragma pack( 1 )
- #define BMC_LUN_00 0
- #define BMC_LUN_01 1
- #define BMC_LUN_10 2
- #define BMC_LUN_11 3
- #define LOOP_BACK_REQ 0x10
- #define LAN_IFC_SUP 0x0001
- #define SOL_IFC_SUP 0x0002
- #define SERIAL_IFC_SUP 0x0004
- #define AMI_DEVICE_SUP 0x0008
- #define USER_LOCKED 1
- #define USER_UNLOCKED 0
- #define MAX_NETFN 64
- // /*FLASH TYPE*/
- // #define YAFU_FLASH 1
- // #define TFTP_FLASH 2
- // #define HPM_FLASH 3
- /*Get the current cmd channel for OBSM*/
- //#define GetCurCmdChannel(BMCInst) g_BMCInfo[BMCInst].Msghndlr.CurChannel
- /*-----------------------
- * Command Handler Type
- *----------------------*/
- typedef int (*pCmdHndlr_T) ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes);
- /*----------------------
- * Command Handler map
- *----------------------*/
- typedef struct
- {
- uint8_t Cmd;
- uint8_t Privilege;
- pCmdHndlr_T CmdHndlr;
- uint8_t ReqLen; /* 0xFF - Any Length */
- uint16_t FFConfig;
- uint16_t IfcSupport;
- } CmdHndlrMap_T;
- /*-------------------------------
- * Extended Command Handler Type
- *-------------------------------*/
- typedef int (*pExCmdHndlr_T) ( uint8_t* pReq, uint32_t ReqLen, uint8_t* pRes);
- /*------------------------------
- * Extended Command Handler map
- *------------------------------*/
- typedef struct
- {
- uint8_t Cmd;
- uint8_t Privilege;
- pExCmdHndlr_T CmdHndlr;
- uint8_t ReqLen; /* 0xFF - Any Length */
- uint16_t FFConfig;
- uint16_t IfcSupport;
- } ExCmdHndlrMap_T;
- /*-------------------------
- * Message Handler Table
- *-------------------------*/
- typedef struct
- {
- uint8_t NetFn;
- const CmdHndlrMap_T* CmdHndlrMap;
- } MsgHndlrTbl_T;
- typedef struct
- {
- uint8_t NetFn;
- uint8_t GroupExtnCode;
- const CmdHndlrMap_T* CmdHndlrMap;
- } GroupExtnMsgHndlrTbl_T;
- /*-------------------------------------------------------------
- * Pending Bridged Response Tbl Size
- *
- * Do not increase beyond 60 as maximum sequence number is 64
- *------------------------------------------------------------*/
- #define MAX_PENDING_BRIDGE_RES 64
- #define MAX_PENDING_BRIDGE_TBL 2
- #define PRIMARY_PB_TBL 0
- #define SECONDARY_PB_TBL 1
- typedef union
- {
- IPMIMsgHdr_T IPMIMsgHdr;
- IPMIUDSMsg_T UDSMsgHdr;
- } ResMsgHdr_T;
- typedef struct
- {
- uint8_t Used;
- uint8_t TimeOut;
- uint8_t SeqNum;
- uint8_t ChannelNum;
- uint8_t DstSessionHandle;
- uint8_t SrcSessionHandle;
- uint32_t SrcSessionID;
- uint8_t DestQ[PIPE_NAME_LEN];
- uint8_t OriginSrc;
- IPMIMsgHdr_T ReqMsgHdr;
- ResMsgHdr_T ResMsgHdr;
- } PendingBridgedResTbl_T;
- /*------------------------------
- * Pending Sequence Number
- *-----------------------------*/
- //#define NO_IPMB_PROTOCOL_CHANNEL 3
- #define MAX_PENDING_SEQ_NO 50
- #define SEQ_NO_EXPIRATION_TIME 5
- typedef struct
- {
- uint8_t Used;
- uint8_t TimeOut;
- uint8_t SeqNum;
- uint8_t NetFn;
- uint8_t Cmd;
- } PendingSeqNoTbl_T;
- #define MAX_IPMI_CMD_BLOCKS 3
- // typedef struct
- // {
- // uint8_t Channel; /**< Originator's channel number */
- // HQueue_T hSrcQ; /**< Originator Queue */
- // uint8_t Param; /**< Parameter */
- // uint8_t Cmd; /**< Command that needs to be processed */
- // uint8_t NetFnLUN; /**< Net function and LUN of command */
- // uint8_t Privilege; /**< Current privilege level */
- // uint32_t SessionID; /**< Session ID if any */
- // uint8_t RequestSize; /**< Size of the Request */
- // uint8_t Request [MSG_PAYLOAD_SIZE]; /**< Request Data buffer */
- // uint8_t ResponseSize; /**< Size of the response */
- // uint8_t Response [MSG_PAYLOAD_SIZE]; /**< Response Data buffer */
- // uint8_t* pRequest; /**< Pointer to Request data */
- // uint8_t* pResponse; /**< Pointer to Response data */
- // } IPMICmdMsg_T;
- typedef struct
- {
- uint8_t NetFnLUN;
- uint32_t SessionID;
- uint8_t SrcQ [PIPE_NAME_LEN];
- } KCSBridgeResInfo_T;
- #pragma pack( )
- // /*------------------ Timer Task Table --------------------------*/
- // typedef void (*pTimerFn_T) ();
- // typedef struct
- // {
- // uint8_t NumSecs;
- // pTimerFn_T TimerFn;
- // } TimerTaskTbl_T;
- /*-----------------------------------------------------------
- * Bridge Status
- *---------------------------------------------------------*/
- #define STATUS_OK 0x0
- #define STATUS_FAIL 0x1
- /* Extern declaration */
- extern int GetCmdHndlr(MsgPkt_T* pReq,MsgPkt_T* pRes,CmdHndlrMap_T* pCmdHndlrMap,
- uint32_t HdrOffset,uint8_t CmdOverride,CmdHndlrMap_T** CmdHndrl );
- extern int GetMsgHndlrMap (uint8_t NetFn, CmdHndlrMap_T ** pCmdHndlrMap);
- /**
- *@fn GroupExtnGetMsgHndlrMap
- *@brief Gets the exact command Handler by comparing NetFn
- *@param Netfn -NetFunction of the Cmd to execute
- *@GroupExtnCode - Group Extension code
- *@param pCmdHndlrMap Pointer to the Command Handler
- */
- extern int GroupExtnGetMsgHndlrMap (uint8_t NetFn, uint8_t GroupExtnCode, CmdHndlrMap_T ** pCmdHndlrMap);
- //extern PendingBridgedResTbl_T m_PendingBridgedResTbl[MAX_PENDING_BRIDGE_TBL][MAX_PENDING_BRIDGE_RES];
- extern uint8_t CalculateCheckSum2 ( uint8_t* Pkt, uint32_t Len);
- extern void SwapIPMIMsgHdr ( IPMIMsgHdr_T* pIPMIMsgReq, IPMIMsgHdr_T* pIPMIMsgRes);
- extern void SwapUDSIPMIMsg ( MsgPkt_T* pIPMIMsgReq, MsgPkt_T* pIPMIMsgRes);
- /**
- * @fn GetIfcSupport
- * @brief This function checks the support of Interface before
- * Interface specific commands are executed
- * @param IfcSupt - Interface support variable to be verified
- * @param IfcSupport - Gives the Interface presence support
- */
- //extern int GetIfcSupport(uint16_t IfcSupt,uint8_t *IfcSupport);
- /*------------------------
- * Privilege Levels
- *------------------------*/
- #define PRIV_NONE 0x00
- #define PRIV_CALLBACK 0x01
- #define PRIV_USER 0x02
- #define PRIV_OPERATOR 0x03
- #define PRIV_ADMIN 0x04
- #define PRIV_OEM 0x05
- #define PRIV_LOCAL 0x81
- #define PRIV_SYS_IFC 0x82
- /*------------------------------
- * Channel type used for BadPassword
- *------------------------------*/
- #define LAN_CHANNEL_BADP 0x1
- #define SERIAL_CHANNEL_BADP 0x2
- /*----------------------------
- * Command Handler Example (app.c)
- *----------------------------*/
- /*
- #ifdef APP_DEVICE
- .... Code ....
- const CmdHndlrMap_T g_APP_CmdHndlr [] =
- {
- { CMD_GET_DEV_ID, PRIV_USER, GET_DEV_ID, 0x00 },
- { CMD_BROADCAST_GET_DEV_ID, PRIV_LOCAL, BROADCAST_GET_DEV_ID, 0x00 },
- ...
- ...
- { 0x00, 0x00, 0x00, 0x00 }
- };
- #else
- const CmdHndlrMap_T g_APP_CmdHndlr [] = { 0x00, 0x00, 0x00, 0x00 };
- #endif // APP_DEVICE
- */
- /*---------------------------
- * app.h
- *---------------------------*/
- /*
- #ifndef APP_H
- #define APP_H
- #include "MsgHndlr.h"
- extern const CmdHndlrMap_T g_APP_CmdHndlr [];
- #endif
- */
- /*---------------------------------------------------
- * Parameters passed by through the message handler Q.
- *---------------------------------------------------*/
- // #define PARAM_IFC 0x01
- // #define PARAM_TIMER 0x02
- // #define PARAM_EXECUTE_SP 0x03
- // #define PARAM_SENSOR_MONITOR 0x04
- // #define PARAM_SENSOR_MONITOR_DONE 0x05
- // #define PARAM_IFC_READY 0x06
- #define RCVMSGQ_LENGTH 100
- #define NO_RESPONSE 0x10
- #define NORMAL_RESPONSE 0x11
- //#define BRIDGING_REQUEST 0x12
- /*----------------------------------------------------
- * Receive Message Queue Names
- *----------------------------------------------------*/
- extern char g_RcvMsgQ [3][RCVMSGQ_LENGTH];
- /*------------------------------------------------------------------
- *@fn RespondSendMessage
- *@brief Frames the Response packet when a IPMB destination is
- * unavialable
- *
- *@param pReq: Request Message Packet address
- *@param Status Status of SendIPMBPkt method
- *@param BMCInst: BMC Instance Number
- *
- *@return none
- *-----------------------------------------------------------------*/
- extern void RespondSendMessage ( MsgPkt_T* pReq, uint8_t Status);
- /**
- *@fn ValidateMsgHdr
- *@brief Validates the Message header and keeps track of the messages that has been bridged
- *@param pReq Request packet of the command to be executed
- *@return Returns -1 in case of the response to the bridged message
- * Returns 0 otherwise
- */
- extern int ValidateMsgHdr ( MsgPkt_T* pReq);
- #endif /* MSG_HNDLR_H */
|