Ver Fonte

uds interface test pass

zhangbo há 5 anos atrás
pai
commit
01561e83a5

+ 10 - 9
app/bmc/Api.c

@@ -69,16 +69,16 @@ int PlatformInit(void)
 	uint8_t PrimaryIPMBBusNum, SecondaryIPMBBusNum;
 	printf("Init Platform...\r\n");
 
-	//hardware init
-	GPIO_InitTypeDef GPIO_InitStruct;
-	GPIO_InitStruct.Pin = GA0_PIN | GA1_PIN | GA2_PIN | GA3_PIN | GA4_PIN | RACKID2_PIN;
-	GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
-	GPIO_InitStruct.Pull = GPIO_NOPULL;
-	GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-	stm32_gpio_init(GPIOH, &GPIO_InitStruct);
+	// //hardware init
+	// GPIO_InitTypeDef GPIO_InitStruct;
+	// GPIO_InitStruct.Pin = GA0_PIN | GA1_PIN | GA2_PIN | GA3_PIN | GA4_PIN | RACKID2_PIN;
+	// GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+	// GPIO_InitStruct.Pull = GPIO_NOPULL;
+	// GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+	// stm32_gpio_init(GPIOH, &GPIO_InitStruct);
 
-	GPIO_InitStruct.Pin = GAP_PIN | RACKID1_PIN | RACKID3_PIN | RACKID4_PIN | RACKID5_PIN;
-	stm32_gpio_init(GPIOI, &GPIO_InitStruct);
+	// GPIO_InitStruct.Pin = GAP_PIN | RACKID1_PIN | RACKID3_PIN | RACKID4_PIN | RACKID5_PIN;
+	// stm32_gpio_init(GPIOI, &GPIO_InitStruct);
 
 
 
@@ -199,6 +199,7 @@ int Init_IPMI_FRU_SDR_SEL(void)
 		g_BMCInfo.IpmiConfig.LANIfcSupport			=	LAN_IFC_SUPPORT;
 		g_BMCInfo.IpmiConfig.SYSIfcSupport			=	SYS_IFC_SUPPORT;
 		g_BMCInfo.IpmiConfig.GrpExtnSupport 		= 	GROUP_EXTERN_SUPPORT;
+		g_BMCInfo.IpmiConfig.UDSIfcSupport			=	UDS_IFC_SUPPORT;
 		g_BMCInfo.IpmiConfig.ChassisTimerInterval	=	CHASSIS_TIMER_INTERVAL;	
 		g_BMCInfo.IpmiConfig.PowerCycleInterval		=	PWR_CYCLE_INTERVAL;
 		g_BMCInfo.IpmiConfig.FanControlInterval		=	FAN_CONTROL_INTERVAL;		

+ 1 - 0
app/bmc/BmcType.h

@@ -45,6 +45,7 @@ typedef struct
     uint8_t LANIfcSupport ;
     uint8_t SYSIfcSupport;
     uint8_t GrpExtnSupport ;
+    uint8_t UDSIfcSupport;
 
 	uint32_t FanControlInterval;
 

BIN
app/bmc/bmc_app


BIN
app/bmc/bmc_app.gdb


+ 1 - 0
app/bmc/main.h

@@ -28,6 +28,7 @@
 #define PRIMARY_IPMB_SUPPORT		1
 #define SECONDARY_IPMB_SUPPORT		1
 #define GROUP_EXTERN_SUPPORT		1
+#define UDS_IFC_SUPPORT				1
 
 #define SENSOR_NUMBERS				(11)
 #define FW_VERSION_MAJOR			(1)

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

@@ -145,16 +145,36 @@ void *MsgHndlrTask( void *pArg )
 		pthread_setspecific(g_tls.OwnerLUN,&reqMsgPkt.NetFnLUN);
 
 		ProcessIPMIReq(&reqMsgPkt, &resMsgPkt);
-		
 		//update checksum2
 		resMsgPkt.Data[resMsgPkt.Size-1]	=	CalculateCheckSum2(resMsgPkt.Data, resMsgPkt.Size-1);
+		if(g_BMCInfo.IpmiConfig.UDSIfcSupport == 0x01 && (reqMsgPkt.SrcQ == gFdUdsRes))
+		{
+			if (resMsgPkt.Size == sizeof(IPMIUDSMsg_T) && (NORMAL_RESPONSE == resMsgPkt.Param) )
+			{
+				continue;
+			}
+			resMsgPkt.Size = resMsgPkt.Size+1;
+			SwapUDSIPMIMsg(&reqMsgPkt,&resMsgPkt);
+			resMsgPkt.Data[resMsgPkt.Size] = 0;
+		}
+		if(SYS_IFC_CHANNEL == reqMsgPkt.Channel)
+		{  
+			/* Skip current request if no response from Command Handler */
+			if (!resMsgPkt.Size && (NO_RESPONSE == resMsgPkt.Param) )
+			{
+				continue;
+			}
+			
+			resMsgPkt.SessionID = reqMsgPkt.SessionID;
+		}
+		printf("Mtx: ");
+		for(i=0;i<resMsgPkt.Size;i++)
+			printf("%#x ", resMsgPkt.Data[i]);
+		printf("\n");
 		
 		//send response pkt to source queue.
 		PostMsg(resMsgPkt.SrcQ, &resMsgPkt);
-		printf("Mtx: ");
-		for(i=0;i<reqMsgPkt.Size;i++)
-			printf("%#x ", reqMsgPkt.Data[i]);
-		printf("\n");
+		
 	}
 }
 
@@ -184,11 +204,23 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	/* Normal IPMI Command response */
 	pRes->Param 	= 	PARAM_NORMAL_RESPONSE;
 	
-	HdrOffset = sizeof (IPMIMsgHdr_T);
-	pReq->Size  = pReq->Size - HdrOffset - 1;
+	if ((SYS_IFC_CHANNEL != pReq->Channel) && (USB_CHANNEL != pReq->Channel) && (pReq->SrcQ != gFdUdsRes))
+	{
+		printf("log 1, pReq->Channel: %#x\n", pReq->Channel);
+		HdrOffset = sizeof (IPMIMsgHdr_T);
+		pReq->Size  = pReq->Size - HdrOffset - 1;
+	}
+	if(pReq->SrcQ == gFdUdsRes)
+	{
+		printf("log 2, pReq->Channel: %#x\n", pReq->Channel);
+		HdrOffset = sizeof(IPMIUDSMsg_T);
+		pReq->Size = pReq->Size -HdrOffset - 1;
+	}
 	
 	SwapIPMIMsgHdr((IPMIMsgHdr_T*)pReq->Data, (IPMIMsgHdr_T*)pRes->Data);
-	pRes->Size  = HdrOffset;
+	pRes->Size  = HdrOffset + sizeof(uint8_t);
+
+	pthread_setspecific(g_tls.CurSessionID,&pReq->SessionID);
 
 	if(IsCommandEnabled(NET_FN(pReq->NetFnLUN), &pReq->Data[HdrOffset], pReq->Cmd) != 0)
 	{
@@ -232,6 +264,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		{
 			pRes->Data [HdrOffset] = CC_INV_CMD;
 			pRes->Size	+= 2;
+			printf("log 3\n");
 			return;
 		}
    }
@@ -261,6 +294,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	//send message command
 	if( (CMD_SEND_MSG == pReq->Cmd) && (NETFN_APP == pReq->NetFnLUN >> 2))
 	{
+		printf("log 4\n");
 		int Offset = 0;
 		uint8_t SeqNum = g_BMCInfo.SendMsgSeqNum;
 		if ((0 == pRes->Size) &&
@@ -294,6 +328,8 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 			}
 		}
 	}
+
+	printf("log 5\n");
 	
 	return;
 }
@@ -741,3 +777,37 @@ SwapIPMIMsgHdr (IPMIMsgHdr_T* pIPMIMsgReq, IPMIMsgHdr_T* pIPMIMsgRes)
 }
 
 
+
+/**
+ * *@fn Swap UDSIPMIMsg
+ * *@brief Swaps the header and copies into response
+ * *@param pIPMIMsgReq Header of the Request
+ * *@param pIPMIMsgRes Header of the response
+ * *@return none
+ * */
+void
+SwapUDSIPMIMsg ( MsgPkt_T* pIPMIMsgReq,  MsgPkt_T* pIPMIMsgRes)
+{
+	IPMIUDSMsg_T *pIPMIUDSMsgRes = (IPMIUDSMsg_T *)&pIPMIMsgRes->Data[0];
+	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;
+}

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

@@ -28,7 +28,11 @@ int  SMMExample_0h(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 {
 	*pRes= CC_NORMAL;
 	printf("SMMExample_0h\n" );
-	return 	1;
+	pRes[1] = 1;
+	pRes[2] = 2;
+	pRes[3] = 3;
+	pRes[4] = 4;
+	return 	5;
 }
 
 int  SMMExample_1h(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)

+ 38 - 36
app/bmc/uds/UDSIfc.c

@@ -73,6 +73,8 @@ void *UDSIfcTask(void* pArg)
     MsgPkt_T Req;
     prctl(PR_SET_NAME,__FUNCTION__,0,0,0);
 
+    printf("UDSIfcTask start...\n");
+
     //create UDS_IFC_Q
     if(-1 != access(UDS_IFC_Q, F_OK))
     {
@@ -133,7 +135,7 @@ void *UDSIfcTask(void* pArg)
             printf("UDSIfc.c: Error Fetching Data from UDSIfcQ\n");
             continue;
         }
-        
+    
         ProcessUDSReq(&Req);
     }
 
@@ -208,6 +210,8 @@ void *RecvUDSPkt(void *pArg)
     int curThreadIndex = 0;
     fd_set  fds;
 
+    printf("RecvUDSPkt start...\n");
+
     memset(&local,0,sizeof(local));
 
     locallen=sizeof(local);
@@ -289,11 +293,11 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
             return UDS_FAILURE;
         }
         
-        int i;
-        printf("---> server recv1 %#x: ", Len);
-        for(i=0;i<Len;i++)
-            printf("%#x ", pData[RecvdLen+i]);
-        printf("\n");
+        // int i;
+        // printf("---> server recv1 %#x: ", Len);
+        // for(i=0;i<Len;i++)
+        //     printf("%#x ", pData[RecvdLen+i]);
+        // printf("\n");
 
         RecvdLen += Len;
     }
@@ -308,11 +312,11 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
             return UDS_FAILURE;
         }
 
-        int i;
-        printf("---> server recv2 %#x: ", Len);
-        for(i=0;i<Len;i++)
-            printf("%#x ", pData[RecvdLen+i]);
-        printf("\n");
+        // int i;
+        // printf("---> server recv2 %#x: ", Len);
+        // for(i=0;i<Len;i++)
+        //     printf("%#x ", pData[RecvdLen+i]);
+        // printf("\n");
 
         RecvdLen += Len;
         RemLen -= Len;
@@ -324,10 +328,10 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
     MsgPkt->Privilege   = pIPMIUDSMsg->Privilege;
     MsgPkt->Socket      = Socket;
     MsgPkt->Size        = RecvdLen;
- //   MsgPkt->Param = UDS_SMB_PARAM;
-    MsgPkt->Channel = pIPMIUDSMsg->ChannelNum;
- //   MsgPkt->SessionType = UDS_SESSION_TYPE;
-    strcpy ((char *)MsgPkt->SrcQ, UDS_RES_Q);
+    MsgPkt->Param       = PARAM_IFC;
+    MsgPkt->Channel     = pIPMIUDSMsg->ChannelNum;
+    MsgPkt->SessionType = UDS_SESSION_TYPE;
+    MsgPkt->SrcQ = gFdUdsRes;
 
     return UDS_SUCCESS;
 }
@@ -358,35 +362,33 @@ static int ProcessUDSReq(MsgPkt_T *pReq )
     // }
     // else if((pReq->SessionID == 0) && CheckReservedCmd(pReq->Cmd))
     // {
-    //     FillUDSResponsePacket(pReq,&pRes,CC_INV_DATA_FIELD,BMCInst);
+    //     FillUDSResponsePacket(pReq,&pRes,CC_INV_DATA_FIELD);
     //     SendUDSPkt(&pRes,BMCInst);
     //     return UDS_FAILURE;
     // }
 
-    // /*Posting the request to Msg Handler for processing the command */
-    // if (UDS_SUCCESS != PostMsg (pReq, MSG_HNDLR_Q, BMCInst))
-    // {
-    //     IPMI_ASSERT (FALSE);
-    //     return UDS_FAILURE;
-    // }
+    /*Posting the request to Msg Handler for processing the command */
+    if (UDS_SUCCESS != PostMsg (gFd_MsgHndlrIfc, pReq))
+    {
+        return UDS_FAILURE;
+    }
 
-    // /* Get the response from the Message handler Task */
-    // memset(&pRes,0,sizeof(MsgPkt_T));
-    // if (UDS_SUCCESS != GetMsg (&pRes, UDS_RES_Q, WAIT_INFINITE, BMCInst))
-    // {
-    //     IPMI_ASSERT (FALSE);
-    //     return UDS_FAILURE;
-    // }
+    /* Get the response from the Message handler Task */
+    memset(&pRes,0,sizeof(MsgPkt_T));
+    if (UDS_SUCCESS != GetMsg (gFdUdsRes, &pRes, WAIT_INFINITE))
+    {
+        return UDS_FAILURE;
+    }
 
     // if(!CheckReservedCmd(pRes.Cmd) && (pRes.SessionID == 0) && (pRes.Cmd != ReservedCmd[1]))
     // {
     //     RetVal = AddUDSInfo(pReq,&pRes,BMCInst);
     // }
 
-    FillUDSResponsePacket(pReq,&pRes,CC_NORMAL);
+    //FillUDSResponsePacket(pReq,&pRes,CC_NORMAL);
 
     /* Sending the Packet to the corresponding client*/
-    //if((UDS_SUCCESS == RetVal) || (UDS_FAILURE == RetVal))
+    if((UDS_SUCCESS == RetVal) || (UDS_FAILURE == RetVal))
     {
         SendUDSPkt(&pRes);
     }
@@ -401,11 +403,11 @@ static int ProcessUDSReq(MsgPkt_T *pReq )
 **/
 int SendUDSPkt (MsgPkt_T *pRes)
 {
-    int i;
-    printf("---> server Send %#x: ", pRes->Size);
-    for(i=0;i<pRes->Size;i++)
-        printf("%#x ", pRes->Data[i]);
-    printf("\n");
+    // int i;
+    // printf("---> server Send %#x: ", pRes->Size);
+    // for(i=0;i<pRes->Size;i++)
+    //     printf("%#x ", pRes->Data[i]);
+    // printf("\n");
     /* Send the UDS response packet */
      if(UDS_FAILURE == send(pRes->Socket,pRes->Data,pRes->Size,MSG_NOSIGNAL))
      {

+ 14 - 6
app/common_include/com_IPMIDefs.h

@@ -126,16 +126,24 @@
  * Parameters
  *----------------------------------------------*/
 
+#define PARAM_IFC               0x01
+#define LAN_SMB_REQUEST         0x01
+#define UDS_SMB_PARAM 			0x01
+
 #define PARAM_REQUEST           0x03
-#define PARAM_BRIDGE            0x04
-#define PARAM_NO_RESPONSE       0x05
-#define PARAM_NORMAL_RESPONSE   0x06
-#define PARAM_IFC               0x06
 #define PARAM_CHASSIS           0x07
-#define PARAM_LAN_SMB_REQUEST   0x08
 #define PARAM_MC                0x09
+
+#define PARAM_NO_RESPONSE       0x10
+#define PARAM_NORMAL_RESPONSE   0x11
+#define PARAM_BRIDGE            0x12
 #define BRIDGING_REQUEST        PARAM_BRIDGE
-#define LAN_SMB_REQUEST         0x01
+
+
+
+
+
+
 
 /*----------------------------------------------
  * Session type

+ 1 - 1
app/goahead-5.1.0/build/linux-arm-static/.makeflags

@@ -1 +1 @@
- --no-print-directory -s
+s --no-print-directory

BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libmbedtls.a


+ 4 - 0
app/goahead-5.1.0/build/linux-arm-static/inc/goahead.h

@@ -17,6 +17,7 @@
 
 #include    "me.h"
 #include    "osdep.h"
+#include    "libipmi_struct.h"
 
 /************************************ Defaults ********************************/
 
@@ -1991,6 +1992,8 @@ typedef struct Webs {
     char            *uploadVar;         /**< Current upload form variable name */
 #endif
     void            *ssl;               /**< SSL context */
+
+    IPMI20_SESSION_T    ipmi_session;
 } Webs;
 
 #if ME_GOAHEAD_LEGACY
@@ -4178,6 +4181,7 @@ PUBLIC void personInfoAction(Webs *wp);
 #endif
 
 
+void getDeviceInfo(Webs *wp);
 
 #ifdef __cplusplus
 }

+ 16 - 2
app/goahead-5.1.0/projects/goahead-linux-static.mk

@@ -140,7 +140,10 @@ clean:
 	rm -f "$(BUILD)/bin/libgo.a"
 	rm -f "$(BUILD)/bin/libgoahead-mbedtls.a"
 	rm -f "$(BUILD)/bin/libmbedtls.a"
-
+#jimbo	
+	rm -f "$(BUILD)/bin/libipmi_session.o"
+	rm -f "$(BUILD)/bin/libipmi_uds_session.o"
+	rm -f "$(BUILD)/bin/libipmi_IPM.o"
 clobber: clean
 	rm -fr ./$(BUILD)
 
@@ -294,6 +297,10 @@ $(BUILD)/obj/libipmi_uds_session.o: \
     src/libipmi/src/libipmi_uds_session.c $(DEPS_USER_C2)
 	@echo '   [Compile] $(BUILD)/obj/libipmi_uds_session.o'
 	$(CC) -c -o $(BUILD)/obj/libipmi_uds_session.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_uds_session.c
+$(BUILD)/obj/libipmi_IPM.o: \
+    src/libipmi/src/libipmi_IPM.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_IPM.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_IPM.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_IPM.c
 
 #
 #   LUSA, ResultUtils
@@ -649,12 +656,19 @@ DEPS_36 += $(BUILD)/obj/time.o
 DEPS_36 += $(BUILD)/obj/upload.o
 DEPS_36 += $(BUILD)/obj/libipmi_session.o
 DEPS_36 += $(BUILD)/obj/libipmi_uds_session.o
+DEPS_36 += $(BUILD)/obj/libipmi_IPM.o
 
 
 
 $(BUILD)/bin/libgo.a: $(DEPS_36)
 	@echo '      [Link] $(BUILD)/bin/libgo.a'
-	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" "$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" "$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" "$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" "$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" "$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" "$(BUILD)/obj/libipmi_uds_session.o" 
+	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" \
+		"$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" \
+		"$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" \
+		"$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" \
+		"$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" \
+		"$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" \
+		"$(BUILD)/obj/libipmi_uds_session.o" "$(BUILD)/obj/libipmi_IPM.o"
 
 #
 #   install-certs

+ 24 - 0
app/goahead-5.1.0/src/goahead.c

@@ -17,6 +17,10 @@
 /********************************* Includes ***********************************/
 
 #include    "goahead.h"
+#include    "libipmi_struct.h"
+#include    "com_IPMI_App.h"
+#include    "libipmi_IPM.h"
+#include    "com_IPMIDefs.h"
 
 /********************************* Defines ************************************/
 
@@ -100,6 +104,26 @@ MAIN(goahead, int argc, char **argv, char **envp)
     route = "route.txt";
     auth = "auth.txt";
 
+
+/********************* jimbo test code **************************/
+    Webs wp;
+    IPMI20_SESSION_T TestSession;
+    uint8_t resBuf[100];
+    uint32_t resLen;
+
+    LIBIPMI_CreateSession(&wp.ipmi_session, 10);
+
+    getDeviceInfo(&wp);
+    // LIBIPMI_Send_RAW_IPMI2_0_Command(&wp.ipmi_session,
+    //     0x2e<<2, 0x01,
+    //     NULL, 0,
+    //     resBuf, &resLen,
+    //         10);
+
+    LIBIPMI_CloseSession( &wp.ipmi_session );
+
+/********************* jimbo test end **************************/    
+
 	error("---> main enter, argc = %d\n", argc);
     for (argind = 1; argind < argc; argind++) {
         argp = argv[argind];

+ 4 - 0
app/goahead-5.1.0/src/goahead.h

@@ -17,6 +17,7 @@
 
 #include    "me.h"
 #include    "osdep.h"
+#include    "libipmi_struct.h"
 
 /************************************ Defaults ********************************/
 
@@ -1991,6 +1992,8 @@ typedef struct Webs {
     char            *uploadVar;         /**< Current upload form variable name */
 #endif
     void            *ssl;               /**< SSL context */
+
+    IPMI20_SESSION_T    ipmi_session;
 } Webs;
 
 #if ME_GOAHEAD_LEGACY
@@ -4178,6 +4181,7 @@ PUBLIC void personInfoAction(Webs *wp);
 #endif
 
 
+void getDeviceInfo(Webs *wp);
 
 #ifdef __cplusplus
 }

+ 1 - 0
app/goahead-5.1.0/src/libipmi/inc/libipmi_IPM.h

@@ -18,6 +18,7 @@
 
 /* command specific header files */
 #include "com_IPMI_IPM.h"
+#include "com_IPMI_App.h"
 
 #ifdef  __cplusplus
 extern "C" {

+ 3 - 3
app/goahead-5.1.0/src/libipmi/src/libipmi_IPM.c

@@ -41,7 +41,7 @@ uint16_t	IPMICMD_GetDeviceID( IPMI20_SESSION_T *pSession, GetDevIDRes_T	*pGetDev
 	uint16_t		wRet;
 
 	//dwResLen = sizeof(GetDevIDRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, 
 											DEFAULT_NET_FN_LUN, CMD_GET_DEV_ID,
 											Req, 0,
 											(uint8_t*)pGetDeviceID, &dwResLen,
@@ -60,11 +60,11 @@ uint16_t	IPMICMD_GetDeviceID( IPMI20_SESSION_T *pSession, GetDevIDRes_T	*pGetDev
 uint16_t	IPMICMD_GetDeviceGUID( IPMI20_SESSION_T *pSession, GetDevGUIDRes_T *pGetDeviceGUID, int timeout )
 {
 	uint8_t		Req [20];
-	uint32		dwResLen;
+	uint32_t		dwResLen;
 	uint16_t		wRet;
 
 	dwResLen = sizeof(GetDevGUIDRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, 
 											DEFAULT_NET_FN_LUN, CMD_GET_DEV_GUID,
 											Req, 0,
 											(uint8_t*)pGetDeviceGUID, &dwResLen,

+ 12 - 13
app/goahead-5.1.0/src/libipmi/src/libipmi_uds_session.c

@@ -135,7 +135,6 @@ uint32_t FillUDSMessagePacket(IPMI20_SESSION_T *pSession, uint8_t *Buffer,
 
     memcpy(pUDSMsg->UserName, pSession->hUDSSession->szUName, MAX_USER_NAME_LEN);
     memcpy(pUDSMsg->IPAddr, pSession->hUDSSession->abyIPAddr, IP6_ADDR_LEN);
-    printf("---> FillUDSMessagePacket log2\n");
     pUDSMsg->ProcessID = getpid();
     pUDSMsg->ThreadID = gettid();
     memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
@@ -208,11 +207,11 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
                 return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
             }
 
-            int i;
-            printf("---> client recv %#x: ", nBytesRecvd);
-            for(i=0;i<nBytesRecvd;i++)
-                printf("%#x ", szBuffer[totalrecvd+i]);
-            printf("\n");
+            // int i;
+            // printf("---> client recv %#x: ", nBytesRecvd);
+            // for(i=0;i<nBytesRecvd;i++)
+            //     printf("%#x ", szBuffer[totalrecvd+i]);
+            // printf("\n");
 
             totalrecvd += nBytesRecvd;
 
@@ -295,13 +294,13 @@ TCPSendUDSDataSelect:
             
             nBytesSent = send (UDSInfo->hSocket,szBuffer+nTotalBytesSent,dwsize, MSG_NOSIGNAL);
             
-            int i=0;
-            printf("---> client Send %#x: ",  nBytesSent);
-            for (i = 0; i < nBytesSent; ++i)
-            {
-                printf("%#x ", szBuffer[nTotalBytesSent+i]);
-            }
-            printf("\n");
+            // int i=0;
+            // printf("---> client Send %#x: ",  nBytesSent);
+            // for (i = 0; i < nBytesSent; ++i)
+            // {
+            //     printf("%#x ", szBuffer[nTotalBytesSent+i]);
+            // }
+            // printf("\n");
 
             /* send failure */
             if ((nBytesSent == SOCKET_ERROR) && ((EBADF == errno) || (EPIPE == errno)))

+ 5 - 2
app/goahead-5.1.0/src/route.c

@@ -15,6 +15,8 @@
 /********************************* Includes ***********************************/
 
 #include    "goahead.h"
+#include    "libipmi_IPM.h"
+#include    "com_IPMIDefs.h"
 
 /*********************************** Locals ***********************************/
 
@@ -84,7 +86,9 @@ void personInfoAction(Webs *wp)
 
 /*获取设备信息*/
 void getDeviceInfo(Webs *wp){
-
+    char DeviceID[16] = {0};
+    LIBIPMI_HL_GetDeviceID(&wp->ipmi_session, DeviceID, DEFAULT_TIMEOUT);
+    printf("DeviceID: %s\n", DeviceID);
 }
 
 
@@ -699,7 +703,6 @@ static bool redirectHandler(Webs *wp)
     return websRedirectByStatus(wp, 0) == 0;
 }
 
-
 #if ME_GOAHEAD_LEGACY
 PUBLIC int websUrlHandlerDefine(cchar *prefix, cchar *dir, int arg, WebsLegacyHandlerProc handler, int flags)
 {

BIN
gd32450i-eval.uImage


+ 14 - 13
local/rc

@@ -10,29 +10,30 @@ ifconfig lo 127.0.0.1
 
 ################### install module #####################
 #insmod /usr/bin/test_module.ko
-#insmod /usr/bin/gpio.ko 
-#insmod /usr/bin/i2c.ko
+insmod /usr/bin/gpio.ko 
+insmod /usr/bin/i2c.ko
 #insmod /usr/bin/fmc.ko
-#insmod /usr/bin/platform_STM32F429.ko
-#insmod /usr/bin/adc.ko
-#insmod /usr/bin/spi.ko
+insmod /usr/bin/platform_STM32F429.ko
+insmod /usr/bin/adc.ko
+insmod /usr/bin/spi.ko
 
 #################### create node ########################
 #mknod /dev/test_module c 99 0
-#mknod /dev/platform c 100 0
-#mknod /dev/i2c1 c 101 0
-#mknod /dev/i2c2 c 101 1
-#mknod /dev/i2c3 c 101 2
+mknod /dev/platform c 100 0
+mknod /dev/i2c1 c 101 0
+mknod /dev/i2c2 c 101 1
+mknod /dev/i2c3 c 101 2
 #mknod /dev/fmc_cpld c 102 0
-#mknod /dev/gpio c 103 0 
-#mknod /dev/adc1 c 105 0
+mknod /dev/gpio c 103 0 
+mknod /dev/adc1 c 105 0
 #mknod /dev/adc2 c 105 1
 #mknod /dev/adc3 c 105 2
-#mknod /dev/spi2 c 104 1
-#mknod /dev/spi5 c 104 4
+mknod /dev/spi2 c 104 1
+mknod /dev/spi5 c 104 4
 
 ################### run app ####################
 /bin/telnetd
 /usr/bin/bmc_app & 
+sleep 10
 #/usr/bin/test_app 
 /usr/bin/goahead -v --home /etc/goahead /var/www/goahead &