/**************************************************************************** Copyright (c) 2006, Dell Inc All rights reserved. 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 Dell Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. *****************************************************************************/ #ifndef __COMMONSSAPI_H_INCLUDED__ #define __COMMONSSAPI_H_INCLUDED__ /************************************************************************** Defines **************************************************************************/ #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #ifndef NULL #define NULL (0) #endif /** * Set a number by bit position * * @param x [in] the bit position */ #ifndef BIT #define BIT(x) (1 << x) #endif #ifndef UNREFERENCED_PARAMETER /* Note: lint -e530 says don't complain about uninitialized variables for this. line +e530 turns that checking back on. Error 527 has to do with unreachable code. */ #define UNREFERENCED_PARAMETER(P) \ /*lint -e527 -e530 */ \ { \ (P) = (P); \ } \ /*lint +e527 +e530 */ #endif /* UNREFERENCED_PARAMETER */ /* common string size definitions */ #define MAX_THR_STR_SIZE (32) #define SENSOR_NAME_STR_SIZE (64) #define PEF_STR_SIZE (128) #define EVENT_DESC_STR_SIZE (256) #define LOG_DATE_STR_SIZE (32) #define SENSOR_TYPE_STR_SIZE (32) #define SENSOR_READING_STR_SIZE (32) #define SENSOR_STATE_STR_SIZE (64) /* 1 means settable, 0 means not */ #define SENSOR_THR_UNC_SETS_ENABLE BIT(0) #define SENSOR_THR_LNC_SETS_ENABLE BIT(1) #define SENSOR_THR_UC_SETS_ENABLE BIT(2) #define SENSOR_THR_LC_SETS_ENABLE BIT(3) /* DISABLED thresholds means the thresholds not exists and the consumers should ignore those threshold fields */ #define SENSOR_THR_LNC_DISABLED BIT(4) #define SENSOR_THR_UNC_DISABLED BIT(5) #define SENSOR_THR_LC_DISABLED BIT(6) #define SENSOR_THR_UC_DISABLED BIT(7) typedef void SDRType; typedef void SELType; typedef SDRType* ( *GETFIRSTSDRFN )(void* userparam); typedef SDRType* ( *GETNEXTSDRFN )(SDRType *, void*); typedef int (*OEM2IPMISDRFN)( const SDRType*, struct _IPMISDR*); typedef struct _EIListType{ unsigned char entityID; unsigned char entityInst; }EIListType; typedef struct _EITable{ unsigned short listsize; EIListType eilist[1]; }EITable; typedef struct _CSDDSensorList{ unsigned char sensorCount; unsigned char sensorNumber[16]; }CSDDSensorList; typedef struct _IPMISensorReadingType{ unsigned char sensorReading; unsigned char sensorFlags; unsigned short sensorState; }IPMISensorReadingType; typedef struct _IPMISensorThresholdType{ unsigned char thrMask; unsigned char lncThr; unsigned char lcThr; unsigned char lnrThr; unsigned char uncThr; unsigned char ucThr; unsigned char unrThr; }IPMISensorThresholdType; typedef struct _SensorThrInfo{ unsigned char thrMask; long lncThr; long lcThr; long lnrThr; long uncThr; long ucThr; long unrThr; }SensorThrInfo; typedef struct _SensorThrStrType{ unsigned char thrMask; char lncThr[MAX_THR_STR_SIZE]; char lcThr[MAX_THR_STR_SIZE]; char lnrThr[MAX_THR_STR_SIZE]; char uncThr[MAX_THR_STR_SIZE]; char ucThr[MAX_THR_STR_SIZE]; char unrThr[MAX_THR_STR_SIZE]; } SensorThrStrType; typedef int (*IPMIGETSENSORREADINGFN) (unsigned char, unsigned char, IPMISensorReadingType *, void*); typedef int (*IPMIGETSENSORTHRESHOLDSFN) (unsigned char, unsigned char, IPMISensorThresholdType *, void*); typedef struct _CSDDUSERAPI { GETFIRSTSDRFN GetFirstSDR; GETNEXTSDRFN GetNextSDR; IPMIGETSENSORREADINGFN GetSensorReading; IPMIGETSENSORTHRESHOLDSFN GetSensorThresholds; OEM2IPMISDRFN Oem2IPMISDR; } CSDDUSERAPI; /************************************ Sensor API ************************************/ int CSDDAttach(CSDDUSERAPI *pfnApiList); int CSDDDetach(void); int CSDDGetSensorsTobeMonitored ( _INOUT CSDDSensorList* pList, _IN const SDRType* pSdr, _IN const EITable* pDonotMonitorEIList, _IN void* puserParameter); int CSDDGetSensorStaticInformation ( _IN const SDRType* pSdr, _IN unsigned char sensorNamePolicy, _OUT unsigned char* pSensorReadingType, _OUT unsigned char* pSensorType, _INOUT short* pSensorNameStrSize, _OUT char* pSensorNameStr, _INOUT short* pSensorTypeStrSize, _OUT char* pSensorTypeStr, _INOUT short* pUnitsStrSize, _OUT char* pUnitsStr, _IN int locale, _IN void* puserParameter); int CSDDGetSensorThresholds ( _IN const SDRType* pSdr, _OUT unsigned char* pThresholdMask, _OUT SensorThrInfo* pThrData, _OUT SensorThrStrType* pThrStrData, _IN int locale, _IN void* puserParameter); int CSDDGetSensorDynamicInformation ( _IN const SDRType* pSdr, _OUT long* pSensorReading, _OUT unsigned short* pSensorState, _INOUT short* pSensorReadingStrSize, _OUT char* pSensorReadingStr, _INOUT short* pSensorStateStrSize, _OUT char* pSensorStateStr, _OUT short* pSeverity, _IN int locale, _IN void* puserParameter); /************************************************ Common SEL definitions ************************************************/ typedef struct _CSLFUSERAPI { GETFIRSTSDRFN GetFirstSDR; GETNEXTSDRFN GetNextSDR; OEM2IPMISDRFN Oem2IPMISDR; } CSLFUSERAPI; typedef struct _DECODING_METHOD { unsigned char completionCode; /* Not used in library */ unsigned char deviceID; unsigned char deviceRevision; unsigned char firmwareMajor; unsigned char firmwareMinor; unsigned char ipmiVersion; unsigned char supportFlags; unsigned char manufactureID[3]; unsigned char productID[2]; unsigned char auxiliary[4]; } DECODING_METHOD; /************************************************ SEL API ************************************************/ #ifdef __cplusplus extern "C" { #endif void CSLFAttach(CSLFUSERAPI *pfnApiList); #ifdef __cplusplus }; #endif void CSLFDetach(void); int CSLFGetDecodingMethod( _INOUT DECODING_METHOD* method); int CSLFSetDecodingMethod( _INOUT DECODING_METHOD* method); /** * This function generates a user readable string that describes the event * corresponding to given a IPMI SEL data record. * It has been assumed that the caller implements the SDR access * routines as described in the readme file supplied in the SDK. * * @param pIPMISelEntry [in] pointer to the SEL entry * * @param pLogTimeStr [out] pointer to the buffer supplied for copying * the String representation of the time of event generation * * @param pLogTimeStrSize [inout] pointer to an unsigned shortr contains * the size of the buffer pointed by pLogTimeStr on the input. * On the output it will have the amount of data copied in to that * buffer * @param pEventDescStr [out] pointer to the buffer supplied for copying * the String representation event data present in pIPMISelEntry * * @param pLogTimeStrSize [inout] pointer to an unsigned short contains * the size of the buffer pointed by pLogTimeStr on the input. * On the output it will have the amount of data copied in to that * buffer * * @param *pSeverity [out] pointer to * * @return return a 0 for success non zero value for error returns * */ #ifdef __cplusplus extern "C" { #endif int CSLFSELEntryToStr( _IN const void* pIPMISelEntry, _IN unsigned char sensorNameGenPolicy, _OUT char* pLogTimeStr, _INOUT unsigned short* pLogTimeStrSize, _OUT char* pEventDescStr, _INOUT unsigned short* pEventDescStrSize, _OUT unsigned char* pSeverity, _IN void* puserParameter); #ifdef __cplusplus }; #endif int CSLFSELUnixToCTime( _IN char* pUnixStr, _INOUT char* pCtime); /************************************************ Common SEL definitions ************************************************/ #pragma pack(1) typedef struct _IPMIPEFEntry { unsigned char filterNumber; unsigned char filterConfig; unsigned char filterAction; unsigned char alertPolicyNumber; unsigned char severity; unsigned char genID1; unsigned char genID2; unsigned char sensorType; unsigned char sensorNumber; unsigned char triggerAndReadingType; unsigned short evtData1offsetMask; unsigned char evtData1ANDMask; unsigned char evtData1compare1; unsigned char evtData1compare2; unsigned char evtData2ANDMask; unsigned char evtData2compare1; unsigned char evtData2compare2; unsigned char evtData3ANDMask; unsigned char evtData3compare1; unsigned char evtData3compare2; } IPMIPEFEntry; #pragma pack() typedef struct _PEFListType { long numPEF; IPMIPEFEntry pPEFEntry[1]; }PEFListType; typedef int (*IPMIGETNUMPEFFN) (unsigned char *numPef, void* userparam); typedef int (*IPMIGETPEFENTRYFN) (unsigned char pefNum, unsigned char *pPEFEntryBuf, void* userparam); typedef int (*IPMISETPEFENTRYFN) (unsigned char *pPEFEntryBuf, void* userparam); typedef struct _CPDCUSERAPI { IPMIGETNUMPEFFN GetNumPEF; IPMIGETPEFENTRYFN GetPEFEntry; IPMISETPEFENTRYFN SetPEFEntry; OEM2IPMISDRFN Oem2IPMISDR; } CPDCUSERAPI; /********************************************* PEF API's *********************************************/ /** * CPDCAttach * @param pfnApiList [in] pointer to the CSDDUSERAPI structure * * @return return a 0 for success non zero value for error returns */ int CPDCAttach(CPDCUSERAPI *pfnApiList); /** * CPDCDetach * @return return a 0 for success non zero value for error returns */ int CPDCDetach(void); PEFListType * CPDCGetPEFListTobeDisplayed ( _IN const void* pDonotDisplayList, _OUT short* pStatus, _IN void* puserParameter); char * CPDCGetPEFName(IPMIPEFEntry *pPEFEntry); int CPDCSetPEFConfig ( _IN unsigned char pefNumber, _IN unsigned char pefEnable, _IN unsigned char pefAction, _IN void* puserParameter); /********************************************* SYSTEM/OS dependences *********************************************/ #ifdef SYSTEM_BBB #define strcpy movstr #define strcat catstr #define strlen lenstr #else #include #include #endif #endif /* __COMMONSSAPI_H_INCLUDED__ */