Pārlūkot izejas kodu

New getSensorInfo

zhangbo 5 gadi atpakaļ
vecāks
revīzija
1a7240de61

+ 3 - 0
app/bmc/Makefile

@@ -58,6 +58,8 @@ SRC += ./msghndlr/Storage/FRUDevice/FRU.c
 SRC += ./msghndlr/Storage/SDRDevice/SDR.c
 SRC += ./msghndlr/Storage/SELDevice/SEL.c
 
+SRC += ./msghndlr/Storlead/Storlead.c
+
 # hal_api
 SRC += $(wildcard ../hal_api/*.c) 
 
@@ -99,6 +101,7 @@ CFLAGS	+= -I ./msghndlr/Storage/FRUDevice
 CFLAGS	+= -I ./msghndlr/Storage/SDRDevice
 CFLAGS	+= -I ./msghndlr/Storage/SELDevice
 CFLAGS	+= -I ./msghndlr/Transport
+CFLAGS	+= -I ./msghndlr/Storlead
 
 
 CFLAGS	+= -I ./encryption

BIN
app/bmc/bmc_app


+ 7 - 7
app/bmc/main.c

@@ -75,13 +75,13 @@ void main(void)
         printf("%s: Create ChassisTimerTask thread failed!\n", __FUNCTION__);
     }
 
-//    /* Create SensorMonitorTask */
-//	gThreadIndex++;
-//	if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,SensorMonitorTask,NULL))
-//    {
-//        printf("%s: Create SensorMonitorTask thread failed!\n", __FUNCTION__);
-//    }
-//
+   /* Create SensorMonitorTask */
+	gThreadIndex++;
+	if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,SensorMonitorTask,NULL))
+   {
+       printf("%s: Create SensorMonitorTask thread failed!\n", __FUNCTION__);
+   }
+
 	/* Create UDS interface */
 	gThreadIndex++;
 	if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,UDSIfcTask,NULL))

+ 1 - 62
app/bmc/msghndlr/OemSMMCmds/OemSMMCmds.c

@@ -883,68 +883,7 @@ int SMMExample_7fh( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 int SMMExample_80h( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)	
 {
 	
-	char Title[] = "CPU info";
-	char Text[] = "CPU:Intel;Freq:1 GHZ;Memory:8 GB;Brief:This section test long string. Very very long string. long enough? not long";
-	int len = 0,remainLen = 0;
-	uint16_t offset = (pReq[1]<<8) | pReq[2];
-	int totalLen = 0;
-	char *pStr = NULL;
-	int reqLen = (pReq[3]<<8) | pReq[4];
-	
-	switch(pReq[0])
-	{
-	case 0:	//get Title
-		while(Title[totalLen])
-		{
-			totalLen++;
-		}printf("title total len = %#x\n",totalLen);
-		pStr = Title;
-		break;
-	case 1:
-		while(Text[totalLen])
-		{
-			totalLen++;
-		}
-		printf("text total len = %#x\n", totalLen);
-		pStr = Text;
-		break;
-	default:
-		*pRes = CC_PARAM_OUT_OF_RANGE;
-		return 1;
-	}
-	
-	*pRes= CC_NORMAL;
-
-	if(offset > totalLen)
-	{
-		printf("Invalid offset: %#x\n", offset);
-		*pRes= CC_PARAM_OUT_OF_RANGE;
-		return 1;
-	}
-	
-	if(reqLen == 0)	
-	{
-		len = totalLen - offset;
-	}
-	else
-	{
-		len = (reqLen > (totalLen-offset)) ? (totalLen-offset) : reqLen;
-	}
-	
-	remainLen = totalLen - offset - len;
-	*(pRes+1) = (len>>8)&0xff;
-	*(pRes+2) = len&0xff;
-	*(pRes+3) = (remainLen>>8)&0xff;
-	*(pRes+4) = remainLen&0xff;
-	memcpy(pRes+5, pStr+offset, len);
-
-	// int i;
-	// printf("Example 80h: ");
-	// for(i=0;i<5+len;i++)
-	// 	printf("%#x ", pRes[i]);
-	// printf("\n");
-
-	return 5+len;	
+	return 1;	
 } 
 
 //

+ 12 - 0
app/bmc/msghndlr/PDKCmds.c

@@ -23,6 +23,7 @@
 #include "PDKCmds.h"
 #include "OemSMMCmds.h"
 #include "com_IPMIDefs.h"
+#include "Storlead.h"
 
 
 /*NetFn -Application OEM Command Handler to override generic IPMI cmd 
@@ -332,6 +333,15 @@ const CmdHndlrMap_T	g_Oem_CmdHndlr [] =	//jimbo add
 	{ CMD_EXAMPLE_ffh,     PRIV_USER,       SMMExample_ffh,      0xff,     0xAAAA,	0xFFFF },
 };
 
+
+const CmdHndlrMap_T g_Storlead_CmdHndlr [] =
+{                                                              
+    { CMD_GET_SYS_INFO,         PRIV_USER,      Storlead_GetSysInfo,        0xff,  0xAAAA ,0xFFFF},
+    { CMD_GET_SENSOR_INFO,      PRIV_USER,      Storlead_GetSensorInfo,     0xff,  0xAAAA  ,0xFFFF},
+    { 0x00,                     0x00,           0x00,                 0x00, 0x0000  ,  0x0000},
+};
+
+
 /*OEM Message Handler table to override generic IPMI cmd
   Any OEM specific Netfn and Command Handler can also be
   added here*/
@@ -344,6 +354,8 @@ const MsgHndlrTbl_T oem_MsgHndlrTbl [] =
     // { NETFN_STORAGE,                 g_Oem_Storage_CmdHndlr         },
     // { NETFN_TRANSPORT,               g_Oem_Config_CmdHndlr          },
     { NETFN_OEM,               		 g_Oem_CmdHndlr      		     },
+    {NETFN_STORLEAD,                   g_Storlead_CmdHndlr   },
+
 };
 
 /**

+ 16 - 0
app/bmc/msghndlr/SensorEvent/SensorDevice/Sensor.c

@@ -314,6 +314,14 @@ SR_LoadSDRDefaults (SDRRecHdr_T* sr, SensorInfo_T* pSensorInfo)
 
         pSensorInfo->EventTypeCode  	= sfs->EventTypeCode;
         pSensorInfo->SensorReadType		= sfs->EventTypeCode;
+        pSensorInfo->InternalFlags     = 0;
+        //    pSensorInfo->InternalFlags        |= BIT0;    // Disable internal scanning by default
+
+        // Check for a signed sensor
+        if (0x80 == (sfs->Units1 & 0xC0))
+        {
+            pSensorInfo->InternalFlags |= BIT1;
+        }
     }
 	else if (sr->Type == COMPACT_SDR_REC)
 	{
@@ -344,6 +352,14 @@ SR_LoadSDRDefaults (SDRRecHdr_T* sr, SensorInfo_T* pSensorInfo)
 		pSensorInfo->Units2                 = scs->Units2;
 		pSensorInfo->Units3                 = scs->Units3;
 		pSensorInfo->OEMField 				= scs->OEMField ;
+        pSensorInfo->InternalFlags          = 0;
+        //      pSensorInfo->InternalFlags      |= BIT0;    // Disable internal scanning by default
+
+        // Check for a signed sensor
+        if (0x80 == (scs->Units1 & 0xC0))
+        {
+            pSensorInfo->InternalFlags |= BIT1;
+        }
     }
 }
 

+ 1 - 1
app/bmc/msghndlr/SensorEvent/SensorMonitor.h

@@ -229,7 +229,7 @@ typedef struct
      * 
      * 
      * */  	
-//    uint8_t   		InternalFlags;   
+    uint8_t   		InternalFlags;   
                             /* Bit 0 -  Enable/Disable scanning - overrides SDR scanning bit      */
                             /* Bit 1 -  reserved                 */
                             /* Bit 2 -  reserved                 */

+ 263 - 0
app/bmc/msghndlr/Storlead/Storlead.c

@@ -0,0 +1,263 @@
+#include <string.h>
+#include "OemSMMCmds.h"
+#include "com_BmcType.h"
+#include "main.h"
+#include "Storlead.h"
+#include "SensorMonitor.h"
+#include "Sensor.h"
+#include "com_IPMI_SDRRecord.h"
+
+int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
+{
+	char Title[] = "CPU info";
+	char Text[] = "CPU:Intel;Freq:1 GHZ;Memory:8 GB;Brief:This section test long string. Very very long string. long enough? not long";
+	int len = 0,remainLen = 0;
+	uint16_t offset = (pReq[1]<<8) | pReq[2];
+	int totalLen = 0;
+	char *pStr = NULL;
+	int reqLen = (pReq[3]<<8) | pReq[4];
+	
+	switch(pReq[0])
+	{
+	case 0:	//get Title
+		while(Title[totalLen])
+		{
+			totalLen++;
+		}printf("title total len = %#x\n",totalLen);
+		pStr = Title;
+		break;
+	case 1:
+		while(Text[totalLen])
+		{
+			totalLen++;
+		}
+		printf("text total len = %#x\n", totalLen);
+		pStr = Text;
+		break;
+	default:
+		*pRes = CC_PARAM_OUT_OF_RANGE;
+		return 1;
+	}
+	
+	*pRes= CC_NORMAL;
+
+	if(offset > totalLen)
+	{
+		printf("Invalid offset: %#x\n", offset);
+		*pRes= CC_PARAM_OUT_OF_RANGE;
+		return 1;
+	}
+	
+	if(reqLen == 0)	
+	{
+		len = totalLen - offset;
+	}
+	else
+	{
+		len = (reqLen > (totalLen-offset)) ? (totalLen-offset) : reqLen;
+	}
+	
+	remainLen = totalLen - offset - len;
+	*(pRes+1) = (len>>8)&0xff;
+	*(pRes+2) = len&0xff;
+	*(pRes+3) = (remainLen>>8)&0xff;
+	*(pRes+4) = remainLen&0xff;
+	memcpy(pRes+5, pStr+offset, len);
+
+	// int i;
+	// printf("Example 80h: ");
+	// for(i=0;i<5+len;i++)
+	// 	printf("%#x ", pRes[i]);
+	// printf("\n");
+
+	return 5+len;	
+}
+
+int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
+{
+	printf("Storlead_GetSensorInfo\n" );
+
+	AMIGetSensorInfoRes_T *pAMIGetSensorInfoRes = (AMIGetSensorInfoRes_T *)pRes;
+    uint8_t*   		pValidSensor = NULL;
+    uint16_t       	SensorIndex = 0;
+    SensorInfo_T    pSensor ;
+    SenInfo_T       SensorInfo;
+    uint8_t 		SensorIsSigned = FALSE;
+    uint16_t 		SensorReading = 0;
+    SensorSharedMem_T*    pSMSharedMem;
+    SDRRecHdr_T*     	  pSDRRec;
+    FullSensorRec_T*      FullSDR;
+    CompactSensorRec_T*   CompSDR;
+    int i = 0;
+
+    /* Get the Sensor Shared Memory */
+    pSMSharedMem = (SensorSharedMem_T*)&g_BMCInfo.SensorSharedMem;
+
+    if(g_BMCInfo.SenConfig.ValidSensorCnt == 0)
+    {
+        pAMIGetSensorInfoRes->CompletionCode = OEMCC_SENSOR_INFO_EMPTY;
+        printf("ValidSensorCnt is 0\n");
+        return sizeof(*pRes);
+    }
+
+    pValidSensor = (uint8_t*)(pAMIGetSensorInfoRes+1);
+    for(i = 0; i < g_BMCInfo.SenConfig.ValidSensorCnt; i++)
+    {
+        SensorIndex = g_BMCInfo.SenConfig.ValidSensorList[i];
+        pSensor = pSMSharedMem->SensorInfo[SensorIndex];
+
+        /*Copy the SDR Header*/
+        memcpy(&SensorInfo.hdr,pSensor.SDRRec,sizeof(SDRRecHdr_T));
+
+        SensorInfo.SensorNumber = pSensor.SensorNumber;
+        SensorInfo.SensorTypeCode = pSensor.SensorTypeCode;
+        SensorInfo.EventTypeCode = pSensor.EventTypeCode;
+
+        SensorInfo.Units1 = pSensor.Units1;
+        SensorInfo.Units2 = pSensor.Units2;
+        SensorInfo.Units3 = pSensor.Units3;
+
+        SensorInfo.M_LSB = pSensor.M_LSB;
+        SensorInfo.M_MSB_Tolerance = pSensor.M_MSB_Tolerance;
+        SensorInfo.B_LSB = pSensor.B_LSB;
+        SensorInfo.B_MSB_Accuracy = pSensor.B_MSB_Accuracy;
+        SensorInfo.Accuracy_MSB_Exp = pSensor.Accuracy_MSB_Exp;
+        SensorInfo.RExp_BExp = pSensor.RExp_BExp;
+
+        SensorInfo.LowerNonCritical = pSensor.LowerNonCritical;
+        SensorInfo.LowerCritical = pSensor.LowerCritical;
+        SensorInfo.LowerNonRecoverable = pSensor.LowerNonRecoverable;
+        SensorInfo.UpperNonCritical = pSensor.UpperNonCritical;
+        SensorInfo.UpperCritical = pSensor.UpperCritical;
+        SensorInfo.UpperNonRecoverable= pSensor.UpperNonRecoverable;
+        SensorInfo.Settable_Readable_ThreshMask= pSensor.SettableThreshMask;
+
+        SensorInfo.Flags = pSensor.EventFlags & 0xe0;
+        if((pSensor.EventFlags & BIT5) != 0)
+        {
+            SensorInfo.SensorReading = 0;
+        }
+
+        SensorReading = pSensor.SensorReading;
+        SensorInfo.SensorReading = 0;
+        SensorIsSigned = ( 0 != (pSensor.InternalFlags & BIT1));
+
+        if (THRESHOLD_SENSOR_CLASS  == pSensor.EventTypeCode)
+        {
+            SensorInfo.SensorReading = (SensorReading & 0x00FF);
+            SensorInfo.ComparisonStatus = 0;
+            if((pSensor.DeassertionEventEnablesByte2 & BIT6) == BIT6 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.UpperNonRecoverable) >= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT5;
+                }
+            }
+            if((pSensor.DeassertionEventEnablesByte2 & BIT5) == BIT5 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.UpperCritical) >= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT4;
+                }
+            }
+            if((pSensor.DeassertionEventEnablesByte2 & BIT4) == BIT4 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.UpperNonCritical) >= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT3;
+                }
+            }
+            if((pSensor.AssertionEventEnablesByte2 & BIT6) == BIT6 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.LowerNonRecoverable) <= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT2;
+                }
+            }
+            if((pSensor.AssertionEventEnablesByte2 & BIT5) == BIT5 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.LowerCritical) <= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT1;
+                }
+            }
+            if((pSensor.AssertionEventEnablesByte2 & BIT4) == BIT4 )
+            {
+                if (CompareValues(SensorIsSigned, SensorInfo.SensorReading, pSensor.LowerNonCritical) <= 0)
+                {
+                    SensorInfo.ComparisonStatus |= BIT0;
+                }
+            }
+
+            SensorInfo.ComparisonStatus &= ((pSensor.SettableThreshMask >>  8) & 0xFF);
+            SensorInfo.OptionalStatus = 0;
+            // For Threshold sensor, [7:6] - reserved. Returned as 1b. Ignore on read.
+            SensorInfo.ComparisonStatus |= THRESHOLD_RESERVED_BIT;
+        }
+        else
+        {
+            SensorInfo.ComparisonStatus = (((uint8_t) (SensorReading & 0x00FF)) & ((uint8_t) (pSensor.SettableThreshMask & 0x00FF)) );
+            SensorInfo.OptionalStatus   = (((uint8_t) (SensorReading >> 8)) & ((uint8_t) (pSensor.SettableThreshMask >> 8)) );
+            // For Discrete sensor, [7] - reserved. Returned as 1b. Ignore on read.
+            SensorInfo.OptionalStatus  |= DISCRETE_RESERVED_BIT;
+        }
+
+        if((pSensor.EventFlags & BIT7) == 0)
+        {
+            SensorInfo.AssertionEventByte1 = 0;
+            SensorInfo.AssertionEventByte2 = 0;
+            SensorInfo.DeassertionEventByte1 = 0;
+            SensorInfo.DeassertionEventByte2 = 0;
+        }
+        if((pSensor.SensorCaps & BIT6) == 0)
+        {
+             SensorInfo.AssertionEventByte1    = (pSensor.AssertionHistoryByte1 & pSensor.AssertionEventEnablesByte1);
+             SensorInfo.AssertionEventByte2    = (pSensor.AssertionHistoryByte2 & pSensor.AssertionEventEnablesByte2);
+             SensorInfo.DeassertionEventByte1    = (pSensor.DeassertionHistoryByte1 & pSensor.DeassertionEventEnablesByte1);
+             SensorInfo.DeassertionEventByte2    = (pSensor.DeassertionHistoryByte2 & pSensor.DeassertionEventEnablesByte2);
+        }
+        else
+        {
+             SensorInfo.AssertionEventByte1    = (pSensor.AssertionEventOccuredByte1 & pSensor.AssertionEventEnablesByte1);
+             SensorInfo.AssertionEventByte2    = (pSensor.AssertionEventOccuredByte2 & pSensor.AssertionEventEnablesByte2);
+             SensorInfo.DeassertionEventByte1    = (pSensor.DeassertionEventOccuredByte1 & pSensor.DeassertionEventEnablesByte1);
+             SensorInfo.DeassertionEventByte2    = (pSensor.DeassertionEventOccuredByte2 & pSensor.DeassertionEventEnablesByte2);
+        }
+        pSDRRec = GetSDRRec(pSensor.SDRRec->ID);
+        if(pSensor.SDRRec->Type  == FULL_SDR_REC)       /*Full SDR*/
+        {
+            FullSDR = (FullSensorRec_T *)pSDRRec;
+            SensorInfo.OwnerID = FullSDR->OwnerID;
+            SensorInfo.OwnerLUN= FullSDR->OwnerLUN;
+            SensorInfo.MaxReading = FullSDR->MaxReading;
+            SensorInfo.MinReading = FullSDR->MinReading;
+            SensorInfo.Linearization = FullSDR->Linearization;
+            memset(SensorInfo.SensorName,0,MAX_ID_STR_LEN);
+            strncpy(SensorInfo.SensorName,FullSDR->IDStr, MAX_ID_STR_LEN - (sizeof(FullSensorRec_T) - sizeof(SDRRecHdr_T) - FullSDR->hdr.Len));
+        }
+        else if(pSensor.SDRRec->Type == COMPACT_SDR_REC)   /*Compact SDR*/
+        {
+            CompSDR = (CompactSensorRec_T *)pSDRRec;
+            SensorInfo.OwnerID = CompSDR->OwnerID;
+            SensorInfo.OwnerLUN= CompSDR->OwnerLUN;
+            SensorInfo.MaxReading = 0;
+            SensorInfo.MinReading = 0;
+            SensorInfo.Linearization = 0;
+            memset(SensorInfo.SensorName,0,MAX_ID_STR_LEN);
+            strncpy(SensorInfo.SensorName,CompSDR->IDStr, MAX_ID_STR_LEN - (sizeof(CompactSensorRec_T) - sizeof(SDRRecHdr_T) - CompSDR->hdr.Len));
+        }
+        memcpy(pValidSensor,(uint8_t *)&SensorInfo,sizeof(SenInfo_T));
+        pValidSensor = pValidSensor + sizeof(SenInfo_T);
+    }
+
+    pAMIGetSensorInfoRes->CompletionCode = CC_NORMAL;
+    pAMIGetSensorInfoRes->Noofentries = g_BMCInfo.SenConfig.ValidSensorCnt;
+
+    // printf("return %d :", sizeof(AMIGetSensorInfoRes_T) + (sizeof(SenInfo_T) * g_BMCInfo.SenConfig.ValidSensorCnt));
+    // for(i=0;i<sizeof(AMIGetSensorInfoRes_T) + (sizeof(SenInfo_T) * g_BMCInfo.SenConfig.ValidSensorCnt);i++)
+    // 	printf("%#x ", pRes[i]);
+    // printf("\n");
+
+    return sizeof(AMIGetSensorInfoRes_T) + (sizeof(SenInfo_T) * g_BMCInfo.SenConfig.ValidSensorCnt);
+
+}

+ 7 - 0
app/bmc/msghndlr/Storlead/Storlead.h

@@ -0,0 +1,7 @@
+
+#include "com_BmcType.h"
+#include "com_IPMI_Storlead.h"
+
+
+int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
+int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);

+ 10 - 0
app/bmc/msghndlr/cmdselect.c

@@ -29,6 +29,7 @@
 #include "com_IPMI_SensorEvent.h"
 #include "com_IPMI_Storage.h"
 #include "OemSMMCmds.h"
+#include "Storlead.h"
 //#include "IPMI_Transport.h"
 //#include "OemSMMCmds.h"
 //#include "main.h"
@@ -793,6 +794,14 @@ const NetFnCmds_T g_oem[] =			//jimbo add
 	{0,											0}
 };
 
+const NetFnCmds_T g_Storlead [] = 
+{
+	/*------------------------- IPM Device Commands --------------------------------------*/
+	{ CMD_GET_SYS_INFO          ,ENABLED},
+	{ CMD_GET_SENSOR_INFO          ,ENABLED},
+	{0,				0		},
+};
+
 NETFNTable_T Netfntbl [] = 
 {
 	{ NETFN_APP,        GRPEXT_NA,      g_App       },
@@ -800,6 +809,7 @@ NETFNTable_T Netfntbl [] =
 	{ NETFN_BRIDGE,     GRPEXT_NA,      g_Bridge    },
 	{ NETFN_SENSOR,     GRPEXT_NA,      g_Sensor    },
 	{ NETFN_STORAGE,    GRPEXT_NA,      g_Storage   },
+	{ NETFN_STORLEAD,    GRPEXT_NA,      g_Storlead   },
 //	{ NETFN_TRANSPORT,  GRPEXT_NA,      g_Transport },
 //	{ NETFN_AMI,        GRPEXT_NA,      g_AMI       },
 //	{ NETFN_OPMA1,      GRPEXT_NA,      g_opma1     },

+ 47 - 0
app/common_include/com_BmcType.h

@@ -5,6 +5,7 @@
 #include "com_IPMI_FRU.h"
 #include "com_IPMIDefs.h"
 #include "com_IPMI_SEL.h"
+#include "com_IPMI_SDRRecord.h"
 
 #ifndef uint8_t
   #define uint8_t unsigned char
@@ -215,6 +216,52 @@ typedef struct {
 } OEM_FLAGS_T;
 
 
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint16_t   Noofentries;
+} AMIGetSensorInfoRes_T;
+
+
+typedef struct
+{
+    SDRRecHdr_T    hdr;
+    uint8_t               OwnerID;
+    uint8_t               OwnerLUN;
+    uint8_t               SensorNumber;
+    uint8_t               SensorReading;
+    uint8_t               MaxReading;
+    uint8_t               MinReading;
+    uint8_t               Flags;
+    uint8_t               ComparisonStatus;
+    uint8_t               OptionalStatus;
+    uint8_t               SensorTypeCode;
+    uint8_t               EventTypeCode;
+    uint8_t               Units1;
+    uint8_t               Units2;
+    uint8_t               Units3;
+    uint8_t               Linearization;
+    uint8_t               M_LSB;
+    uint8_t               M_MSB_Tolerance;
+    uint8_t               B_LSB;
+    uint8_t               B_MSB_Accuracy;
+    uint8_t               Accuracy_MSB_Exp;
+    uint8_t               RExp_BExp;
+    uint8_t               LowerNonCritical;
+    uint8_t               LowerCritical;
+    uint8_t               LowerNonRecoverable;
+    uint8_t               UpperNonCritical;
+    uint8_t               UpperCritical;
+    uint8_t               UpperNonRecoverable;
+    uint8_t               AssertionEventByte1;
+    uint8_t               AssertionEventByte2;
+    uint8_t               DeassertionEventByte1;
+    uint8_t               DeassertionEventByte2;
+    char                SensorName[MAX_ID_STR_LEN];
+    uint16_t              Settable_Readable_ThreshMask;    
+
+}SenInfo_T;
+
 // typedef struct
 // {
 //     uint8_t               Used;

+ 4 - 2
app/common_include/com_IPMIDefs.h

@@ -208,6 +208,8 @@
 //#define	MAX_USER_PWD_LEN								(20+1) //1 for storing the null character
 #define MAX_RAND_NO_LEN									16
 
+#define THRESHOLD_RESERVED_BIT  0xC0
+#define DISCRETE_RESERVED_BIT   0x80
 
 /* (0x6 << 2) == 0x18 */
 #define DEFAULT_NET_FN_LUN					0x18
@@ -216,7 +218,7 @@
 #define NETFNLUN_IPMI_STORAGE				0x28
 #define NETFNLUN_IPMI_CHASSIS               0x00
 #define NETFNLUN_IPMI_OEM					0xB8
-
+#define NETFNLUN_IPMI_STORLEAD				0xC8
 
 
 
@@ -266,7 +268,7 @@
 #define NETFN_STORAGE                     0x0A
 #define NETFN_TRANSPORT                   0x0C
 #define NETFN_PICMG                       0x2C
-#define NETFN_AMI                         0x32
+#define NETFN_STORLEAD                         0x32
 #define NETFN_OEM                         0x2E
 #define NETFN_OPMA1                       0x30
 #define NETFN_OPMA2                       0x3E

+ 7 - 0
app/common_include/com_IPMI_Storlead.h

@@ -0,0 +1,7 @@
+#ifndef __COM_IPMI_STORLEAD_H__
+#define __COM_IPMI_STORLEAD_H__
+
+#define CMD_GET_SYS_INFO   		0x0
+#define CMD_GET_SENSOR_INFO   	0x1
+
+#endif /* __COM_IPMI_STORLEAD_H__ */

+ 1 - 1
app/common_include/com_Message.h

@@ -40,7 +40,7 @@
 /*-----------------------------------
  * Definitions
  *-----------------------------------*/
-#define MSG_PAYLOAD_SIZE	1024
+#define MSG_PAYLOAD_SIZE	1024*2
 #define PIPE_NAME_LEN       	64
 
 /*-----------------------------------

+ 6 - 0
app/goahead-5.1.0/projects/goahead-linux-static.mk

@@ -224,6 +224,7 @@ DEPS_USER_H2 += ../common_include/com_IPMI_LANConfig.h
 DEPS_USER_H2 += ../common_include/com_IPMI_PEF.h
 DEPS_USER_H2 += ../common_include/com_IPMI_RMCP.h
 DEPS_USER_H2 += ../common_include/com_BmcType.h
+DEPS_USER_H2 += ../common_include/com_IPMI_Storlead.h
 
 
 $(BUILD)/inc/libipmi_session.h: $(DEPS_USER_H2)
@@ -371,6 +372,10 @@ $(BUILD)/inc/com_BmcType.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/com_BmcType.h'
 	mkdir -p "$(BUILD)/inc"
 	cp ../common_include/com_BmcType.h $(BUILD)/inc/com_BmcType.h
+$(BUILD)/inc/com_IPMI_Storlead.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_Storlead.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_Storlead.h $(BUILD)/inc/com_IPMI_Storlead.h
 
 #
 #   LUSA, ResultUtils
@@ -475,6 +480,7 @@ DEPS_USER_C2 += $(BUILD)/inc/com_BmcType.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_Sensor.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_SDRRecord.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_PEF.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_Storlead.h
 
 
 

+ 0 - 43
app/goahead-5.1.0/src/libipmi/inc/libipmi_struct.h

@@ -72,50 +72,7 @@ typedef enum
     AUTH_BYPASS_FLAG,
 }USER_Auth;
 
-typedef struct
-{
-    uint8_t   CompletionCode;
-    uint16_t   Noofentries;
-} AMIGetSensorInfoRes_T;
-
-typedef struct
-{
-    SDRRecHdr_T    hdr;
-    uint8_t               OwnerID;
-    uint8_t               OwnerLUN;
-    uint8_t               SensorNumber;
-    uint8_t               SensorReading;
-    uint8_t               MaxReading;
-    uint8_t               MinReading;
-    uint8_t               Flags;
-    uint8_t               ComparisonStatus;
-    uint8_t               OptionalStatus;
-    uint8_t               SensorTypeCode;
-    uint8_t               EventTypeCode;
-    uint8_t               Units1;
-    uint8_t               Units2;
-    uint8_t               Units3;
-    uint8_t               Linearization;
-    uint8_t               M_LSB;
-    uint8_t               M_MSB_Tolerance;
-    uint8_t               B_LSB;
-    uint8_t               B_MSB_Accuracy;
-    uint8_t               Accuracy_MSB_Exp;
-    uint8_t               RExp_BExp;
-    uint8_t               LowerNonCritical;
-    uint8_t               LowerCritical;
-    uint8_t               LowerNonRecoverable;
-    uint8_t               UpperNonCritical;
-    uint8_t               UpperCritical;
-    uint8_t               UpperNonRecoverable;
-    uint8_t               AssertionEventByte1;
-    uint8_t               AssertionEventByte2;
-    uint8_t               DeassertionEventByte1;
-    uint8_t               DeassertionEventByte2;
-    char                SensorName[MAX_ID_STR_LEN];
-    uint16_t              Settable_Readable_ThreshMask;    
 
-}SenInfo_T;
 
 
 

+ 4 - 2
app/goahead-5.1.0/src/libipmi/inc/libsensor.h

@@ -23,7 +23,7 @@
 // #define THRESH_UP_NON_RECOV         ( (u16)0x40 )
 // #define THRESH_LOW_NON_RECOV        ( (u16)0x80 )
 
-//#pragma pack(1)
+#pragma pack(1)
 struct sensor_data
 {
 	/*
@@ -48,7 +48,9 @@ struct sensor_data
     float high_non_recov_thresh;
     int SensorAccessibleFlags;
     uint16_t Settable_Readable_ThreshMask;    
-};
+} ;
+
+#pragma pack()
 
 int getsensorcount( IPMI20_SESSION_T *pSession );
 int getallsensorreadings( struct sensor_data *sensors, IPMI20_SESSION_T *pSession );

+ 112 - 112
app/goahead-5.1.0/src/libipmi/src/libipmi_sensor.c

@@ -853,29 +853,29 @@ LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,
  */
 
   uint16_t
-LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,          struct sensor_data *sensor_list, uint32_t* nNumSensor, int timeout )
+LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession, struct sensor_data *sensor_list, uint32_t* nNumSensor, int timeout )
 {
     uint16_t wRet;
-  //   int sdr_count;
-  //   int i ;
-  //   SenInfo_T * pSensorBuff = NULL;
-  //   unsigned char* pSensor = NULL;
-
-  //   /* Load the SDRs related to sensors into memory */
-  //   wRet = LIBIPMI_HL_GetSensorCount( pSession,&sdr_count, timeout );
-  //   if( wRet != LIBIPMI_E_SUCCESS )
-  //   {
-  //       printf( "Cannot load sensor SDRs\n" );
-  //       return( wRet );
-  //   }
+    int sdr_count;
+    int i ;
+    SenInfo_T * pSensorBuff = NULL;
+    unsigned char* pSensor = NULL;
 
-  //   pSensorBuff = (SenInfo_T*) malloc(sdr_count* sizeof(SenInfo_T));
-  //   if(pSensorBuff == NULL)
-  //   {
-  //       printf("Error in Allocating the Memory\n");
-  //       return -1;
-  //   }
-  //   pSensor = (unsigned char *)pSensorBuff;
+    /* Load the SDRs related to sensors into memory */
+    wRet = LIBIPMI_HL_GetSensorCount( pSession,&sdr_count, timeout );
+    if( wRet != LIBIPMI_E_SUCCESS )
+    {
+        printf( "Cannot load sensor SDRs\n" );
+        return( wRet );
+    }
+
+    pSensorBuff = (SenInfo_T*) malloc(sdr_count* sizeof(SenInfo_T));
+    if(pSensorBuff == NULL)
+    {
+        printf("Error in Allocating the Memory\n");
+        return -1;
+    }
+    pSensor = (unsigned char *)pSensorBuff;
 
   //   if(pSession->byMediumType == 5)	//IPMB
   //   {
@@ -895,100 +895,100 @@ LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,          struct sen
 		// }
   //   }
   //   else
-  //   {
-  //   	wRet = LIBIPMI_HL_AMIGetSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
-		// if ( wRet != LIBIPMI_E_SUCCESS )
-		// {
-		// 	free(pSensorBuff);
-		// 	if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
-		// 	{
-		// 		TINFO("Sensor Info is empty\n");
-		// 	}
-		// 	else
-		// 	{
-		// 		printf("Error in getting sensor info\n");
-		// 	}
-		// 	return (wRet);
-		// }
-  //   }
+    {
+    	wRet = LIBIPMI_HL_AMIGetSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
+		if ( wRet != LIBIPMI_E_SUCCESS )
+		{
+			free(pSensorBuff);
+			if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
+			{
+				printf("Sensor Info is empty\n");
+			}
+			else
+			{
+				printf("Error in getting sensor info\n");
+			}
+			return (wRet);
+		}
+    }
 
-  //   for(i = 0; i < *nNumSensor; i++)
-  //   {
-  //       sensor_list[ i ].sensor_num = pSensorBuff->SensorNumber;
-  //       sensor_list[ i ].owner_id = pSensorBuff->OwnerID;
-  //       sensor_list[ i ].owner_lun = pSensorBuff->OwnerLUN;
-  //       sensor_list[ i ].sensor_type = pSensorBuff->SensorTypeCode;
-  //       sensor_list[ i ].sensor_units[ 0 ] = pSensorBuff->Units1;
-  //       sensor_list[ i ].sensor_units[ 1 ] = pSensorBuff->Units2;
-  //       sensor_list[ i ].sensor_units[ 2 ] = pSensorBuff->Units3;
-  //       sensor_list[ i ].raw_reading = pSensorBuff->SensorReading;
-  //       strncpy(sensor_list[ i ].sensor_name,pSensorBuff->SensorName,MAX_ID_STR_LEN);
-  //       sensor_list[i].SensorAccessibleFlags = 0;
-
-  //       if(pSensorBuff->EventTypeCode > 1)
-  //       {
-  //           /*Updating the discrete sensor details*/
-  //           sensor_list[i].discrete_state = pSensorBuff->EventTypeCode;
-  //           sensor_list[i].sensor_state = 0;
-  //           sensor_list[ i ].sensor_reading = (float)(pSensorBuff->ComparisonStatus | (pSensorBuff->OptionalStatus << 8));
-  //       }
-  //       else
-  //       {
-  //           sensor_list[ i ].discrete_state = 0;
-  //           sensor_list[ i ].Settable_Readable_ThreshMask=pSensorBuff->Settable_Readable_ThreshMask;
+    for(i = 0; i < *nNumSensor; i++)
+    {
+        sensor_list[ i ].sensor_num = pSensorBuff->SensorNumber;
+        sensor_list[ i ].owner_id = pSensorBuff->OwnerID;
+        sensor_list[ i ].owner_lun = pSensorBuff->OwnerLUN;
+        sensor_list[ i ].sensor_type = pSensorBuff->SensorTypeCode;
+        sensor_list[ i ].sensor_units[ 0 ] = pSensorBuff->Units1;
+        sensor_list[ i ].sensor_units[ 1 ] = pSensorBuff->Units2;
+        sensor_list[ i ].sensor_units[ 2 ] = pSensorBuff->Units3;
+        sensor_list[ i ].raw_reading = pSensorBuff->SensorReading;
+        strncpy(sensor_list[ i ].sensor_name,pSensorBuff->SensorName,MAX_ID_STR_LEN);
+        sensor_list[i].SensorAccessibleFlags = 0;
+
+        if(pSensorBuff->EventTypeCode > 1)
+        {
+            /*Updating the discrete sensor details*/
+            sensor_list[i].discrete_state = pSensorBuff->EventTypeCode;
+            sensor_list[i].sensor_state = 0;
+            sensor_list[ i ].sensor_reading = (float)(pSensorBuff->ComparisonStatus | (pSensorBuff->OptionalStatus << 8));
+        }
+        else
+        {
+            sensor_list[ i ].discrete_state = 0;
+            sensor_list[ i ].Settable_Readable_ThreshMask=pSensorBuff->Settable_Readable_ThreshMask;
             
-  //           if(pSensorBuff->SensorReading>0)
-  //           /*Convert Sensor Reading*/
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->SensorReading, &sensor_list[i].sensor_reading, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert LowerNonRecoverable*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT2)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonRecoverable, &sensor_list[i].low_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert LowerCritical*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT1)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerCritical, &sensor_list[i].low_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert LowerNonCritical*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT0)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonCritical, &sensor_list[i].low_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert UpperNonCritical*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT3)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonCritical, &sensor_list[i].high_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert UpperCritical*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT4)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperCritical, &sensor_list[i].high_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Convert UpperNonRecoverable*/
-  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT5)
-  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonRecoverable, &sensor_list[i].high_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-  //           /*Get the Sensor state*/
-  //           SensorState(pSensorBuff->SensorReading,&sensor_list[i].sensor_state,pSensorBuff->hdr.Type,pSensorBuff->Linearization,pSensorBuff->Units1,pSensorBuff->EventTypeCode,pSensorBuff->AssertionEventByte1,pSensorBuff->AssertionEventByte2,pSensorBuff->DeassertionEventByte1,pSensorBuff->DeassertionEventByte2);
-
-  //       }
-
-  //       /* If sensor scanning is disabled or the reading is unavailable... */
-  //       if( !( pSensorBuff->Flags & SENSOR_SCANNING_BIT)  || (pSensorBuff->Flags & UNABLE_TO_READ_SENSOR) )
-  //       {
-  //           /* Return an error code to let the caller know */
-  //           sensor_list[i].SensorAccessibleFlags = SENSOR_NOT_AVAILABLE;
-  //           sensor_list[i].sensor_reading = 0;
-  //           sensor_list[i].discrete_state = 0;
-  //           sensor_list[i].raw_reading = 0;
-  //       }
-  //       pSensorBuff++;
-  //   }
-  //   free(pSensor);
+            if(pSensorBuff->SensorReading>0)
+            /*Convert Sensor Reading*/
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->SensorReading, &sensor_list[i].sensor_reading, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert LowerNonRecoverable*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT2)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonRecoverable, &sensor_list[i].low_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert LowerCritical*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT1)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerCritical, &sensor_list[i].low_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert LowerNonCritical*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT0)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonCritical, &sensor_list[i].low_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert UpperNonCritical*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT3)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonCritical, &sensor_list[i].high_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert UpperCritical*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT4)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperCritical, &sensor_list[i].high_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Convert UpperNonRecoverable*/
+            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT5)
+            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonRecoverable, &sensor_list[i].high_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+            /*Get the Sensor state*/
+            SensorState(pSensorBuff->SensorReading,&sensor_list[i].sensor_state,pSensorBuff->hdr.Type,pSensorBuff->Linearization,pSensorBuff->Units1,pSensorBuff->EventTypeCode,pSensorBuff->AssertionEventByte1,pSensorBuff->AssertionEventByte2,pSensorBuff->DeassertionEventByte1,pSensorBuff->DeassertionEventByte2);
+
+        }
+
+        /* If sensor scanning is disabled or the reading is unavailable... */
+        if( !( pSensorBuff->Flags & SENSOR_SCANNING_BIT)  || (pSensorBuff->Flags & UNABLE_TO_READ_SENSOR) )
+        {
+            /* Return an error code to let the caller know */
+            sensor_list[i].SensorAccessibleFlags = SENSOR_NOT_AVAILABLE;
+            sensor_list[i].sensor_reading = 0;
+            sensor_list[i].discrete_state = 0;
+            sensor_list[i].raw_reading = 0;
+        }
+        pSensorBuff++;
+    }
+    free(pSensor);
     return wRet ;
 }
 

+ 182 - 131
app/goahead-5.1.0/src/libipmi/src/libipmi_storlead_OEM.c

@@ -14,6 +14,7 @@
 #include "libipmi_sdr.h"
 #include "libipmi_sensor.h"
 #include "libipmi_storlead_OEM.h"
+#include "com_IPMI_Storlead.h"
 
 
 OemWebFlags_T g_OemWebFlags;
@@ -27,152 +28,152 @@ OemWebFlags_T g_OemWebFlags;
 **/
 uint16_t IPMICMD_GetIPMCSensorInfo(IPMI20_SESSION_T *pSession, AMIGetSensorInfoRes_T *pGetIPMCSensorInfoRes,int timeout)
 {
-	uint16_t wRet = 0;
+ 	uint16_t wRet = 0;
 	
-	uint16_t reservation_id;
-	uint16_t record_id = 0;
-	uint32_t dwRecordLen;
-	SenInfo_T SensorInfo;
+// 	uint16_t reservation_id;
+// 	uint16_t record_id = 0;
+// 	uint32_t dwRecordLen;
+// 	SenInfo_T SensorInfo;
 	
-	uint8_t SDRData[100] = {0};
-	uint8_t NextRecIDLS = 0;
-	uint8_t NextRecIDMS = 0;
-	uint8_t cnt = 0;
-	uint8_t timeoutTick = 0;
-	wRet = IPMICMD_ReserveSDRRepository(pSession, (ReserveSDRRepositoryRes_T*)SDRData, timeout);
-	if(wRet != 0)
-	{
-		printf("Error Reserve SDR Repository\n");
-		return wRet;
-	}
+// 	uint8_t SDRData[100] = {0};
+// 	uint8_t NextRecIDLS = 0;
+// 	uint8_t NextRecIDMS = 0;
+// 	uint8_t cnt = 0;
+// 	uint8_t timeoutTick = 0;
+// 	wRet = IPMICMD_ReserveSDRRepository(pSession, (ReserveSDRRepositoryRes_T*)SDRData, timeout);
+// 	if(wRet != 0)
+// 	{
+// 		printf("Error Reserve SDR Repository\n");
+// 		return wRet;
+// 	}
 	
-	reservation_id = SDRData[2]<<8 | SDRData[1];
+// 	reservation_id = SDRData[2]<<8 | SDRData[1];
 	
-	do
-	{
-		//Get SDR
-		if(0 != LIBIPMI_HL_GetSDR(pSession, reservation_id, record_id, (GetSDRRes_T*)SDRData, &dwRecordLen, timeout ))
-		{
-			printf("---> Get SDR error! record_id = %#x\n", record_id);
-			return -1;
-		}
+// 	do
+// 	{
+// 		//Get SDR
+// 		if(0 != LIBIPMI_HL_GetSDR(pSession, reservation_id, record_id, (GetSDRRes_T*)SDRData, &dwRecordLen, timeout ))
+// 		{
+// 			printf("---> Get SDR error! record_id = %#x\n", record_id);
+// 			return -1;
+// 		}
 			
-		NextRecIDLS = SDRData[1];
-		NextRecIDMS = SDRData[2];
-		memcpy(&SensorInfo.hdr, &SDRData[3],5/*Sizeof(SDRRecHdr_T)*/);
-		if(SensorInfo.hdr.Type == 0x01)	//full sensor sdr
-		{	
-			SensorInfo.Accuracy_MSB_Exp = SDRData[3+29-1];
-			//SensorInfo.AssertionEventByte1 = SDRData[3+15-1];
-			//SensorInfo.AssertionEventByte2 = SDRData[3+16-1];
-			SensorInfo.B_LSB	= SDRData[3+27-1];
-			SensorInfo.B_MSB_Accuracy	=	SDRData[3+28-1];
-			SensorInfo.DeassertionEventByte1	=	SDRData[3+17-1];
-			SensorInfo.DeassertionEventByte2	=	SDRData[3+18-1];
-			SensorInfo.EventTypeCode	=	SDRData[3+14-1];
-			SensorInfo.Linearization	=	SDRData[3+24-1];
-			SensorInfo.LowerCritical	=	SDRData[3+41-1];
-			SensorInfo.LowerNonCritical	=	SDRData[3+42-1];
-			SensorInfo.LowerNonRecoverable	=	SDRData[3+40-1];
-			SensorInfo.M_LSB	=	SDRData[3+25-1];
-			SensorInfo.M_MSB_Tolerance	=	SDRData[3+26-1];
-			SensorInfo.MaxReading	=	SDRData[3+35-1];
-			SensorInfo.MinReading	=	SDRData[3+36-1];
-			SensorInfo.OwnerID	=	SDRData[3+6-1];
-			SensorInfo.OwnerLUN	=	SDRData[3+7-1];
-			SensorInfo.RExp_BExp	=	SDRData[3+30-1];			
-			SensorInfo.SensorNumber	=	SDRData[3+8-1];
-			SensorInfo.SensorTypeCode		=	SDRData[3+13-1];
-			SensorInfo.Settable_Readable_ThreshMask	=	SDRData[3+20-1]<<8 | SDRData[3+19-1];
-			SensorInfo.Units1	=	SDRData[3+21-1];
-			SensorInfo.Units2	=	SDRData[3+22-1];
-			SensorInfo.Units3	=	SDRData[3+23-1];
-			SensorInfo.UpperCritical	=	SDRData[3+38-1];
-			SensorInfo.UpperNonCritical	=	SDRData[3+39-1];
-			SensorInfo.UpperNonRecoverable = SDRData[3+37-1];
+// 		NextRecIDLS = SDRData[1];
+// 		NextRecIDMS = SDRData[2];
+// 		memcpy(&SensorInfo.hdr, &SDRData[3],5/*Sizeof(SDRRecHdr_T)*/);
+// 		if(SensorInfo.hdr.Type == 0x01)	//full sensor sdr
+// 		{	
+// 			SensorInfo.Accuracy_MSB_Exp = SDRData[3+29-1];
+// 			//SensorInfo.AssertionEventByte1 = SDRData[3+15-1];
+// 			//SensorInfo.AssertionEventByte2 = SDRData[3+16-1];
+// 			SensorInfo.B_LSB	= SDRData[3+27-1];
+// 			SensorInfo.B_MSB_Accuracy	=	SDRData[3+28-1];
+// 			SensorInfo.DeassertionEventByte1	=	SDRData[3+17-1];
+// 			SensorInfo.DeassertionEventByte2	=	SDRData[3+18-1];
+// 			SensorInfo.EventTypeCode	=	SDRData[3+14-1];
+// 			SensorInfo.Linearization	=	SDRData[3+24-1];
+// 			SensorInfo.LowerCritical	=	SDRData[3+41-1];
+// 			SensorInfo.LowerNonCritical	=	SDRData[3+42-1];
+// 			SensorInfo.LowerNonRecoverable	=	SDRData[3+40-1];
+// 			SensorInfo.M_LSB	=	SDRData[3+25-1];
+// 			SensorInfo.M_MSB_Tolerance	=	SDRData[3+26-1];
+// 			SensorInfo.MaxReading	=	SDRData[3+35-1];
+// 			SensorInfo.MinReading	=	SDRData[3+36-1];
+// 			SensorInfo.OwnerID	=	SDRData[3+6-1];
+// 			SensorInfo.OwnerLUN	=	SDRData[3+7-1];
+// 			SensorInfo.RExp_BExp	=	SDRData[3+30-1];			
+// 			SensorInfo.SensorNumber	=	SDRData[3+8-1];
+// 			SensorInfo.SensorTypeCode		=	SDRData[3+13-1];
+// 			SensorInfo.Settable_Readable_ThreshMask	=	SDRData[3+20-1]<<8 | SDRData[3+19-1];
+// 			SensorInfo.Units1	=	SDRData[3+21-1];
+// 			SensorInfo.Units2	=	SDRData[3+22-1];
+// 			SensorInfo.Units3	=	SDRData[3+23-1];
+// 			SensorInfo.UpperCritical	=	SDRData[3+38-1];
+// 			SensorInfo.UpperNonCritical	=	SDRData[3+39-1];
+// 			SensorInfo.UpperNonRecoverable = SDRData[3+37-1];
 			
-			memset(SensorInfo.SensorName, 0, 16);
-			memcpy(SensorInfo.SensorName, &SDRData[3+49-1], SDRData[3+48-1]&0x3f);
+// 			memset(SensorInfo.SensorName, 0, 16);
+// 			memcpy(SensorInfo.SensorName, &SDRData[3+49-1], SDRData[3+48-1]&0x3f);
 			
-			//get sensor reading
-			if(0 != IPMICMD_GetSensorReading(pSession, (GetSensorReadingReq_T *)&SensorInfo.SensorNumber, 
-				(GetSensorReadingRes_T *)SDRData, timeout))
-			{
-				printf("---> Get sensorReading error! sensorNum = %#x\n", SensorInfo.SensorNumber);
-				return -1;
-			}
-			SensorInfo.SensorReading = SDRData[1];
-			SensorInfo.OptionalStatus	=	SDRData[4];
-			SensorInfo.Flags	=	SDRData[2];
+// 			//get sensor reading
+// 			if(0 != IPMICMD_GetSensorReading(pSession, (GetSensorReadingReq_T *)&SensorInfo.SensorNumber, 
+// 				(GetSensorReadingRes_T *)SDRData, timeout))
+// 			{
+// 				printf("---> Get sensorReading error! sensorNum = %#x\n", SensorInfo.SensorNumber);
+// 				return -1;
+// 			}
+// 			SensorInfo.SensorReading = SDRData[1];
+// 			SensorInfo.OptionalStatus	=	SDRData[4];
+// 			SensorInfo.Flags	=	SDRData[2];
 			
-			SensorInfo.ComparisonStatus = SDRData[3];
-			if(SensorInfo.EventTypeCode == 0x01)	//threshold
-			{
-				//TODO: jimbo
-				SensorInfo.AssertionEventByte1 = 0x0;
-				SensorInfo.AssertionEventByte2 = 0x0;
-				if((SensorInfo.Units1 & 0xc0) == 0x00)	//unsigned
-				{
-					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperCritical)
-						SensorInfo.AssertionEventByte2 |= 0x02;
-					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperNonCritical)
-						SensorInfo.AssertionEventByte1 |= 0x80;
-					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperNonRecoverable)
-						SensorInfo.AssertionEventByte2 |= 0x08;
-					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerCritical)
-						SensorInfo.AssertionEventByte1 |= 0x04;
-					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerNonCritical)
-						SensorInfo.AssertionEventByte1 |= 0x01;
-					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerNonRecoverable)
-						SensorInfo.AssertionEventByte1 |= 0x10;					
-				}
-				else if((SensorInfo.Units1 & 0xc0) == 0x80)	//2's complement
-				{
-					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperCritical)
-						SensorInfo.AssertionEventByte2 |= 0x02;
-					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonCritical)
-						SensorInfo.AssertionEventByte1 |= 0x80;
-					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonRecoverable)
-						SensorInfo.AssertionEventByte2 |= 0x08;
-					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerCritical)
-						SensorInfo.AssertionEventByte1 |= 0x04;
-					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonCritical)
-						SensorInfo.AssertionEventByte1 |= 0x01;
-					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonRecoverable)
-						SensorInfo.AssertionEventByte1 |= 0x10;
-				}
+// 			SensorInfo.ComparisonStatus = SDRData[3];
+// 			if(SensorInfo.EventTypeCode == 0x01)	//threshold
+// 			{
+// 				//TODO: jimbo
+// 				SensorInfo.AssertionEventByte1 = 0x0;
+// 				SensorInfo.AssertionEventByte2 = 0x0;
+// 				if((SensorInfo.Units1 & 0xc0) == 0x00)	//unsigned
+// 				{
+// 					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperCritical)
+// 						SensorInfo.AssertionEventByte2 |= 0x02;
+// 					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperNonCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x80;
+// 					if((uint8_t)SensorInfo.SensorReading > (uint8_t)SensorInfo.UpperNonRecoverable)
+// 						SensorInfo.AssertionEventByte2 |= 0x08;
+// 					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x04;
+// 					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerNonCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x01;
+// 					if((uint8_t)SensorInfo.SensorReading < (uint8_t)SensorInfo.LowerNonRecoverable)
+// 						SensorInfo.AssertionEventByte1 |= 0x10;					
+// 				}
+// 				else if((SensorInfo.Units1 & 0xc0) == 0x80)	//2's complement
+// 				{
+// 					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperCritical)
+// 						SensorInfo.AssertionEventByte2 |= 0x02;
+// 					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x80;
+// 					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonRecoverable)
+// 						SensorInfo.AssertionEventByte2 |= 0x08;
+// 					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x04;
+// 					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonCritical)
+// 						SensorInfo.AssertionEventByte1 |= 0x01;
+// 					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonRecoverable)
+// 						SensorInfo.AssertionEventByte1 |= 0x10;
+// 				}
 				
-			}
+// 			}
 			
 			
-			memcpy(((uint8_t*)pGetIPMCSensorInfoRes)+3+sizeof(SenInfo_T)*cnt, &SensorInfo, sizeof(SenInfo_T));
-			cnt++;
+// 			memcpy(((uint8_t*)pGetIPMCSensorInfoRes)+3+sizeof(SenInfo_T)*cnt, &SensorInfo, sizeof(SenInfo_T));
+// 			cnt++;
 			
-//			printf("cnt: %d, sensorNum: %#x, sensorReading: %#x, OptionStatus = %#x, ComparisonStatus = %#x\n", 
-//					cnt, SensorInfo.SensorNumber, SensorInfo.SensorReading, SensorInfo.OptionalStatus, SensorInfo.ComparisonStatus);
-		}
+// //			printf("cnt: %d, sensorNum: %#x, sensorReading: %#x, OptionStatus = %#x, ComparisonStatus = %#x\n", 
+// //					cnt, SensorInfo.SensorNumber, SensorInfo.SensorReading, SensorInfo.OptionalStatus, SensorInfo.ComparisonStatus);
+// 		}
 		
 		
-		record_id = NextRecIDMS<<8 | NextRecIDLS;
-		timeoutTick++;
-		if(timeoutTick > 64)	
-		{
-			wRet = -1;
-			break;
-		}
-	}while(record_id != 0xffff);	  
+// 		record_id = NextRecIDMS<<8 | NextRecIDLS;
+// 		timeoutTick++;
+// 		if(timeoutTick > 64)	
+// 		{
+// 			wRet = -1;
+// 			break;
+// 		}
+// 	}while(record_id != 0xffff);	  
 	
-	if(wRet == 0)
-		pGetIPMCSensorInfoRes->CompletionCode = 0;
-	else
-		pGetIPMCSensorInfoRes->CompletionCode = 255;
+// 	if(wRet == 0)
+// 		pGetIPMCSensorInfoRes->CompletionCode = 0;
+// 	else
+// 		pGetIPMCSensorInfoRes->CompletionCode = 255;
 	
-	pGetIPMCSensorInfoRes->Noofentries = cnt;
+// 	pGetIPMCSensorInfoRes->Noofentries = cnt;
 	
-//	printf("return pGetIPMCSensorInfoRes: ");
-//	for(i=0;i<3+sizeof(SenInfo_T)*cnt;i++)
-//		printf("%#2x ",((uint8_t*)pGetIPMCSensorInfoRes)[i]);
-//	printf("\n");
+// //	printf("return pGetIPMCSensorInfoRes: ");
+// //	for(i=0;i<3+sizeof(SenInfo_T)*cnt;i++)
+// //		printf("%#2x ",((uint8_t*)pGetIPMCSensorInfoRes)[i]);
+// //	printf("\n");
 	
 	return (wRet);
 }
@@ -277,7 +278,7 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_SESSION_T *pSession, SysInfo_T *pSysInfo,
 	Req[3] = (MAX_TITLE_LEN>>8)&0xff;	//max title len
 	Req[4] = MAX_TITLE_LEN&0xff;
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   
-												NETFNLUN_IPMI_OEM, 0x80,
+												NETFNLUN_IPMI_STORLEAD, CMD_GET_SYS_INFO,
 												(uint8_t*)Req, 5,
 												(uint8_t *)Res, &dwResLen,
 												timeout);
@@ -297,7 +298,7 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_SESSION_T *pSession, SysInfo_T *pSysInfo,
 	Req[3] = (MAX_TEXT_LEN>>8)&0xff;	//max text len
 	Req[4] = MAX_TEXT_LEN&0xff;
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   
-												NETFNLUN_IPMI_OEM, 0x80,
+												NETFNLUN_IPMI_STORLEAD, CMD_GET_SYS_INFO,
 												(uint8_t*)Req, 5,
 												(uint8_t *)Res, &dwResLen,
 												timeout);
@@ -608,3 +609,53 @@ int LIBIPMI_HL_SetSensorHistoryEn(IPMI20_SESSION_T *pSession, uint8_t sensorNum,
  
  return 0;
 }
+
+uint16_t IPMICMD_AMIGetSensorInfo(IPMI20_SESSION_T *pSession, AMIGetSensorInfoRes_T *pAMIGetSensorInfoRes,int timeout)
+{
+	uint16_t wRet;
+	uint32_t dwResLen;
+	uint8_t Req[20];
+	dwResLen = sizeof(AMIGetSensorInfoRes_T);
+	
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, 	//notice!
+						(NETFN_STORLEAD << 2), CMD_GET_SENSOR_INFO,
+						Req, 0,
+						(uint8_t*)pAMIGetSensorInfoRes, &dwResLen,
+						timeout);
+	
+	return (wRet);
+}
+
+uint16_t LIBIPMI_HL_AMIGetSensorInfo(IPMI20_SESSION_T *pSession,SenInfo_T *pSensorInfo,uint32_t *nNumSensor,int timeout)
+{
+	uint16_t wRet = 0;
+	AMIGetSensorInfoRes_T *pAMIGetSensorInfoRes;
+	uint8_t *SensorEntries;
+	int i;
+
+	SensorEntries = (uint8_t *)malloc(MAX_SENSOR_INFO_SIZE);
+	if(SensorEntries == NULL)
+	{
+		printf("Memory allocation error in LIBIPMI_HL_AMIGetSELEntires \n");
+		wRet = 0xFF;
+		return wRet;
+	}
+
+	memset(SensorEntries,0,MAX_SENSOR_INFO_SIZE);
+	pAMIGetSensorInfoRes = (AMIGetSensorInfoRes_T *)SensorEntries;
+	wRet = IPMICMD_AMIGetSensorInfo(pSession,(AMIGetSensorInfoRes_T *)SensorEntries,timeout);
+	if(wRet == LIBIPMI_E_SUCCESS)
+	{
+		*nNumSensor = pAMIGetSensorInfoRes->Noofentries;
+		for(i = 0; i < pAMIGetSensorInfoRes->Noofentries; i++)
+		{
+			memcpy((uint8_t *)&pSensorInfo[i],&SensorEntries[sizeof(AMIGetSensorInfoRes_T) + (i * sizeof(SenInfo_T))],sizeof(SenInfo_T) );
+		}
+	}
+	else
+	{
+		printf("error getting sensor info %d\n",wRet);
+	}
+	free(SensorEntries);
+	return (wRet);
+}

+ 128 - 1
app/goahead-5.1.0/src/web_interface/src/dashboard.c

@@ -4,6 +4,7 @@
 #include    "ResultUtils.h"
 #include    "cJSON.h"
 #include    "libipmi_storlead_OEM.h"
+#include    "libsensor.h"
 /*获取设备信息*/
 
 /*获取设备信息*/
@@ -167,10 +168,136 @@ sys_info_end:
 
 
 /*获取刀片信息*/
-void getCardInfo(Webs *web){
+void getCardInfo(Webs *wp){
 
 }
 
+void getSensorInfo(Webs *wp){
+    int         wRet;
+    int         nSensors = 0;
+    uint8_t     SensorNumber;
+    char        SensorName[MAX_ID_STR_LEN];
+    uint8_t     OwnerID;
+    uint8_t     OwnerLUN;
+    uint8_t     SensorType;
+    uint8_t     SensorUnit1;
+    uint8_t     SensorUnit2;
+    uint8_t     SensorUnit3;
+    int         SensorReading;
+    uint8_t     RawReading;
+    uint16_t    SensorState;
+    uint8_t     DiscreteState;
+    int         LowNRThresh;
+    int         LowCTThresh;
+    int         LowNCThresh;
+    int         HighNCThresh;
+    int         HighCTThresh;
+    int         HighNRThresh;
+    int         SensorAccessibleFlags;
+    struct sensor_data *pSensorBuff = NULL;
+    long int reading,lownr,lowct,lownc,highnc,highct,highnr = 0;
+    unsigned char *pStartBuff = NULL;
+    uint32_t nNumSensor = 0;
+
+    //Create session
+    wRet = LIBIPMI_CreateSession(&wp->ipmi_session, 10);
+   
+    /* Get number of SEL records in the system at this time */
+    wRet = LIBIPMI_HL_GetSensorCount(&wp->ipmi_session,&nSensors,DEFAULT_TIMEOUT);
+    if( wRet != 0 )
+    {
+        printf("Error getting num of sensors\n");
+        goto error_out;
+    }
+    else
+    {
+        //printf("success getting num of sensors: %d\n",nSensors);  //this is all sensor count
+        /* Now get all sensors records */
+        if(!nSensors)
+        {
+            /* There are no sensors present at this time */
+            goto error_out;
+        }
+
+        /* Allocate the buffer to hold sensors records */
+        pSensorBuff = (struct sensor_data *) malloc(nSensors * sizeof(struct sensor_data));
+        if(pSensorBuff == NULL)
+        {
+            printf("Error alloc memory!\n");
+            goto error_out;
+        }
+        memset(pSensorBuff, 0, nSensors * sizeof(struct sensor_data));
+        pStartBuff = (unsigned char *)pSensorBuff;
+
+        wRet = LIBIPMI_HL_GetAllSensorReadings(&wp->ipmi_session,pSensorBuff, &nNumSensor,DEFAULT_TIMEOUT);
+        
+
+        if(wRet != 0)
+        {
+            printf("Error reading All Sensors\n");
+            goto error_out;
+        }
+        else
+        {
+            //printf("sesscess reading All Sensors, nNumSensor = %d\n", nNumSensor);    //this is sensor number
+            /* Write entries here */
+            while(nNumSensor)
+            {
+                reading = pSensorBuff->sensor_reading * 1000;
+                lownr = pSensorBuff->low_non_recov_thresh * 1000;
+                lowct = pSensorBuff->low_crit_thresh * 1000;
+                lownc = pSensorBuff->low_non_crit_thresh * 1000;
+                highnc = pSensorBuff->high_non_crit_thresh * 1000;
+                highct = pSensorBuff->high_crit_thresh * 1000;
+                highnr = pSensorBuff->high_non_recov_thresh * 1000;
+
+                // WEBPAGE_WRITE_JSON_RECORD(HL_GETALLSENSORS,
+                //             pSensorBuff->sensor_num,
+                //             pSensorBuff->sensor_name,
+                //             pSensorBuff->owner_id,
+                //             pSensorBuff->owner_lun,
+                //             pSensorBuff->sensor_type,
+                //             pSensorBuff->sensor_units[0],
+                //             pSensorBuff->sensor_units[1],
+                //             pSensorBuff->sensor_units[2],
+                //             reading,
+                //             pSensorBuff->raw_reading,
+                //             pSensorBuff->sensor_state,
+                //             pSensorBuff->discrete_state,
+                //             lownr,
+                //             lowct,
+                //             lownc,
+                //             highnc,
+                //             highct,
+                //             highnr,
+                //             pSensorBuff->SensorAccessibleFlags);
+                pSensorBuff++;
+                nNumSensor--;
+            }
+        }
+    }
+    //Close session
+    LIBIPMI_CloseSession(&wp->ipmi_session );
+
+    //TODO: lusa
+
+
+
+
+
+
+
+
+error_out:
+    if(pStartBuff != NULL)
+    {
+        free(pStartBuff);
+    }
+
+    
+}
+
+
 
 void buy(Webs *wp)
 {