8 コミット 50aefe297f ... 1bd14c49eb

作者 SHA1 メッセージ 日付
  zhangbo 1bd14c49eb Merge branch 'master' of https://gogs.storlead.com/zhangbo/GD32F450_BMC_BaseCode 3 年 前
  zhangbo 519d2a5049 add present to getAllBladeInfo 3 年 前
  zhangbo 2954b8653a Merge branch 'master' of https://gogs.storlead.com/zhangbo/GD32F450_BMC_BaseCode 3 年 前
  zhangbo b9d4229f30 for sync 3 年 前
  zhangbo 38006110af Merge branch 'master' of https://gogs.storlead.com/zhangbo/GD32F450_BMC_BaseCode 3 年 前
  zhangbo ae5b0cd7f2 all ipmc interfance ok 3 年 前
  zhangbo 9ec59f4ef0 remote_control ipmc ok 3 年 前
  zhangbo d592d676b5 server_health web ok 3 年 前
32 ファイル変更1107 行追加2222 行削除
  1. 64 4
      app/bmc/Api.c
  2. 2 1
      app/bmc/Api.h
  3. 5 2
      app/bmc/BmcType.h
  4. 14 7
      app/bmc/PendActionTask/PendActionTask.c
  5. 0 5
      app/bmc/Util.h
  6. 15 14
      app/bmc/main.c
  7. 1 1
      app/bmc/msghndlr/App/App.c
  8. 50 50
      app/bmc/msghndlr/App/AppDevice/AppDevice.c
  9. 53 27
      app/bmc/msghndlr/Storlead/Storlead.c
  10. 191 1335
      app/bmc/msghndlr/Transport/LANConfig.c
  11. 2 2
      app/bmc/msghndlr/Transport/LANConfig.h
  12. 3 2
      app/common_include/com_BmcType.h
  13. 6 6
      app/common_include/com_IPMI_LANConfig.h
  14. 2 66
      app/goahead-3.6.5/src/libipmi/inc/libipmi_ChassisDevice.h
  15. 6 0
      app/goahead-3.6.5/src/libipmi/inc/libipmi_sdr.h
  16. 3 0
      app/goahead-3.6.5/src/libipmi/inc/libipmi_sensor.h
  17. 15 14
      app/goahead-3.6.5/src/libipmi/inc/libipmi_storlead_OEM.h
  18. 101 97
      app/goahead-3.6.5/src/libipmi/src/libipmi_Chassis.c
  19. 20 20
      app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c
  20. 82 5
      app/goahead-3.6.5/src/libipmi/src/libipmi_sdr.c
  21. 47 0
      app/goahead-3.6.5/src/libipmi/src/libipmi_sensor.c
  22. 65 299
      app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c
  23. 102 87
      app/goahead-3.6.5/src/web_interface/src/config.c
  24. 29 10
      app/goahead-3.6.5/src/web_interface/src/dashboard.c
  25. 2 2
      app/goahead-3.6.5/src/web_interface/src/fan.c
  26. 3 3
      app/goahead-3.6.5/src/web_interface/src/fru.c
  27. 24 27
      app/goahead-3.6.5/src/web_interface/src/fw_update.c
  28. 44 30
      app/goahead-3.6.5/src/web_interface/src/remote_control.c
  29. 18 19
      app/goahead-3.6.5/src/web_interface/src/sel.c
  30. 110 39
      app/goahead-3.6.5/src/web_interface/src/server_health.c
  31. 17 41
      app/goahead-3.6.5/src/web_interface/src/user.c
  32. 11 7
      app/ipmitool-1.8.18/lib/ipmi_lanp.c

+ 64 - 4
app/bmc/Api.c

@@ -50,9 +50,9 @@ int PlatformInit(void)
 	
 	
 	//LAN地址
-	LanInfo_T *pSetLanInfo = &g_BMCInfo.LanInfo[0];
-	strcpy(pSetLanInfo->EthName, "eth0");
-	pSetLanInfo->IPAddrSrc 	= 	0x01;	//static
+	LanInfo_T *pSetLanInfo = &g_BMCInfo.IpmiConfig.LanInfo[0];
+	// strcpy(pSetLanInfo->EthName, "eth0");
+	// pSetLanInfo->IPAddrSrc 	= 	0x01;	//static
 	pSetLanInfo->IPAddr[0] = 192;
 	pSetLanInfo->IPAddr[1] = 168;
 	pSetLanInfo->IPAddr[2] = 1;		//网段
@@ -797,7 +797,7 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
 			m_PendingBridgedResTbl[PBTbl][SeqNum].ChannelNum = pReqPkt->Channel; 
 			m_PendingBridgedResTbl[PBTbl][SeqNum].OriginSrc  = ORIGIN_INT_REQ;
 			g_BMCInfo.SendMsgSeqNum = SeqNum;
-			printf("g_BMCInfo.SendMsgSeqNum %d\n", g_BMCInfo.SendMsgSeqNum);
+//			printf("g_BMCInfo.SendMsgSeqNum %d\n", g_BMCInfo.SendMsgSeqNum);
 
 			/* Format Sequence Number */
 			pReqMsgHdr->RqSeqLUN = ((g_BMCInfo.SendMsgSeqNum) << 2) & 0xFC;
@@ -1065,4 +1065,64 @@ int UpdateFlash(void)
 	FlushIPMIToFlash();
 	FlushFRUToFlash();
 	return 0;
+}
+
+int InitChannelTab(void)
+{
+	int i;
+	//primary IPMB channel
+	g_BMCInfo.ChannelTab[0].ChannelNumber = 0;
+	g_BMCInfo.ChannelTab[0].ChannelProtocol = 1;//Used for IPMB, serial/modem Basic Mode, and LAN.reference IPMIv2.0 Table 6-2
+	g_BMCInfo.ChannelTab[0].ChannelMedium = 1;	//IPMB, reference IPMIv2.0 Table 6-3 
+	g_BMCInfo.ChannelTab[0].SessionSupport = 0;	//session less
+	g_BMCInfo.ChannelTab[0].ActiveSession = 0;
+	g_BMCInfo.ChannelTab[0].ProtocolVendorId[0] = 0x12;
+	g_BMCInfo.ChannelTab[0].ProtocolVendorId[1] = 0x34;
+	g_BMCInfo.ChannelTab[0].ProtocolVendorId[2] = 0x56;
+	g_BMCInfo.ChannelTab[0].AuxiliaryInfo[0] = 0xff;
+	g_BMCInfo.ChannelTab[0].AuxiliaryInfo[1] = 0xff;
+
+	//LAN chennel
+	g_BMCInfo.ChannelTab[1].ChannelNumber = 1;
+	g_BMCInfo.ChannelTab[1].ChannelProtocol = 1;//Used for IPMB, serial/modem Basic Mode, and LAN.reference IPMIv2.0 Table 6-2
+	g_BMCInfo.ChannelTab[1].ChannelMedium = 4;	//802.3 LAN, reference IPMIv2.0 Table 6-3 
+	g_BMCInfo.ChannelTab[1].SessionSupport = 2;	//muti session
+	g_BMCInfo.ChannelTab[1].ActiveSession = 0;
+	g_BMCInfo.ChannelTab[1].ProtocolVendorId[0] = 0x12;
+	g_BMCInfo.ChannelTab[1].ProtocolVendorId[1] = 0x34;
+	g_BMCInfo.ChannelTab[1].ProtocolVendorId[2] = 0x56;
+	g_BMCInfo.ChannelTab[1].AuxiliaryInfo[0] = 0xff;
+	g_BMCInfo.ChannelTab[1].AuxiliaryInfo[1] = 0xff;
+
+	//Secondary IPMB channel
+	g_BMCInfo.ChannelTab[2].ChannelNumber = 6;
+	g_BMCInfo.ChannelTab[2].ChannelProtocol = 1;//Used for IPMB, serial/modem Basic Mode, and LAN.reference IPMIv2.0 Table 6-2
+	g_BMCInfo.ChannelTab[2].ChannelMedium = 1;	//IPMB, reference IPMIv2.0 Table 6-3 
+	g_BMCInfo.ChannelTab[2].SessionSupport = 0;	//session less
+	g_BMCInfo.ChannelTab[2].ActiveSession = 0;
+	g_BMCInfo.ChannelTab[2].ProtocolVendorId[0] = 0x12;
+	g_BMCInfo.ChannelTab[2].ProtocolVendorId[1] = 0x34;
+	g_BMCInfo.ChannelTab[2].ProtocolVendorId[2] = 0x56;
+	g_BMCInfo.ChannelTab[2].AuxiliaryInfo[0] = 0xff;
+	g_BMCInfo.ChannelTab[2].AuxiliaryInfo[1] = 0xff;
+
+	for(i=3;i<15;i++)
+	{
+		g_BMCInfo.ChannelTab[i].ChannelNumber = 0xf;
+	}
+
+
+}
+
+ChannelInfo_T* getChannelInfo(uint8_t ChannelNum)
+{
+	int i;
+	for(i=0;i<15;i++)
+	{
+		if(g_BMCInfo.ChannelTab[i].ChannelNumber == ChannelNum)
+		{
+			return (ChannelInfo_T*)&g_BMCInfo.ChannelTab[i];
+		}
+	}
+	return NULL;
 }

+ 2 - 1
app/bmc/Api.h

@@ -44,7 +44,8 @@ int FlushSELToFlash();
 int GetSDRFromFlash();
 int FlushSDRToFlash();
 int UpdateFlash(void);
-
+int InitChannelTab(void);
+ChannelInfo_T* getChannelInfo(uint8_t ChannelNum);
 	
 int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, int Channel);
 

+ 5 - 2
app/bmc/BmcType.h

@@ -74,6 +74,9 @@ typedef struct
 	SDR_T				SDRConfig;
 	SEL_T				SELConfig;
 
+	//lan configuration
+	LanInfo_T 	LanInfo[1];	//方便扩展多个网卡。
+
 	
 } IPMIConfig_T;
 
@@ -84,6 +87,7 @@ typedef struct
 	OemFRUData_T		FRU;
 	uint8_t*			pSDR;
 	uint8_t*			pSEL;		
+	ChannelInfo_T		ChannelTab[15];							//最大支持15个通道。
 
 	//time
     uint32_t 			CurTimerTick;							//uint: 1ms
@@ -97,8 +101,7 @@ typedef struct
 	uint8_t				ChassisID;
 	uint8_t             PrimaryIPMBAddr;	//8bit
 	uint8_t				SecondaryIPMBAddr;	//8bit
-	//lan configuration
-	LanInfo_T 	LanInfo[1];	//方便扩展多个网卡。
+	
 
 	uint8_t				PowerGoodFlag;
 	uint8_t				FirstPowerOn;

+ 14 - 7
app/bmc/PendActionTask/PendActionTask.c

@@ -108,7 +108,9 @@ void *PendActionTask(void *Param)
 			}
 			else if(MsgPkt.Param == PARAM_LAN)
 			{
-				pSetLanCfg = (SetLanConfigReq_T*)MsgPkt.Data;
+				int index = MsgPkt.Data[0];
+				int isSave = MsgPkt.Data[1];
+				pSetLanCfg = (SetLanConfigReq_T*)&MsgPkt.Data[2];
 				printf("---> PARAM_LAN, NetFnLUN: %#x, cmd: %#x\n", MsgPkt.NetFnLUN, MsgPkt.Cmd);
 				printf("---> Data: %#x %#x %#x %#x %#x\n", MsgPkt.Data[0], MsgPkt.Data[1], MsgPkt.Data[2], MsgPkt.Data[3], MsgPkt.Data[4]);
 				if(((MsgPkt.NetFnLUN>>2) == NETFN_TRANSPORT) 
@@ -161,22 +163,22 @@ void *PendActionTask(void *Param)
 				else if(((MsgPkt.NetFnLUN>>2) == NETFN_STORLEAD) 
 					&& (MsgPkt.Cmd == CMD_SET_LAN_INFO))
 				{
-					LanInfo_T *pSetLanInfo = (LanInfo_T*)MsgPkt.Data;
+					LanInfo_T *pSetLanInfo = (LanInfo_T*)&MsgPkt.Data[2];
 					sleep(1);
 					//down
-					sprintf(cmdStr, "ifconfig %s down", pSetLanInfo->EthName);
+					sprintf(cmdStr, "ifconfig eth%d down", index);
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 					//set mac
-					sprintf(cmdStr, "ifconfig %s hw ether %02x:%02x:%02x:%02x:%02x:%02x", 
-						pSetLanInfo->EthName, pSetLanInfo->MACAddr[0], pSetLanInfo->MACAddr[1],
+					sprintf(cmdStr, "ifconfig eth%d hw ether %02x:%02x:%02x:%02x:%02x:%02x", 
+						index, pSetLanInfo->MACAddr[0], pSetLanInfo->MACAddr[1],
 						pSetLanInfo->MACAddr[2], pSetLanInfo->MACAddr[3], 
 						pSetLanInfo->MACAddr[4], pSetLanInfo->MACAddr[5]);
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 					//ip, broadcast, netmask
-					sprintf(cmdStr, "ifconfig %s %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
-						pSetLanInfo->EthName, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
+					sprintf(cmdStr, "ifconfig eth%d %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
+						index, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
 						pSetLanInfo->IPAddr[2], pSetLanInfo->IPAddr[3], pSetLanInfo->BroadCast[0],
 						pSetLanInfo->BroadCast[1], pSetLanInfo->BroadCast[2], pSetLanInfo->BroadCast[3],
 						pSetLanInfo->NetMask[0], pSetLanInfo->NetMask[1], pSetLanInfo->NetMask[2],
@@ -189,6 +191,11 @@ void *PendActionTask(void *Param)
 					printf("%s\n", cmdStr);
 					system(cmdStr);
 				} 
+
+				if(isSave)
+				{
+					FlushIPMIToFlash();
+				}
 			}
 		}
 	}

+ 0 - 5
app/bmc/Util.h

@@ -67,11 +67,6 @@ uint8_t mac2hex(const char *strMac, uint8_t index);
 */
 uint8_t ip2dec(const char *strIp, uint8_t index);
 
-int FlushUserInfo(void);
-int FlushFRU(void);
-int FlushSDR(void);
-int FlushIpmiConfig(void);
-int FlushSEL(void);
 
 
 

+ 15 - 14
app/bmc/main.c

@@ -58,17 +58,17 @@ FanInfo_T	gFanInfo[FAN_NUMBERS] = {
 								// 	{3, {"Fan4"}, 0, 0, 0 },
 								};
 BladeStatus_T gBladeStatus[BLADE_NUMBERS] = {
-								/*  healthStatus | name | slotID | pwrStatus */
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
-									{ 0, "---", 0, 0},
+								/*  present | healthStatus | name | slotID | pwrStatus */
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
+									{ 0, 0, "---", 0, 0},
 								};
 //void *test_thread(void *var);
 //uint8_t test_flag = 0;
@@ -115,6 +115,7 @@ void main(void)
 	Init_IPMI_FRU_SDR_SEL();
 	Init_SessionTbl();
 	InitTimerTaskTbl();
+	InitChannelTab();
 
 	pthread_mutex_init(&api_bridge_mutex, NULL);
 	pthread_mutex_init(&Flash_Mutex, NULL);
@@ -124,7 +125,7 @@ void main(void)
 
 	//Initialize IP
 	char cmdStr[100];
-	LanInfo_T *pSetLanInfo = &g_BMCInfo.LanInfo[0];
+	LanInfo_T *pSetLanInfo = &g_BMCInfo.IpmiConfig.LanInfo[0];
 	// //down
 	// sprintf(cmdStr, "ifconfig %s down", pSetLanInfo->EthName);
 	// printf("%s\n", cmdStr);
@@ -137,8 +138,8 @@ void main(void)
 	// printf("%s\n", cmdStr);
 	// system(cmdStr);
 	//ip, broadcast, netmask
-	sprintf(cmdStr, "ifconfig %s %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
-		pSetLanInfo->EthName, pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
+	sprintf(cmdStr, "ifconfig eth0 %d.%d.%d.%d broadcast %d.%d.%d.%d netmask %d.%d.%d.%d up",
+		pSetLanInfo->IPAddr[0], pSetLanInfo->IPAddr[1],
 		pSetLanInfo->IPAddr[2], pSetLanInfo->IPAddr[3], pSetLanInfo->BroadCast[0],
 		pSetLanInfo->BroadCast[1], pSetLanInfo->BroadCast[2], pSetLanInfo->BroadCast[3],
 		pSetLanInfo->NetMask[0], pSetLanInfo->NetMask[1], pSetLanInfo->NetMask[2],

+ 1 - 1
app/bmc/msghndlr/App/App.c

@@ -81,7 +81,7 @@ const CmdHndlrMap_T g_App_CmdHndlr [] =	//notice!
 //    { CMD_GET_AUTH_CODE,            PRIV_OPERATOR,  GET_AUTH_CODE,          sizeof (GetAuthCodeReq_T),      0xAAAA ,0xFFFF},
 //    { CMD_SET_CH_ACCESS,            PRIV_ADMIN,     SET_CH_ACCESS,          sizeof (SetChAccessReq_T),      0xAAAA ,0xFFFF},
 //    { CMD_GET_CH_ACCESS,            PRIV_USER,      GET_CH_ACCESS,          sizeof (GetChAccessReq_T),      0xAAAA ,0xFFFF},
-//    { CMD_GET_CH_INFO,              PRIV_USER,      GET_CH_INFO,            sizeof (uint8_t),                 0xAAAA ,0xFFFF},
+    { CMD_GET_CH_INFO,              PRIV_USER,      GET_CH_INFO,            sizeof (uint8_t),                 0xAAAA ,0xFFFF},
     { CMD_SET_USER_ACCESS,          PRIV_ADMIN,     SET_USER_ACCESS,        0xFF,    0xAAAA ,0xFFFF},
     { CMD_GET_USER_ACCESS,          PRIV_OPERATOR,  GET_USER_ACCESS,        sizeof (GetUserAccessReq_T),    0xAAAA ,0xFFFF},
     { CMD_SET_USER_NAME,            PRIV_ADMIN,     SET_USER_NAME,          0xff,      0xAAAA ,0xFFFF},

+ 50 - 50
app/bmc/msghndlr/App/AppDevice/AppDevice.c

@@ -78,6 +78,11 @@
 #define SET_PASSWORD    2
 #define TEST_PASSWORD   3
 
+#define MAX_LAN_CHANNELS  1
+#define LAN_RMCP_CHANNEL1_TYPE  0x01
+#define LAN_RMCP_CHANNEL2_TYPE  0x02
+#define LAN_RMCP_CHANNEL3_TYPE  0x03
+
 /*** Global variables ***/
 uint8_t   g_TmrRunning;
 /*** Module variables ***/
@@ -2177,62 +2182,57 @@ CloseSession ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 //}
 
 
-///*---------------------------------------
-//* GetChInfo
-//*---------------------------------------*/
-//int
-//GetChInfo ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes, int BMCInst)
-//{
-//      GetChInfoReq_T*     pGetChInfoReq = ( GetChInfoReq_T*)pReq;
-//      GetChInfoRes_T*     pGetChInfoRes = ( GetChInfoRes_T*)pRes;
-//    BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
-//       ChannelInfo_T*      pChannelInfo;
-//    uint8_t               ChannelNum,*curchannel;
-
-//    if(pGetChInfoReq->ChannelNum & (BIT7 | BIT6 | BIT5 | BIT4)) //Check for Reserved bits
-//    {
-//        pGetChInfoRes->CompletionCode = CC_INV_DATA_FIELD;
-//        return sizeof(*pRes);
-//    }
+/*---------------------------------------
+* GetChInfo
+*---------------------------------------*/
+int
+GetChInfo ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
+{
+     GetChInfoReq_T*     pGetChInfoReq = ( GetChInfoReq_T*)pReq;
+     GetChInfoRes_T*     pGetChInfoRes = ( GetChInfoRes_T*)pRes;
+      ChannelInfo_T*      pChannelInfo;
+   uint8_t               ChannelNum,*curchannel;
 
-//    ChannelNum = pGetChInfoReq->ChannelNum;
-//    if (CURRENT_CHANNEL_NUM == ChannelNum)
-//    {
-//        OS_THREAD_TLS_GET(g_tls.CurChannel,curchannel);
-//        ChannelNum = *curchannel & 0xF;
-//        
-//        /* UDS, not being a physical channel, will hold LAN properties */ 
-//        if(UDS_CHANNEL == ChannelNum)
-//        {
-//        	ChannelNum = LAN_RMCP_CHANNEL1_TYPE;
-//        }
-//    }
+   if(pGetChInfoReq->ChannelNum & (BIT7 | BIT6 | BIT5 | BIT4)) //Check for Reserved bits
+   {
+       pGetChInfoRes->CompletionCode = CC_INV_DATA_FIELD;
+       return sizeof(*pRes);
+   }
 
-//    OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->ChUserMutex,WAIT_INFINITE);
-//    pChannelInfo = getChannelInfo(ChannelNum, BMCInst);
-//    if (NULL == pChannelInfo)
-//    {
-//        OS_THREAD_MUTEX_RELEASE(&pBMCInfo->ChUserMutex);
-//        pGetChInfoRes->CompletionCode = CC_INV_DATA_FIELD ;
-//        return  sizeof (*pRes);
-//    }
+   ChannelNum = pGetChInfoReq->ChannelNum;
+   if (CURRENT_CHANNEL_NUM == ChannelNum)
+   {
+       curchannel = pthread_getspecific(g_tls.CurChannel); 
+       ChannelNum = *curchannel & 0xF;
+       
+       /* UDS, not being a physical channel, will hold LAN properties */ 
+       if(UDS_CHANNEL == ChannelNum)
+       {
+       	ChannelNum = LAN_RMCP_CHANNEL1_TYPE;
+       }
+   }
 
-//    pGetChInfoRes->CompletionCode        = CC_NORMAL;
-//    pGetChInfoRes->ChannelNum            = ChannelNum;
-//    pGetChInfoRes->ChannelMedium         = pChannelInfo->ChannelMedium;
-//    pGetChInfoRes->ChannelProtocol       = pChannelInfo->ChannelProtocol;
-//    pGetChInfoRes->SessionActiveSupport  = pChannelInfo->SessionSupport << 6;
-//    pGetChInfoRes->SessionActiveSupport |= pChannelInfo->ActiveSession;
+   pChannelInfo = getChannelInfo(ChannelNum);
+   if (NULL == pChannelInfo)
+   {
+       pGetChInfoRes->CompletionCode = CC_INV_DATA_FIELD ;
+       return  sizeof (*pRes);
+   }
 
-//    _fmemcpy (pGetChInfoRes->VendorID, pChannelInfo->ProtocolVendorId,
-//                sizeof (pGetChInfoRes->VendorID));
-//    _fmemcpy (pGetChInfoRes->AuxiliaryInfo, pChannelInfo->AuxiliaryInfo,
-//                sizeof (pGetChInfoRes->AuxiliaryInfo));
+   pGetChInfoRes->CompletionCode        = CC_NORMAL;
+   pGetChInfoRes->ChannelNum            = ChannelNum;
+   pGetChInfoRes->ChannelMedium         = pChannelInfo->ChannelMedium;
+   pGetChInfoRes->ChannelProtocol       = pChannelInfo->ChannelProtocol;
+   pGetChInfoRes->SessionActiveSupport  = pChannelInfo->SessionSupport << 6;
+   pGetChInfoRes->SessionActiveSupport |= pChannelInfo->ActiveSession;
 
-//    OS_THREAD_MUTEX_RELEASE(&pBMCInfo->ChUserMutex);
+   memcpy (pGetChInfoRes->VendorID, pChannelInfo->ProtocolVendorId,
+               sizeof (pGetChInfoRes->VendorID));
+   memcpy (pGetChInfoRes->AuxiliaryInfo, pChannelInfo->AuxiliaryInfo,
+               sizeof (pGetChInfoRes->AuxiliaryInfo));
 
-//    return sizeof (GetChInfoRes_T);
-//}
+   return sizeof (GetChInfoRes_T);
+}
 
 ///*---------------------------------------
 //* IsChannelSuppGroups

+ 53 - 27
app/bmc/msghndlr/Storlead/Storlead.c

@@ -354,12 +354,23 @@ int Storlead_AuthorVerify(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
     return 1;
 }
 
+/*
+    Req[0]: sensor number
+    Req[1]: offset_lsb
+    Req[2]: offset_msb
+    Req[3]: readlen_lsb
+    Req[4]: readlen_msb
+    -----------------------
+    Res[0]: ccode
+    Res[1]: return len lsb
+    Res[2]: return len msb
+*/
 int Storlead_GetSensorHistory(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     uint8_t *pSensorHistory = pRes+3;
     uint8_t  sensorNum = pReq[0];
-    uint16_t offset = (pReq[1]<<8) | pReq[2];
-    uint16_t len = (pReq[3]<<8) | pReq[4];
+    uint16_t offset = (pReq[2]<<8) | pReq[1];
+    uint16_t len = (pReq[4]<<8) | pReq[3];
     uint16_t total_len = 480;
     *pRes= CC_NORMAL;
     
@@ -380,8 +391,8 @@ int Storlead_GetSensorHistory(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
         len = total_len - offset;
     printf("len = %d, offset = %d, total_len = %d\n", len, offset, total_len);
     
-    *(pRes+1) = (len>>8)&0xff;
-    *(pRes+2) = len&0xff;
+    *(pRes+1) = len&0xff;
+    *(pRes+2) = (len>>8)&0xff;
     
     return len+3;   
 }
@@ -443,6 +454,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
     {
         for(i=0;i<BLADE_NUMBERS;i++)
         {
+            gBladeStatus[i].present = 0;
             gBladeStatus[i].healthStatus = 0;
             sprintf(gBladeStatus[i].bladeName, "---");
             gBladeStatus[i].slotID = 0;
@@ -452,6 +464,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
         //当前模块的信息
         if(g_BMCInfo.IndexInChassis < BLADE_NUMBERS)
         {
+            gBladeStatus[g_BMCInfo.IndexInChassis].present = 1;
             gBladeStatus[g_BMCInfo.IndexInChassis].healthStatus = 1;
             memcpy(gBladeStatus[g_BMCInfo.IndexInChassis].bladeName, g_BMCInfo.BladeName, 31);
             gBladeStatus[g_BMCInfo.IndexInChassis].slotID = g_BMCInfo.SlotID;
@@ -466,6 +479,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
         {
             if(gChassisIPMBAddr[index] == 0x20) //chMC
             {
+                gBladeStatus[index].present = 1;
                 gBladeStatus[index].healthStatus = 1;
                 memcpy(gBladeStatus[index].bladeName, g_BMCInfo.BladeName, 31);
                 gBladeStatus[index].slotID = g_BMCInfo.SlotID;
@@ -487,6 +501,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 
                 if(ResPkt.Data[0] == 0)
                 {
+                    gBladeStatus[index].present = 1;
                     gBladeStatus[index].healthStatus = ResPkt.Data[1];
                     memcpy(gBladeStatus[index].bladeName, &ResPkt.Data[2], 31);
                     gBladeStatus[index].slotID = ResPkt.Data[33];
@@ -495,6 +510,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
                 }
                 else
                 {
+                    gBladeStatus[index].present = 0;
                     gBladeStatus[index].healthStatus = 0;
                     sprintf(gBladeStatus[index].bladeName, "---");
                     gBladeStatus[index].slotID = 0;
@@ -504,6 +520,7 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
             }
             else
             {
+                gBladeStatus[index].present = 0;
                 gBladeStatus[index].healthStatus = 0;
                 sprintf(gBladeStatus[index].bladeName, "---");
                 gBladeStatus[index].slotID = 0;
@@ -560,46 +577,53 @@ int Storlead_GetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
     //Update LanInfo
     char ip_buf[16];
     getip(ip_buf);
-    g_BMCInfo.LanInfo[index].IPAddr[0] = ip2dec(ip_buf, 0);
-    g_BMCInfo.LanInfo[index].IPAddr[1] = ip2dec(ip_buf, 1);
-    g_BMCInfo.LanInfo[index].IPAddr[2] = ip2dec(ip_buf, 2);
-    g_BMCInfo.LanInfo[index].IPAddr[3] = ip2dec(ip_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[0] = ip2dec(ip_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[1] = ip2dec(ip_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[2] = ip2dec(ip_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr[3] = ip2dec(ip_buf, 3);
 
     char mask_buf[16];
     getnetmask(mask_buf);
-    g_BMCInfo.LanInfo[index].NetMask[0] = ip2dec(mask_buf, 0);
-    g_BMCInfo.LanInfo[index].NetMask[1] = ip2dec(mask_buf, 1);
-    g_BMCInfo.LanInfo[index].NetMask[2] = ip2dec(mask_buf, 2);
-    g_BMCInfo.LanInfo[index].NetMask[3] = ip2dec(mask_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[0] = ip2dec(mask_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[1] = ip2dec(mask_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[2] = ip2dec(mask_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].NetMask[3] = ip2dec(mask_buf, 3);
 
     char broadcast_buf[16];
     getbroadcast(broadcast_buf);
-    g_BMCInfo.LanInfo[index].BroadCast[0] = ip2dec(broadcast_buf, 0);
-    g_BMCInfo.LanInfo[index].BroadCast[1] = ip2dec(broadcast_buf, 1);
-    g_BMCInfo.LanInfo[index].BroadCast[2] = ip2dec(broadcast_buf, 2);
-    g_BMCInfo.LanInfo[index].BroadCast[3] = ip2dec(broadcast_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[0] = ip2dec(broadcast_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[1] = ip2dec(broadcast_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[2] = ip2dec(broadcast_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].BroadCast[3] = ip2dec(broadcast_buf, 3);
 
     char mac_buf[18];
     getmac(mac_buf);
-    g_BMCInfo.LanInfo[index].MACAddr[0] = mac2hex(mac_buf, 0);
-    g_BMCInfo.LanInfo[index].MACAddr[1] = mac2hex(mac_buf, 1);
-    g_BMCInfo.LanInfo[index].MACAddr[2] = mac2hex(mac_buf, 2);
-    g_BMCInfo.LanInfo[index].MACAddr[3] = mac2hex(mac_buf, 3);
-    g_BMCInfo.LanInfo[index].MACAddr[4] = mac2hex(mac_buf, 4);
-    g_BMCInfo.LanInfo[index].MACAddr[5] = mac2hex(mac_buf, 5);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[0] = mac2hex(mac_buf, 0);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[1] = mac2hex(mac_buf, 1);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[2] = mac2hex(mac_buf, 2);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[3] = mac2hex(mac_buf, 3);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[4] = mac2hex(mac_buf, 4);
+    g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr[5] = mac2hex(mac_buf, 5);
 
     //TODO: get default GetWay
 
-    memcpy(pRes+1, &g_BMCInfo.LanInfo[index], sizeof(LanInfo_T));
+    memcpy(pRes+1, &g_BMCInfo.IpmiConfig.LanInfo[index], sizeof(LanInfo_T));
 
     return 1+sizeof(LanInfo_T);
 }
 
+/*
+    Req[0]:     index
+    Req[1]:     isSave      0:掉电不保存,1:掉电保存
+    Req[2~n]:   LanInfo_T
+*/
 int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     MsgPkt_T m_MsgPkt;
     uint8_t index = pReq[0];
-    LanInfo_T *pLanInfo = (LanInfo_T*)&pReq[1];
+    uint8_t isSave = pReq[1];
+    LanInfo_T *pLanInfo = (LanInfo_T*)&pReq[2];
+    
 
     if(index > 0)   //只有一张网卡,index只能是0
     {
@@ -607,13 +631,15 @@ int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
         return 1;
     }
 
-    memcpy(&g_BMCInfo.LanInfo[index], pLanInfo, sizeof(LanInfo_T));
+    memcpy(&g_BMCInfo.IpmiConfig.LanInfo[index], pLanInfo, sizeof(LanInfo_T));
 
     m_MsgPkt.Param      = PARAM_LAN;
     m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_STORLEAD;
     m_MsgPkt.Cmd        = CMD_SET_LAN_INFO;
-    m_MsgPkt.Size       = sizeof(LanInfo_T);
-    memcpy(m_MsgPkt.Data, pLanInfo, sizeof(LanInfo_T));
+    m_MsgPkt.Size       = sizeof(LanInfo_T)+2;
+    m_MsgPkt.Data[0]    = index;
+    m_MsgPkt.Data[1]    = isSave;
+    memcpy(&m_MsgPkt.Data[2], pLanInfo, sizeof(LanInfo_T));
     PostMsg(gPendActionIfc, &m_MsgPkt);
     
     pRes[0] = CC_NORMAL;

+ 191 - 1335
app/bmc/msghndlr/Transport/LANConfig.c

@@ -359,12 +359,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
 
             //Update
-            memcpy(g_BMCInfo.LanInfo[index].IPAddr, pSetLanReq->ConfigData.IPAddr, 4); 
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].IPAddr, pSetLanReq->ConfigData.IPAddr, 4); 
             FlushIpmiConfig();
             printf("---> old_ip: %s, new_ip: %s\n", old_ip, ipStr);
             printf("---> send data: %#x %#x %#x %#x %#x\n", m_MsgPkt.Data[0], m_MsgPkt.Data[1]
@@ -373,79 +375,6 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_IP_ADDRESS_SOURCE:
             printf("---> Not implement!\n");
-            //Update
-            g_BMCInfo.LanInfo[index].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-            FlushIpmiConfig();
-      //       if ((pSetLanReq->ConfigData.IPAddrSrc > BMC_OTHER_SOURCE)
-      //           ||(pSetLanReq->ConfigData.IPAddrSrc == UNSPECIFIED_IP_SOURCE))
-      //       {
-      //           *pRes = CC_INV_DATA_FIELD;
-      //           return sizeof (uint8_t);
-      //       }
-      //       if ( g_BMCInfo.IpmiConfig.IPAddrSrc == pSetLanReq->ConfigData.IPAddrSrc )
-      //       {
-      //           printf("LAN or VLAN if current SRC is DHCP/Static and incoming SRC is DHCP/Static, do nothing\n");
-      //           break;
-      //       }
-		    // if(!((pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE )))
-			   //   g_BMCInfo.IpmiConfig.IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-
-      //       if ( (pSetLanReq->ConfigData.IPAddrSrc == STATIC_IP_SOURCE ) || (pSetLanReq->ConfigData.IPAddrSrc == DHCP_IP_SOURCE ) )
-      //       {
-      //           pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-      //           if(pendStatus == PEND_STATUS_PENDING)
-      //           {
-      //               *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-      //               return sizeof (uint8_t);
-      //           }
-		    //     pBMCInfo->LANCfs[EthIndex].IPAddrSrc = pSetLanReq->ConfigData.IPAddrSrc ;
-      //           NWConfig.CfgMethod = pSetLanReq->ConfigData.IPAddrSrc;
-      //           SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-      //           PostPendTask(PEND_OP_SET_SOURCE,(uint8_t*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-      //       }
-      //       else if(pSetLanReq->ConfigData.IPAddrSrc == BIOS_IP_SOURCE)
-      //       {
-      //           /*Perform OEM action*/
-      //           if(g_PDKHandle[PDK_BIOSIPSOURCE] != NULL)
-      //           {
-      //           	 retValue = ((int(*)(uint8_t))g_PDKHandle[PDK_BIOSIPSOURCE]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
-	     //             if(retValue == 1)
-	     //             {
-		    //              *pRes = CC_INV_DATA_FIELD;
-		    //              return sizeof (*pRes);
-	     //             }
-      //           }
-      //           else
-      //           {
-      //               pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-      //               if(pendStatus == PEND_STATUS_PENDING)
-      //               {
-      //                   *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-      //                   return sizeof (uint8_t);
-      //               }
-      //               NWConfig.CfgMethod = STATIC_IP_SOURCE;
-      //               SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-      //               PostPendTask(PEND_OP_SET_SOURCE, (uint8_t*) &NWConfig,sizeof(NWConfig), (pSetLanReq->ChannelNum & CHANNEL_ID_MASK), BMCInst );
-      //           }
-      //       }
-      //       else if(pSetLanReq->ConfigData.IPAddrSrc == BMC_OTHER_SOURCE)
-      //       {
-      //           /*Perform OEM action*/
-      //           if(g_PDKHandle[PDK_BMCOTHERSOURCEIP] != NULL)
-      //           {
-      //           	retValue = ((int(*)(uint8_t))g_PDKHandle[PDK_BMCOTHERSOURCEIP]) (pSetLanReq->ChannelNum & CHANNEL_ID_MASK);
-      //                if(retValue == 1)
-      //                {
-		    //              *pRes = CC_INV_DATA_FIELD;
-		    //              return sizeof (*pRes);
-	     //             }
-      //           }
-      //           else
-      //           {	
-      //                *pRes = CC_INV_DATA_FIELD;
-	     //             return sizeof (*pRes);
-      //           }
-      //       }  
             break;
 
         case LAN_PARAM_MAC_ADDRESS:
@@ -479,25 +408,19 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 				m_MsgPkt.Param      = PARAM_LAN;
                 m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
                 m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-                m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-                memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+                m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+                m_MsgPkt.Data[0]    = 0;//eth0
+                m_MsgPkt.Data[1]    = 0;//掉电不保存
+                memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
                 PostMsg(gPendActionIfc, &m_MsgPkt);
                 //Update
-                memcpy(g_BMCInfo.LanInfo[index].MACAddr, pSetLanReq->ConfigData.MACAddr, 6); 
-                FlushIpmiConfig();
+                memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].MACAddr, pSetLanReq->ConfigData.MACAddr, 6); 
 				printf("---> old_mac: %s, new_mac: %s\n", old_mac, macStr);
 				pSetLanRes->CompletionCode = CC_NORMAL;
 			}
 			
 			break;
         case LAN_PARAM_SUBNET_MASK:
-            /*Returning valid completion code in case of attempt to set netmask in DHCP mode */
-            if(g_BMCInfo.LanInfo[index].IPAddrSrc == DHCP_IP_SOURCE)
-            {
-                *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-                return sizeof (uint8_t);
-            }
-
             getnetmask(old_netmask);
             sprintf(netmaskStr, "%d.%d.%d.%d", pSetLanReq->ConfigData.SubNetMask[0],
                 pSetLanReq->ConfigData.SubNetMask[1], pSetLanReq->ConfigData.SubNetMask[2],
@@ -518,58 +441,22 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
              //Update
-            memcpy(g_BMCInfo.LanInfo[index].NetMask, pSetLanReq->ConfigData.SubNetMask, 4); 
-            FlushIpmiConfig();
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].NetMask, pSetLanReq->ConfigData.SubNetMask, 4); 
             pSetLanRes->CompletionCode = CC_NORMAL;  
             break;
 
         case LAN_PARAM_IPv4_HEADER:
             printf("Not implement\n");
-            // pendStatus = GetPendStatus(PEND_OP_SET_IPV4_HEADERS);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // if(!pSetLanReq->ConfigData.Ipv4HdrParam.TimeToLive > 0)
-            // {
-            //     IPMI_DBG_PRINT("The requested IPv4 header(TTL) to set is invalid.\n");
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof(*pRes);
-            // }
-            // if(pSetLanReq->ConfigData.Ipv4HdrParam.IpHeaderFlags == 0x60) // Flags can be either of the values: DF(0x40) or MF(0x20)
-            // {
-            //     IPMI_DBG_PRINT("The requested IPv4 header(Flags) to set is invalid.\n");
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof(*pRes);
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (&pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam,
-            // &pSetLanReq->ConfigData.Ipv4HdrParam, sizeof(IPv4HdrParams_T));
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // SetPendStatus(PEND_OP_SET_IPV4_HEADERS,PEND_STATUS_PENDING);
-            // PostPendTask(PEND_OP_SET_IPV4_HEADERS, (uint8_t*)&(pSetLanReq->ConfigData.Ipv4HdrParam),
-            // sizeof(pSetLanReq->ConfigData.Ipv4HdrParam),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
             break;
 
         case LAN_PARAM_PRI_RMCP_PORT:
             printf("Not implement\n");  //需要重启网络线程
-            // pendStatus = GetPendStatus(PEND_RMCP_PORT_CHANGE);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort = ipmitoh_u16 (pSetLanReq->ConfigData.PrimaryRMCPPort);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // SetPendStatus(PEND_RMCP_PORT_CHANGE,PEND_STATUS_PENDING);
-            // PostPendTask(PEND_RMCP_PORT_CHANGE,(uint8_t*)&(pSetLanReq->ConfigData.PrimaryRMCPPort),
-            //                         sizeof(pSetLanReq->ConfigData.PrimaryRMCPPort),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
             break;
 
         case LAN_PARAM_SEC_RMCP_PORT:
@@ -581,46 +468,13 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
             printf("Not implement\n");  
-   //      	currBmcGenArpCtrl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
-        	
-			// if(currBmcGenArpCtrl != pSetLanReq->ConfigData.BMCGeneratedARPControl)
-			// 	pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl = pSetLanReq->ConfigData.BMCGeneratedARPControl;
-
-			// if((ENABLE_ARP_RESPONSES & currBmcGenArpCtrl) !=
-			//    (ENABLE_ARP_RESPONSES & pSetLanReq->ConfigData.BMCGeneratedARPControl))
-			// {
-			// 	UpdateArpStatus(EthIndex, BMC_GET_SHARED_MEM(BMCInst)->IsWDTRunning, BMCInst);
-			// }
-
-			// if(!(GRATIUTOUS_ENABLE_MASK & currBmcGenArpCtrl) &&
-			//    (GRATIUTOUS_ENABLE_MASK & pSetLanReq->ConfigData.BMCGeneratedARPControl))
-			// {
-   //              /* Create a thread to Send Gratuitous ARP Packet */
-   //              pLANArg = malloc(sizeof(BMCArg));
-   //              pLANArg->BMCInst = BMCInst; 
-   //              pLANArg->Len = strlen((char *)&EthIndex);
-   //              pLANArg->Argument = malloc(pLANArg->Len);
-   //              memcpy(pLANArg->Argument,(char *)&EthIndex,pLANArg->Len);
-               
-   //              OS_CREATE_THREAD ((void *)GratuitousARPTask,(void *)pLANArg, NULL);
-   //          }
-
             break;
 
         case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
             printf("Not implement\n");  
-            // pBMCInfo->LANCfs[EthIndex].GratitousARPInterval =
-            //                         pSetLanReq->ConfigData.GratitousARPInterval;
             break;
 
         case LAN_PARAM_DEFAULT_GATEWAY_IP:
-            /*Returning valid completion code in case of attempt to set default gateway ip in DHCP mode */
-            if(g_BMCInfo.LanInfo[index].IPAddrSrc == DHCP_IP_SOURCE)
-            {
-                *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-                return sizeof (uint8_t);
-            }
-            
             if(IPAddrCheck(pSetLanReq->ConfigData.DefaultGatewayIPAddr,LAN_PARAM_DEFAULT_GATEWAY_IP))
             {
                 *pRes = CC_INV_DATA_FIELD;
@@ -630,12 +484,13 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
             m_MsgPkt.Param      = PARAM_LAN;
             m_MsgPkt.NetFnLUN   = NETFNLUN_IPMI_TRANSPORT;
             m_MsgPkt.Cmd        = CMD_SET_LAN_CONFIGURATION_PARAMETERS;
-            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T);
-            memcpy(m_MsgPkt.Data, pSetLanReq, sizeof(SetLanConfigReq_T));
+            m_MsgPkt.Size       = sizeof(SetLanConfigReq_T)+2;
+            m_MsgPkt.Data[0]    = 0;//eth0
+            m_MsgPkt.Data[1]    = 0;//掉电不保存
+            memcpy(&m_MsgPkt.Data[2], pSetLanReq, sizeof(SetLanConfigReq_T));
             PostMsg(gPendActionIfc, &m_MsgPkt);
             //Update
-            memcpy(g_BMCInfo.LanInfo[index].DefaultGW, pSetLanReq->ConfigData.DefaultGatewayIPAddr, 4); 
-            FlushIpmiConfig();
+            memcpy(g_BMCInfo.IpmiConfig.LanInfo[index].DefaultGW, pSetLanReq->ConfigData.DefaultGatewayIPAddr, 4); 
             pSetLanRes->CompletionCode = CC_NORMAL;  
            
             break;
@@ -647,45 +502,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_BACKUP_GATEWAY_IP:
             printf("Not implement\n");
-            // nwReadNWCfg_v4_v6( &NWConfig,&NWConfig6, netindex,g_corefeatures.global_ipv6);
-            // _fmemcpy ((uint8_t*)&GWIp,pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
-            // _fmemcpy ((uint8_t*)&Subnetmask,&NWConfig.Mask[0],IP_ADDR_LEN);
-            // _fmemcpy ((uint8_t*)&IPAddr,&NWConfig.IPAddr[0], IP_ADDR_LEN);
-            // if(GWIp != 0)
-            // {
-            //     if((IPAddr & Subnetmask ) != (GWIp & Subnetmask))
-            //     {
-            //          IPMI_DBG_PRINT("\n Backup GatewayIP to set is not valid \n");
-            //         *pRes = CC_INV_DATA_FIELD;
-            //         return sizeof (uint8_t);
-            //     }
-            // }
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,
-            // pSetLanReq->ConfigData.BackupGatewayIPAddr, IP_ADDR_LEN);
-            // nwSetBkupGWyAddr(pSetLanReq->ConfigData.BackupGatewayIPAddr,netindex);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_BACKUP_GATEWAY_MAC:
             printf("Not implement\n");
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr,
-            //           pSetLanReq->ConfigData.BackupGatewayMACAddr, MAC_ADDR_LEN);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_COMMUNITY_STRING:
             printf("Not implement\n");
-            // if (g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME] != NULL )
-            // {
-            //         if(((int(*)(uint8_t *, uint8_t,int))(g_PDKHandle[PDK_SETSNMPCOMMUNITYNAME]))(pSetLanReq->ConfigData.CommunityStr,MAX_COMM_STRING_SIZE, BMCInst)==0)
-            //             break;
-            // }
-            // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->PefConfig.PEFSharedMemMutex, WAIT_INFINITE);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CommunityStr,
-            //          pSetLanReq->ConfigData.CommunityStr, MAX_COMM_STRING_SIZE);
-            // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->PefConfig.PEFSharedMemMutex);
             break;
 
         case LAN_PARAM_DEST_NUM:
@@ -695,285 +519,17 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_SELECT_DEST_TYPE:
             printf("Not implement\n");
-            // // if (pSetLanReq->ConfigData.DestType.SetSelect > NUM_LAN_DESTINATION)
-            // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
-            // {
-            //     *pRes = CC_PARAM_OUT_OF_RANGE;
-            //     return sizeof (*pRes);
-            // }
-
-            // if (0 == pSetLanReq->ConfigData.DestType.SetSelect)
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pSharedMem->VolLANDestType[EthIndex],
-            //               &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // else
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestType [pSetLanReq->ConfigData.DestType.SetSelect - 1],
-            //               &pSetLanReq->ConfigData.DestType, sizeof(LANDestType_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
             break;
 
         case LAN_PARAM_SELECT_DEST_ADDR:
             printf("Not implement\n");
-            // pendStatus = GetPendStatus(PEND_OP_SET_GATEWAY);
-            // if(pendStatus == PEND_STATUS_PENDING)
-            // {
-            //     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof (uint8_t);
-            // }
-            // // if (pSetLanReq->ConfigData.DestAddr.SetSelect > NUM_LAN_DESTINATION)
-            // if (pSetLanReq->ConfigData.DestType.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest )
-            // {
-            //     *pRes = CC_PARAM_OUT_OF_RANGE ;
-            //     return sizeof (*pRes);
-            // }
-
-            // if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pSharedMem->VolLANDest[EthIndex],
-            //               &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
-            //    memset(pSharedMem->VolLANv6Dest,0,sizeof(LANDestv6Addr_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // else
-            // {
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy (&pBMCInfo->LANCfs[EthIndex].DestAddr [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
-            //               &pSetLanReq->ConfigData.DestAddr, sizeof(LANDestAddr_T));
-            //     memset( &pBMCInfo->LANCfs[EthIndex].Destv6Addr [pSetLanReq->ConfigData.Destv6Addr.SetSelect -1], 0 ,
-            //         sizeof(LANDestv6Addr_T));
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            // }
-            // /* Setting BackupGw to DefaultGw as per request to send trap */
-            // if(pSetLanReq->ConfigData.DestAddr.GateWayUse == 1)
-            // {
-            //     IPMI_DBG_PRINT("Setting Backupgw to Defaultgwip as per Request \n");
-            //     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-            //     LOCK_BMC_SHARED_MEM(BMCInst);
-            //     _fmemcpy(NWConfig.Gateway,pBMCInfo->LANCfs[EthIndex].BackupGatewayIPAddr,IP_ADDR_LEN);
-            //     UNLOCK_BMC_SHARED_MEM(BMCInst);
-            //     SetPendStatus(PEND_OP_SET_GATEWAY,PEND_STATUS_PENDING);
-            //     PostPendTask(PEND_OP_SET_GATEWAY,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F),BMCInst);
-
-            //  }
             break;
 
         case LAN_PARAM_VLAN_ID:
             printf("Not implement\n");
-            // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
-            // {
-            //     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-
-            //     if((pSetLanReq->ConfigData.VLANID & VLAN_MASK_BIT) == VLAN_MASK_BIT)    /* checks for VLAN enable bit*/
-            //     {
-            //         pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //         if(pendStatus == PEND_STATUS_PENDING)
-            //         {
-            //             *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //             return sizeof (uint8_t);
-            //         }
-            //         vlanID = (pSetLanReq->ConfigData.VLANID & 0xfff);    /* get the vlan d from the data */
-
-            //         for(i=0;i<sizeof(InvalidVlanID)/sizeof(uint16_t);i++)
-            //         {
-            //             if(InvalidVlanID[i] != vlanID)
-            //             {
-            //                 continue;
-            //             }
-            //             else        /*invalid vlan id */
-            //             {
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //         }
-
-            //         if ( NWConfig.VLANID != 0)     /* checks if vlan id already present */
-            //         {
-            //             if(NWConfig.VLANID == vlanID)
-            //             {
-            //                 TCRIT("Currently configured vlan id and incoming set vlan id are same thus, do nothing\n");
-            //                 break;
-            //             }
-            //             memset(IfcName,0,sizeof(IfcName));
-            //             if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //             {
-            //                 TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
-            //             if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
-            //             {
-            //                 pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //                 if(pendStatus == PEND_STATUS_PENDING)
-            //                 {
-            //                     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                     return sizeof (uint8_t);
-            //                 }
-            //                 SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
-            //                 PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //                 pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
-            //             }
-            //         }
-
-            //         NWConfig.VLANID=vlanID;
-            //         SetPendStatus(PEND_OP_SET_VLAN_ID,PEND_STATUS_PENDING);
-            //         PostPendTask(PEND_OP_SET_VLAN_ID,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //         pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //     }
-            //     else        /* Vlan Bit is Disabled */
-            //     {
-            //         if(NWConfig.VLANID==0)        /* Vlan id is disabled */
-            //         {
-            //             if((pSetLanReq->ConfigData.VLANID & 0xfff)!=0)
-            //             {
-            //                 pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //             }
-
-            //             if((pSetLanReq->ConfigData.VLANID & 0xfff)==0)
-            //             {
-            //                 if((pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff)!=0)
-            //                 {
-            //                     pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //                 }
-            //             }
-            //         }
-
-            //         else                /* Vlan ID is enable. so deconfigure it */
-            //         {
-            //             memset(IfcName,0,sizeof(IfcName));
-            //             if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //             {
-            //                 TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             sprintf(VLANInterfaceName, "%s.%d", IfcName, (int)(NWConfig.VLANID));
-            //             if (0 == NwInterfacePresenceCheck (VLANInterfaceName))
-            //             {
-            //                 pendStatus = GetPendStatus(PEND_OP_SET_VLAN_ID);
-            //                 if(pendStatus == PEND_STATUS_PENDING)
-            //                 {
-            //                     *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                     return sizeof (uint8_t);
-            //                 }
-            //                 SetPendStatus(PEND_OP_DECONFIG_VLAN_IFC,PEND_STATUS_PENDING);
-            //                 PostPendTask(PEND_OP_DECONFIG_VLAN_IFC,(uint8_t*)&NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //                 pBMCInfo->LANCfs[EthIndex].VLANPriority =0;
-            //             }
-            //             pendStatus = GetPendStatus(PEND_OP_SET_SOURCE);
-            //             if(pendStatus == PEND_STATUS_PENDING)
-            //             {
-            //                 *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //                 return sizeof (uint8_t);
-            //             }
-            //             //NWConfig.VLANID=0;
-            //             NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
-            //             SetPendStatus(PEND_OP_SET_SOURCE,PEND_STATUS_PENDING);
-            //             PostPendTask(PEND_OP_SET_SOURCE,(uint8_t*) &NWConfig,sizeof(NWConfig),(pSetLanReq->ChannelNum & 0x0F), BMCInst );
-            //             pBMCInfo->LANCfs[EthIndex].VLANID = pSetLanReq->ConfigData.VLANID;
-            //         }
-
-            //     }
-            // }
-            // else
-            // {
-            //     pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //     return sizeof(uint8_t);
-            // }
             break;
         case LAN_PARAM_VLAN_PRIORITY:
             printf("Not implement\n");
-            // if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
-            // {
-            //     if((pBMCInfo->LANCfs[EthIndex].VLANID & VLAN_MASK_BIT) != VLAN_MASK_BIT)    /* checks for VLAN enable bit*/
-            //     {
-            //         if(g_corefeatures.vlan_priorityset == ENABLED)
-            //         {
-            //             if(pSetLanReq->ConfigData.VLANPriority > 7 )
-            //             {
-            //                 TCRIT(" VLAN Priority value should be 0-7 \n");
-            //                 *pRes = CC_INV_DATA_FIELD ;
-            //                 return sizeof (*pRes);
-            //             }
-            //             if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
-            //             {
-            //                 return -1;
-            //             }
-            //             if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
-            //             {
-            //                 return -1;
-            //             }
-            //             pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
-            //         }
-            //         else
-            //         {
-            //             TCRIT(" VLAN is not Configured \n");
-            //             *pRes = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //             return sizeof (*pRes);
-            //         }
-            //     }
-            //     else
-            //     {
-            //         if(pSetLanReq->ConfigData.VLANPriority > 7 )
-            //         {
-            //             TCRIT(" VLAN Priority value should be 0-7 \n");
-            //             *pRes = CC_INV_DATA_FIELD ;
-            //             return sizeof (*pRes);
-            //         }
-
-            //         if(ReadVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel) == -1)
-            //         {
-            //             return -1;
-            //         }
-
-            //         if(WriteVLANFile(VLAN_PRIORITY_SETTING_STR, PriorityLevel, netindex,pSetLanReq->ConfigData.VLANPriority) == -1)
-            //         {
-            //             return -1;
-            //         }
-
-            //         pBMCInfo->LANCfs[EthIndex].VLANPriority = pSetLanReq->ConfigData.VLANPriority;
-            //         vlanID = (pBMCInfo->LANCfs[EthIndex].VLANID & 0xfff);
-            //         memset(IfcName,0,sizeof(IfcName));
-            //         if(GetIfcName(EthIndex, IfcName,BMCInst) != 0)
-            //         {
-            //              TCRIT("Error in getting Interface Name for the Lan Index :%d\n",EthIndex);
-            //              *pRes = CC_INV_DATA_FIELD;
-            //              return sizeof(*pRes);
-            //         }
-            //         /*vconfig set_egress_map <valninterface> <skb_buffer> <vlan-priority>*/
-            //         sprintf(cmdSetPriority,"vconfig set_egress_map  %s.%d  0  %d",IfcName,vlanID,pSetLanReq->ConfigData.VLANPriority);
-            //         if(((retValue = safe_system(cmdSetPriority)) < 0))
-            //         {
-            //             TCRIT("ERROR %d: Set VLAN Priority failed\n",retValue);
-            //         }
-                
-            //     /* 
-            //      * Set priority of IPMI commands. 
-            //      * The skb->priority value of IPMI command will be modified by TOS option.
-            //      * So, use the mapping table to get the current value.
-            //      */
-            //         memset(&cmdSetPriority,0,sizeof(cmdSetPriority));
-            //         TOS = pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam.TypeOfService;
-            //         SkbPriority = IP_TOS2PRIO[IPTOS_TOS(TOS)>>1];
-            //         sprintf(cmdSetPriority,"vconfig set_egress_map %s.%d %d %d",IfcName,vlanID,SkbPriority,pSetLanReq->ConfigData.VLANPriority);
-            //         if(((retValue = safe_system(cmdSetPriority)) < 0))
-            //         {
-            //             TCRIT("ERROR %d: Set VLAN IPMI Priority failed\n",retValue);
-            //         } 
-            //     }
-            // }
-            // else
-            // {
-            //      pSetLanRes->CompletionCode = CC_PARAM_NOT_SUP_IN_CUR_STATE;
-            //      return sizeof(uint8_t);
-            // }
             break;
         case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
             pSetLanRes->CompletionCode = CC_ATTEMPT_TO_SET_RO_PARAM;
@@ -986,42 +542,14 @@ SetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
 
         case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
             printf("Not implement\n");
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy (pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
-            //           pSetLanReq->ConfigData.CipherSuitePrivLevels, MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
 
         case LAN_PARAM_VLAN_TAGS:
             printf("Not implement\n");
-          //   if (0 == pSetLanReq->ConfigData.DestAddr.SetSelect)
-          // {
-          //       LOCK_BMC_SHARED_MEM(BMCInst);
-          //       _fmemcpy(&pSharedMem->VLANDestTag,
-          //                ((  uint8_t*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
-          //       UNLOCK_BMC_SHARED_MEM(BMCInst);
-          // }
-          // else
-          // {
-          //       if (pSetLanReq->ConfigData.DestAddr.SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
-          //       {
-          //           pSetLanRes->CompletionCode = CC_PARAM_OUT_OF_RANGE;
-          //           return sizeof (uint8_t);
-          //       }
-          //       LOCK_BMC_SHARED_MEM(BMCInst);
-          //       _fmemcpy(&pBMCInfo->LANCfs[EthIndex].VLANDestTags [pSetLanReq->ConfigData.DestAddr.SetSelect - 1],
-          //                ((  uint8_t*)&pSetLanReq->ConfigData) + 1, sizeof(VLANDestTags_T));
-          //       UNLOCK_BMC_SHARED_MEM(BMCInst);
-          // }
             break;
 
         case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
             printf("Not implement\n");
-            // ClearUserLockAttempts(LAN_CHANNEL_BADP,BMCInst);
-            // LOCK_BMC_SHARED_MEM(BMCInst);
-            // _fmemcpy(&pBMCInfo->LANCfs[EthIndex].BadPasswd,
-            //                 &pSetLanReq->ConfigData.BadPasswd,sizeof(BadPassword_T));
-            // UNLOCK_BMC_SHARED_MEM(BMCInst);
             break;
         default:
             pSetLanRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
@@ -1206,857 +734,185 @@ int IPAddrCheck(uint8_t *Addr,int params)
 // }
 
 
-// /*---------------------------------------------------
-//  * GetLanConfigParam
-//  *---------------------------------------------------*/
-// int
-// GetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes,  int BMCInst)
-// {
-//        GetLanConfigReq_T*  pGetLanReq = (  GetLanConfigReq_T*) pReq;
-//        GetLanConfigRes_T*  pGetLanRes = (  GetLanConfigRes_T*) pRes;
-//         BMCSharedMem_T*     pSharedMem = BMC_GET_SHARED_MEM (BMCInst);
-//     uint8_t IsOemDefined = FALSE;
-//     NWCFG_STRUCT        NWConfig;
-//     NWCFG6_STRUCT        NWConfig6;
-// //    V6DNS_CONFIG v6dnsconfig;
-//     uint8_t EthIndex,netindex= 0xFF,i;
-//       BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
-//     int ncsiPortConfigNum = 0;
-
-//     ETHCFG_STRUCT PHYCfg;
-//     ChannelInfo_T* pChannelInfo = NULL;
-
-//     char IfcName[16];  /* Eth interface name */
-//     uint8_t               ComStrLen=MAX_COMM_STRING_SIZE;
-//     int retValue = 0,NIC_Count = 0;
-
-//     pGetLanRes->CCParamRev.CompletionCode = CC_NORMAL;
-//     pGetLanRes->CCParamRev.ParamRevision  = PARAMETER_REVISION_FORMAT;
-
-// //    printf("---> channel: %d, parameter: %#x, setslect: %#x, blockselect: %#x\n", pGetLanReq->ChannelNum, pGetLanReq->ParameterSelect, pGetLanReq->SetSelect, pGetLanReq->BlockSelect);
-//     if(pGetLanReq->ChannelNum & RESERVED_VALUE_70)
-//     {
-//         /* Alarm !!! Somebody is trying to set Reseved Bits */
-//         *pRes = CC_INV_DATA_FIELD;
-//         return sizeof (*pRes);
-//     }
-
-//     if((pGetLanReq->ParameterSelect >= MIN_LAN_OEM_CONF_PARAM) && 
-//             (pGetLanReq->ParameterSelect <= MAX_LAN_OEM_CONF_PARAM) )
-//     {
-//     	/* Converts OEM parameter value to equivalent AMI parameter value */
-//     	if (0 != GetLanAMIParamValue (&pGetLanReq->ParameterSelect, &IsOemDefined) )
-//     	{
-//             pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//             return sizeof(uint8_t);
-//     	}
-
-//     	/* Hook for OEM to handle this parameter */
-//         if ( (IsOemDefined)  && (g_PDKHandle[PDK_GETLANOEMPARAM] != NULL) )
-//         {
-// 			return ((int(*)(uint8_t *, uint8_t, uint8_t *,int))(g_PDKHandle[PDK_GETLANOEMPARAM]))(pReq, ReqLen, pRes, BMCInst);
-//     	}
-   	
-//     }
-
-//     if (g_PDKHandle[PDK_BEFOREGETLANPARM] != NULL)
-//     {
-//         retValue = ((int(*)(uint8_t *, uint8_t, uint8_t *,int))(g_PDKHandle[PDK_BEFOREGETLANPARM]))(pReq, ReqLen, pRes, BMCInst);
-//         if(retValue != 0)
-//         {
-//               return retValue;
-//         }
-//     }
-
-//     //! Validate the SetSelector value. 
-//     if (  (0x00 != pGetLanReq->SetSelect) &&  
-//           (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_TYPE) &&  
-//           (pGetLanReq->ParameterSelect != LAN_PARAM_SELECT_DEST_ADDR) &&  
-//           (pGetLanReq->ParameterSelect != LAN_PARAM_VLAN_TAGS) &&
-//           (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR) && 
-//           (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR) &&
-//           (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64) &&
-//           (pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH))
-//     {
-//     	printf("GetLanConfigParam log1\n");
-//         if( g_corefeatures.ncsi_cmd_support == ENABLED )
-//         {
-//             if ((pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_SETTINGS) &&
-// 				(pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE) &&
-// 				(pGetLanReq->ParameterSelect != LAN_PARAMS_AMI_OEM_NCSI_EXTENSION))
-//             {
-//                 *pRes = CC_INV_DATA_FIELD;  
-//                 return sizeof (*pRes);  
-//             }
-//         }
-//         else
-//         {
-//             *pRes = CC_INV_DATA_FIELD;  
-//             return sizeof (*pRes);  
-//         }
-//     }  
-
-//     //! Validate the BlockSelector value.  
-//     if (0x00 != pGetLanReq->BlockSelect)  
-//     {
-//     	printf("GetLanConfigParam log2\n");
-//         *pRes = CC_INV_DATA_FIELD;  
-//         return sizeof (*pRes);  
-//     }
-
-
-//     EthIndex= GetEthIndex(pGetLanReq->ChannelNum & 0x0F, BMCInst);
-//     if(0xff == EthIndex)
-//     {
-//     	printf("GetLanConfigParam log3\n");
-//         *pRes = CC_INV_DATA_FIELD;
-//         return sizeof (uint8_t);
-//     }
-
-//     /*Get the EthIndex*/
-//     if(GetIfcName(EthIndex,IfcName, BMCInst) != 0)
-//     {
-//         TCRIT("Error in Getting IfcName\n");
-//         *pRes = CC_INV_DATA_FIELD;
-//         return sizeof (uint8_t);
-//     }
+/*---------------------------------------------------
+ * GetLanConfigParam
+ *---------------------------------------------------*/
+int
+GetLanConfigParam (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes)
+{
+    GetLanConfigReq_T*  pGetLanReq = (  GetLanConfigReq_T*) pReq;
+    GetLanConfigRes_T*  pGetLanRes = (  GetLanConfigRes_T*) pRes;
+    uint8_t EthIndex;
+    char IfcName[16];  /* Eth interface name */
 
-//     for(i=0;i<sizeof(Ifcnametable)/sizeof(IfcName_T);i++)
-//     {
-//         if(strcmp(Ifcnametable[i].Ifcname,IfcName) == 0)
-//         {
-//             netindex= Ifcnametable[i].Index;
-//             break;
-//         }
-//     }
+    pGetLanRes->CCParamRev.CompletionCode = CC_NORMAL;
+    pGetLanRes->CCParamRev.ParamRevision  = PARAMETER_REVISION_FORMAT;
 
-//     if(netindex == 0xFF)
-//     {
-//         TCRIT("Error in Getting netindex %d %s\n",netindex,IfcName);
-//         *pRes = CC_INV_DATA_FIELD;
-//         return sizeof (uint8_t);
-//     }
+//    printf("---> channel: %d, parameter: %#x, setslect: %#x, blockselect: %#x\n", pGetLanReq->ChannelNum, pGetLanReq->ParameterSelect, pGetLanReq->SetSelect, pGetLanReq->BlockSelect);
+    if(pGetLanReq->ChannelNum & RESERVED_VALUE_70)
+    {
+        /* Alarm !!! Somebody is trying to set Reseved Bits */
+        *pRes = CC_INV_DATA_FIELD;
+        return sizeof (*pRes);
+    }
     
-//     if ((pGetLanReq->ChannelNum & GET_PARAMETER_REVISION_MASK) != 0)
-//     {
-//         if((MAX_LAN_CONF_PARAM >= pGetLanReq->ParameterSelect) ||
-//                ((MIN_LAN_OEM_CONF_PARAM <= pGetLanReq->ParameterSelect) && (MAX_LAN_OEM_CONF_PARAM >= pGetLanReq->ParameterSelect)) ) 
-//         {
-//             return sizeof(GetLanCCRev_T);
-//         }
-//         else
-//         {
-//              *pRes = CC_PARAM_NOT_SUPPORTED;
-//              return sizeof (*pRes);  
-//         }
-
-//     }
-//     else
-//     {
-//     	printf("GetLanConfigParam log4\n");
-//             switch(pGetLanReq->ParameterSelect)
-//             {
-//             case LAN_PARAM_SET_IN_PROGRESS:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 pGetLanRes->ConfigData.SetInProgress = BMC_GET_SHARED_MEM(BMCInst)->m_Lan_SetInProgress;
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_AUTH_TYPE_SUPPORT:
-
-//                 pGetLanRes->ConfigData.AuthTypeSupport = pBMCInfo->LANCfs[EthIndex].AuthTypeSupport;
-//                 break;
-
-//             case LAN_PARAM_AUTH_TYPE_ENABLES:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy (&pGetLanRes->ConfigData.AuthTypeEnables,
-//                           &(pBMCInfo->LANCfs[EthIndex].AuthTypeEnables), sizeof(AuthTypeEnables_T));
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_IP_ADDRESS:
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
-//                     {
-//                         _fmemcpy (NWConfig.IPAddr,pBMCInfo->LANCfs[EthIndex].IPAddr, IP_ADDR_LEN);
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig, 0, sizeof(NWConfig));
-//                     }
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 _fmemcpy (pGetLanRes->ConfigData.IPAddr, NWConfig.IPAddr, IP_ADDR_LEN);
-
-
-//             break;
-
-//             case LAN_PARAM_IP_ADDRESS_SOURCE:
-//             if(g_corefeatures.delayed_lan_restart_support)
-//             {
-//                 if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
-//                 {
-//                     NWConfig.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPAddrSrc;
-//                 }
-//                 else
-//                 {
-//                     memset(&NWConfig, 0, sizeof(NWConfig));
-//                 }
-//             }
-//             else
-//             {
-//                 nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//             }
-
-//             pGetLanRes->ConfigData.IPAddrSrc = NWConfig.CfgMethod;
-//               break;
-
-//             case LAN_PARAM_MAC_ADDRESS:
-//                 nwGetNWInformations(&NWConfig,IfcName);
-//                 _fmemcpy (pGetLanRes->ConfigData.MACAddr, NWConfig.MAC, MAC_ADDR_LEN);
-
-//                 break;
-
-//             case LAN_PARAM_SUBNET_MASK:
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
-//                     {
-//                         _fmemcpy (NWConfig.Mask,pBMCInfo->LANCfs[EthIndex].SubNetMask, IP_ADDR_LEN);
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig, 0, sizeof(NWConfig));
-//                     }
-//                 }
-//                 else 
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);	
-//                 }
-//                 _fmemcpy (pGetLanRes->ConfigData.SubNetMask, NWConfig.Mask, IP_ADDR_LEN);
-//                 break;
-
-//             case LAN_PARAM_IPv4_HEADER:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy (&pGetLanRes->ConfigData.Ipv4HdrParam,
-//                           &(pBMCInfo->LANCfs[EthIndex].Ipv4HdrParam), sizeof(IPv4HdrParams_T));
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_PRI_RMCP_PORT:
-
-//                 pGetLanRes->ConfigData.PrimaryRMCPPort = htoipmi_u16(pBMCInfo->LANCfs[EthIndex].PrimaryRMCPPort);
-//                 break;
-
-//             case LAN_PARAM_SEC_RMCP_PORT:
-//                 /* Returning Invalid error message */
-//                 *pRes = CC_PARAM_NOT_SUPPORTED;
-//                 return sizeof (uint8_t);
-//                 /*pGetLanRes->ConfigData.SecondaryPort = htoipmi_u16(pPMConfig->LANConfig[EthIndex].SecondaryPort);*/
-//                 break;
-
-//             case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
-
-//                 pGetLanRes->ConfigData.BMCGeneratedARPControl = pBMCInfo->LANCfs[EthIndex].BMCGeneratedARPControl;
-//                 break;
-//             case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
-//                 pGetLanRes->ConfigData.GratitousARPInterval =
-//                         pBMCInfo->LANCfs[EthIndex].GratitousARPInterval;
-//                 break;
-
-//             case LAN_PARAM_DEFAULT_GATEWAY_IP:
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if(pBMCInfo->LANCfs[EthIndex].IPv4_Enable)
-//                     {
-//                         _fmemcpy (NWConfig.Gateway, pBMCInfo->LANCfs[EthIndex].DefaultGatewayIPAddr, IP_ADDR_LEN);
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig, 0, sizeof(NWConfig));
-//                     }
-//                 }
-//                 else 
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);	
-//                 }
-//                 _fmemcpy (pGetLanRes->ConfigData.DefaultGatewayIPAddr, NWConfig.Gateway, IP_ADDR_LEN);
-//                 break;
-
-//             case LAN_PARAM_DEFAULT_GATEWAY_MAC:
-//                 nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 nwGetSrcMacAddr(&NWConfig.Gateway[0],netindex, &pGetLanRes->ConfigData.DefaultGatewayMACAddr[0]);
-//                 break;
-
-//             case LAN_PARAM_BACKUP_GATEWAY_IP:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 nwGetBkupGWyAddr(pGetLanRes->ConfigData.BackupGatewayIPAddr,netindex);
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_BACKUP_GATEWAY_MAC:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy (pGetLanRes->ConfigData.BackupGatewayMACAddr,
-//                           pBMCInfo->LANCfs[EthIndex].BackupGatewayMACAddr, MAC_ADDR_LEN);
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_COMMUNITY_STRING:
-//                 if (g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME] != NULL )
-//                 {
-//                     if(((int(*)(uint8_t *, uint8_t *,int))(g_PDKHandle[PDK_GETSNMPCOMMUNITYNAME]))(pGetLanRes->ConfigData.CommunityStr,&ComStrLen, BMCInst)==0)
-//                         break;
-//                 }
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy (pGetLanRes->ConfigData.CommunityStr,
-//                           pBMCInfo->LANCfs[EthIndex].CommunityStr, MAX_COMM_STRING_SIZE);
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_DEST_NUM:
-
-//                 pGetLanRes->ConfigData.NumDest = pBMCInfo->LANCfs[EthIndex].NumDest;
-//                 break;
-
-//             case LAN_PARAM_SELECT_DEST_TYPE:
-
-
-//                 //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
-//                 if ( pGetLanReq->SetSelect   > pBMCInfo->LANCfs[EthIndex].NumDest )
-//                 {
-//                     *pRes = CC_PARAM_OUT_OF_RANGE ;
-//                     return sizeof (*pRes);
-//                 }
-
-//                 if (0 == pGetLanReq->SetSelect)
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.DestType,
-//                               &pSharedMem->VolLANDestType[EthIndex], sizeof(LANDestType_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 else
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.DestType,
-//                               &(pBMCInfo->LANCfs[EthIndex].DestType[pGetLanReq->SetSelect - 1]),
-//                               sizeof(LANDestType_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 break;
-
-//             case LAN_PARAM_SELECT_DEST_ADDR:
-
-//                 //if (pGetLanReq->SetSelect > NUM_LAN_DESTINATION)
-//                 if ( pGetLanReq->SetSelect   > pBMCInfo->LANCfs[EthIndex].NumDest )
-//                 {
-//                     *pRes = CC_PARAM_OUT_OF_RANGE ;
-//                     return sizeof (*pRes);
-//                 }
-
-//                 if (0 == pGetLanReq->SetSelect)
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
-//                               &pSharedMem->VolLANDest[EthIndex], sizeof(LANDestAddr_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 else
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.DestAddr,
-//                               &(pBMCInfo->LANCfs[EthIndex].DestAddr[pGetLanReq->SetSelect - 1]),
-//                               sizeof(LANDestAddr_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 break;
-
-//             case LAN_PARAM_VLAN_ID:
-
-//                 if( pBMCInfo->IpmiConfig.VLANIfcSupport == 1)
-//                 {
-//                     pGetLanRes->ConfigData.VLANID = pBMCInfo->LANCfs[EthIndex].VLANID;
-//                 }
-//                 break;
-
-//             case LAN_PARAM_VLAN_PRIORITY:
-
-//                 pGetLanRes->ConfigData.VLANPriority = pBMCInfo->LANCfs[EthIndex].VLANPriority;
-//                 break;
-
-//             case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
-
-//                 pGetLanRes->ConfigData.CipherSuiteSup = N0_OF_CIPHER_SUITE_SUPPORTED;
-//                 break;
-
-//             case LAN_PARAM_CIPHER_SUITE_ENTRIES:
-//                 {
-//                     int i;
-//                     _fmemset (pGetLanRes->ConfigData.CipherSuiteEntries, 0,
-//                               sizeof (pGetLanRes->ConfigData.CipherSuiteEntries));
-//                     for (i = 0; i < (N0_OF_CIPHER_SUITE_SUPPORTED); i++)
-//                     {
-//                         pGetLanRes->ConfigData.CipherSuiteEntries[i+1] = g_CipherRec[1 + i * 5];
-//                     }
-//                 }
-//                 break;
-
-//             case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
-
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy (pGetLanRes->ConfigData.CipherSuitePrivLevels,
-//                           pBMCInfo->LANCfs[EthIndex].CipherSuitePrivLevels,
-//                           MAX_NUM_CIPHER_SUITE_PRIV_LEVELS);
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-
-//             case LAN_PARAM_VLAN_TAGS:
-
-//                 *((  uint8_t*)&pGetLanRes->ConfigData) = pGetLanReq->SetSelect;
-//                 if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
-//                 {
-//                     pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
-//                     return sizeof (GetLanCCRev_T);
-//                 }
-//                 if (0 == pGetLanReq->SetSelect)
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (((  uint8_t*) &pGetLanRes->ConfigData) + 1,&pSharedMem->VLANDestTag, sizeof(VLANDestTags_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 else
-//                 {
-//                     if (pGetLanReq->SetSelect > pBMCInfo->LANCfs[EthIndex].NumDest)
-//                     {
-//                         pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_OUT_OF_RANGE;
-//                         return sizeof(GetLanCCRev_T);
-//                     }
-
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (((  uint8_t*)&pGetLanRes->ConfigData) + 1,
-//                     &pBMCInfo->LANCfs[EthIndex].VLANDestTags[pGetLanReq->SetSelect - 1],
-//                     sizeof(VLANDestTags_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 break;
-
-//             case LAN_PARAMS_BAD_PASSWORD_THRESHOLD:
-//                 LOCK_BMC_SHARED_MEM(BMCInst);
-//                 _fmemcpy(&pGetLanRes->ConfigData.BadPasswd,
-//                                 &pBMCInfo->LANCfs[EthIndex].BadPasswd,sizeof(BadPassword_T));
-//                 UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 break;
-//             case LAN_PARAMS_AMI_OEM_SNMPV6_DEST_ADDR:
-
-//                 if ( pGetLanReq->SetSelect   > pBMCInfo->LANCfs[EthIndex].NumDest )
-//                 {
-//                     *pRes = CC_PARAM_OUT_OF_RANGE ;
-//                     return sizeof (*pRes);
-//                 }
-
-//                 if (0 == pGetLanReq->SetSelect)
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
-//                               &pSharedMem->VolLANv6Dest[EthIndex], sizeof(LANDestv6Addr_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-//                 else
-//                 {
-//                     LOCK_BMC_SHARED_MEM(BMCInst);
-//                     _fmemcpy (&pGetLanRes->ConfigData.Destv6Addr,
-//                               &(pBMCInfo->LANCfs[EthIndex].Destv6Addr[pGetLanReq->SetSelect - 1]),
-//                               sizeof(LANDestv6Addr_T));
-//                     UNLOCK_BMC_SHARED_MEM(BMCInst);
-//                 }
-
-//                 TDBG("\n GetLanconfig: Getting SNMPv6 configuration done..\n");
-
-//                 return sizeof(GetLanConfigRes_T);
-
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_ENABLE_SET_MAC:
-
-//             	pGetLanRes->ConfigData.ChangeMACEnabled = enableSetMACAddr;
-//             	return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_ENABLE:
-//                 if(g_corefeatures.delayed_lan_restart_support) 
-//                 {
-//                     NWConfig6.enable = pBMCInfo->LANCfs[EthIndex].IPv6_Enable;
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 pGetLanRes->ConfigData.IPv6_Enable = NWConfig6.enable;
-//                 return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-                
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_SOURCE:
-//                 if(g_corefeatures.delayed_lan_restart_support) 
-//                 {
-//                     if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
-//                     {
-//                         NWConfig6.CfgMethod = pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc;
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig6, 0, sizeof(NWConfig6));
-//                     }
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 pGetLanRes->ConfigData.IPv6_IPAddrSrc = NWConfig6.CfgMethod;
-//                 return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-                
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR:
-//             case LAN_PARAMS_AMI_OEM_IPV6_IP_ADDR_EUI64:
-//                 if(pGetLanReq->SetSelect & 0xF0)
-//                 {
-//                     *pRes = CC_INV_DATA_FIELD;
-//                     return sizeof(uint8_t);
-//                 }
-               
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
-//                     {
-//                         _fmemcpy (NWConfig6.GlobalIPAddr,pBMCInfo->LANCfs[EthIndex].IPv6_IPAddr, IP6_ADDR_LEN*MAX_IPV6ADDRS);
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig6, 0, sizeof(NWConfig6));
-//                     }
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.GlobalIPAddr[(pGetLanReq->SetSelect & 0x0F)], IP6_ADDR_LEN);
-//                 return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
-                
-//                 break;
-//             case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR:
-//                 nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 _fmemcpy (pGetLanRes->ConfigData.IPv6_LinkAddr, NWConfig6.LinkIPAddr, IP6_ADDR_LEN);
-//                 return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_PREFIX_LENGTH:
-
-//                 if(pGetLanReq->SetSelect & 0xF0)
-//                 {
-//                     *pRes = CC_INV_DATA_FIELD;
-//                     return sizeof(uint8_t);
-//                 }
-
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
-//                     {
-//                         NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)] = pBMCInfo->LANCfs[EthIndex].IPv6_PrefixLen[(pGetLanReq->SetSelect & 0x0F)];
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig6, 0, sizeof(NWConfig6));
-//                     }
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.GlobalPrefix[(pGetLanReq->SetSelect & 0x0F)];
-//                 return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-                
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_LINK_ADDR_PREFIX:
-//                 nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 pGetLanRes->ConfigData.IPv6_LinkAddrPrefix = NWConfig6.LinkPrefix;
-//                 return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-                
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_IPV6_GATEWAY_IP:
-//                 if((g_corefeatures.delayed_lan_restart_support) && (pBMCInfo->LANCfs[EthIndex].IPv6_IPAddrSrc == STATIC_IP_SOURCE))
-//                 {
-//                     if((pBMCInfo->LANCfs[EthIndex].IPv6_Enable))
-//                     {
-//                         _fmemcpy (NWConfig6.Gateway,pBMCInfo->LANCfs[EthIndex].IPv6_GatewayIPAddr, IP6_ADDR_LEN);
-//                     }
-//                     else
-//                     {
-//                         memset(&NWConfig6, 0, sizeof(NWConfig6));
-//                     }
-//                 }
-//                 else
-//                 {
-//                     nwReadNWCfg_v4_v6( &NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 }
-//                 _fmemcpy (pGetLanRes->ConfigData.IPv6_GatewayIPAddr, NWConfig6.Gateway, IP6_ADDR_LEN);
-//                 return sizeof(GetLanCCRev_T) + IP6_ADDR_LEN;
-                
-//                 break;
-
-//             case LAN_PARAMS_AMI_OEM_PHY_SETTINGS:
-//                 memset(IfcName, 0, sizeof(IfcName));
-//                 if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
-//                 {
-//                     TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
-//                 }
-//                 if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
-//                 {
-//                     pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
-//                     return sizeof(GetLanCCRev_T);
-//                 }
-//                 pGetLanRes->ConfigData.PHYConfig.Interface = EthIndex;
-//                 pGetLanRes->ConfigData.PHYConfig.AutoNegotiationEnable = PHYCfg.autoneg;
-//                 pGetLanRes->ConfigData.PHYConfig.Speed = PHYCfg.speed;
-//                 pGetLanRes->ConfigData.PHYConfig.Duplex = PHYCfg.duplex;
-//                 pGetLanRes->ConfigData.PHYConfig.CapabilitiesSupported = PHYCfg.supported;
-
-//                 return sizeof(GetLanCCRev_T) + sizeof(PHYConfig_T);
-
-//             case LAN_PARAMS_AMI_OEM_MTU_SETTINGS:
-//                         memset(IfcName,0,sizeof(IfcName));
-//                         if(GetIfcNameByIndex(EthIndex, IfcName) != 0)
-//                         {
-//                             TCRIT("Error in Getting Interface Name for the lan Index:%d\n",EthIndex);
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
-//                             return sizeof(GetLanCCRev_T);
-
-//                         }
-//                         if(nwGetEthInformation(&PHYCfg, IfcName) !=0)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_UNSPECIFIED_ERR;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-					
-//                         pGetLanRes->ConfigData.MTU_size = PHYCfg.maxtxpkt;
-//                         return sizeof(GetLanCCRev_T) + sizeof(uint16_t);
-				
-//         case LAN_PARAMS_SSI_OEM_2ND_PRI_ETH_MAC_ADDR:
-//             if(g_corefeatures.ssi_support == ENABLED)
-//             {
-//                 netindex = 0x1; /* Specify the 2nd interface */
-//                 nwReadNWCfg_v4_v6(&NWConfig, &NWConfig6, netindex,g_corefeatures.global_ipv6);
-//                 _fmemcpy(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr, NWConfig.MAC, MAC_ADDR_LEN);
-//                 return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSI2ndPriEthMACAddr);
-//              }
-//              else
-//              {
-//                 pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//                 return sizeof(uint8_t);
-//              }
-//             break;
-
-//         case LAN_PARAMS_SSI_OEM_LINK_CTRL:
-//             if(g_corefeatures.ssi_support == ENABLED)
-//             {
-//                 pGetLanRes->ConfigData.SSILinkControl = 0;
-
-//                 pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN1Ch, BMCInst);
-//                 if(NULL == pChannelInfo)
-//                 {
-//                     *pRes = CC_UNSPECIFIED_ERR;
-//                     return	sizeof (*pRes);
-//                 }
+    //! Validate the SetSelector value. 
+    if (0x00 != pGetLanReq->SetSelect)
+    {
+        printf("---> SetSelector not support!\n");
+        *pRes = CC_INV_DATA_FIELD;  
+        return sizeof (*pRes);  
+    }  
 
-//                 if (pChannelInfo->AccessMode == 0x02)		/* If 1st channal is available */
-//                     pGetLanRes->ConfigData.SSILinkControl |= BIT0;
-//                 NIC_Count = g_coremacros.global_nic_count;
-//                 if (NIC_Count == 2)
-//                 {
-//                     pChannelInfo = getChannelInfo(pBMCInfo->RMCPLAN2Ch, BMCInst);
-//                     if(NULL == pChannelInfo)
-//                     {
-//                         *pRes = CC_UNSPECIFIED_ERR;
-//                         return	sizeof (*pRes);
-//                     }
-
-//                     if (pChannelInfo->AccessMode == 0x02)	/* If 2nd channal is available */
-//                         pGetLanRes->ConfigData.SSILinkControl |= BIT1;
-//                 }
-//                 return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.SSILinkControl);
-//             }
-//             else
-//             {
-//                 pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//                 return sizeof(uint8_t);
-//             }
-//             break;
+    //! Validate the BlockSelector value.  
+    if (0x00 != pGetLanReq->BlockSelect)  
+    {
+        printf("---> BlockSelector not support!\n");
+        *pRes = CC_INV_DATA_FIELD;  
+        return sizeof (*pRes);  
+    }
 
-//         case LAN_PARAMS_SSI_OEM_CMM_IP_ADDR:
-//             if(g_corefeatures.ssi_support == ENABLED)
-//             {
-//                 _fmemcpy (pGetLanRes->ConfigData.CMMIPAddr, pBMCInfo->SSIConfig.CMMIPAddr, IP_ADDR_LEN);
-//                 return sizeof(GetLanCCRev_T) + sizeof(pGetLanRes->ConfigData.CMMIPAddr);
-//             }
-//             else
-//             {
-//                 pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//                 return sizeof(uint8_t);
-//             }
-//             break;
 
-//         default:
-//             if(g_corefeatures.ncsi_cmd_support == ENABLED)
-//             {
-//                 switch(pGetLanReq->ParameterSelect)
-//                 {
-//                     case LAN_PARAMS_AMI_OEM_NCSI_CONFIG_NUM:
-//                         NCSIGetTotalPorts(&ncsiPortConfigNum);
-                        
-//                         if (ncsiPortConfigNum >= 0xFF)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-//                         else
-//                         {
-//                             pGetLanRes->ConfigData.NumNCSIPortConfigs = ncsiPortConfigNum;
-//                             return sizeof(GetLanCCRev_T) + sizeof(uint8_t);
-//                         }
-//                     break;
-                                
-//                     case LAN_PARAMS_AMI_OEM_NCSI_SETTINGS:
-//                     {
-//                         NIC_Count=g_coremacros.global_nic_count;
-//                         if (pGetLanReq->SetSelect >= NIC_Count)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-//                         NCSIConfig_T configData;
-//                         char interfaceName[8];
-
-//                         memset(&configData, 0, sizeof(NCSIConfig_T));
-//                         memset(interfaceName, 0, sizeof(interfaceName));
-
-//                         snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
-                        
-//                         if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-
-//                         if (configData.PackageId >= 0xFF || configData.ChannelId >= 0xFF)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-
-//                         pGetLanRes->ConfigData.NCSIPortConfig.Interface = pGetLanReq->SetSelect;
-//                         pGetLanRes->ConfigData.NCSIPortConfig.PackageId = configData.PackageId;
-//                         pGetLanRes->ConfigData.NCSIPortConfig.ChannelId = configData.ChannelId;
-
-//                         return sizeof(GetLanCCRev_T) + sizeof(NCSIPortConfig_T);
-//                     }
-//                     break;
-
-//                     case LAN_PARAMS_AMI_OEM_NCSI_MODE_CHANGE:
-//                     {
-//                         NIC_Count=g_coremacros.global_nic_count;
-//                         if (pGetLanReq->SetSelect >= NIC_Count)
-//                         		{
-//                         	printf("---> log5, SetSelect = %d, NIC_Count = %d\n",pGetLanReq->SetSelect, NIC_Count);
-//                            pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                            return sizeof(GetLanCCRev_T);
-//                         		}
-						
-//                         NCSIConfig_T configData;
-//                         char interfaceName[8];
-//                         memset(&configData, 0, sizeof(NCSIConfig_T));
-//                         memset(interfaceName, 0, sizeof(interfaceName));
-				
-//                         snprintf(interfaceName, sizeof(interfaceName), "%s%d", "eth", pGetLanReq->SetSelect);
-				
-//                         if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-						
-//                         if (configData.AutoSelect>= 0xFF)
-//                         {
-//                             pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                             return sizeof(GetLanCCRev_T);
-//                         }
-
-//                         pGetLanRes->ConfigData.NCSIModeConfig.Interface = pGetLanReq->SetSelect;
-//                         pGetLanRes->ConfigData.NCSIModeConfig.NCSIMode = configData.AutoSelect;
-
-//                         return sizeof(GetLanCCRev_T) + sizeof(NCSIModeConfig_T);
-//                     }
-//                     break;
-
-//                     case LAN_PARAMS_AMI_OEM_NCSI_EXTENSION:
-//                     {
-//                         char ncsi_default_ifc[IFNAMSIZ + 1] = "eth1";
-                        
-//                         if ((pGetLanReq->SetSelect == 0x20) && 
-//                             (g_corefeatures.ncsi_keep_phy_linkup_support == ENABLED))
-//                         {
-//                             NIC_Count=g_coremacros.global_nic_count;
-//                             NCSIConfig_T configData;
-//                             char interfaceName[8];
-//                             memset(&configData, 0, sizeof(NCSIConfig_T));
-//                             memset(interfaceName, 0, sizeof(interfaceName));
-
-//                             GetMacrodefine_string("CONFIG_SPX_FEATURE_NCSI_DEFAULT_INTERFACE", ncsi_default_ifc);
-//                             snprintf(interfaceName, sizeof(interfaceName), "%s", ncsi_default_ifc);
-
-//                             if (NCSIGetPortConfigByName(interfaceName, &configData) != 0)
-//                             {
-//                                 pGetLanRes->CCParamRev.CompletionCode = CC_INV_DATA_FIELD;
-//                                 return sizeof(GetLanCCRev_T);
-//                             }
-
-//                             char Interface[2];
-//                             snprintf(Interface, sizeof(Interface), "%c", interfaceName[3]);
-//                             pGetLanRes->ConfigData.NCSIPHYConfigGet.Interface = atoi(Interface);
-//                             pGetLanRes->ConfigData.NCSIPHYConfigGet.VetoBit = configData.VetoBit;
-
-//                             return sizeof(GetLanCCRev_T) + sizeof(NCSIPHYConfigGet_T);
-//                     }
-//                     else
-//                     {
-//                         pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//                         return sizeof(GetLanCCRev_T);
-//                     }
-//                 	}
-//                     break;
-					
-//                     default:
-//                         TDBG("In Valid Option\n");
-                        
-//                 }
-//             }
-//             pGetLanRes->CCParamRev.CompletionCode = CC_PARAM_NOT_SUPPORTED;
-//             return sizeof(uint8_t);
-//         }
+    EthIndex= 0;
+    sprintf(IfcName, "eth%d", EthIndex);
 
-//     }
+    if ((pGetLanReq->ChannelNum & GET_PARAMETER_REVISION_MASK) != 0)
+    {
+        if(MAX_LAN_CONF_PARAM >= pGetLanReq->ParameterSelect)
+        {
+            return sizeof(GetLanCCRev_T);
+        }
+        else
+        {
+             *pRes = CC_PARAM_NOT_SUPPORTED;
+             return sizeof (*pRes);  
+        }
 
-    
-//     return sizeof(GetLanCCRev_T) + LanconfigParameterLength[pGetLanReq->ParameterSelect];
-// }
+    }
+    else
+    {
+    	printf("GetLanConfigParam log4\n");
+        switch(pGetLanReq->ParameterSelect)
+        {
+            case LAN_PARAM_SET_IN_PROGRESS:
+                pGetLanRes->ConfigData.SetInProgress = 0;
+                break;
+            case LAN_PARAM_AUTH_TYPE_SUPPORT:
+                pGetLanRes->ConfigData.AuthTypeSupport = 0x04;  //only support MD5
+                break;
+            case LAN_PARAM_AUTH_TYPE_ENABLES:
+                pGetLanRes->ConfigData.AuthTypeEnables.AuthTypeCallBack = 0x04; //MD5
+                pGetLanRes->ConfigData.AuthTypeEnables.AuthTypeUser = 0x04;
+                pGetLanRes->ConfigData.AuthTypeEnables.AuthTypeOperator = 0x04;
+                pGetLanRes->ConfigData.AuthTypeEnables.AuthTypeAdmin = 0x04;
+                pGetLanRes->ConfigData.AuthTypeEnables.AuthTypeOem = 0x04;                
+                break;
+            case LAN_PARAM_IP_ADDRESS:
+                pGetLanRes->ConfigData.IPAddr[0] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].IPAddr[0]; 
+                pGetLanRes->ConfigData.IPAddr[1] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].IPAddr[1];
+                pGetLanRes->ConfigData.IPAddr[2] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].IPAddr[2];
+                pGetLanRes->ConfigData.IPAddr[3] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].IPAddr[3];
+                break;
+            case LAN_PARAM_IP_ADDRESS_SOURCE:
+                pGetLanRes->ConfigData.IPAddrSrc = 1;   //static
+                break;
+            case LAN_PARAM_MAC_ADDRESS:
+                pGetLanRes->ConfigData.MACAddr[0] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[0];
+                pGetLanRes->ConfigData.MACAddr[1] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[1];
+                pGetLanRes->ConfigData.MACAddr[2] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[2];
+                pGetLanRes->ConfigData.MACAddr[3] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[3];
+                pGetLanRes->ConfigData.MACAddr[4] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[4];
+                pGetLanRes->ConfigData.MACAddr[5] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].MACAddr[5];
+                break;
+            case LAN_PARAM_SUBNET_MASK:
+                pGetLanRes->ConfigData.SubNetMask[0] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].NetMask[0];
+                pGetLanRes->ConfigData.SubNetMask[1] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].NetMask[1];
+                pGetLanRes->ConfigData.SubNetMask[2] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].NetMask[2];
+                pGetLanRes->ConfigData.SubNetMask[3] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].NetMask[3];
+                break;
+            case LAN_PARAM_IPv4_HEADER: //下面这些参数是多少不知道,参考LanIfc.c的SetIPv4Header函数。
+                pGetLanRes->ConfigData.Ipv4HdrParam.TimeToLive = 64;
+                pGetLanRes->ConfigData.Ipv4HdrParam.IpHeaderFlags = 0;
+                pGetLanRes->ConfigData.Ipv4HdrParam.TypeOfService = 0x10;   //default
+                break;
+            case LAN_PARAM_PRI_RMCP_PORT:
+                pGetLanRes->ConfigData.PrimaryRMCPPort = LAN_RMCP_PORT; //LSB first
+                break;
+            case LAN_PARAM_SEC_RMCP_PORT:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+
+            case LAN_PARAM_BMC_GENERATED_ARP_CONTROL:
+                pGetLanRes->ConfigData.BMCGeneratedARPControl = 0;
+                break;
+            case LAN_PARAM_GRATITIOUS_ARP_INTERVAL:
+                pGetLanRes->ConfigData.GratitousARPInterval = 4;    //4*500ms
+                break;
+            case LAN_PARAM_DEFAULT_GATEWAY_IP:
+                pGetLanRes->ConfigData.DefaultGatewayIPAddr[0] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].DefaultGW[0];
+                pGetLanRes->ConfigData.DefaultGatewayIPAddr[1] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].DefaultGW[1];
+                pGetLanRes->ConfigData.DefaultGatewayIPAddr[2] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].DefaultGW[2];
+                pGetLanRes->ConfigData.DefaultGatewayIPAddr[3] = g_BMCInfo.IpmiConfig.LanInfo[EthIndex].DefaultGW[3];
+                break;
+            case LAN_PARAM_DEFAULT_GATEWAY_MAC: //这个参数提供不了。
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_BACKUP_GATEWAY_IP:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_BACKUP_GATEWAY_MAC:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_COMMUNITY_STRING:
+                sprintf(pGetLanRes->ConfigData.CommunityStr,"public");
+                break;
+            case LAN_PARAM_DEST_NUM:
+                pGetLanRes->ConfigData.NumDest = 0;
+                break;
+            case LAN_PARAM_SELECT_DEST_TYPE:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_SELECT_DEST_ADDR:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_VLAN_ID:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_VLAN_PRIORITY:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_CIPHER_SUITE_ENTRY_SUP:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_CIPHER_SUITE_ENTRIES:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_CIPHER_SUITE_PRIV_LEVELS:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            case LAN_PARAM_VLAN_TAGS:
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof (uint8_t);
+                break;
+            default: 
+                *pRes = CC_PARAM_NOT_SUPPORTED;
+                return sizeof(uint8_t);
+                break;
+        }
+    }
+    return sizeof(GetLanCCRev_T) + LanconfigParameterLength[pGetLanReq->ParameterSelect];
+}
 
 
 // /*---------------------------------------------------

+ 2 - 2
app/bmc/msghndlr/Transport/LANConfig.h

@@ -36,8 +36,8 @@
  * Get/Set commands allow retrieval and updation of various LAN parameters.
  * @{
 **/
- int SetLanConfigParam  (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
-// int GetLanConfigParam  (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
+int SetLanConfigParam  (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
+int GetLanConfigParam  (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
 // int SuspendBMCArps (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
 // int GetIPUDPRMCPStats (  uint8_t* pReq, uint8_t ReqLen,   uint8_t* pRes );
 

+ 3 - 2
app/common_include/com_BmcType.h

@@ -313,6 +313,7 @@ typedef struct{
 } FanInfo_T;
 
 typedef struct{
+    uint8_t present;        //0:不在位,1:在位。这个字段是给主模块用的,主模块会重写从模块的该字段。
     uint8_t healthStatus;   //0: 未知(灰色) 1:健康(绿色) 2:警告(黄色)3:错误(红色)
     uint8_t bladeName[31];  //10个汉字或30个字符
     uint8_t slotID;         
@@ -322,8 +323,8 @@ typedef struct{
 
 
 typedef struct{
-    uint8_t EthName[20];
-    uint8_t IPAddrSrc;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other
+//    uint8_t EthName[20];
+//    uint8_t IPAddrSrc;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other
     uint8_t IPAddr[4];
     uint8_t BroadCast[4];
     uint8_t NetMask[4];

+ 6 - 6
app/common_include/com_IPMI_LANConfig.h

@@ -310,13 +310,13 @@ typedef struct
 }   GetLanConfigReq_T;
 
 
-///* GetLanConfigRes_T */
-//typedef struct
-//{
-//    GetLanCCRev_T   CCParamRev;
-//    LANConfigUn_T   ConfigData;
+/* GetLanConfigRes_T */
+typedef struct
+{
+   GetLanCCRev_T   CCParamRev;
+   LANConfigUn_T   ConfigData;
 
-//}   GetLanConfigRes_T;
+}   GetLanConfigRes_T;
 
 /* GetLanConfigOEM_T */
 typedef struct

+ 2 - 66
app/goahead-3.6.5/src/libipmi/inc/libipmi_ChassisDevice.h

@@ -32,71 +32,7 @@ extern "C" {
 
 
 uint16_t  IPMICMD_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, int timeout, char cmd);
-
-
-// /**
-//    \breif	Higher level function for PowerOff Host.
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
-
-
-
-// /**
-//    \breif	Higher level function for PowerUP Host
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
-
-
-
-// /**
-//    \breif	Higher level function for PowerCycle host.
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
-
-
-
-// /**
-//    \breif	Higher level function for HardReset
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
-    
-
-// /**
-//    \breif	Higher level function for DiagInt
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
-    
-
-// /**
-//    \breif	Higher level function for SoftOff
-//    @param	pUDSSession		[in]Session handle
-//    @param	timeout			[in]timeout value in seconds.
-
-//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-// */
-//   uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
-    
-
+uint16_t IPMC_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout, char cmd);
 
 typedef enum tag_CHASSIS_ID_STATE
 {
@@ -123,7 +59,7 @@ typedef struct tag_chassis_status_T
  * @return  Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  */
   uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, int timeout,  chassis_status_T *status);
-
+uint16_t	IPMC_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout, chassis_status_T *status);
 /*---------------------Chassis Idnetify defines ---------------------*/
 #define CHASSIS_ID_INTERVAL_TURN_OFF		0
 #define CHASSIS_ID_INTERVAL_SPEC_DEFAULT   	15

+ 6 - 0
app/goahead-3.6.5/src/libipmi/inc/libipmi_sdr.h

@@ -147,6 +147,12 @@ uint16_t Storlead_GetCompleteSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ipm
 										int SensorNumber,
 										int timeout );
 
+  uint16_t IPMC_GetSpecificSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
+                                                uint8_t *sdr_buffer, 
+                                                uint32_t* sdr_buff_size,
+                                                int SensorNumber,
+                                                int timeout );
+
 
 #ifdef  __cplusplus
 }

+ 3 - 0
app/goahead-3.6.5/src/libipmi/inc/libipmi_sensor.h

@@ -57,6 +57,9 @@ extern "C" {
                                                SetSensorThresholdReq_T *pReqSetSensorThreshold,
                                                SetSensorThresholdRes_T *pResSetSensorThreshold,
                                                int timeout);
+uint16_t  IPMC_SetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
+                    SetSensorThresholdReq_T *pReqSetSensorThreshold,
+                    int timeout);
 
 /* 35.9 Get Sensor Thresholds Command */
   uint16_t IPMICMD_GetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,

+ 15 - 14
app/goahead-3.6.5/src/libipmi/inc/libipmi_storlead_OEM.h

@@ -29,18 +29,18 @@ typedef struct{
 }SysInfo_T;
 
 
-typedef struct{
-	uint8_t bladeNum;	//index
-	uint8_t isChmc;	//is main blade
-	uint8_t IPMBAddr;	//physical ID
-	uint8_t status;	//0: not install, 1: normal, 2: error
-	uint8_t reserve;
-} bladeStatus_T;
-
-typedef struct{
-	uint8_t complecode;	
-	bladeStatus_T bdStatus[10];
-} CardStatus_T;
+// typedef struct{
+// 	uint8_t bladeNum;	//index
+// 	uint8_t isChmc;	//is main blade
+// 	uint8_t IPMBAddr;	//physical ID
+// 	uint8_t status;	//0: not install, 1: normal, 2: error
+// 	uint8_t reserve;
+// } bladeStatus_T;
+
+// typedef struct{
+// 	uint8_t complecode;	
+// 	bladeStatus_T bdStatus[10];
+// } CardStatus_T;
 
 typedef struct{
 	uint8_t slotNum; //total slot numbers of chassis.
@@ -92,7 +92,6 @@ typedef struct{
 
 #pragma pack()
 
-extern OemWebFlags_T g_OemWebFlags;
 extern uint8_t gIPMBAddr[BLADE_NUMBERS];
 extern uint8_t gChassisManageEn;
 //uint16_t LIBIPMI_HL_GetIPMCSensorInfo(IPMI20_UDS_SESSION_T *pUDSSession, SenInfo_T *pSensorInfo,uint32_t *nNumSensor,int timeout);
@@ -109,12 +108,14 @@ uint16_t Storlead_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ip
 	SELEventRecordWithSensorName_T *pSELEntriesBuffer,uint32_t *nNumSelEntries,int timeout);
 uint16_t IPMICMD_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, int timeout);
 uint16_t IPMC_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout);
-uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout);
+uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, uint8_t isSave, LanInfo_T *pLanInfo, int timeout);
 uint16_t IPMICMD_GetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout);
 uint16_t IPMICMD_restoreFactorySettings(IPMI20_UDS_SESSION_T *pUDSSession, int timeout);
 uint16_t IPMC_restoreFactorySettings(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout);
 int LIBIPMI_IPMC_GetDeviceID(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, GetDevIDRes_T *DevIDRes, int timeout);
 int IPMI_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t sensor_number, uint8_t *sensor_name, int timeout);
 int IPMC_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, uint8_t sensor_number, uint8_t *sensor_name, int timeout);
+int IPMI_GetSensorHistory(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t sensor_number, uint8_t *history_buf, int timeout);
+int IPMC_GetSensorHistory(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, uint8_t sensor_number, uint16_t offset, uint16_t length, uint8_t *history_buf, int timeout);
 #endif /* __LIBIPMI_STORLEAD_OEM_H__ */
 

+ 101 - 97
app/goahead-3.6.5/src/libipmi/src/libipmi_Chassis.c

@@ -24,6 +24,7 @@
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
 #include "libipmi_ChassisDevice.h"
+#include "com_IPMI_App.h"
 
 #include "string.h"
 
@@ -55,6 +56,38 @@ uint16_t IPMICMD_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, int timeout,
     return wRet;
 }
 
+uint16_t IPMC_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout, char cmd)
+{
+	uint16_t 	wRet = 0;
+	uint8_t 	Req[10] = {0};
+	uint8_t		Res[10];
+	uint16_t 	strLen, remainLen;
+	uint32_t	dwResLen;
+	
+	//get title
+	Req[0] = 0x40;	//Track | channel 0
+	Req[1] = IpmbAddr;
+	Req[2] = NETFNLUN_IPMI_CHASSIS;
+	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
+	Req[4] = 0x20;
+	Req[5] = 0x10;
+	Req[6] = CMD_CHASSIS_CONTROL;	
+	Req[7] = cmd;
+	Req[8] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7])&0xff;
+
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+											DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+											Req, 9,
+											Res, &dwResLen,
+											timeout);
+	if((wRet != 0) || (Res[6] != 0))
+	{
+		printf("IPMC_ChassisControl faile\n" );
+		return -1;
+	}
+
+    return 0;
+}
 
 uint16_t IPMICMD_GetSystemBootOptions(IPMI20_UDS_SESSION_T *pUDSSession, GetBootOptionsReq_T* pReqGetBootOptions,
 							 GetBootOptionsRes_T* pResGetBootOptions,int reslen,int timeout)
@@ -155,101 +188,15 @@ uint16_t IPMICMD_ChassisIdentify(IPMI20_UDS_SESSION_T *pUDSSession,int timeout,C
 }
 
 
-// uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWEROFF);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed powerOFF  command.\n");
-//     }else
-// 	TDBG("Error: PowerOFF Command Failed.\n");
-	
-//     return wRet;
-// }
-
-// uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERUP);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed powerUP the command.\n");
-//     }else
-// 	TDBG("Error: PowerUp Command Failed.\n");
-	
-//     return wRet;
-// }
-
-// uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERCYCLE);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed powerCycle the command.\n");
-//     }else
-// 	TDBG("Error: PowerCycle Command Failed.\n");
-	
-//     return wRet;
-// }
-
-// uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {	//TODO: jimbo control rst1~10 pin
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_HARDRESET);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed HardReset the command.\n");
-//     }else
-// 	TDBG("Error: HardReset Command Failed.\n");
-	
-//     return wRet;
-// }
-
-// uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_DIAGINT);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed DiagInt command.\n");
-//     }else
-// 	TDBG("Error: DiagInt Command Failed.\n");
-	
-//     return wRet;
-// }
-
-// uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-// {
-//     uint16_t	wRet;
-
-//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_SOFTOFF);
-
-//     if (wRet == LIBIPMI_E_SUCCESS){
-// 	TDBG("Succefully executed SoftOff command.\n");
-//     }else
-// 	TDBG("Error: SoftOff Command Failed.\n");
-	
-//     return wRet;
-// }
 
 uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, int timeout, chassis_status_T *status)
 {
-
     uint32_t		dwResLen;
     uint16_t		wRet;
     uint8_t		ChassisStatusReq;
     GetChassisStatusRes_T ChassisStatusRes;
     uint8_t		powerState = -1;
 
-    dwResLen = sizeof(GetChassisStatusRes_T);
-    
     wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
 					    NETFNLUN_IPMI_CHASSIS, CMD_GET_CHASSIS_STATUS,
 					    (uint8_t *)&ChassisStatusReq, 0 ,
@@ -257,27 +204,21 @@ uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, int tim
 					    timeout);
     
     powerState = ChassisStatusRes.ChassisPowerState.PowerState ;
-    
-//    TINFO("PowerState is %d \n", powerState);
-    
     status->power_state = powerState & 0x01;
-
     status->last_power_event = ChassisStatusRes.ChassisPowerState.LastPowerEvent;
-
-
     if(ChassisStatusRes.ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_STATE_INFO_SUPPORTED)
     {
-	status->chassis_indetify_supported = 1;
+		status->chassis_indetify_supported = 1;
     }
     else
     {
-	status->chassis_indetify_supported = 0;
+		status->chassis_indetify_supported = 0;
     }
 
 
     if(ChassisStatusRes.ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_INDEFINITE_ON)
     {
-	status->chassis_identify_state = CHASSIS_ID_INDEFINITE_ON;
+		status->chassis_identify_state = CHASSIS_ID_INDEFINITE_ON;
     }
     else if(ChassisStatusRes.ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_TIMED_ON)
     {
@@ -285,12 +226,75 @@ uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, int tim
     }
     else
     {
-	status->chassis_identify_state = CHASSIS_ID_OFF;
+		status->chassis_identify_state = CHASSIS_ID_OFF;
     }
     
-    return wRet;
+    return 0;
 }
 
+uint16_t	IPMC_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int timeout, chassis_status_T *status)
+{
+
+	uint16_t 	wRet = 0;
+	uint8_t 	Req[10] = {0};
+	uint8_t		Res[10];
+	uint16_t 	strLen, remainLen;
+	uint32_t	dwResLen;
+	GetChassisStatusRes_T *pChassisStatusRes;
+	uint8_t		powerState = -1;
+	
+
+	//get title
+	Req[0] = 0x40;	//Track | channel 0
+	Req[1] = IpmbAddr;
+	Req[2] = NETFNLUN_IPMI_CHASSIS;
+	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
+	Req[4] = 0x20;
+	Req[5] = 0x10;
+	Req[6] = CMD_GET_CHASSIS_STATUS;	
+	Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
+
+	//dwResLen = sizeof(GetDevIDRes_T);
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+											DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+											Req, 8,
+											Res, &dwResLen,
+											timeout);
+    if((wRet != 0) || (Res[6] != 0))
+	{
+		printf("---> IPMC_GetChassisStatus error\n");
+		return -1;
+	}
+    
+    pChassisStatusRes = (GetChassisStatusRes_T *)&Res[6];
+    powerState = pChassisStatusRes->ChassisPowerState.PowerState ;
+    status->power_state = powerState & 0x01;
+    status->last_power_event = pChassisStatusRes->ChassisPowerState.LastPowerEvent;
+    if(pChassisStatusRes->ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_STATE_INFO_SUPPORTED)
+    {
+		status->chassis_indetify_supported = 1;
+    }
+    else
+    {
+		status->chassis_indetify_supported = 0;
+    }
+
+
+    if(pChassisStatusRes->ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_INDEFINITE_ON)
+    {
+		status->chassis_identify_state = CHASSIS_ID_INDEFINITE_ON;
+    }
+    else if(pChassisStatusRes->ChassisPowerState.MiscChassisState & CHASSIS_IDENTITY_TIMED_ON)
+    {
+        status->chassis_identify_state = CHASSIS_ID_TIMED_ON;
+    }
+    else
+    {
+		status->chassis_identify_state = CHASSIS_ID_OFF;
+    }
+    
+    return 0;
+}
 
 //will turn chassis identify on or off
 //BlinkTime - Set to TURN_OFF for turning off indefinitely

+ 20 - 20
app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c

@@ -60,7 +60,7 @@ uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(SELAllocInfo_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_GET_SEL_ALLOCATION_INFO,
+						NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_ALLOCATION_INFO,
 						(uint8_t*)DummyReqData, 0,
 						(uint8_t *)pResGetSELAllocInfo, &dwResLen,
 						timeout);
@@ -77,7 +77,7 @@ uint16_t IPMICMD_ReserveSEL(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	memset(pReserveSelRes, 0, sizeof(ReserveSELRes_T));
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
+						NETFNLUN_IPMI_STORAGE, CMD_RESERVE_SEL,
 						NULL, 0,
 						(uint8_t *)pReserveSelRes, &dwResLen,
 						timeout);
@@ -108,7 +108,7 @@ uint16_t IPMC_ReserveSEL(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
 
 	Req[0] = 0x40;	//Track | channel 0
 	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_APP;
+	Req[2] = NETFNLUN_IPMI_STORAGE;
 	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
 	Req[4] = 0x20;
 	Req[5] = 0x10;
@@ -147,7 +147,7 @@ uint16_t IPMICMD_GetSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
 	uint16_t wRet = 0;
 
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_GET_SEL_ENTRY,
+						NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_ENTRY,
 						(uint8_t*)pGetSELReqData, sizeof(GetSELReq_T),
 						(uint8_t *)pGetSELResData, &ResDataLen,
 						timeout);
@@ -244,7 +244,7 @@ uint16_t IPMICMD_AddSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(AddSELRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_ADD_SEL_ENTRY,
+						NETFNLUN_IPMI_STORAGE, CMD_ADD_SEL_ENTRY,
 						(uint8_t*)pSELReqData, sizeof(SELEventRecord_T),
 						(uint8_t *)pSELResData, &dwResLen,
 						timeout);
@@ -269,7 +269,7 @@ uint16_t IPMICMD_DeleteSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
 	//first do a SEL reservation
 	dwResLen = sizeof(ReserveSELRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
+						NETFNLUN_IPMI_STORAGE, CMD_RESERVE_SEL,
 						NULL, 0,
 						(uint8_t *)&ReserveSelRes, &dwResLen,
 						timeout);
@@ -293,7 +293,7 @@ uint16_t IPMICMD_DeleteSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
 	DeleteSELReqData.RecID = RecordID;
 
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_DELETE_SEL_ENTRY,
+						NETFNLUN_IPMI_STORAGE, CMD_DELETE_SEL_ENTRY,
 						(uint8_t*)&DeleteSELReqData, sizeof(DeleteSELReqData),
 						(uint8_t *)&DeleteSELResData, &dwResLen,
 						timeout);
@@ -314,7 +314,7 @@ uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
 	//first do a SEL reservation
  	dwResLen = sizeof(ReserveSELRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
+						NETFNLUN_IPMI_STORAGE, CMD_RESERVE_SEL,
 						(uint8_t*)DummyReqData, 0,
 						(uint8_t *)&ReserveSelRes, &dwResLen,
 						timeout);
@@ -343,7 +343,7 @@ uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(ClearSELRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_CLEAR_SEL,
+						NETFNLUN_IPMI_STORAGE, CMD_CLEAR_SEL,
 						(uint8_t*)&ClearSelReq, sizeof(ClearSELReq_T),
 						(uint8_t *)&ClearSelRes, &dwResLen,
 						timeout);
@@ -977,7 +977,7 @@ uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(FRUInventoryAreaInfoRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_FRU_INVENTORY_AREA_INFO,
+						NETFNLUN_IPMI_STORAGE, CMD_FRU_INVENTORY_AREA_INFO,
 						(uint8_t *)pReqFRUInventoryAreaInfo, sizeof(FRUInventoryAreaInfoReq_T),
 						(uint8_t *)pResFRUInventoryAreaInfo, &dwResLen,
 						timeout);
@@ -997,7 +997,7 @@ uint16_t IPMICMD_ReadFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(FRUReadRes_T) + (pFRUReadReqData->CountToRead);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_READ_FRU_DATA,
+						NETFNLUN_IPMI_STORAGE, CMD_READ_FRU_DATA,
 						(uint8_t *)pFRUReadReqData, sizeof(FRUReadReq_T),
 						(uint8_t *)pFRUReadResData, &dwResLen,
 						timeout);
@@ -1015,7 +1015,7 @@ uint16_t IPMICMD_WriteFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(FRUWriteRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_WRITE_FRU_DATA,
+						NETFNLUN_IPMI_STORAGE, CMD_WRITE_FRU_DATA,
 						(uint8_t *)pFRUWriteReqData, ReqDataLen,
 						(uint8_t *)pFRUWriteResData, &dwResLen,
 						timeout);
@@ -1155,7 +1155,7 @@ uint8_t IPMICMD_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(GetSELTimeRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_GET_SEL_TIME,
+						NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_TIME,
 						(uint8_t*)DummyReqData, 0,
 						(uint8_t *)pGetSELTimeRes, &dwResLen,
 						timeout);
@@ -1176,7 +1176,7 @@ uint8_t IPMC_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
 
 	Req[0] = 0x40;	//Track | channel 0
 	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_APP;
+	Req[2] = NETFNLUN_IPMI_STORAGE;
 	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
 	Req[4] = 0x20;
 	Req[5] = 0x10;
@@ -1208,7 +1208,7 @@ uint8_t IPMICMD_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(uint8_t);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_SET_SEL_TIME,
+						NETFNLUN_IPMI_STORAGE, CMD_SET_SEL_TIME,
 						(uint8_t *)pSetSELTimeReq, sizeof(SetSELTimeReq_T),
 						(uint8_t *)DummyResData, &dwResLen,
 						timeout);
@@ -1229,7 +1229,7 @@ uint8_t IPMC_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
 
 	Req[0] = 0x40;	//Track | channel 0
 	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_APP;
+	Req[2] = NETFNLUN_IPMI_STORAGE;
 	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
 	Req[4] = 0x20;
 	Req[5] = 0x10;
@@ -1261,7 +1261,7 @@ uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(GetSELTimeUTCOffsetRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_GET_SEL_TIME_UTC_OFFSET,
+						NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_TIME_UTC_OFFSET,
 						(uint8_t*)DummyReqData, 0,
 						(uint8_t *)pGetSELTimeUTCOffsetRes, &dwResLen,
 						timeout);
@@ -1282,7 +1282,7 @@ uint8_t IPMC_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ipmb
 
 	Req[0] = 0x40;	//Track | channel 0
 	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_APP;
+	Req[2] = NETFNLUN_IPMI_STORAGE;
 	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
 	Req[4] = 0x20;
 	Req[5] = 0x10;
@@ -1314,7 +1314,7 @@ uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
 
 	dwResLen = sizeof(SetSELTimeUTCOffsetRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-						NETFNLUN_IPMI_APP, CMD_SET_SEL_TIME_UTC_OFFSET,
+						NETFNLUN_IPMI_STORAGE, CMD_SET_SEL_TIME_UTC_OFFSET,
 						(uint8_t *)pSetSELTimeUTCOffsetReq, sizeof(SetSELTimeUTCOffsetReq_T),
 						(uint8_t *)&pSetSELTimeUTCOffsetRes, &dwResLen,
 						timeout);
@@ -1335,7 +1335,7 @@ uint8_t IPMC_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ipmb
 
 	Req[0] = 0x40;	//Track | channel 0
 	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_APP;
+	Req[2] = NETFNLUN_IPMI_STORAGE;
 	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
 	Req[4] = 0x20;
 	Req[5] = 0x10;

+ 82 - 5
app/goahead-3.6.5/src/libipmi/src/libipmi_sdr.c

@@ -672,7 +672,7 @@ uint16_t IPMC_GetSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
     FullSensorRec_T *sdr_record = (FullSensorRec_T*) &data_buffer[sizeof(GetSDRRes_T)];
     GetSDRReq_T ReqGetSDR;
     GetSDRRes_T *pResGetSDR = (GetSDRRes_T *) &data_buffer[0];
-    uint32_t      dwRetLen = 255;   //sizeof(data_buffer);
+    uint32_t      dwRetLen;   //sizeof(data_buffer);
     int wRet = 0;
     
     wRet = IPMICMD_ReserveSDRRepository(pUDSSession, &ResReserveSDRRepository, timeout);
@@ -685,8 +685,6 @@ uint16_t IPMC_GetSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
         ReqGetSDR.Offset = 0;
         ReqGetSDR.Size = 0xff;
         wRet = IPMICMD_GetSDR(pUDSSession, &ReqGetSDR, pResGetSDR, &dwRetLen, timeout);
-        //TODO: IPMICMD_GetSDR replaced by LIBIPMI_HL_GetSDR, by jimbo
-        //wRet = LIBIPMI_HL_GetSDR(pUDSSession, ReqGetSDR.ReservationID, ReqGetSDR.RecID, pResGetSDR, &dwRetLen, timeout );
         if (wRet != LIBIPMI_E_SUCCESS)
         {
             printf("Get SDR error!\n");
@@ -700,8 +698,7 @@ uint16_t IPMC_GetSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
         }
     }
     
-    dwRetLen -= sizeof(GetSDRRes_T);
-    *sdr_buff_size = *sdr_buff_size >= dwRetLen ? dwRetLen : *sdr_buff_size;
+    *sdr_buff_size =  sizeof(FullSensorRec_T);
     memcpy(sdr_buffer, sdr_record, *sdr_buff_size);
 
     //printf("sdr_buff_size: %d\n", *sdr_buff_size);
@@ -710,3 +707,83 @@ uint16_t IPMC_GetSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
     return wRet;
 }
 
+uint16_t IPMC_GetSpecificSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
+                                                uint8_t *sdr_buffer, 
+                                                uint32_t* sdr_buff_size,
+                                                int SensorNumber,
+                                                int timeout )
+{
+    FullSensorRec_T *sdr_record = NULL;
+    uint16_t    wRet = 0;
+    uint8_t     Req[50] = {0};
+    uint8_t     Res[100];
+    uint16_t    strLen, remainLen;
+    uint32_t    dwResLen;
+    uint16_t    ReserveID = 0;
+    uint16_t    NextRecID = 0;
+    
+
+    //Reserve SDR
+    Req[0] = 0x40;  //Track | channel 0
+    Req[1] = IpmbAddr;
+    Req[2] = NETFNLUN_IPMI_STORAGE;
+    Req[3] = 0x100 - (Req[1] + Req[2])&0xff;    //checksum1
+    Req[4] = 0x20;
+    Req[5] = 0x10;
+    Req[6] = CMD_RESERVE_SDR_REPOSITORY;  
+    Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
+
+    //dwResLen = sizeof(GetDevIDRes_T);
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+                                            DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+                                            Req, 8,
+                                            Res, &dwResLen,
+                                            timeout);
+    if((wRet != 0) || (Res[6] != 0))
+    {
+        printf("Reserve SDR failed\n");
+        ReserveID = 0;
+    }
+
+
+    NextRecID = 0;
+    while (1)
+    {
+        Req[0] = 0x40;  //Track | channel 0
+        Req[1] = IpmbAddr;
+        Req[2] = NETFNLUN_IPMI_STORAGE;
+        Req[3] = 0x100 - (Req[1] + Req[2])&0xff;    //checksum1
+        Req[4] = 0x20;
+        Req[5] = 0x10;
+        Req[6] = CMD_GET_SDR;  
+        Req[7] = ReserveID&0xff;
+        Req[8] = (ReserveID>>8)&0xff;
+        Req[9] = NextRecID&0xff;
+        Req[10] = (NextRecID>>8)&0xff;
+        Req[11] = 0;                     //offset
+        Req[12] = 0xff;                 //size
+        Req[13] = 0x100 - (Req[4]+Req[5]+Req[6]+Req[7]+Req[8]+Req[9]+Req[10]+Req[11]+Req[12])&0xff;
+
+        wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+                                                DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+                                                Req, 14,
+                                                Res, &dwResLen,
+                                                timeout);
+        if ((wRet != LIBIPMI_E_SUCCESS) || (Res[6] != 0))
+        {
+            printf("Get SDR error!\n");
+            break;
+        }
+
+        NextRecID = (Res[8]<<8) | Res[7];
+        sdr_record = (FullSensorRec_T*)&Res[9];
+        if (sdr_record->SensorNum == SensorNumber)
+        {
+            break;  // found
+        }
+    }
+    
+    *sdr_buff_size = sizeof(FullSensorRec_T);
+    memcpy(sdr_buffer, sdr_record, *sdr_buff_size);
+    return 0;
+}

+ 47 - 0
app/goahead-3.6.5/src/libipmi/src/libipmi_sensor.c

@@ -178,6 +178,53 @@ uint16_t	IPMICMD_GetSDRInfo( IPMI20_UDS_SESSION_T *pUDSSession,
 	return wRet;
 }
 
+uint16_t	IPMC_SetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
+										SetSensorThresholdReq_T *pReqSetSensorThreshold,
+										int timeout)
+{
+	uint16_t    wRet = 0;
+    uint8_t     Req[50] = {0};
+    uint8_t     Res[50];
+    uint16_t    strLen, remainLen;
+    uint32_t    dwResLen;
+    uint16_t    ReserveID = 0;
+    uint16_t    NextRecID = 0;
+    
+
+    //Reserve SDR
+    Req[0] = 0x40;  //Track | channel 0
+    Req[1] = IpmbAddr;
+    Req[2] = NETFNLUN_IPMI_SENSOR;
+    Req[3] = 0x100 - (Req[1] + Req[2])&0xff;    //checksum1
+    Req[4] = 0x20;
+    Req[5] = 0x10;
+    Req[6] = CMD_SET_SENSOR_THRESHOLDS;  
+    Req[7] = pReqSetSensorThreshold->SensorNum;
+    Req[8] = pReqSetSensorThreshold->SetFlags;
+    Req[9] = pReqSetSensorThreshold->LowerNonCritical;
+    Req[10] = pReqSetSensorThreshold->LowerCritical;
+    Req[11] = pReqSetSensorThreshold->LowerNonRecoverable;
+    Req[12] = pReqSetSensorThreshold->UpperNonCritical;
+    Req[13] = pReqSetSensorThreshold->UpperCritical;
+    Req[14] = pReqSetSensorThreshold->UpperNonRecoverable;
+    Req[15] = 0x100 - (Req[4]+Req[5]+Req[6]+Req[7]+Req[8]+Req[9]+Req[10]+Req[11]+Req[12]+Req[13]+Req[14])&0xff;
+
+    //dwResLen = sizeof(GetDevIDRes_T);
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+                                            DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+                                            Req, 16,
+                                            Res, &dwResLen,
+                                            timeout);
+    if((wRet != 0) || (Res[6] != 0))
+    {
+    	printf("IPMC_SetSensorThreshold failed\n");
+    	return wRet;
+    }
+
+	return 0;
+}
+
+
 /* 35.9 Get Sensor Thresholds Command */
   uint16_t	IPMICMD_GetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,
 										GetSensorThresholdReq_T *pReqGetSensorThreshold,

+ 65 - 299
app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c

@@ -23,204 +23,6 @@
 #include "com_IPMI_App.h"
 
 
-OemWebFlags_T g_OemWebFlags;
-uint8_t ChassisPrimaryIPMBAddr[BLADE_NUMBERS] = {0X82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
-uint8_t ChassisSecondaryIPMBAddr[BLADE_NUMBERS] = {0X82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
-/*
-*@fn IPMICMD_AMIGetSensorInfo
-*@brief
-*@param pUDSSession - IPMI Session Handle
-*@param pAMIGetSensorInfoReq - Pointer to the request of AMI Get SensorInfo command
-*@param pAMIGetSensorInfoRes - Pointer to the response of AMI Get SensorInfo command
-*@param timeout - Timeout Value
-**/
-// uint16_t IPMICMD_GetIPMCSensorInfo(IPMI20_UDS_SESSION_T *pUDSSession, AMIGetSensorInfoRes_T *pGetIPMCSensorInfoRes,int timeout)
-// {
-//  	uint16_t wRet = 0;
-	
-// 	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(pUDSSession, (ReserveSDRRepositoryRes_T*)SDRData, timeout);
-// 	if(wRet != 0)
-// 	{
-// 		printf("Error Reserve SDR Repository\n");
-// 		return wRet;
-// 	}
-	
-// 	reservation_id = SDRData[2]<<8 | SDRData[1];
-	
-// 	do
-// 	{
-// 		//Get SDR
-// 		if(0 != LIBIPMI_HL_GetSDR(pUDSSession, 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];
-			
-// 			memset(SensorInfo.SensorName, 0, 16);
-// 			memcpy(SensorInfo.SensorName, &SDRData[3+49-1], SDRData[3+48-1]&0x3f);
-			
-// 			//get sensor reading
-// 			if(0 != IPMICMD_GetSensorReading(pUDSSession, (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;
-// 				}
-				
-// 			}
-			
-			
-// 			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);
-// 		}
-		
-		
-// 		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;
-	
-// 	pGetIPMCSensorInfoRes->Noofentries = cnt;
-	
-// //	printf("return pGetIPMCSensorInfoRes: ");
-// //	for(i=0;i<3+sizeof(SenInfo_T)*cnt;i++)
-// //		printf("%#2x ",((uint8_t*)pGetIPMCSensorInfoRes)[i]);
-// //	printf("\n");
-	
-// 	return (wRet);
-// }
-
-
-// uint16_t LIBIPMI_HL_GetIPMCSensorInfo(IPMI20_UDS_SESSION_T *pUDSSession,SenInfo_T *pSensorInfo,uint32_t *nNumSensor,int timeout)
-// {
-// 	uint16_t wRet = 0;
-// 	AMIGetSensorInfoRes_T *pGetIPMCSensorInfoRes;
-// 	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);
-// 	pGetIPMCSensorInfoRes = (AMIGetSensorInfoRes_T *)SensorEntries;
-// 	wRet = IPMICMD_GetIPMCSensorInfo(pUDSSession,(AMIGetSensorInfoRes_T *)SensorEntries,timeout);
-// 	if(wRet == LIBIPMI_E_SUCCESS)
-// 	{
-// 		*nNumSensor = pGetIPMCSensorInfoRes->Noofentries;
-// 		for(i = 0; i < pGetIPMCSensorInfoRes->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);
-// }
-
 uint16_t LIBIPMI_HL_SetFanInfo( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t fanIndex, uint8_t fanMode, uint8_t fanLevel, int timeout)
 {
 	uint16_t wRet = 0;
@@ -397,102 +199,6 @@ uint16_t IPMC_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, S
 	return 0;
 }
 
-
-uint16_t
-LIBIPMI_HL_GetSensorHistory( IPMI20_UDS_SESSION_T *pUDSSession, sensor_history_st *pSensorHistory_st, int card_index, int sensor_number, int IPMB_ADDR)
-{
-	printf("---> come in history\n");
-	int i = 0;
-	//uint8_t	 	RawHistory[MAX_HISTORY_LEN];
-	uint16_t    wRet;
-	uint32_t    dwResLen;
-	uint32_t	sdr_buff_size = 255;
-	uint8_t 	Req[5];
-	uint8_t 	*Res = (uint8_t*)walloc(MAX_HISTORY_LEN+3);
-	int timeout = 3;
-	FullSensorRec_T sdr_buffer;
-	uint16_t 	offset = 0;
-	uint16_t	reqLen = 0, resLen = 0;
-	float 		tmpValue;
-	//get factors
-	LIBIPMI_HL_GetSpecificSDR( pUDSSession, (uint8_t*)&sdr_buffer, &sdr_buff_size, sensor_number, timeout );	
-	
-	//get history
-	// if( pUDSSession->byMediumType == IPMB_MEDIUM )
-	// {
-	// 	reqLen = 22;	//32 bytes - ipmb message header - response header - checksum2
-	// 	do{
-	// 		Req[0] = sensor_number;
-	// 		Req[1] = (offset>>8)&0xff;
-	// 		Req[2] = offset&0xff;
-	// 		Req[3] = (reqLen>>8)&0xff;
-	// 		Req[4] = reqLen&0xff;
-	// 		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,   0x2e<<2, 0x89,
-	// 												(uint8_t*)Req, 5,
-	// 												(uint8_t *)Res, &dwResLen,
-	// 												timeout);
-	// 		if(wRet != 0)
-	// 		{
-	// 			return -1;
-	// 		}
-	// 		resLen = (Res[1]<<8) | Res[2];
-	// 		if(resLen > MAX_HISTORY_LEN)
-	// 		{
-	// 			printf("---> response length error: resLen = %#x\n", resLen);
-	// 			return -1;
-	// 		}
-	// 		memcpy(&RawHistory[offset],&Res[3],resLen);
-	// 		offset += resLen;
-	// 		if(offset >= MAX_HISTORY_LEN)	//get all history datas
-	// 		{
-	// 			reqLen = 0;
-	// 			break;
-	// 		}
-	// 		reqLen = ((MAX_HISTORY_LEN-offset)>22) ? 22 : (MAX_HISTORY_LEN-offset);		
-	// 	}while(reqLen);		
-	// }
-	// else
-	{
-		Req[0] = sensor_number;
-		Req[1] = 0;
-		Req[2] = 0;
-		Req[3] = (MAX_HISTORY_LEN>>8)&0xff;
-		Req[4] = MAX_HISTORY_LEN & 0xff;
-		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,   
-									NETFNLUN_IPMI_STORLEAD, CMD_GET_SENSOR_HISTORY,
-									(uint8_t*)Req, 5,
-									(uint8_t *)Res, &dwResLen,
-									timeout);
-		if(wRet != 0)
-		{
-			return -1;
-		}
-		
-		resLen = (Res[1]<<8) | Res[2];
-		if(resLen > MAX_HISTORY_LEN)
-		{
-			printf("---> response length error: resLen = %#x\n", resLen);
-			return -1;
-		}
-		//memcpy(RawHistory,&Res[3],resLen);
-	}
-	
-	for(i=0;i < 480; i++)
-	{
-		ipmi_convert_reading( (uint8_t*)&sdr_buffer, Res[3+i], &tmpValue );
-		pSensorHistory_st->sensor_history[i] = tmpValue;
-		//printf("raw: %#x, float: %f\n", Res[3+i], tmpValue);
-	}
-	
-	memset(pSensorHistory_st->sensor_name, 0,sizeof(pSensorHistory_st->sensor_name));
-	memcpy(pSensorHistory_st->sensor_name, sdr_buffer.IDStr, sdr_buffer.IDStrTypeLen&0x3f);
-	pSensorHistory_st->sensor_num = sensor_number;
-
-	wfree(Res);
-
-	return 0;
-}
-
 // /************************************************* new add **********************************************************************/
 int LIBIPMI_HL_GetChassisInfo(IPMI20_UDS_SESSION_T *pUDSSession, OemChassisInfo_T* pChassisInfo, int timeout)
 {
@@ -841,7 +547,7 @@ uint16_t IPMC_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, int
 	return (wRet);
 }
 
-uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, LanInfo_T *pLanInfo, int timeout)
+uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, uint8_t isSave, LanInfo_T *pLanInfo, int timeout)
 {
 	uint16_t wRet;
 	uint32_t dwResLen;
@@ -849,10 +555,11 @@ uint16_t IPMICMD_SetLanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t index, La
 	uint8_t req[100];
 	
 	req[0] = index; 
-	memcpy(&req[1], pLanInfo, sizeof(LanInfo_T));
+	req[1] = isSave;
+	memcpy(&req[2], pLanInfo, sizeof(LanInfo_T));
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
 						NETFNLUN_IPMI_STORLEAD, CMD_SET_LAN_INFO,
-						req, sizeof(LanInfo_T)+1,
+						req, sizeof(LanInfo_T)+2,
 						(uint8_t*)res, &dwResLen,
 						timeout);
 	if(res[0] != 0)
@@ -918,7 +625,6 @@ uint16_t IPMC_restoreFactorySettings(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t
 	Req[6] = CMD_RESTORE_FACTORY_SET;	
 	Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
 
-	//dwResLen = sizeof(GetDevIDRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
 											DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
 											Req,8,
@@ -1024,4 +730,64 @@ int IPMC_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, uint
 
 	memcpy(sensor_name, &Res[7], MAX_ID_STR_LEN);
 	return 0;
-}
+}
+
+int IPMI_GetSensorHistory(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t sensor_number, uint8_t *history_buf, int timeout)
+{
+	uint8_t 	Req[10] = {0};
+	uint32_t	dwResLen;
+	uint16_t 	wRet;
+	Req[0] = sensor_number;
+    Req[1] = 0;
+    Req[2] = 0;
+    Req[3] = (MAX_HISTORY_LEN>>8)&0xff;
+    Req[4] = MAX_HISTORY_LEN & 0xff;
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,   
+                                NETFNLUN_IPMI_STORLEAD, CMD_GET_SENSOR_HISTORY,
+                                (uint8_t*)Req, 5,
+                                (uint8_t *)history_buf, &dwResLen,
+                                timeout);
+    if((wRet != 0) || (history_buf[0] != 0))
+    {
+        printf("IPMI_GetSensorHistory error!\n");
+        return -1;
+    }
+
+    return 0;
+}
+
+/*
+	本地模块可以一次性全部获取,但是从模块的IPMB总线最大也就只能传输256个字节,所以要分开获取。
+*/
+int IPMC_GetSensorHistory(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, uint8_t sensor_number, uint16_t offset, uint16_t length, uint8_t *history_buf, int timeout)
+{
+	uint8_t 	Req[20] = {0};
+	uint32_t	dwResLen;
+	uint16_t 	wRet;
+    Req[0] = 0x40;  //Track | channel 0
+    Req[1] = IpmbAddr;
+    Req[2] = NETFNLUN_IPMI_STORLEAD;
+    Req[3] = 0x100 - (Req[1] + Req[2])&0xff;    //checksum1
+    Req[4] = 0x20;
+    Req[5] = 0x10;
+    Req[6] = CMD_GET_SENSOR_HISTORY;  
+    Req[7] = sensor_number;
+    Req[8] = offset&0xff; //offset lsb
+    Req[9] = (offset>>8)&0xff; //offset msb
+    Req[10] = length&0xff;      //readlen lsb
+    Req[11] = (length>>8)&0xff;    //readlen msb
+    Req[12] = 0x100 - (Req[4]+Req[5]+Req[6]+Req[7]+Req[8]+Req[9]+Req[10]+Req[11])&0xff;
+
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession, 
+                                            DEFAULT_NET_FN_LUN, CMD_SEND_MSG,
+                                            Req, 13,
+                                            history_buf, &dwResLen,
+                                            timeout);
+    if((wRet != 0) || (history_buf[6] != 0))
+    {
+        printf("IPMC_GetSensorHistory error!\n");
+        return wRet;
+    }
+
+    return 0;
+}

+ 102 - 87
app/goahead-3.6.5/src/web_interface/src/config.c

@@ -22,15 +22,31 @@ uint8_t ip2dec(const char *strIp, uint8_t index);
 void restoreFactorySettings(Webs *wp){
 	uint16_t    wRet = LIBIPMI_E_SUCCESS;
     IPMI20_UDS_SESSION_T    UDSSession;
+    uint8_t target_addr;
     
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    //擦除Flash的配置区
-    IPMICMD_restoreFactorySettings(&UDSSession, DEFAULT_TIMEOUT);
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
+    {
+        //擦除Flash的配置区
+        wRet = IPMICMD_restoreFactorySettings(&UDSSession, DEFAULT_TIMEOUT);
+    }
+    else
+    {
+        wRet = IPMC_restoreFactorySettings(&UDSSession, target_addr, DEFAULT_TIMEOUT);
+    }
     
     //重启BMC
-    wRet = IPMICMD_ResetBMC(&UDSSession, DEFAULT_TIMEOUT);
+    if(target_addr == 0x20)
+    {
+        wRet = IPMICMD_ResetBMC(&UDSSession, DEFAULT_TIMEOUT);
+    }
+    else
+    {
+        wRet = IPMC_ResetBMC(&UDSSession, target_addr,DEFAULT_TIMEOUT);
+    }
 	if(wRet != 0)
 	{
 		websError(wp, 404, "Reset BMC fail!");
@@ -39,23 +55,22 @@ void restoreFactorySettings(Webs *wp){
 	//Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-	char *pStr;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-  
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
 
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -67,11 +82,20 @@ void restoreFactorySettings(Webs *wp){
 void web_ResetBMC(Webs *wp){
 	uint16_t    wRet = LIBIPMI_E_SUCCESS;
     IPMI20_UDS_SESSION_T    UDSSession;
+    uint8_t target_addr;
     
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-	wRet = IPMICMD_ResetBMC(&UDSSession, DEFAULT_TIMEOUT);
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
+    {
+	   wRet = IPMICMD_ResetBMC(&UDSSession, DEFAULT_TIMEOUT);
+    }
+    else
+    {
+        wRet = IPMC_ResetBMC(&UDSSession, target_addr, DEFAULT_TIMEOUT);
+    }
 	if(wRet != 0)
 	{
 		websError(wp, 404, "Reset BMC fail!");
@@ -80,23 +104,22 @@ void web_ResetBMC(Webs *wp){
 	//Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-	char *pStr;
+	
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-  
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -104,13 +127,13 @@ void web_ResetBMC(Webs *wp){
         cJSON_Delete(root);
 }
 
-
 void web_GetLanInfo(Webs *wp){
     uint16_t    wRet = LIBIPMI_E_SUCCESS;
     IPMI20_UDS_SESSION_T    UDSSession;
     LanInfo_T   LanInfo;
     uint8_t index = 0;
     char *EthName = websGetVar(wp, "eth", NULL);
+    uint8_t target_addr;
 
     if(strcmp(EthName, "eth0") == 0)
     {
@@ -125,32 +148,32 @@ void web_GetLanInfo(Webs *wp){
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    wRet = IPMICMD_GetLanInfo(&UDSSession, index, &LanInfo, DEFAULT_TIMEOUT);
-    if(wRet != 0)
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
     {
-        websError(wp, 404, "Get Lan Info fail!");
+        wRet = IPMICMD_GetLanInfo(&UDSSession, index, &LanInfo, DEFAULT_TIMEOUT);
+        if(wRet != 0)
+        {
+            websError(wp, 404, "Get Lan Info fail!");
+        }
+    }
+    else
+    {
+        memset(&LanInfo, 0, sizeof(LanInfo_T));
     }
 
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-    cJSON_AddStringToObject(data, "eth", LanInfo.EthName);
-
-    if(LanInfo.IPAddrSrc == STATIC_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "static");
-    else if(LanInfo.IPAddrSrc == DHCP_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "DHCP");
-    else if(LanInfo.IPAddrSrc == BIOS_IP_SOURCE)
-        cJSON_AddStringToObject(data, "mode", "BIOS");
-    else 
-        cJSON_AddStringToObject(data, "mode", "Other");
+    cJSON_AddStringToObject(data, "eth", "eth0");
+    cJSON_AddStringToObject(data, "mode", "static");
     
     char strIp[16] = {0};
     sprintf(strIp, "%d.%d.%d.%d", LanInfo.IPAddr[0], LanInfo.IPAddr[1], 
@@ -177,15 +200,15 @@ void web_GetLanInfo(Webs *wp){
         LanInfo.DefaultGW[2], LanInfo.DefaultGW[3]);
     cJSON_AddStringToObject(data, "defaultgw", strGw);
 
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -199,6 +222,7 @@ void web_SetLanInfo(Webs *wp){
     IPMI20_UDS_SESSION_T    UDSSession;
     LanInfo_T   LanInfo;
     uint8_t index = 0;
+    uint8_t target_addr;
     
     char *EthName = websGetVar(wp, "eth", NULL);    //eth0
     char *strMode = websGetVar(wp, "mode", NULL);   //static DHCP
@@ -207,6 +231,9 @@ void web_SetLanInfo(Webs *wp){
     char *strBrdCast = websGetVar(wp, "broadcast", NULL);   //192.168.0.255
     char *strMask = websGetVar(wp, "netmask", NULL);        //255.255.255.0
     char *strGw = websGetVar(wp, "defaultgw", NULL);        //192.168.0.1
+    char *strSave = websGetVar(wp, "isSave", NULL);         //0 or 1
+
+    int  isSave = atoi(strSave);
 
     if(strlen(EthName) > 20)
     {
@@ -225,83 +252,71 @@ void web_SetLanInfo(Webs *wp){
         return;
     }
 
-    strcpy(LanInfo.EthName, EthName);
-    if((strcmp(strMode, "static") == 0) || (strcmp(strMode, "Static") == 0) 
-        || (strcmp(strMode, "STATIC") == 0))
-    {
-        LanInfo.IPAddrSrc = STATIC_IP_SOURCE;  //0:unspecified 1:Static 2:DHCP  3:BIOS 4:other    
-    }
-    else if((strcmp(strMode, "DHCP") == 0) || (strcmp(strMode, "Dhcp") == 0 )
-        || (strcmp(strMode, "dhcp") == 0))
-    {
-        LanInfo.IPAddrSrc = DHCP_IP_SOURCE;    
-    }
-    else if((strcmp(strMode, "BIOS") == 0) || (strcmp(strMode, "Bios") == 0 )
-        || (strcmp(strMode, "bios") == 0))
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
     {
-        LanInfo.IPAddrSrc = BIOS_IP_SOURCE;    
-    }
-    else
-    {
-        LanInfo.IPAddrSrc = BMC_OTHER_SOURCE;  
-    }
+        LanInfo.IPAddr[0] = ip2dec(strIp, 0);
+        LanInfo.IPAddr[1] = ip2dec(strIp, 1);
+        LanInfo.IPAddr[2] = ip2dec(strIp, 2);
+        LanInfo.IPAddr[3] = ip2dec(strIp, 3);
+        
+        LanInfo.BroadCast[0] = ip2dec(strBrdCast, 0);
+        LanInfo.BroadCast[1] = ip2dec(strBrdCast, 1);
+        LanInfo.BroadCast[2] = ip2dec(strBrdCast, 2);
+        LanInfo.BroadCast[3] = ip2dec(strBrdCast, 3);
+
+        LanInfo.NetMask[0] = ip2dec(strMask, 0);
+        LanInfo.NetMask[1] = ip2dec(strMask, 1);
+        LanInfo.NetMask[2] = ip2dec(strMask, 2);
+        LanInfo.NetMask[3] = ip2dec(strMask, 3);
+
+        LanInfo.DefaultGW[0] = ip2dec(strGw, 0);
+        LanInfo.DefaultGW[1] = ip2dec(strGw, 1);
+        LanInfo.DefaultGW[2] = ip2dec(strGw, 2);
+        LanInfo.DefaultGW[3] = ip2dec(strGw, 3);
+
+        LanInfo.MACAddr[0] = mac2hex(strMac, 0);
+        LanInfo.MACAddr[1] = mac2hex(strMac, 1);
+        LanInfo.MACAddr[2] = mac2hex(strMac, 2);
+        LanInfo.MACAddr[3] = mac2hex(strMac, 3);
+        LanInfo.MACAddr[4] = mac2hex(strMac, 4);
+        LanInfo.MACAddr[5] = mac2hex(strMac, 5);
+
+        //isSave 只能是0和1这两个值。
+        if(isSave != 1)
+        {
+            isSave = 0;
+        }
+        
+        //Create session
+        LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    LanInfo.IPAddr[0] = ip2dec(strIp, 0);
-    LanInfo.IPAddr[1] = ip2dec(strIp, 1);
-    LanInfo.IPAddr[2] = ip2dec(strIp, 2);
-    LanInfo.IPAddr[3] = ip2dec(strIp, 3);
-    
-    LanInfo.BroadCast[0] = ip2dec(strBrdCast, 0);
-    LanInfo.BroadCast[1] = ip2dec(strBrdCast, 1);
-    LanInfo.BroadCast[2] = ip2dec(strBrdCast, 2);
-    LanInfo.BroadCast[3] = ip2dec(strBrdCast, 3);
-
-    LanInfo.NetMask[0] = ip2dec(strMask, 0);
-    LanInfo.NetMask[1] = ip2dec(strMask, 1);
-    LanInfo.NetMask[2] = ip2dec(strMask, 2);
-    LanInfo.NetMask[3] = ip2dec(strMask, 3);
-
-    LanInfo.DefaultGW[0] = ip2dec(strGw, 0);
-    LanInfo.DefaultGW[1] = ip2dec(strGw, 1);
-    LanInfo.DefaultGW[2] = ip2dec(strGw, 2);
-    LanInfo.DefaultGW[3] = ip2dec(strGw, 3);
-
-    LanInfo.MACAddr[0] = mac2hex(strMac, 0);
-    LanInfo.MACAddr[1] = mac2hex(strMac, 1);
-    LanInfo.MACAddr[2] = mac2hex(strMac, 2);
-    LanInfo.MACAddr[3] = mac2hex(strMac, 3);
-    LanInfo.MACAddr[4] = mac2hex(strMac, 4);
-    LanInfo.MACAddr[5] = mac2hex(strMac, 5);
-    
-    //Create session
-    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+        wRet = IPMICMD_SetLanInfo(&UDSSession, index, isSave, &LanInfo, DEFAULT_TIMEOUT);
+        if(wRet != 0)
+        {
+            websError(wp, 404, "Reset BMC fail!");
+        }
 
-    wRet = IPMICMD_SetLanInfo(&UDSSession, index, &LanInfo, DEFAULT_TIMEOUT);
-    if(wRet != 0)
-    {
-        websError(wp, 404, "Reset BMC fail!");
+        //Close session
+        LIBIPMI_CloseSession(&UDSSession );
     }
 
-    //Close session
-    LIBIPMI_CloseSession(&UDSSession );
-
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-  
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 29 - 10
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -119,8 +119,8 @@ void getDeviceInfo(Webs *wp){
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
-    printf("---> cJSON Str:\n%s\n", pStr);
     if(pStr)
         wfree(pStr);
     if(root)
@@ -191,7 +191,7 @@ void getSysInfo(Webs *wp){
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
 sys_info_end: 
     if(sysInfo.title)
@@ -342,9 +342,20 @@ void getSensorInfo(Webs *wp){
             sprintf(minReading, "%.3f", pSensorBuff->min_reading);
 
             cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
+            // cJSON_AddNumberToObject(pJsonsub, "Num", pSensorBuff->sensor_num); 
+            // cJSON_AddStringToObject(pJsonsub, "Nam", pSensorBuff->sensor_name);
+            // cJSON_AddStringToObject(pJsonsub, "rad", reading);      /* 给对象增加内容 */    
+            // cJSON_AddStringToObject(pJsonsub, "lnr", lownr);                                        
+            // cJSON_AddStringToObject(pJsonsub, "lct", lowct);   
+            // cJSON_AddStringToObject(pJsonsub, "lnc", lownc);                                                       
+            // cJSON_AddStringToObject(pJsonsub, "hnc", highnc);                 
+            // cJSON_AddStringToObject(pJsonsub, "hct", highct);   
+            // cJSON_AddStringToObject(pJsonsub, "hnr", highnr);  
+            // cJSON_AddStringToObject(pJsonsub, "max", maxReading);  
+            // cJSON_AddStringToObject(pJsonsub, "min", minReading);  
+
             cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num); 
             cJSON_AddStringToObject(pJsonsub, "sensorName", pSensorBuff->sensor_name);
-
             cJSON_AddStringToObject(pJsonsub, "reading", reading);      /* 给对象增加内容 */    
             cJSON_AddStringToObject(pJsonsub, "lownr", lownr);                                        
             cJSON_AddStringToObject(pJsonsub, "lowct", lowct);   
@@ -355,7 +366,7 @@ void getSensorInfo(Webs *wp){
             cJSON_AddStringToObject(pJsonsub, "maxReading", maxReading);  
             cJSON_AddStringToObject(pJsonsub, "minReading", minReading);  
 
-            switch(pSensorBuff->sensor_units[1])    //sensorUinits2
+            switch(pSensorBuff->sensor_units[1])    //sensorUinits2 //uit
             {
             case 0: cJSON_AddStringToObject(pJsonsub, "unit", "unspecified"); break;                    
             case 1: cJSON_AddStringToObject(pJsonsub, "unit", "degree C"); break;
@@ -368,7 +379,7 @@ void getSensorInfo(Webs *wp){
             default: cJSON_AddStringToObject(pJsonsub, "unit", "unknown"); break;
             }
 
-            switch(pSensorBuff->sensor_state)
+            switch(pSensorBuff->sensor_state)   //sta
             {
             case 0x1:  cJSON_AddStringToObject(pJsonsub, "state", "ok"); cJSON_AddStringToObject(pJsonsub, "status", "1"); break;
             case 0x2:  cJSON_AddStringToObject(pJsonsub, "state", "Upper Non-Critical"); cJSON_AddStringToObject(pJsonsub, "status", "2"); break;    
@@ -395,7 +406,7 @@ void getSensorInfo(Webs *wp){
         websWrite(wp, pStr);
         websFlush(wp, 0);
         websDone(wp);
-        printf("---> cJSON Str:\n%s\n", pStr);
+        printf("cJSON:%s\n", pStr);
 
         if(root)
             cJSON_Delete(root);
@@ -488,11 +499,19 @@ void getAllBladeInfo(Webs *wp){
     for(i=0;i<BLADE_NUMBERS;i++)
     {
         cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
+        cJSON_AddNumberToObject(pJsonsub, "present", pBladeStatus[i].present);  //0:不在位,1:在位
         cJSON_AddNumberToObject(pJsonsub, "status", pBladeStatus[i].healthStatus); //0:灰色, 1: 绿色 2:红色
         cJSON_AddNumberToObject(pJsonsub, "slot", pBladeStatus[i].slotID); 
         cJSON_AddNumberToObject(pJsonsub, "power", pBladeStatus[i].pwrStatus); 
         cJSON_AddStringToObject(pJsonsub, "name", pBladeStatus[i].bladeName); 
         cJSON_AddNumberToObject(pJsonsub, "isChMC", pBladeStatus[i].isChMC); 
+
+        //将主模块的IPMB地址改成0x20
+        if(pBladeStatus[i].isChMC)
+        {
+            gIPMBAddr[i] = 0x20;
+            printf("Modify %d blade ipmb address to 0x20\n", i);
+        }
     }
   
     pStr = cJSON_PrintUnformatted(root);
@@ -503,7 +522,7 @@ void getAllBladeInfo(Webs *wp){
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -535,7 +554,7 @@ void setBladeManage(Webs *wp){
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -562,7 +581,7 @@ void getBladeManage(Webs *wp){
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -627,7 +646,7 @@ void getChassisInfo(Webs *wp){
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 2 - 2
app/goahead-3.6.5/src/web_interface/src/fan.c

@@ -78,7 +78,7 @@ void getAllFanInfo(Webs *wp){
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -151,7 +151,7 @@ void setFanInfo(Webs *wp){
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 3 - 3
app/goahead-3.6.5/src/web_interface/src/fru.c

@@ -178,7 +178,7 @@ void getFruChassisInfo(Webs *wp)
     websWrite(wp, "%s", pStr); 
     websFlush(wp, 0);	//wait for all data to be written to the socket 
     websDone(wp);
-    printf("---> cJSON Str: %d \n%s\n", strlen(pStr), pStr);
+    printf("cJSON: %s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -317,7 +317,7 @@ void getFruBoardInfo(Webs *wp)
     websWrite(wp, "%s", pStr);     
     websFlush(wp, 0);	//wait for all data to be written to the socket 
     websDone(wp);
-    printf("---> cJSON Str: %d \n%s\n", strlen(pStr), pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -455,7 +455,7 @@ void getFruProductInfo(Webs *wp)
     websWrite(wp, "%s", pStr); 
     websFlush(wp, 0);	
     websDone(wp);
-    printf("---> cJSON Str: %d \n%s\n", strlen(pStr), pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 24 - 27
app/goahead-3.6.5/src/web_interface/src/fw_update.c

@@ -44,35 +44,34 @@ void prepareDevice(Webs *wp)
         //Do nothing
     } 
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
+    
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-//    printf("---> cJSON Str:\n%s\n", pStr);
-   
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
-    // websDone(wp);
-
+    websDone(wp);
+    printf("cJSON:%s\n", pStr);
+ 
     if(pStr)
         wfree(pStr);
     if(root)
         cJSON_Delete(root);
     
-    websDone(wp);
     printf("Update Firmware: Prepare Device Ok.\n");
 }
 
 /* 
     接收上传的固件
 */
-
 void uploadFirmware(Webs *wp)
 {
     WebsKey         *s;
@@ -100,27 +99,27 @@ void uploadFirmware(Webs *wp)
         //Do nothing
     }
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
+
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
-    // websDone(wp);
+    websDone(wp);
+    printf("cJSON:\n%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
     if(root)
         cJSON_Delete(root);
-    
-    websDone(wp);
 }
 
 /*
@@ -130,7 +129,6 @@ void uploadFirmware(Webs *wp)
 void updateFlash(Webs *wp)
 {
     printf("Update Firmware: Update Flash...\n");
-    //TODO: 
     uint8_t cmd[50] = {0};
     progress = 0;
 
@@ -147,28 +145,28 @@ void updateFlash(Webs *wp)
         //Do nothing
     }
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
+
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-//    printf("---> cJSON Str:\n%s\n", pStr);
-   
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
-    // websDone(wp);
+    websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
     if(root)
         cJSON_Delete(root);
     
-    websDone(wp);
     printf("Update Firmware: Update Flash ok.\n");
 }
 
@@ -209,21 +207,20 @@ void getUpdateProgress(Webs *wp)
         sprintf(progressStr, "100");
     }
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON_AddStringToObject(root, "progress", progressStr);
     cJSON_AddNumberToObject(root, "code", 200);
     
-
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
-    //websWriteHeader(wp, "getUpdateProgress");
     websWriteEndHeaders(wp);
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
     
     if(pStr)
         wfree(pStr);
@@ -272,21 +269,20 @@ void getVerifyStatus(Webs *wp)
     }
 
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON_AddStringToObject(root, "verify", verigyStr);
     cJSON_AddNumberToObject(root, "code", 200);
     
-
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
-    //websWriteHeader(wp, "getUpdateProgress");
     websWriteEndHeaders(wp);
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -303,11 +299,12 @@ void resetBmc(Webs *wp)
     ((0x3<<30) | (__MAJOR__<<16) | (__MAGIC__<<8) | __CMD__)
 #define RESET_MCU                       GENERATE_CMD(IOCTL_MAGIC, MAJOR_PLATFORM, 2)
 
-    printf("Update Firmware: Reset BMC...\n");
+    
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
     websDone(wp);
+    printf("Update Firmware: Reset BMC...\n");
 
 //    wp->index = TEST_INDEX;
     target_addr = gIPMBAddr[wp->index];

+ 44 - 30
app/goahead-3.6.5/src/web_interface/src/remote_control.c

@@ -27,8 +27,12 @@ void chassisPwrCtrl(Webs *wp){
 	char cmd = -1;
 	char *pwrAction = NULL;
 	int ret;
+    uint8_t target_addr;
+    uint16_t wRet;
 	pwrAction = websGetVar(wp, "pwrAction", NULL);
 
+    //wp->index = 1;
+
 	if(strcmp(pwrAction, "on") == 0)
 		cmd = 1;
 	else if(strcmp(pwrAction, "off") == 0)
@@ -42,9 +46,9 @@ void chassisPwrCtrl(Webs *wp){
 	else if(strcmp(pwrAction, "soft") == 0)
 		cmd = 5;
 
-	printf("Get pwrAction: %s, cmd: %d\n", pwrAction, cmd);
+//	printf("Get pwrAction: %s, cmd: %d\n", pwrAction, cmd);
 
-	char *pStr;
+	
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
@@ -56,10 +60,22 @@ void chassisPwrCtrl(Webs *wp){
 	{
 		//Create session
 	    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-	    IPMICMD_ChassisControl( &UDSSession, DEFAULT_TIMEOUT, cmd);
+        target_addr = gIPMBAddr[wp->index];
+        if(target_addr == 0x20)
+        {
+	       wRet = IPMICMD_ChassisControl( &UDSSession, DEFAULT_TIMEOUT, cmd);
+        }
+        else
+        {
+            wRet = IPMC_ChassisControl( &UDSSession, target_addr, DEFAULT_TIMEOUT, cmd);
+        }
 	    //Close session
 	    LIBIPMI_CloseSession(&UDSSession );
-	    cJSON_AddStringToObject(data, "status", "success");
+
+        if(wRet != 0)
+            cJSON_AddStringToObject(data, "status", "fail");
+        else    
+	       cJSON_AddStringToObject(data, "status", "success");
 	}
 	else
 	{
@@ -67,22 +83,16 @@ void chassisPwrCtrl(Webs *wp){
 		cJSON_AddStringToObject(data, "status", "fail");
 	}
 
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str: %d\n%s\n", strlen(pStr), pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
-    ret = websWrite(wp, "%s", pStr);
-    if(ret < 0)
-    	printf("websWrite error\n");
-    
-    ret = websFlush(wp, 1);	//wait for all data to be written to the socket 
-  	printf("websFlush ret = %d\n", ret);
+    websWrite(wp, "%s", pStr);
+    websFlush(wp, 0);	
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
-    // if(pwrAction)
-    // 	wfree(pwrAction);
     if(pStr)
         wfree(pStr);
     if(root)
@@ -95,15 +105,26 @@ void getChassisStatus(Webs *wp)
 {
 	chassis_status_T chassisSta;
 	IPMI20_UDS_SESSION_T    UDSSession;
-	int ret;
+    uint8_t target_addr;
+    uint16_t wRet;
+
+    //wp->index = 1;
 
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-    LIBIPMI_HL_GetChassisStatus(&UDSSession, DEFAULT_TIMEOUT, &chassisSta);
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
+    {
+        wRet = LIBIPMI_HL_GetChassisStatus(&UDSSession, DEFAULT_TIMEOUT, &chassisSta);
+    }
+    else
+    {
+        wRet = IPMC_GetChassisStatus(&UDSSession, target_addr, DEFAULT_TIMEOUT, &chassisSta);
+    }
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
@@ -118,22 +139,15 @@ void getChassisStatus(Webs *wp)
     	cJSON_AddStringToObject(data, "powerStatus", "on" );	
     }
 
-    pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str: %d \n%s\n", strlen(pStr), pStr);
+    char *pStr;
+    pStr = cJSON_PrintUnformatted(root); 
     websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);	//Set length to -1 if unknown and transfer-chunk-encoding will be employed.
+    websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
-
-    ret = websWrite(wp, "%s", pStr);
-    if(ret < 0)
-    	printf("websWrite error\n");
-    
-    ret = websFlush(wp, 1);	//wait for all data to be written to the socket 
-    if(ret != 1)
-    	printf("websFlush error, ret = %d\n", ret);
-    
+    websWrite(wp, "%s", pStr);
+    websFlush(wp, 0);	
     websDone(wp);
+    printf("cJSON:%s\n",pStr);
 
     if(pStr)
         wfree(pStr);

+ 18 - 19
app/goahead-3.6.5/src/web_interface/src/sel.c

@@ -57,7 +57,7 @@ void Web_ClearSEL(Webs *wp)
     websWrite(wp, "%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -137,7 +137,7 @@ void GetAllSELEntriesSorted(Webs *wp)
             websWrite(wp, pStr);
             websFlush(wp, 0);
             websDone(wp);
-            printf("---> pStr %d: %s\n", strlen(pStr), pStr);
+            printf("cJSON:%s\n", pStr);
             
             if(root)
                 cJSON_Delete(root);
@@ -187,17 +187,17 @@ void GetAllSELEntriesSorted(Webs *wp)
                 {
                     break;
                 }
-                // cJSON_AddNumberToObject(pJsonsub, "1", SELEventData.hdr.ID);
-                // cJSON_AddNumberToObject(pJsonsub, "2", SELEventData.hdr.Type);
-                // cJSON_AddNumberToObject(pJsonsub, "3", SELEventData.hdr.TimeStamp);
-                // cJSON_AddNumberToObject(pJsonsub, "4", SELEventData.GenID[0]);
-                // cJSON_AddNumberToObject(pJsonsub, "5", SELEventData.GenID[1]);
-                // cJSON_AddNumberToObject(pJsonsub, "6", SELEventData.EvMRev);
-                // cJSON_AddNumberToObject(pJsonsub, "7", SELEventData.SensorType);
-                // cJSON_AddNumberToObject(pJsonsub, "8", SELEventData.EvtDirType);
-                // cJSON_AddNumberToObject(pJsonsub, "9", SELEventData.EvtData1);
-                // cJSON_AddNumberToObject(pJsonsub, "a", SELEventData.EvtData2);
-                // cJSON_AddNumberToObject(pJsonsub, "b", SELEventData.EvtData3);
+                // cJSON_AddNumberToObject(pJsonsub, "D1", SELEventData.hdr.ID);
+                // cJSON_AddNumberToObject(pJsonsub, "D2", SELEventData.hdr.Type);
+                // cJSON_AddNumberToObject(pJsonsub, "D3", SELEventData.hdr.TimeStamp);
+                // cJSON_AddNumberToObject(pJsonsub, "D4", SELEventData.GenID[0]);
+                // cJSON_AddNumberToObject(pJsonsub, "D5", SELEventData.GenID[1]);
+                // cJSON_AddNumberToObject(pJsonsub, "D6", SELEventData.EvMRev);
+                // cJSON_AddNumberToObject(pJsonsub, "D7", SELEventData.SensorType);
+                // cJSON_AddNumberToObject(pJsonsub, "D8", SELEventData.EvtDirType);
+                // cJSON_AddNumberToObject(pJsonsub, "D9", SELEventData.EvtData1);
+                // cJSON_AddNumberToObject(pJsonsub, "D10", SELEventData.EvtData2);
+                // cJSON_AddNumberToObject(pJsonsub, "D11", SELEventData.EvtData3);
 
                 cJSON_AddNumberToObject(pJsonsub, "RecordID", SELEventData.hdr.ID);
                 cJSON_AddNumberToObject(pJsonsub, "RecordType", SELEventData.hdr.Type);
@@ -282,7 +282,7 @@ void GetAllSELEntriesSorted(Webs *wp)
     websWrite(wp, pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> pStr %d: %s\n", strlen(pStr), pStr);
+    printf("cJSON:%s\n",pStr);
     
     if(root)
         cJSON_Delete(root);
@@ -363,23 +363,22 @@ void SetTime(Webs *wp)
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
     
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
 
-  
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -453,7 +452,7 @@ void GetTime(Webs *wp)
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
-    printf("---> cJSON Str:\n%s\n", pStr);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 110 - 39
app/goahead-3.6.5/src/web_interface/src/server_health.c

@@ -31,9 +31,10 @@ void setThreshold(Webs *wp){
     float LC = atof(strLC);
     float LNR = atof(strLNR);
     int   SensorNumber = atoi(strSensorNumber);
+    uint8_t target_addr;
 
-    printf(" %s, %s %s %s, %s %s %s = %d, %f %f %f %f %f %f \n", strSensorNumber, strUNC, strUC, strUNR, strLNC, strLC, 
-    	strLNR,  SensorNumber, UNC, UC, UNR, LNC, LC, LNR );
+    // printf(" %s, %s %s %s, %s %s %s = %d, %f %f %f %f %f %f \n", strSensorNumber, strUNC, strUC, strUNR, strLNC, strLC, 
+    // 	strLNR,  SensorNumber, UNC, UC, UNR, LNC, LC, LNR );
 
     uint8_t  *data_buffer = (uint8_t*)walloc(255);
     FullSensorRec_T	*sdr_record = (FullSensorRec_T*) data_buffer;
@@ -63,7 +64,15 @@ void setThreshold(Webs *wp){
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    wRet = LIBIPMI_HL_GetSpecificSDR(&UDSSession, data_buffer, &data_buff_size, SensorNumber, DEFAULT_TIMEOUT);
+    target_addr = gIPMBAddr[wp->index];
+    if(target_addr == 0x20)
+    { 
+        wRet = LIBIPMI_HL_GetSpecificSDR(&UDSSession, data_buffer, &data_buff_size, SensorNumber, DEFAULT_TIMEOUT);
+    }
+    else
+    {
+        wRet = IPMC_GetSpecificSDR(&UDSSession, target_addr, data_buffer, &data_buff_size, SensorNumber, DEFAULT_TIMEOUT);   
+    }
     
     pReqSetSensorThreshold->SensorNum = SensorNumber;
     
@@ -76,34 +85,34 @@ void setThreshold(Webs *wp){
     pReqSetSensorThreshold->LowerCritical = sdr_convert_sensor_value_to_raw(sdr_record, LC);
     pReqSetSensorThreshold->LowerNonRecoverable = sdr_convert_sensor_value_to_raw(sdr_record, LNR);
     
-    // printf("---> Num %d, Name: %s, raw: %d, %d, %d, %d, %d, %d\n", 
-    // 	pReqSetSensorThreshold->SensorNum, sdr_record->IDStr,
-    // 	pReqSetSensorThreshold->UpperNonCritical, pReqSetSensorThreshold->UpperCritical, 
-    // 	pReqSetSensorThreshold->UpperNonRecoverable, pReqSetSensorThreshold->LowerNonCritical, 
-    // 	pReqSetSensorThreshold->LowerCritical, pReqSetSensorThreshold->LowerNonRecoverable);
-
-    wRet = IPMICMD_SetSensorThreshold( &UDSSession, pReqSetSensorThreshold, pResSetSensorThreshold, DEFAULT_TIMEOUT);
+    if(target_addr == 0x20)
+    {
+        wRet = IPMICMD_SetSensorThreshold( &UDSSession, pReqSetSensorThreshold, pResSetSensorThreshold, DEFAULT_TIMEOUT);
+    }
+    else
+    {
+        wRet = IPMC_SetSensorThreshold( &UDSSession, target_addr, pReqSetSensorThreshold, DEFAULT_TIMEOUT);   
+    }
 
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-	char *pStr;
+	
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
     
-   
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -124,15 +133,18 @@ void setThreshold(Webs *wp){
 void webGetSensorHistory(Webs *wp)
 {
     IPMI20_UDS_SESSION_T    UDSSession;
-    int i = 0,j=0;
-    int wRet = 0;
+    int         i = 0,j=0;
+    int         wRet = 0;
     sensor_history_st *pSensorHistory = (sensor_history_st *)walloc(sizeof(sensor_history_st));
-    char tmpBuf[10];
-    char * const historyBuf = walloc(5000);
-    char *strBuf = historyBuf;
-    uint8_t CARDE_INDEX = 0;
-    uint8_t IPMB_ADDR = 0;
-
+    char        tmpBuf[10];
+    char        *historyBuf = walloc(5000);
+    uint8_t     target_addr;
+    FullSensorRec_T *sdr_record = (FullSensorRec_T*) walloc(100);
+    uint32_t     sdr_buff_size = 0;
+    float       tmpValue;
+    uint8_t     Req[20];
+    uint8_t     Res[256];
+    uint32_t    dwResLen;
 
     char *strSensorNumber = websGetVar(wp, "SensorNumber", NULL);
     int   SensorNumber = atoi(strSensorNumber);
@@ -140,20 +152,87 @@ void webGetSensorHistory(Webs *wp)
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    wRet = LIBIPMI_HL_GetSensorHistory(&UDSSession, pSensorHistory, CARDE_INDEX, SensorNumber, IPMB_ADDR);
-    
-    if(wRet != 0){
-        printf("---> LIBIPMI_HL_GetSensorHistory error, return %#x\n", wRet);
-         websError(wp, 404, "Get Sensor History error!");
-        return ;
+    //wp->index = 1;
+    target_addr = gIPMBAddr[wp->index];
+    //get factors
+    if(target_addr == 0x20)
+    { 
+        wRet = LIBIPMI_HL_GetSpecificSDR( &UDSSession, (uint8_t*)sdr_record, &sdr_buff_size, SensorNumber, DEFAULT_TIMEOUT );
+    }
+    else
+    {
+        wRet = IPMC_GetSpecificSDR(&UDSSession, target_addr, (uint8_t*)sdr_record, &sdr_buff_size, SensorNumber, DEFAULT_TIMEOUT);   
     }
 
+    if(wRet != 0)
+    {
+        websError(wp, 404, "GetSpecificSDR error!");
+        wfree(pSensorHistory);
+        wfree(historyBuf);
+        wfree(sdr_record);
+        return;
+    }
+
+    pSensorHistory->sensor_num = SensorNumber;
+    strcpy(pSensorHistory->sensor_name, sdr_record->IDStr);
+    if(target_addr == 0x20)
+    {
+        wRet = IPMI_GetSensorHistory(&UDSSession, SensorNumber, (uint8_t*)historyBuf, DEFAULT_TIMEOUT);
+        if(wRet != 0)
+        {
+            websError(wp, 404, "IPMI_GetSensorHistory error!");
+            wfree(pSensorHistory);
+            wfree(historyBuf);
+            wfree(sdr_record);
+            return;
+        }
+        for(i=0;i<MAX_HISTORY_LEN;i++)
+        {
+            ipmi_convert_reading( (uint8_t*)sdr_record, (uint8_t)historyBuf[3+i], &tmpValue );   //remove ccode, returnlen_lsb/msb
+            pSensorHistory->sensor_history[i] = tmpValue;
+        }
+    }
+    else
+    {
+        //获取前240字节
+        wRet = IPMC_GetSensorHistory(&UDSSession, target_addr, SensorNumber, 0, 240, (uint8_t*)historyBuf, DEFAULT_TIMEOUT);
+        if(wRet != 0)
+        {
+            websError(wp, 404, "IPMC_GetSensorHistory error!");
+            wfree(pSensorHistory);
+            wfree(historyBuf);
+            wfree(sdr_record);
+            return;
+        }
+        for(i=0;i<240;i++)
+        {
+            ipmi_convert_reading( (uint8_t*)sdr_record, historyBuf[9+i], &tmpValue );   //remove ipmb header and ccode,returnlen_lsb/msb
+            pSensorHistory->sensor_history[i] = tmpValue;
+        }
+        //获取后240字节
+        wRet = IPMC_GetSensorHistory(&UDSSession, target_addr, SensorNumber, 240, 240, (uint8_t*)historyBuf, DEFAULT_TIMEOUT);
+        if(wRet != 0)
+        {
+            websError(wp, 404, "IPMC_GetSensorHistory error!");
+            wfree(pSensorHistory);
+            wfree(historyBuf);
+            wfree(sdr_record);
+            return;
+        }
+        for(i=0;i<240;i++)
+        {
+            ipmi_convert_reading( (uint8_t*)sdr_record, historyBuf[9+i], &tmpValue );   //remove ipmb header and ccode,returnlen_lsb/msb
+            pSensorHistory->sensor_history[240+i] = tmpValue;
+        }
+    }
+    
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
     
+    char *strBuf = historyBuf;
     for(i=0;i<HISTORY_DATA_SIZE;i++)
     {
-        sprintf(tmpBuf, "%0.3f", pSensorHistory->sensor_history[i]);
+        sprintf(tmpBuf, "%0.2f", pSensorHistory->sensor_history[i]);
         j = 0;
         while(tmpBuf[j] != '\0')
         {
@@ -169,38 +248,30 @@ void webGetSensorHistory(Webs *wp)
     strBuf--;
     *strBuf = '\0';
 
-//    printf("---> strBuf: %s\n", strBuf);
-
-    char *pStr;
     cJSON * root =  cJSON_CreateObject();
-
     cJSON_AddNumberToObject(root, "SensorNum", pSensorHistory->sensor_num);
     cJSON_AddStringToObject(root, "SensorName", pSensorHistory->sensor_name);
     cJSON_AddStringToObject(root, "history", historyBuf);
     
-   
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp, pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
     if(root)
         cJSON_Delete(root);
 
-
     if(historyBuf)
         wfree(historyBuf);
     if(pSensorHistory)
         wfree(pSensorHistory);
-
-
 }
 
 

+ 17 - 41
app/goahead-3.6.5/src/web_interface/src/user.c

@@ -33,8 +33,6 @@ PUBLIC bool websVerifyPasswordFromBMC(Webs *wp)
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    gChassisManageEn = 1;
-
     return success;
 }
 
@@ -51,8 +49,6 @@ void getAllUserInfo(Webs *wp){
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
-    int code = 200;
     cJSON * root =  cJSON_CreateObject();
     cJSON  *pJsonArry,*pJsonsub;
     pJsonArry=cJSON_CreateArray();   /*创建数组*/
@@ -63,20 +59,19 @@ void getAllUserInfo(Webs *wp){
     		cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject());
     		cJSON_AddNumberToObject(pJsonsub, "userid", userInfoTbl[i].UserId); 
     		cJSON_AddStringToObject(pJsonsub, "username", userInfoTbl[i].UserName); 
-   
     	}
     }
-
     cJSON_AddItemToObject(root, "data", pJsonArry);
-    pStr = cJSON_PrintUnformatted(root);
 
-//    printf("---> cJSON Str:\n%s\n", pStr);
+    char *pStr;
+    pStr = cJSON_PrintUnformatted(root);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -93,22 +88,8 @@ void setUserPassword(Webs *wp){
     char *useridstr = websGetVar(wp, "userid", NULL);
     uint8_t userid = atoi(useridstr);
 
-    // printf("---> setUserPassword, userid: %d, username: %s,  password: %s\n",
-    // 	userid, username, password);
-    //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    // //verify old password
-    // if(LIBIPMI_AuthorVerify(&UDSSession, username, oldpassword, DEFAULT_TIMEOUT) != TRUE)
-    // {
-    // 	printf("Verify oldpassword error!\n" );
-    // 	//Close session
-    // 	LIBIPMI_CloseSession(&UDSSession );
-    // 	websError(wp, 404, "Verify oldpassword error!");
-    // 	return;
-    // }
-
-    //printf("Verify oldpassword success!\n" );
     //set new password
     if(0 != LIBIPMI_SetPassword(&UDSSession, userid, password, DEFAULT_TIMEOUT))
     {
@@ -118,28 +99,25 @@ void setUserPassword(Webs *wp){
     	websError(wp, 404, "Set user password fail!");    	
     	return;
     }
-    //printf("Set user password success!\n" );
   
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
     
-   
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
- //   printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -201,25 +179,21 @@ void addUser(Webs *wp){
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
-    // cJSON_AddNumberToObject(data, "userid", userid);
-    // cJSON_AddStringToObject(data, "username", username);
-    // cJSON_AddStringToObject(data, "password", password);
    
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -250,7 +224,6 @@ void delUser(Webs *wp){
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    char *pStr;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
@@ -258,15 +231,15 @@ void delUser(Webs *wp){
     cJSON_AddNumberToObject(root, "code", 200);
     cJSON_AddNumberToObject(data, "userid", userid);
    
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
-
-//    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -277,13 +250,15 @@ void delUser(Webs *wp){
 
 void checkLoginStatus(Webs *wp){
     char *loginStatus = (char*) websGetSessionVar(wp, "loginStatus", 0);
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
     cJSON_AddStringToObject(data, "loginStatus", loginStatus);
+
+    char *pStr;
     pStr = cJSON_PrintUnformatted(root);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
@@ -291,6 +266,7 @@ void checkLoginStatus(Webs *wp){
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);
@@ -301,23 +277,23 @@ void checkLoginStatus(Webs *wp){
 void logout(Webs *wp){
     websSetSessionVar(wp, "loginStatus", "failed");
     char *loginStatus = (char*) websGetSessionVar(wp, "loginStatus", 0);
-    char *pStr;
+    
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
     cJSON_AddStringToObject(data, "loginStatus", loginStatus);
-    printf("---> come Str:\n");
-    pStr = cJSON_PrintUnformatted(root);
 
-    printf("---> cJSON Str:\n%s\n", pStr);
+    char *pStr;
+    pStr = cJSON_PrintUnformatted(root);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWrite(wp,"%s", pStr);
     websFlush(wp, 0);
     websDone(wp);
+    printf("cJSON:%s\n", pStr);
 
     if(pStr)
         wfree(pStr);

+ 11 - 7
app/ipmitool-1.8.18/lib/ipmi_lanp.c

@@ -82,16 +82,20 @@ static void print_lan_usage(void);
 static int
 is_lan_channel(struct ipmi_intf * intf, uint8_t chan)
 {
-	uint8_t medium;
+	//uint8_t medium;
 
-	if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
-		return 0;
+	//jimbo modify, 固定死网络的通道号是1
+	printf("--->is_lan_channel %d\n", chan);
+	if(chan == 1)
+		return 1;
+	// if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX)
+	// 	return 0;
 
-	medium = ipmi_get_channel_medium(intf, chan);
+	// medium = ipmi_get_channel_medium(intf, chan);
 
-	if (medium == IPMI_CHANNEL_MEDIUM_LAN ||
-	    medium == IPMI_CHANNEL_MEDIUM_LAN_OTHER)
-		return 1;
+	// if (medium == IPMI_CHANNEL_MEDIUM_LAN ||
+	//     medium == IPMI_CHANNEL_MEDIUM_LAN_OTHER)
+	// 	return 1;
 
 	return 0;
 }