/****************************************************************
 ****************************************************************
 **                                                            **
 ***    (C)Copyright 2005-2006, American Megatrends Inc.       **
 **                                                            **
 **            All Rights Reserved.                            **
 **                                                            **
 **        6145-F, Northbelt Parkway, Norcross,                **
 **                                                            **
 **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
 **                                                            **
 ****************************************************************
 ****************************************************************
 *****************************************************************
 *
 * ipmi_PEF.h
 * AppDevice Commands Handler
 *
 * Author: Govind Kothandapani <govindk@ami.com>
 *       : Rama Bisa <ramab@ami.com>
 *       : Basavaraj Astekar <basavaraja@ami.com>
 *       : Bakka Ravinder Reddy bakkar@ami.com>
 *
 *****************************************************************/
#ifndef IPMI_PEFDEV_H
#define IPMI_PEFDEV_H

#include <stdint.h>
#pragma pack( 1 )

#define ALERT_STR_MAX_BLOCKS                0x3
#define ALERT_STR_BLOCK_SIZE                0x10
#define MAX_ALERT_ENTRIES		127
#define MAX_PEF_ENTRIES			127
#define MAX_ALERT_STRING_LENGTH  48
#define MAX_PEF_CONF_PARAM 					0x0F
#define MIN_PEF_OEM_CONF_PARAM				96
#define MAX_PEF_OEM_CONF_PARAM				127

/**
 * @struct EvtFilterTblEntry_T
 * @brief Event Filter table entry format.
**/
typedef struct
{
    uint8_t   FilterConfig;           /**< Filter configuration. */
    uint8_t   EvtFilterAction;        /**< Filter Action. */
    uint8_t   AlertPolicyNum;         /**< Alert Policy Number. */
    uint8_t   EventSeverity;          /**< Event Severity. */
    uint8_t   GenIDByte1;             /**< Event Gen ID Byte 1. */
    uint8_t   GenIDByte2;             /**< Channel Number/LUN. */
    uint8_t   SensorType;             /**< Sensor Type. */
    uint8_t   SensorNum;              /**< Sensor Number. */
    uint8_t   EventTrigger;           /**< Event Trigger Reading, 0xff - match any. */
    uint16_t  EventData1OffsetMask;   /**< Event Data1 offset Mask. */
    uint8_t   EventData1ANDMask;      /**< Event Data1 offset AND Mask. */
    uint8_t   EventData1Cmp1;         /**< Event Data1 Compare 1 Mask. */
    uint8_t   EventData1Cmp2;         /**< Event Data1 Compare 2 Mask. */
    uint8_t   EventData2ANDMask;      /**< Event Data1 offset AND Mask. */
    uint8_t   EventData2Cmp1;         /**< Event Data1 Compare 1 Mask. */
    uint8_t   EventData2Cmp2;         /**< Event Data1 Compare 2 Mask. */
    uint8_t   EventData3ANDMask;      /**< Event Data1 offset AND Mask. */
    uint8_t   EventData3Cmp1;         /**< Event Data1 Compare 1 Mask. */
    uint8_t   EventData3Cmp2;         /**< Event Data1 Compare 2 Mask. */

}   EvtFilterTblEntry_T;


/**
 * @struct AlertPolicyTblEntry_T
 * @brief Alert Policy Entry structure
**/
typedef struct
{
    uint8_t   AlertNum;           /**< Alert policy no. */
    uint8_t   ChannelDestSel;     /**< Destination selector. */
    uint8_t   AlertStingkey;      /**< Alert String key. */

}   AlertPolicyTblEntry_T;


/**
 * @struct AlertStringTbl_T
 * Alert String Table
**/
typedef struct
{
    uint8_t   EventFilterSel;
    uint8_t   AlertStringSet;
    uint8_t   AlertString [ALERT_STR_MAX_BLOCKS] [ALERT_STR_BLOCK_SIZE];

}   AlertStringTbl_T;


/* GetPEFCapRes_T */
typedef struct
{
    uint8_t   CompletionCode;
    uint8_t   PEFVersion;
    uint8_t   ActionSupport;
    uint8_t   TotalEntries;

}   GetPEFCapRes_T;

/* ArmPEFTmrRes_T */
typedef struct
{
    uint8_t   CompletionCode;
    uint8_t   PresentTmrVal;

}   ArmPEFTmrRes_T;

/* GetPEFConfigReq_T */
typedef struct
{
    uint8_t   ParamSel;
    uint8_t   SetSel;
    uint8_t   BlockSel;

}   GetPEFConfigReq_T;

/* GetPEFConfigRes_T */
typedef struct
{
    uint8_t   CompletionCode;
    uint8_t   PEFVersion;
}   GetPEFConfigRes_T;

/* SetLastEvtIDReq_T */
typedef struct 
{
    uint8_t   SetRecIDType;
    uint16_t  RecordID;

}   SetLastEvtIDReq_T;

/* GetLastEvtIDRes_T */
typedef struct 
{
    uint8_t   CompletionCode;     
    uint32_t  RecentTimestamp;    
    uint16_t  LastSELRecord;      
    uint16_t  LastSWProcessedID;  
    uint16_t  LastBMCProcessedID; 

}   GetLastEvtIDRes_T;

/* AlertImmReq_T */
typedef struct 
{
    uint8_t   ChannelNo;      
    uint8_t   DestSel;        
    uint8_t   AlertStrSel;    
    uint8_t   GenID ;
    uint8_t   EvMRev;
    uint8_t   SensorType;
    uint8_t   SensorNum;
    uint8_t   EvtDirType;
    uint8_t   EvtData1;
    uint8_t   EvtData2;
    uint8_t   EvtData3;

}   AlertImmReq_T;

typedef struct
{
    uint8_t   CompletionCode;
    uint8_t   Status;

}   AlertImmRes_T;

/* PETAckReq_T */
typedef struct 
{
    uint16_t  SequenceNum;    
    uint32_t  Timestamp;      
    uint8_t   EventSrcType;
    uint8_t   SensorDevice;   
    uint8_t   SensorNum;      
    uint8_t   EventData1;     
    uint8_t   EventData2;     
    uint8_t   EventData3; 
}   PETAckReq_T;

#pragma pack( )

#endif /* IPMI_PEFDEV_H */
