zhangbo пре 3 година
родитељ
комит
7ddb340117

+ 7 - 7
app/bmc/Api.c

@@ -866,13 +866,13 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
 	
     RetVal = GetMsg (fd_BridgeQue, pResPkt, 5000);  //3s
 
-    int i;
-    printf("Bridge recv: ");
-    for(i=0;i<pResPkt->Size;i++)
-    {
-    	printf("%#x ", pResPkt->Data[i]);
-    }
-    printf("\n");
+    // int i;
+    // printf("Bridge recv: ");
+    // for(i=0;i<pResPkt->Size;i++)
+    // {
+    // 	printf("%#x ", pResPkt->Data[i]);
+    // }
+    // printf("\n");
 
 	remove(BRIDGE_QUEUE);
 	pthread_mutex_unlock(&api_bridge_mutex);

+ 5 - 5
app/bmc/main.c

@@ -51,11 +51,11 @@ uint8_t 	gChassisIPMBAddr[BLADE_NUMBERS] = {0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C,
 SensorHistoryInfo_T 	gSensorHistoryInfo[SENSOR_NUMBERS];
 
 FanInfo_T	gFanInfo[FAN_NUMBERS] = {
-								// /* Index | name | mode | level | speed  */
-								// 	{0, {"Fan1"}, 0, 0, 0 },
-								// 	{1, {"Fan2"}, 0, 0, 0 },
-								// 	{2, {"Fan3"}, 0, 0, 0 },
-								// 	{3, {"Fan4"}, 0, 0, 0 },
+								 /* Index | name | mode | level | speed  */
+									{0, {"Fan1"}, 0, 0, 0 },
+									{1, {"Fan2"}, 0, 0, 0 },
+									{2, {"Fan3"}, 0, 0, 0 },
+									{3, {"Fan4"}, 0, 0, 0 },
 								};
 BladeStatus_T gBladeStatus[BLADE_NUMBERS] = {
 								/*  present | healthStatus | name | slotID | pwrStatus */

+ 6 - 8
app/bmc/msghndlr/MsgHndlrTask.c

@@ -165,6 +165,7 @@ void *MsgHndlrTask( void *pArg )
 
 		if(g_BMCInfo.IpmiConfig.UDSIfcSupport == 0x01 && (reqMsgPkt.SrcQ == gFdUdsRes))
 		{			
+			//TODO:UDS的数据结构在最后多了一个0,找机会要给他去掉。
 			resMsgPkt.Size = resMsgPkt.Size+1;
 			SwapUDSIPMIMsg(&reqMsgPkt,&resMsgPkt);
 			resMsgPkt.Data[resMsgPkt.Size-1] = 0;
@@ -928,7 +929,11 @@ SwapIPMIMsgHdr (IPMIMsgHdr_T* pIPMIMsgReq, IPMIMsgHdr_T* pIPMIMsgRes)
 	return;
 }
 
-
+/*
+	UDS data format, LSB first
+	uint32_t  + uint16_t   + uint8_t  + uint8_t + uint8_t    + uint8_t* + uint8_t  + uint8_t
+	SessionID + IPMIMsgLen + NetFnLUN + Cmd     + ChannelNum + Data[n]  + checksum +  0(多余的,想办法去掉)
+*/
 
 /**
  * *@fn Swap UDSIPMIMsg
@@ -944,22 +949,15 @@ SwapUDSIPMIMsg ( MsgPkt_T* pIPMIMsgReq,  MsgPkt_T* pIPMIMsgRes)
 	IPMIUDSMsg_T *pIPMIUDSMsgReq = (IPMIUDSMsg_T *)&pIPMIMsgReq->Data[0];
 
 	pIPMIMsgRes->NetFnLUN = pIPMIMsgReq->NetFnLUN;
-//	pIPMIMsgRes->Privilege = pIPMIMsgReq->Privilege;
 	pIPMIMsgRes->Cmd = pIPMIMsgReq->Cmd;
 	pIPMIMsgRes->Channel = pIPMIMsgReq->Channel;
 	pIPMIMsgRes->SessionID   = pIPMIMsgReq->SessionID;
 	pIPMIMsgRes->Socket = pIPMIMsgReq->Socket;
 
 	pIPMIUDSMsgRes->NetFnLUN = pIPMIMsgReq->NetFnLUN;
-//	pIPMIUDSMsgRes->Privilege = pIPMIMsgReq->Privilege;
 	pIPMIUDSMsgRes->Cmd = pIPMIMsgReq->Cmd;
 	pIPMIUDSMsgRes->ChannelNum = pIPMIMsgReq->Channel;
 	pIPMIUDSMsgRes->SessionID = pIPMIMsgReq->SessionID;
-	//pIPMIUDSMsgRes->AuthFlag = pIPMIUDSMsgReq->AuthFlag;
 	pIPMIUDSMsgRes->IPMIMsgLen = pIPMIMsgRes->Size;
-	
-//	strcpy( (char *)pIPMIUDSMsgRes->UserName, (char *)pIPMIUDSMsgReq->UserName);
-//	memcpy(pIPMIUDSMsgRes->IPAddr, pIPMIUDSMsgReq->IPAddr, 16);  
-
 	return;
 }

+ 40 - 33
app/bmc/msghndlr/Storlead/Storlead.c

@@ -77,7 +77,7 @@ int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 
 int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 {
-	printf("Storlead_GetSensorInfo\n" );
+//	printf("Storlead_GetSensorInfo\n" );
 
 	StorleadGetSensorInfoRes_T *pGetSensorInfoRes = (StorleadGetSensorInfoRes_T *)pRes;
     uint8_t*   		pValidSensor = NULL;
@@ -282,47 +282,48 @@ int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 
 int Storlead_GetSELEntires(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
-    AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq = (AMIGetSELEntriesReq_T *)pReq;
-    AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)pRes;
-    SELRepository_T *m_sel = NULL;
-    uint16_t NumRecords = 0;
+    // AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq = (AMIGetSELEntriesReq_T *)pReq;
+    // AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)pRes;
+    // SELRepository_T *m_sel = NULL;
+    // uint16_t NumRecords = 0;
 
     
-     m_sel = (SELRepository_T*)g_BMCInfo.pSEL;
-     NumRecords = m_sel->NumRecords;
+    //  m_sel = (SELRepository_T*)g_BMCInfo.pSEL;
+    //  NumRecords = m_sel->NumRecords;
 
-    if(((NumRecords - pAMIGetSelEntriesReq->Noofentretrieved) * sizeof(SELRec_T)) < MAX_FULL_SEL_ENTRIES)
-    {
-        pAMIGetSelEntiresRes->Status = FULL_SEL_ENTRIES;
-        pAMIGetSelEntiresRes->Noofentries = NumRecords - pAMIGetSelEntriesReq->Noofentretrieved;
-    }
-    else if(NumRecords == SEL_EMPTY_REPOSITORY)
-    {
-        pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_EMPTY_REPOSITORY;
-        return sizeof(*pRes);
-    }
-    else if (NumRecords < pAMIGetSelEntriesReq->Noofentretrieved)
-    {
-        pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_CLEARED;
-        return sizeof(*pRes);
-    }
-    else
-    {
-        pAMIGetSelEntiresRes->Status = PARTIAL_SEL_ENTRIES;
-        pAMIGetSelEntiresRes->Noofentries = ((MAX_FULL_SEL_ENTRIES - sizeof(AMIGetSELEntriesRes_T))/sizeof(SELRec_T));
-    }
+    // if(((NumRecords - pAMIGetSelEntriesReq->Noofentretrieved) * sizeof(SELRec_T)) < MAX_FULL_SEL_ENTRIES)
+    // {
+    //     pAMIGetSelEntiresRes->Status = FULL_SEL_ENTRIES;
+    //     pAMIGetSelEntiresRes->Noofentries = NumRecords - pAMIGetSelEntriesReq->Noofentretrieved;
+    // }
+    // else if(NumRecords == SEL_EMPTY_REPOSITORY)
+    // {
+    //     pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_EMPTY_REPOSITORY;
+    //     return sizeof(*pRes);
+    // }
+    // else if (NumRecords < pAMIGetSelEntriesReq->Noofentretrieved)
+    // {
+    //     pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_CLEARED;
+    //     return sizeof(*pRes);
+    // }
+    // else
+    // {
+    //     pAMIGetSelEntiresRes->Status = PARTIAL_SEL_ENTRIES;
+    //     pAMIGetSelEntiresRes->Noofentries = ((MAX_FULL_SEL_ENTRIES - sizeof(AMIGetSELEntriesRes_T))/sizeof(SELRec_T));
+    // }
 
 
    
-    memcpy((uint8_t*)(pAMIGetSelEntiresRes + 1),(uint8_t*)&m_sel->SELRecord[pAMIGetSelEntriesReq->Noofentretrieved],
-              sizeof(SELRec_T)*pAMIGetSelEntiresRes->Noofentries);
+    // memcpy((uint8_t*)(pAMIGetSelEntiresRes + 1),(uint8_t*)&m_sel->SELRecord[pAMIGetSelEntriesReq->Noofentretrieved],
+    //           sizeof(SELRec_T)*pAMIGetSelEntiresRes->Noofentries);
   
 
-    pAMIGetSelEntiresRes->LastRecID = m_sel->LastRecID;
+    // pAMIGetSelEntiresRes->LastRecID = m_sel->LastRecID;
 
-    pAMIGetSelEntiresRes->CompletionCode = CC_NORMAL;
+    // pAMIGetSelEntiresRes->CompletionCode = CC_NORMAL;
 
-    return sizeof(AMIGetSELEntriesRes_T) + (sizeof(SELRec_T) * pAMIGetSelEntiresRes->Noofentries);
+    // return sizeof(AMIGetSELEntriesRes_T) + (sizeof(SELRec_T) * pAMIGetSelEntiresRes->Noofentries);
+    return 1;
 }
 
 int Storlead_AuthorVerify(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
@@ -400,6 +401,12 @@ int Storlead_GetSensorHistory(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 int Storlead_GetFanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     *pRes = CC_NORMAL;
+    
+    //for test
+    int i;
+    for(i=0;i<FAN_NUMBERS;i++)
+        gFanInfo[i].speed++;
+
     memcpy(pRes+1, (uint8_t*)gFanInfo, FAN_NUMBERS*sizeof(FanInfo_T));
     return FAN_NUMBERS*sizeof(FanInfo_T) + 1;   
 }
@@ -665,7 +672,7 @@ int Storlead_GetBladeInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 }
 
 /*
-    Req[0] : sensor name
+    Req[0] : sensor number
 
 */
 int Storlead_GetSensorName(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)

+ 1 - 1
app/bmc/msghndlr/Storlead/Storlead.h

@@ -18,4 +18,4 @@ int Storlead_RestoreFactorSettings(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 int Storlead_GetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_GetBladeInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
-int Storlead_GetSensorName(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
+int Storlead_GetSensorName(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);

+ 1 - 1
app/bmc/uds/UDSIfc.c

@@ -378,7 +378,7 @@ static int ProcessUDSReq(MsgPkt_T *pReq )
     // int i;
     // printf("ProcessUDSReq Recv: ");
     // for(i=0;i<pRes.Size;i++)
-    //     printf("%#x ", pRes.Data[i]);
+    //     printf("%02x ", pRes.Data[i]);
     // printf("\n");
 
     /* Sending the Packet to the corresponding client*/

+ 1 - 1
app/common_include/com_BMCCfg.h

@@ -1,7 +1,7 @@
 #ifndef __COM_BMC_CFG_H__
 #define __COM_BMC_CFG_H__
 
-#define 	FAN_NUMBERS		0		//当前板卡有0个风扇。
+#define 	FAN_NUMBERS		4		//当前板卡有0个风扇。
 #define 	MAX_FAN_NUMS 	10		//该系统最多支持10个风扇
 #define 	BLADE_NUMBERS	10
 #define SENSOR_NUMBERS				(15)

+ 0 - 6
app/common_include/com_IPMIDefs.h

@@ -566,16 +566,10 @@ typedef struct
 typedef struct
 {
     uint32_t SessionID;
-//    uint8_t Privilege;
     uint16_t IPMIMsgLen;
     uint8_t NetFnLUN;
     uint8_t Cmd;
     uint8_t ChannelNum;
-//    uint8_t AuthFlag;
-//    uint8_t UserName[MAX_USERNAME_LEN];
-//    uint8_t IPAddr[IP6_ADDR_LEN];
-//    uint32_t ProcessID;
-//    uint32_t ThreadID;
 }IPMIUDSMsg_T;
 
 #pragma pack( )

+ 5 - 4
app/goahead-3.6.5/src/libipmi/src/libipmi_session.c

@@ -39,7 +39,7 @@ uint16_t LIBIPMI_CreateSession(IPMI20_UDS_SESSION_T *pUDSSession, int timeout)
     int client_sock;
     struct sockaddr_un client_addr;
 
-    printf("---> Create_IPMI20_UDS_Session\n");
+    
     
     /* Open the socket */
     client_sock = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -58,7 +58,7 @@ uint16_t LIBIPMI_CreateSession(IPMI20_UDS_SESSION_T *pUDSSession, int timeout)
     strcpy(client_addr.sun_path,UDS_SOCKET_PATH);
     int len = sizeof(client_addr.sun_family)+strlen(client_addr.sun_path);
 
-    printf("---> UDS_Connect, socket: %d, SocketPath: %s\n", client_sock, UDS_SOCKET_PATH);
+    printf("---> Create_IPMI20_UDS_Session %d\n", client_sock);
     if ( connect (client_sock, (struct sockaddr *) &client_addr,len) < 0)
     {
         printf("LIBIPMI_UDS_SESSION.C: Unable to connect to Server:\n");
@@ -198,8 +198,9 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
 
     if(byretval > 0)
     {
-        IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];        
-        *pdwResDataLen = pIPMIUDSMsg->IPMIMsgLen-sizeof(IPMIUDSMsg_T) - 1;
+        IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];   
+        //TODO:UDS的数据结构在最后多了一个0,找机会要给他去掉。     
+        *pdwResDataLen = pIPMIUDSMsg->IPMIMsgLen-sizeof(IPMIUDSMsg_T) - 2;  //remove header, 最后多出来的一个0,and checksum
         memcpy(pszResData,&pbyIPMIUDSResData[sizeof(IPMIUDSMsg_T)],*pdwResDataLen);
     }
     else

+ 3 - 1
app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c

@@ -258,13 +258,15 @@ int LIBIPMI_HL_GetFanInfo(IPMI20_UDS_SESSION_T *pUDSSession, FanInfo_T* pFanInfo
 							NULL,	0,
 							(uint8_t*)pRes,  &dwResLen,
 							timeout);
+
+	printf("dwResLen %d\n", dwResLen);
 	if(( wRet != 0 ) || (pRes[0] != 0))
 	{
 		printf("Error LIBIPMI_HL_GetFanInfo\n");
 		return -1;
 	}
 
-	memcpy((uint8_t*)pFanInfo, pRes+1, dwResLen-1);
+	memcpy((uint8_t*)pFanInfo, pRes+1, dwResLen-1);	//remove ccode 
 	return 0;
 }
 

+ 1 - 0
app/goahead-3.6.5/src/web_interface/src/fan.c

@@ -59,6 +59,7 @@ void getAllFanInfo(Webs *wp){
 
     for(i=0;i<MAX_FAN_NUMS;i++)
     {
+        printf("===> %d %s %d %d %d \n", fanInfo[i].index,fanInfo[i].name,fanInfo[i].mode,fanInfo[i].level,fanInfo[i].speed);
         if(fanInfo[i].index != 0xff)
         {
         	cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/