Browse Source

New remote_control function

zhangbo 5 years ago
parent
commit
a932fa7caf
72 changed files with 1776 additions and 1129 deletions
  1. 3 2
      app/Makefile
  2. 45 15
      app/bmc/Api.c
  3. 15 9
      app/bmc/Api.h
  4. 4 4
      app/bmc/ChassisTimer/ChassisTimerTask.c
  5. 89 91
      app/bmc/Session.c
  6. 0 1
      app/bmc/Session.h
  7. BIN
      app/bmc/bmc_app
  8. 1 1
      app/bmc/main.c
  9. 1 1
      app/bmc/msghndlr/App/AppDevice/AppDevice.c
  10. 8 1
      app/bmc/msghndlr/Chassis/ChassisDevice.c
  11. 9 9
      app/bmc/msghndlr/MsgHndlrTask.c
  12. 0 22
      app/bmc/msghndlr/PMConfig.h
  13. 2 2
      app/bmc/msghndlr/cmdselect.c
  14. 8 1
      app/bmc/readme.txt
  15. 10 10
      app/bmc/uds/UDSIfc.c
  16. 8 0
      app/bmc/userinfo/userinfo.c
  17. 8 0
      app/bmc/userinfo/userinfo.h
  18. 24 0
      app/common_include/com_BmcType.h
  19. 9 6
      app/common_include/com_IPMIDefs.h
  20. 1 0
      app/driver/Platform/.platform.ko.cmd
  21. 296 0
      app/driver/Platform/.platform.mod.o.cmd
  22. 1 0
      app/driver/Platform/.platform.o.cmd
  23. 1 1
      app/driver/Platform/.platform_main.o.cmd
  24. 1 1
      app/driver/Platform/.tmp_versions/platform.mod
  25. 5 5
      app/driver/Platform/Makefile
  26. 1 1
      app/driver/Platform/modules.order
  27. BIN
      app/driver/Platform/platform.ko
  28. 21 0
      app/driver/Platform/platform.mod.c
  29. 4 4
      app/driver/Platform/platform_main.c
  30. 5 0
      app/driver/driver.h
  31. BIN
      app/goahead-3.6.5/build/linux-arm-static/bin/goahead
  32. BIN
      app/goahead-3.6.5/build/linux-arm-static/bin/gopass
  33. BIN
      app/goahead-3.6.5/build/linux-arm-static/bin/libgo.a
  34. BIN
      app/goahead-3.6.5/build/linux-arm-static/bin/libgoahead-mbedtls.a
  35. BIN
      app/goahead-3.6.5/build/linux-arm-static/bin/libmbedtls.a
  36. 24 0
      app/goahead-3.6.5/build/linux-arm-static/inc/com_BmcType.h
  37. 9 6
      app/goahead-3.6.5/build/linux-arm-static/inc/com_IPMIDefs.h
  38. 3 0
      app/goahead-3.6.5/build/linux-arm-static/inc/goahead.h
  39. 43 43
      app/goahead-3.6.5/build/linux-arm-static/inc/libipmi_ChassisDevice.h
  40. 4 0
      app/goahead-3.6.5/build/linux-arm-static/inc/remote_control.h
  41. 1 0
      app/goahead-3.6.5/projects/goahead-linux-static.mk
  42. 6 6
      app/goahead-3.6.5/src/auth.c
  43. 2 0
      app/goahead-3.6.5/src/auth.txt
  44. 19 4
      app/goahead-3.6.5/src/goahead.c
  45. 3 0
      app/goahead-3.6.5/src/goahead.h
  46. 5 0
      app/goahead-3.6.5/src/http.c
  47. 43 43
      app/goahead-3.6.5/src/libipmi/inc/libipmi_ChassisDevice.h
  48. 8 0
      app/goahead-3.6.5/src/libipmi/inc/userinfo.h
  49. 62 62
      app/goahead-3.6.5/src/libipmi/src/libipmi_Chassis.c
  50. 18 0
      app/goahead-3.6.5/src/libipmi/src/userinfo.c
  51. 9 2
      app/goahead-3.6.5/src/route.txt
  52. 3 3
      app/goahead-3.6.5/src/runtime.c
  53. 4 0
      app/goahead-3.6.5/src/web_interface/inc/remote_control.h
  54. 142 0
      app/goahead-3.6.5/src/web_interface/src/remote_control.c
  55. 2 0
      app/hal_api/hal_interface_api.h
  56. 32 0
      app/hal_api/hal_platform_interface.c
  57. 15 12
      app/ipmitool-1.8.18/Makefile
  58. 3 0
      app/ipmitool-1.8.18/include/ipmitool/helper.h
  59. BIN
      app/ipmitool-1.8.18/ipmitool
  60. 11 2
      app/ipmitool-1.8.18/lib/dimm_spd.c
  61. 69 55
      app/ipmitool-1.8.18/lib/helper.c
  62. 149 149
      app/ipmitool-1.8.18/lib/ipmi_fru.c
  63. 119 120
      app/ipmitool-1.8.18/lib/ipmi_main.c
  64. 32 33
      app/ipmitool-1.8.18/lib/ipmi_raw.c
  65. 167 213
      app/ipmitool-1.8.18/lib/ipmi_sdr.c
  66. 25 25
      app/ipmitool-1.8.18/lib/ipmi_sdradd.c
  67. 93 93
      app/ipmitool-1.8.18/lib/ipmi_sel.c
  68. 54 54
      app/ipmitool-1.8.18/lib/ipmi_sensor.c
  69. 14 14
      app/ipmitool-1.8.18/src/plugins/ipmi_intf.c
  70. BIN
      app/test_app/test_app
  71. 2 2
      gd32450i-eval.initramfs
  72. 1 1
      local/rc

+ 3 - 2
app/Makefile

@@ -11,15 +11,16 @@ all	:
 	make -C ./bmc
 	make -C ./goahead-3.6.5
 	make -C ./test_app
-	#make -C ./ipmitool-1.8.18
+	make -C ./ipmitool-1.8.18
 clean	: 
 	make -C ./goahead-3.6.5 clean
 	make -C ./bmc clean
 	make -C ./test_app clean
+	make -C ./ipmitool-1.8.18 clean
 
 	make -C ./driver/Platform clean
 	make -C ./driver/GPIO clean
 	make -C ./driver/FMC clean
 	make -C ./driver/ADC clean
 	make -C ./driver/I2C clean
-	make -C ./driver/SPI clean
+	make -C ./driver/SPI clean

+ 45 - 15
app/bmc/Api.c

@@ -130,7 +130,6 @@ int PlatformInit(void)
 	g_BMCInfo.CurTimerSecond			=	0;
 	g_BMCInfo.BootValidMinutes			=	0;
 	
-	g_BMCInfo.pUserInfo					=	NULL;
 		
 	return 0;
 }
@@ -220,19 +219,7 @@ int Init_IPMI_FRU_SDR_SEL(void)
 		g_BMCInfo.IpmiConfig.PrimaryIPMBAddr 		= 	PRIMARY_IPMB_ADDR;
 		g_BMCInfo.IpmiConfig.SecondaryIPMBAddr 		= 	SECONDARY_IPMB_ADDR;
 		
-		// //set default user
-		// memset(g_BMCInfo.IpmiConfig.UserInfoTbl, 0, sizeof(UserInfo_T)*MAX_USER_NUM);
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].ID		=	USER_ID;
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].UserId	=	1;
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].MaxPasswordSize	=	20;
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].UserStatus	=	TRUE;
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].ChannelAccess = 0x34;
-		// g_BMCInfo.IpmiConfig.UserInfoTbl[0].MaxPasswordSize = 20;
-		// memcpy(g_BMCInfo.IpmiConfig.UserInfoTbl[0].UserName, USER_NAME, sizeof(USER_NAME));
-		// memcpy(g_BMCInfo.IpmiConfig.UserInfoTbl[0].UserPassword, PASS_WORD, sizeof(PASS_WORD));
-		
-		// g_BMCInfo.IpmiConfig.CurrentNoUser			=	1;
-		
+				
 		//Init FRU
 		memcpy(&g_BMCInfo.FRU, &Default_FRUData, sizeof(OemFRUData_T));
 		
@@ -296,6 +283,34 @@ int Init_IPMI_FRU_SDR_SEL(void)
 	return 0;
 }
 
+int Init_UserInfoTbl(void)
+{
+	int i;
+	if(1)	//first power on
+	{
+		memset(g_BMCInfo.UserInfoTbl, 0x0, sizeof(UserInfo_T)*MAX_USER_NUM);
+		g_BMCInfo.UserInfoTbl[0].UserId = 1;
+		strcpy(g_BMCInfo.UserInfoTbl[0].UserName, "admin");
+		strcpy(g_BMCInfo.UserInfoTbl[0].UserPassword, "admin");
+		g_BMCInfo.UserInfoTbl[0].UserStatus = TRUE;
+
+		g_BMCInfo.CurrentNoUser = 1;
+		g_BMCInfo.pUserInfo = NULL;
+		FlushUserInfoTbl();
+	}
+	else
+	{
+		UpdateUserInfoTble();
+		g_BMCInfo.CurrentNoUser = 0;
+		for(i=0;i<MAX_USER_NUM;i++)
+		{
+			if((g_BMCInfo.UserInfoTbl[i].UserId != 0) && (g_BMCInfo.UserInfoTbl[i].UserStatus == TRUE))
+				g_BMCInfo.CurrentNoUser++;
+		}
+		g_BMCInfo.pUserInfo = NULL;
+	}
+}
+
 
 
 int UpdateFlash(void)
@@ -380,12 +395,14 @@ uint8_t PDK_GetChassisID(void)
 
 int PDK_PowerOffChassis(void)
 {
-	printf("power off chassis\n");
+	printf("Api power off chassis\n");
+	g_BMCInfo.PowerGoodFlag = 0;
 }
 
 int PDK_PowerOnChassis(void)
 {
 	printf("power on chassis\n");
+	g_BMCInfo.PowerGoodFlag = 1;
 }
 
 int PDK_SoftOffChassis(void)
@@ -497,4 +514,17 @@ char* getmac(char *mac_buf)
     }
     close(fd);
     return mac_buf;
+}
+
+int FlushUserInfoTbl(void)
+{
+	sf_sector_erase(5, USERTBL_FLASH_ADDR);
+	sf_write(5, USERTBL_FLASH_ADDR, (uint8_t*)g_BMCInfo.UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
+	return 0;
+}
+
+int UpdateUserInfoTble(void)
+{
+	sf_read(5, USERTBL_FLASH_ADDR, (uint8_t*)g_BMCInfo.UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
+	return 0;
 }

+ 15 - 9
app/bmc/Api.h

@@ -16,18 +16,24 @@ int GetSysTime(void);
 
 int PostEventMessage (uint8_t *EventMsg,uint8_t size);
 
-extern uint8_t PDK_GetSlotID(void);
-extern uint8_t PDK_GetChassisID(void);
-extern int PDK_PowerOffChassis(void);
-extern int PDK_PowerOnChassis(void);
-extern int PDK_SoftOffChassis(void);
-extern int PDK_PowerCycleChassis(void);
-extern int PDK_ResetChassis(void);
-extern int PDK_DiagInterruptChassis(void);
-extern int PDK_FanControl(void);
+ uint8_t PDK_GetSlotID(void);
+ uint8_t PDK_GetChassisID(void);
+ int PDK_PowerOffChassis(void);
+ int PDK_PowerOnChassis(void);
+ int PDK_SoftOffChassis(void);
+ int PDK_PowerCycleChassis(void);
+ int PDK_ResetChassis(void);
+ int PDK_DiagInterruptChassis(void);
+ int PDK_FanControl(void);
 
 char* getip(char *ip_buf);
 int setip(char *ip);
 char* getmac(char *mac_buf);
 
+int FlushUserInfoTbl(void);
+int UpdateUserInfoTble(void);
+int Init_UserInfoTbl(void);
+
+
+
 #endif /* __API_H__ */

+ 4 - 4
app/bmc/ChassisTimer/ChassisTimerTask.c

@@ -24,6 +24,7 @@
 #include "time.h"
 
 #include "com_IPMI_App.h"
+#include "hal_interface_api.h"
 
 
 int gFd_ChassisPwrHndlrQue;
@@ -97,9 +98,8 @@ void *ChassisTimerTask(void* pArg)
 			{
 				if(((MsgPkt.NetFnLUN>>2) == NETFN_APP) && ((MsgPkt.Cmd == CMD_COLD_RESET) || (MsgPkt.Cmd == CMD_WARM_RESET))) 
 				{
-					sleep(1);
-					//NVIC_SystemReset();
-					//TODO: reset stm32
+					sleep(1);	//wait ipmi request response finish.
+					stm32_reset_mcu();
 				}
 			}
 		}
@@ -111,7 +111,7 @@ void *ChassisTimerTask(void* pArg)
 			//log("Chassis interval\r\n");
 			preChassisSeconds	=	g_BMCInfo.CurTimerSecond;
 			//TODO:
-			g_BMCInfo.PowerGoodFlag = 1;
+			//g_BMCInfo.PowerGoodFlag = 1;
 			g_BMCInfo.IpmiConfig.ChassisPowerState.PowerState	=	g_BMCInfo.PowerGoodFlag;
 		}
 		

+ 89 - 91
app/bmc/Session.c

@@ -245,92 +245,92 @@ void SessionTimerTask (void)
 //    return NULL;
 //}
 
-int UpdateUserInfoTable(void)
-{
-    uint8_t buf[1000];
-    uint8_t UserNameLen = 0;
-    uint8_t PassWordLen = 0;
-    uint8_t *pUserName;
-    uint8_t *pPassword;
-    uint8_t *pStr;
-    uint8_t usercnt = 0;
-    uint32_t len = 0;
-    uint8_t     namesize = 0;
-    FILE *fp = NULL;
-
-
-    printf("\n\nUpdateUserInfoTable\n");
-
-    fp = fopen(AUTH_FILE_PATH, "r");
-    if(fp == NULL)
-    {
-        printf("Open %s fail!\n", AUTH_FILE_PATH);
-        return -1;
-    }
-
-    while(fgets(buf, 1000, fp) != NULL){
-        pStr = buf;
-
-        //remove blank
-        while(*pStr == ' ')
-        {
-            pStr++;
-        }
-
-        if(strncmp(pStr, "user name=", 10) == 0)
-        {
-            pStr+=10;
-            //get name
-            pUserName = pStr;
-            UserNameLen = 0;
-            while(*pStr != ' ')
-            {
-                UserNameLen++;
-                pStr++;
-            }
-
-            memset(g_BMCInfo.UserInfoTbl[usercnt].UserName, 0, MAX_USERNAME_LEN);
-            memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserName, pUserName, UserNameLen);
+// int UpdateUserInfoTable(void)
+// {
+//     uint8_t buf[1000];
+//     uint8_t UserNameLen = 0;
+//     uint8_t PassWordLen = 0;
+//     uint8_t *pUserName;
+//     uint8_t *pPassword;
+//     uint8_t *pStr;
+//     uint8_t usercnt = 0;
+//     uint32_t len = 0;
+//     uint8_t     namesize = 0;
+//     FILE *fp = NULL;
+
+
+//     printf("\n\nUpdateUserInfoTable\n");
+
+//     fp = fopen(AUTH_FILE_PATH, "r");
+//     if(fp == NULL)
+//     {
+//         printf("Open %s fail!\n", AUTH_FILE_PATH);
+//         return -1;
+//     }
+
+//     while(fgets(buf, 1000, fp) != NULL){
+//         pStr = buf;
+
+//         //remove blank
+//         while(*pStr == ' ')
+//         {
+//             pStr++;
+//         }
+
+//         if(strncmp(pStr, "user name=", 10) == 0)
+//         {
+//             pStr+=10;
+//             //get name
+//             pUserName = pStr;
+//             UserNameLen = 0;
+//             while(*pStr != ' ')
+//             {
+//                 UserNameLen++;
+//                 pStr++;
+//             }
+
+//             memset(g_BMCInfo.UserInfoTbl[usercnt].UserName, 0, MAX_USERNAME_LEN);
+//             memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserName, pUserName, UserNameLen);
             
-            //remove blank
-            while(*pStr == ' ')
-            {
-                pStr++;
-            }
-            if(strncmp(pStr, "password=", 9) == 0)
-            {
-                pStr += 9;
-                //get password
-                pPassword = pStr;
-                PassWordLen = 0;
-                while(*pStr != ' ')
-                {
-                    PassWordLen++;
-                    pStr++;
-                }
-
-                memset(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, 0, MAX_PASSWORD_LEN);
-                memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, pPassword, PassWordLen);
+//             //remove blank
+//             while(*pStr == ' ')
+//             {
+//                 pStr++;
+//             }
+//             if(strncmp(pStr, "password=", 9) == 0)
+//             {
+//                 pStr += 9;
+//                 //get password
+//                 pPassword = pStr;
+//                 PassWordLen = 0;
+//                 while(*pStr != ' ')
+//                 {
+//                     PassWordLen++;
+//                     pStr++;
+//                 }
+
+//                 memset(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, 0, MAX_PASSWORD_LEN);
+//                 memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, pPassword, PassWordLen);
             
-                g_BMCInfo.UserInfoTbl[usercnt].UserId = usercnt;
-
-                if(usercnt < 10)
-                    usercnt++;
-                else
-                    break;
-            }
-            else
-                continue;
-        }
-        else
-            continue;
-    }
-
-    g_BMCInfo.CurrentNoUser = usercnt;
-    fclose(fp);
-
-    return 0;
-}
+//                 g_BMCInfo.UserInfoTbl[usercnt].UserId = usercnt;
+
+//                 if(usercnt < 10)
+//                     usercnt++;
+//                 else
+//                     break;
+//             }
+//             else
+//                 continue;
+//         }
+//         else
+//             continue;
+//     }
+
+//     g_BMCInfo.CurrentNoUser = usercnt;
+//     fclose(fp);
+
+//     return 0;
+// }
 /*********************************************************************************************
     Name	:	CheckForDuplicateUsers
     Input	:	UserName - Name of the User
@@ -341,11 +341,11 @@ uint8_t CheckForDuplicateUsers ( uint8_t* UserName)
 {
 	int i = 0;
     
-    for(i=0; i<=MAX_USER_NUM; i++)
+    for(i=0; i<MAX_USER_NUM; i++)
     {
         if(g_BMCInfo.UserInfoTbl[i].UserId != 0)
         {
-            if (0 == memcmp(g_BMCInfo.UserInfoTbl[i].UserName, UserName, MAX_USERNAME_LEN))
+            if (0 == strcmp(g_BMCInfo.UserInfoTbl[i].UserName, UserName))
                 return FALSE;
         }
     }	
@@ -360,12 +360,11 @@ uint8_t CheckForDuplicateUsers ( uint8_t* UserName)
 *********************************************************************************************/
 UserInfo_T*	getUserIdInfo (uint8_t UserId)
 {
-    UpdateUserInfoTable();
-    //if (UserId == 0) { return NULL; }
+    if (UserId == 0) { return NULL; }
 
-    if (UserId < MAX_USER_NUM)
+    if (UserId <= MAX_USER_NUM)
     {
-        return &g_BMCInfo.UserInfoTbl[UserId];
+        return &g_BMCInfo.UserInfoTbl[UserId-1];
     }
     else
     {
@@ -383,7 +382,6 @@ UserInfo_T*	getUserNameInfo (uint8_t *UserName)
 {
    int i = 0;
 
-   UpdateUserInfoTable();
    if (UserName[0] == 0) { return NULL; }
    if( (UserName[0] >= '0') && (UserName[0] <= '9') ) {return NULL;}
 

+ 0 - 1
app/bmc/Session.h

@@ -174,7 +174,6 @@ extern		 void				SessionTimerTask (void);
 extern SessionInfo_T*		getSessionInfo (uint8_t Arg, void *Session);
 // extern _FAR_ ChannelUserInfo_T* getChUserPrivInfo (_NEAR_ char *userName, _NEAR_ uint8_t Role, _NEAR_ uint8_t* chIndex, _FAR_ ChannelUserInfo_T *pChUserInfo, int BMCInst);
 // extern _FAR_ ChannelUserInfo_T*	getChUserInfo (_NEAR_ char *userName, _NEAR_ uint8_t* chIndex, _FAR_ ChannelUserInfo_T *pChUserInfo, int BMCInst);
-extern int UpdateUserInfoTable(void);
 extern UserInfo_T*		getUserIdInfo (uint8_t userId);
 extern  UserInfo_T* getUserNameInfo (uint8_t *UserName);
 extern uint8_t	CheckForDuplicateUsers (uint8_t* UserName);

BIN
app/bmc/bmc_app


+ 1 - 1
app/bmc/main.c

@@ -41,6 +41,7 @@ void main(void)
 	InitSelConfig();
 	Init_SessionTbl();
 	InitTimerTaskTbl();
+	Init_UserInfoTbl();
 
 	printf("\tChassisID %#02x, SlotID %#02x\r\n", g_BMCInfo.ChassisID, g_BMCInfo.SlotID);
 	if(g_BMCInfo.IpmiConfig.PrimaryIPMBSupport)
@@ -117,7 +118,6 @@ void main(void)
 
 	/* Create UDS interface */
 
-	UpdateUserInfoTable();
 	while(1)
 	{
 		sleep(100);

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

@@ -2511,7 +2511,7 @@ GetUserAccess ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 
     pGetUserAccessRes->CompletionCode = CC_NORMAL;
     pGetUserAccessRes->MaxNoUserID    = MAX_USER_NUM;
-    pGetUserAccessRes->CurrentUserID  = g_BMCInfo.CurrentNoUser;
+    pGetUserAccessRes->CurrentUserID  = g_BMCInfo.pUserInfo->UserId;
     pGetUserAccessRes->FixedUserID    = 0;
 	//pGetUserAccessRes->ChannelAccess  = pUserInfo->ChannelAccess;
 

+ 8 - 1
app/bmc/msghndlr/Chassis/ChassisDevice.c

@@ -194,7 +194,9 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 			MsgPkt.NetFnLUN	=	0x00<<2;
 			MsgPkt.Cmd		=	0x02;
 			MsgPkt.Data[0]	=	CHASSIS_POWER_DOWN;
-			PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);	
+			MsgPkt.Size     =    1;
+            PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);	
+
 //            g_BMCInfo.HostOFFStopWDT = TRUE ;
             g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
 //            OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
@@ -207,6 +209,7 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 			MsgPkt.NetFnLUN	=	0x00<<2;
 			MsgPkt.Cmd		=	0x02;
 			MsgPkt.Data[0]	=	CHASSIS_POWER_UP;
+            MsgPkt.Size     =    1;
 			PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
             g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
 //            OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
@@ -225,6 +228,7 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 		MsgPkt.NetFnLUN	=	0x00<<2;
 		MsgPkt.Cmd		=	0x02;
 		MsgPkt.Data[0]	=	CHASSIS_POWER_CYCLE;
+        MsgPkt.Size     =    1;
 		PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
 	
         g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
@@ -244,6 +248,7 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 		MsgPkt.NetFnLUN	=	0x00<<2;
 		MsgPkt.Cmd		=	0x02;
 		MsgPkt.Data[0]	=	CHASSIS_HARD_RESET;
+        MsgPkt.Size     =    1;
 		PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);	
         g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
 //        OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
@@ -256,6 +261,7 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 		MsgPkt.NetFnLUN	=	0x00<<2;
 		MsgPkt.Cmd		=	0x02;
 		MsgPkt.Data[0]	=	CHASSIS_PULSE_DIAGNOSTIC_INTERRUPT;
+        MsgPkt.Size     =    1;
 		PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
         //Platform_HostDiagInt ();
         break;
@@ -266,6 +272,7 @@ ChassisControl (  uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes )
 		MsgPkt.NetFnLUN	=	0x00<<2;
 		MsgPkt.Cmd		=	0x02;
 		MsgPkt.Data[0]	=	CHASSIS_SOFT_SHUTDOWN;
+        MsgPkt.Size     =    1;
 		PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
         //Platform_HostSoftShutDown (BMCInst);
         break;

+ 9 - 9
app/bmc/msghndlr/MsgHndlrTask.c

@@ -132,11 +132,11 @@ void *MsgHndlrTask( void *pArg )
 	while(1)
 	{
 		while(GetMsg(gFd_MsgHndlrIfc, &reqMsgPkt, WAIT_INFINITE) != 0);
-		// printf("Mrx: ");
-		// int i;
-		// for(i=0;i<reqMsgPkt.Size;i++)
-		// 	printf("%#x ", reqMsgPkt.Data[i]);
-		// printf("\n");
+		printf("Mrx: ");
+		int i;
+		for(i=0;i<reqMsgPkt.Size;i++)
+			printf("%#x ", reqMsgPkt.Data[i]);
+		printf("\n");
 
 		pthread_setspecific(g_tls.CurChannel,&reqMsgPkt.Channel);
 		pthread_setspecific(g_tls.CurPrivLevel,&reqMsgPkt.Privilege);
@@ -167,10 +167,10 @@ void *MsgHndlrTask( void *pArg )
 			
 			resMsgPkt.SessionID = reqMsgPkt.SessionID;
 		}
-		// printf("Mtx: ");
-		// for(i=0;i<resMsgPkt.Size;i++)
-		// 	printf("%#x ", resMsgPkt.Data[i]);
-		// printf("\n");
+		printf("Mtx: ");
+		for(i=0;i<resMsgPkt.Size;i++)
+			printf("%#x ", resMsgPkt.Data[i]);
+		printf("\n");
 
 		//send response pkt to source queue.
 		PostMsg(resMsgPkt.SrcQ, &resMsgPkt);

+ 0 - 22
app/bmc/msghndlr/PMConfig.h

@@ -155,28 +155,6 @@ typedef struct
 }   ChannelUserInfo_T;
 
 
-/**
- * @struct UserInfo_T
- * Structure for user information.
-**/
-typedef struct
-{
-//    uint32_t  ID;
-    uint8_t   UserId;
-    uint8_t   UserName [MAX_USERNAME_LEN];
-    uint8_t   UserPassword [MAX_PASSWORD_LEN];
-//    uint8_t   MaxPasswordSize;				/**< Maximum password size					*/
-//	uint8_t	  ChannelAccess;				/** reserve,Call back, Link Auth, Ipmi Msg, Priv[3:0]. **/
-//    uint8_t   UserShell;	                    /**< user shell type	                    */		
-//    uint8_t	UserEMailID [EMAIL_ADDR_SIZE];	/**< Email-ID registered for the user		*/
-//    uint8_t   MaxSession;             		/**< max No of session allowed for User.    */
-//    uint8_t   CurrentSession;         		/**< No Current session for the User.       */
-//   uint8_t    UserStatus;           		/**< User Enabled/Disabled Status.          */
-//    uint32_t    FixedUser:1;            		/**< Is this user name fixed                */
-//    uint8_t  EmailFormat[EMAIL_FORMAT_SIZE]; /** Email Alert format                       */
-//    uint32_t  ExtendedPrivilege;                       /** User Enhanced Privilege Flags           */
-//    uint8_t   UserPasswdConfigured;			/*  Flag to allow default Empty Password  */
-}   UserInfo_T;
 
 
 /**

+ 2 - 2
app/bmc/msghndlr/cmdselect.c

@@ -34,8 +34,8 @@
 //#include "OemSMMCmds.h"
 //#include "main.h"
 
-#define ENABLED		0x01
-#define DISABLED	0xff
+#define ENABLED 0x1
+#define DISABLED 0xff
 
 const NetFnCmds_T g_App [] = 
 {

+ 8 - 1
app/bmc/readme.txt

@@ -5,4 +5,11 @@
 	- sensor_sdr.c			Add new SDR
 	- main.h				SENSOR_NUMBERS = ?
 
-2. Web Access IPMC through SendMessage and GetMessage command
+2. Web Access IPMC through SendMessage and GetMessage command
+
+3. UserInfoTbl
+	UserInfo 保存在flash里,offset = 0x800000; UserId从1开始。
+	g_BMCInfo.UserInfoTbl[0]: UserId = 1
+	g_BMCInfo.UserInfoTbl[1]: UserId = 2
+	g_BMCInfo.UserInfoTbl[2]: UserId = 3
+	...

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

@@ -293,11 +293,11 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
             return UDS_FAILURE;
         }
         
-        int i;
-        printf("---> server recv1 %#x: ", Len);
-        for(i=0;i<Len;i++)
-            printf("%#x ", pData[RecvdLen+i]);
-        printf("\n");
+        // int i;
+        // printf("---> server recv1 %#x: ", Len);
+        // for(i=0;i<Len;i++)
+        //     printf("%#x ", pData[RecvdLen+i]);
+        // printf("\n");
 
         RecvdLen += Len;
     }
@@ -317,11 +317,11 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
             return UDS_FAILURE;
         }
 
-        int i;
-        printf("---> server recv2 %#x: ", Len);
-        for(i=0;i<Len;i++)
-            printf("%#x ", pData[RecvdLen+i]);
-        printf("\n");
+        // int i;
+        // printf("---> server recv2 %#x: ", Len);
+        // for(i=0;i<Len;i++)
+        //     printf("%#x ", pData[RecvdLen+i]);
+        // printf("\n");
 
         RecvdLen += Len;
         RemLen -= Len;

+ 8 - 0
app/bmc/userinfo/userinfo.c

@@ -0,0 +1,8 @@
+#include "userinfo.h"
+#include "main.h"
+
+
+void InitUserInfo(void)
+{
+	
+}

+ 8 - 0
app/bmc/userinfo/userinfo.h

@@ -0,0 +1,8 @@
+#ifndef __USER_INFO_H__
+#define __USER_INFO_H__
+
+#include <stdint.h>
+
+
+
+#endif __USER_INFO_H__

+ 24 - 0
app/common_include/com_BmcType.h

@@ -263,6 +263,30 @@ typedef struct
     //uint16_t   Noofentries;
 } StorleadGetSensorInfoRes_T;
 
+
+/**
+ * @struct UserInfo_T
+ * Structure for user information.
+**/
+typedef struct
+{
+//    uint32_t  ID;
+    uint8_t   UserId;
+    uint8_t   UserName [MAX_USERNAME_LEN];
+    uint8_t   UserPassword [MAX_PASSWORD_LEN];
+//    uint8_t   MaxPasswordSize;                /**< Maximum password size                  */
+//  uint8_t   ChannelAccess;                /** reserve,Call back, Link Auth, Ipmi Msg, Priv[3:0]. **/
+//    uint8_t   UserShell;                      /**< user shell type                        */      
+//    uint8_t   UserEMailID [EMAIL_ADDR_SIZE];  /**< Email-ID registered for the user       */
+//    uint8_t   MaxSession;                     /**< max No of session allowed for User.    */
+//    uint8_t   CurrentSession;                 /**< No Current session for the User.       */
+    uint8_t    UserStatus;                  /**< User Enabled/Disabled Status.          */
+//    uint32_t    FixedUser:1;                  /**< Is this user name fixed                */
+//    uint8_t  EmailFormat[EMAIL_FORMAT_SIZE]; /** Email Alert format                       */
+//    uint32_t  ExtendedPrivilege;                       /** User Enhanced Privilege Flags           */
+//    uint8_t   UserPasswdConfigured;           /*  Flag to allow default Empty Password  */
+}   UserInfo_T;
+
 // typedef struct
 // {
 //     uint8_t               Used;

+ 9 - 6
app/common_include/com_IPMIDefs.h

@@ -45,6 +45,7 @@
     #define FALSE 0
 #endif    
 
+#define USERTBL_FLASH_ADDR 0x800000
 
 #define MAX_STR_LENGTH          128
 #define SOCKET_PATH_LEN         108
@@ -57,6 +58,12 @@
 #define MAX_ID_STR_LEN  		16
 #define MAX_FRU_SDR_STR_SIZE 	40
 #define MAX_SENSOR_INFO_SIZE	(1024)
+#define IP4_VERSION     4
+#define IP6_VERSION     6
+#define IP4_ADDR_LEN    4
+#define IP6_ADDR_LEN   16
+#define MAX_USERNAME_LEN        (16+1)
+#define MAX_PASSWORD_LEN        (20+1)
 
 #define AUTH_FILE_PATH		"/etc/goahead/auth.txt"
 
@@ -88,6 +95,7 @@
 #define	MAX_REQUEST_SIZE		1024
 #define	MAX_RESPONSE_SIZE		1024
 
+
 #define WAIT_NONE       0
 #define WAIT_INFINITE   (-1)
 
@@ -150,10 +158,6 @@
 
 
 
-#define IP4_VERSION     4
-#define IP6_VERSION     6
-#define IP4_ADDR_LEN    4
-#define IP6_ADDR_LEN   16
 
 
 /* Authentication Types */
@@ -283,8 +287,7 @@
 #define NETFN_GROUP_EXTN                  0x2C
 #define IPMI_GROUP_EXTN_CODE_DCMI         0xDC
 
-#define MAX_USERNAME_LEN        (16+1)
-#define MAX_PASSWORD_LEN        (20+1)
+
 
 /**** Command Completion Codes ****/
 #define CC_NORMAL                                       0x00

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

@@ -0,0 +1 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.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.ko /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o

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

@@ -0,0 +1,296 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/.platform.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.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(platform)"  -DMODULE -mlong-calls -fno-optimize-sibling-calls -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.c
+
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.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.mod.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o)
+
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.mod.o):

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

@@ -0,0 +1 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.o := arm-uclinuxeabi-ld -EL    -r -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.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 

+ 1 - 1
app/driver/Platform/.platform_main.o.cmd

@@ -1,4 +1,4 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/.platform_main.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  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(platform_main)"  -D"KBUILD_MODNAME=KBUILD_STR(platform_STM32F429)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/.platform_main.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  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(platform_main)"  -D"KBUILD_MODNAME=KBUILD_STR(platform)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.c
 
 deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.o := \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_main.c \

+ 1 - 1
app/driver/Platform/.tmp_versions/platform_STM32F429.mod → app/driver/Platform/.tmp_versions/platform.mod

@@ -1,2 +1,2 @@
-/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.ko
 /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

+ 5 - 5
app/driver/Platform/Makefile

@@ -1,13 +1,13 @@
 
 KERNELDIR	:= $(INSTALL_ROOT)/linux
 
-platform_STM32F429-objs += ../STM32F4xx_HAL_Driver/system_stm32f4xx.o
-platform_STM32F429-objs += ../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o
-platform_STM32F429-objs += ../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o
+platform-objs += ../STM32F4xx_HAL_Driver/system_stm32f4xx.o
+platform-objs += ../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o
+platform-objs += ../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o
 
-platform_STM32F429-objs += platform_main.o
+platform-objs += platform_main.o
 
-obj-m	+= platform_STM32F429.o
+obj-m	+= platform.o
 
 APPDIR := $(INSTALL_ROOT)/projects/gd32450i-eval/app
 

+ 1 - 1
app/driver/Platform/modules.order

@@ -1 +1 @@
-kernel//gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform_STM32F429.ko
+kernel//gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/Platform/platform.ko

BIN
app/driver/Platform/platform.ko


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

@@ -0,0 +1,21 @@
+#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=";
+

+ 4 - 4
app/driver/Platform/platform_main.c

@@ -23,12 +23,9 @@ static int minor = 0;
 static dev_t devno;
 static struct cdev *platform_cdev = NULL;
 static int count = 1;
-#define DEVNAME "platform_STM32F429"
+#define DEVNAME "Platform_GD32F450I"
 struct device *dev = NULL;
 
-#define SET_PRIORITY_GROUP	0
-#define GET_PRIORITY_GROUP	1
-
 typedef struct {
 	uint32_t	priority_group;
 } platform_arg_t;
@@ -101,6 +98,9 @@ static int platform_ioctl(struct inode *indoe, struct file *filep, unsigned int
 		if(copy_to_user((void*)arg, &platform_arg, sizeof(platform_arg_t)))
 			return -EFAULT;
 		break;
+	case RESET_MCU:
+		NVIC_SystemReset();
+		break;
 	default:
 		printk(KERN_ERR"Invalid cmd\n");
 		break;

+ 5 - 0
app/driver/driver.h

@@ -54,6 +54,11 @@
 #define GPIO_I2C_MASTER_TRANSFER		GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO_I2C, 0)
 #define GPIO_I2C_MASTER_RECEIVE			GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO_I2C, 1)
 
+/* Platform command */
+#define SET_PRIORITY_GROUP 				GENERATE_CMD(IOCTL_MAGIC, MAJOR_PLATFORM, 0)
+#define GET_PRIORITY_GROUP 				GENERATE_CMD(IOCTL_MAGIC, MAJOR_PLATFORM, 1)
+#define RESET_MCU 						GENERATE_CMD(IOCTL_MAGIC, MAJOR_PLATFORM, 2)
+
 typedef struct {
 	uint32_t address;
 	uint16_t length;

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


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


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


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


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


+ 24 - 0
app/goahead-3.6.5/build/linux-arm-static/inc/com_BmcType.h

@@ -263,6 +263,30 @@ typedef struct
     //uint16_t   Noofentries;
 } StorleadGetSensorInfoRes_T;
 
+
+/**
+ * @struct UserInfo_T
+ * Structure for user information.
+**/
+typedef struct
+{
+//    uint32_t  ID;
+    uint8_t   UserId;
+    uint8_t   UserName [MAX_USERNAME_LEN];
+    uint8_t   UserPassword [MAX_PASSWORD_LEN];
+//    uint8_t   MaxPasswordSize;                /**< Maximum password size                  */
+//  uint8_t   ChannelAccess;                /** reserve,Call back, Link Auth, Ipmi Msg, Priv[3:0]. **/
+//    uint8_t   UserShell;                      /**< user shell type                        */      
+//    uint8_t   UserEMailID [EMAIL_ADDR_SIZE];  /**< Email-ID registered for the user       */
+//    uint8_t   MaxSession;                     /**< max No of session allowed for User.    */
+//    uint8_t   CurrentSession;                 /**< No Current session for the User.       */
+    uint8_t    UserStatus;                  /**< User Enabled/Disabled Status.          */
+//    uint32_t    FixedUser:1;                  /**< Is this user name fixed                */
+//    uint8_t  EmailFormat[EMAIL_FORMAT_SIZE]; /** Email Alert format                       */
+//    uint32_t  ExtendedPrivilege;                       /** User Enhanced Privilege Flags           */
+//    uint8_t   UserPasswdConfigured;           /*  Flag to allow default Empty Password  */
+}   UserInfo_T;
+
 // typedef struct
 // {
 //     uint8_t               Used;

+ 9 - 6
app/goahead-3.6.5/build/linux-arm-static/inc/com_IPMIDefs.h

@@ -45,6 +45,7 @@
     #define FALSE 0
 #endif    
 
+#define USERTBL_FLASH_ADDR 0x800000
 
 #define MAX_STR_LENGTH          128
 #define SOCKET_PATH_LEN         108
@@ -57,6 +58,12 @@
 #define MAX_ID_STR_LEN  		16
 #define MAX_FRU_SDR_STR_SIZE 	40
 #define MAX_SENSOR_INFO_SIZE	(1024)
+#define IP4_VERSION     4
+#define IP6_VERSION     6
+#define IP4_ADDR_LEN    4
+#define IP6_ADDR_LEN   16
+#define MAX_USERNAME_LEN        (16+1)
+#define MAX_PASSWORD_LEN        (20+1)
 
 #define AUTH_FILE_PATH		"/etc/goahead/auth.txt"
 
@@ -88,6 +95,7 @@
 #define	MAX_REQUEST_SIZE		1024
 #define	MAX_RESPONSE_SIZE		1024
 
+
 #define WAIT_NONE       0
 #define WAIT_INFINITE   (-1)
 
@@ -150,10 +158,6 @@
 
 
 
-#define IP4_VERSION     4
-#define IP6_VERSION     6
-#define IP4_ADDR_LEN    4
-#define IP6_ADDR_LEN   16
 
 
 /* Authentication Types */
@@ -283,8 +287,7 @@
 #define NETFN_GROUP_EXTN                  0x2C
 #define IPMI_GROUP_EXTN_CODE_DCMI         0xDC
 
-#define MAX_USERNAME_LEN        (16+1)
-#define MAX_PASSWORD_LEN        (20+1)
+
 
 /**** Command Completion Codes ****/
 #define CC_NORMAL                                       0x00

+ 3 - 0
app/goahead-3.6.5/build/linux-arm-static/inc/goahead.h

@@ -24,6 +24,9 @@
 extern "C" {
 #endif
 
+
+ 
+
 #if (ME_COM_MBEDTLS + ME_COM_MATRIXSSL + ME_COM_NANOSSL + ME_COM_OPENSSL) > 1
     #error "Cannot have more than one SSL provider configured"
 #endif

+ 43 - 43
app/goahead-3.6.5/build/linux-arm-static/inc/libipmi_ChassisDevice.h

@@ -31,70 +31,70 @@ extern "C" {
 #define CHASSIS_SOFTOFF	         0x05
 
 
+uint16_t  IPMICMD_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, int timeout, char cmd);
 
 
+// /**
+//    \breif	Higher level function for PowerOff Host.
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerOff Host.
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
 
+// /**
+//    \breif	Higher level function for PowerUP Host
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerUP Host
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
 
+// /**
+//    \breif	Higher level function for PowerCycle host.
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerCycle host.
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
 
 
+// /**
+//    \breif	Higher level function for HardReset
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for HardReset
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
-
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
-/**
-   \breif	Higher level function for DiagInt
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+// /**
+//    \breif	Higher level function for DiagInt
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
-/**
-   \breif	Higher level function for SoftOff
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+// /**
+//    \breif	Higher level function for SoftOff
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
 

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

@@ -3,4 +3,8 @@
 
 #include "goahead.h"
 
+void chassisPwrCtrl(Webs *wp);
+void getChassisStatus(Webs *wp);
+
+
 #endif /* __REMOTE_CONTROL_H__ */

+ 1 - 0
app/goahead-3.6.5/projects/goahead-linux-static.mk

@@ -766,6 +766,7 @@ $(BUILD)/obj/goahead-openssl.o: \
 #   goahead.o
 #
 DEPS_17 += $(BUILD)/inc/goahead.h
+DEPS_17 += $(BUILD)/inc/com_BmcType.h
 
 $(BUILD)/obj/goahead.o: \
     src/goahead.c $(DEPS_17)

+ 6 - 6
app/goahead-3.6.5/src/auth.c

@@ -243,7 +243,7 @@ PUBLIC int websWriteAuthFile(char *path)
 #endif
 
 
-static WebsUser *createUser(char *username, char *password, char *roles)
+static WebsUser *createUser(char *username, char *password, char *roles)    //jimbo todo
 {
     WebsUser    *user;
 
@@ -260,7 +260,7 @@ static WebsUser *createUser(char *username, char *password, char *roles)
 }
 
 
-WebsUser *websAddUser(char *username, char *password, char *roles)
+WebsUser *websAddUser(char *username, char *password, char *roles)  //jimbo todo
 {
     WebsUser    *user;
 
@@ -283,7 +283,7 @@ WebsUser *websAddUser(char *username, char *password, char *roles)
 }
 
 
-PUBLIC int websRemoveUser(char *username)
+PUBLIC int websRemoveUser(char *username)   //jimbo todo
 {
     WebsKey     *key;
 
@@ -295,7 +295,7 @@ PUBLIC int websRemoveUser(char *username)
 }
 
 
-static void freeUser(WebsUser *up)
+static void freeUser(WebsUser *up)  //jimbo delete
 {
     assert(up);
     hashFree(up->abilities);
@@ -306,7 +306,7 @@ static void freeUser(WebsUser *up)
 }
 
 
-PUBLIC int websSetUserPassword(char *username, char *password)
+PUBLIC int websSetUserPassword(char *username, char *password)  //jimbo todo
 {
     WebsUser    *user;
 
@@ -320,7 +320,7 @@ PUBLIC int websSetUserPassword(char *username, char *password)
 }
 
 
-PUBLIC int websSetUserRoles(char *username, char *roles)
+PUBLIC int websSetUserRoles(char *username, char *roles)    //jimbo todo
 {
     WebsUser    *user;
 

+ 2 - 0
app/goahead-3.6.5/src/auth.txt

@@ -15,3 +15,5 @@
 #   Define a user
 #       user name=joshua password=2fd6e47ff9bb70c0465fd2f5c8e5305e roles=manager,purchaser
 #
+
+user name=admin password=2fd6e47ff9bb70c0465fd2f5c8e5305e roles=manager,purchaser

+ 19 - 4
app/goahead-3.6.5/src/goahead.c

@@ -19,11 +19,21 @@
 #include    "goahead.h"
 #include    "dashboard.h"
 #include    "cJSON.h"
+#include    "com_BmcType.h"
+#include    "remote_control.h"
+#include    "fan.h"
+#include    "fru.h"
+#include    "sel.h"
+#include    "server_health.h"
+#include    "fw_update.h"
+#include    "config.h"
 
 /********************************* Defines ************************************/
 
 static int finished = 0;
 
+UserInfo_T UserInfoTbl[MAX_USER_NUM];
+
 /********************************* Forwards ***********************************/
 
 static void initPlatform();
@@ -56,10 +66,10 @@ MAIN(goahead, int argc, char **argv, char **envp)
     auth = "auth.txt";
 
 /**************** user code before goahead ************************/   
-cJSON_Hooks hooks;
-hooks.malloc_fn = (void *(*)(size_t))walloc;
-hooks.free_fn = (void (*)(void *))wfree;
-cJSON_InitHooks(&hooks);
+    cJSON_Hooks hooks;
+    hooks.malloc_fn = (void *(*)(size_t))walloc;
+    hooks.free_fn = (void (*)(void *))wfree;
+    cJSON_InitHooks(&hooks);
 
 /**************** user code before goahead end************************/
     for (argind = 1; argind < argc; argind++) {
@@ -162,10 +172,15 @@ cJSON_InitHooks(&hooks);
 websDefineAction("test", actionTest);
 websDefineAction("buy", buy);
 
+//dashboard
 websDefineAction("getDeviceInfo", getDeviceInfo);
 websDefineAction("getSysInfo", getSysInfo);
 websDefineAction("getCardInfo", getCardInfo);
 websDefineAction("getSensorInfo", getSensorInfo);
+//remote control
+websDefineAction("chassisPwrCtrl", chassisPwrCtrl);
+websDefineAction("getChassisStatus", getChassisStatus);
+
  
 
 

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

@@ -24,6 +24,9 @@
 extern "C" {
 #endif
 
+
+ 
+
 #if (ME_COM_MBEDTLS + ME_COM_MATRIXSSL + ME_COM_NANOSSL + ME_COM_OPENSSL) > 1
     #error "Cannot have more than one SSL provider configured"
 #endif

+ 5 - 0
app/goahead-3.6.5/src/http.c

@@ -1242,6 +1242,7 @@ static bool filterChunkData(Webs *wp)
         switch (wp->rxChunkState) {
         case WEBS_CHUNK_UNCHUNKED:
             len = min(wp->rxRemaining, bufLen(rxbuf));
+//            printf("---> bufPutBlk1 len = %d\n", len);
             bufPutBlk(&wp->input, rxbuf->servp, len);
             bufAddNull(&wp->input);
             bufAdjustStart(rxbuf, len);
@@ -1308,6 +1309,7 @@ static bool filterChunkData(Webs *wp)
         case WEBS_CHUNK_DATA:
             len = min(bufLen(rxbuf), wp->rxRemaining);
             nbytes = min(bufRoom(&wp->input), len);
+//            printf("---> bufPutBlk2 len = %d\n", len);
             if (len > 0 && (nbytes = bufPutBlk(&wp->input, rxbuf->servp, nbytes)) == 0) {
                 websError(wp, HTTP_CODE_REQUEST_TOO_LARGE | WEBS_CLOSE, "Too big");
                 return 1;
@@ -1999,6 +2001,7 @@ static bool flushChunkData(Webs *wp)
             break;
 
         case WEBS_CHUNK_HEADER:
+//            printf("---> bufPutBlk3 len = %d\n", wp->txChunkPrefixLen);
             if ((written = bufPutBlk(&wp->output, wp->txChunkPrefixNext, wp->txChunkPrefixLen)) < 0) {
                 return 0;
             } else {
@@ -2015,6 +2018,7 @@ static bool flushChunkData(Webs *wp)
         case WEBS_CHUNK_DATA:
             if (wp->txChunkLen > 0) {
                 len = min(room, wp->txChunkLen);
+//                printf("---> bufPutBlk4 len = %d, room = %d, wp->txChunkLen = %d\n", len, room, wp->txChunkLen);
                 if ((written = bufPutBlk(&wp->output, wp->chunkbuf.servp, len)) != len) {
                     assert(0);
                     return -1;
@@ -2178,6 +2182,7 @@ PUBLIC ssize websWriteBlock(Webs *wp, char *buf, ssize size)
             break;
         }
         thisWrite = min(room, size);
+//        printf("---> bufPutBlk5 room = %d, size = %d, thisWrite = %d, buf = %s\n", room, size, thisWrite, buf);
         bufPutBlk(op, buf, thisWrite);
         size -= thisWrite;
         buf += thisWrite;

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

@@ -31,70 +31,70 @@ extern "C" {
 #define CHASSIS_SOFTOFF	         0x05
 
 
+uint16_t  IPMICMD_ChassisControl( IPMI20_UDS_SESSION_T *pUDSSession, int timeout, char cmd);
 
 
+// /**
+//    \breif	Higher level function for PowerOff Host.
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerOff Host.
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
 
+// /**
+//    \breif	Higher level function for PowerUP Host
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerUP Host
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, int timeout/*in*/);
 
 
+// /**
+//    \breif	Higher level function for PowerCycle host.
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for PowerCycle host.
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
 
 
+// /**
+//    \breif	Higher level function for HardReset
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-/**
-   \breif	Higher level function for HardReset
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
-
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
-/**
-   \breif	Higher level function for DiagInt
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+// /**
+//    \breif	Higher level function for DiagInt
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
-/**
-   \breif	Higher level function for SoftOff
-   @param	pUDSSession		[in]Session handle
-   @param	timeout			[in]timeout value in seconds.
+// /**
+//    \breif	Higher level function for SoftOff
+//    @param	pUDSSession		[in]Session handle
+//    @param	timeout			[in]timeout value in seconds.
 
-   @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
-*/
-  uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
+//    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
+// */
+//   uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout );
     
 
 

+ 8 - 0
app/goahead-3.6.5/src/libipmi/inc/userinfo.h

@@ -0,0 +1,8 @@
+#ifndef __USER_INFO_H__
+#define __USER_INFO_H__
+
+#include "com_BmcType.h"
+
+int FlushUserInfoTbl(void);
+int UpdateUserInfoTble(void);
+#endif /* __USER_INFO_H__ */

+ 62 - 62
app/goahead-3.6.5/src/libipmi/src/libipmi_Chassis.c

@@ -155,89 +155,89 @@ uint16_t IPMICMD_ChassisIdentify(IPMI20_UDS_SESSION_T *pUDSSession,int timeout,C
 }
 
 
-uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_PowerOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWEROFF);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWEROFF);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed powerOFF  command.\n");
-    }else
-	TDBG("Error: PowerOFF Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed powerOFF  command.\n");
+//     }else
+// 	TDBG("Error: PowerOFF Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
-uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_PowerUp( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERUP);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERUP);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed powerUP the command.\n");
-    }else
-	TDBG("Error: PowerUp Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed powerUP the command.\n");
+//     }else
+// 	TDBG("Error: PowerUp Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
-uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_PowerCycle( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERCYCLE);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_POWERCYCLE);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed powerCycle the command.\n");
-    }else
-	TDBG("Error: PowerCycle Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed powerCycle the command.\n");
+//     }else
+// 	TDBG("Error: PowerCycle Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
-uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{	//TODO: jimbo control rst1~10 pin
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_HardReset( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {	//TODO: jimbo control rst1~10 pin
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_HARDRESET);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_HARDRESET);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed HardReset the command.\n");
-    }else
-	TDBG("Error: HardReset Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed HardReset the command.\n");
+//     }else
+// 	TDBG("Error: HardReset Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
-uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_DiagInt( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_DIAGINT);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_DIAGINT);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed DiagInt command.\n");
-    }else
-	TDBG("Error: DiagInt Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed DiagInt command.\n");
+//     }else
+// 	TDBG("Error: DiagInt Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
-uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
-{
-    uint16_t	wRet;
+// uint16_t LIBIPMI_HL_SoftOff( IPMI20_UDS_SESSION_T *pUDSSession, int timeout )
+// {
+//     uint16_t	wRet;
 
-    wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_SOFTOFF);
+//     wRet = IPMICMD_ChassisControl( pUDSSession, timeout, CHASSIS_SOFTOFF);
 
-    if (wRet == LIBIPMI_E_SUCCESS){
-	TDBG("Succefully executed SoftOff command.\n");
-    }else
-	TDBG("Error: SoftOff Command Failed.\n");
+//     if (wRet == LIBIPMI_E_SUCCESS){
+// 	TDBG("Succefully executed SoftOff command.\n");
+//     }else
+// 	TDBG("Error: SoftOff Command Failed.\n");
 	
-    return wRet;
-}
+//     return wRet;
+// }
 
 uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_UDS_SESSION_T *pUDSSession, int timeout, chassis_status_T *status)
 {
@@ -308,13 +308,13 @@ uint16_t LIBIPMI_HL_ChassisIdentify(IPMI20_UDS_SESSION_T *pUDSSession, int timeo
 	ChassisIdReq.IdentifyInterval = BlinkTimeSecs;
 	ChassisIdReq.ForceIdentify = ForceOn;
 	
-	TDBG("id interval and  force in libipmi are %d %d \n",ChassisIdReq.IdentifyInterval,ChassisIdReq.ForceIdentify);
+	printf("id interval and  force in libipmi are %d %d \n",ChassisIdReq.IdentifyInterval,ChassisIdReq.ForceIdentify);
 	
 	wRet = IPMICMD_ChassisIdentify(pUDSSession,timeout,&ChassisIdReq);
 	
 	if(wRet == LIBIPMI_E_SUCCESS)
 	{
-		TDBG("Chassis identify command success\n");
+		printf("Chassis identify command success\n");
 	}
 	else
 	{	

+ 18 - 0
app/goahead-3.6.5/src/libipmi/src/userinfo.c

@@ -0,0 +1,18 @@
+#include "hal_interface_api.h"
+#include "com_IPMIDefs.h"
+#include "userinfo.h"
+#include "goahead.h"
+
+
+int FlushUserInfoTbl(void)
+{
+	sf_sector_erase(5, USERTBL_FLASH_ADDR);
+	sf_write(5, USERTBL_FLASH_ADDR, (uint8_t*)UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
+	return 0;
+}
+
+int UpdateUserInfoTble(void)
+{
+	sf_read(5, USERTBL_FLASH_ADDR, (uint8_t*)UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
+	return 0;
+}

+ 9 - 2
app/goahead-3.6.5/src/route.txt

@@ -36,6 +36,15 @@ route uri=/action handler=action
 route uri=/ extensions=jst handler=jst
 route uri=/ methods=OPTIONS|TRACE handler=options
 
+############################### User code ##########################
+route uri=/index.html
+#route uri=/ redirect=*@/index.html
+
+
+
+
+
+
 #   For legacy GoAhead applications using /goform
 route uri=/goform handler=action
 
@@ -44,5 +53,3 @@ route uri=/goform handler=action
 #
 route uri=/
 
-############################### User code ##########################
-route uri=/index.html

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

@@ -1498,7 +1498,7 @@ PUBLIC ssize bufPut(WebsBuf *bp, char *fmt, ...)
     va_start(ap, fmt);
     str = sfmtv(fmt, ap);
     va_end(ap);
-
+//printf("---> bufPutBlk6 len = %d\n", strlen(str) * sizeof(char));
     rc = bufPutBlk(bp, str, strlen(str) * sizeof(char));
     *((char*) bp->endp) = (char) '\0';
     return rc;
@@ -1515,7 +1515,7 @@ PUBLIC ssize bufPutStr(WebsBuf *bp, char *str)
     assert(bp);
     assert(str);
     assert(bp->buflen == (bp->endbuf - bp->buf));
-
+//printf("---> bufPutBlk9 len = %d, str = %s\n", strlen(str) * sizeof(char), str);
     rc = bufPutBlk(bp, str, strlen(str) * sizeof(char));
     *((char*) bp->endp) = (char) '\0';
     return rc;
@@ -1610,7 +1610,7 @@ PUBLIC int bufPutStrA(WebsBuf *bp, char *str)
     assert(bp);
     assert(str);
     assert(bp->buflen == (bp->endbuf - bp->buf));
-
+//printf("---> bufPutBlk7 len = %d, str = %s\n", strlen(str), str);
     rc = (int) bufPutBlk(bp, str, strlen(str));
     bp->endp[0] = '\0';
     return rc;

+ 4 - 0
app/goahead-3.6.5/src/web_interface/inc/remote_control.h

@@ -3,4 +3,8 @@
 
 #include "goahead.h"
 
+void chassisPwrCtrl(Webs *wp);
+void getChassisStatus(Webs *wp);
+
+
 #endif /* __REMOTE_CONTROL_H__ */

+ 142 - 0
app/goahead-3.6.5/src/web_interface/src/remote_control.c

@@ -0,0 +1,142 @@
+#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 "libipmi_ChassisDevice.h"
+
+
+/*控制远程开关机及复位*/
+/* 
+	192.168.0.207/action/?pwrAction=on
+	192.168.0.207/action/?pwrAction=off
+	192.168.0.207/action/?pwrAction=reset
+	192.168.0.207/action/?pwrAction=cycle
+	192.168.0.207/action/?pwrAction=diagnostic
+	192.168.0.207/action/?pwrAction=soft
+*/
+void chassisPwrCtrl(Webs *wp){
+
+	IPMI20_UDS_SESSION_T    UDSSession;
+	char cmd = -1;
+	char *pwrAction = NULL;
+	int ret;
+	pwrAction = websGetVar(wp, "pwrAction", NULL);
+
+	if(strcmp(pwrAction, "on") == 0)
+		cmd = 1;
+	else if(strcmp(pwrAction, "off") == 0)
+		cmd = 0;
+	else if(strcmp(pwrAction, "reset") == 0)
+		cmd = 3;
+	else if(strcmp(pwrAction, "cycle") == 0)
+		cmd = 2;
+	else if(strcmp(pwrAction, "diagnostic")==0)
+		cmd = 4;
+	else if(strcmp(pwrAction, "soft") == 0)
+		cmd = 5;
+
+	printf("Get pwrAction: %s, cmd: %d\n", pwrAction, cmd);
+
+	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((cmd >= 0) && (cmd <= 5) )
+	{
+		//Create session
+	    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+	    IPMICMD_ChassisControl( &UDSSession, DEFAULT_TIMEOUT, cmd);
+	    //Close session
+	    LIBIPMI_CloseSession(&UDSSession );
+	    cJSON_AddStringToObject(data, "status", "success");
+	}
+	else
+	{
+		printf("Invalid command %d\n", cmd);
+		cJSON_AddStringToObject(data, "status", "fail");
+	}
+
+    pStr = cJSON_Print(root);
+
+    printf("---> cJSON Str: %d\n%s\n", strlen(pStr), pStr);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp);
+    ret = websWrite(wp, "%s", pStr);
+    if(ret < 0)
+    	printf("websWrite error\n");
+    
+    ret = websFlush(wp, 1);	//wait for all data to be written to the socket 
+  	printf("websFlush ret = %d\n", ret);
+    websDone(wp);
+
+    if(pwrAction)
+    	wfree(pwrAction);
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+}
+
+
+/*控制远程开关机及复位*/
+void getChassisStatus(Webs *wp)
+{
+	chassis_status_T chassisSta;
+	IPMI20_UDS_SESSION_T    UDSSession;
+	int ret;
+
+	//Create session
+    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+    LIBIPMI_HL_GetChassisStatus(&UDSSession, DEFAULT_TIMEOUT, &chassisSta);
+    //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(chassisSta.power_state == 0)
+    {
+    	cJSON_AddStringToObject(data, "powerStatus", "off" );
+    }
+    else
+    {
+    	cJSON_AddStringToObject(data, "powerStatus", "on" );	
+    }
+
+    pStr = cJSON_Print(root);
+
+    printf("---> cJSON Str: %d \n%s\n", strlen(pStr), pStr);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);	//Set length to -1 if unknown and transfer-chunk-encoding will be employed.
+    websWriteEndHeaders(wp);
+
+    ret = websWrite(wp, "%s", pStr);
+    if(ret < 0)
+    	printf("websWrite error\n");
+    
+    ret = websFlush(wp, 1);	//wait for all data to be written to the socket 
+    if(ret != 1)
+    	printf("websFlush error, ret = %d\n", ret);
+    
+    websDone(wp);
+
+    if(pStr)
+        wfree(pStr);
+    if(root)
+        cJSON_Delete(root);
+}

+ 2 - 0
app/hal_api/hal_interface_api.h

@@ -39,5 +39,7 @@ int sf_write(uint8_t spi, uint32_t Address, uint8_t *buf, uint32_t size);
 int stm32_adc_get_value(uint8_t channel, uint16_t *value);
 
 /* UART Interface */
+/* Platform Interface */
+int stm32_reset_mcu(void);
 
 #endif /* __HAL_INTERFACE_API_H__ */

+ 32 - 0
app/hal_api/hal_platform_interface.c

@@ -0,0 +1,32 @@
+#include "driver.h"
+#include <linux/types.h>
+#include <stdio.h>
+#include <string.h>
+#include "com_gpio.h"
+#include "hal_interface_api.h"
+#include "linux/fcntl.h"
+#include "time.h"
+#include <unistd.h>
+
+#define DEV_NAME	"/dev/platform"
+
+int stm32_reset_mcu(void)
+{
+	int fd;
+	int ret;
+	
+	fd = open(DEV_NAME, O_RDWR);
+	if(fd == -1)
+	{
+		printf("Open %s failed!\n", DEV_NAME);
+	}
+
+	ret = ioctl(fd, RESET_MCU, NULL);
+	if(ret == -1)
+	{
+		printf("Reset MCU failed!\n");
+	}
+	close(fd);
+
+	return ret;
+}

+ 15 - 12
app/ipmitool-1.8.18/Makefile

@@ -1,25 +1,30 @@
-EXEC		= ipmitool
+EXEC		:= ipmitool
 
 CFLAGS		:= -Os -mcpu=cortex-m3 -mthumb
 LDFLAGS		:= -mcpu=cortex-m3 -mthumb -L$(INSTALL_ROOT)/A2F/root/usr/lib
 
 
 
-CC	= $(CROSS_COMPILE_APPS)gcc
+CC	:= $(CROSS_COMPILE_APPS)gcc
 
 #source
-SRC	= src/ipmitool.c
+SRC	:= src/ipmitool.c
 SRC += src/plugins/ipmi_intf.c
-SRC += lib/log.c
+#SRC += lib/log.c
 SRC += lib/helper.c
-SRC += lib/ipmi_string.c
+SRC += lib/ipmi_strings.c
 SRC += lib/ipmi_main.c
 SRC += lib/ipmi_raw.c
 
 #SRC += lib/ipmi_delloem.c
 #SRC += lib/ipmi_oem.c
-#SRC += lib/ipmi_sdr.c
+SRC += lib/ipmi_sdr.c
 #SRC += lib/ipmi_sel.c
+SRC += lib/dimm_spd.c
+SRC += lib/ipmi_sdradd.c
+SRC += lib/ipmi_sel.c
+SRC += lib/ipmi_sensor.c
+SRC += lib/ipmi_fru.c
 
 
 
@@ -33,15 +38,13 @@ CFLAGS	+= -I ./include
 
 
 
-#object
-OBJS	= $(SRC:%.o=%.c)
+$(EXEC): $(SRC)
+	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBS) -lpthread -lm -lc
 
-$(EXEC): $(OBJS)
-	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBS) -lpthread
-	rm -f *.o
 
+#object
+OBJS	= $(SRC:%.c=%.o)
 clean:
-	OBJS	= $(SRC:%.o=%.c)
 	rm -rf $(EXEC) $(OBJS)
 
 

+ 3 - 0
app/ipmitool-1.8.18/include/ipmitool/helper.h

@@ -128,4 +128,7 @@ uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
 # define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;})
 #endif
 
+// double pow(double base,int ex);
+// double log(double a);
+
 #endif /* IPMI_HELPER_H */

BIN
app/ipmitool-1.8.18/ipmitool


+ 11 - 2
app/ipmitool-1.8.18/lib/dimm_spd.c

@@ -1329,6 +1329,15 @@ const struct valstr jedec_id9_vals[] = {
 	{ 0x00, NULL },
 };
 
+// //jimbo
+// int ldexp(int a, int b)
+// {
+// 	int i,m=1;
+// 	for(i=0;i<b;i++)
+// 		m = 2*m;
+// 	return a*m;
+// }
+
 int
 ipmi_spd_print(uint8_t *spd_data, int len)
 {
@@ -1645,12 +1654,12 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
 	fru.size = (rsp->data[1] << 8) | rsp->data[0];
 	fru.access = rsp->data[2] & 0x1;
 
-	lprintf(LOG_DEBUG, "fru.size = %d bytes (accessed by %s)",
+	printf(  "fru.size = %d bytes (accessed by %s)",
 		fru.size, fru.access ? "words" : "bytes");
 
 
 	if (fru.size < 1) {
-		lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
+		printf(  " Invalid FRU size %d", fru.size);
 		return -1;
 	}
 

+ 69 - 55
app/ipmitool-1.8.18/lib/helper.c

@@ -29,12 +29,12 @@
  * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
-#define _POSIX_SOURCE
-#define /* glibc 2.19 and earlier */ _BSD_SOURCE || \
-	/* Since glibc 2.20 */_DEFAULT_SOURCE || \
-	_XOPEN_SOURCE >= 500 || \
-	_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || \
-	/* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200112L \
+// #define _POSIX_SOURCE
+// #define /* glibc 2.19 and earlier */ _BSD_SOURCE || \
+// 	/* Since glibc 2.20 */_DEFAULT_SOURCE || \
+// 	_XOPEN_SOURCE >= 500 || \
+// 	_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || \
+// 	/* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200112L \
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -62,7 +62,7 @@
 #include <ipmitool/ipmi.h>
 #include <ipmitool/ipmi_intf.h>
 #include <ipmitool/helper.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 
 extern int verbose;
 
@@ -249,13 +249,13 @@ str2mac(const char *arg, uint8_t *buf)
 	unsigned int m6 = 0;
 	if (sscanf(arg, "%02x:%02x:%02x:%02x:%02x:%02x",
 		   &m1, &m2, &m3, &m4, &m5, &m6) != 6) {
-		lprintf(LOG_ERR, "Invalid MAC address: %s", arg);
+		printf( "Invalid MAC address: %s", arg);
 		return -1;
 	}
 	if (m1 > UINT8_MAX || m2 > UINT8_MAX
 			|| m3 > UINT8_MAX || m4 > UINT8_MAX
 			|| m5 > UINT8_MAX || m6 > UINT8_MAX) {
-		lprintf(LOG_ERR, "Invalid MAC address: %s", arg);
+		printf( "Invalid MAC address: %s", arg);
 		return -1;
 	}
 	buf[0] = (uint8_t)m1;
@@ -585,15 +585,15 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
 		if (loglevel < 0)
 			printf("\n%s:\n\n", title);
 		else
-			lprintf(loglevel, "\n%s:\n", title);
+			printf( "\n%s:\n", title);
 	}
 
 	if (loglevel < 0) {
 		printf("  VALUE\tHEX\tSTRING\n");
 		printf("==============================================\n");
 	} else {
-		lprintf(loglevel, "  VAL\tHEX\tSTRING");
-		lprintf(loglevel, "==============================================");
+		printf( "  VAL\tHEX\tSTRING");
+		printf( "==============================================");
 	}
 
 	for (i = 0; vs[i].str != NULL; i++) {
@@ -604,16 +604,16 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
 				printf("  %d\t0x%04x\t%s\n", vs[i].val, vs[i].val, vs[i].str);
 		} else {
 			if (vs[i].val < 256)
-				lprintf(loglevel, "  %d\t0x%02x\t%s", vs[i].val, vs[i].val, vs[i].str);
+				printf( "  %d\t0x%02x\t%s", vs[i].val, vs[i].val, vs[i].str);
 			else
-				lprintf(loglevel, "  %d\t0x%04x\t%s", vs[i].val, vs[i].val, vs[i].str);
+				printf( "  %d\t0x%04x\t%s", vs[i].val, vs[i].val, vs[i].str);
 		}
 	}
 
 	if (loglevel < 0)
 		printf("\n");
 	else
-		lprintf(loglevel, "");
+		printf( "");
 }
 
 /* print_valstr_2col  -  print value string list in two columns to log or stdout
@@ -634,7 +634,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
 		if (loglevel < 0)
 			printf("\n%s:\n\n", title);
 		else
-			lprintf(loglevel, "\n%s:\n", title);
+			printf( "\n%s:\n", title);
 	}
 
 	for (i = 0; vs[i].str != NULL; i++) {
@@ -643,7 +643,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
 			if (loglevel < 0) {
 				printf("  %4d  %-32s\n", vs[i].val, vs[i].str);
 			} else {
-				lprintf(loglevel, "  %4d  %-32s\n", vs[i].val, vs[i].str);
+				printf( "  %4d  %-32s\n", vs[i].val, vs[i].str);
 			}
 		}
 		else {
@@ -651,7 +651,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
 				printf("  %4d  %-32s    %4d  %-32s\n",
 				       vs[i].val, vs[i].str, vs[i+1].val, vs[i+1].str);
 			} else {
-				lprintf(loglevel, "  %4d  %-32s    %4d  %-32s\n",
+				printf( "  %4d  %-32s    %4d  %-32s\n",
 					vs[i].val, vs[i].str, vs[i+1].val, vs[i+1].str);
 			}
 			i++;
@@ -661,7 +661,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
 	if (loglevel < 0)
 		printf("\n");
 	else
-		lprintf(loglevel, "");
+		printf( "");
 }
 
 /* ipmi_csum  -  calculate an ipmi checksum
@@ -698,14 +698,14 @@ ipmi_open_file(const char * file, int rw)
 			/* does not exist, ok to create */
 			fp = fopen(file, "w");
 			if (fp == NULL) {
-				lperror(LOG_ERR, "Unable to open file %s "
+				printf("Unable to open file %s "
 					"for write", file);
 				return NULL;
 			}
 			/* created ok, now return the descriptor */
 			return fp;
 		} else {
-			lprintf(LOG_ERR, "File %s does not exist", file);
+			printf( "File %s does not exist", file);
 			return NULL;
 		}
 	}
@@ -715,7 +715,7 @@ ipmi_open_file(const char * file, int rw)
 		/* on read skip the extra checks */
 		fp = fopen(file, "r");
 		if (fp == NULL) {
-			lperror(LOG_ERR, "Unable to open file %s", file);
+			printf( "Unable to open file %s", file);
 			return NULL;
 		}
 		return fp;
@@ -724,34 +724,34 @@ ipmi_open_file(const char * file, int rw)
 
 	/* it exists - only regular files, not links */
 	if (S_ISREG(st1.st_mode) == 0) {
-		lprintf(LOG_ERR, "File %s has invalid mode: %d",
+		printf( "File %s has invalid mode: %d",
 			file, st1.st_mode);
 		return NULL;
 	}
 
 	/* allow only files with 1 link (itself) */
 	if (st1.st_nlink != 1) {
-		lprintf(LOG_ERR, "File %s has invalid link count: %d != 1",
+		printf( "File %s has invalid link count: %d != 1",
 		       file, (int)st1.st_nlink);
 		return NULL;
 	}
 
 	fp = fopen(file, rw ? "w+" : "r");
 	if (fp == NULL) {
-		lperror(LOG_ERR, "Unable to open file %s", file);
+		printf( "Unable to open file %s", file);
 		return NULL;
 	}
 
 	/* stat again */
 	if (fstat(fileno(fp), &st2) < 0) {
-		lperror(LOG_ERR, "Unable to stat file %s", file);
+		printf( "Unable to stat file %s", file);
 		fclose(fp);
 		return NULL;
 	}
 
 	/* verify inode */
 	if (st1.st_ino != st2.st_ino) {
-		lprintf(LOG_ERR, "File %s has invalid inode: %d != %d",
+		printf( "File %s has invalid inode: %d != %d",
 			file, st1.st_ino, st2.st_ino);
 		fclose(fp);
 		return NULL;
@@ -759,7 +759,7 @@ ipmi_open_file(const char * file, int rw)
 
 	/* verify owner */
 	if (st1.st_uid != st2.st_uid) {
-		lprintf(LOG_ERR, "File %s has invalid user id: %d != %d",
+		printf( "File %s has invalid user id: %d != %d",
 			file, st1.st_uid, st2.st_uid);
 		fclose(fp);
 		return NULL;
@@ -767,7 +767,7 @@ ipmi_open_file(const char * file, int rw)
 
 	/* verify inode */
 	if (st2.st_nlink != 1) {
-		lprintf(LOG_ERR, "File %s has invalid link count: %d != 1",
+		printf( "File %s has invalid link count: %d != 1",
 			file, st2.st_nlink);
 		fclose(fp);
 		return NULL;
@@ -854,23 +854,23 @@ eval_ccode(const int ccode)
 	} else if (ccode < 0) {
 		switch (ccode) {
 			case (-1):
-				lprintf(LOG_ERR, "IPMI response is NULL.");
+				printf( "IPMI response is NULL.");
 				break;
 			case (-2):
-				lprintf(LOG_ERR, "Unexpected data length received.");
+				printf( "Unexpected data length received.");
 				break;
 			case (-3):
-				lprintf(LOG_ERR, "Invalid function parameter.");
+				printf( "Invalid function parameter.");
 				break;
 			case (-4):
-				lprintf(LOG_ERR, "ipmitool: malloc failure.");
+				printf( "ipmitool: malloc failure.");
 				break;
 			default:
 				break;
 		}
 		return (-1);
 	} else {
-		lprintf(LOG_ERR, "IPMI command failed: %s",
+		printf( "IPMI command failed: %s",
 				val2str(ccode, completion_code_vals));
 		return (-1);
 	}
@@ -890,14 +890,14 @@ int
 is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr)
 {
 	if (!argv_ptr || !fru_id_ptr) {
-		lprintf(LOG_ERR, "is_fru_id(): invalid argument(s).");
+		printf( "is_fru_id(): invalid argument(s).");
 		return (-1);
 	}
 
 	if (str2uchar(argv_ptr, fru_id_ptr) == 0) {
 		return 0;
 	}
-	lprintf(LOG_ERR, "FRU ID '%s' is either invalid or out of range.",
+	printf( "FRU ID '%s' is either invalid or out of range.",
 			argv_ptr);
 	return (-1);
 } /* is_fru_id(...) */
@@ -919,8 +919,7 @@ int
 is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr)
 {
 	if (!argv_ptr || !channel_ptr) {
-		lprintf(LOG_ERR,
-				"is_ipmi_channel_num(): invalid argument(s).");
+		printf("is_ipmi_channel_num(): invalid argument(s).");
 		return (-1);
 	}
 	if ((str2uchar(argv_ptr, channel_ptr) == 0)
@@ -928,10 +927,9 @@ is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr)
 				|| (*channel_ptr >= 0xE && *channel_ptr <= 0xF))) {
 		return 0;
 	}
-	lprintf(LOG_ERR,
-			"Given Channel number '%s' is either invalid or out of range.",
+	printf(	"Given Channel number '%s' is either invalid or out of range.",
 			argv_ptr);
-	lprintf(LOG_ERR, "Channel number must be from ranges: <0x0..0xB>, <0xE..0xF>");
+	printf( "Channel number must be from ranges: <0x0..0xB>, <0xE..0xF>");
 	return (-1);
 }
 
@@ -948,8 +946,7 @@ int
 is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr)
 {
 	if (!argv_ptr || !ipmi_uid_ptr) {
-		lprintf(LOG_ERR,
-				"is_ipmi_user_id(): invalid argument(s).");
+		printf("is_ipmi_user_id(): invalid argument(s).");
 		return (-1);
 	}
 	if ((str2uchar(argv_ptr, ipmi_uid_ptr) == 0)
@@ -957,10 +954,9 @@ is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr)
 			&& *ipmi_uid_ptr <= IPMI_UID_MAX) {
 		return 0;
 	}
-	lprintf(LOG_ERR,
-			"Given User ID '%s' is either invalid or out of range.",
+	printf("Given User ID '%s' is either invalid or out of range.",
 			argv_ptr);
-	lprintf(LOG_ERR, "User ID is limited to range <%i..%i>.",
+	printf( "User ID is limited to range <%i..%i>.",
 			IPMI_UID_MIN, IPMI_UID_MAX);
 	return (-1);
 }
@@ -977,19 +973,16 @@ int
 is_ipmi_user_priv_limit(const char *argv_ptr, uint8_t *ipmi_priv_limit_ptr)
 {
 	if (!argv_ptr || !ipmi_priv_limit_ptr) {
-		lprintf(LOG_ERR,
-				"is_ipmi_user_priv_limit(): invalid argument(s).");
+		printf(	"is_ipmi_user_priv_limit(): invalid argument(s).");
 		return (-1);
 	}
 	if ((str2uchar(argv_ptr, ipmi_priv_limit_ptr) != 0)
 			|| ((*ipmi_priv_limit_ptr < 0x01
 				|| *ipmi_priv_limit_ptr > 0x05)
 				&& *ipmi_priv_limit_ptr != 0x0F)) {
-		lprintf(LOG_ERR,
-				"Given Privilege Limit '%s' is invalid.",
+		printf("Given Privilege Limit '%s' is invalid.",
 				argv_ptr);
-		lprintf(LOG_ERR,
-				"Privilege Limit is limited to <0x1..0x5> and <0xF>.");
+		printf(	"Privilege Limit is limited to <0x1..0x5> and <0xF>.");
 		return (-1);
 	}
 	return 0;
@@ -1010,16 +1003,37 @@ ipmi_get_oem_id(struct ipmi_intf *intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get Board ID command failed");
+		printf( "Get Board ID command failed");
 		return 0;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
+		printf( "Get Board ID command failed: %#x %s",
 			rsp->ccode, val2str(rsp->ccode, completion_code_vals));
 		return 0;
 	}
 	oem_id = rsp->data[0] | (rsp->data[1] << 8);
-	lprintf(LOG_DEBUG,"Board ID: %x", oem_id);
+	printf("Board ID: %x", oem_id);
 
 	return oem_id;
 }
+
+
+
+// double log(double a)  
+// {  
+//    int N = 15;//我们取了前15+1项来估算  
+//    int k,nk;  
+//    double x,xx,y;  
+//    x = (a-1)/(a+1);  
+//    xx = x*x;  
+//    nk = 2*N+1;  
+//    y = 1.0/nk;  
+//    for(k=N;k>0;k--)  
+//    {  
+//      nk = nk - 2;  
+//      y = 1.0/nk+xx*y;  
+       
+//    }  
+//    return 2.0*x*y;  
+     
+// }  

File diff suppressed because it is too large
+ 149 - 149
app/ipmitool-1.8.18/lib/ipmi_fru.c


+ 119 - 120
app/ipmitool-1.8.18/lib/ipmi_main.c

@@ -167,12 +167,12 @@ ipmi_cmd_print(struct ipmi_cmd * cmdlist)
 		if (cmd->desc == NULL)
 			continue;
 		if (hdr == 0) {
-			lprintf(LOG_NOTICE, "Commands:");
+			printf( "Commands:");
 			hdr = 1;
 		}
-		lprintf(LOG_NOTICE, "\t%-12s  %s", cmd->name, cmd->desc);
+		printf( "\t%-12s  %s", cmd->name, cmd->desc);
 	}
-	lprintf(LOG_NOTICE, "");
+	printf( "");
 }
 
 /* ipmi_cmd_run - run a command from list based on parameters
@@ -201,7 +201,7 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
 		else if (strncmp(cmd->name, "default", 7) == 0)
 			return cmd->func(intf, 0, NULL);
 		else {
-			lprintf(LOG_ERR, "No command provided!");
+			printf("No command provided!");
 			ipmi_cmd_print(intf->cmdlist);
 			return -1;
 		}
@@ -216,7 +216,7 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
 		if (strncmp(cmd->name, "default", 7) == 0)
 			return cmd->func(intf, argc+1, argv-1);
 
-		lprintf(LOG_ERR, "Invalid command: %s", name);
+		printf("Invalid command: %s", name);
 		ipmi_cmd_print(intf->cmdlist);
 		return -1;
 	}
@@ -226,49 +226,49 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
 static void
 ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist)
 {
-	lprintf(LOG_NOTICE, "%s version %s\n", progname, VERSION);
-	lprintf(LOG_NOTICE, "usage: %s [options...] <command>\n", progname);
-	lprintf(LOG_NOTICE, "       -h             This help");
-	lprintf(LOG_NOTICE, "       -V             Show version information");
-	lprintf(LOG_NOTICE, "       -v             Verbose (can use multiple times)");
-	lprintf(LOG_NOTICE, "       -c             Display output in comma separated format");
-	lprintf(LOG_NOTICE, "       -d N           Specify a /dev/ipmiN device to use (default=0)");
-	lprintf(LOG_NOTICE, "       -I intf        Interface to use");
-	lprintf(LOG_NOTICE, "       -H hostname    Remote host name for LAN interface");
-	lprintf(LOG_NOTICE, "       -p port        Remote RMCP port [default=623]");
-	lprintf(LOG_NOTICE, "       -U username    Remote session username");
-	lprintf(LOG_NOTICE, "       -f file        Read remote session password from file");
-	lprintf(LOG_NOTICE, "       -z size        Change Size of Communication Channel (OEM)");
-	lprintf(LOG_NOTICE, "       -S sdr         Use local file for remote SDR cache");
-	lprintf(LOG_NOTICE, "       -D tty:b[:s]   Specify the serial device, baud rate to use");
-	lprintf(LOG_NOTICE, "                      and, optionally, specify that interface is the system one");
-	lprintf(LOG_NOTICE, "       -4             Use only IPv4");
-	lprintf(LOG_NOTICE, "       -6             Use only IPv6");
+	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");
 #ifdef ENABLE_ALL_OPTIONS
-	lprintf(LOG_NOTICE, "       -a             Prompt for remote password");
-	lprintf(LOG_NOTICE, "       -Y             Prompt for the Kg key for IPMIv2 authentication");
-	lprintf(LOG_NOTICE, "       -e char        Set SOL escape character");
-	lprintf(LOG_NOTICE, "       -C ciphersuite Cipher suite to be used by lanplus interface");
-	lprintf(LOG_NOTICE, "       -k key         Use Kg key for IPMIv2 authentication");
-	lprintf(LOG_NOTICE, "       -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication");
-	lprintf(LOG_NOTICE, "       -L level       Remote session privilege level [default=ADMINISTRATOR]");
-	lprintf(LOG_NOTICE, "                      Append a '+' to use name/privilege lookup in RAKP1");
-	lprintf(LOG_NOTICE, "       -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM");
-	lprintf(LOG_NOTICE, "       -P password    Remote session password");
-	lprintf(LOG_NOTICE, "       -E             Read password from IPMI_PASSWORD environment variable");
-	lprintf(LOG_NOTICE, "       -K             Read kgkey from IPMI_KGKEY environment variable");
-	lprintf(LOG_NOTICE, "       -m address     Set local IPMB address");
-	lprintf(LOG_NOTICE, "       -b channel     Set destination channel for bridged request");
-	lprintf(LOG_NOTICE, "       -t address     Bridge request to remote target address");
-	lprintf(LOG_NOTICE, "       -B channel     Set transit channel for bridged request (dual bridge)");
-	lprintf(LOG_NOTICE, "       -T address     Set transit address for bridge request (dual bridge)");
-	lprintf(LOG_NOTICE, "       -l lun         Set destination lun for raw commands");
-	lprintf(LOG_NOTICE, "       -o oemtype     Setup for OEM (use 'list' to see available OEM types)");
-	lprintf(LOG_NOTICE, "       -O seloem      Use file for OEM SEL event descriptions");
-	lprintf(LOG_NOTICE, "       -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface");
-	lprintf(LOG_NOTICE, "       -R retry       Set the number of retries for lan/lanplus interface [default=4]");
+	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]");
 #endif
-	lprintf(LOG_NOTICE, "");
+	printf( "");
 
 	ipmi_intf_print(intflist);
 
@@ -374,7 +374,7 @@ ipmi_main(int argc, char ** argv,
 			}
 			intfname = strdup(optarg);
 			if (intfname == NULL) {
-				lprintf(LOG_ERR, "%s: malloc failure", progname);
+				printf( "%s: malloc failure", progname);
 				goto out_free;
 			}
 			if (intflist != NULL) {
@@ -386,7 +386,7 @@ ipmi_main(int argc, char ** argv,
 						found = 1;
 				}
 				if (!found) {
-					lprintf(LOG_ERR, "Interface %s not supported", intfname);
+					printf( "Interface %s not supported", intfname);
 					goto out_free;
 				}
 			}
@@ -401,53 +401,53 @@ ipmi_main(int argc, char ** argv,
 			rc = 0;
 			goto out_free;
 			break;
-		case 'd':
-			if (str2int(optarg, &devnum) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-d'.");
-				rc = -1;
-				goto out_free;
-			}
-			/* Check if device number is -gt 0; I couldn't find limit for
-			 * kernels > 2.6, thus right side is unlimited.
-			 */
-			if (devnum < 0) {
-				lprintf(LOG_ERR, "Device number %i is out of range.", devnum);
-				rc = -1;
-				goto out_free;
-			}
-			break;
-		case 'p':
-			if (str2int(optarg, &port) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-p'.");
-				rc = -1;
-				goto out_free;
-			}
-			/* Check if port is -gt 0 && port is -lt 65535 */
-			if (port < 0 || port > 65535) {
-				lprintf(LOG_ERR, "Port number %i is out of range.", port);
-				rc = -1;
-				goto out_free;
-			}
-			break;
-		case 'C':
-			if (str2int(optarg, &cipher_suite_id) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-C'.");
-				rc = -1;
-				goto out_free;
-			}
-			/* add check Cipher is -gt 0 */
-			if (cipher_suite_id < 0) {
-				lprintf(LOG_ERR, "Cipher suite ID %i is invalid.", cipher_suite_id);
-				rc = -1;
-				goto out_free;
-			}
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case 'c':
-			csv_output = 1;
-			break;
+		// case 'd':
+		// 	if (str2int(optarg, &devnum) != 0) {
+		// 		lprintf(LOG_ERR, "Invalid parameter given or out of range for '-d'.");
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	/* Check if device number is -gt 0; I couldn't find limit for
+		// 	 * kernels > 2.6, thus right side is unlimited.
+		// 	 */
+		// 	if (devnum < 0) {
+		// 		lprintf(LOG_ERR, "Device number %i is out of range.", devnum);
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	break;
+		// case 'p':
+		// 	if (str2int(optarg, &port) != 0) {
+		// 		lprintf(LOG_ERR, "Invalid parameter given or out of range for '-p'.");
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	/* Check if port is -gt 0 && port is -lt 65535 */
+		// 	if (port < 0 || port > 65535) {
+		// 		lprintf(LOG_ERR, "Port number %i is out of range.", port);
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	break;
+		// case 'C':
+		// 	if (str2int(optarg, &cipher_suite_id) != 0) {
+		// 		lprintf(LOG_ERR, "Invalid parameter given or out of range for '-C'.");
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	/* add check Cipher is -gt 0 */
+		// 	if (cipher_suite_id < 0) {
+		// 		lprintf(LOG_ERR, "Cipher suite ID %i is invalid.", cipher_suite_id);
+		// 		rc = -1;
+		// 		goto out_free;
+		// 	}
+		// 	break;
+		// case 'v':
+		// 	verbose++;
+		// 	break;
+		// case 'c':
+		// 	csv_output = 1;
+		// 	break;
 		case 'H':
 			if (hostname) {
 				free(hostname);
@@ -455,7 +455,7 @@ ipmi_main(int argc, char ** argv,
 			}
 			hostname = strdup(optarg);
 			if (hostname == NULL) {
-				lprintf(LOG_ERR, "%s: malloc failure", progname);
+				printf( "%s: malloc failure", progname);
 				goto out_free;
 			}
 			break;
@@ -535,12 +535,12 @@ ipmi_main(int argc, char ** argv,
 				username = NULL;
 			}
 			if (strlen(optarg) > 16) {
-				lprintf(LOG_ERR, "Username is too long (> 16 bytes)");
+				printf( "Username is too long (> 16 bytes)");
 				goto out_free;
 			}
 			username = strdup(optarg);
 			if (username == NULL) {
-				lprintf(LOG_ERR, "%s: malloc failure", progname);
+				printf( "%s: malloc failure", progname);
 				goto out_free;
 			}
 			break;
@@ -640,7 +640,7 @@ ipmi_main(int argc, char ** argv,
 			}
 			password = strdup(optarg);
 			if (password == NULL) {
-				lprintf(LOG_ERR, "%s: malloc failure", progname);
+				printf( "%s: malloc failure", progname);
 				goto out_free;
 			}
 
@@ -691,14 +691,14 @@ ipmi_main(int argc, char ** argv,
 		// 	break;
 		case 't':
 			if (str2uchar(optarg, &target_addr) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-t'.");
+				printf( "Invalid parameter given or out of range for '-t'.");
 				rc = -1;
 				goto out_free;
 			}
 			break;
 		case 'b':
 			if (str2uchar(optarg, &target_channel) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-b'.");
+				printf( "Invalid parameter given or out of range for '-b'.");
 				rc = -1;
 				goto out_free;
 			}
@@ -726,7 +726,7 @@ ipmi_main(int argc, char ** argv,
 		// 	break;
 		case 'm':
 			if (str2uchar(optarg, &arg_addr) != 0) {
-				lprintf(LOG_ERR, "Invalid parameter given or out of range for '-m'.");
+				printf( "Invalid parameter given or out of range for '-m'.");
 				rc = -1;
 				goto out_free;
 			}
@@ -820,18 +820,18 @@ ipmi_main(int argc, char ** argv,
 	if (intfname == NULL && hostname != NULL) {
 		intfname = strdup("lan");
 		if (intfname == NULL) {
-			lprintf(LOG_ERR, "%s: malloc failure", progname);
+			printf( "%s: malloc failure", progname);
 			goto out_free;
 		}
 	}
 
 	if (password != NULL && intfname != NULL) {
 		if (strcmp(intfname, "lan") == 0 && strlen(password) > 16) {
-			lprintf(LOG_ERR, "%s: password is longer than 16 bytes.", intfname);
+			printf( "%s: password is longer than 16 bytes.", intfname);
 			rc = -1;
 			goto out_free;
 		} else if (strcmp(intfname, "lanplus") == 0 && strlen(password) > 20) {
-			lprintf(LOG_ERR, "%s: password is longer than 20 bytes.", intfname);
+			printf( "%s: password is longer than 20 bytes.", intfname);
 			rc = -1;
 			goto out_free;
 		}
@@ -840,19 +840,19 @@ ipmi_main(int argc, char ** argv,
 	/* load interface */
 	ipmi_main_intf = ipmi_intf_load(intfname);
 	if (ipmi_main_intf == NULL) {
-		lprintf(LOG_ERR, "Error loading interface %s", intfname);
+		printf( "Error loading interface %s", intfname);
 		goto out_free;
 	}
 
-	/* setup log */
-	log_init(progname, 0, verbose);
+	// /* setup log */
+	// log_init(progname, 0, verbose);
 
-	/* run OEM setup if found */
-	if (oemtype != NULL &&
-	    ipmi_oem_setup(ipmi_main_intf, oemtype) < 0) {
-		lprintf(LOG_ERR, "OEM setup for \"%s\" failed", oemtype);
-		goto out_free;
-	}
+	// /* run OEM setup if found */
+	// if (oemtype != NULL &&
+	//     ipmi_oem_setup(ipmi_main_intf, oemtype) < 0) {
+	// 	lprintf(LOG_ERR, "OEM setup for \"%s\" failed", oemtype);
+	// 	goto out_free;
+	// }
 
 	/* set session variables */
 	if (hostname != NULL)
@@ -942,8 +942,7 @@ ipmi_main(int argc, char ** argv,
 		/* sanity check, transit makes no sense without a target */
 		if ((transit_addr != 0 || transit_channel != 0) &&
 			target_addr == 0) {
-			lprintf(LOG_ERR,
-				"Transit address/channel %#x/%#x ignored. "
+			printf("Transit address/channel %#x/%#x ignored. "
 				"Target address must be specified!",
 				transit_addr, transit_channel);
 			goto out_free;
@@ -960,13 +959,13 @@ ipmi_main(int argc, char ** argv,
 		// /* Get the ipmb address of the targeted entity */
 		// ipmi_main_intf->target_ipmb_addr =
 		// 			ipmi_acquire_ipmb_address(ipmi_main_intf);
-		lprintf(LOG_DEBUG, "Specified addressing     Target  %#x:%#x Transit %#x:%#x",
+		printf("Specified addressing     Target  %#x:%#x Transit %#x:%#x",
 					   ipmi_main_intf->target_addr,
 					   ipmi_main_intf->target_channel,
 					   ipmi_main_intf->transit_addr,
 					   ipmi_main_intf->transit_channel);
 		if (ipmi_main_intf->target_ipmb_addr) {
-			lprintf(LOG_INFO, "Discovered Target IPMB-0 address %#x",
+			printf("Discovered Target IPMB-0 address %#x",
 					   ipmi_main_intf->target_ipmb_addr);
 		}
 	}
@@ -974,7 +973,7 @@ ipmi_main(int argc, char ** argv,
 	/* set target LUN (for RAW command) */
 	ipmi_main_intf->target_lun = target_lun ;
 
-	lprintf(LOG_DEBUG, "Interface address: my_addr %#x "
+	printf("Interface address: my_addr %#x "
 			   "transit %#x:%#x target %#x:%#x "
 			   "ipmb_target %#x\n",
 			ipmi_main_intf->my_addr,
@@ -1030,7 +1029,7 @@ ipmi_main(int argc, char ** argv,
 		ipmi_main_intf->close(ipmi_main_intf);
 
 	out_free:
-	log_halt();
+	//log_halt();
 
 	if (intfname != NULL) {
 		free(intfname);

+ 32 - 33
app/ipmitool-1.8.18/lib/ipmi_raw.c

@@ -35,7 +35,7 @@
 #include <stdio.h>
 
 #include <ipmitool/ipmi.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 #include <ipmitool/helper.h>
 #include <ipmitool/ipmi_intf.h>
 #include <ipmitool/ipmi_raw.h>
@@ -70,11 +70,11 @@ ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
 	uint8_t rqdata[IPMI_I2C_MASTER_MAX_SIZE + 3];
 
 	if (rsize > IPMI_I2C_MASTER_MAX_SIZE) {
-		lprintf(LOG_ERR, "Master Write-Read: Too many bytes (%d) to read", rsize);
+		printf( "Master Write-Read: Too many bytes (%d) to read", rsize);
 		return NULL;
 	}
 	if (wsize > IPMI_I2C_MASTER_MAX_SIZE) {
-		lprintf(LOG_ERR, "Master Write-Read: Too many bytes (%d) to write", wsize);
+		printf( "Master Write-Read: Too many bytes (%d) to write", wsize);
 		return NULL;
 	}
 
@@ -93,34 +93,34 @@ ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
 		/* copy in data to write */
 		memcpy(rqdata+3, wdata, wsize);
 		req.msg.data_len += wsize;
-		lprintf(LOG_DEBUG, "Writing %d bytes to i2cdev %02Xh", wsize, addr);
+		printf( "Writing %d bytes to i2cdev %02Xh", wsize, addr);
 	}
 
 	if (rsize > 0) {
-		lprintf(LOG_DEBUG, "Reading %d bytes from i2cdev %02Xh", rsize, addr);
+		printf( "Reading %d bytes from i2cdev %02Xh", rsize, addr);
 	}
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "I2C Master Write-Read command failed");
+		printf( "I2C Master Write-Read command failed");
 		return NULL;
 	}
 	else if (rsp->ccode > 0) {
 		switch (rsp->ccode) {
 		case 0x81:
-			lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration");
+			printf( "I2C Master Write-Read command failed: Lost Arbitration");
 			break;
 		case 0x82:
-			lprintf(LOG_ERR, "I2C Master Write-Read command failed: Bus Error");
+			printf( "I2C Master Write-Read command failed: Bus Error");
 			break;
 		case 0x83:
-			lprintf(LOG_ERR, "I2C Master Write-Read command failed: NAK on Write");
+			printf( "I2C Master Write-Read command failed: NAK on Write");
 			break;
 		case 0x84:
-			lprintf(LOG_ERR, "I2C Master Write-Read command failed: Truncated Read");
+			printf( "I2C Master Write-Read command failed: Truncated Read");
 			break;
 		default:
-			lprintf(LOG_ERR, "I2C Master Write-Read command failed: %s",
+			printf( "I2C Master Write-Read command failed: %s",
 				val2str(rsp->ccode, completion_code_vals));
 			break;
 		}
@@ -146,7 +146,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
 	memset(spd_data, 0, RAW_SPD_SIZE);
 
 	if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
-		lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
+		printf( "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
 		return 0;
 	}
 
@@ -172,7 +172,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
 		rsp = ipmi_master_write_read(intf, i2cbus, i2caddr,
 					     (uint8_t *)&i, 1, msize );
 		if (rsp == NULL) {
-			lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
+			printf( "Unable to perform I2C Master Write-Read");
 			return -1;
 		}
 
@@ -185,9 +185,9 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
 
 static void rawi2c_usage(void)
 {
-	lprintf(LOG_NOTICE, "usage: i2c [bus=public|# [chan=#] <i2caddr> <read bytes> [write data]");
-	lprintf(LOG_NOTICE, "            bus=public is default");
-	lprintf(LOG_NOTICE, "            chan=0 is default, bus= must be specified to use chan=");
+	printf( "usage: i2c [bus=public|# [chan=#] <i2caddr> <read bytes> [write data]");
+	printf( "            bus=public is default");
+	printf( "            chan=0 is default, bus= must be specified to use chan=");
 }
 
 int
@@ -226,7 +226,7 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
 		return 0;
 	}
 	else if (argc-i-2 > IPMI_I2C_MASTER_MAX_SIZE) {
-		lprintf(LOG_ERR, "Raw command input limit (%d bytes) exceeded",
+		printf( "Raw command input limit (%d bytes) exceeded",
 			IPMI_I2C_MASTER_MAX_SIZE);
 		return -1;
 	}
@@ -238,7 +238,7 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
 		return (-1);
 
 	if (i2caddr == 0) {
-		lprintf(LOG_ERR, "Invalid I2C address 0");
+		printf( "Invalid I2C address 0");
 		rawi2c_usage();
 		return -1;
 	}
@@ -254,13 +254,13 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
 		wsize++;
 	}
 
-	lprintf(LOG_INFO, "RAW I2C REQ (i2caddr=%x readbytes=%d writebytes=%d)",
+	printf( "RAW I2C REQ (i2caddr=%x readbytes=%d writebytes=%d)",
 		i2caddr, rsize, wsize);
 	printbuf(wdata, wsize, "WRITE DATA");
 
 	rsp = ipmi_master_write_read(intf, bus, i2caddr, wdata, wsize, rsize);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
+		printf( "Unable to perform I2C Master Write-Read");
 		return -1;
 	}
 
@@ -307,9 +307,9 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
 void
 ipmi_raw_help()
 {
-	lprintf(LOG_NOTICE, "RAW Commands:  raw <netfn> <cmd> [data]");
-	print_valstr(ipmi_netfn_vals, "Network Function Codes", LOG_NOTICE);
-	lprintf(LOG_NOTICE, "(can also use raw hex values)");
+	printf( "RAW Commands:  raw <netfn> <cmd> [data]");
+	print_valstr(ipmi_netfn_vals, "Network Function Codes", -1);
+	printf( "(can also use raw hex values)");
 } /* ipmi_raw_help() */
 
 int
@@ -327,13 +327,13 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
 		return 0;
 	}
 	else if (argc < 2) {
-		lprintf(LOG_ERR, "Not enough parameters given.");
+		printf( "Not enough parameters given.");
 		ipmi_raw_help();
 		return (-1);
 	}
 	else if (argc > sizeof(data))
 	{
-		lprintf(LOG_NOTICE, "Raw command input limit (256 bytes) exceeded");
+		printf( "Raw command input limit (256 bytes) exceeded");
 		return -1;
 	}
 
@@ -344,7 +344,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
 			return (-1);
 	} else {
 		if (netfn_tmp >= UINT8_MAX) {
-			lprintf(LOG_ERR, "Given netfn \"%s\" is out of range.", argv[0]);
+			printf( "Given netfn \"%s\" is out of range.", argv[0]);
 			return (-1);
 		}
 		netfn = netfn_tmp;
@@ -370,8 +370,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
 		req.msg.data_len++;
 	}
 
-	lprintf(LOG_INFO, 
-           "RAW REQ (channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x data_len=%d)",
+	printf( "RAW REQ (channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x data_len=%d)",
            intf->target_channel & 0x0f, req.msg.netfn,req.msg.lun , 
            req.msg.cmd, req.msg.data_len);
 
@@ -380,20 +379,20 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
 	rsp = intf->sendrecv(intf, &req);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Unable to send RAW command "
+		printf( "Unable to send RAW command "
 			"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x)",
 			intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd);
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Unable to send RAW command "
+		printf( "Unable to send RAW command "
 			"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s",
 			intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode,
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
 
-	lprintf(LOG_INFO, "RAW RSP (%d bytes)", rsp->data_len);
+	printf( "RAW RSP (%d bytes)", rsp->data_len);
 
 	/* print the raw response buffer */
 	for (i=0; i<rsp->data_len; i++) {
@@ -418,12 +417,12 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
 int
 is_valid_param(const char *input_param, uint8_t *uchr_ptr, const char *label) {
 	if (input_param == NULL || label == NULL) {
-		lprintf(LOG_ERROR, "ERROR: NULL pointer passed.");
+		printf( "ERROR: NULL pointer passed.");
 		return (-1);
 	}
 	if (str2uchar(input_param, uchr_ptr) == 0)
 		return 0;
 
-	lprintf(LOG_ERR, "Given %s \"%s\" is invalid.", label, input_param);
+	printf( "Given %s \"%s\" is invalid.", label, input_param);
 	return (-1);
 }

+ 167 - 213
app/ipmitool-1.8.18/lib/ipmi_sdr.c

@@ -43,7 +43,7 @@
 #include <time.h>
 
 #include <ipmitool/ipmi.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 #include <ipmitool/ipmi_mc.h>
 #include <ipmitool/ipmi_sdr.h>
 #include <ipmitool/ipmi_sdradd.h>
@@ -370,39 +370,39 @@ sdr_convert_sensor_tolerance(struct sdr_record_full_sensor *sensor, uint8_t val)
 	}
 
 	switch (sensor->linearization & 0x7f) {
-	case SDR_SENSOR_L_LN:
-		result = log(result);
-		break;
-	case SDR_SENSOR_L_LOG10:
-		result = log10(result);
-		break;
-	case SDR_SENSOR_L_LOG2:
-		result = (double) (log(result) / log(2.0));
-		break;
-	case SDR_SENSOR_L_E:
-		result = exp(result);
-		break;
-	case SDR_SENSOR_L_EXP10:
-		result = pow(10.0, result);
-		break;
-	case SDR_SENSOR_L_EXP2:
-		result = pow(2.0, result);
-		break;
-	case SDR_SENSOR_L_1_X:
-		result = pow(result, -1.0);	/*1/x w/o exception */
-		break;
-	case SDR_SENSOR_L_SQR:
-		result = pow(result, 2.0);
-		break;
-	case SDR_SENSOR_L_CUBE:
-		result = pow(result, 3.0);
-		break;
-	case SDR_SENSOR_L_SQRT:
-		result = sqrt(result);
-		break;
-	case SDR_SENSOR_L_CUBERT:
-		result = cbrt(result);
-		break;
+	// case SDR_SENSOR_L_LN:
+	// 	result = log(result);
+	// 	break;
+	// case SDR_SENSOR_L_LOG10:
+	// 	result = log10(result);
+	// 	break;
+	// case SDR_SENSOR_L_LOG2:
+	// 	result = (double) (log(result) / log(2.0));
+	// 	break;
+	// case SDR_SENSOR_L_E:
+	// 	result = exp(result);
+	// 	break;
+	// case SDR_SENSOR_L_EXP10:
+	// 	result = pow(10.0, result);
+	// 	break;
+	// case SDR_SENSOR_L_EXP2:
+	// 	result = pow(2.0, result);
+	// 	break;
+	// case SDR_SENSOR_L_1_X:
+	// 	result = pow(result, -1.0);	/*1/x w/o exception */
+	// 	break;
+	// case SDR_SENSOR_L_SQR:
+	// 	result = pow(result, 2.0);
+	// 	break;
+	// case SDR_SENSOR_L_CUBE:
+	// 	result = pow(result, 3.0);
+	// 	break;
+	// case SDR_SENSOR_L_SQRT:
+	// 	result = sqrt(result);
+	// 	break;
+	// case SDR_SENSOR_L_CUBERT:
+	// 	result = cbrt(result);
+	// 	break;
 	case SDR_SENSOR_L_LINEAR:
 	default:
 		break;
@@ -440,7 +440,7 @@ sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor,
 	result = (((val / pow(10, k2)) - (b * pow(10, k1))) / m);
 
 	if ((result - (int) result) >= .5)
-		return (uint8_t) ceil(result);
+		return (uint8_t) (result+0.5);
 	else
 		return (uint8_t) result;
 }
@@ -578,8 +578,7 @@ ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
 	uint32_t save_channel;
 
 	if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
-		lprintf(LOG_DEBUG,
-			"Bridge to Sensor "
+		printf("Bridge to Sensor "
 			"Intf my/%#x tgt/%#x:%#x Sdr tgt/%#x:%#x\n",
 			intf->my_addr, intf->target_addr, intf->target_channel,
 			target, channel);
@@ -794,12 +793,12 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
 		sdr_rq.reserve_id = itr->reservation;
 		rsp = intf->sendrecv(intf, &req);
 		if (rsp == NULL) {
-			lprintf(LOG_ERR, "Get SDR %04x command failed",
+			printf( "Get SDR %04x command failed",
 				itr->next);
 			continue;
 		} else if (rsp->ccode == 0xc5) {
 			/* lost reservation */
-			lprintf(LOG_DEBUG, "SDR reservation %04x cancelled. "
+			printf( "SDR reservation %04x cancelled. "
 				"Sleeping a bit and retrying...",
 				itr->reservation);
 
@@ -807,12 +806,12 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
 
 			if (ipmi_sdr_get_reservation(intf, itr->use_built_in,
                                       &(itr->reservation)) < 0) {
-				lprintf(LOG_ERR,
+				printf(
 					"Unable to renew SDR reservation");
 				return NULL;
 			}
 		} else if (rsp->ccode > 0) {
-			lprintf(LOG_ERR, "Get SDR %04x command failed: %s",
+			printf( "Get SDR %04x command failed: %s",
 				itr->next, val2str(rsp->ccode,
 						   completion_code_vals));
 			continue;
@@ -827,12 +826,12 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
 	if (!rsp)
 		return NULL;
 
-	lprintf(LOG_DEBUG, "SDR record ID   : 0x%04x", itr->next);
+	printf( "SDR record ID   : 0x%04x", itr->next);
 
 	memcpy(&sdr_rs, rsp->data, sizeof (sdr_rs));
 
 	if (sdr_rs.length == 0) {
-		lprintf(LOG_ERR, "SDR record id 0x%04x: invalid length %d",
+		printf( "SDR record id 0x%04x: invalid length %d",
 			itr->next, sdr_rs.length);
 		return NULL;
 	}
@@ -848,13 +847,13 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
 	 */
 	if ((itr->next != 0x0000) &&
 		(sdr_rs.id != itr->next)) {
-		lprintf(LOG_DEBUG, "SDR record id mismatch: 0x%04x", sdr_rs.id);
+		printf( "SDR record id mismatch: 0x%04x", sdr_rs.id);
 		sdr_rs.id = itr->next;
 	}
 
-	lprintf(LOG_DEBUG, "SDR record type : 0x%02x", sdr_rs.type);
-	lprintf(LOG_DEBUG, "SDR record next : 0x%04x", sdr_rs.next);
-	lprintf(LOG_DEBUG, "SDR record bytes: %d", sdr_rs.length);
+	printf( "SDR record type : 0x%02x", sdr_rs.type);
+	printf( "SDR record next : 0x%04x", sdr_rs.next);
+	printf( "SDR record bytes: %d", sdr_rs.length);
 
 	return &sdr_rs;
 }
@@ -960,14 +959,12 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
 						target, lun, channel);
 
 	if (rsp == NULL) {
-		lprintf(LOG_DEBUG,
-			"Error reading event status for sensor #%02x",
+		printf("Error reading event status for sensor #%02x",
 			sensor_num);
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_DEBUG,
-			"Error reading event status for sensor #%02x: %s",
+		printf("Error reading event status for sensor #%02x: %s",
 			sensor_num, val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -1174,14 +1171,12 @@ ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
 						target, lun, channel);
 
 	if (rsp == NULL) {
-		lprintf(LOG_DEBUG,
-			"Error reading event enable for sensor #%02x",
+		printf(	"Error reading event enable for sensor #%02x",
 			sensor_num);
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_DEBUG,
-			"Error reading event enable for sensor #%02x: %s",
+		printf(	"Error reading event enable for sensor #%02x: %s",
 			sensor_num, val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -1440,7 +1435,7 @@ ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
 
 
 	if (rsp == NULL) {
-		lprintf(LOG_DEBUG, "Error reading sensor %s (#%02x)",
+		printf( "Error reading sensor %s (#%02x)",
 			sr.s_id, sensor->keys.sensor_num);
 		return &sr;
 	}
@@ -1448,8 +1443,7 @@ ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
 	if (rsp->ccode) {
 		if ( !((sr.full    && rsp->ccode == 0xcb) ||
 		       (sr.compact && rsp->ccode == 0xcd)) ) {
-			lprintf(LOG_DEBUG,
-				"Error reading sensor %s (#%02x): %s", sr.s_id,
+			printf("Error reading sensor %s (#%02x): %s", sr.s_id,
 				sensor->keys.sensor_num,
 				val2str(rsp->ccode, completion_code_vals));
 		}
@@ -1463,7 +1457,7 @@ ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
 		 * the reading.    If we don't have both of these we can't have
 		 * a valid sensor reading.
 		 */
-		lprintf(LOG_DEBUG, "Error reading sensor %s invalid len %d",
+		printf( "Error reading sensor %s invalid len %d",
 			sr.s_id, rsp->data_len);
 		return &sr;
 	}
@@ -1474,7 +1468,7 @@ ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
 
 	if (IS_SCANNING_DISABLED(rsp->data[1])) {
 		sr.s_scanning_disabled = 1;
-		lprintf(LOG_DEBUG, "Sensor %s (#%02x) scanning disabled",
+		printf( "Sensor %s (#%02x) scanning disabled",
 			sr.s_id, sensor->keys.sensor_num);
 		return &sr;
 	}
@@ -1717,7 +1711,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
 		printf(" Sensor Type (Discrete): %s (0x%02x)\n",
 				ipmi_get_sensor_type(intf, sensor->sensor.type),
 				sensor->sensor.type);
-		lprintf(LOG_DEBUG, " Event Type Code       : 0x%02x",
+		printf( " Event Type Code       : 0x%02x",
 			sensor->event_type);
 
 		printf(" Sensor Reading        : ");
@@ -2095,7 +2089,7 @@ ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
 		printf("Sensor Type            : %s (0x%02x)\n",
 			ipmi_get_sensor_type(intf, sensor->sensor_type),
 			sensor->sensor_type);
-		lprintf(LOG_DEBUG, "Event Type Code        : 0x%02x",
+		printf("Event Type Code        : 0x%02x",
 			sensor->event_type);
 		printf("\n");
 	} else {
@@ -2422,7 +2416,7 @@ ipmi_sdr_print_sensor_oem_intel(struct ipmi_intf *intf,
 	case 0x07:		/* Ambient Temperature Fan Speed Control */
 		break;
 	default:
-		lprintf(LOG_DEBUG, "Unknown Intel OEM SDR Record type %02x",
+		printf( "Unknown Intel OEM SDR Record type %02x",
 			oem->data[3]);
 	}
 
@@ -2517,7 +2511,7 @@ ipmi_sdr_print_name_from_rawentry(struct ipmi_intf *intf, uint16_t id,
       break;
    }   
 
-      lprintf(LOG_INFO, "ID: 0x%04x , NAME: %-16s", id, desc);
+     printf( "ID: 0x%04x , NAME: %-16s", id, desc);
    return rc;
 }
 
@@ -2660,12 +2654,12 @@ ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type)
 	struct sdr_record_list *e;
 	int rc = 0;
 
-	lprintf(LOG_DEBUG, "Querying SDR for sensor list");
+	printf( "Querying SDR for sensor list");
 
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return -1;
 		}
 	}
@@ -2687,14 +2681,14 @@ ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type)
 
 		rec = ipmi_sdr_get_record(intf, header, sdr_list_itr);
 		if (rec == NULL) {
-			lprintf(LOG_ERR, "ipmitool: ipmi_sdr_get_record() failed");
+			printf( "ipmitool: ipmi_sdr_get_record() failed");
 			rc = -1;
 			continue;
 		}
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			if (rec != NULL) {
 				free(rec);
 				rec = NULL;
@@ -2741,7 +2735,7 @@ ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type)
 			continue;
 		}
 
-                lprintf(LOG_DEBUG, "SDR record ID   : 0x%04x", sdrr->id);
+                printf( "SDR record ID   : 0x%04x", sdrr->id);
 
 		if (type == header->type || type == 0xff ||
 		    (type == 0xfe &&
@@ -2798,7 +2792,7 @@ ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
 		return -1;
 
 	*reserve_id = ((struct sdr_reserve_repo_rs *) &(rsp->data))->reserve_id;
-	lprintf(LOG_DEBUG, "SDR reservation ID %04x", *reserve_id);
+	printf( "SDR reservation ID %04x", *reserve_id);
 
 	return 0;
 }
@@ -2821,7 +2815,7 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 
 	itr = malloc(sizeof (struct ipmi_sdr_iterator));
 	if (itr == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return NULL;
 	}
 
@@ -2834,13 +2828,13 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 	rsp = intf->sendrecv(intf, &req);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get Device ID command failed");
+		printf( "Get Device ID command failed");
 		free(itr);
 		itr = NULL;
 		return NULL;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
+		printf( "Get Device ID command failed: %#x %s",
 			rsp->ccode, val2str(rsp->ccode, completion_code_vals));
 		free(itr);
 		itr = NULL;
@@ -2853,16 +2847,16 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 	if (!use_builtin && (devid->device_revision & IPM_DEV_DEVICE_ID_SDR_MASK)) {
 		if ((devid->adtl_device_support & 0x02) == 0) {
 			if ((devid->adtl_device_support & 0x01)) {
-				lprintf(LOG_DEBUG, "Using Device SDRs\n");
+				printf( "Using Device SDRs\n");
 				use_built_in = 1;
 			} else {
-				lprintf(LOG_ERR, "Error obtaining SDR info");
+				printf( "Error obtaining SDR info");
 				free(itr);
 				itr = NULL;
 				return NULL;
 			}
 		} else {
-			lprintf(LOG_DEBUG, "Using SDR from Repository \n");
+			printf( "Using SDR from Repository \n");
 		}
 	}
 	itr->use_built_in = use_builtin ? 1 : use_built_in;
@@ -2876,13 +2870,13 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 
 		rsp = intf->sendrecv(intf, &req);
 		if (rsp == NULL) {
-			lprintf(LOG_ERR, "Error obtaining SDR info");
+			printf( "Error obtaining SDR info");
 			free(itr);
 			itr = NULL;
 			return NULL;
 		}
 		if (rsp->ccode > 0) {
-			lprintf(LOG_ERR, "Error obtaining SDR info: %s",
+			printf( "Error obtaining SDR info: %s",
 				val2str(rsp->ccode, completion_code_vals));
 			free(itr);
 			itr = NULL;
@@ -2897,22 +2891,22 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 		if ((sdr_info.version != 0x51) &&
 		    (sdr_info.version != 0x01) &&
 		    (sdr_info.version != 0x02)) {
-			lprintf(LOG_WARN, "WARNING: Unknown SDR repository "
+			printf( "WARNING: Unknown SDR repository "
 				"version 0x%02x", sdr_info.version);
 		}
 
 		itr->total = sdr_info.count;
 		itr->next = 0;
 
-		lprintf(LOG_DEBUG, "SDR free space: %d", sdr_info.free);
-		lprintf(LOG_DEBUG, "SDR records   : %d", sdr_info.count);
+		printf( "SDR free space: %d", sdr_info.free);
+		printf( "SDR records   : %d", sdr_info.count);
 
 		/* Build SDRR if there is no record in repository */
 		if( sdr_info.count == 0 ) {
-		   lprintf(LOG_DEBUG, "Rebuilding SDRR...");
+		   printf( "Rebuilding SDRR...");
 
 		   if( ipmi_sdr_add_from_sensors( intf, 0 ) != 0 ) {
-		      lprintf(LOG_ERR, "Could not build SDRR!");
+		      printf( "Could not build SDRR!");
 		      free(itr);
 					itr = NULL;
 		      return NULL;
@@ -2936,12 +2930,12 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
 
 		itr->total = sdr_info.count;
 		itr->next = 0;
-		lprintf(LOG_DEBUG, "SDR records   : %d", sdr_info.count);
+		printf( "SDR records   : %d", sdr_info.count);
 	}
 
 	if (ipmi_sdr_get_reservation(intf, itr->use_built_in,
                                 &(itr->reservation)) < 0) {
-		lprintf(LOG_ERR, "Unable to obtain SDR reservation");
+		printf( "Unable to obtain SDR reservation");
 		free(itr);
 		itr = NULL;
 		return NULL;
@@ -2974,7 +2968,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
 
 	data = malloc(len + 1);
 	if (data == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(data, 0, len + 1);
@@ -3015,7 +3009,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
 		    len - i : sdr_max_read_len;
 		sdr_rq.offset = i + 5;	/* 5 header bytes */
 
-		lprintf(LOG_DEBUG, "Getting %d bytes from SDR at offset %d",
+		printf( "Getting %d bytes from SDR at offset %d",
 			sdr_rq.length, sdr_rq.offset);
 
 		rsp = intf->sendrecv(intf, &req);
@@ -3039,7 +3033,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
 			continue;
 		case 0xc5:
 			/* lost reservation */
-			lprintf(LOG_DEBUG, "SDR reservation cancelled. "
+			printf( "SDR reservation cancelled. "
 				"Sleeping a bit and retrying...");
 
 			sleep(rand() & 3);
@@ -3103,7 +3097,7 @@ __sdr_list_add(struct sdr_record_list *head, struct sdr_record_list *entry)
 
 	new = malloc(sizeof (struct sdr_record_list));
 	if (new == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return -1;
 	}
 	memcpy(new, entry, sizeof (struct sdr_record_list));
@@ -3218,7 +3212,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint16_t gen_id, uint8_t num
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return NULL;
 		}
 	}
@@ -3249,7 +3243,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint16_t gen_id, uint8_t num
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -3342,7 +3336,7 @@ ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, uint8_t type)
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return NULL;
 		}
 	}
@@ -3350,7 +3344,7 @@ ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, uint8_t type)
 	/* check what we've already read */
 	head = malloc(sizeof (struct sdr_record_list));
 	if (head == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(head, 0, sizeof (struct sdr_record_list));
@@ -3376,7 +3370,7 @@ ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, uint8_t type)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -3462,14 +3456,14 @@ ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, struct entity_id *entity)
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return NULL;
 		}
 	}
 
 	head = malloc(sizeof (struct sdr_record_list));
 	if (head == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(head, 0, sizeof (struct sdr_record_list));
@@ -3530,7 +3524,7 @@ ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, struct entity_id *entity)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -3642,14 +3636,14 @@ ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf, uint8_t type)
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return NULL;
 		}
 	}
 
 	head = malloc(sizeof (struct sdr_record_list));
 	if (head == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf( "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(head, 0, sizeof (struct sdr_record_list));
@@ -3666,7 +3660,7 @@ ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf, uint8_t type)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -3757,7 +3751,7 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id)
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return NULL;
 		}
 	}
@@ -3811,7 +3805,7 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -3936,13 +3930,13 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 	int ret = 0, count = 0, bc = 0;
 
 	if (ifile == NULL) {
-		lprintf(LOG_ERR, "No SDR cache filename given");
+		printf( "No SDR cache filename given");
 		return -1;
 	}
 
 	fp = ipmi_open_file_read(ifile);
 	if (fp == NULL) {
-		lprintf(LOG_ERR, "Unable to open SDR cache %s for reading",
+		printf( "Unable to open SDR cache %s for reading",
 			ifile);
 		return -1;
 	}
@@ -3954,7 +3948,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 			break;
 
 		if (bc != 5) {
-			lprintf(LOG_ERR, "header read %d bytes, expected 5",
+			printf( "header read %d bytes, expected 5",
 				bc);
 			ret = -1;
 			break;
@@ -3966,7 +3960,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 		if (header.version != 0x51 &&
 		    header.version != 0x01 &&
 		    header.version != 0x02) {
-			lprintf(LOG_WARN, "invalid sdr header version %02x",
+			printf( "invalid sdr header version %02x",
 				header.version);
 			ret = -1;
 			break;
@@ -3974,7 +3968,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			ret = -1;
 			break;
 		}
@@ -3985,7 +3979,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 
 		rec = malloc(header.length + 1);
 		if (rec == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			ret = -1;
 			if (sdrr != NULL) {
 				free(sdrr);
@@ -3997,7 +3991,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 
 		bc = fread(rec, 1, header.length, fp);
 		if (bc != header.length) {
-			lprintf(LOG_ERR,
+			printf(
 				"record %04x read %d bytes, expected %d",
 				header.id, bc, header.length);
 			ret = -1;
@@ -4058,7 +4052,7 @@ ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile)
 
 		count++;
 
-		lprintf(LOG_DEBUG, "Read record %04x from file into cache",
+		printf( "Read record %04x from file into cache",
 			sdrr->id);
 	}
 
@@ -4090,7 +4084,7 @@ ipmi_sdr_list_cache(struct ipmi_intf *intf)
 	if (sdr_list_itr == NULL) {
 		sdr_list_itr = ipmi_sdr_start(intf, 0);
 		if (sdr_list_itr == NULL) {
-			lprintf(LOG_ERR, "Unable to open SDR for reading");
+			printf( "Unable to open SDR for reading");
 			return -1;
 		}
 	}
@@ -4101,7 +4095,7 @@ ipmi_sdr_list_cache(struct ipmi_intf *intf)
 
 		sdrr = malloc(sizeof (struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			break;
 		}
 		memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -4193,11 +4187,11 @@ ipmi_sdr_get_info(struct ipmi_intf *intf,
 	rsp = intf->sendrecv(intf, &req);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get SDR Repository Info command failed");
+		printf( "Get SDR Repository Info command failed");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get SDR Repository Info command failed: %s",
+		printf( "Get SDR Repository Info command failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -4348,7 +4342,7 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
 	/* open connection to SDR */
 	itr = ipmi_sdr_start(intf, 0);
 	if (itr == NULL) {
-		lprintf(LOG_ERR, "Unable to open SDR for reading");
+		printf( "Unable to open SDR for reading");
 		return -1;
 	}
 
@@ -4358,12 +4352,12 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
 	while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
 		sdrr = malloc(sizeof(struct sdr_record_list));
 		if (sdrr == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf( "ipmitool: malloc failure");
 			return -1;
 		}
 		memset(sdrr, 0, sizeof(struct sdr_record_list));
 
-		lprintf(LOG_INFO, "Record ID %04x (%d bytes)",
+		printf( "Record ID %04x (%d bytes)",
 			header->id, header->length);
 
 		sdrr->id = header->id;
@@ -4373,7 +4367,7 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
 		sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
 
 		if (sdrr->raw == NULL) {
-		    lprintf(LOG_ERR, "ipmitool: cannot obtain SDR record %04x", header->id);
+		    printf( "ipmitool: cannot obtain SDR record %04x", header->id);
 				if (sdrr != NULL) {
 					free(sdrr);
 					sdrr = NULL;
@@ -4409,7 +4403,7 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
 
 		r = fwrite(h, 1, 5, fp);
 		if (r != 5) {
-			lprintf(LOG_ERR, "Error writing header "
+			printf( "Error writing header "
 				"to output file %s", ofile);
 			rc = -1;
 			break;
@@ -4417,14 +4411,14 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
 
 		/* write sdr entry */
 		if (!sdrr->raw) {
-			lprintf(LOG_ERR, "Error: raw data is null (length=%d)",
+			printf( "Error: raw data is null (length=%d)",
 								sdrr->length);
 			rc = -1;
 			break;
 		}
 		r = fwrite(sdrr->raw, 1, sdrr->length, fp);
 		if (r != sdrr->length) {
-			lprintf(LOG_ERR, "Error writing %d record bytes "
+			printf( "Error writing %d record bytes "
 				"to output file %s", sdrr->length, ofile);
 			rc = -1;
 			break;
@@ -4466,7 +4460,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
 	if (strncmp(type, "0x", 2) == 0) {
 		/* begins with 0x so let it be entered as raw hex value */
 		if (str2uchar(type, &sensor_type) != 0) {
-			lprintf(LOG_ERR,
+			printf(
 					"Given type of sensor \"%s\" is either invalid or out of range.",
 					type);
 			return (-1);
@@ -4481,7 +4475,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
 			}
 		}
 		if (sensor_type != x) {
-			lprintf(LOG_ERR, "Sensor Type \"%s\" not found.",
+			printf( "Sensor Type \"%s\" not found.",
 				type);
 			printf("Sensor Types:\n");
 			for (x = 1; x < SENSOR_TYPE_MAX; x += 2) {
@@ -4546,7 +4540,7 @@ ipmi_sdr_print_entity(struct ipmi_intf *intf, char *entitystr)
 				}
 			}
 			if (j == 0) {
-				lprintf(LOG_ERR, "Invalid entity: %s", entitystr);
+				printf( "Invalid entity: %s", entitystr);
 				return -1;
 			}
 		} else {
@@ -4586,7 +4580,7 @@ ipmi_sdr_print_entry_byid(struct ipmi_intf *intf, int argc, char **argv)
 	int v, i;
 
 	if (argc < 1) {
-		lprintf(LOG_ERR, "No Sensor ID supplied");
+		printf( "No Sensor ID supplied");
 		return -1;
 	}
 
@@ -4596,7 +4590,7 @@ ipmi_sdr_print_entry_byid(struct ipmi_intf *intf, int argc, char **argv)
 	for (i = 0; i < argc; i++) {
 		sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
 		if (sdr == NULL) {
-			lprintf(LOG_ERR, "Unable to find sensor id '%s'",
+			printf( "Unable to find sensor id '%s'",
 				argv[i]);
 		} else {
 			if (ipmi_sdr_print_listentry(intf, sdr) < 0)
@@ -4661,17 +4655,14 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
 			rc = ipmi_sdr_print_sdr(intf,
 						SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
 		else if (strcmp(argv[1], "help") == 0) {
-			lprintf(LOG_NOTICE,
-				"usage: sdr %s [all|full|compact|event|mcloc|fru|generic]",
+			printf(	"usage: sdr %s [all|full|compact|event|mcloc|fru|generic]",
 				argv[0]);
 			return 0;
 		}
 		else {
-			lprintf(LOG_ERR,
-				"Invalid SDR %s command: %s",
+			printf(	"Invalid SDR %s command: %s",
 				argv[0], argv[1]);
-			lprintf(LOG_NOTICE,
-				"usage: sdr %s [all|full|compact|event|mcloc|fru|generic]",
+			printf(	"usage: sdr %s [all|full|compact|event|mcloc|fru|generic]",
 				argv[0]);
 			return (-1);
 		}
@@ -4687,17 +4678,17 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
 		rc = ipmi_sdr_print_entry_byid(intf, argc - 1, &argv[1]);
 	} else if (strncmp(argv[0], "dump", 4) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_ERR, "Not enough parameters given.");
-			lprintf(LOG_NOTICE, "usage: sdr dump <file>");
+			printf( "Not enough parameters given.");
+			printf( "usage: sdr dump <file>");
 			return (-1);
 		}
 		rc = ipmi_sdr_dump_bin(intf, argv[1]);
 	} else if (strncmp(argv[0], "fill", 4) == 0) {
 		if (argc <= 1) {
-			lprintf(LOG_ERR, "Not enough parameters given.");
-			lprintf(LOG_NOTICE, "usage: sdr fill sensors");
-			lprintf(LOG_NOTICE, "usage: sdr fill file <file>");
-			lprintf(LOG_NOTICE, "usage: sdr fill range <range>");
+			printf( "Not enough parameters given.");
+			printf( "usage: sdr fill sensors");
+			printf( "usage: sdr fill file <file>");
+			printf( "usage: sdr fill range <range>");
 			return (-1);
 		} else if (strncmp(argv[1], "sensors", 7) == 0) {
 			rc = ipmi_sdr_add_from_sensors(intf, 21);
@@ -4705,33 +4696,27 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
 			rc = ipmi_sdr_add_from_sensors(intf, 0);
 		} else if (strncmp(argv[1], "file", 4) == 0) {
 			if (argc < 3) {
-				lprintf(LOG_ERR,
-					"Not enough parameters given.");
-				lprintf(LOG_NOTICE,
-					"usage: sdr fill file <file>");
+				printf(	"Not enough parameters given.");
+				printf(	"usage: sdr fill file <file>");
 				return (-1);
 			}
 			rc = ipmi_sdr_add_from_file(intf, argv[2]);
 		} else if (strncmp(argv[1], "range", 4) == 0) {
 			if (argc < 3) {
-				lprintf(LOG_ERR,
-					"Not enough parameters given.");
-				lprintf(LOG_NOTICE,
-					"usage: sdr fill range <range>");
+				printf(	"Not enough parameters given.");
+				printf(	"usage: sdr fill range <range>");
 				return (-1);
 			}
 			rc = ipmi_sdr_add_from_list(intf, argv[2]);
 		} else {
-		    lprintf(LOG_ERR,
-			    "Invalid SDR %s command: %s",
+		    printf("Invalid SDR %s command: %s",
 			    argv[0], argv[1]);
-		    lprintf(LOG_NOTICE,
-			    "usage: sdr %s <sensors|nosat|file|range> [options]",
+		    printf(   "usage: sdr %s <sensors|nosat|file|range> [options]",
 			    argv[0]);
 		    return (-1);
 		}
 	} else {
-		lprintf(LOG_ERR, "Invalid SDR command: %s", argv[0]);
+		printf( "Invalid SDR command: %s", argv[0]);
 		rc = -1;
 	}
 
@@ -4741,66 +4726,35 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
 void
 printf_sdr_usage()
 {
-	lprintf(LOG_NOTICE,
-"usage: sdr <command> [options]");
-	lprintf(LOG_NOTICE,
-"               list | elist [option]");
-	lprintf(LOG_NOTICE,
-"                     all           All SDR Records");
-	lprintf(LOG_NOTICE,
-"                     full          Full Sensor Record");
-	lprintf(LOG_NOTICE,
-"                     compact       Compact Sensor Record");
-	lprintf(LOG_NOTICE,
-"                     event         Event-Only Sensor Record");
-	lprintf(LOG_NOTICE,
-"                     mcloc         Management Controller Locator Record");
-	lprintf(LOG_NOTICE,
-"                     fru           FRU Locator Record");
-	lprintf(LOG_NOTICE,
-"                     generic       Generic Device Locator Record\n");
-	lprintf(LOG_NOTICE,
-"               type [option]");
-	lprintf(LOG_NOTICE,
-"                     <Sensor_Type> Retrieve the state of specified sensor.");
-	lprintf(LOG_NOTICE,
-"                                   Sensor_Type can be specified either as");
-	lprintf(LOG_NOTICE,
-"                                   a string or a hex value.");
-	lprintf(LOG_NOTICE,
-"                     list          Get a list of available sensor types\n");
-	lprintf(LOG_NOTICE,
-"               get <Sensor_ID>");
-	lprintf(LOG_NOTICE,
-"                     Retrieve state of the first sensor matched by Sensor_ID\n");
-	lprintf(LOG_NOTICE,
-"               info");
-	lprintf(LOG_NOTICE,
-"                     Display information about the repository itself\n");
-	lprintf(LOG_NOTICE,
-"               entity <Entity_ID>[.<Instance_ID>]");
-	lprintf(LOG_NOTICE,
-"                     Display all sensors associated with an entity\n");
-	lprintf(LOG_NOTICE,
-"               dump <file>");
-	lprintf(LOG_NOTICE,
-"                     Dump raw SDR data to a file\n");
-	lprintf(LOG_NOTICE,
-"               fill <option>");
-	lprintf(LOG_NOTICE,
-"                     sensors       Creates the SDR repository for the current");
-	lprintf(LOG_NOTICE,
-"                                   configuration");
-	lprintf(LOG_NOTICE,
-"                     nosat         Creates the SDR repository for the current");
-	lprintf(LOG_NOTICE,
-"                                   configuration, without satellite scan");
-	lprintf(LOG_NOTICE,
-"                     file <file>   Load SDR repository from a file");
-	lprintf(LOG_NOTICE,
-"                     range <range> Load SDR repository from a provided list");
-	lprintf(LOG_NOTICE,
-"                                   or range. Use ',' for list or '-' for");
-	lprintf(LOG_NOTICE,
-"                                   range, eg. 0x28,0x32,0x40-0x44");
+	printf( "usage: sdr <command> [options]");
+	printf("               list | elist [option]");
+	printf("                     all           All SDR Records");
+	printf("                     full          Full Sensor Record");
+	printf("                     compact       Compact Sensor Record");
+	printf("                     event         Event-Only Sensor Record");
+	printf("                     mcloc         Management Controller Locator Record");
+	printf("                     fru           FRU Locator Record");
+	printf("                     generic       Generic Device Locator Record\n");
+	printf("               type [option]");
+	printf("                     <Sensor_Type> Retrieve the state of specified sensor.");
+	printf("                                   Sensor_Type can be specified either as");
+	printf("                                   a string or a hex value.");
+	printf("                     list          Get a list of available sensor types\n");
+	printf("               get <Sensor_ID>");
+	printf("                     Retrieve state of the first sensor matched by Sensor_ID\n");
+	printf("               info");
+	printf("                     Display information about the repository itself\n");
+	printf("               entity <Entity_ID>[.<Instance_ID>]");
+	printf("                     Display all sensors associated with an entity\n");
+	printf("               dump <file>");
+	printf("                     Dump raw SDR data to a file\n");
+	printf("               fill <option>");
+	printf("                     sensors       Creates the SDR repository for the current");
+	printf("                                   configuration");
+	printf("                     nosat         Creates the SDR repository for the current");
+	printf("                                   configuration, without satellite scan");
+	printf("                     file <file>   Load SDR repository from a file");
+	printf("                     range <range> Load SDR repository from a provided list");
+	printf("                                   or range. Use ',' for list or '-' for");
+	printf("                                   range, eg. 0x28,0x32,0x40-0x44");
 }

+ 25 - 25
app/ipmitool-1.8.18/lib/ipmi_sdradd.c

@@ -105,18 +105,18 @@ ipmi_sdr_add_record(struct ipmi_intf *intf, struct sdr_record_list *sdrr)
 
   /* actually no SDR to program */
   if (len < 1 || !sdrr->raw) {
-    lprintf(LOG_ERR, "ipmitool: bad record , skipped");
+    printf(  "ipmitool: bad record , skipped");
     return 0;
   }
 
   if (ipmi_sdr_get_reservation(intf, 0, &reserve_id)) {
-    lprintf(LOG_ERR, "ipmitool: reservation failed");
+    printf(  "ipmitool: reservation failed");
     return -1;
   }
 
   sdr_rq = (struct sdr_add_rq *)malloc(sizeof(*sdr_rq) + sdr_max_write_len);
   if (sdr_rq == NULL) {
-    lprintf(LOG_ERR, "ipmitool: malloc failure");
+    printf(  "ipmitool: malloc failure");
     return -1;
   }
   sdr_rq->reserve_id = reserve_id;
@@ -138,7 +138,7 @@ ipmi_sdr_add_record(struct ipmi_intf *intf, struct sdr_record_list *sdrr)
   req.msg.data_len = 5 + sizeof(*sdr_rq) - 1;
 
   if (partial_send(intf, &req, &id)) {
-     lprintf(LOG_ERR, "ipmitool: partial send error");
+     printf(  "ipmitool: partial send error");
     free(sdr_rq);
     sdr_rq = NULL;
     return -1;
@@ -163,7 +163,7 @@ ipmi_sdr_add_record(struct ipmi_intf *intf, struct sdr_record_list *sdrr)
     req.msg.data_len = data_len + sizeof(*sdr_rq) - 1;
 
     if ((rc = partial_send(intf, &req, &id)) != 0) {
-       lprintf(LOG_ERR, "ipmitool: partial add failed");
+       printf(  "ipmitool: partial add failed");
       break;
     }
 
@@ -203,11 +203,11 @@ ipmi_sdr_repo_clear(struct ipmi_intf *intf)
   for (try = 0; try < 5; try++) {
     rsp = intf->sendrecv(intf, &req);
     if (rsp == NULL) {
-      lprintf(LOG_ERR, "Unable to clear SDRR");
+      printf(  "Unable to clear SDRR");
       return -1;
     }
     if (rsp->ccode > 0) {
-      lprintf(LOG_ERR, "Unable to clear SDRR: %s",
+      printf(  "Unable to clear SDRR: %s",
         val2str(rsp->ccode, completion_code_vals));
       return -1;
     }
@@ -253,7 +253,7 @@ sdrr_get_records(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr,
 
     sdrr = malloc(sizeof (struct sdr_record_list));
     if (sdrr == NULL) {
-      lprintf(LOG_ERR, "ipmitool: malloc failure");
+      printf(  "ipmitool: malloc failure");
       return -1;
     }
     memset(sdrr, 0, sizeof (struct sdr_record_list));
@@ -304,7 +304,7 @@ sdr_copy_to_sdrr(struct ipmi_intf *intf, int use_builtin,
     sdrr_next = sdrr->next;
     rc = ipmi_sdr_add_record(intf, sdrr);
     if(rc < 0){
-      lprintf(LOG_ERR, "Cannot add SDR ID 0x%04x to repository...", sdrr->id);
+      printf(  "Cannot add SDR ID 0x%04x to repository...", sdrr->id);
     }
     free(sdrr);
     sdrr = NULL;
@@ -321,7 +321,7 @@ ipmi_sdr_add_from_sensors(struct ipmi_intf *intf, int maxslot)
   int myaddr = intf->target_addr;
 
   if (ipmi_sdr_repo_clear(intf)) {
-    lprintf(LOG_ERR, "Cannot erase SDRR. Give up.");
+    printf(  "Cannot erase SDRR. Give up.");
     return -1;
   }
 
@@ -398,7 +398,7 @@ int ipmi_hex_to_dec( char * strchar, unsigned char * pDecValue)
   }
   else
   {
-    lprintf(LOG_ERR, "Must be Hex value of 4 characters (Ex.: 0x24)");
+    printf(  "Must be Hex value of 4 characters (Ex.: 0x24)");
   }
 
   return rc;
@@ -461,7 +461,7 @@ int ipmi_parse_range_list(const char *rangeList, unsigned char * pHexList)
           }
           else
           {
-            lprintf(LOG_ERR, "I2C address provided value must be even.");
+            printf(  "I2C address provided value must be even.");
           }
         }
       }
@@ -493,7 +493,7 @@ int ipmi_parse_range_list(const char *rangeList, unsigned char * pHexList)
           }
           else
           {
-            lprintf(LOG_ERR, "I2C address provided value must be even.");
+            printf(  "I2C address provided value must be even.");
           }
         }
       }
@@ -523,7 +523,7 @@ ipmi_sdr_add_from_list(struct ipmi_intf *intf, const char *rangeList)
   /* Build list from string */
   if(ipmi_parse_range_list(rangeList, listValue) != 0)
   {
-    lprintf(LOG_ERR, "Range - List invalid, cannot be parsed.");
+    printf(  "Range - List invalid, cannot be parsed.");
     return -1;
   }
 
@@ -540,7 +540,7 @@ ipmi_sdr_add_from_list(struct ipmi_intf *intf, const char *rangeList)
 
   printf("Clearing SDR Repository\n");
   if (ipmi_sdr_repo_clear(intf)) {
-    lprintf(LOG_ERR, "Cannot erase SDRR. Give up.");
+    printf(  "Cannot erase SDRR. Give up.");
     return -1;
   }
 
@@ -590,15 +590,15 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
     
     struct sdr_record_list *sdrr;
 
-    lprintf(LOG_DEBUG, "binHdr[0] (id[MSB]) = 0x%02x", binHdr[0]);
-    lprintf(LOG_DEBUG, "binHdr[1] (id[LSB]) = 0x%02x", binHdr[1]);
-    lprintf(LOG_DEBUG, "binHdr[2] (version) = 0x%02x", binHdr[2]);
-    lprintf(LOG_DEBUG, "binHdr[3] (type) = 0x%02x", binHdr[3]);
-    lprintf(LOG_DEBUG, "binHdr[4] (length) = 0x%02x", binHdr[4]);
+    printf(  "binHdr[0] (id[MSB]) = 0x%02x", binHdr[0]);
+    printf(  "binHdr[1] (id[LSB]) = 0x%02x", binHdr[1]);
+    printf(  "binHdr[2] (version) = 0x%02x", binHdr[2]);
+    printf(  "binHdr[3] (type) = 0x%02x", binHdr[3]);
+    printf(  "binHdr[4] (length) = 0x%02x", binHdr[4]);
 
     sdrr = malloc(sizeof(*sdrr));
     if (sdrr == NULL) {
-      lprintf(LOG_ERR, "ipmitool: malloc failure");
+      printf(  "ipmitool: malloc failure");
       rc = -1;
       break;
     }
@@ -608,7 +608,7 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
     sdrr->length = binHdr[4];
 
     if ((sdrr->raw = malloc(sdrr->length)) == NULL) {
-      lprintf(LOG_ERR, "ipmitool: malloc failure");
+      printf(  "ipmitool: malloc failure");
       free(sdrr);
       sdrr = NULL;
       rc = -1;
@@ -616,7 +616,7 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
     }
 
     if (read(fd, sdrr->raw, sdrr->length) != sdrr->length) {
-      lprintf(LOG_ERR, "SDR from '%s' truncated", filename);
+      printf(  "SDR from '%s' truncated", filename);
       free(sdrr->raw);
       sdrr->raw = NULL;
       free(sdrr);
@@ -648,7 +648,7 @@ ipmi_sdr_add_from_file(struct ipmi_intf *intf, const char *ifile)
   rc = ipmi_sdr_read_records(ifile, &sdrr_queue);
 
   if (ipmi_sdr_repo_clear(intf)) {
-    lprintf(LOG_ERR, "Cannot erase SDRR. Giving up.");
+    printf(  "Cannot erase SDRR. Giving up.");
     /* FIXME: free sdr list */
     return -1;
   }
@@ -658,7 +658,7 @@ ipmi_sdr_add_from_file(struct ipmi_intf *intf, const char *ifile)
     sdrr_next = sdrr->next;
     rc = ipmi_sdr_add_record(intf, sdrr);
     if(rc < 0){
-      lprintf(LOG_ERR, "Cannot add SDR ID 0x%04x to repository...", sdrr->id);
+      printf(  "Cannot add SDR ID 0x%04x to repository...", sdrr->id);
     }
     free(sdrr);
     sdrr = NULL;

+ 93 - 93
app/ipmitool-1.8.18/lib/ipmi_sel.c

@@ -124,13 +124,13 @@ int ipmi_sel_oem_init(const char * filename)
 	char buf[15][150];
 
 	if (filename == NULL) {
-		lprintf(LOG_ERR, "No SEL OEM filename provided");
+		printf(  "No SEL OEM filename provided");
 		return -1;
 	}
 
 	fp = ipmi_open_file_read(filename);
 	if (fp == NULL) {
-		lprintf(LOG_ERR, "Could not open %s file", filename);
+		printf(  "Could not open %s file", filename);
 		return -1;
 	}
 
@@ -156,7 +156,7 @@ int ipmi_sel_oem_init(const char * filename)
 			 buf[12], buf[13], buf[14]);
 
 		if (n != 15) {
-			lprintf (LOG_ERR, "Encountered problems reading line %d of %s",
+			printf (  "Encountered problems reading line %d of %s",
 				 i+1, filename);
 			fclose(fp);
 			fp = NULL;
@@ -316,18 +316,18 @@ ipmi_get_oem(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get Device ID command failed");
+		printf(  "Get Device ID command failed");
 		return IPMI_OEM_UNKNOWN;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
+		printf(  "Get Device ID command failed: %#x %s",
 			rsp->ccode, val2str(rsp->ccode, completion_code_vals));
 		return IPMI_OEM_UNKNOWN;
 	}
 
 	devid = (struct ipm_devid_rsp *) rsp->data;
 
-	lprintf(LOG_DEBUG,"Iana: %u",
+	printf( "Iana: %u",
            IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id));
 
 	return  IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id);
@@ -349,11 +349,11 @@ ipmi_sel_add_entry(struct ipmi_intf * intf, struct sel_event_record * rec)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Add SEL Entry failed");
+		printf(  "Add SEL Entry failed");
 		return -1;
 	}
 	else if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Add SEL Entry failed: %s",
+		printf(  "Add SEL Entry failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -415,7 +415,7 @@ ipmi_sel_add_entries_fromfile(struct ipmi_intf * intf, const char * filename)
 			tok = strtok(NULL, " ");
 		}
 		if (i < 7) {
-			lprintf(LOG_ERR, "Invalid Event: %s",
+			printf(  "Invalid Event: %s",
 			       buf2str(rqdata, sizeof(rqdata)));
 			continue;
 		}
@@ -508,12 +508,12 @@ get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
 		if (verbose)
-			lprintf(LOG_ERR, "Error issuing OEM command");
+			printf(  "Error issuing OEM command");
 		return NULL;
 	}
 	if (rsp->ccode > 0) {
 		if (verbose)
-			lprintf(LOG_ERR, "OEM command returned error code: %s",
+			printf(  "OEM command returned error code: %s",
 					val2str(rsp->ccode, completion_code_vals));
 		return NULL;
 	}
@@ -521,17 +521,17 @@ get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
 	/* Verify our response before we use it */
 	if (rsp->data_len < 5)
 	{
-		lprintf(LOG_ERR, "Newisys OEM response too short");
+		printf(  "Newisys OEM response too short");
 		return NULL;
 	}
 	else if (rsp->data_len != (4 + rsp->data[3]))
 	{
-		lprintf(LOG_ERR, "Newisys OEM response has unexpected length");
+		printf(  "Newisys OEM response has unexpected length");
 		return NULL;
 	}
 	else if (IPM_DEV_MANUFACTURER_ID(rsp->data) != IPMI_OEM_NEWISYS)
 	{
-		lprintf(LOG_ERR, "Newisys OEM response has unexpected length");
+		printf(  "Newisys OEM response has unexpected length");
 		return NULL;
 	}
 
@@ -568,7 +568,7 @@ get_supermicro_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec)
 	/* Allocate mem for te Description string */
 	desc = malloc(sizeof(char) * SIZE_OF_DESC);
 	if (desc == NULL) {
-		lprintf(LOG_ERR, "ipmitool: malloc failure");
+		printf(  "ipmitool: malloc failure");
 		return NULL;
 	}
 	memset(desc, '\0', SIZE_OF_DESC);
@@ -584,14 +584,14 @@ get_supermicro_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec)
 
 			rsp = intf->sendrecv(intf, &req);
 			if (rsp == NULL) {
-				lprintf(LOG_ERR, " Error getting system info");
+				printf(  " Error getting system info");
 				if (desc != NULL) {
 					free(desc);
 					desc = NULL;
 				}
 				return NULL;
 			} else if (rsp->ccode > 0) {
-				lprintf(LOG_ERR, " Error getting system info: %s",
+				printf(  " Error getting system info: %s",
 						val2str(rsp->ccode, completion_code_vals));
 				if (desc != NULL) {
 					free(desc);
@@ -786,7 +786,7 @@ char * get_dell_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
 				rsp = intf->sendrecv(intf, &req);
 				if (NULL == rsp) 
 				{
-					lprintf(LOG_ERR, " Error getting system info");
+					printf(  " Error getting system info");
 					if (desc != NULL) {
 						free(desc);
 						desc = NULL;
@@ -795,7 +795,7 @@ char * get_dell_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
 				} 
 				else if (rsp->ccode > 0)
 				{
-					lprintf(LOG_ERR, " Error getting system info: %s",
+					printf(  " Error getting system info: %s",
 						val2str(rsp->ccode, completion_code_vals));
 					if (desc != NULL) {
 						free(desc);
@@ -1334,7 +1334,7 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
 
 			switch(iana){
 				case IPMI_OEM_KONTRON:
-					lprintf(LOG_DEBUG, "oem sensor type %x %d using oem type supplied description",
+					printf(  "oem sensor type %x %d using oem type supplied description",
 		                       rec->sel_type.standard_type.sensor_type , iana);
 				 break;
 				case IPMI_OEM_DELL:		/* OEM Bytes Decoding for DELLi */
@@ -1350,7 +1350,7 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
 					break;
 				 /* add your oem sensor assignation here */
 				default:
-					lprintf(LOG_DEBUG, "oem sensor type %x  using standard type supplied description",
+					printf(  "oem sensor type %x  using standard type supplied description",
 						rec->sel_type.standard_type.sensor_type );
 					break;
 			}
@@ -1398,7 +1398,7 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
 			/* Increase the Malloc size to current_size + Dellspecific description size */
 			*desc = (char *)malloc(strlen(evt->desc) + 48 + SIZE_OF_DESC);
 			if (NULL == *desc) {
-				lprintf(LOG_ERR, "ipmitool: malloc failure");
+				printf(  "ipmitool: malloc failure");
 				return;
 			}
 			memset(*desc, 0, strlen(evt->desc)+ 48 + SIZE_OF_DESC);
@@ -1450,7 +1450,7 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
 		    *desc = (char *)malloc( 48 + SIZE_OF_DESC);
 		    if (NULL == *desc)
 			{
-		        lprintf(LOG_ERR, "ipmitool: malloc failure");
+		        printf(  "ipmitool: malloc failure");
 			    return;
 		    }
 		memset(*desc, 0, 48 + SIZE_OF_DESC);
@@ -1538,14 +1538,14 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get SEL Info command failed");
+		printf(  "Get SEL Info command failed");
 		return -1;
 	} else if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get SEL Info command failed: %s",
+		printf(  "Get SEL Info command failed: %s",
 		       val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	} else if (rsp->data_len != 14) {
-		lprintf(LOG_ERR, "Get SEL Info command failed: "
+		printf(  "Get SEL Info command failed: "
 			"Invalid data length %d", rsp->data_len);
 		return (-1);
 	}
@@ -1619,12 +1619,12 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
 
 		rsp = intf->sendrecv(intf, &req);
 		if (rsp == NULL) {
-			lprintf(LOG_ERR,
+			printf( 
 				"Get SEL Allocation Info command failed");
 			return -1;
 		}
 		if (rsp->ccode > 0) {
-			lprintf(LOG_ERR,
+			printf( 
 				"Get SEL Allocation Info command failed: %s",
 				val2str(rsp->ccode, completion_code_vals));
 			return -1;
@@ -1665,11 +1665,11 @@ ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id,
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get SEL Entry %x command failed", id);
+		printf(  "Get SEL Entry %x command failed", id);
 		return 0;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get SEL Entry %x command failed: %s",
+		printf(  "Get SEL Entry %x command failed: %s",
 			id, val2str(rsp->ccode, completion_code_vals));
 		return 0;
 	}
@@ -1677,7 +1677,7 @@ ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id,
 	/* save next entry id */
 	next = (rsp->data[1] << 8) | rsp->data[0];
 
-	lprintf(LOG_DEBUG, "SEL Entry: %s", buf2str(rsp->data+2, rsp->data_len-2));
+	printf(  "SEL Entry: %s", buf2str(rsp->data+2, rsp->data_len-2));
 	memset(evt, 0, sizeof(*evt));
   
 	/*Clear SEL Structure*/
@@ -2269,11 +2269,11 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get SEL Info command failed");
+		printf(  "Get SEL Info command failed");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get SEL Info command failed: %s",
+		printf(  "Get SEL Info command failed: %s",
 		       val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -2281,7 +2281,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
 		printbuf(rsp->data, rsp->data_len, "sel_info");
 
 	if (rsp->data[1] == 0 && rsp->data[2] == 0) {
-		lprintf(LOG_ERR, "SEL has no entries");
+		printf(  "SEL has no entries");
 		return 0;
 	}
 
@@ -2291,11 +2291,11 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Reserve SEL command failed");
+		printf(  "Reserve SEL command failed");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Reserve SEL command failed: %s",
+		printf(  "Reserve SEL command failed: %s",
 		       val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -2308,11 +2308,11 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
 		req.msg.cmd = IPMI_CMD_GET_SEL_INFO;
 		rsp = intf->sendrecv(intf, &req);
 		if (rsp == NULL) {
-			lprintf(LOG_ERR, "Get SEL Info command failed");
+			printf(  "Get SEL Info command failed");
 			return -1;
 		}
 		if (rsp->ccode > 0) {
-			lprintf(LOG_ERR, "Get SEL Info command failed: %s",
+			printf(  "Get SEL Info command failed: %s",
 				val2str(rsp->ccode, completion_code_vals));
 			return -1;
 		}
@@ -2342,7 +2342,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
 
 	while (next_id != 0xffff) {
 		curr_id = next_id;
-		lprintf(LOG_DEBUG, "SEL Next ID: %04x", curr_id);
+		printf(  "SEL Next ID: %04x", curr_id);
 
 		next_id = ipmi_sel_get_std_entry(intf, curr_id, &evt);
 		if (next_id == 0) {
@@ -2419,13 +2419,13 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 		 */
 		fp = ipmi_open_file(readfile, 0);
 		if (fp == NULL) {
-			lprintf(LOG_ERR, "Failed to open file '%s' for reading.",
+			printf(  "Failed to open file '%s' for reading.",
 					readfile);
 			return (-1);
 		}
 		buffer = (char *)malloc((size_t)256);
 		if (buffer == NULL) {
-			lprintf(LOG_ERR, "ipmitool: malloc failure");
+			printf(  "ipmitool: malloc failure");
 			fclose(fp);
 			return (-1);
 		}
@@ -2438,7 +2438,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				break;
 			}
 			if (strlen(buffer) > 255) {
-				lprintf(LOG_ERR, "ipmitool: invalid entry found in file.");
+				printf(  "ipmitool: invalid entry found in file.");
 				continue;
 			}
 			cursor = buffer;
@@ -2447,7 +2447,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 			errno = 0;
 			evt.record_id = strtol((const char *)cursor, (char **)NULL, 16);
 			if (errno != 0) {
-				lprintf(LOG_ERR, "Invalid record ID.");
+				printf(  "Invalid record ID.");
 				status = (-1);
 				break;
 			}	
@@ -2475,7 +2475,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 			evt.sel_type.standard_type.sensor_type =
 				strtol((const char *)cursor, (char **)NULL, 16);
 			if (errno != 0) {
-				lprintf(LOG_ERR, "Invalid Sensor Type.");
+				printf(  "Invalid Sensor Type.");
 				status = (-1);
 				break;
 			}	
@@ -2486,7 +2486,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 			evt.sel_type.standard_type.sensor_num =
 				strtol((const char *)cursor, (char **)NULL, 10);
 			if (errno != 0) {
-				lprintf(LOG_ERR, "Invalid Sensor Number.");
+				printf(  "Invalid Sensor Number.");
 				status = (-1);
 				break;
 			}	
@@ -2499,7 +2499,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 			evt.sel_type.standard_type.event_type=
 				strtol((const char *)cursor, (char **)NULL, 16);
 			if (errno != 0) {
-				lprintf(LOG_ERR, "Invalid Event Type.");
+				printf(  "Invalid Event Type.");
 				status = (-1);
 				break;
 			}	
@@ -2526,7 +2526,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[2] =
 					strtol(cursor, (char **)NULL, 10);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#2.");
+					printf(  "Invalid Event Data#2.");
 					status = (-1);
 					break;
 				}	
@@ -2540,7 +2540,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[1] =
 					strtol(cursor, (char **)NULL, 10);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#1.");
+					printf(  "Invalid Event Data#1.");
 					status = (-1);
 					break;
 				}	
@@ -2554,7 +2554,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[0] =
 					0xA0 | strtol(cursor, (char **)NULL, 10);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#0.");
+					printf(  "Invalid Event Data#0.");
 					status = (-1);
 					break;
 				}	
@@ -2566,7 +2566,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[1] |=
 					(strtol(cursor, (char **)NULL, 16)) << 4;
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#1.");
+					printf(  "Invalid Event Data#1.");
 					status = (-1);
 					break;
 				}	
@@ -2575,7 +2575,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[0] =
 					strtol((const char *)cursor, (char **)NULL, 16);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#0.");
+					printf(  "Invalid Event Data#0.");
 					status = (-1);
 					break;
 				}	
@@ -2586,7 +2586,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[1] =
 					strtol((const char *)cursor, (char **)NULL, 16);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#1.");
+					printf(  "Invalid Event Data#1.");
 					status = (-1);
 					break;
 				}	
@@ -2598,12 +2598,12 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 				evt.sel_type.standard_type.event_data[2] =
 					strtol((const char *)cursor, (char **)NULL, 16);
 				if (errno != 0) {
-					lprintf(LOG_ERR, "Invalid Event Data#2.");
+					printf(  "Invalid Event Data#2.");
 					status = (-1);
 					break;
 				}	
 			} else {
-				lprintf(LOG_ERR, "ipmitool: can't guess format.");
+				printf(  "ipmitool: can't guess format.");
 			}
 			/* parse the PPS line into a sel_event_record */
 			if (verbose) {
@@ -2618,7 +2618,7 @@ ipmi_sel_interpret(struct ipmi_intf *intf, unsigned long iana,
 		buffer = NULL;
 		fclose(fp);
 	} else {
-		lprintf(LOG_ERR, "Given format '%s' is unknown.", format);
+		printf(  "Given format '%s' is unknown.", format);
 		status = (-1);
 	}
 	return status;
@@ -2656,7 +2656,7 @@ ipmi_sel_readraw(struct ipmi_intf * intf, const char * inputfile)
 			{
 				if (bytesRead != 0)
 				{
-					lprintf(LOG_ERR, "ipmitool: incomplete record found in file.");
+					printf(  "ipmitool: incomplete record found in file.");
 					ret = -1;
 				}
 				
@@ -2668,7 +2668,7 @@ ipmi_sel_readraw(struct ipmi_intf * intf, const char * inputfile)
 	}
 	else
 	{
-		lprintf(LOG_ERR, "ipmitool: could not open input file.");
+		printf(  "ipmitool: could not open input file.");
 		ret = -1;
 	}
 	return ret;
@@ -2688,7 +2688,7 @@ ipmi_sel_reserve(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_WARN, "Unable to reserve SEL");
+		printf(  "Unable to reserve SEL");
 		return 0;
 	}
 	if (rsp->ccode > 0) {
@@ -2724,16 +2724,16 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
 	rsp = intf->sendrecv(intf, &req);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Get SEL Time command failed");
+		printf(  "Get SEL Time command failed");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Get SEL Time command failed: %s",
+		printf(  "Get SEL Time command failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
 	if (rsp->data_len != 4) {
-		lprintf(LOG_ERR, "Get SEL Time command failed: "
+		printf(  "Get SEL Time command failed: "
 			"Invalid data length %d", rsp->data_len);
 		return -1;
 	}
@@ -2780,13 +2780,13 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
 	else {
 		/* Now how do we get our time_t from our ascii version? */
 		if (strptime(time_string, time_format, &tm) == 0) {
-			lprintf(LOG_ERR, "Specified time could not be parsed");
+			printf(  "Specified time could not be parsed");
 			return -1;
 		}
 		tm.tm_isdst = (-1); /* look up DST information */
 		t = mktime(&tm);
 		if (t < 0) {
-			lprintf(LOG_ERR, "Specified time could not be parsed");
+			printf(  "Specified time could not be parsed");
 			return -1;
 		}
 	}
@@ -2826,11 +2826,11 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Set SEL Time command failed");
+		printf(  "Set SEL Time command failed");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Set SEL Time command failed: %s",
+		printf(  "Set SEL Time command failed: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -2870,11 +2870,11 @@ ipmi_sel_clear(struct ipmi_intf * intf)
 
 	rsp = intf->sendrecv(intf, &req);
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Unable to clear SEL");
+		printf(  "Unable to clear SEL");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Unable to clear SEL: %s",
+		printf(  "Unable to clear SEL: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -2893,7 +2893,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
 	int rc = 0;
 
 	if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
-		lprintf(LOG_ERR, "usage: delete <id>...<id>\n");
+		printf(  "usage: delete <id>...<id>\n");
 		return -1;
 	}
 
@@ -2908,7 +2908,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
 	for (; argc != 0; argc--)
 	{
 		if (str2ushort(argv[argc-1], &id) != 0) {
-			lprintf(LOG_ERR, "Given SEL ID '%s' is invalid.",
+			printf(  "Given SEL ID '%s' is invalid.",
 					argv[argc-1]);
 			rc = (-1);
 			continue;
@@ -2924,11 +2924,11 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
 
 		rsp = intf->sendrecv(intf, &req);
 		if (rsp == NULL) {
-			lprintf(LOG_ERR, "Unable to delete entry %d", id);
+			printf(  "Unable to delete entry %d", id);
 			rc = -1;
 		}
 		else if (rsp->ccode > 0) {
-			lprintf(LOG_ERR, "Unable to delete entry %d: %s", id,
+			printf(  "Unable to delete entry %d: %s", id,
 				val2str(rsp->ccode, completion_code_vals));
 			rc = -1;
 		}
@@ -2954,35 +2954,35 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
 	uint16_t id;
 
 	if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
-		lprintf(LOG_ERR, "usage: sel get <id>...<id>");
+		printf(  "usage: sel get <id>...<id>");
 		return (-1);
 	}
 
 	if (ipmi_sel_reserve(intf) == 0) {
-		lprintf(LOG_ERR, "Unable to reserve SEL");
+		printf(  "Unable to reserve SEL");
 		return (-1);
 	}
 
 	for (i = 0; i < argc; i++) {
 		if (str2ushort(argv[i], &id) != 0) {
-			lprintf(LOG_ERR, "Given SEL ID '%s' is invalid.",
+			printf(  "Given SEL ID '%s' is invalid.",
 					argv[i]);
 			rc = (-1);
 			continue;
 		}
 
-		lprintf(LOG_DEBUG, "Looking up SEL entry 0x%x", id);
+		printf(  "Looking up SEL entry 0x%x", id);
 
 		/* lookup SEL entry based on ID */
 		if (!ipmi_sel_get_std_entry(intf, id, &evt)) {
-			lprintf(LOG_DEBUG, "SEL Entry 0x%x not found.", id);
+			printf(  "SEL Entry 0x%x not found.", id);
 			rc = (-1);
 			continue;
 		}
 		if (evt.sel_type.standard_type.sensor_num == 0
 				&& evt.sel_type.standard_type.sensor_type == 0
 				&& evt.record_type == 0) {
-			lprintf(LOG_WARN, "SEL Entry 0x%x not found", id);
+			printf(  "SEL Entry 0x%x not found", id);
 			rc = (-1);
 			continue;
 		}
@@ -3043,16 +3043,16 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
 	if (argc == 0)
 		rc = ipmi_sel_get_info(intf);
 	else if (strncmp(argv[0], "help", 4) == 0)
-		lprintf(LOG_ERR, "SEL Commands:  "
+		printf(  "SEL Commands:  "
 				"info clear delete list elist get add time save readraw writeraw interpret");
 	else if (strncmp(argv[0], "interpret", 9) == 0) {
 		uint32_t iana = 0;
 		if (argc < 4) {
-			lprintf(LOG_NOTICE, "usage: sel interpret iana filename format(pps)");
+			printf(  "usage: sel interpret iana filename format(pps)");
 			return 0;
 		}
 		if (str2uint(argv[1], &iana) != 0) {
-			lprintf(LOG_ERR, "Given IANA '%s' is invalid.",
+			printf(  "Given IANA '%s' is invalid.",
 					argv[1]);
 			return (-1);
 		}
@@ -3062,35 +3062,35 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
 		rc = ipmi_sel_get_info(intf);
 	else if (strncmp(argv[0], "save", 4) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_NOTICE, "usage: sel save <filename>");
+			printf(  "usage: sel save <filename>");
 			return 0;
 		}
 		rc = ipmi_sel_save_entries(intf, 0, argv[1]);
 	}
 	else if (strncmp(argv[0], "add", 3) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_NOTICE, "usage: sel add <filename>");
+			printf(  "usage: sel add <filename>");
 			return 0;
 		}
 		rc = ipmi_sel_add_entries_fromfile(intf, argv[1]);
 	}
 	else if (strncmp(argv[0], "writeraw", 8) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_NOTICE, "usage: sel writeraw <filename>");
+			printf(  "usage: sel writeraw <filename>");
 			return 0;
 		}
 		rc = ipmi_sel_writeraw(intf, argv[1]);
 	}
 	else if (strncmp(argv[0], "readraw", 7) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_NOTICE, "usage: sel readraw <filename>");
+			printf(  "usage: sel readraw <filename>");
 			return 0;
 		}
 		rc = ipmi_sel_readraw(intf, argv[1]);
 	}
 	else if (strncmp(argv[0], "ereadraw", 8) == 0) {
 		if (argc < 2) {
-			lprintf(LOG_NOTICE, "usage: sel ereadraw <filename>");
+			printf(  "usage: sel ereadraw <filename>");
 			return 0;
 		}
 		sel_extended = 1;
@@ -3123,14 +3123,14 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
 				sign = -1;
 			}
 			else if (strncmp(argv[1], "first", 5) != 0) {
-				lprintf(LOG_ERR, "Unknown sel list option");
+				printf(  "Unknown sel list option");
 				return -1;
 			}
 		}
 
 		if (countstr) {
 			if (str2int(countstr, &count) != 0) {
-				lprintf(LOG_ERR, "Numeric argument required; got '%s'",
+				printf(  "Numeric argument required; got '%s'",
 					countstr);
 				return -1;
 			}
@@ -3143,32 +3143,32 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
 		rc = ipmi_sel_clear(intf);
 	else if (strncmp(argv[0], "delete", 6) == 0) {
 		if (argc < 2)
-			lprintf(LOG_ERR, "usage: sel delete <id>...<id>");
+			printf(  "usage: sel delete <id>...<id>");
 		else
 			rc = ipmi_sel_delete(intf, argc-1, &argv[1]);
 	}
 	else if (strncmp(argv[0], "get", 3) == 0) {
 		if (argc < 2)
-			lprintf(LOG_ERR, "usage: sel get <entry>");
+			printf(  "usage: sel get <entry>");
 		else
 			rc = ipmi_sel_show_entry(intf, argc-1, &argv[1]);
 	}
 	else if (strncmp(argv[0], "time", 4) == 0) {
 		if (argc < 2)
-			lprintf(LOG_ERR, "sel time commands: get set");
+			printf(  "sel time commands: get set");
 		else if (strncmp(argv[1], "get", 3) == 0)
 			ipmi_sel_get_time(intf);
 		else if (strncmp(argv[1], "set", 3) == 0) {
 			if (argc < 3)
-				lprintf(LOG_ERR, "usage: sel time set \"mm/dd/yyyy hh:mm:ss\"");
+				printf(  "usage: sel time set \"mm/dd/yyyy hh:mm:ss\"");
 			else
 				rc = ipmi_sel_set_time(intf, argv[2]);
 		} else {
-			lprintf(LOG_ERR, "sel time commands: get set");
+			printf(  "sel time commands: get set");
 		}
 	}
 	else {
-		lprintf(LOG_ERR, "Invalid SEL command: %s", argv[0]);
+		printf(  "Invalid SEL command: %s", argv[0]);
 		rc = -1;
 	}
 

+ 54 - 54
app/ipmitool-1.8.18/lib/ipmi_sensor.c

@@ -81,7 +81,7 @@ ipmi_sensor_get_sensor_reading_factors(
 	rsp = intf->sendrecv(intf, &req);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Error updating reading factor for sensor %s (#%02x)",
+		printf(  "Error updating reading factor for sensor %s (#%02x)",
 			id, sensor->cmn.keys.sensor_num);
 		return -1;
 	} else if (rsp->ccode) {
@@ -421,11 +421,11 @@ ipmi_sensor_list(struct ipmi_intf *intf)
 	struct ipmi_sdr_iterator *itr;
 	int rc = 0;
 
-	lprintf(LOG_DEBUG, "Querying SDR for sensor list");
+	printf(  "Querying SDR for sensor list");
 
 	itr = ipmi_sdr_start(intf, 0);
 	if (itr == NULL) {
-		lprintf(LOG_ERR, "Unable to open SDR for reading");
+		printf(  "Unable to open SDR for reading");
 		return -1;
 	}
 
@@ -434,7 +434,7 @@ ipmi_sensor_list(struct ipmi_intf *intf)
 
 		rec = ipmi_sdr_get_record(intf, header, itr);
 		if (rec == NULL) {
-			lprintf(LOG_DEBUG, "rec == NULL");
+			printf(  "rec == NULL");
 			continue;
 		}
 
@@ -482,11 +482,11 @@ __ipmi_sensor_set_threshold(struct ipmi_intf *intf,
 				  target, lun, channel);
 
 	if (rsp == NULL) {
-		lprintf(LOG_ERR, "Error setting threshold");
+		printf(  "Error setting threshold");
 		return -1;
 	}
 	if (rsp->ccode > 0) {
-		lprintf(LOG_ERR, "Error setting threshold: %s",
+		printf(  "Error setting threshold: %s",
 			val2str(rsp->ccode, completion_code_vals));
 		return -1;
 	}
@@ -539,45 +539,45 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 
 	if (strncmp(thresh, "upper", 5) == 0) {
 		if (argc < 5) {
-			lprintf(LOG_ERR,
+			printf( 
 				"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
 			return -1;
 		}
 		allUpper = 1;
 		if (str2double(argv[2], &setting1) != 0) {
-			lprintf(LOG_ERR, "Given unc '%s' is invalid.",
+			printf(  "Given unc '%s' is invalid.",
 					argv[2]);
 			return (-1);
 		}
 		if (str2double(argv[3], &setting2) != 0) {
-			lprintf(LOG_ERR, "Given ucr '%s' is invalid.",
+			printf(  "Given ucr '%s' is invalid.",
 					argv[3]);
 			return (-1);
 		}
 		if (str2double(argv[4], &setting3) != 0) {
-			lprintf(LOG_ERR, "Given unr '%s' is invalid.",
+			printf(  "Given unr '%s' is invalid.",
 					argv[4]);
 			return (-1);
 		}
 	} else if (strncmp(thresh, "lower", 5) == 0) {
 		if (argc < 5) {
-			lprintf(LOG_ERR,
+			printf( 
 				"usage: sensor thresh <id> lower <lnr> <lcr> <lnc>");
 			return -1;
 		}
 		allLower = 1;
 		if (str2double(argv[2], &setting1) != 0) {
-			lprintf(LOG_ERR, "Given lnc '%s' is invalid.",
+			printf(  "Given lnc '%s' is invalid.",
 					argv[2]);
 			return (-1);
 		}
 		if (str2double(argv[3], &setting2) != 0) {
-			lprintf(LOG_ERR, "Given lcr '%s' is invalid.",
+			printf(  "Given lcr '%s' is invalid.",
 					argv[3]);
 			return (-1);
 		}
 		if (str2double(argv[4], &setting3) != 0) {
-			lprintf(LOG_ERR, "Given lnr '%s' is invalid.",
+			printf(  "Given lnr '%s' is invalid.",
 					argv[4]);
 			return (-1);
 		}
@@ -595,13 +595,13 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 		else if (strncmp(thresh, "lnr", 3) == 0)
 			settingMask = LOWER_NON_RECOV_SPECIFIED;
 		else {
-			lprintf(LOG_ERR,
+			printf( 
 				"Valid threshold '%s' for sensor '%s' not specified!",
 				thresh, id);
 			return -1;
 		}
 		if (str2double(argv[2], &setting1) != 0) {
-			lprintf(LOG_ERR,
+			printf( 
 					"Given %s threshold value '%s' is invalid.",
 					thresh, argv[2]);
 			return (-1);
@@ -613,17 +613,17 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 	/* lookup by sensor name */
 	sdr = ipmi_sdr_find_sdr_byid(intf, id);
 	if (sdr == NULL) {
-		lprintf(LOG_ERR, "Sensor data record not found!");
+		printf(  "Sensor data record not found!");
 		return -1;
 	}
 
 	if (sdr->type != SDR_RECORD_TYPE_FULL_SENSOR) {
-		lprintf(LOG_ERR, "Invalid sensor type %02x", sdr->type);
+		printf(  "Invalid sensor type %02x", sdr->type);
 		return -1;
 	}
 
 	if (!IS_THRESHOLD_SENSOR(sdr->record.common)) {
-		lprintf(LOG_ERR, "Invalid sensor event type %02x", sdr->record.common->event_type);
+		printf(  "Invalid sensor event type %02x", sdr->record.common->event_type);
 		return -1;
 	}
 
@@ -722,7 +722,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 						sdr->record.common->keys.lun,
 						sdr->record.common->keys.channel);
 		if ((rsp == NULL) || (rsp->ccode > 0)) {
-			lprintf(LOG_ERR, "Sensor data record not found!");
+			printf(  "Sensor data record not found!");
 				return -1;
 		}
 		for(i=1;i<=6;i++) {
@@ -737,7 +737,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				(( (rsp->data[0] & UPPER_CRIT_SPECIFIED) && ( setting1 <= val[5])) ||
 					( (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED) && ( setting1 <= val[4]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else if( (settingMask & UPPER_CRIT_SPECIFIED) ) { 		/* Check for the valid Upper critical Value.*/
@@ -745,7 +745,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				(((rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)&& ( setting1 >= val[6])) ||
 				((rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)&&( setting1 <= val[4]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else if( (settingMask & UPPER_NON_CRIT_SPECIFIED) ) {  		/* Check for the valid Upper non critical Value.*/
@@ -754,7 +754,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				((rsp->data[0] & UPPER_CRIT_SPECIFIED)&&( setting1 >= val[5])) ||
 				((rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)&&( setting1 <= val[1]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else if( (settingMask & LOWER_NON_CRIT_SPECIFIED) ) {		/* Check for the valid lower non critical Value.*/
@@ -763,7 +763,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				((rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)&&( setting1 <= val[3]))||
 				((rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)&&( setting1 >= val[4]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else if( (settingMask & LOWER_CRIT_SPECIFIED) ) {		/* Check for the valid lower critical Value.*/
@@ -771,7 +771,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				(((rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)&&( setting1 >= val[1])) ||
 				((rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)&&( setting1 <= val[3]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else if( (settingMask & LOWER_NON_RECOV_SPECIFIED) ) {		/* Check for the valid lower non recovarable Value.*/
@@ -779,11 +779,11 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
 				(((rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)&&( setting1 >= val[1])) ||
 				((rsp->data[0] & LOWER_CRIT_SPECIFIED)&&( setting1 >= val[2]))) )
 			{
-				lprintf(LOG_ERR, INVALID_THRESHOLD);
+				printf(  INVALID_THRESHOLD);
 				return -1;
 			}
 		} else {			/* None of this Then Return with error messages.*/
-			lprintf(LOG_ERR, INVALID_THRESHOLD);
+			printf(  INVALID_THRESHOLD);
 			return -1;
 		}
 
@@ -811,15 +811,15 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
 	int i, rc=0;
 
 	if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
-		lprintf(LOG_NOTICE, "sensor reading <id> ... [id]");
-		lprintf(LOG_NOTICE, "   id        : name of desired sensor");
+		printf(  "sensor reading <id> ... [id]");
+		printf(  "   id        : name of desired sensor");
 		return -1;
 	}
 
 	for (i = 0; i < argc; i++) {
 		sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
 		if (sdr == NULL) {
-			lprintf(LOG_ERR, "Sensor \"%s\" not found!",
+			printf(  "Sensor \"%s\" not found!",
 				argv[i]);
 			rc = -1;
 			continue;
@@ -845,7 +845,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
 				continue;
 
 			if (!sr->s_has_analog_value) {
-				lprintf(LOG_ERR, "Sensor \"%s\" is a discrete sensor!", argv[i]);
+				printf(  "Sensor \"%s\" is a discrete sensor!", argv[i]);
 				continue;
 			}
 			if (csv_output)
@@ -871,7 +871,7 @@ ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv)
 	struct sdr_record_list *sdr;
 
 	if (argc < 1) {
-		lprintf(LOG_ERR, "Not enough parameters given.");
+		printf(  "Not enough parameters given.");
 		print_sensor_get_usage();
 		return (-1);
 	} else if (strcmp(argv[0], "help") == 0) {
@@ -883,7 +883,7 @@ ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv)
 	for (i = 0; i < argc; i++) {
 		sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
 		if (sdr == NULL) {
-			lprintf(LOG_ERR, "Sensor data record \"%s\" not found!",
+			printf(  "Sensor data record \"%s\" not found!",
 					argv[i]);
 			rc = -1;
 			continue;
@@ -920,7 +920,7 @@ ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
 	if (argc == 0) {
 		rc = ipmi_sensor_list(intf);
 	} else if (strncmp(argv[0], "help", 4) == 0) {
-		lprintf(LOG_NOTICE, "Sensor Commands:  list thresh get reading");
+		printf(  "Sensor Commands:  list thresh get reading");
 	} else if (strncmp(argv[0], "list", 4) == 0) {
 		rc = ipmi_sensor_list(intf);
 	} else if (strncmp(argv[0], "thresh", 5) == 0) {
@@ -930,7 +930,7 @@ ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
 	} else if (strncmp(argv[0], "reading", 7) == 0) {
 		rc = ipmi_sensor_get_reading(intf, argc - 1, &argv[1]);
 	} else {
-		lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
+		printf(  "Invalid sensor command: %s", argv[0]);
 		rc = -1;
 	}
 
@@ -944,8 +944,8 @@ ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
 void
 print_sensor_get_usage()
 {
-	lprintf(LOG_NOTICE, "sensor get <id> ... [id]");
-	lprintf(LOG_NOTICE, "   id        : name of desired sensor");
+	printf(  "sensor get <id> ... [id]");
+	printf(  "   id        : name of desired sensor");
 }
 
 /* print_sensor_thresh_set_usage - print usage for # ipmitool sensor thresh;
@@ -955,37 +955,37 @@ print_sensor_get_usage()
 void
 print_sensor_thresh_usage()
 {
-	lprintf(LOG_NOTICE,
+	printf( 
 "sensor thresh <id> <threshold> <setting>");
-	lprintf(LOG_NOTICE,
+	printf( 
 "   id        : name of the sensor for which threshold is to be set");
-	lprintf(LOG_NOTICE,
+	printf( 
 "   threshold : which threshold to set");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 unr = upper non-recoverable");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 ucr = upper critical");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 unc = upper non-critical");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 lnc = lower non-critical");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 lcr = lower critical");
-	lprintf(LOG_NOTICE,
+	printf( 
 "                 lnr = lower non-recoverable");
-	lprintf(LOG_NOTICE,
+	printf( 
 "   setting   : the value to set the threshold to");
-	lprintf(LOG_NOTICE,
+	printf( 
 "");
-	lprintf(LOG_NOTICE,
+	printf( 
 "sensor thresh <id> lower <lnr> <lcr> <lnc>");
-	lprintf(LOG_NOTICE,
+	printf( 
 "   Set all lower thresholds at the same time");
-	lprintf(LOG_NOTICE,
+	printf( 
 "");
-	lprintf(LOG_NOTICE,
+	printf( 
 "sensor thresh <id> upper <unc> <ucr> <unr>");
-	lprintf(LOG_NOTICE,
+	printf( 
 "   Set all upper thresholds at the same time");
-	lprintf(LOG_NOTICE, "");
+	printf(  "");
 }

+ 14 - 14
app/ipmitool-1.8.18/src/plugins/ipmi_intf.c

@@ -54,7 +54,7 @@
 #include <ipmitool/ipmi_intf.h>
 #include <ipmitool/ipmi.h>
 #include <ipmitool/ipmi_sdr.h>
-#include <ipmitool/log.h>
+//#include <ipmitool/log.h>
 
 #define IPMI_DEFAULT_PAYLOAD_SIZE   25
 
@@ -136,7 +136,7 @@ void ipmi_intf_print(struct ipmi_intf_support * intflist)
 	int def = 1;
 	int found;
 
-	lprintf(LOG_NOTICE, "Interfaces:");
+	printf( "Interfaces:");
 
 	for (intf = ipmi_intf_table; intf && *intf; intf++) {
 
@@ -152,12 +152,12 @@ void ipmi_intf_print(struct ipmi_intf_support * intflist)
 				continue;
 		}
 
-		lprintf(LOG_NOTICE, "\t%-12s  %s %s",
+		printf( "\t%-12s  %s %s",
 			(*intf)->name, (*intf)->desc,
 			def ? "[default]" : "");
 		def = 0;
 	}
-	lprintf(LOG_NOTICE, "");
+	printf( "");
 }
 
 /* ipmi_intf_load  -  Load an interface from the interface table above
@@ -176,7 +176,7 @@ struct ipmi_intf * ipmi_intf_load(char * name)
 	if (name == NULL) {
 		i = ipmi_intf_table[0];
 		if (i->setup != NULL && (i->setup(i) < 0)) {
-			lprintf(LOG_ERR, "Unable to setup "
+			printf( "Unable to setup "
 				"interface %s", name);
 			return NULL;
 		}
@@ -189,7 +189,7 @@ struct ipmi_intf * ipmi_intf_load(char * name)
 		i = *intf;
 		if (strncmp(name, i->name, strlen(name)) == 0) {
 			if (i->setup != NULL && (i->setup(i) < 0)) {
-				lprintf(LOG_ERR, "Unable to setup "
+				printf( "Unable to setup "
 					"interface %s", name);
 				return NULL;
 			}
@@ -335,7 +335,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 	params = &intf->ssn_params;
 
 	if (params->hostname == NULL || strlen((const char *)params->hostname) == 0) {
-		lprintf(LOG_ERR, "No hostname specified!");
+		printf( "No hostname specified!");
 		return -1;
 	}
 
@@ -351,7 +351,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 	hints.ai_protocol = IPPROTO_UDP; /*  */
 
 	if (getaddrinfo(params->hostname, service, &hints, &rp0) != 0) {
-		lprintf(LOG_ERR, "Address lookup for %s failed",
+		printf( "Address lookup for %s failed",
 				params->hostname);
 		return -1;
 	}
@@ -387,7 +387,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 			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) {
-					lprintf(LOG_DEBUG, "Trying address: %s scope=%d",
+					printf( "Trying address: %s scope=%d",
 						hbuf,
 						addr6->sin6_scope_id);
 				}
@@ -401,7 +401,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 				struct ifaddrs *ifa = NULL;
 
 				if (getifaddrs(&ifaddrs) < 0) {
-					lprintf(LOG_ERR, "Interface address lookup for %s failed",
+					printf( "Interface address lookup for %s failed",
 						params->hostname);
 					break;
 				}
@@ -423,7 +423,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 						}
 						len = sizeof(struct sockaddr_in6);
 						if ( getnameinfo((struct sockaddr *)tmp6, len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) == 0) {
-							lprintf(LOG_DEBUG, "Testing %s interface address: %s scope=%d",
+							printf( "Testing %s interface address: %s scope=%d",
 								ifa->ifa_name != NULL ? ifa->ifa_name : "???",
 								hbuf,
 								tmp6->sin6_scope_id);
@@ -449,7 +449,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf)
 						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;
-								lprintf(LOG_DEBUG, "Successful connected on %s interface with scope id %d", ifa->ifa_name, tmp6->sin6_scope_id);
+								printf( "Successful connected on %s interface with scope id %d", ifa->ifa_name, tmp6->sin6_scope_id);
 								break;  /* Success */
 							}
 						}
@@ -595,7 +595,7 @@ void
 ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size)
 {
 	if (size < IPMI_DEFAULT_PAYLOAD_SIZE) {
-		lprintf(LOG_ERR, "Request size is too small (%d), leave default size",
+		printf( "Request size is too small (%d), leave default size",
 				size);
 		return;
 	}
@@ -611,7 +611,7 @@ void
 ipmi_intf_set_max_response_data_size(struct ipmi_intf * intf, uint16_t size)
 {
 	if (size < IPMI_DEFAULT_PAYLOAD_SIZE - 1) {
-		lprintf(LOG_ERR, "Response size is too small (%d), leave default size",
+		printf( "Response size is too small (%d), leave default size",
 				size);
 		return;
 	}

BIN
app/test_app/test_app


+ 2 - 2
gd32450i-eval.initramfs

@@ -106,7 +106,7 @@ file /usr/bin/gpio.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/GPIO/gpio.ko
 file /usr/bin/i2c.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/I2C/i2c.ko 755 0 0
 file /usr/bin/fmc.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/FMC/fmc.ko 755 0 0
 file /usr/bin/test_module.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/test/test_module.ko 755 0 0
-file /usr/bin/platform_STM32F429.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/Platform/platform_STM32F429.ko 755 0 0
+file /usr/bin/platform.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/Platform/platform.ko 755 0 0
 file /usr/bin/adc.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/ADC/adc.ko 755 0 0
 file /usr/bin/spi.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/SPI/spi.ko 755 0 0
 
@@ -116,7 +116,7 @@ file /usr/bin/spi.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/SPI/spi.ko 75
 
 file /usr/bin/test_app ${INSTALL_ROOT}/projects/${SAMPLE}/app/test_app/test_app 755 0 0
 file /usr/bin/bmc_app ${INSTALL_ROOT}/projects/${SAMPLE}/app/bmc/bmc_app 755 0 0
-#file /usr/bin/ipmitool ${INSTALL_ROOT}/projects/${SAMPLE}/app/ipmitool-1.8.18/ipmitool 755 0 0
+file /usr/bin/ipmitool ${INSTALL_ROOT}/projects/${SAMPLE}/app/ipmitool-1.8.18/ipmitool 755 0 0
 file /usr/bin/goahead-3.6.5 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/build/linux-arm-static/bin/goahead 755 0 0
 
 dir /etc/goahead 755 0 0 

+ 1 - 1
local/rc

@@ -13,7 +13,7 @@ ifconfig lo 127.0.0.1
 insmod /usr/bin/gpio.ko 
 #insmod /usr/bin/i2c.ko
 #insmod /usr/bin/fmc.ko
-insmod /usr/bin/platform_STM32F429.ko
+insmod /usr/bin/platform.ko
 #insmod /usr/bin/adc.ko
 #insmod /usr/bin/spi.ko
 

Some files were not shown because too many files changed in this diff