zhangbo 5 năm trước cách đây
mục cha
commit
3a942ba617
46 tập tin đã thay đổi với 1137 bổ sung1191 xóa
  1. 10 9
      app/bmc/Api.c
  2. BIN
      app/bmc/bmc_app
  3. 4 4
      app/bmc/main.c
  4. 122 283
      app/bmc/msghndlr/App/AppDevice/AppDevice.c
  5. 38 44
      app/bmc/msghndlr/MsgHndlrTask.c
  6. 1 0
      app/bmc/msghndlr/PDKCmds.c
  7. 7 3
      app/bmc/msghndlr/Storage/SDRDevice/SDR.c
  8. 4 4
      app/bmc/msghndlr/Storage/SELDevice/SEL.c
  9. 54 0
      app/bmc/msghndlr/Storlead/Storlead.c
  10. 2 1
      app/bmc/msghndlr/Storlead/Storlead.h
  11. 1 0
      app/bmc/msghndlr/cmdselect.c
  12. 3 3
      app/bmc/sensor_driver.c
  13. 12 12
      app/bmc/sensor_sdr.c
  14. 17 0
      app/common_include/com_BmcType.h
  15. 6 0
      app/common_include/com_IPMIDefs.h
  16. 1 0
      app/common_include/com_IPMI_Storlead.h
  17. 0 1
      app/driver/Platform/.platform_STM32F429.ko.cmd
  18. 0 296
      app/driver/Platform/.platform_STM32F429.mod.o.cmd
  19. 0 1
      app/driver/Platform/.platform_STM32F429.o.cmd
  20. BIN
      app/driver/Platform/platform_STM32F429.ko
  21. 0 21
      app/driver/Platform/platform_STM32F429.mod.c
  22. 2 0
      app/goahead-3.6.5/src/file.c
  23. 3 0
      app/goahead-3.6.5/src/goahead.c
  24. 1 1
      app/goahead-3.6.5/src/libipmi/inc/libipmi_StorDevice.h
  25. 135 130
      app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c
  26. 7 19
      app/goahead-3.6.5/src/libipmi/src/libipmi_sdr.c
  27. 169 1
      app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c
  28. 3 0
      app/goahead-3.6.5/src/web_interface/inc/sel.h
  29. 22 23
      app/goahead-3.6.5/src/web_interface/src/dashboard.c
  30. 175 0
      app/goahead-3.6.5/src/web_interface/src/sel.c
  31. 15 1
      app/ipmitool-1.8.18/Makefile
  32. 4 0
      app/ipmitool-1.8.18/include/ipmitool/ipmi.h
  33. BIN
      app/ipmitool-1.8.18/ipmitool
  34. 4 1
      app/ipmitool-1.8.18/jimbo note
  35. 20 20
      app/ipmitool-1.8.18/lib/hpm2.c
  36. 46 43
      app/ipmitool-1.8.18/lib/ipmi_main.c
  37. 6 6
      app/ipmitool-1.8.18/lib/ipmi_oem.c
  38. 18 134
      app/ipmitool-1.8.18/src/plugins/ipmi_intf.c
  39. 123 119
      app/ipmitool-1.8.18/src/plugins/lan/lan.c
  40. 1 1
      app/test_app/Makefile
  41. 57 0
      app/test_app/netspeed.c
  42. 28 1
      app/test_app/test.c
  43. BIN
      app/test_app/test_app
  44. 8 8
      gd32450i-eval.busybox
  45. 7 0
      gd32450i-eval.initramfs
  46. 1 1
      local/rc

+ 10 - 9
app/bmc/Api.c

@@ -40,11 +40,11 @@ int InitSdrConfig(void)
 	g_BMCInfo.SDRConfig.RepositoryInfo.OpSupport	=	0x23;
 	
 	//TODO:
-	g_BMCInfo.SDRConfig.RepositoryAllocInfo.NumAllocUnits	=	0;
-	g_BMCInfo.SDRConfig.RepositoryAllocInfo.AllocUnitSize	=	0;
-	g_BMCInfo.SDRConfig.RepositoryAllocInfo.NumFreeAllocUnits	=	0;
-	g_BMCInfo.SDRConfig.RepositoryAllocInfo.LargestFreeBlock	=	0;
-	g_BMCInfo.SDRConfig.RepositoryAllocInfo.MaxRecSize	=	0;
+	g_BMCInfo.SDRConfig.RepositoryAllocInfo.NumAllocUnits	=	MAX_SENSOR_NUMBERS+1;
+	g_BMCInfo.SDRConfig.RepositoryAllocInfo.AllocUnitSize	=	SDR_ALLOC_UNIT_SIZE;
+	g_BMCInfo.SDRConfig.RepositoryAllocInfo.NumFreeAllocUnits	=	MAX_SENSOR_NUMBERS - SENSOR_NUMBERS;
+	g_BMCInfo.SDRConfig.RepositoryAllocInfo.LargestFreeBlock	=	SDR_MAX_RECORD_SIZE;
+	g_BMCInfo.SDRConfig.RepositoryAllocInfo.MaxRecSize	=	SDR_MAX_RECORD_SIZE;	//Maximum record size in allocation units
 
 	return 0;
 }
@@ -414,22 +414,23 @@ int PDK_PowerOnChassis(void)
 
 int PDK_SoftOffChassis(void)
 {
-	printf("soft off chassis\n");;
+	printf("soft off chassis\n");
+	g_BMCInfo.PowerGoodFlag = 0;
 }
 
 int PDK_PowerCycleChassis(void)
 {
-	printf("power cycle chassis\n");;
+	printf("power cycle chassis\n");
 }
 
 int PDK_ResetChassis(void)
 {
-	printf("power reset chassis\n");;
+	printf("power reset chassis\n");
 }
 
 int PDK_DiagInterruptChassis(void)
 {
-	printf("power diag chassis\n");;
+	printf("power diag chassis\n");
 }
 
 int PDK_FanControl(void)

BIN
app/bmc/bmc_app


+ 4 - 4
app/bmc/main.c

@@ -97,10 +97,10 @@ void main(void)
         printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
     }
 
-//	/* Create IPMB interface */
-//	uint8_t primaryIpmbSelect = 0;	//primary
-//	gThreadIndex++;
-//	if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&primaryIpmbSelect))
+	// /* Create IPMB interface */
+	// uint8_t primaryIpmbSelect = 0;	//primary
+	// gThreadIndex++;
+	// if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&primaryIpmbSelect))
  //  {
  //      printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
  //  }

+ 122 - 283
app/bmc/msghndlr/App/AppDevice/AppDevice.c

@@ -830,6 +830,7 @@ SendMessage ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
    uint32_t *CurSesID;
    uint8_t *curprivlevel,*curchannel,*kcsifcnum;
 
+   *pRes = CC_NORMAL;
    if (ReqLen < 1)
    {
        *pRes = CC_REQ_INV_LEN;
@@ -857,99 +858,26 @@ SendMessage ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
    CurSesID = pthread_getspecific(g_tls.CurSessionID);       
    curchannel = pthread_getspecific(g_tls.CurChannel);       
    kcsifcnum = pthread_getspecific(g_tls.CurKCSIfcNum);       
+  
+    m_MsgPkt.Param    = BRIDGING_REQUEST;
+    m_MsgPkt.Channel  = Channel;
+    m_MsgPkt.Size     = ReqLen - 1; /* -1 to skip channel num */
+
+    /* Copy the message data */
+    memcpy (m_MsgPkt.Data, &pReq[1], m_MsgPkt.Size);
+    /* Copy the IPMI Message header */
+    pIPMIMsgHdr =  ( IPMIMsgHdr_T*)&m_MsgPkt.Data[Offset - 1];
+    if(ValidateIPMBChksum1(( uint8_t*)pIPMIMsgHdr) == FALSE)
+    {
+       *pRes = CC_INV_DATA_FIELD;
+       return  sizeof (*pRes);
+    }
 
-
-   // if(g_corefeatures.mbmc_single_nic == ENABLED
-   //     && g_corefeatures.ifc_specific_msg_handling != ENABLED)
-   // {
-   //     ResLen = 0;
-   //     g_MBMCInfo.sbmcinst = BMCInst;
-   //     memset((char *)&ResPkt,0,sizeof(MsgPkt_T));
-   //     pIPMIMsgHdr = (IPMIMsgHdr_T*)(&pBMCInfo->LANConfig.MsgReq.Data[sizeof (IPMIMsgHdr_T) + 1]);
-   //     m_MsgPkt.Param    = PARAM_IFC;
-   //     m_MsgPkt.Channel  = *curchannel;
-   //     m_MsgPkt.NetFnLUN = pIPMIMsgHdr->NetFnLUN;
-   //     m_MsgPkt.Cmd      = pIPMIMsgHdr->Cmd;
-   //     m_MsgPkt.Privilege =  PRIV_ADMIN;
-   //     m_MsgPkt.Size     = pBMCInfo->LANConfig.MsgReq.Size - sizeof (IPMIMsgHdr_T) - 2;
-   //     _fmemcpy (m_MsgPkt.Data, pIPMIMsgHdr, m_MsgPkt.Size);
-
-   //     if(g_PDKHandle[PDK_MBMCSINGLENICSENDMSG] != NULL)
-   //     {
-   //         tmpBMCInst = ( (int (*)(uint8_t,int) ) g_PDKHandle[PDK_MBMCSINGLENICSENDMSG]) ( m_MsgPkt.Data[0],BMCInst);
-   //     }
-
-   //     if(tmpBMCInst == 0)
-   //     {
-   //         resaddr = (m_MsgPkt.Data[0] - pBMCInfo->IpmiConfig.BMCSlaveAddr) >> 1;
-   //         if(0 <= resaddr && resaddr < BMCInstCount && (m_MsgPkt.Data[0] - pBMCInfo->IpmiConfig.BMCSlaveAddr)%2 == 0) 
-   //         {
-   //             tmpBMCInst = resaddr + 1;
-   //         }
-   //         else
-   //         {
-   //             *pRes = CC_INV_DATA_FIELD;
-   //             OS_THREAD_MUTEX_RELEASE(&pBMCInfo->BMCMsgMutex);
-   //             return sizeof(*pRes);
-   //         }
-   //     }
-
-   //     _fmemcpy(ResPkt.Data,pBMCInfo->LANConfig.MsgReq.Data,sizeof(IPMIMsgHdr_T));
-   //      ResPkt.Param = BRIDGING_REQUEST;
-   //      ResPkt.Cmd = pIPMIMsgHdr->Cmd;
-   //      ((IPMIMsgHdr_T *)ResPkt.Data)->NetFnLUN = ((pBMCInfo->LANConfig.MsgReq.NetFnLUN >> 2) +1) << 2;
-   //      ResPkt.Data [sizeof(IPMIMsgHdr_T)] = CC_NORMAL;
-   //      ResPkt.Size = sizeof (IPMIMsgHdr_T) + 1 + 1; // IPMI Header + Completion Code + Second Checksum
-   //      /* Calculate the Second CheckSum */
-   //      ResPkt.Data[ResPkt.Size - 1] = CalculateCheckSum2 (ResPkt.Data, ResPkt.Size-1);
-   //     if (0 != PostMsg (&ResPkt,LAN_RES_Q,BMCInst))
-   //     {
-   //         TDBG ("SendMsg: Failed to post message to interface queue\n");
-   //     }
-
-   //     pSessionInfo = getSessionInfo (SESSION_ID_INFO,CurSesID,BMCInst);
-   //     if (NULL != pSessionInfo)
-   //     {
-   //         g_MBMCInfo.SrcSessionHndl = pSessionInfo->SessionHandle;
-   //     }
-   //     else
-   //     {
-   //         *pRes = CC_UNSPECIFIED_ERR;
-   //         OS_THREAD_MUTEX_RELEASE(&pBMCInfo->BMCMsgMutex);
-   //         return sizeof(*pRes);
-   //     }
-       
-   //     memset(QueueName,0,sizeof(QueueName));
-   //     sprintf(QueueName,"%s%d",LAN_IFC_Q,BMCInst);
-   //     strcpy ((char *)m_MsgPkt.SrcQ,QueueName);
-
-   //     /* Post the message to Message Handler */
-   //     if (0 != PostMsg (&m_MsgPkt,MSG_HNDLR_Q,tmpBMCInst))
-   //     {
-   //         TDBG ("SendMsg: Failed to post message to interface queue\n");
-   //     }
-   // }
-   // else
-   {
-       m_MsgPkt.Param    = BRIDGING_REQUEST;
-       m_MsgPkt.Channel  = Channel;
-       m_MsgPkt.Size     = ReqLen - 1; /* -1 to skip channel num */
-
-       /* Copy the message data */
-       memcpy (m_MsgPkt.Data, &pReq[1], m_MsgPkt.Size);
-       /* Copy the IPMI Message header */
-       pIPMIMsgHdr =  ( IPMIMsgHdr_T*)&m_MsgPkt.Data[Offset - 1];
-       if(ValidateIPMBChksum1(( uint8_t*)pIPMIMsgHdr) == FALSE)
-       {
-           *pRes = CC_INV_DATA_FIELD;
-           return  sizeof (*pRes);
-       }
-
-      if(m_MsgPkt.Data[ReqLen - 2] != CalculateCheckSum2 (( uint8_t*)pIPMIMsgHdr, ReqLen - Offset - 1))
-      {
-           *pRes = CC_INV_DATA_FIELD;
-           return  sizeof (*pRes);
-      }
+    if(m_MsgPkt.Data[ReqLen - 2] != CalculateCheckSum2 (( uint8_t*)pIPMIMsgHdr, ReqLen - Offset - 1))
+    {
+       *pRes = CC_INV_DATA_FIELD;
+       return  sizeof (*pRes);
+    }
 
 #if 1
 	int z;
@@ -959,213 +887,124 @@ SendMessage ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
    	printf("\n");
 #endif
 
-      
-
-       // if(pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
-       // {
-       //     /* To Check the Wheather  Serial Channel */
-       //     if (pBMCInfo->SERIALch != CH_NOT_USED && (*curchannel  & 0xF) == pBMCInfo->SERIALch && pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
-       //     {
-       //          SessionInfo_T* pSessionInfo = getSessionInfo (SESSION_ID_INFO,CurSesID,BMCInst);
-
-       //         if (NULL != pSessionInfo)
-       //         {
-       //             SrcSessionHndl = pSessionInfo->SessionHandle;
-       //         }
-
-       //         TDBG ("SendMsg: To Serial Interface for reference\n");
-       //         // Offset++; : causes bridging issues
-       //         strcpy ((char *)m_MsgPkt.SrcQ, SERIAL_IFC_Q);
-       //     }
-       // }
-
-   		printf("curchannel: %d, Channel: %d\n", *curchannel, Channel);
-   		// if(g_BMCInfo.IpmiConfig.LANIfcSupport == 1)
-     //  {
-     //       /* To Check the Wheather  LAN Channel */
-     //       //if (IsLANChannel(*curchannel & 0xF, BMCInst))
-     //   		if(*curchannel&0xf == LAN_RMCP_CHANNEL)	//jimbo
-     //      {
-     //          SessionInfo_T* pSessionInfo = getSessionInfo (SESSION_ID_INFO,CurSesID);
-
-     //          if (NULL != pSessionInfo)
-     //          {
-     //              SrcSessionHndl = pSessionInfo->SessionHandle;
-     //          }
-
-     //           printf ("SendMsg: To LAN Interface for reference\n");
-     //           // Offset++; : causes bridging issues
-     //           m_MsgPkt.SrcQ = gFd_LanIfcQ;
-     //      }
-     //  }
-
-      if((Channel == PRIMARY_IPMB_CHANNEL) && g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 1)
-      {
-         printf ("SendMsg: To Primary IPMB Interface\n");
-         m_MsgPkt.SrcQ 	= gFd_PrimaryIpmbIfcQ;
-      }
-      else if(( Channel == SECONDARY_IPMB_CHANNEL) && (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 1))
-      {
-         printf ("SendMsg: To SMLink IPMB Interface\n");
-         m_MsgPkt.SrcQ = gFd_SecondaryIpmbIfcQ;
-      }
-      else
-      {
-         printf ("SendMsg: Invalid Channel\n");
-         *pRes = CC_DEST_UNAVAILABLE;
-         return sizeof (*pRes);
-      }
-   
-       if (1 == Tracking)
+    printf("curchannel: %d, Channel: %d\n", *curchannel, Channel);
+
+    if((Channel == PRIMARY_IPMB_CHANNEL) && g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 1)
+    {
+     printf ("SendMsg: To Primary IPMB Interface\n");
+     m_MsgPkt.SrcQ 	= gFd_PrimaryIpmbIfcQ;
+    }
+    else if(( Channel == SECONDARY_IPMB_CHANNEL) && (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 1))
+    {
+     printf ("SendMsg: To Secondary IPMB Interface\n");
+     m_MsgPkt.SrcQ = gFd_SecondaryIpmbIfcQ;
+    }
+    else
+    {
+     printf ("SendMsg: Invalid Channel\n");
+     *pRes = CC_DEST_UNAVAILABLE;
+     return sizeof (*pRes);
+    }
+
+    if (1 == Tracking)
+    {       
+       /* Tracking is not required if originator is System ifc */
+       if (SYS_IFC_CHANNEL == (*curchannel & 0xF))
        {
-           /* Response length is set to zero to make MsgHndlr skip responding to this request 
-            * The Response will be handled by the ipmb interface after verifying NAK.
-            */
-           ResLen = 0;
-           
-           /* Tracking is not required if originator is System ifc */
-           if (SYS_IFC_CHANNEL == (*curchannel & 0xF))
-           {
-               *pRes = CC_INV_DATA_FIELD;
-               return sizeof (*pRes);
-           }
-           
-           PBTbl = (Channel == SECONDARY_IPMB_CHANNEL) ? SECONDARY_PB_TBL : PRIMARY_PB_TBL ;
+           *pRes = CC_INV_DATA_FIELD;
+           return sizeof (*pRes);
+       }
+       
+       PBTbl = (Channel == SECONDARY_IPMB_CHANNEL) ? SECONDARY_PB_TBL : PRIMARY_PB_TBL ;
 
-           /* Store in the table for response tracking */
-           while(TRUE)
+       /* Store in the table for response tracking */
+       while(TRUE)
+       {
+           if (FALSE == m_PendingBridgedResTbl[PBTbl][SeqNum].Used)
            {
-               if (FALSE == m_PendingBridgedResTbl[PBTbl][SeqNum].Used)
+               m_PendingBridgedResTbl[PBTbl][SeqNum].TimeOut = g_BMCInfo.IpmiConfig.SendMsgTimeout;
+               m_PendingBridgedResTbl[PBTbl][SeqNum].ChannelNum = (*curchannel & 0xF);
+               m_PendingBridgedResTbl[PBTbl][SeqNum].OriginSrc  = ORIGIN_SENDMSG;
+               g_BMCInfo.SendMsgSeqNum = SeqNum;
+               
+               if (1 != Offset)
                {
-                   m_PendingBridgedResTbl[PBTbl][SeqNum].TimeOut = g_BMCInfo.IpmiConfig.SendMsgTimeout;
-                   m_PendingBridgedResTbl[PBTbl][SeqNum].ChannelNum = (*curchannel & 0xF);
-                   m_PendingBridgedResTbl[PBTbl][SeqNum].OriginSrc  = ORIGIN_SENDMSG;
-                   g_BMCInfo.SendMsgSeqNum = SeqNum;
-                   
-                   if (1 != Offset)
-                   {
-                       m_PendingBridgedResTbl[PBTbl][SeqNum].DstSessionHandle = pReq[Offset]; /* Session handle */
-                   }
+                   m_PendingBridgedResTbl[PBTbl][SeqNum].DstSessionHandle = pReq[Offset]; /* Session handle */
+               }
 
-                   m_PendingBridgedResTbl[PBTbl][SeqNum].SrcSessionHandle = SrcSessionHndl;
+               m_PendingBridgedResTbl[PBTbl][SeqNum].SrcSessionHandle = SrcSessionHndl;
 
-                   memcpy (&m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr, pIPMIMsgHdr, sizeof (IPMIMsgHdr_T));
+               memcpy (&m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr, pIPMIMsgHdr, sizeof (IPMIMsgHdr_T));
 
-                   /* Format the IPMI Msg Hdr */
-                   if(Channel == PRIMARY_IPMB_CHANNEL)  
-                   {
-                       pIPMIMsgHdr->ReqAddr = g_BMCInfo.IpmiConfig.PrimaryIPMBAddr;
-                   }
-                   else if(Channel == SECONDARY_IPMB_CHANNEL)
-                   {
-                       pIPMIMsgHdr->ReqAddr =  g_BMCInfo.IpmiConfig.SecondaryIPMBAddr;
-                   }
-                   else
-                   {
-                       printf("Invalid channel %d\n", Channel);//pIPMIMsgHdr->ReqAddr = pBMCInfo->IpmiConfig.BMCSlaveAddr;
-                   }
+               /* Format the IPMI Msg Hdr */
+               if(Channel == PRIMARY_IPMB_CHANNEL)  
+               {
+                   pIPMIMsgHdr->ReqAddr = g_BMCInfo.IpmiConfig.PrimaryIPMBAddr;
+               }
+               else if(Channel == SECONDARY_IPMB_CHANNEL)
+               {
+                   pIPMIMsgHdr->ReqAddr =  g_BMCInfo.IpmiConfig.SecondaryIPMBAddr;
+               }
+               else
+               {
+                   printf("Invalid channel %d\n", Channel);//pIPMIMsgHdr->ReqAddr = pBMCInfo->IpmiConfig.BMCSlaveAddr;
+               }
 
-                   pIPMIMsgHdr->RqSeqLUN = (g_BMCInfo.SendMsgSeqNum << 2) & 0xFC; /* Seq Num and LUN =00 */
+               pIPMIMsgHdr->RqSeqLUN = (g_BMCInfo.SendMsgSeqNum << 2) & 0xFC; /* Seq Num and LUN =00 */
 
-                   /* Recalculate the checksum */
-                   m_MsgPkt.Data[ReqLen - 2] = CalculateCheckSum2 (( uint8_t*)pIPMIMsgHdr, ReqLen - Offset - 1);
-                   if((*curchannel & 0xF) == LAN_RMCP_CHANNEL)
-                   {                 
-                       m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_LanIfcQ;
+               /* Recalculate the checksum */
+               m_MsgPkt.Data[ReqLen - 2] = CalculateCheckSum2 (( uint8_t*)pIPMIMsgHdr, ReqLen - Offset - 1);
+               if((*curchannel & 0xF) == LAN_RMCP_CHANNEL)
+               {                 
+                   m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_LanIfcQ;
+               }                  
+               else
+               {
+                   if(( (*curchannel & 0xF) == PRIMARY_IPMB_CHANNEL) && (g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 1 ))
+                   {          
+                       m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_PrimaryIpmbIfcQ;
                    }
-                   // else if (pBMCInfo->SERIALch != CH_NOT_USED && (*curchannel & 0xF) == pBMCInfo->SERIALch && pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
-                   // {
-                   //     memset(QueueName,0,sizeof(QueueName));
-                   //     sprintf(QueueName,"%s%d",SERIAL_IFC_Q,BMCInst);
-                   //     strcpy ((char *)m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ,QueueName);
-                   // }
-                   else
+                   else if(((*curchannel & 0xF) == SECONDARY_IPMB_CHANNEL) && g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 1)
                    {
-                       if(( (*curchannel & 0xF) == PRIMARY_IPMB_CHANNEL) && (g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 1 ))
-                       {          
-                           m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_PrimaryIpmbIfcQ;
-                       }
-                       else if(((*curchannel & 0xF) == SECONDARY_IPMB_CHANNEL) && g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 1)
-                       {
-                           m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_SecondaryIpmbIfcQ;
-                       }
-                       // else if ((pBMCInfo->SERIALch != CH_NOT_USED && Channel == pBMCInfo->SERIALch) && pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
-                       // {
-                       //     memset(QueueName,0,sizeof(QueueName));
-                       //     sprintf(QueueName,"%s%d",SERIAL_IFC_Q,BMCInst);
-                       //     strcpy ((char *)m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ,QueueName);
-                       // }
-                       // else if((pBMCInfo->SMBUSCh != CH_NOT_USED && Channel == pBMCInfo->SMBUSCh) && pBMCInfo->IpmiConfig.SMBUSIfcSupport == 1)
-                       // {
-                       // //strcpy ((char *)m_PendingBridgedResTbl[i].DestQ, NULL);
-                       // }
-                       // else if ((pBMCInfo->ICMBCh != CH_NOT_USED && Channel == pBMCInfo->ICMBCh) && pBMCInfo->IpmiConfig.ICMBIfcSupport == 1)
-                       // {
-                       //    memset(QueueName,0,sizeof(QueueName));
-                       //    sprintf(QueueName,"%s%d",ICMB_IFC_Q,BMCInst);
-                       //    strcpy ((char *)m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ,QueueName);
-                       // }
-                   }
-                   m_PendingBridgedResTbl[PBTbl][SeqNum].Used = TRUE;
-                   printf( "SendMessage:  Bridged message added index = %d.\n", SeqNum);
-
-                   break;
+                       m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ = gFd_SecondaryIpmbIfcQ;
+                   }                       
                }
-               else
-               {
-                   SeqNum = (SeqNum + 1) & 0x3F;
+               m_PendingBridgedResTbl[PBTbl][SeqNum].Used = TRUE;
+               printf( "SendMessage:  Bridged message added index = %d.\n", SeqNum);
 
-                   if (SeqNum == g_BMCInfo.SendMsgSeqNum)
-                   {
-                       /* If not been added to the Pending Bridge table, an error should be reported back.
-                       If not, for internal channel, the thread calling it may end up waiting! */
-                       *pRes = CC_NODE_BUSY;
-                       return  sizeof (*pRes);
-                   }
-                }
+               break;
            }
-       }
+           else
+           {
+               SeqNum = (SeqNum + 1) & 0x3F;
 
-       // if ((pBMCInfo->SYSCh == (*curchannel & 0xF)) && pBMCInfo->IpmiConfig.SYSIfcSupport == 0x01)
-       // {
-       //     ResLen = 0;
-       //     /* Format the IPMI Msg Hdr */
-       //     // Fill the address from Infrastrucure function instead of using PRIMARY_IPMB_ADDR/SECONDARY_IPMB_ADDR
-       //     if(Channel == pBMCInfo->PrimaryIPMBCh)
-       //     {
-       //         pIPMIMsgHdr->ReqAddr = pBMCInfo->IpmiConfig.PrimaryIPMBAddr;
-       //     }
-       //     else if(Channel == pBMCInfo->SecondaryIPMBCh)
-       //     {
-       //         pIPMIMsgHdr->ReqAddr = pBMCInfo->IpmiConfig.SecondaryIPMBAddr;
-       //     }
-       //     else
-       //     {
-       //         pIPMIMsgHdr->ReqAddr = pBMCInfo->IpmiConfig.BMCSlaveAddr;
-       //     }
-
-       //     /*Change the encapsulated request's LUN based on originating KCS interface */
-       //     pIPMIMsgHdr->RqSeqLUN = (pIPMIMsgHdr->RqSeqLUN & 0xFC) | (*kcsifcnum + 0x01);
-       //     m_MsgPkt.Data[ReqLen - 2] = CalculateCheckSum2 (( uint8_t*)pIPMIMsgHdr, ReqLen - Offset - 1);
-       //     pBMCInfo->BridgeMsgKCSIfc = *kcsifcnum;
-       // }
-
-        printf ("SendMsgCmd:Posting to interface ");
-        int y;
-        for(y=0;y<m_MsgPkt.Size;y++)
-       		printf("%#x ", m_MsgPkt.Data[y]);
-       	printf("\n");
-
-        m_MsgPkt.Cmd = PAYLOAD_IPMI_MSG;
-       /* Post the message to interface */
-       if (0 != PostMsg (m_MsgPkt.SrcQ, &m_MsgPkt))
-       {
-           printf ("SendMsg: Failed to post message to interface queue\n");
+               if (SeqNum == g_BMCInfo.SendMsgSeqNum)
+               {
+                   /* If not been added to the Pending Bridge table, an error should be reported back.
+                   If not, for internal channel, the thread calling it may end up waiting! */
+                   *pRes = CC_NODE_BUSY;
+                   return  sizeof (*pRes);
+               }
+            }
        }
+    }
 
-       pSendMsgRes->CompletionCode = CC_NORMAL;
-   }
-   return ResLen;
+    printf ("SendMsgCmd:Posting to interface ");
+    int y;
+    for(y=0;y<m_MsgPkt.Size;y++)
+    		printf("%#x ", m_MsgPkt.Data[y]);
+    	printf("\n");
+
+    m_MsgPkt.Cmd = PAYLOAD_IPMI_MSG;
+    /* Post the message to interface */
+    if (0 != PostMsg (m_MsgPkt.SrcQ, &m_MsgPkt))
+    {
+       printf ("SendMsg: Failed to post message to interface queue\n");
+    }
+
+    pSendMsgRes->CompletionCode = CC_NORMAL;
+   
+    return ResLen;
 }
 
 
@@ -1368,7 +1207,7 @@ GetSessionChallenge ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
   for(Index=0;Index < CHALLENGE_STR_LEN;Index+=4)
   {
       TempRandom = stm32_generate_random32bit();
-      printf("TempRandom: %#lx\n", TempRandom);
+//      printf("TempRandom: %#lx\n", TempRandom);
       ChallengeString[Index] = TempRandom&0xff;
       ChallengeString[Index+1] = TempRandom>>8;
       ChallengeString[Index+2] = TempRandom>>16;

+ 38 - 44
app/bmc/msghndlr/MsgHndlrTask.c

@@ -212,7 +212,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	}
 	if(UDS_CHANNEL == pReq->Channel)
 	{
-		printf("log 2, pReq->Size: %d, HdrOffset: %d\n", pReq->Size, HdrOffset);
+		//printf("log 2, pReq->Size: %d, HdrOffset: %d\n", pReq->Size, HdrOffset);
 		HdrOffset = sizeof(IPMIUDSMsg_T);
 		pReq->Size = pReq->Size -HdrOffset - 1;
 	}
@@ -283,51 +283,45 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	}
 	
 	pRes->Size 	= 	pCmdHndlrMap->CmdHndlr (&pReq->Data [HdrOffset], pReq->Size, &pRes->Data [HdrOffset]) + HdrOffset + 1;
-	
-	// //Patch for sensor Owner ID not equal IPMB address bug.
-	// if((NET_FN(pReq->NetFnLUN) == NETFN_STORAGE) && (pReq->Cmd == CMD_GET_SDR) 
-	// 	&& (((GetSDRReq_T*)&pReq->Data[6])->Offset == 5) && (pRes->Data [HdrOffset] == CC_NORMAL))
+		
+	// //send message command
+	// if( (CMD_SEND_MSG == pReq->Cmd) && (NETFN_APP == pReq->NetFnLUN >> 2))
 	// {
-	// 	pRes->Data [HdrOffset+3] = ((IPMIMsgHdr_T*)(pReq->Data))->ResAddr;	//modify sensor owner id
+	// 	printf("log 4\n");
+	// 	int Offset = 0;
+	// 	uint8_t SeqNum = g_BMCInfo.SendMsgSeqNum;
+	// 	if ((0 == pRes->Size) &&
+	// 		((g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 0x01  && PRIMARY_IPMB_CHANNEL == pRes->Channel) || 
+	// 		 (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 0x01 && SECONDARY_IPMB_CHANNEL == pRes->Channel)) )
+	// 	{
+	// 		pRes->Param = PARAM_NO_RESPONSE;
+	// 		Offset = HdrOffset + 2;
+	// 	}
+	// 	else if (HdrOffset == pRes->Size)
+	// 	{
+	// 		Offset = HdrOffset + 1;
+	// 	}
+
+	//     PBTbl = ( ((pReq->Data[sizeof (IPMIMsgHdr_T)] & 0x0F) == SECONDARY_IPMB_CHANNEL) ? SECONDARY_PB_TBL : PRIMARY_PB_TBL );
+	// 	while(TRUE)
+	// 	{ 
+	// 		if ( (TRUE == m_PendingBridgedResTbl[PBTbl][SeqNum].Used) &&
+	// 			(0 == memcmp (&m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr, &pReq->Data[Offset], sizeof (IPMIMsgHdr_T))) )
+	// 		{
+	// 			printf("---> log 4.1\n");
+	// 			 memcpy (&m_PendingBridgedResTbl[PBTbl][SeqNum].ResMsgHdr, pRes->Data, sizeof (IPMIMsgHdr_T));
+	// 			 break;    
+	// 		}
+	// 		else
+	// 		{
+	// 			SeqNum = (SeqNum - 1) & 0x3F;
+	// 			if(SeqNum == g_BMCInfo.SendMsgSeqNum)
+	// 			{
+	// 				break; 
+	// 			}
+	// 		}
+	// 	}
 	// }
-	
-	//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) &&
-			((g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 0x01  && PRIMARY_IPMB_CHANNEL == pRes->Channel) || 
-			 (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 0x01 && SECONDARY_IPMB_CHANNEL == pRes->Channel)) )
-		{
-			pRes->Param = PARAM_NO_RESPONSE;
-			Offset = HdrOffset + 2;
-		}
-		else if (HdrOffset == pRes->Size)
-		{
-			Offset = HdrOffset + 1;
-		}
-
-	    PBTbl = ( ((pReq->Data[sizeof (IPMIMsgHdr_T)] & 0x0F) == SECONDARY_IPMB_CHANNEL) ? SECONDARY_PB_TBL : PRIMARY_PB_TBL );
-		while(TRUE)
-		{ 
-			if ( (TRUE == m_PendingBridgedResTbl[PBTbl][SeqNum].Used) &&
-				(0 == memcmp (&m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr, &pReq->Data[Offset], sizeof (IPMIMsgHdr_T))) )
-			{
-				 memcpy (&m_PendingBridgedResTbl[PBTbl][SeqNum].ResMsgHdr, pRes->Data, sizeof (IPMIMsgHdr_T));
-				 break;    
-			}
-			else
-			{
-				SeqNum = (SeqNum - 1) & 0x3F;
-				if(SeqNum == g_BMCInfo.SendMsgSeqNum)
-				{
-					break; 
-				}
-			}
-		}
-	}
 
 //	printf("log 5\n");
 	

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

@@ -338,6 +338,7 @@ const CmdHndlrMap_T g_Storlead_CmdHndlr [] =
 {                                                              
     { CMD_GET_SYS_INFO,         PRIV_USER,      Storlead_GetSysInfo,        0xff,  0xAAAA ,0xFFFF},
     { CMD_GET_SENSOR_INFO,      PRIV_USER,      Storlead_GetSensorInfo,     0xff,  0xAAAA  ,0xFFFF},
+    { CMD_GET_SEL_ENTIRES,      PRIV_USER,      Storlead_GetSELEntires,     0xff,  0xAAAA  ,0xFFFF},
     { 0x00,                     0x00,           0x00,                 0x00, 0x0000  ,  0x0000},
 };
 

+ 7 - 3
app/bmc/msghndlr/Storage/SDRDevice/SDR.c

@@ -63,8 +63,7 @@
 
 #define MAX_OEM_REC_LEN  64
 
-#define SDR_ALLOC_UNIT_SIZE                 0x10
-#define SDR_MAX_RECORD_SIZE                 0x80
+
 #define SDR_ERASE_COMPLETED                 0x01
 #define SDR_INIT_COMPLETED                  0x01
 
@@ -186,6 +185,7 @@ int GetSDR ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 	SDRRecHdr_T*     pSDRRec;
 	GetSDRReq_T*     pGetSDRReq = ( GetSDRReq_T*) pReq;
 	GetSDRRes_T*     pGetSDRRes = ( GetSDRRes_T*) pRes;
+    uint8_t         *curchannel;
 	
 	uint8_t SDRLen = 0;
 
@@ -219,8 +219,12 @@ int GetSDR ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
         pGetSDRReq->Size =  SDRLen - pGetSDRReq->Offset;
     }
 
+    curchannel = pthread_getspecific(g_tls.CurChannel); 
     /* Check for Max Request Bytes */
-    if ((pGetSDRReq->Size > MAX_SDR_LEN) || (pGetSDRReq->Size > SDRLen) || (pGetSDRReq->Offset > SDRLen) 
+    if (((pGetSDRReq->Size > MAX_SDR_LEN) && \
+        ( g_BMCInfo.IpmiConfig.PrimaryIPMBSupport == 0x01 && PRIMARY_IPMB_CHANNEL == (*curchannel & 0xF)) 
+        || (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 0x01 && SECONDARY_IPMB_CHANNEL == (*curchannel & 0xF)))\
+        || (pGetSDRReq->Size > SDRLen) || (pGetSDRReq->Offset > SDRLen) 
         || (pGetSDRReq->Size > (SDRLen-pGetSDRReq->Offset)))
     {
         pGetSDRRes->CompletionCode = CC_CANNOT_RETURN_REQ_BYTES;

+ 4 - 4
app/bmc/msghndlr/Storage/SELDevice/SEL.c

@@ -147,17 +147,17 @@ GetSELAllocationInfo( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 	SELRepository_T* 	m_sel;
 
     pAllocInfo->CompletionCode    = CC_NORMAL;
-    pAllocInfo->NumAllocUnits     =  1;
+    pAllocInfo->NumAllocUnits     =  MAX_SEL_RECORD;
     pAllocInfo->AllocUnitSize     =  (sizeof (SELRec_T));
 
 	m_sel = ( SELRepository_T*) g_BMCInfo.pSEL;
 	pAllocInfo->NumFreeAllocUnits =  ((g_BMCInfo.SELConfig.MaxSELRecord - m_sel->NumRecords));
-	pAllocInfo->LargestFreeBlock  =  (sizeof (SELRec_T));
+	pAllocInfo->LargestFreeBlock  =  sizeof(SELRec_T);
 
 
-    pAllocInfo->MaxRecSize        = (sizeof (SELRec_T));
+    pAllocInfo->MaxRecSize        = sizeof(SELRec_T);
     
-    return sizeof (SELAllocInfo_T);
+    return sizeof(SELAllocInfo_T);
 }
 
 

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

@@ -7,6 +7,7 @@
 #include "Sensor.h"
 #include "com_IPMI_SDRRecord.h"
 #include "SDR.h"
+#include "SELRecord.h"
 
 int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 {
@@ -270,3 +271,56 @@ int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 
     return sizeof(StorleadGetSensorInfoRes_T);
 }
+
+
+/*
+*@fn AMIGetSELEntires
+*@param This function retrieves the SEL entries
+*@return Returns CC_NORMAL
+*/
+#define MAX_FULL_SEL_ENTRIES 900    //18*50=900, 50个SEL Entry, 每个18字节
+
+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;
+
+    
+     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));
+    }
+
+
+   
+    memcpy((uint8_t*)(pAMIGetSelEntiresRes + 1),(uint8_t*)&m_sel->SELRecord[pAMIGetSelEntriesReq->Noofentretrieved],
+              sizeof(SELRec_T)*pAMIGetSelEntiresRes->Noofentries);
+  
+
+    pAMIGetSelEntiresRes->LastRecID = m_sel->LastRecID;
+
+    pAMIGetSelEntiresRes->CompletionCode = CC_NORMAL;
+
+    return sizeof(AMIGetSELEntriesRes_T) + (sizeof(SELRec_T) * pAMIGetSelEntiresRes->Noofentries);
+}

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

@@ -4,4 +4,5 @@
 
 
 int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
-int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
+int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
+int  Storlead_GetSELEntires(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);

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

@@ -799,6 +799,7 @@ const NetFnCmds_T g_Storlead [] =
 	/*------------------------- IPM Device Commands --------------------------------------*/
 	{ CMD_GET_SYS_INFO          ,ENABLED},
 	{ CMD_GET_SENSOR_INFO          ,ENABLED},
+	{ CMD_GET_SEL_ENTIRES          ,ENABLED},
 	{0,				0		},
 };
 

+ 3 - 3
app/bmc/sensor_driver.c

@@ -34,7 +34,7 @@ int sensor_1_read(uint8_t *reading)
 //	close(fd);
 	//printf("read sensor 1: %#x!\n", buf);
 	//*reading = buf;
-	*reading = 0x10;
+	*reading = 0xff;
 	return 0;
 }
 
@@ -63,7 +63,7 @@ int sensor_2_read(uint8_t *reading)
 //	stm32_i2c_master_read(fd, 0xAA, &buf, 1);
 //	close(fd);
 	//*reading = buf;
-	*reading = 0x20;
+	*reading = 0xe0;
 	return 0;
 }
 
@@ -122,7 +122,7 @@ int sensor_4_read(uint8_t *reading)
 //	stm32_i2c_master_read(fd, 0x98, &buf, 1);
 //	close(fd);
 	//*reading = buf;
-	*reading = 0x40;
+	*reading = 0x8a;
 	return 0;
 }
 

+ 12 - 12
app/bmc/sensor_sdr.c

@@ -124,9 +124,9 @@ const FullSensorRec_T full_sdr_tbl[] = {
 		0x00,	//Normal Minimum
 		0xff,	//Sensor Maximum Reading
 		0x00,	//Sensor Minimum Reading
-		0xff,	//Upper Non-Recoverable Threshold
-		0xff,	//Upper Critical Threshold
-		0xff,	//Upper Non-Critical Threshold
+		0xc0,	//Upper Non-Recoverable Threshold
+		0xb0,	//Upper Critical Threshold
+		0xa0,	//Upper Non-Critical Threshold
 		0x00,	//Lower Non-Recoverable Threshold
 		0x00,	//Lower Critical Threshold
 		0x00,	//Lower Non-Critical threshold
@@ -226,9 +226,9 @@ const FullSensorRec_T full_sdr_tbl[] = {
 		0xff,	//Upper Non-Recoverable Threshold
 		0xff,	//Upper Critical Threshold
 		0xff,	//Upper Non-Critical Threshold
-		0x00,	//Lower Non-Recoverable Threshold
-		0x00,	//Lower Critical Threshold
-		0x00,	//Lower Non-Critical threshold
+		0xc0,	//Lower Non-Recoverable Threshold
+		0xb0,	//Lower Critical Threshold
+		0xa0,	//Lower Non-Critical threshold
 		0x0,	//Positive - threshold Hysteresis value
 		0x0,	//Negative - threshold Hysteresis value
 		0x0,	//Reserved
@@ -325,9 +325,9 @@ const FullSensorRec_T full_sdr_tbl[] = {
 		0x7f,	//Upper Non-Recoverable Threshold
 		0x7f,	//Upper Critical Threshold
 		0x7f,	//Upper Non-Critical Threshold
-		0x80,	//Lower Non-Recoverable Threshold
-		0x80,	//Lower Critical Threshold
-		0x80,	//Lower Non-Critical threshold
+		0xD0,	//Lower Non-Recoverable Threshold
+		0xE0,	//Lower Critical Threshold
+		0xF0,	//Lower Non-Critical threshold
 		0x0,	//Positive - threshold Hysteresis value
 		0x0,	//Negative - threshold Hysteresis value
 		0x0,	//Reserved
@@ -424,9 +424,9 @@ const FullSensorRec_T full_sdr_tbl[] = {
 		0x7f,	//Upper Non-Recoverable Threshold
 		0x7f,	//Upper Critical Threshold
 		0x7f,	//Upper Non-Critical Threshold
-		0x80,	//Lower Non-Recoverable Threshold
-		0x80,	//Lower Critical Threshold
-		0x80,	//Lower Non-Critical threshold
+		0xD0,	//Lower Non-Recoverable Threshold
+		0xE0,	//Lower Critical Threshold
+		0xF0,	//Lower Non-Critical threshold
 		0x0,	//Positive - threshold Hysteresis value
 		0x0,	//Negative - threshold Hysteresis value
 		0x0,	//Reserved

+ 17 - 0
app/common_include/com_BmcType.h

@@ -302,5 +302,22 @@ typedef struct
 //     IPMIMsgHdr_T          ResMsgHdr;
 // } 	PendingBridgedResTbl_T;
 
+
+
+typedef struct
+{
+    uint32_t Noofentretrieved;  //offset
+}AMIGetSELEntriesReq_T;
+
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint32_t   Noofentries;
+    uint16_t   LastRecID;
+    uint8_t   Status;
+}AMIGetSELEntriesRes_T;
+
+
+
 #pragma pack()
 #endif /* __BMC_TYPE_H__ */

+ 6 - 0
app/common_include/com_IPMIDefs.h

@@ -64,6 +64,8 @@
 #define IP6_ADDR_LEN   16
 #define MAX_USERNAME_LEN        (16+1)
 #define MAX_PASSWORD_LEN        (20+1)
+#define SDR_ALLOC_UNIT_SIZE                 0x40
+#define SDR_MAX_RECORD_SIZE                 0x1 	//Maximum record size in allocation units
 
 #define AUTH_FILE_PATH		"/etc/goahead/auth.txt"
 
@@ -244,6 +246,10 @@
 #define BLADE_IPMC              1
 #define   CH_NOT_USED   0xFF
 
+#define FULL_SEL_ENTRIES     0xFF
+#define PARTIAL_SEL_ENTRIES   0x00
+#define SEL_EMPTY_REPOSITORY 0x00
+
 /*----------------------------------------------
  * Bit fields
  *----------------------------------------------*/

+ 1 - 0
app/common_include/com_IPMI_Storlead.h

@@ -3,5 +3,6 @@
 
 #define CMD_GET_SYS_INFO   		0x0
 #define CMD_GET_SENSOR_INFO   	0x1
+#define CMD_GET_SEL_ENTIRES		0x2
 
 #endif /* __COM_IPMI_STORLEAD_H__ */

+ 0 - 1
app/driver/Platform/.platform_STM32F429.ko.cmd

@@ -1 +0,0 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.ko := arm-uclinuxeabi-ld -EL -r  -T /gd32f450_prj/linux-cortexm-1.14.2/linux/scripts/module-common.lds  -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.ko /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o

+ 0 - 296
app/driver/Platform/.platform_STM32F429.mod.o.cmd

@@ -1,296 +0,0 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/.platform_STM32F429.mod.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include  -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(platform_STM32F429.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(platform_STM32F429)"  -DMODULE -mlong-calls -fno-optimize-sibling-calls -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.c
-
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.c \
-    $(wildcard include/config/module/unload.h) \
-  include/linux/module.h \
-    $(wildcard include/config/symbol/prefix.h) \
-    $(wildcard include/config/modules.h) \
-    $(wildcard include/config/modversions.h) \
-    $(wildcard include/config/unused/symbols.h) \
-    $(wildcard include/config/generic/bug.h) \
-    $(wildcard include/config/kallsyms.h) \
-    $(wildcard include/config/tracepoints.h) \
-    $(wildcard include/config/tracing.h) \
-    $(wildcard include/config/event/tracing.h) \
-    $(wildcard include/config/ftrace/mcount/record.h) \
-    $(wildcard include/config/smp.h) \
-    $(wildcard include/config/constructors.h) \
-    $(wildcard include/config/sysfs.h) \
-  include/linux/list.h \
-    $(wildcard include/config/debug/list.h) \
-  include/linux/stddef.h \
-  include/linux/compiler.h \
-    $(wildcard include/config/trace/branch/profiling.h) \
-    $(wildcard include/config/profile/all/branches.h) \
-    $(wildcard include/config/enable/must/check.h) \
-    $(wildcard include/config/enable/warn/deprecated.h) \
-  include/linux/compiler-gcc.h \
-    $(wildcard include/config/arch/supports/optimized/inlining.h) \
-    $(wildcard include/config/optimize/inlining.h) \
-  include/linux/compiler-gcc4.h \
-  include/linux/poison.h \
-    $(wildcard include/config/illegal/pointer/value.h) \
-  include/linux/prefetch.h \
-  include/linux/types.h \
-    $(wildcard include/config/uid16.h) \
-    $(wildcard include/config/lbdaf.h) \
-    $(wildcard include/config/phys/addr/t/64bit.h) \
-    $(wildcard include/config/64bit.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/types.h \
-  include/asm-generic/int-ll64.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitsperlong.h \
-  include/asm-generic/bitsperlong.h \
-  include/linux/posix_types.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/posix_types.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/processor.h \
-    $(wildcard include/config/mmu.h) \
-    $(wildcard include/config/cpu/v7m.h) \
-    $(wildcard include/config/mpu.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/ptrace.h \
-    $(wildcard include/config/cpu/endian/be8.h) \
-    $(wildcard include/config/arm/thumb.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/hwcap.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/cache.h \
-    $(wildcard include/config/arm/l1/cache/shift.h) \
-    $(wildcard include/config/aeabi.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/system.h \
-    $(wildcard include/config/cpu/xsc3.h) \
-    $(wildcard include/config/cpu/fa526.h) \
-    $(wildcard include/config/arch/has/barriers.h) \
-    $(wildcard include/config/cpu/sa1100.h) \
-    $(wildcard include/config/cpu/sa110.h) \
-    $(wildcard include/config/arch/a2f.h) \
-    $(wildcard include/config/cpu/32v6k.h) \
-  include/linux/linkage.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/linkage.h \
-  include/linux/irqflags.h \
-    $(wildcard include/config/trace/irqflags.h) \
-    $(wildcard include/config/irqsoff/tracer.h) \
-    $(wildcard include/config/preempt/tracer.h) \
-    $(wildcard include/config/trace/irqflags/support.h) \
-  include/linux/typecheck.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/irqflags.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/outercache.h \
-    $(wildcard include/config/outer/cache/sync.h) \
-    $(wildcard include/config/outer/cache.h) \
-  include/asm-generic/cmpxchg-local.h \
-  include/linux/stat.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/stat.h \
-  include/linux/time.h \
-    $(wildcard include/config/arch/uses/gettimeoffset.h) \
-  include/linux/cache.h \
-    $(wildcard include/config/arch/has/cache/line/size.h) \
-  include/linux/kernel.h \
-    $(wildcard include/config/preempt/voluntary.h) \
-    $(wildcard include/config/debug/spinlock/sleep.h) \
-    $(wildcard include/config/prove/locking.h) \
-    $(wildcard include/config/printk.h) \
-    $(wildcard include/config/dynamic/debug.h) \
-    $(wildcard include/config/ring/buffer.h) \
-    $(wildcard include/config/numa.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include/stdarg.h \
-  include/linux/bitops.h \
-    $(wildcard include/config/generic/find/first/bit.h) \
-    $(wildcard include/config/generic/find/last/bit.h) \
-    $(wildcard include/config/generic/find/next/bit.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitops.h \
-  include/asm-generic/bitops/non-atomic.h \
-  include/asm-generic/bitops/fls64.h \
-  include/asm-generic/bitops/sched.h \
-  include/asm-generic/bitops/hweight.h \
-  include/asm-generic/bitops/lock.h \
-  include/linux/log2.h \
-    $(wildcard include/config/arch/has/ilog2/u32.h) \
-    $(wildcard include/config/arch/has/ilog2/u64.h) \
-  include/linux/dynamic_debug.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/byteorder.h \
-  include/linux/byteorder/little_endian.h \
-  include/linux/swab.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/swab.h \
-  include/linux/byteorder/generic.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bug.h \
-    $(wildcard include/config/bug.h) \
-    $(wildcard include/config/debug/bugverbose.h) \
-  include/asm-generic/bug.h \
-    $(wildcard include/config/generic/bug/relative/pointers.h) \
-  include/linux/seqlock.h \
-  include/linux/spinlock.h \
-    $(wildcard include/config/debug/spinlock.h) \
-    $(wildcard include/config/generic/lockbreak.h) \
-    $(wildcard include/config/preempt.h) \
-    $(wildcard include/config/debug/lock/alloc.h) \
-  include/linux/preempt.h \
-    $(wildcard include/config/debug/preempt.h) \
-    $(wildcard include/config/preempt/notifiers.h) \
-  include/linux/thread_info.h \
-    $(wildcard include/config/compat.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/thread_info.h \
-    $(wildcard include/config/arm/thumbee.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/fpstate.h \
-    $(wildcard include/config/vfpv3.h) \
-    $(wildcard include/config/vfpm.h) \
-    $(wildcard include/config/iwmmxt.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/domain.h \
-    $(wildcard include/config/io/36.h) \
-    $(wildcard include/config/cpu/use/domains.h) \
-  include/linux/stringify.h \
-  include/linux/bottom_half.h \
-  include/linux/spinlock_types.h \
-  include/linux/spinlock_types_up.h \
-  include/linux/lockdep.h \
-    $(wildcard include/config/lockdep.h) \
-    $(wildcard include/config/lock/stat.h) \
-    $(wildcard include/config/generic/hardirqs.h) \
-  include/linux/rwlock_types.h \
-  include/linux/spinlock_up.h \
-  include/linux/rwlock.h \
-  include/linux/spinlock_api_up.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/atomic.h \
-    $(wildcard include/config/generic/atomic64.h) \
-  include/asm-generic/atomic64.h \
-  include/asm-generic/atomic-long.h \
-  include/linux/math64.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/div64.h \
-  include/linux/kmod.h \
-  include/linux/gfp.h \
-    $(wildcard include/config/kmemcheck.h) \
-    $(wildcard include/config/highmem.h) \
-    $(wildcard include/config/zone/dma.h) \
-    $(wildcard include/config/zone/dma32.h) \
-    $(wildcard include/config/debug/vm.h) \
-  include/linux/mmzone.h \
-    $(wildcard include/config/force/max/zoneorder.h) \
-    $(wildcard include/config/memory/hotplug.h) \
-    $(wildcard include/config/sparsemem.h) \
-    $(wildcard include/config/arch/populates/node/map.h) \
-    $(wildcard include/config/discontigmem.h) \
-    $(wildcard include/config/flat/node/mem/map.h) \
-    $(wildcard include/config/cgroup/mem/res/ctlr.h) \
-    $(wildcard include/config/have/memory/present.h) \
-    $(wildcard include/config/need/node/memmap/size.h) \
-    $(wildcard include/config/need/multiple/nodes.h) \
-    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
-    $(wildcard include/config/flatmem.h) \
-    $(wildcard include/config/sparsemem/extreme.h) \
-    $(wildcard include/config/nodes/span/other/nodes.h) \
-    $(wildcard include/config/holes/in/zone.h) \
-    $(wildcard include/config/arch/has/holes/memorymodel.h) \
-  include/linux/wait.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/current.h \
-  include/linux/threads.h \
-    $(wildcard include/config/nr/cpus.h) \
-    $(wildcard include/config/base/small.h) \
-  include/linux/numa.h \
-    $(wildcard include/config/nodes/shift.h) \
-  include/linux/init.h \
-    $(wildcard include/config/hotplug.h) \
-  include/linux/nodemask.h \
-  include/linux/bitmap.h \
-  include/linux/string.h \
-    $(wildcard include/config/binary/printf.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/string.h \
-  include/linux/pageblock-flags.h \
-    $(wildcard include/config/hugetlb/page.h) \
-    $(wildcard include/config/hugetlb/page/size/variable.h) \
-  include/generated/bounds.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page.h \
-    $(wildcard include/config/cpu/copy/v3.h) \
-    $(wildcard include/config/cpu/copy/v4wt.h) \
-    $(wildcard include/config/cpu/copy/v4wb.h) \
-    $(wildcard include/config/cpu/copy/feroceon.h) \
-    $(wildcard include/config/cpu/copy/fa.h) \
-    $(wildcard include/config/cpu/xscale.h) \
-    $(wildcard include/config/cpu/copy/v6.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page-nommu.h \
-    $(wildcard include/config/small/tasks.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/memory.h \
-    $(wildcard include/config/page/offset.h) \
-    $(wildcard include/config/thumb2/kernel.h) \
-    $(wildcard include/config/dram/size.h) \
-    $(wildcard include/config/dram/base.h) \
-  include/linux/const.h \
-  arch/arm/mach-stm32/include/mach/memory.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/sizes.h \
-  include/asm-generic/memory_model.h \
-    $(wildcard include/config/sparsemem/vmemmap.h) \
-  include/asm-generic/getorder.h \
-  include/linux/memory_hotplug.h \
-    $(wildcard include/config/have/arch/nodedata/extension.h) \
-    $(wildcard include/config/memory/hotremove.h) \
-  include/linux/notifier.h \
-  include/linux/errno.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/errno.h \
-  include/asm-generic/errno.h \
-  include/asm-generic/errno-base.h \
-  include/linux/mutex.h \
-    $(wildcard include/config/debug/mutexes.h) \
-  include/linux/rwsem.h \
-    $(wildcard include/config/rwsem/generic/spinlock.h) \
-  include/linux/rwsem-spinlock.h \
-  include/linux/srcu.h \
-  include/linux/topology.h \
-    $(wildcard include/config/sched/smt.h) \
-    $(wildcard include/config/sched/mc.h) \
-  include/linux/cpumask.h \
-    $(wildcard include/config/cpumask/offstack.h) \
-    $(wildcard include/config/hotplug/cpu.h) \
-    $(wildcard include/config/debug/per/cpu/maps.h) \
-    $(wildcard include/config/disable/obsolete/cpumask/functions.h) \
-  include/linux/smp.h \
-    $(wildcard include/config/use/generic/smp/helpers.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/topology.h \
-  include/asm-generic/topology.h \
-  include/linux/mmdebug.h \
-    $(wildcard include/config/debug/virtual.h) \
-  include/linux/elf.h \
-  include/linux/elf-em.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/elf.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/user.h \
-  include/linux/kobject.h \
-  include/linux/sysfs.h \
-  include/linux/kref.h \
-  include/linux/moduleparam.h \
-    $(wildcard include/config/alpha.h) \
-    $(wildcard include/config/ia64.h) \
-    $(wildcard include/config/ppc64.h) \
-  include/linux/tracepoint.h \
-  include/linux/rcupdate.h \
-    $(wildcard include/config/tree/rcu.h) \
-    $(wildcard include/config/tree/preempt/rcu.h) \
-    $(wildcard include/config/tiny/rcu.h) \
-  include/linux/completion.h \
-  include/linux/rcutree.h \
-    $(wildcard include/config/no/hz.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/local.h \
-  include/asm-generic/local.h \
-  include/linux/percpu.h \
-    $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \
-    $(wildcard include/config/need/per/cpu/page/first/chunk.h) \
-    $(wildcard include/config/have/setup/per/cpu/area.h) \
-  include/linux/slab.h \
-    $(wildcard include/config/slab/debug.h) \
-    $(wildcard include/config/debug/objects.h) \
-    $(wildcard include/config/slub.h) \
-    $(wildcard include/config/slob.h) \
-    $(wildcard include/config/debug/slab.h) \
-  include/linux/slab_def.h \
-  include/linux/kmemtrace.h \
-    $(wildcard include/config/kmemtrace.h) \
-  include/trace/events/kmem.h \
-  include/trace/define_trace.h \
-  include/linux/kmalloc_sizes.h \
-  include/linux/pfn.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/percpu.h \
-  include/asm-generic/percpu.h \
-  include/linux/percpu-defs.h \
-    $(wildcard include/config/debug/force/weak/per/cpu.h) \
-  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/module.h \
-    $(wildcard include/config/arm/unwind.h) \
-  include/trace/events/module.h \
-  include/linux/vermagic.h \
-  include/generated/utsrelease.h \
-
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o)
-
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.mod.o):

+ 0 - 1
app/driver/Platform/.platform_STM32F429.o.cmd

@@ -1 +0,0 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.o := arm-uclinuxeabi-ld -EL    -r -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/../STM32F4xx_HAL_Driver/system_stm32f4xx.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o 

BIN
app/driver/Platform/platform_STM32F429.ko


+ 0 - 21
app/driver/Platform/platform_STM32F429.mod.c

@@ -1,21 +0,0 @@
-#include <linux/module.h>
-#include <linux/vermagic.h>
-#include <linux/compiler.h>
-
-MODULE_INFO(vermagic, VERMAGIC_STRING);
-
-struct module __this_module
-__attribute__((section(".gnu.linkonce.this_module"))) = {
- .name = KBUILD_MODNAME,
- .init = init_module,
-#ifdef CONFIG_MODULE_UNLOAD
- .exit = cleanup_module,
-#endif
- .arch = MODULE_ARCH_INIT,
-};
-
-static const char __module_depends[]
-__used
-__attribute__((section(".modinfo"))) =
-"depends=";
-

+ 2 - 0
app/goahead-3.6.5/src/file.c

@@ -186,6 +186,7 @@ static void fileClose()
 
 PUBLIC void websFileOpen()
 {
+    printf(">>>>>>>>>>>>>>>>>>>>>>>>>>333>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
     websIndex = sclone("index.html");
     websDefineHandler("file", 0, fileHandler, fileClose, 0);
 }
@@ -196,6 +197,7 @@ PUBLIC void websFileOpen()
  */
 PUBLIC char *websGetIndex()
 {
+    printf(">>>>>>>>>>>>>>>>>>>>>>>>is here ???>>>>>>>>>>>>>>>>>>>>>>");
     return websIndex;
 }
 

+ 3 - 0
app/goahead-3.6.5/src/goahead.c

@@ -187,6 +187,9 @@ websDefineAction("getFruChassisInfo", getFruChassisInfo);
 websDefineAction("getFruBoardInfo", getFruBoardInfo);
 websDefineAction("getFruProductInfo", getFruProductInfo);
 
+//sel
+websDefineAction("Web_ClearSEL", Web_ClearSEL);
+websDefineAction("GetAllSELEntriesSorted", GetAllSELEntriesSorted);
 
 
 

+ 1 - 1
app/goahead-3.6.5/src/libipmi/inc/libipmi_StorDevice.h

@@ -93,7 +93,7 @@ we want all sel entires but we also want sensor names*/
 typedef struct _SELEventRecordWithSensorName
 {
 	SELRec_T EventRecord;
-	uint8_t SensorName[65]; //65 is the max possible because SensorName len in SDR is indicated by 6 bits
+	uint8_t SensorName[MAX_ID_STR_LEN]; //MAX_ID_STR_LEN is the max possible because SensorName len in SDR is indicated by 6 bits
 } SELEventRecordWithSensorName_T;
 
 #ifndef MAX_FRU_DEVICES

+ 135 - 130
app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c

@@ -497,137 +497,142 @@ uint16_t LIBIPMI_HL_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession,
 	return wRet;
 }
 
-// /*this function wants to be nice to all nice people in the world who display
-// sensor information. Instead of letting them go nuts getting all sel entires first
-// an then looping thru all sel entires to go get all the sensor names and then each time to
-// get a sensor name read SDR
-// it just does that for them
-// GetAllSelEntires
-// Also GetAllSDR stuff once
-// then loop and fill it all up internally*/
-// uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession,
-// 					SELEventRecordWithSensorName_T *pSELEntriesBuffer,
-// 					int timeout)
-// {
+/*this function wants to be nice to all nice people in the world who display
+sensor information. Instead of letting them go nuts getting all sel entires first
+an then looping thru all sel entires to go get all the sensor names and then each time to
+get a sensor name read SDR
+it just does that for them
+GetAllSelEntires
+Also GetAllSDR stuff once
+then loop and fill it all up internally*/
+uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession,
+					SELEventRecordWithSensorName_T *pSELEntriesBuffer,
+					int timeout)
+{
 
-// 	// first SEL record and complete record,
-// 	// starting at offset 0 of each record.
-// 	//uint32_t DataLen = 0;
-// 	uint16_t wRet = 0;
-// 	SDRRepositoryAllocInfo_T SDRAllocationInfo;
-// 	SDRRepositoryInfo_T SDRReposInfo;
-// 	int MaxSDRLen = 0;
-// 	int i,SDRCount = 0;
-// 	uint8_t *pSDRBuff = NULL;
-// 	SDRHeader *pSDRHeader = NULL;
-// 	uint8_t *pSDRStart = NULL;
-// 	uint32_t nNumSelEntries = 0;
-// 	int q = 0;
-
-
-// 	/***********************************Get all Sel Entries now*********************************************/
-// 	/* We want to read full records */
-// 	//DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
-
-// 	wRet = LIBIPMI_HL_AMIGetSELEntires(pUDSSession,pSELEntriesBuffer,&nNumSelEntries,timeout);
-// 	if(wRet != LIBIPMI_E_SUCCESS)
-// 	{
-// 		printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
-// 		return wRet;
-// 	}
-
-
-// 	/*************************************Get The SDR once so that we can get sensor names*******************/
-// 	/* Get max buffer size to be allocated to read all SDRs in the system */
-// 	wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
-// 	if( wRet != 0 )
-// 	{
-// 		printf("Error getting SDR Repository Allocation Info\n");
-// 		return wRet;
-// 	}
-// 	/* Get repository information */
-// 	wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
-// 	if( wRet != 0 )
-// 	{
-// 		printf("Error getting SDR Repository Info\n");
-// 		return wRet;
-// 	}
-
-// 	/* Determine max SDR entry length */
-// 	MaxSDRLen = SDRAllocationInfo.MaxRecSize *  ( SDRAllocationInfo.AllocUnitSize );
-
-// 	/* Determine total number of SDRs stored */
-// 	SDRCount =  ( SDRReposInfo.RecCt );
-
-// 	/* Allocate the buffer */
-// 	pSDRBuff = (uint8_t *) malloc(MaxSDRLen * SDRCount);
-// 	if(!pSDRBuff)
-// 	{
-// 		printf("Error allocating memopry for SDRs in GetAllEventsWithSensorNames\n");
-// 		wRet = STATUS_CODE(IPMI_ERROR_FLAG,CC_OUT_OF_SPACE);
-// 		return wRet;
-// 	}
-// 	pSDRStart = pSDRBuff;
-
-// 	/* Call the function to read all the SDRs into this buffer */
-// 	wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
-//                                      pSDRBuff,(MaxSDRLen * SDRCount),
-//                                      timeout*4);
-
-// 	/*************************************Get The SDR once so that we can get sensor names*******************/
-
-// 	/******************Now parse through sensor headers and get names corresponding to each event************/
-// 	for(q=0;q<nNumSelEntries;q++)
-// 	{
-
-// 		strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-
-// 		pSDRBuff = pSDRStart;
-// 		for( i = 0; i < SDRCount; i++)
-// 		{
-// 			pSDRHeader = (SDRHeader *) pSDRBuff;
-// 			if((pSDRHeader->RecordType >= 0x01) && (pSDRHeader->RecordType <= 0x03))
-// 			{
-// 				/* Compare SlaveAdd and LUNid fields */
-// 				uint8_t *pTmp = pSDRBuff + sizeof(SDRHeader);
-// 				uint8_t len = 0;
-
-
-
-// 				if((pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[0] == *pTmp) && (pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[1] == *(pTmp+1)))
-// 				{
-
-// 					/* Now compare the sensor number */
-// 					if(pSELEntriesBuffer[q].EventRecord.EvtRecord.SensorNum == *(pTmp+2))
-// 					{
-// 						/* Get the Name and return */
-// 						if(pSDRHeader->RecordType == 0x01)
-// 							pTmp = pSDRBuff + sizeof(SDRHeader) + 42;
-// 						else if(pSDRHeader->RecordType == 0x02)
-// 							pTmp = pSDRBuff + sizeof(SDRHeader) + 26;
-// 						else
-// 							pTmp = pSDRBuff + sizeof(SDRHeader) + 11;
-
-// 						len = GetBits(*pTmp,5,0);
-// 						if(len)
-// 						{
-// 							pTmp++;
-
-// 							memcpy(pSELEntriesBuffer[q].SensorName,pTmp,len);
-// 							pSELEntriesBuffer[q].SensorName[len] = 0;
-
-// 						}
-// 						else
-// 							strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-// 					}
-// 				}
-// 			}
-// 			pSDRBuff += MaxSDRLen;
-// 		}
-// 	}
-// 	free(pSDRStart);
-// 	return wRet;
-// }
+	// first SEL record and complete record,
+	// starting at offset 0 of each record.
+	//uint32_t DataLen = 0;
+	uint16_t wRet = 0;
+	SDRRepositoryAllocInfo_T SDRAllocationInfo;
+	SDRRepositoryInfo_T SDRReposInfo;
+	int MaxSDRLen = 0;
+	int i,SDRCount = 0;
+	uint8_t *pSDRBuff = NULL;
+	SDRHeader *pSDRHeader = NULL;
+	uint8_t *pSDRStart = NULL;
+	uint32_t nNumSelEntries = 0;
+	int q = 0;
+
+
+	/***********************************Get all Sel Entries now*********************************************/
+	/* We want to read full records */
+	//DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
+
+	wRet = LIBIPMI_HL_AMIGetSELEntires(pUDSSession,pSELEntriesBuffer,&nNumSelEntries,timeout);
+	if(wRet != LIBIPMI_E_SUCCESS)
+	{
+		printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
+		return wRet;
+	}
+
+	
+	/*************************************Get The SDR once so that we can get sensor names*******************/
+	/* Get max buffer size to be allocated to read all SDRs in the system */
+	wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
+	if( wRet != 0 )
+	{
+		printf("Error getting SDR Repository Allocation Info\n");
+		return wRet;
+	}
+	printf("---> NumAllocUnits: %d, AllocUnitSize: %d, NumFreeAllocUnits: %d, LargestFreeBlock: %d, MaxRecSize: %d\n", \
+		SDRAllocationInfo.NumAllocUnits, SDRAllocationInfo.AllocUnitSize, SDRAllocationInfo.NumFreeAllocUnits, \
+		SDRAllocationInfo.LargestFreeBlock, SDRAllocationInfo.MaxRecSize);
+
+	/* Get repository information */
+	wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
+	if( wRet != 0 )
+	{
+		printf("Error getting SDR Repository Info\n");
+		return wRet;
+	}
+
+	/* Determine max SDR entry length */
+	MaxSDRLen = SDRAllocationInfo.MaxRecSize *  ( SDRAllocationInfo.AllocUnitSize );
+
+	/* Determine total number of SDRs stored */
+	SDRCount =  ( SDRReposInfo.RecCt );
+	printf("---> SDRCount: %d, MaxSDRLen: %d\n", SDRCount, MaxSDRLen);
+
+	/* Allocate the buffer */
+	pSDRBuff = (uint8_t *) malloc(MaxSDRLen * SDRCount);
+	if(!pSDRBuff)
+	{
+		printf("Error allocating memopry for SDRs in GetAllEventsWithSensorNames\n");
+		wRet = STATUS_CODE(IPMI_ERROR_FLAG,CC_OUT_OF_SPACE);
+		return wRet;
+	}
+	pSDRStart = pSDRBuff;
+
+	/* Call the function to read all the SDRs into this buffer */
+	wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
+                                     pSDRBuff,(MaxSDRLen * SDRCount),
+                                     timeout*4);
+
+	/*************************************Get The SDR once so that we can get sensor names*******************/
+
+	/******************Now parse through sensor headers and get names corresponding to each event************/
+	for(q=0;q<nNumSelEntries;q++)
+	{
+
+		strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
+
+		pSDRBuff = pSDRStart;
+		for( i = 0; i < SDRCount; i++)
+		{
+			pSDRHeader = (SDRHeader *) pSDRBuff;
+			if((pSDRHeader->RecordType >= 0x01) && (pSDRHeader->RecordType <= 0x03))
+			{
+				/* Compare SlaveAdd and LUNid fields */
+				uint8_t *pTmp = pSDRBuff + sizeof(SDRHeader);
+				uint8_t len = 0;
+
+
+
+				if((pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[0] == *pTmp) && (pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[1] == *(pTmp+1)))
+				{
+
+					/* Now compare the sensor number */
+					if(pSELEntriesBuffer[q].EventRecord.EvtRecord.SensorNum == *(pTmp+2))
+					{
+						/* Get the Name and return */
+						if(pSDRHeader->RecordType == 0x01)
+							pTmp = pSDRBuff + sizeof(SDRHeader) + 42;
+						else if(pSDRHeader->RecordType == 0x02)
+							pTmp = pSDRBuff + sizeof(SDRHeader) + 26;
+						else
+							pTmp = pSDRBuff + sizeof(SDRHeader) + 11;
+
+						len = GetBits(*pTmp,5,0);
+						if(len)
+						{
+							pTmp++;
+
+							memcpy(pSELEntriesBuffer[q].SensorName,pTmp,len);
+							pSELEntriesBuffer[q].SensorName[len] = 0;
+
+						}
+						else
+							strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
+					}
+				}
+			}
+			pSDRBuff += MaxSDRLen;
+		}
+	}
+	free(pSDRStart);
+	return wRet;
+}
 
 /*****************************************************************************
 	Field Replacement Unit (FRU)

+ 7 - 19
app/goahead-3.6.5/src/libipmi/src/libipmi_sdr.c

@@ -395,7 +395,7 @@ static uint16_t ipmb_get_sdr( IPMI20_UDS_SESSION_T *pUDSSession,
 		get_sdr_req.RecID =  ( record_id );
 		get_sdr_req.Offset = 0;
 		get_sdr_req.Size = 0xff;
-    		wRet = IPMICMD_GetSDR( pUDSSession, &get_sdr_req, pGetSDRRes,
+    	wRet = IPMICMD_GetSDR( pUDSSession, &get_sdr_req, pGetSDRRes,
                            dwDataLen, timeout );
 	}
 
@@ -432,38 +432,24 @@ static uint16_t ipmb_get_sdr( IPMI20_UDS_SESSION_T *pUDSSession,
         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
 
     
-    temp_buffer = malloc( max_sdr_len + sizeof( GetSDRRes_T ) );
+    temp_buffer = walloc( max_sdr_len + sizeof( GetSDRRes_T ) );
     if( temp_buffer == NULL )
         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
     
     get_sdr_res = (GetSDRRes_T *)temp_buffer;
-	// if(pUDSSession->byMediumType == NETWORK_MEDIUM_UDP_SAL)
- //    {
- //        blen = max_sdr_len + sizeof(GetSDRRes_T);
- //    }
-
-#if 0        
-    get_sdr_req.ReservationID = reservation.ReservationID;
-    get_sdr_req.RecID =  ( record_id );
-    get_sdr_req.Offset = 0;
-    get_sdr_req.Size = 0xff;
-
-    /* Now try to get the whole record */
-    wRet = IPMICMD_GetSDR( pUDSSession, &get_sdr_req, (GetSDRRes_T *)temp_buffer,
-                           &blen, timeout );
-#endif
     wRet = LIBIPMI_HL_GetSDR(pUDSSession,  (reservation.ReservationID),
     					record_id, (GetSDRRes_T *)temp_buffer, &blen, timeout);
     if( wRet != LIBIPMI_E_SUCCESS )
     {
-        free( temp_buffer );
+        printf("---> LIBIPMI_HL_GetSDR error!\n");
+        wfree( temp_buffer );
         return( wRet );
     }
 
     *next_record_id =  ( get_sdr_res->NextRecID );
 
     memcpy( sdr_buffer, temp_buffer + sizeof( GetSDRRes_T ), blen );
-    free( temp_buffer );
+    wfree( temp_buffer );
 
     return( wRet );
 }
@@ -501,6 +487,7 @@ static uint16_t ipmb_get_sdr( IPMI20_UDS_SESSION_T *pUDSSession,
     if( buffer_len < (size_t) ( max_sdr_len * sdr_count ) )
         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
 
+    //printf("---> LIBIPMI_HL_GetAllSDRs, max_sdr_len: %d, sdr_count: %d\n", max_sdr_len, sdr_count);
     /* Read all the SDRs in this loop */
     for( i = 0; i < sdr_count; i++ )
     {
@@ -510,6 +497,7 @@ static uint16_t ipmb_get_sdr( IPMI20_UDS_SESSION_T *pUDSSession,
         wRet = LIBIPMI_HL_GetCompleteSDR( pUDSSession, record_id, &next_record_id,
                                           &sdr_buffer[ i * max_sdr_len ],
                                           max_sdr_len, timeout );
+        //printf("---> i: %d, record_id: %d, next_record_id: %d\n", i, record_id, next_record_id);
         if( wRet != LIBIPMI_E_SUCCESS )
             return( wRet );
 

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

@@ -15,6 +15,8 @@
 #include "libipmi_sensor.h"
 #include "libipmi_storlead_OEM.h"
 #include "com_IPMI_Storlead.h"
+#include "libipmi_StorDevice.h"
+#include "com_BmcType.h"
 
 
 OemWebFlags_T g_OemWebFlags;
@@ -645,4 +647,170 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, SysInfo_T *pS
 // 		}
 // 	}
 // 	return (wRet);
-// }
+// }
+
+/*
+*@fn IPMICMD_AMIGetSELEntires
+*@brief
+*@param pSession - IPMI Session Handle
+*@param pAMIGetSelEntriesReq - Pointer to the request of AMI Get SEL Entries command
+*@param pAMIGetSelEntiresRes - Pointer to the response of AMI Get SEL Entries command
+*@param timeout - Timeout Value
+**/
+uint16_t IPMICMD_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq,
+											   AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes,int timeout)
+{
+	uint16_t wRet;
+	uint32_t dwResLen;
+	dwResLen = sizeof(AMIGetSELEntriesRes_T);
+	
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
+						NETFNLUN_IPMI_STORLEAD, CMD_GET_SEL_ENTIRES,
+						(uint8_t *)pAMIGetSelEntriesReq, sizeof(AMIGetSELEntriesReq_T),
+						(uint8_t*)pAMIGetSelEntiresRes, &dwResLen,
+						timeout);
+	
+	return (wRet);
+}
+
+
+/*
+*@fn LIBIPMI_HL_AMIGetSELEntires
+*@brief High Level command to retrieve the total SEL Entries
+*@param pSession - IPMI Session Handle
+*@param pSELEntriesBuffer - Pointer to hold the retrieved SEL Entries
+*@param nNumSelEntries - Pointer which hold the no. of SEL Entries retrieved
+*@param timeout - Timeout Value
+*@return Returns LIBIPMI_E_SUCCESS on success
+*@return Returns proper completion code on error
+**/
+uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventRecordWithSensorName_T *pSELEntriesBuffer,uint32_t *nNumSelEntries,int timeout)
+{
+	AMIGetSELEntriesReq_T pAMIGetSelEntriesReq = {0};
+	AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes;
+	SELEventRecordWithSensorName_T *CircSELEntries;
+	uint8_t *SELEntries;
+	uint16_t wRet = 0;
+	int j=0;
+	uint16_t i=0,recindex=0;
+	uint16_t LastRecID = 0xFFFF,MaxSELEntries=0;
+	
+	SELEntries = (uint8_t *)malloc(MAX_SEL_RECORD);
+	if(SELEntries == NULL)
+	{
+		printf("Memory allocation error in LIBIPMI_HL_AMIGetSELEntires \n");
+		wRet = 0xFF;
+		return wRet;
+	}
+	
+	memset(SELEntries,0,MAX_SEL_RECORD);
+	pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)SELEntries;
+	
+	do
+	{
+		wRet = IPMICMD_AMIGetSELEntires(pUDSSession,&pAMIGetSelEntriesReq,(AMIGetSELEntriesRes_T *)SELEntries,timeout);
+		if(wRet == LIBIPMI_E_SUCCESS)
+		{
+			for(i = 0; i < pAMIGetSelEntiresRes->Noofentries; i++)
+			{
+				memcpy((uint8_t *)&pSELEntriesBuffer[i+*nNumSelEntries].EventRecord,&(SELEntries)[sizeof(AMIGetSELEntriesRes_T) + (i * sizeof(SELRec_T))],
+							   sizeof(SELRec_T));
+			}
+	
+			if(pAMIGetSelEntriesReq.Noofentretrieved == 0x00)
+			{
+				LastRecID = pAMIGetSelEntiresRes->LastRecID;
+			}
+	
+			if(pAMIGetSelEntiresRes->Status == FULL_SEL_ENTRIES)
+			{
+				*nNumSelEntries += pAMIGetSelEntiresRes->Noofentries;
+				break;
+			}
+			else
+			{
+				*nNumSelEntries += pAMIGetSelEntiresRes->Noofentries;
+				pAMIGetSelEntriesReq.Noofentretrieved = *nNumSelEntries;
+				memset(SELEntries,0,MAX_SEL_RECORD);
+				continue;
+			}
+		}
+		else if((wRet & 0xFF) == LIBIPMI_E_SEL_CLEARED)
+		{
+			memset(SELEntries,0,MAX_SEL_RECORD);
+			memset((uint8_t*)&pSELEntriesBuffer[0],0,sizeof(SELEventRecordWithSensorName_T) * *nNumSelEntries);
+			*nNumSelEntries =  pAMIGetSelEntriesReq.Noofentretrieved = 0;
+			continue;
+		}
+		else if((wRet & 0xFF)  == LIBIPMI_E_SEL_EMPTY)
+		{
+			/* Returning LIBIPMI_E_SUCCESS when sel repo is empty as
+				 per WebUI expectations. Will be removed once changes are made in WebUI*/
+			wRet = LIBIPMI_E_SUCCESS;
+			return wRet;
+		}
+		else
+		{
+			break;
+		}
+	}while(1);
+	
+	free(SELEntries);
+	
+	
+	if(wRet == LIBIPMI_E_SUCCESS)
+	{
+		if(LastRecID != 0xFFFF)
+		{
+			wRet = LIBIPMI_HL_GetMaxPossibleSELEntries(pUDSSession,&MaxSELEntries,timeout);
+			if(wRet == LIBIPMI_E_SUCCESS)
+			{
+				 if(LastRecID > MaxSELEntries)
+				{
+					for(i = 0; i < *nNumSelEntries; i++)
+					{
+						if(pSELEntriesBuffer[i].EventRecord.EvtRecord.hdr.ID == LastRecID)
+						{
+							recindex = i;
+							break;
+						}
+					}
+	
+					/* Last Record is not found if reached till end of SEL Entries*/
+					if(i == *nNumSelEntries)
+					{
+						wRet = 0xFF;
+						return wRet;
+					}
+	
+					/*SEL Records added lastely will be displayed first */
+					CircSELEntries = (SELEventRecordWithSensorName_T *)malloc (sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
+					if(CircSELEntries != NULL)
+					{
+						memset(CircSELEntries,0,sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
+						j = recindex; i = 0;
+						while(j >= 0)
+						{
+							memcpy((uint8_t *)&CircSELEntries[i],(uint8_t*)&pSELEntriesBuffer[j],sizeof(SELEventRecordWithSensorName_T));
+							j--;i++;
+						}
+	
+						for(j = recindex + 1,i = 1; j < *nNumSelEntries; j++,i++)
+						{
+							memcpy((uint8_t*)&CircSELEntries[j],(uint8_t*)&pSELEntriesBuffer[*nNumSelEntries - i ],sizeof(SELEventRecordWithSensorName_T));
+						}
+	
+						for(i = 0,j=1;i< *nNumSelEntries; i++,j++)
+						{
+							memcpy((uint8_t*)&pSELEntriesBuffer[i],(uint8_t*)&CircSELEntries[*nNumSelEntries - j],sizeof(SELEventRecordWithSensorName_T));
+						}
+	
+						free(CircSELEntries);
+					}
+				}
+			}
+		}
+	}
+	
+	return (wRet);
+}

+ 3 - 0
app/goahead-3.6.5/src/web_interface/inc/sel.h

@@ -3,4 +3,7 @@
 
 #include "goahead.h"
 
+void Web_ClearSEL(Webs *wp);
+void GetAllSELEntriesSorted(Webs *wp);
+
 #endif /* __SEL_H__ */

+ 22 - 23
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -267,7 +267,7 @@ void getSensorInfo(Webs *wp){
                 sprintf(highnr, "%.3f", pSensorBuff->high_non_recov_thresh);
 
                 cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
-                //cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num); 
+                cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num); 
                 cJSON_AddStringToObject(pJsonsub, "sensorName", pSensorBuff->sensor_name);
 
                 //cJSON_AddNumberToObject(pJsonsub, "ownerId",    pSensorBuff->owner_id);
@@ -283,35 +283,36 @@ void getSensorInfo(Webs *wp){
                 //cJSON_AddNumberToObject(pJsonsub, "SensorAccessibleFlags", pSensorBuff->SensorAccessibleFlags); 
                 cJSON_AddStringToObject(pJsonsub, "reading", reading);      /* 给对象增加内容 */    
                 cJSON_AddStringToObject(pJsonsub, "lownr", lownr);                                        
-                cJSON_AddStringToObject(pJsonsub, "lowct", lowct);                                                         
+                cJSON_AddStringToObject(pJsonsub, "lowct", lowct);   
+                cJSON_AddStringToObject(pJsonsub, "lownc", lownc);                                                       
                 cJSON_AddStringToObject(pJsonsub, "highnc", highnc);                 
                 cJSON_AddStringToObject(pJsonsub, "highct", highct);   
                 cJSON_AddStringToObject(pJsonsub, "highnr", highnr);  
 
                 switch(pSensorBuff->sensor_units[1])    //sensorUinits2
                 {
-                case 0: cJSON_AddStringToObject(pJsonsub, "Unit", "unspecified"); break;                    
-                case 1: cJSON_AddStringToObject(pJsonsub, "Unit", "degree C"); break;
-                case 2: cJSON_AddStringToObject(pJsonsub, "Unit", "degree F"); break;
-                case 3: cJSON_AddStringToObject(pJsonsub, "Unit", "degree K"); break;
-                case 4: cJSON_AddStringToObject(pJsonsub, "Unit", "Volts"); break;
-                case 5: cJSON_AddStringToObject(pJsonsub, "Unit", "Amps"); break;
-                case 6: cJSON_AddStringToObject(pJsonsub, "Unit", "Watts"); break;
-                case 18: cJSON_AddStringToObject(pJsonsub, "Unit", "RPM"); break;
-                default: cJSON_AddStringToObject(pJsonsub, "Unit", "unknown"); break;
+                case 0: cJSON_AddStringToObject(pJsonsub, "unit", "unspecified"); break;                    
+                case 1: cJSON_AddStringToObject(pJsonsub, "unit", "degree C"); break;
+                case 2: cJSON_AddStringToObject(pJsonsub, "unit", "degree F"); break;
+                case 3: cJSON_AddStringToObject(pJsonsub, "unit", "degree K"); break;
+                case 4: cJSON_AddStringToObject(pJsonsub, "unit", "Volts"); break;
+                case 5: cJSON_AddStringToObject(pJsonsub, "unit", "Amps"); break;
+                case 6: cJSON_AddStringToObject(pJsonsub, "unit", "Watts"); break;
+                case 18: cJSON_AddStringToObject(pJsonsub, "unit", "RPM"); break;
+                default: cJSON_AddStringToObject(pJsonsub, "unit", "unknown"); break;
                 }
 
                 switch(pSensorBuff->sensor_state)
                 {
-                case 0x1:  cJSON_AddStringToObject(pJsonsub, "State", "ok"); break;
-                case 0x2:  cJSON_AddStringToObject(pJsonsub, "State", "Upper Non-Critical"); break;    
-                case 0x4:  cJSON_AddStringToObject(pJsonsub, "State", "Upper Critical Threshold"); break;    
-                case 0x8:  cJSON_AddStringToObject(pJsonsub, "State", "Lower Non-Critical"); break;    
-                case 0x10:  cJSON_AddStringToObject(pJsonsub, "State", "Lower Critical"); break;    
-                case 0x20:  cJSON_AddStringToObject(pJsonsub, "State", "Access failed"); break;    
-                case 0x40:  cJSON_AddStringToObject(pJsonsub, "State", "Upper Non-Recoverable"); break;    
-                case 0x80:  cJSON_AddStringToObject(pJsonsub, "State", "Lower Non-Recoverable"); break;    
-                default:  cJSON_AddNumberToObject(pJsonsub, "State", pSensorBuff->sensor_state); break;      
+                case 0x1:  cJSON_AddStringToObject(pJsonsub, "state", "ok"); break;
+                case 0x2:  cJSON_AddStringToObject(pJsonsub, "state", "Upper Non-Critical"); break;    
+                case 0x4:  cJSON_AddStringToObject(pJsonsub, "state", "Upper Critical Threshold"); break;    
+                case 0x8:  cJSON_AddStringToObject(pJsonsub, "state", "Lower Non-Critical"); break;    
+                case 0x10:  cJSON_AddStringToObject(pJsonsub, "state", "Lower Critical"); break;    
+                case 0x20:  cJSON_AddStringToObject(pJsonsub, "state", "Access failed"); break;    
+                case 0x40:  cJSON_AddStringToObject(pJsonsub, "state", "Upper Non-Recoverable"); break;    
+                case 0x80:  cJSON_AddStringToObject(pJsonsub, "state", "Lower Non-Recoverable"); break;    
+                default:  cJSON_AddNumberToObject(pJsonsub, "state", pSensorBuff->sensor_state); break;      
                 }
          
                 pSensorBuff++;
@@ -324,7 +325,7 @@ void getSensorInfo(Webs *wp){
             // pStr = cJSON_Print(pJsonArry);
             cJSON_AddItemToObject(root, "data", pJsonArry);
             pStr = cJSON_PrintUnformatted(root);
-            printf("---> pStr %d: %s\n", strlen(pStr), pStr);
+            // printf("---> pStr %d: %s\n", strlen(pStr), pStr);
 
             websSetStatus(wp, 200);
             websWriteHeaders(wp, -1, 0);
@@ -347,8 +348,6 @@ error_out:
     
 }
 
-
-
 void buy(Webs *wp)
 {
     char    *name, *age;

+ 175 - 0
app/goahead-3.6.5/src/web_interface/src/sel.c

@@ -0,0 +1,175 @@
+#include    "goahead.h"
+#include    "libipmi_IPM.h"
+#include    "com_IPMIDefs.h"
+#include    "ResultUtils.h"
+#include    "cJSON.h"
+#include    "libipmi_storlead_OEM.h"
+#include    "libsensor.h"
+#include    <stdio.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include "sel.h"
+#include "libipmi_StorDevice.h"
+
+void Web_ClearSEL(Webs *wp)
+{
+	int wRet = 0;
+
+	IPMI20_UDS_SESSION_T    UDSSession;
+
+	//Create session
+    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+
+    //get firmware version
+    wRet = IPMICMD_ClearSEL( &UDSSession, DEFAULT_TIMEOUT);
+    if(wRet != 0)
+		printf("Error trying to clear SEL!! %x\n", wRet);
+    //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);
+
+    if(wRet != 0)
+    	cJSON_AddStringToObject(data, "status", "fail");
+    else
+    	cJSON_AddStringToObject(data, "status", "success");
+
+    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);
+
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+}
+
+void GetAllSELEntriesSorted(Webs *wp)
+{
+	int wRet = 0;
+	unsigned short nEntries = 0;
+	SELEventRecordWithSensorName_T *pSELBuff = NULL;
+	uint8 *pStartBuff = NULL;
+	uint16 nMaxEntries = 0;
+	IPMI20_UDS_SESSION_T    UDSSession;
+
+	
+
+	//Create session
+    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+	/* Get number of SEL records in the system at this time */
+	wRet = LIBIPMI_HL_GetNumOfSELEntries(&UDSSession, &nEntries, DEFAULT_TIMEOUT);
+	if(wRet != 0)
+	{
+		printf("Error getting num of sel recods\n");
+		goto error_out;
+	}
+	else
+	{
+		printf("success getting num of sel recods: %d\n",nEntries);
+		/* Now get all sel records */
+		//now find maximum possible sel entries and allocate that much
+		wRet = LIBIPMI_HL_GetMaxPossibleSELEntries(&UDSSession,&nMaxEntries,DEFAULT_TIMEOUT);
+		if(wRet != 0)
+		{
+			printf("Error getting maximum no of entries..assuming 1024\n");
+			nMaxEntries = 1024;
+		}
+		else
+		{
+			printf("MAX Possible SEL entries : %d\n",nMaxEntries);
+		}
+
+		if(!nEntries)
+		{
+			/* There are no entries present at this time */
+			goto error_out;
+		}
+
+		/* Allocate the buffer to hold SEL entries */
+		pSELBuff = (SELEventRecordWithSensorName_T *) walloc(nMaxEntries * sizeof(SELEventRecordWithSensorName_T));
+		if(pSELBuff == NULL)
+		{
+			printf("Error allocating memory for SEL entries!!\n");
+			wRet = -1;
+			goto error_out;
+		}
+		pStartBuff = (uint8 *)pSELBuff;
+
+		printf("before get all sel entried\n");
+		/* Now pass this buffer pointer to the function to get all SEL entries */
+		wRet = LIBIPMI_HL_GetAllSelEntriesWithSensorNames(&UDSSession, pSELBuff, DEFAULT_TIMEOUT);
+		if(wRet == 0)
+		{
+			char *pStr;
+		    int code = 200;
+		    cJSON * root =  cJSON_CreateObject();
+		    cJSON  *pJsonArry,*pJsonsub;
+		    pJsonArry=cJSON_CreateArray();   /*创建数组*/
+			/* Write entries here */
+			while(nEntries)
+			{
+				if(pSELBuff[nEntries-1].EventRecord.Valid != 0xA5)
+				{
+					cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
+                	cJSON_AddNumberToObject(pJsonsub, "RecordID", pSELBuff[nEntries-1].EventRecord.EvtRecord.hdr.ID);
+                	cJSON_AddNumberToObject(pJsonsub, "RecordType", pSELBuff[nEntries-1].EventRecord.EvtRecord.hdr.Type);
+                	cJSON_AddNumberToObject(pJsonsub, "TimeStamp", pSELBuff[nEntries-1].EventRecord.EvtRecord.hdr.TimeStamp);
+                	cJSON_AddNumberToObject(pJsonsub, "GenID1", pSELBuff[nEntries-1].EventRecord.EvtRecord.GenID[0]);
+                	cJSON_AddNumberToObject(pJsonsub, "GenID2", pSELBuff[nEntries-1].EventRecord.EvtRecord.GenID[1]);
+                	cJSON_AddNumberToObject(pJsonsub, "EvmRev", pSELBuff[nEntries-1].EventRecord.EvtRecord.EvMRev);
+					cJSON_AddNumberToObject(pJsonsub, "SensorType", pSELBuff[nEntries-1].EventRecord.EvtRecord.SensorType);
+					cJSON_AddStringToObject(pJsonsub, "SensorName", pSELBuff[nEntries-1].SensorName);
+					cJSON_AddNumberToObject(pJsonsub, "EventDirType", pSELBuff[nEntries-1].EventRecord.EvtRecord.EvtDirType);
+					cJSON_AddNumberToObject(pJsonsub, "EventData1", pSELBuff[nEntries-1].EventRecord.EvtRecord.EvtData1);
+					cJSON_AddNumberToObject(pJsonsub, "EventData2", pSELBuff[nEntries-1].EventRecord.EvtRecord.EvtData2);
+					cJSON_AddNumberToObject(pJsonsub, "EventData3", pSELBuff[nEntries-1].EventRecord.EvtRecord.EvtData3);							
+				}
+				nEntries--;
+			}
+
+			cJSON_AddItemToObject(root, "data", pJsonArry);
+		    pStr = cJSON_PrintUnformatted(root);
+		    printf("---> pStr %d: %s\n", strlen(pStr), pStr);
+
+		    websSetStatus(wp, 200);
+		    websWriteHeaders(wp, -1, 0);
+		    websWriteEndHeaders(wp); 
+		    websWrite(wp, pStr);
+		    websDone(wp);
+
+		    if(root)
+		        cJSON_Delete(root);
+		    if(pStr)
+		    	wfree(pStr);
+		}
+		else
+		{
+			printf("Error reading All SEL entries\n");
+		}
+		wfree(pStartBuff);
+	}
+
+	//Close session
+    LIBIPMI_CloseSession(&UDSSession );
+
+	return;
+
+error_out:
+	websError(wp, 404, "Get SEL error!");
+
+}
+

+ 15 - 1
app/ipmitool-1.8.18/Makefile

@@ -10,6 +10,9 @@ CC	:= $(CROSS_COMPILE_APPS)gcc
 #source
 SRC	:= src/ipmitool.c
 SRC += src/plugins/ipmi_intf.c
+SRC += src/plugins/lan/lan.c
+SRC += src/plugins/lan/auth.c
+SRC += src/plugins/lan/md5.c
 #SRC += lib/log.c
 SRC += lib/helper.c
 SRC += lib/ipmi_strings.c
@@ -17,7 +20,7 @@ SRC += lib/ipmi_main.c
 SRC += lib/ipmi_raw.c
 
 #SRC += lib/ipmi_delloem.c
-#SRC += lib/ipmi_oem.c
+SRC += lib/ipmi_oem.c
 SRC += lib/ipmi_sdr.c
 #SRC += lib/ipmi_sel.c
 SRC += lib/dimm_spd.c
@@ -25,6 +28,7 @@ SRC += lib/ipmi_sdradd.c
 SRC += lib/ipmi_sel.c
 SRC += lib/ipmi_sensor.c
 SRC += lib/ipmi_fru.c
+SRC += lib/hpm2.c
 
 
 
@@ -35,6 +39,16 @@ SRC += lib/ipmi_fru.c
 #incldue
 CFLAGS	+= -I$(INSTALL_ROOT)/A2F/root/usr/include
 CFLAGS	+= -I ./include
+CFLAGS  += -I ./src/plugins/lan
+CFLAGS  += -I ./src/plugins/bmc
+CFLAGS  += -I ./src/plugins/dummy
+CFLAGS  += -I ./src/plugins/free
+CFLAGS  += -I ./src/plugins/imb
+CFLAGS  += -I ./src/plugins/lanplus
+CFLAGS  += -I ./src/plugins/lipmi
+CFLAGS  += -I ./src/plugins/open
+CFLAGS  += -I ./src/plugins/serial
+CFLAGS  += -I ./src/plugins/usb
 
 
 

+ 4 - 0
app/ipmitool-1.8.18/include/ipmitool/ipmi.h

@@ -41,6 +41,10 @@
 #include <ipmitool/helper.h>
 #include <ipmitool/ipmi_cc.h>
 
+/****************** jimbo add ******************/
+#define IPMI_INTF_LAN 1
+#define ENABLE_ALL_OPTIONS 1
+/****************** jimbo end ******************/
 
 #define IPMI_BUF_SIZE 1024
 #define IPMI_MAX_MD_SIZE 0x20

BIN
app/ipmitool-1.8.18/ipmitool


+ 4 - 1
app/ipmitool-1.8.18/jimbo note

@@ -1 +1,4 @@
-1. not support ipmi shell
+
+UDP通信,IPPROTO_UDP
+SOCK_DGRAM
+IPV4

+ 20 - 20
app/ipmitool-1.8.18/lib/hpm2.c

@@ -33,7 +33,7 @@
 #include <ipmitool/bswap.h>
 #include <ipmitool/hpm2.h>
 #include <ipmitool/ipmi_intf.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 #include <ipmitool/bswap.h>
 
 /* From src/plugins/ipmi_intf.c: */
@@ -91,28 +91,28 @@ int hpm2_get_capabilities(struct ipmi_intf * intf,
 	rsp = intf->sendrecv(intf, &req);
 
 	if (!rsp) {
-		lprintf(LOG_NOTICE, "Error sending request.");
+		printf(  "Error sending request.");
 		return -1;
 	}
 
 	if (rsp->ccode == 0xC1) {
-		lprintf(LOG_DEBUG, "IPM Controller is not HPM.2 compatible");
+		printf(  "IPM Controller is not HPM.2 compatible");
 		return rsp->ccode;
 	} else if (rsp->ccode) {
-		lprintf(LOG_NOTICE, "Get HPM.x Capabilities request failed,"
+		printf(  "Get HPM.x Capabilities request failed,"
 				" compcode = %x", rsp->ccode);
 		return rsp->ccode;
 	}
 
 	/* check response length */
 	if (rsp->data_len < 2 || rsp->data_len > 10) {
-		lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
+		printf(  "Bad response length, len=%d", rsp->data_len);
 		return -1;
 	}
 
 	/* check HPM.x identifier */
 	if (rsp->data[1] != 2) {
-		lprintf(LOG_NOTICE, "Bad HPM.x ID, id=%d", rsp->data[1]);
+		printf(  "Bad HPM.x ID, id=%d", rsp->data[1]);
 		return rsp->ccode;
 	}
 
@@ -121,7 +121,7 @@ int hpm2_get_capabilities(struct ipmi_intf * intf,
 	 * but check for safety
 	 */
 	if (rsp->data_len < 4) {
-		lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
+		printf(  "Bad response length, len=%d", rsp->data_len);
 		return -1;
 	}
 
@@ -135,7 +135,7 @@ int hpm2_get_capabilities(struct ipmi_intf * intf,
 
 	/* check HPM.2 revision */
 	if (caps->hpm2_revision_id == 0) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 revision, rev=%d",
+		printf(  "Bad HPM.2 revision, rev=%d",
 				caps->hpm2_revision_id);
 		return -1;
 	}
@@ -146,20 +146,20 @@ int hpm2_get_capabilities(struct ipmi_intf * intf,
 
 	/* check response length */
 	if (rsp->data_len < 8) {
-		lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
+		printf(  "Bad response length, len=%d", rsp->data_len);
 		return -1;
 	}
 
 	/* check HPM.2 LAN parameters start */
 	if (caps->hpm2_lan_params_start < 0xC0) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 LAN params start, start=%x",
+		printf(  "Bad HPM.2 LAN params start, start=%x",
 				caps->hpm2_lan_params_start);
 		return -1;
 	}
 
 	/* check HPM.2 LAN parameters revision */
 	if (caps->hpm2_lan_params_rev != HPM2_LAN_PARAMS_REV) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 LAN params revision, rev=%d",
+		printf(  "Bad HPM.2 LAN params revision, rev=%d",
 				caps->hpm2_lan_params_rev);
 		return -1;
 	}
@@ -172,20 +172,20 @@ int hpm2_get_capabilities(struct ipmi_intf * intf,
 
 	/* check response length */
 	if (rsp->data_len < 10) {
-		lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
+		printf(  "Bad response length, len=%d", rsp->data_len);
 		return -1;
 	}
 
 	/* check HPM.2 SOL parameters start */
 	if (caps->hpm2_sol_params_start < 0xC0) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 SOL params start, start=%x",
+		printf(  "Bad HPM.2 SOL params start, start=%x",
 				caps->hpm2_sol_params_start);
 		return -1;
 	}
 
 	/* check HPM.2 SOL parameters revision */
 	if (caps->hpm2_sol_params_rev != HPM2_SOL_PARAMS_REV) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 SOL params revision, rev=%d",
+		printf(  "Bad HPM.2 SOL params revision, rev=%d",
 				caps->hpm2_sol_params_rev);
 		return -1;
 	}
@@ -220,29 +220,29 @@ int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf,
 	rsp = intf->sendrecv(intf, &req);
 
 	if (!rsp) {
-		lprintf(LOG_NOTICE, "Error sending request.");
+		printf(  "Error sending request.");
 		return -1;
 	}
 
 	if (rsp->ccode == 0x80) {
-		lprintf(LOG_DEBUG, "HPM.2 Channel Caps parameter is not supported");
+		printf(  "HPM.2 Channel Caps parameter is not supported");
 		return rsp->ccode;
 	} else if (rsp->ccode) {
-		lprintf(LOG_NOTICE, "Get LAN Configuration Parameters request failed,"
+		printf(  "Get LAN Configuration Parameters request failed,"
 				" compcode = %x", rsp->ccode);
 		return rsp->ccode;
 	}
 
 	/* check response length */
 	if (rsp->data_len != sizeof (struct hpm2_lan_channel_capabilities) + 1) {
-		lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
+		printf(  "Bad response length, len=%d", rsp->data_len);
 		return -1;
 	}
 
 	/* check parameter revision */
 	if (rsp->data[0] !=
 			LAN_PARAM_REV(HPM2_LAN_PARAMS_REV, HPM2_LAN_PARAMS_REV)) {
-		lprintf(LOG_NOTICE, "Bad HPM.2 LAN parameter revision, rev=%d",
+		printf(  "Bad HPM.2 LAN parameter revision, rev=%d",
 				rsp->data[0]);
 		return -1;
 	}
@@ -289,7 +289,7 @@ int hpm2_detect_max_payload_size(struct ipmi_intf * intf)
 			channel_caps.max_outbound_pld_size - 8);
 
 	/* print debug info */
-	lprintf(LOG_DEBUG, "Set maximum request size to %d\n"
+	printf(  "Set maximum request size to %d\n"
 			"Set maximum response size to %d",
 			intf->max_request_data_size, intf->max_response_data_size);
 

+ 46 - 43
app/ipmitool-1.8.18/lib/ipmi_main.c

@@ -66,7 +66,7 @@
 // #include <ipmitool/ipmi_user.h>
 // #include <ipmitool/ipmi_raw.h>
 // #include <ipmitool/ipmi_pef.h>
-// #include <ipmitool/ipmi_oem.h>
+#include <ipmitool/ipmi_oem.h>
 
 //#include <ipmitool/ipmi_ekanalyzer.h>
 //#include <ipmitool/ipmi_picmg.h>
@@ -87,9 +87,6 @@
 # define OPTION_STRING	"I:46hVvcH:f:U:p:d:S:D:"
 #endif
 
-/**** jimbo add ****/
-#define ENABLE_ALL_OPTIONS 1
-
 /* From src/plugins/ipmi_intf.c: */
 void
 ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size);
@@ -228,47 +225,47 @@ ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_
 {
 	printf("%s version %s\n", progname, VERSION);
 	printf( "usage: %s [options...] <command>\n", progname);
-	printf( "       -h             This help");
-	printf( "       -V             Show version information");
-	printf( "       -v             Verbose (can use multiple times)");
-	printf( "       -c             Display output in comma separated format");
-	printf( "       -d N           Specify a /dev/ipmiN device to use (default=0)");
-	printf( "       -I intf        Interface to use");
-	printf( "       -H hostname    Remote host name for LAN interface");
-	printf( "       -p port        Remote RMCP port [default=623]");
-	printf( "       -U username    Remote session username");
-	printf( "       -f file        Read remote session password from file");
-	printf( "       -z size        Change Size of Communication Channel (OEM)");
-	printf( "       -S sdr         Use local file for remote SDR cache");
-	printf( "       -D tty:b[:s]   Specify the serial device, baud rate to use");
-	printf( "                      and, optionally, specify that interface is the system one");
-	printf( "       -4             Use only IPv4");
-	printf( "       -6             Use only IPv6");
+	printf( "       -h             This help\n");
+	printf( "       -V             Show version information\n");
+	printf( "       -v             Verbose (can use multiple times)\n");
+	printf( "       -c             Display output in comma separated format\n");
+	printf( "       -d N           Specify a /dev/ipmiN device to use (default=0)\n");
+	printf( "       -I intf        Interface to use\n");
+	printf( "       -H hostname    Remote host name for LAN interface\n");
+	printf( "       -p port        Remote RMCP port [default=623]\n");
+	printf( "       -U username    Remote session username\n");
+	printf( "       -f file        Read remote session password from file\n");
+	printf( "       -z size        Change Size of Communication Channel (OEM)\n");
+	printf( "       -S sdr         Use local file for remote SDR cache\n");
+	printf( "       -D tty:b[:s]   Specify the serial device, baud rate to use\n");
+	printf( "                      and, optionally, specify that interface is the system one\n");
+	printf( "       -4             Use only IPv4\n");
+	printf( "       -6             Use only IPv6\n");
 #ifdef ENABLE_ALL_OPTIONS
-	printf( "       -a             Prompt for remote password");
-	printf( "       -Y             Prompt for the Kg key for IPMIv2 authentication");
-	printf( "       -e char        Set SOL escape character");
-	printf( "       -C ciphersuite Cipher suite to be used by lanplus interface");
-	printf( "       -k key         Use Kg key for IPMIv2 authentication");
-	printf( "       -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication");
-	printf( "       -L level       Remote session privilege level [default=ADMINISTRATOR]");
-	printf( "                      Append a '+' to use name/privilege lookup in RAKP1");
-	printf( "       -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM");
-	printf( "       -P password    Remote session password");
-	printf( "       -E             Read password from IPMI_PASSWORD environment variable");
-	printf( "       -K             Read kgkey from IPMI_KGKEY environment variable");
-	printf( "       -m address     Set local IPMB address");
-	printf( "       -b channel     Set destination channel for bridged request");
-	printf( "       -t address     Bridge request to remote target address");
-	printf( "       -B channel     Set transit channel for bridged request (dual bridge)");
-	printf( "       -T address     Set transit address for bridge request (dual bridge)");
-	printf( "       -l lun         Set destination lun for raw commands");
-	printf( "       -o oemtype     Setup for OEM (use 'list' to see available OEM types)");
-	printf( "       -O seloem      Use file for OEM SEL event descriptions");
-	printf( "       -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface");
-	printf( "       -R retry       Set the number of retries for lan/lanplus interface [default=4]");
+	printf( "       -a             Prompt for remote password\n");
+	printf( "       -Y             Prompt for the Kg key for IPMIv2 authentication\n");
+	printf( "       -e char        Set SOL escape character\n");
+	printf( "       -C ciphersuite Cipher suite to be used by lanplus interface\n");
+	printf( "       -k key         Use Kg key for IPMIv2 authentication\n");
+	printf( "       -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication\n");
+	printf( "       -L level       Remote session privilege level [default=ADMINISTRATOR]\n");
+	printf( "                      Append a '+' to use name/privilege lookup in RAKP1\n");
+	printf( "       -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM\n");
+	printf( "       -P password    Remote session password\n");
+	printf( "       -E             Read password from IPMI_PASSWORD environment variable\n");
+	printf( "       -K             Read kgkey from IPMI_KGKEY environment variable\n");
+	printf( "       -m address     Set local IPMB address\n");
+	printf( "       -b channel     Set destination channel for bridged request\n");
+	printf( "       -t address     Bridge request to remote target address\n");
+	printf( "       -B channel     Set transit channel for bridged request (dual bridge)\n");
+	printf( "       -T address     Set transit address for bridge request (dual bridge)\n");
+	printf( "       -l lun         Set destination lun for raw commands\n");
+	printf( "       -o oemtype     Setup for OEM (use 'list' to see available OEM types)\n");
+	printf( "       -O seloem      Use file for OEM SEL event descriptions\n");
+	printf( "       -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface\n");
+	printf( "       -R retry       Set the number of retries for lan/lanplus interface [default=4]\n");
 #endif
-	printf( "");
+	printf( "\n");
 
 	ipmi_intf_print(intflist);
 
@@ -634,6 +631,7 @@ ipmi_main(int argc, char ** argv,
 // 			oemtype = strdup("supermicro");
 // 			break;
 		case 'P':
+
 			if (password) {
 				free(password);
 				password = NULL;
@@ -647,6 +645,7 @@ ipmi_main(int argc, char ** argv,
 			/* Prevent password snooping with ps */
 			i = strlen(optarg);
 			memset(optarg, 'X', i);
+			printf("---> get P: %s\n", password);
 			break;
 		// case 'E':
 		// 	if ((tmp_env = getenv("IPMITOOL_PASSWORD"))) {
@@ -817,6 +816,7 @@ ipmi_main(int argc, char ** argv,
 	 * otherwise the default is hardcoded
 	 * to use the first entry in the list
 	 */
+
 	if (intfname == NULL && hostname != NULL) {
 		intfname = strdup("lan");
 		if (intfname == NULL) {
@@ -838,6 +838,7 @@ ipmi_main(int argc, char ** argv,
 	} /* if (password != NULL && intfname != NULL) */
 
 	/* load interface */
+		printf("---> intfname: %s, hostname: %s, username: %s, password: %s\n", intfname, hostname, username, password);
 	ipmi_main_intf = ipmi_intf_load(intfname);
 	if (ipmi_main_intf == NULL) {
 		printf( "Error loading interface %s", intfname);
@@ -881,6 +882,8 @@ ipmi_main(int argc, char ** argv,
 //	ipmi_intf_session_set_sol_escape_char(ipmi_main_intf, sol_escape_char);
 	ipmi_intf_session_set_cipher_suite_id(ipmi_main_intf, cipher_suite_id);
 
+	printf("---> port: %d, authtype: %d, privlvl: %d, retry: %d\n", port, authtype, privlvl, retry);
+
 	ipmi_main_intf->devnum = devnum;
 
 	/* setup device file if given */

+ 6 - 6
app/ipmitool-1.8.18/lib/ipmi_oem.c

@@ -33,7 +33,7 @@
 #include <ipmitool/ipmi.h>
 #include <ipmitool/ipmi_intf.h>
 #include <ipmitool/ipmi_constants.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 #include <ipmitool/helper.h>
 #include <ipmitool/ipmi_sel.h>
 
@@ -87,7 +87,7 @@ ipmi_oem_ibm(struct ipmi_intf * intf)
 {
 	char * filename;
 	if ((filename = getenv("IPMI_OEM_IBM_DATAFILE")) == NULL) {
-		lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
+		printf(  "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
 		return -1;
 	}
 	return ipmi_sel_oem_init((const char *)filename);
@@ -99,11 +99,11 @@ void
 ipmi_oem_print(void)
 {
 	struct ipmi_oem_handle * oem;
-	lprintf(LOG_NOTICE, "\nOEM Support:");
+	printf(  "\nOEM Support:");
 	for (oem=ipmi_oem_list; oem->name != NULL && oem->desc != NULL; oem++) {
-		lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
+		printf(  "\t%-12s %s", oem->name, oem->desc);
 	}
-	lprintf(LOG_NOTICE, "");
+	printf(  "");
 }
 
 /* ipmi_oem_setup  -  do initial setup of OEM handle
@@ -140,7 +140,7 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
 
 	/* run optional setup function if it is defined */
 	if (oem->setup != NULL) {
-		lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
+		printf(  "Running OEM setup for \"%s\"", oem->desc);
 		rc = oem->setup(intf);
 	}
 

+ 18 - 134
app/ipmitool-1.8.18/src/plugins/ipmi_intf.c

@@ -39,20 +39,20 @@
 #if defined(HAVE_CONFIG_H)
 # include <config.h>
 #endif
+#include <ipmitool/ipmi.h>
 
 #if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <ifaddrs.h>
+//#include <ifaddrs.h>
 #include <unistd.h>
 #include <netdb.h>
 #endif
 
 
 #include <ipmitool/ipmi_intf.h>
-#include <ipmitool/ipmi.h>
 #include <ipmitool/ipmi_sdr.h>
 //#include <ipmitool/log.h>
 
@@ -322,12 +322,7 @@ int
 ipmi_intf_socket_connect(struct ipmi_intf * intf)
 {
 	struct ipmi_session_params *params;
-
-	struct sockaddr_storage addr;
-	struct addrinfo hints;
-	struct addrinfo *rp0 = NULL, *rp;
-	char service[NI_MAXSERV];
-
+	struct sockaddr_in servaddr;
 	if (!intf) {
 		return -1;
 	}
@@ -339,135 +334,24 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 		return -1;
 	}
 
-	/* open port to BMC */
-	memset(&addr, 0, sizeof(addr));
-
-	sprintf(service, "%d", params->port);
-	/* Obtain address(es) matching host/port */
-	memset(&hints, 0, sizeof(hints));
-	hints.ai_family   = intf->ai_family;    /* Allow IPv4 or IPv6 */
-	hints.ai_socktype = SOCK_DGRAM;   /* Datagram socket */
-	hints.ai_flags    = 0;            /* use AI_NUMERICSERV for no name resolution */
-	hints.ai_protocol = IPPROTO_UDP; /*  */
-
-	if (getaddrinfo(params->hostname, service, &hints, &rp0) != 0) {
-		printf( "Address lookup for %s failed",
-				params->hostname);
+	intf->fd = socket(AF_INET, SOCK_DGRAM, 0);
+	if (intf->fd == -1) {
+		printf("---> create socket error!\n");
 		return -1;
 	}
 
-	/* getaddrinfo() returns a list of address structures.
-	 * Try each address until we successfully connect(2).
-	 * If socket(2) (or connect(2)) fails, we (close the socket
-	 * and) try the next address.
-	 */
-
-	for (rp = rp0; rp != NULL; rp = rp->ai_next) {
-		/* We are only interested in IPv4 and IPv6 */
-		if ((rp->ai_family != AF_INET6) && (rp->ai_family != AF_INET)) {
-			continue;
-		}
-
-		intf->fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
-		if (intf->fd == -1) {
-			continue;
-		}
-
-		if (rp->ai_family == AF_INET) {
-			if (connect(intf->fd, rp->ai_addr, rp->ai_addrlen) != -1) {
-				hints.ai_family = rp->ai_family;
-				break;  /* Success */
-			}
-		}  else if (rp->ai_family == AF_INET6) {
-			struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)rp->ai_addr;
-			char hbuf[NI_MAXHOST];
-			socklen_t len;
-
-			/* The scope was specified on the command line e.g. with -H FE80::219:99FF:FEA0:BD95%eth0 */
-			if (addr6->sin6_scope_id != 0) {
-				len = sizeof(struct sockaddr_in6);
-				if (getnameinfo((struct sockaddr *)addr6, len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) == 0) {
-					printf( "Trying address: %s scope=%d",
-						hbuf,
-						addr6->sin6_scope_id);
-				}
-				if (connect(intf->fd, rp->ai_addr, rp->ai_addrlen) != -1) {
-					hints.ai_family = rp->ai_family;
-					break;  /* Success */
-				}
-			} else {
-				/* No scope specified, try to get this from the list of interfaces */
-				struct ifaddrs *ifaddrs = NULL;
-				struct ifaddrs *ifa = NULL;
-
-				if (getifaddrs(&ifaddrs) < 0) {
-					printf( "Interface address lookup for %s failed",
-						params->hostname);
-					break;
-				}
-
-				for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-					if (ifa->ifa_addr == NULL) {
-						continue;
-					}
-
-					if (ifa->ifa_addr->sa_family == AF_INET6) {
-						struct sockaddr_in6 *tmp6 = (struct sockaddr_in6 *)ifa->ifa_addr;
-
-						/* Skip unwanted addresses */
-						if (IN6_IS_ADDR_MULTICAST(&tmp6->sin6_addr)) {
-							continue;
-						}
-						if (IN6_IS_ADDR_LOOPBACK(&tmp6->sin6_addr)) {
-							continue;
-						}
-						len = sizeof(struct sockaddr_in6);
-						if ( getnameinfo((struct sockaddr *)tmp6, len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) == 0) {
-							printf( "Testing %s interface address: %s scope=%d",
-								ifa->ifa_name != NULL ? ifa->ifa_name : "???",
-								hbuf,
-								tmp6->sin6_scope_id);
-						}
-
-						if (tmp6->sin6_scope_id != 0) {
-							addr6->sin6_scope_id = tmp6->sin6_scope_id;
-						} else {
-							/*
-							 * No scope information in interface address information
-							 * On some OS'es, getifaddrs() is returning out the 'kernel' representation
-							 * of scoped addresses which stores the scope in the 3rd and 4th
-							 * byte. See also this page:
-							 * http://www.freebsd.org/doc/en/books/developers-handbook/ipv6.html
-							 */
-							if (IN6_IS_ADDR_LINKLOCAL(&tmp6->sin6_addr)
-									&& (tmp6->sin6_addr.s6_addr[1] != 0)) {
-								addr6->sin6_scope_id = ntohs(tmp6->sin6_addr.s6_addr[1]);
-							}
-						}
-
-						/* OK, now try to connect with the scope id from this interface address */
-						if (addr6->sin6_scope_id != 0 || !IN6_IS_ADDR_LINKLOCAL(&tmp6->sin6_addr)) {
-							if (connect(intf->fd, rp->ai_addr, rp->ai_addrlen) != -1) {
-								hints.ai_family = rp->ai_family;
-								printf( "Successful connected on %s interface with scope id %d", ifa->ifa_name, tmp6->sin6_scope_id);
-								break;  /* Success */
-							}
-						}
-					}
-				}
-				freeifaddrs(ifaddrs);
-			}
-		}
-		if (hints.ai_family != AF_UNSPEC) {
-			break;
-		}
-		close(intf->fd);
-		intf->fd = -1;
+	bzero(&servaddr, sizeof(servaddr));
+	servaddr.sin_family = AF_INET;
+	servaddr.sin_port = params->port;					
+	servaddr.sin_addr.s_addr = inet_addr(params->hostname);
+	if (connect(intf->fd, &servaddr, sizeof(servaddr)) == -1) {
+		printf("---> connect error!\n");
+		return -1;
 	}
 
-	/* No longer needed */
-	freeaddrinfo(rp0);
-
+	printf("---> connect ok\n");
+	uint8_t buf[] = {1,2,3,4,5,6,7,8,9};
+	send(intf->fd, buf, 9, 0);
 	return ((intf->fd != -1) ? 0 : -1);
 }
 #endif
@@ -482,7 +366,7 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf)
 	/* check if request size is not specified */
 	if (!size) {
 		/*
-		 * The IPMB standard overall message length for ‘non -bridging’
+		 * The IPMB standard overall message length for ‘non -bridging’
 		 * messages is specified as 32 bytes, maximum, including slave
 		 * address. This sets the upper limit for typical IPMI messages.
 		 * With the exception of messages used for bridging messages to
@@ -539,7 +423,7 @@ ipmi_intf_get_max_response_data_size(struct ipmi_intf * intf)
 	/* check if response size is not specified */
 	if (!size) {
 		/*
-		 * The IPMB standard overall message length for ‘non -bridging’
+		 * The IPMB standard overall message length for ‘non -bridging’
 		 * messages is specified as 32 bytes, maximum, including slave
 		 * address. This sets the upper limit for typical IPMI messages.
 		 * With the exception of messages used for bridging messages to

+ 123 - 119
app/ipmitool-1.8.18/src/plugins/lan/lan.c

@@ -125,7 +125,7 @@ ipmi_req_add_entry(struct ipmi_intf * intf, struct ipmi_rq * req, uint8_t req_se
 
 	e = malloc(sizeof(struct ipmi_rq_entry));
 	if (e == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf("ipmitool: malloc failure");
 		return NULL;
 	}
 
@@ -141,7 +141,7 @@ ipmi_req_add_entry(struct ipmi_intf * intf, struct ipmi_rq * req, uint8_t req_se
 		ipmi_req_entries_tail->next = e;
 
 	ipmi_req_entries_tail = e;
-	lprintf(LOG_DEBUG+3, "added list entry seq=0x%02x cmd=0x%02x",
+	printf("added list entry seq=0x%02x cmd=0x%02x",
 		e->rq_seq, e->req.msg.cmd);
 	return e;
 }
@@ -170,7 +170,7 @@ ipmi_req_remove_entry(uint8_t seq, uint8_t cmd)
 		e = e->next;
 	}
 	if (e) {
-		lprintf(LOG_DEBUG+3, "removed list entry seq=0x%02x cmd=0x%02x",
+		printf("removed list entry seq=0x%02x cmd=0x%02x",
 			seq, cmd);
 		saved_next_entry = e->next;
 		p->next = (p->next == e->next) ? NULL : e->next;
@@ -204,7 +204,7 @@ ipmi_req_clear_entries(void)
 
 	e = ipmi_req_entries;
 	while (e) {
-		lprintf(LOG_DEBUG+3, "cleared list entry seq=0x%02x cmd=0x%02x",
+		printf("cleared list entry seq=0x%02x cmd=0x%02x",
 			e->rq_seq, e->req.msg.cmd);
 		if (e->next != NULL) {
 			p = e->next;
@@ -223,19 +223,20 @@ ipmi_req_clear_entries(void)
 static int
 get_random(void *data, int len)
 {
-	int fd = open("/dev/urandom", O_RDONLY);
-	int rv;
+	//int fd = open("/dev/urandom", O_RDONLY);
+	static int rv = 0x12345678;
 
-	if (fd < 0)
-		return errno;
-	if (len < 0) {
-		close(fd);
-		return errno; /* XXX: ORLY? */
-	}
+	// if (fd < 0)
+	// 	return errno;
+	// if (len < 0) {
+	// 	close(fd);
+	// 	return errno; /* XXX: ORLY? */
+	// }
 
-	rv = read(fd, data, len);
+	// rv = read(fd, data, len);
 
-	close(fd);
+	// close(fd);
+	rv++;
 	return rv;
 }
 
@@ -350,7 +351,7 @@ ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rs * rsp)
 
 	pong = (struct rmcp_pong *)rsp->data;
 
-	lprintf(LOG_DEBUG,
+	printf(
 		"Received IPMI/RMCP response packet: \n"
 		"  IPMI%s Supported\n"
 		"  ASF Version %s\n"
@@ -403,14 +404,14 @@ ipmi_lan_ping(struct ipmi_intf * intf)
 
 	data = malloc(len);
 	if (data == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		return -1;
 	}
 	memset(data, 0, len);
 	memcpy(data, &rmcp_ping, sizeof(rmcp_ping));
 	memcpy(data+sizeof(rmcp_ping), &asf_ping, sizeof(asf_ping));
 
-	lprintf(LOG_DEBUG, "Sending IPMI/RMCP presence ping packet");
+	printf( "Sending IPMI/RMCP presence ping packet");
 
 	rv = ipmi_lan_send_packet(intf, data, len);
 
@@ -418,7 +419,7 @@ ipmi_lan_ping(struct ipmi_intf * intf)
 	data = NULL;
 
 	if (rv < 0) {
-		lprintf(LOG_ERR, "Unable to send IPMI presence ping packet");
+		printf(  "Unable to send IPMI presence ping packet");
 		return -1;
 	}
 
@@ -477,7 +478,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
 			/* handled by rest of function */
 			break;
 		default:
-			lprintf(LOG_DEBUG, "Invalid RMCP class: %x",
+			printf( "Invalid RMCP class: %x",
 				rmcp_rsp.class);
 			rsp = ipmi_lan_recv_packet(intf);
 			continue;
@@ -522,28 +523,28 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
 
 			x++; /* On ISOL there's and additional fifth byte before the data starts */
 	
-			lprintf(LOG_DEBUG, "SOL sequence number     : 0x%02x",
+			printf( "SOL sequence number     : 0x%02x",
 				rsp->payload.sol_packet.packet_sequence_number);
 
-			lprintf(LOG_DEBUG, "SOL acked packet        : 0x%02x",
+			printf( "SOL acked packet        : 0x%02x",
 				rsp->payload.sol_packet.acked_packet_number);
 			
-			lprintf(LOG_DEBUG, "SOL accepted char count : 0x%02x",
+			printf(  "SOL accepted char count : 0x%02x",
 				rsp->payload.sol_packet.accepted_character_count);
 			
-			lprintf(LOG_DEBUG, "SOL is nack             : %s",
+			printf(  "SOL is nack             : %s",
 				rsp->payload.sol_packet.is_nack? "true" : "false");
 			
-			lprintf(LOG_DEBUG, "SOL xfer unavailable    : %s",
+			printf(  "SOL xfer unavailable    : %s",
 				rsp->payload.sol_packet.transfer_unavailable? "true" : "false");
 			
-			lprintf(LOG_DEBUG, "SOL inactive            : %s",
+			printf(  "SOL inactive            : %s",
 				rsp->payload.sol_packet.sol_inactive? "true" : "false");
 			
-			lprintf(LOG_DEBUG, "SOL transmit overrun    : %s",
+			printf(  "SOL transmit overrun    : %s",
 				rsp->payload.sol_packet.transmit_overrun? "true" : "false");
 			
-			lprintf(LOG_DEBUG, "SOL break detected      : %s",
+			printf(  "SOL break detected      : %s",
 				rsp->payload.sol_packet.break_detected? "true" : "false");
 		}
 		else
@@ -567,36 +568,36 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
 			if (verbose > 2)
 				printbuf(rsp->data, rsp->data_len, "ipmi message header");
 			
-			lprintf(LOG_DEBUG+1, "<< IPMI Response Session Header");
-			lprintf(LOG_DEBUG+1, "<<   Authtype   : %s",
+			printf(  "<< IPMI Response Session Header");
+			printf(  "<<   Authtype   : %s",
 				val2str(rsp->session.authtype, ipmi_authtype_session_vals));
-			lprintf(LOG_DEBUG+1, "<<   Sequence   : 0x%08lx",
+			printf(  "<<   Sequence   : 0x%08lx",
 				(long)rsp->session.seq);
-			lprintf(LOG_DEBUG+1, "<<   Session ID : 0x%08lx",
+			printf(  "<<   Session ID : 0x%08lx",
 				(long)rsp->session.id);
-			lprintf(LOG_DEBUG+1, "<< IPMI Response Message Header");
-			lprintf(LOG_DEBUG+1, "<<   Rq Addr    : %02x",
+			printf(  "<< IPMI Response Message Header");
+			printf(  "<<   Rq Addr    : %02x",
 				rsp->payload.ipmi_response.rq_addr);
-			lprintf(LOG_DEBUG+1, "<<   NetFn      : %02x",
+			printf(  "<<   NetFn      : %02x",
 				rsp->payload.ipmi_response.netfn);
-			lprintf(LOG_DEBUG+1, "<<   Rq LUN     : %01x",
+			printf(  "<<   Rq LUN     : %01x",
 				rsp->payload.ipmi_response.rq_lun);
-			lprintf(LOG_DEBUG+1, "<<   Rs Addr    : %02x",
+			printf(  "<<   Rs Addr    : %02x",
 				rsp->payload.ipmi_response.rs_addr);
-			lprintf(LOG_DEBUG+1, "<<   Rq Seq     : %02x",
+			printf(  "<<   Rq Seq     : %02x",
 				rsp->payload.ipmi_response.rq_seq);
-			lprintf(LOG_DEBUG+1, "<<   Rs Lun     : %01x",
+			printf(  "<<   Rs Lun     : %01x",
 				rsp->payload.ipmi_response.rs_lun);
-			lprintf(LOG_DEBUG+1, "<<   Command    : %02x",
+			printf(  "<<   Command    : %02x",
 				rsp->payload.ipmi_response.cmd);
-			lprintf(LOG_DEBUG+1, "<<   Compl Code : 0x%02x",
+			printf(  "<<   Compl Code : 0x%02x",
 				rsp->ccode);
 			
 			/* now see if we have outstanding entry in request list */
 			entry = ipmi_req_lookup_entry(rsp->payload.ipmi_response.rq_seq,
 						      rsp->payload.ipmi_response.cmd);
 			if (entry) {
-				lprintf(LOG_DEBUG+2, "IPMI Request Match found");
+				printf(  "IPMI Request Match found");
 				if ((intf->target_addr != our_address) && bridge_possible) {
 					if ((rsp->data_len) && (rsp->payload.ipmi_response.netfn == 7) &&
 					    (rsp->payload.ipmi_response.cmd != 0x34)) {
@@ -632,7 +633,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
 					} else {
 						//x += sizeof(rsp->payload.ipmi_response);
 						if (rsp->data[x-1] != 0)
-							lprintf(LOG_DEBUG, "WARNING: Bridged "
+							printf(  "WARNING: Bridged "
 								"cmd ccode = 0x%02x",
 								rsp->data[x-1]);
 					}
@@ -640,7 +641,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
 				ipmi_req_remove_entry(rsp->payload.ipmi_response.rq_seq,
 						      rsp->payload.ipmi_response.cmd);
 			} else {
-				lprintf(LOG_INFO, "IPMI Request Match NOT FOUND");
+				printf(  "IPMI Request Match NOT FOUND");
 				rsp = ipmi_lan_recv_packet(intf);
 				continue;
 			}
@@ -750,7 +751,7 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req, int isRetry)
 		len += 8;
 	msg = malloc(len);
 	if (msg == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(msg, 0, len);
@@ -834,19 +835,19 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req, int isRetry)
 	msg[len++] = entry->rq_seq << 2;
 	msg[len++] = req->msg.cmd;
 
-	lprintf(LOG_DEBUG+1, ">> IPMI Request Session Header (level %d)", entry->bridging_level);
-	lprintf(LOG_DEBUG+1, ">>   Authtype   : %s",
+	printf(  ">> IPMI Request Session Header (level %d)", entry->bridging_level);
+	printf(  ">>   Authtype   : %s",
 	       val2str(s->authtype, ipmi_authtype_session_vals));
-	lprintf(LOG_DEBUG+1, ">>   Sequence   : 0x%08lx", (long)s->in_seq);
-	lprintf(LOG_DEBUG+1, ">>   Session ID : 0x%08lx", (long)s->session_id);
-	lprintf(LOG_DEBUG+1, ">> IPMI Request Message Header");
-	lprintf(LOG_DEBUG+1, ">>   Rs Addr    : %02x", intf->target_addr);
-	lprintf(LOG_DEBUG+1, ">>   NetFn      : %02x", req->msg.netfn);
-	lprintf(LOG_DEBUG+1, ">>   Rs LUN     : %01x", 0);
-	lprintf(LOG_DEBUG+1, ">>   Rq Addr    : %02x", IPMI_REMOTE_SWID);
-	lprintf(LOG_DEBUG+1, ">>   Rq Seq     : %02x", entry->rq_seq);
-	lprintf(LOG_DEBUG+1, ">>   Rq Lun     : %01x", 0);
-	lprintf(LOG_DEBUG+1, ">>   Command    : %02x", req->msg.cmd);
+	printf(  ">>   Sequence   : 0x%08lx", (long)s->in_seq);
+	printf(  ">>   Session ID : 0x%08lx", (long)s->session_id);
+	printf(  ">> IPMI Request Message Header");
+	printf(  ">>   Rs Addr    : %02x", intf->target_addr);
+	printf(  ">>   NetFn      : %02x", req->msg.netfn);
+	printf(  ">>   Rs LUN     : %01x", 0);
+	printf(  ">>   Rq Addr    : %02x", IPMI_REMOTE_SWID);
+	printf(  ">>   Rq Seq     : %02x", entry->rq_seq);
+	printf(  ">>   Rq Lun     : %01x", 0);
+	printf(  ">>   Command    : %02x", req->msg.cmd);
 
 	/* message data */
 	if (req->msg.data_len) {
@@ -906,15 +907,15 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
 	int try = 0;
 	int isRetry = 0;
 
-	lprintf(LOG_DEBUG, "ipmi_lan_send_cmd:opened=[%d], open=[%d]",
+	printf(  "ipmi_lan_send_cmd:opened=[%d], open=[%d]",
 		intf->opened, intf->open);
 
 	if (intf->opened == 0 && intf->open != NULL) {
 		if (intf->open(intf) < 0) {
-			lprintf(LOG_DEBUG, "Failed to open LAN interface");
+			printf(  "Failed to open LAN interface");
 			return NULL;
 		}
-		lprintf(LOG_DEBUG, "\topened=[%d], open=[%d]",
+		printf(  "\topened=[%d], open=[%d]",
 			intf->opened, intf->open);
 	}
 
@@ -923,7 +924,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
 
 		entry = ipmi_lan_build_cmd(intf, req, isRetry);
 		if (entry == NULL) {
-			lprintf(LOG_ERR, "Aborting send command, unable to build");
+			printf(  "Aborting send command, unable to build");
 			return NULL;
 		}
 
@@ -957,7 +958,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
 
 		usleep(5000);
 		if (++try >= intf->ssn_params.retry) {
-			lprintf(LOG_DEBUG, "  No response from remote controller");
+			printf(  "  No response from remote controller");
 			break;
 		}
 	}
@@ -1008,7 +1009,7 @@ ipmi_lan_build_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp, int * llen)
 
 	msg = malloc(len);
 	if (msg == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(msg, 0, len);
@@ -1091,7 +1092,7 @@ ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
 
 	msg = ipmi_lan_build_rsp(intf, rsp, &len);
 	if (len <= 0 || msg == NULL) {
-		lprintf(LOG_ERR, "Invalid response packet");
+		printf(  "Invalid response packet");
 		if (msg != NULL) {
 			free(msg);
 			msg = NULL;
@@ -1103,7 +1104,7 @@ ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
 		    (struct sockaddr *)&intf->session->addr,
 		    intf->session->addrlen);
 	if (rv < 0) {
-		lprintf(LOG_ERR, "Packet send failed");
+		printf(  "Packet send failed");
 		if (msg != NULL) {
 			free(msg);
 			msg = NULL;
@@ -1164,7 +1165,7 @@ uint8_t * ipmi_lan_build_sol_msg(struct ipmi_intf * intf,
 
 	msg = malloc(len);
 	if (msg == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(msg, 0, len);
@@ -1263,7 +1264,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
 
 	msg = ipmi_lan_build_sol_msg(intf, payload, &len);
 	if (len <= 0 || msg == NULL) {
-		lprintf(LOG_ERR, "Invalid SOL payload packet");
+		printf(  "Invalid SOL payload packet");
 		if (msg != NULL) {
 			free(msg);
 			msg = NULL;
@@ -1271,7 +1272,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
 		return NULL;
 	}
 
-	lprintf(LOG_DEBUG, ">> SENDING A SOL MESSAGE\n");
+	printf(  ">> SENDING A SOL MESSAGE\n");
 
 	for (;;) {
 		if (ipmi_lan_send_packet(intf, msg, len) < 0) {
@@ -1307,7 +1308,7 @@ ipmi_lan_send_sol_payload(struct ipmi_intf * intf,
 
 		usleep(5000);
 		if (++try >= intf->ssn_params.retry) {
-			lprintf(LOG_DEBUG, "  No response from remote controller");
+			printf(  "  No response from remote controller");
 			break;
 		}
 	}
@@ -1595,44 +1596,44 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_INFO, "Get Auth Capabilities command failed");
+		printf(  "Get Auth Capabilities command failed");
 		return -1;
 	}
 	if (verbose > 2)
 		printbuf(rsp->data, rsp->data_len, "get_auth_capabilities");
 
 	if (rsp->ccode > 0) {
-		lprintf(LOG_INFO, "Get Auth Capabilities command failed: %s",
+		printf(  "Get Auth Capabilities command failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
 
-	lprintf(LOG_DEBUG, "Channel %02x Authentication Capabilities:",
+	printf(  "Channel %02x Authentication Capabilities:",
 		rsp->data[0]);
-	lprintf(LOG_DEBUG, "  Privilege Level : %s",
+	printf(  "  Privilege Level : %s",
 		val2str(req.msg.data[1], ipmi_privlvl_vals));
-	lprintf(LOG_DEBUG, "  Auth Types      : %s%s%s%s%s",
+	printf(  "  Auth Types      : %s%s%s%s%s",
 		(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_NONE) ? "NONE " : "",
 		(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD2) ? "MD2 " : "",
 		(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_MD5) ? "MD5 " : "",
 		(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_PASSWORD) ? "PASSWORD " : "",
 		(rsp->data[1] & 1<<IPMI_SESSION_AUTHTYPE_OEM) ? "OEM " : "");
-	lprintf(LOG_DEBUG, "  Per-msg auth    : %sabled",
+	printf(  "  Per-msg auth    : %sabled",
 		(rsp->data[2] & IPMI_AUTHSTATUS_PER_MSG_DISABLED) ?
 		"dis" : "en");
-	lprintf(LOG_DEBUG, "  User level auth : %sabled",
+	printf(  "  User level auth : %sabled",
 		(rsp->data[2] & IPMI_AUTHSTATUS_PER_USER_DISABLED) ?
 		"dis" : "en");
-	lprintf(LOG_DEBUG, "  Non-null users  : %sabled",
+	printf(  "  Non-null users  : %sabled",
 		(rsp->data[2] & IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED) ?
 		"en" : "dis");
-	lprintf(LOG_DEBUG, "  Null users      : %sabled",
+	printf(  "  Null users      : %sabled",
 		(rsp->data[2] & IPMI_AUTHSTATUS_NULL_USERS_ENABLED) ?
 		"en" : "dis");
-	lprintf(LOG_DEBUG, "  Anonymous login : %sabled",
+	printf(  "  Anonymous login : %sabled",
 		(rsp->data[2] & IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED) ?
 		"en" : "dis");
-	lprintf(LOG_DEBUG, "");
+	printf(  "");
 
 	s->authstatus = rsp->data[2];
 
@@ -1672,15 +1673,15 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
 	}
 	else {
 		if (!(rsp->data[1] & 1<<p->authtype_set))
-			lprintf(LOG_ERR, "Authentication type %s not supported",
+			printf(  "Authentication type %s not supported",
 			       val2str(p->authtype_set, ipmi_authtype_session_vals));
 		else
-			lprintf(LOG_ERR, "No supported authtypes found");
+			printf(  "No supported authtypes found");
 
 		return -1;
 	}
 
-	lprintf(LOG_DEBUG, "Proceeding with AuthType %s",
+	printf(  "Proceeding with AuthType %s",
 		val2str(s->authtype, ipmi_authtype_session_vals));
 
 	return 0;
@@ -1710,7 +1711,7 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get Session Challenge command failed");
+		printf(  "Get Session Challenge command failed");
 		return -1;
 	}
 	if (verbose > 2)
@@ -1719,13 +1720,13 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
 	if (rsp->ccode > 0) {
 		switch (rsp->ccode) {
 		case 0x81:
-			lprintf(LOG_ERR, "Invalid user name");
+			printf(  "Invalid user name");
 			break;
 		case 0x82:
-			lprintf(LOG_ERR, "NULL user name not enabled");
+			printf(  "NULL user name not enabled");
 			break;
 		default:
-			lprintf(LOG_ERR, "Get Session Challenge command failed: %s",
+			printf(  "Get Session Challenge command failed: %s",
 				val2str(rsp->ccode, completion_code_vals));
 		}
 		return -1;
@@ -1734,9 +1735,9 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
 	memcpy(&s->session_id, rsp->data, 4);
 	memcpy(s->challenge, rsp->data + 4, 16);
 
-	lprintf(LOG_DEBUG, "Opening Session");
-	lprintf(LOG_DEBUG, "  Session ID      : %08lx", (long)s->session_id);
-	lprintf(LOG_DEBUG, "  Challenge       : %s", buf2str(s->challenge, 16));
+	printf(  "Opening Session");
+	printf(  "  Session ID      : %08lx", (long)s->session_id);
+	printf(  "  Challenge       : %s", buf2str(s->challenge, 16));
 
 	return 0;
 }
@@ -1764,7 +1765,7 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
 		uint8_t * special = ipmi_auth_special(s);
 		memcpy(intf->session->authcode, special, 16);
 		memset(msg_data + 2, 0, 16);
-		lprintf(LOG_DEBUG, "  OEM Auth        : %s",
+		printf(  "  OEM Auth        : %s",
 			buf2str(special, 16));
 	} else {
 		memcpy(msg_data + 2, s->challenge, 16);
@@ -1778,14 +1779,14 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
 
 	s->active = 1;
 
-	lprintf(LOG_DEBUG, "  Privilege Level : %s",
+	printf(  "  Privilege Level : %s",
 		val2str(msg_data[1], ipmi_privlvl_vals));
-	lprintf(LOG_DEBUG, "  Auth Type       : %s",
+	printf(  "  Auth Type       : %s",
 		val2str(s->authtype, ipmi_authtype_session_vals));
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Activate Session command failed");
+		printf(  "Activate Session command failed");
 		s->active = 0;
 		return -1;
 	}
@@ -1796,31 +1797,31 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
 		fprintf(stderr, "Activate Session error:");
 		switch (rsp->ccode) {
 		case 0x81:
-			lprintf(LOG_ERR, "\tNo session slot available");
+			printf(  "\tNo session slot available");
 			break;
 		case 0x82:
-			lprintf(LOG_ERR, "\tNo slot available for given user - "
+			printf(  "\tNo slot available for given user - "
 				"limit reached");
 			break;
 		case 0x83:
-			lprintf(LOG_ERR, "\tNo slot available to support user "
+			printf(  "\tNo slot available to support user "
 				"due to maximum privilege capacity");
 			break;
 		case 0x84:
-			lprintf(LOG_ERR, "\tSession sequence out of range");
+			printf(  "\tSession sequence out of range");
 			break;
 		case 0x85:
-			lprintf(LOG_ERR, "\tInvalid session ID in request");
+			printf(  "\tInvalid session ID in request");
 			break;
 		case 0x86:
-			lprintf(LOG_ERR, "\tRequested privilege level "
+			printf(  "\tRequested privilege level "
 				"exceeds limit");
 			break;
 		case 0xd4:
-			lprintf(LOG_ERR, "\tInsufficient privilege level");
+			printf(  "\tInsufficient privilege level");
 			break;
 		default:
-			lprintf(LOG_ERR, "\t%s",
+			printf(  "\t%s",
 				val2str(rsp->ccode, completion_code_vals));
 		}
 		return -1;
@@ -1834,18 +1835,18 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
 	if (s->authstatus & IPMI_AUTHSTATUS_PER_MSG_DISABLED)
 		s->authtype = IPMI_SESSION_AUTHTYPE_NONE;
 	else if (s->authtype != (rsp->data[0] & 0xf)) {
-		lprintf(LOG_ERR, "Invalid Session AuthType %s in response",
+		printf(  "Invalid Session AuthType %s in response",
 			val2str(s->authtype, ipmi_authtype_session_vals));
 		return -1;
 	}
 
-	lprintf(LOG_DEBUG, "\nSession Activated");
-	lprintf(LOG_DEBUG, "  Auth Type       : %s",
+	printf(  "\nSession Activated");
+	printf(  "  Auth Type       : %s",
 		val2str(rsp->data[0], ipmi_authtype_session_vals));
-	lprintf(LOG_DEBUG, "  Max Priv Level  : %s",
+	printf(  "  Max Priv Level  : %s",
 		val2str(rsp->data[9], ipmi_privlvl_vals));
-	lprintf(LOG_DEBUG, "  Session ID      : %08lx", (long)s->session_id);
-	lprintf(LOG_DEBUG, "  Inbound Seq     : %08lx\n", (long)s->in_seq);
+	printf(  "  Session ID      : %08lx", (long)s->session_id);
+	printf(  "  Inbound Seq     : %08lx\n", (long)s->in_seq);
 
 	return 0;
 }
@@ -1876,7 +1877,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
 	bridge_possible = backup_bridge_possible;
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Set Session Privilege Level to %s failed",
+		printf(  "Set Session Privilege Level to %s failed",
 			val2str(privlvl, ipmi_privlvl_vals));
 		return -1;
 	}
@@ -1884,13 +1885,13 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
 		printbuf(rsp->data, rsp->data_len, "set_session_privlvl");
 
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s",
+		printf(  "Set Session Privilege Level to %s failed: %s",
 			val2str(privlvl, ipmi_privlvl_vals),
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
 
-	lprintf(LOG_DEBUG, "Set Session Privilege Level to %s\n",
+	printf(  "Set Session Privilege Level to %s\n",
 		val2str(rsp->data[0], ipmi_privlvl_vals));
 
 	return 0;
@@ -1920,24 +1921,24 @@ ipmi_close_session_cmd(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Close Session command failed");
+		printf(  "Close Session command failed");
 		return -1;
 	}
 	if (verbose > 2)
 		printbuf(rsp->data, rsp->data_len, "close_session");
 
 	if (rsp->ccode == 0x87) {
-		lprintf(LOG_ERR, "Failed to Close Session: invalid "
+		printf(  "Failed to Close Session: invalid "
 			"session ID %08lx", (long)session_id);
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Close Session command failed: %s",
+		printf(  "Close Session command failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
 
-	lprintf(LOG_DEBUG, "Closed Session %08lx\n", (long)session_id);
+	printf(  "Closed Session %08lx\n", (long)session_id);
 
 	return 0;
 }
@@ -1999,7 +2000,7 @@ ipmi_lan_activate_session(struct ipmi_intf * intf)
  close_fail:
 	ipmi_close_session_cmd(intf);
  fail:
-	lprintf(LOG_ERR, "Error: Unable to establish LAN session");
+	printf(  "Error: Unable to establish LAN session");
 	return -1;
 }
 
@@ -2044,18 +2045,18 @@ ipmi_lan_open(struct ipmi_intf * intf)
 		p->retry = IPMI_LAN_RETRY;
 
 	if (p->hostname == NULL || strlen((const char *)p->hostname) == 0) {
-		lprintf(LOG_ERR, "No hostname specified!");
+		printf(  "No hostname specified!");
 		return -1;
 	}
 
 	if (ipmi_intf_socket_connect(intf) == -1) {
-		lprintf(LOG_ERR, "Could not open socket!");
+		printf(  "Could not open socket!");
 		return -1;
 	}
 
 	s = (struct ipmi_session *)malloc(sizeof(struct ipmi_session));
 	if (!s) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		goto fail;
 	}
 
@@ -2070,12 +2071,14 @@ ipmi_lan_open(struct ipmi_intf * intf)
 	memcpy(&s->authcode, &p->authcode_set, sizeof(s->authcode));
 	s->addrlen = sizeof(s->addr);
 	if (getsockname(intf->fd, (struct sockaddr *)&s->addr, &s->addrlen)) {
+		printf("---> getsockname error!\n");
 		goto fail;
 	}
 
 	/* try to open session */
 	rc = ipmi_lan_activate_session(intf);
 	if (rc < 0) {
+		printf("---> active session error!\n");
 	    goto fail;
 	}
 
@@ -2087,10 +2090,11 @@ ipmi_lan_open(struct ipmi_intf * intf)
 
 	/* now allow bridging */
 	bridge_possible = 1;
+	printf("---> return intf->fd %d\n", intf->fd);
 	return intf->fd;
 
  fail:
-	lprintf(LOG_ERR, "Error: Unable to establish IPMI v1.5 / RMCP session");
+	printf(  "Error: Unable to establish IPMI v1.5 / RMCP session");
 	intf->close(intf);
 	return -1;
 }

+ 1 - 1
app/test_app/Makefile

@@ -9,7 +9,7 @@ LDFLAGS		:= -mcpu=cortex-m3 -mthumb -L$(INSTALL_ROOT)/A2F/root/usr/lib
 CC	= $(CROSS_COMPILE_APPS)gcc
 
 #source
-SRC	= test.c
+SRC	= netspeed.c
 
 # hal_api
 SRC += $(wildcard ../hal_api/*.c) 

+ 57 - 0
app/test_app/netspeed.c

@@ -0,0 +1,57 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/prctl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+
+void main()
+{
+        int mysocket,connectd;
+        uint8_t buf[1024];
+        int cnt,len;
+        struct sockaddr_in serveraddr;
+        struct sockaddr_in client;
+        int opt;
+        int i;
+        mysocket = socket(AF_INET, SOCK_STREAM,0);
+
+        memset(&serveraddr, 0, sizeof(serveraddr));
+        serveraddr.sin_family = AF_INET;
+        serveraddr.sin_port = htons(10000);
+        serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
+
+        opt = SO_REUSEADDR;
+        setsockopt(mysocket, SOL_SOCKET,SO_REUSEADDR,&opt,sizeof(opt));
+
+        if(-1 == bind(mysocket, (struct sockaddr*)&serveraddr, sizeof(serveraddr))) printf("bind error\n");
+        if(-1 == listen(mysocket, 10)) printf("listen error\n");
+
+        if (-1==(connectd=accept(mysocket,(struct sockaddr*)&client,&len)))
+        {
+                printf("create connect socket error\n");
+        }
+        else
+                printf("connected!\n");
+
+        while(1)
+        {
+                cnt = recv(connectd, buf, 10000, 0);
+                printf("\nrecv %d:", cnt);
+                for(i=0;i<cnt;i++)
+                {
+                        if(i%16 == 0) printf("\n");
+                        printf("%#x ", buf[i]);
+                }
+        }
+}
+
+                      

+ 28 - 1
app/test_app/test.c

@@ -6,13 +6,40 @@
 //#include <linux/jiffies.h>
 #include <unistd.h>
 #include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netdb.h>        /* getaddrinfo(3) et al.                       */
+#include <netinet/in.h>   /* sockaddr_in & sockaddr_in6 definition.      */
+#include  <net/if.h>
+#include <sys/prctl.h>
 #include "driver.h"
 #include "hal_interface_api.h"
 
 int main()
 {
+	int fd;
+	struct sockaddr_in servaddr;
 	printf("test_app\n");
-	printf("Build time: %s %s\n", __DATE__, __TIME__);
 
+	fd = socket(AF_INET, SOCK_DGRAM, 0);
+	if (fd == -1) {
+		printf("---> create socket error!\n");
+	}
+
+	bzero(&servaddr, sizeof(servaddr));
+	servaddr.sin_family = AF_INET;
+	servaddr.sin_port = htons(623);					
+	servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
+	if (connect(fd, &servaddr, sizeof(servaddr)) == -1) {
+		printf("---> connect error!\n");
+		return -1;
+	}
 
+	printf("---> connect ok, port: %d\n", \
+		servaddr.sin_port );
+	uint8_t buf[] = {1,2,3,4,5,6,7,8,9};
+	send(fd, buf, 9, 0);
 }

BIN
app/test_app/test_app


+ 8 - 8
gd32450i-eval.busybox

@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Busybox version: 1.17.0
-# Thu Mar 26 00:29:42 2020
+# Mon Mar 30 00:00:02 2020
 #
 CONFIG_HAVE_DOT_CONFIG=y
 
@@ -698,11 +698,11 @@ CONFIG_FEATURE_UNIX_LOCAL=y
 # CONFIG_DNSD is not set
 # CONFIG_ETHER_WAKE is not set
 # CONFIG_FAKEIDENTD is not set
-# CONFIG_FTPD is not set
-# CONFIG_FEATURE_FTP_WRITE is not set
-# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
-# CONFIG_FTPGET is not set
-# CONFIG_FTPPUT is not set
+CONFIG_FTPD=y
+CONFIG_FEATURE_FTP_WRITE=y
+CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y
+CONFIG_FTPGET=y
+CONFIG_FTPPUT=y
 # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
 CONFIG_HOSTNAME=y
 # CONFIG_HTTPD is not set
@@ -778,7 +778,7 @@ CONFIG_ROUTE=y
 CONFIG_TELNETD=y
 CONFIG_FEATURE_TELNETD_STANDALONE=y
 # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
-# CONFIG_TFTP is not set
+CONFIG_TFTP=y
 CONFIG_TFTPD=y
 
 #
@@ -787,7 +787,7 @@ CONFIG_TFTPD=y
 CONFIG_FEATURE_TFTP_GET=y
 CONFIG_FEATURE_TFTP_PUT=y
 CONFIG_FEATURE_TFTP_BLOCKSIZE=y
-# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
 # CONFIG_TFTP_DEBUG is not set
 CONFIG_TRACEROUTE=y
 # CONFIG_TRACEROUTE6 is not set

+ 7 - 0
gd32450i-eval.initramfs

@@ -90,6 +90,13 @@ slink /bin/traceroute busybox 777 0 0
 slink /bin/vi busybox 777 0 0
 slink /bin/top busybox 777 0 0
 slink /bin/free busybox 777 0 0
+slink /bin/tftp busybox 777 0 0
+slink /bin/tftpd busybox 777 0 0
+slink /bin/ftpd busybox 777 0 0
+slink /bin/ftpget busybox 777 0 0
+slink /bin/ftpput busybox 777 0 0
+
+
 ifarch A2F file /bin/iap_tool ${INSTALL_ROOT}/A2F/root/usr/bin/iap_tool 755 0 0
 
 dir /usr 755 0 0

+ 1 - 1
local/rc

@@ -25,7 +25,7 @@ mknod /dev/platform c 100 0
 #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/adc1 c 105 0
 #mknod /dev/adc2 c 105 1
 #mknod /dev/adc3 c 105 2
 #mknod /dev/spi2 c 104 1