summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/channel.cpp2
-rw-r--r--apphandler.cpp54
-rw-r--r--chassishandler.cpp79
-rw-r--r--dcmihandler.cpp14
-rw-r--r--groupext.cpp1
-rw-r--r--host-cmd-manager.cpp8
-rw-r--r--host-interface.cpp2
-rw-r--r--ipmid.cpp80
-rw-r--r--ipmisensor.cpp15
-rw-r--r--sensorhandler.cpp11
-rw-r--r--softoff/mainapp.cpp4
-rw-r--r--softoff/softoff.cpp4
-rw-r--r--storageaddsel.cpp17
-rw-r--r--storagehandler.cpp30
-rw-r--r--systemintfcmds.cpp10
-rw-r--r--testaddsel.cpp21
-rw-r--r--testit.cpp23
-rw-r--r--transporthandler.cpp4
18 files changed, 157 insertions, 222 deletions
diff --git a/app/channel.cpp b/app/channel.cpp
index 3134683..3c011fd 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -104,8 +104,6 @@ ipmi_ret_t ipmi_app_channel_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
int channel = (*p) & CHANNEL_MASK;
std::string ethdevice = ipmi::network::ChanneltoEthernet(channel);
- printf("IPMI APP GET CHANNEL INFO\n");
-
// The supported channels numbers are those which are configured.
// Channel Number E is used as way to identify the current channel
// that the command is being is received from.
diff --git a/apphandler.cpp b/apphandler.cpp
index 057f578..e69829f 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -147,7 +147,7 @@ ipmi_ret_t ipmi_app_set_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_ret_t rc = IPMI_CC_OK;
*data_len = 0;
- printf("IPMI SET ACPI STATE Ignoring for now\n");
+ log<level::DEBUG>("IPMI SET ACPI STATE Ignoring for now\n");
return rc;
}
@@ -398,13 +398,12 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_ret_t rc = IPMI_CC_OK;
*data_len = 0;
- printf("IPMI GET DEVICE GUID\n");
-
// Call Get properties method with the interface and property name
r = mapper_get_service(bus, objname, &busname);
if (r < 0) {
- fprintf(stderr, "Failed to get %s bus name: %s\n",
- objname, strerror(-r));
+ log<level::ERR>("Failed to get bus name",
+ entry("BUS=%s", objname),
+ entry("ERRNO=0x%X", -r));
goto finish;
}
r = sd_bus_call_method(bus,busname,objname,iface,
@@ -412,7 +411,8 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
chassis_iface, "uuid");
if (r < 0)
{
- fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
+ log<level::ERR>("Failed to call Get Method",
+ entry("ERRNO=0x%X", -r));
rc = IPMI_CC_UNSPECIFIED_ERROR;
goto finish;
}
@@ -420,7 +420,8 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
r = sd_bus_message_read(reply, "v", "s", &uuid);
if (r < 0 || uuid == NULL)
{
- fprintf(stderr, "Failed to get a response: %s", strerror(-r));
+ log<level::ERR>("Failed to get a response",
+ entry("ERRNO=0x%X", -r));
rc = IPMI_CC_RESPONSE_ERROR;
goto finish;
}
@@ -432,7 +433,8 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
if (id_octet == NULL)
{
// Error
- fprintf(stderr, "Unexpected UUID format: %s", uuid);
+ log<level::ERR>("Unexpected UUID format",
+ entry("UUID=%s", uuid));
rc = IPMI_CC_RESPONSE_ERROR;
goto finish;
}
@@ -476,7 +478,6 @@ ipmi_ret_t ipmi_app_get_bt_capabilities(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- printf("Handling Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
// Status code.
ipmi_ret_t rc = IPMI_CC_OK;
@@ -498,8 +499,6 @@ ipmi_ret_t ipmi_app_wildcard_handler(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- printf("Handling WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
-
// Status code.
ipmi_ret_t rc = IPMI_CC_INVALID;
@@ -579,9 +578,6 @@ ipmi_ret_t ipmi_app_get_sys_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_app_functions()
{
// <Get BT Interface Capabilities>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_CAP_BIT);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_CAP_BIT,
NULL,
@@ -589,9 +585,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Wildcard Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_WILDCARD);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_WILDCARD,
NULL,
@@ -599,9 +592,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Reset Watchdog Timer>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_RESET_WD);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_RESET_WD,
NULL,
@@ -609,9 +599,6 @@ void register_netfn_app_functions()
PRIVILEGE_OPERATOR);
// <Set Watchdog Timer>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_SET_WD);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_SET_WD,
NULL,
@@ -626,9 +613,6 @@ void register_netfn_app_functions()
PRIVILEGE_OPERATOR);
// <Get Device ID>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_DEVICE_ID);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_DEVICE_ID,
NULL,
@@ -636,9 +620,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Get Self Test Results>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_SELF_TEST_RESULTS);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_SELF_TEST_RESULTS,
NULL,
@@ -646,9 +627,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Get Device GUID>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_DEVICE_GUID);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_DEVICE_GUID,
NULL,
@@ -656,9 +634,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Set ACPI Power State>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_SET_ACPI);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_SET_ACPI,
NULL,
@@ -666,9 +641,6 @@ void register_netfn_app_functions()
PRIVILEGE_ADMIN);
// <Get Channel Access>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_CHANNEL_ACCESS);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_CHANNEL_ACCESS,
NULL,
@@ -676,9 +648,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Get Channel Info Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_CHAN_INFO);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_CHAN_INFO,
NULL,
@@ -686,9 +655,6 @@ void register_netfn_app_functions()
PRIVILEGE_USER);
// <Get System GUID Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_APP,
- IPMI_CMD_GET_SYS_GUID);
ipmi_register_callback(NETFUN_APP,
IPMI_CMD_GET_SYS_GUID,
NULL,
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 43c3fe3..d392d55 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -145,8 +145,9 @@ int dbus_get_property(const char *name, char **buf)
r = mapper_get_service(bus, settings_object_name, &connection);
if (r < 0) {
- fprintf(stderr, "Failed to get %s connection: %s\n",
- settings_object_name, strerror(-r));
+ log<level::ERR>("Failed to get connection",
+ entry("OBJ_NAME=%s", settings_object_name),
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -168,7 +169,8 @@ int dbus_get_property(const char *name, char **buf)
name); /* second argument */
if (r < 0) {
- fprintf(stderr, "Failed to issue method call: %s\n", error.message);
+ log<level::ERR>("Failed to issue Get method call",
+ entry("ERRNO=0x%X", r));
goto finish;
}
@@ -178,7 +180,8 @@ int dbus_get_property(const char *name, char **buf)
*/
r = sd_bus_message_read(m, "v", "s", &temp_buf);
if (r < 0) {
- fprintf(stderr, "Failed to parse response message: %s\n", strerror(-r));
+ log<level::ERR>("Failed to parse response message",
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -188,7 +191,7 @@ int dbus_get_property(const char *name, char **buf)
strcpy(*buf, temp_buf);
}
*/
- printf("IPMID boot option property get: {%s}.\n", (char *) temp_buf);
+
finish:
sd_bus_error_free(&error);
@@ -216,8 +219,9 @@ int dbus_set_property(const char * name, const char *value)
r = mapper_get_service(bus, settings_object_name, &connection);
if (r < 0) {
- fprintf(stderr, "Failed to get %s connection: %s\n",
- settings_object_name, strerror(-r));
+ log<level::ERR>("Failed to get connection",
+ entry("OBJ_NAME=%s", settings_object_name),
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -241,12 +245,11 @@ int dbus_set_property(const char * name, const char *value)
value); /* fourth argument */
if (r < 0) {
- fprintf(stderr, "Failed to issue method call: %s\n", error.message);
+ log<level::ERR>("Failed to issue Set method call",
+ entry("ERRNO=0x%X", r));
goto finish;
}
- printf("IPMID boot option property set: {%s}.\n", value);
-
finish:
sd_bus_error_free(&error);
sd_bus_message_unref(m);
@@ -584,7 +587,6 @@ ipmi_ret_t ipmi_chassis_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- printf("Handling CHASSIS WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
// Status code.
ipmi_ret_t rc = IPMI_CC_INVALID;
*data_len = 0;
@@ -661,8 +663,8 @@ int initiate_state_transition(State::Host::Transition transition)
if (rc < 0)
{
log<level::ERR>("Failed to get bus name",
- entry("ERROR=%s, OBJPATH=%s",
- strerror(-rc), HOST_STATE_MANAGER_ROOT));
+ entry("ERRNO=0x%X, OBJPATH=%s",
+ -rc, HOST_STATE_MANAGER_ROOT));
return rc;
}
@@ -683,8 +685,7 @@ int initiate_state_transition(State::Host::Transition transition)
if(rc < 0)
{
log<level::ERR>("Failed to initiate transition",
- entry("ERROR=%s, REQUEST=%s",
- bus_error.message, request.c_str()));
+ entry("ERRNO=0x%X, REQUEST=%s", -rc, request.c_str()));
}
else
{
@@ -766,29 +767,32 @@ ipmi_ret_t ipmi_get_chassis_status(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
r = mapper_get_service(bus, objname, &busname);
if (r < 0) {
- fprintf(stderr, "Failed to get bus name, return value: %s.\n", strerror(-r));
+ log<level::ERR>("Failed to get bus name",
+ entry("ERRNO=0x%X", -r));
rc = IPMI_CC_UNSPECIFIED_ERROR;
goto finish;
}
r = sd_bus_get_property(bus, busname, objname, intf, "pgood", NULL, &reply, "i");
if (r < 0) {
- fprintf(stderr, "Failed to call sd_bus_get_property:%d, %s\n", r, strerror(-r));
- fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n",
- busname, objname, intf);
+ log<level::ERR>("Failed to call sd_bus_get_property",
+ entry("PROPERTY=%s","pgood"),
+ entry("ERRNO=0x%X", -r),
+ entry("BUS=%s", busname),
+ entry("PATH=%s", objname),
+ entry("INTERFACE=%s", intf));
rc = IPMI_CC_UNSPECIFIED_ERROR;
goto finish;
}
r = sd_bus_message_read(reply, "i", &pgood);
if (r < 0) {
- fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r));
+ log<level::ERR>("Failed to read sensor:",
+ entry("ERRNO=0x%X", -r));
rc = IPMI_CC_UNSPECIFIED_ERROR;
goto finish;
}
- printf("pgood is 0x%02x\n", pgood);
-
s = dbusToIpmi.at(powerRestore);
// Current Power State
@@ -899,7 +903,7 @@ int stop_soft_off_timer()
//if (r < 0)
//{
// fprintf(stderr, "Failed to get %s bus name: %s\n",
- // SOFTOFF_OBJPATH, strerror(-r));
+ // SOFTOFF_OBJPATH, -r);
// return r;
//}
@@ -909,8 +913,8 @@ int stop_soft_off_timer()
soft_off_iface, property, "s", value);
if (rc < 0)
{
- fprintf(stderr, "Failed to set property in SoftPowerOff object: %s\n",
- strerror(-rc));
+ log<level::ERR>("Failed to set property in SoftPowerOff object",
+ entry("ERRNO=0x%X", -rc));
}
//TODO openbmc/openbmc#1661 - Mapper refactor
@@ -958,7 +962,6 @@ ipmi_ret_t ipmi_chassis_control(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// Catch the actual operaton by peeking into request buffer
uint8_t chassis_ctrl_cmd = *(uint8_t *)request;
- printf("Chassis Control Command: Operation:[0x%X]\n",chassis_ctrl_cmd);
switch(chassis_ctrl_cmd)
{
@@ -1022,7 +1025,8 @@ ipmi_ret_t ipmi_chassis_control(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
default:
{
- fprintf(stderr, "Invalid Chassis Control command:[0x%X] received\n",chassis_ctrl_cmd);
+ log<level::ERR>("Invalid Chassis Control command",
+ entry("CMD=0x%X", chassis_ctrl_cmd));
rc = -1;
}
}
@@ -1187,8 +1191,6 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
get_sys_boot_options_t *reqptr = (get_sys_boot_options_t*) request;
IpmiValue bootOption = ipmiDefault;
- printf("IPMI GET_SYS_BOOT_OPTIONS\n");
-
memset(resp,0,sizeof(*resp));
resp->version = SET_PARM_VERSION;
resp->parm = 5;
@@ -1289,7 +1291,8 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
if (ret < 0) {
- fprintf(stderr, "getHostNetworkData failed for get_sys_boot_options.\n");
+ log<level::ERR>(
+ "getHostNetworkData failed for get_sys_boot_options.");
rc = IPMI_CC_UNSPECIFIED_ERROR;
}else
@@ -1297,7 +1300,8 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
}
else {
- fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
+ log<level::ERR>("Unsupported parameter", entry(
+ "PARAM=0x%x", reqptr->parameter));
}
if (p)
@@ -1441,7 +1445,8 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
int ret = setHostNetworkData(reqptr);
if (ret < 0) {
- fprintf(stderr, "setHostNetworkData failed for set_sys_boot_options.\n");
+ log<level::ERR>(
+ "setHostNetworkData failed for set_sys_boot_options");
rc = IPMI_CC_UNSPECIFIED_ERROR;
}
} else if (reqptr->parameter ==
@@ -1453,7 +1458,8 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// flags.
rc = IPMI_CC_OK;
} else {
- fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
+ log<level::ERR>("Unsupported parameter", entry(
+ "PARAM=0x%x", reqptr->parameter));
rc = IPMI_CC_PARM_NOT_SUPPORTED;
}
@@ -1463,37 +1469,30 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_chassis_functions()
{
// <Wildcard Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_WILDCARD);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_WILDCARD, NULL, ipmi_chassis_wildcard,
PRIVILEGE_USER);
// Get Chassis Capabilities
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_GET_CHASSIS_CAP);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_GET_CHASSIS_CAP, NULL, ipmi_get_chassis_cap,
PRIVILEGE_USER);
// <Get System Boot Options>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS, NULL,
ipmi_chassis_get_sys_boot_options, PRIVILEGE_OPERATOR);
// <Get Chassis Status>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_CHASSIS_STATUS);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_CHASSIS_STATUS, NULL, ipmi_get_chassis_status,
PRIVILEGE_USER);
// <Chassis Control>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_CHASSIS_CONTROL);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_CHASSIS_CONTROL, NULL, ipmi_chassis_control,
PRIVILEGE_OPERATOR);
// <Chassis Identify>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_CHASSIS_IDENTIFY);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_CHASSIS_IDENTIFY, NULL,
ipmi_chassis_identify, PRIVILEGE_OPERATOR);
// <Set System Boot Options>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_CHASSIS, IPMI_CMD_SET_SYS_BOOT_OPTIONS);
ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_SET_SYS_BOOT_OPTIONS, NULL,
ipmi_chassis_set_sys_boot_options, PRIVILEGE_OPERATOR);
}
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 2f3eded..be3e27e 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -1506,50 +1506,36 @@ ipmi_ret_t getSensorInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_dcmi_functions()
{
// <Get Power Limit>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::GET_POWER_LIMIT);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_POWER_LIMIT,
NULL, getPowerLimit, PRIVILEGE_USER);
// <Set Power Limit>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::SET_POWER_LIMIT);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_POWER_LIMIT,
NULL, setPowerLimit, PRIVILEGE_OPERATOR);
// <Activate/Deactivate Power Limit>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::APPLY_POWER_LIMIT);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::APPLY_POWER_LIMIT,
NULL, applyPowerLimit, PRIVILEGE_OPERATOR);
// <Get Asset Tag>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::GET_ASSET_TAG);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_ASSET_TAG,
NULL, getAssetTag, PRIVILEGE_USER);
// <Set Asset Tag>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::SET_ASSET_TAG);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_ASSET_TAG,
NULL, setAssetTag, PRIVILEGE_OPERATOR);
// <Get Management Controller Identifier String>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::GET_MGMNT_CTRL_ID_STR);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_MGMNT_CTRL_ID_STR,
NULL, getMgmntCtrlIdStr, PRIVILEGE_USER);
// <Set Management Controller Identifier String>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_GRPEXT, dcmi::Commands::SET_MGMNT_CTRL_ID_STR);
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_MGMNT_CTRL_ID_STR,
NULL, setMgmntCtrlIdStr, PRIVILEGE_ADMIN);
diff --git a/groupext.cpp b/groupext.cpp
index 5695d07..1166a3e 100644
--- a/groupext.cpp
+++ b/groupext.cpp
@@ -25,7 +25,6 @@ ipmi_ret_t ipmi_groupext(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_groupext_functions()
{
// <Group Extension Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_GRPEXT, GRPEXT_GET_GROUP_CMD);
ipmi_register_callback(NETFUN_GRPEXT, GRPEXT_GET_GROUP_CMD, NULL, ipmi_groupext,
PRIVILEGE_USER);
diff --git a/host-cmd-manager.cpp b/host-cmd-manager.cpp
index 500e57d..799f9bf 100644
--- a/host-cmd-manager.cpp
+++ b/host-cmd-manager.cpp
@@ -46,7 +46,7 @@ IpmiCmdData Manager::getNextCommand()
{
// Just return a heartbeat in this case. A spurious SMS_ATN was
// asserted for the host (probably from a previous boot).
- log<level::INFO>("Control Host work queue is empty!");
+ log<level::DEBUG>("Control Host work queue is empty!");
return std::make_pair(CMD_HEARTBEAT, 0x00);
}
@@ -95,7 +95,7 @@ void Manager::checkQueueAndAlertHost()
{
if (this->workQueue.size() >= 1)
{
- log<level::INFO>("Asserting SMS Attention");
+ log<level::DEBUG>("Asserting SMS Attention");
std::string IPMI_PATH("/org/openbmc/HostIpmi/1");
std::string IPMI_INTERFACE("org.openbmc.HostIpmi");
@@ -124,14 +124,14 @@ void Manager::checkQueueAndAlertHost()
log<level::ERR>("Error in setting SMS attention");
elog<InternalFailure>();
}
- log<level::INFO>("SMS Attention asserted");
+ log<level::DEBUG>("SMS Attention asserted");
}
}
// Called by specific implementations that provide commands
void Manager::execute(CommandHandler command)
{
- log<level::INFO>("Pushing cmd on to queue",
+ log<level::DEBUG>("Pushing cmd on to queue",
entry("COMMAND=%d", std::get<0>(command).first));
this->workQueue.emplace(command);
diff --git a/host-interface.cpp b/host-interface.cpp
index 5cd5a35..19ca291 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -55,7 +55,7 @@ void Host::execute(Base::Host::Command command)
{
using namespace phosphor::logging;
- log<level::INFO>("Pushing cmd on to queue",
+ log<level::DEBUG>("Pushing cmd on to queue",
entry("CONTROL_HOST_CMD=%s",
convertForMessage(command)));
diff --git a/ipmid.cpp b/ipmid.cpp
index 91bbbee..c48df3b 100644
--- a/ipmid.cpp
+++ b/ipmid.cpp
@@ -158,7 +158,9 @@ void ipmi_register_callback(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_context_t c
auto iter = g_ipmid_router_map.find(netfn_and_cmd);
if(iter != g_ipmid_router_map.end())
{
- fprintf(stderr,"ERROR : Duplicate registration for NetFn [0x%X], Cmd:[0x%X]\n",netfn, cmd);
+ log<level::ERR>("Duplicate registration",
+ entry("NETFN=0x%X", netfn),
+ entry("CMD=0x%X", cmd));
}
else
{
@@ -183,8 +185,9 @@ ipmi_ret_t ipmi_netfn_router(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t
if (!std::binary_search(whitelist.cbegin(), whitelist.cend(),
std::make_pair(netfn, cmd)))
{
- printf("Net function:[0x%X], Command:[0x%X] is not whitelisted\n",
- netfn, cmd);
+ log<level::ERR>("Net function not whitelisted",
+ entry("NETFN=0x%X", netfn),
+ entry("CMD=0x%X", cmd));
rc = IPMI_CC_INSUFFICIENT_PRIVILEGE;
memcpy(response, &rc, IPMI_CC_LEN);
*data_len = IPMI_CC_LEN;
@@ -199,8 +202,10 @@ ipmi_ret_t ipmi_netfn_router(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t
{
/* By default should only print on failure to find wildcard command. */
#ifdef __IPMI_DEBUG__
- fprintf(stderr, "No registered handlers for NetFn:[0x%X], Cmd:[0x%X]"
- " trying Wilcard implementation \n",netfn, cmd);
+ log<level::ERR>(
+ "No registered handlers for NetFn, trying Wilcard implementation",
+ entry("NET_FUN=0x%X", netfn)
+ entry("CMD=0x%X", IPMI_CMD_WILDCARD));
#endif
// Now that we did not find any specific [NetFn,Cmd], tuple, check for
@@ -208,7 +213,9 @@ ipmi_ret_t ipmi_netfn_router(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t
iter = g_ipmid_router_map.find(std::make_pair(netfn, IPMI_CMD_WILDCARD));
if(iter == g_ipmid_router_map.end())
{
- fprintf(stderr, "No Registered handlers for NetFn:[0x%X],Cmd:[0x%X]\n",netfn, IPMI_CMD_WILDCARD);
+ log<level::ERR>("No Registered handlers for NetFn",
+ entry("NET_FUN=0x%X", netfn),
+ entry("CMD=0x%X", IPMI_CMD_WILDCARD));
// Respond with a 0xC1
memcpy(response, &rc, IPMI_CC_LEN);
@@ -219,7 +226,9 @@ ipmi_ret_t ipmi_netfn_router(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t
#ifdef __IPMI_DEBUG__
// We have either a perfect match -OR- a wild card atleast,
- printf("Calling Net function:[0x%X], Command:[0x%X]\n", netfn, cmd);
+ log<level::ERR>("Calling Net function",
+ entry("NET_FUN=0x%X", netfn)
+ entry("CMD=0x%X", cmd));
#endif
// Extract the map data onto appropriate containers
@@ -261,7 +270,8 @@ static int send_ipmi_message(sd_bus_message *req, unsigned char seq, unsigned ch
DBUS_INTF,
"sendMessage");
if (r < 0) {
- fprintf(stderr, "Failed to add the method object: %s\n", strerror(-r));
+ log<level::ERR>("Failed to add the method object",
+ entry("ERRNO=0x%X", -r));
return -1;
}
@@ -273,13 +283,15 @@ static int send_ipmi_message(sd_bus_message *req, unsigned char seq, unsigned ch
// Add the bytes needed for the methods to be called
r = sd_bus_message_append(m, "yyyyy", seq, netfn, lun, cmd, cc);
if (r < 0) {
- fprintf(stderr, "Failed add the netfn and others : %s\n", strerror(-r));
+ log<level::ERR>("Failed add the netfn and others",
+ entry("ERRNO=0x%X", -r));
goto final;
}
r = sd_bus_message_append_array(m, 'y', buf, len);
if (r < 0) {
- fprintf(stderr, "Failed to add the string of response bytes: %s\n", strerror(-r));
+ log<level::ERR>("Failed to add the string of response bytes",
+ entry("ERRNO=0x%X", -r));
goto final;
}
@@ -288,14 +300,17 @@ static int send_ipmi_message(sd_bus_message *req, unsigned char seq, unsigned ch
// Call the IPMI responder on the bus so the message can be sent to the CEC
r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
- fprintf(stderr, "Failed to call the method: %s\n", strerror(-r));
- fprintf(stderr, "Dest: %s, Path: %s\n", dest, path);
+ log<level::ERR>("Failed to call the method",
+ entry("DEST=%s", dest),
+ entry("PATH=%s", path),
+ entry("ERRNO=0x%X", -r));
goto final;
}
r = sd_bus_message_read(reply, "x", &pty);
if (r < 0) {
- fprintf(stderr, "Failed to get a rc from the method: %s\n", strerror(-r));
+ log<level::ERR>("Failed to get a reply from the method",
+ entry("ERRNO=0x%X", -r));
}
final:
@@ -360,13 +375,15 @@ static int handle_ipmi_command(sd_bus_message *m, void *user_data, sd_bus_error
r = sd_bus_message_read(m, "yyyy", &sequence, &netfn, &lun, &cmd);
if (r < 0) {
- fprintf(stderr, "Failed to parse signal message: %s\n", strerror(-r));
+ log<level::ERR>("Failed to parse signal message",
+ entry("ERRNO=0x%X", -r));
return -1;
}
r = sd_bus_message_read_array(m, 'y', &request, &sz );
if (r < 0) {
- fprintf(stderr, "Failed to parse signal message: %s\n", strerror(-r));
+ log<level::ERR>("Failed to parse signal message",
+ entry("ERRNO=0x%X", -r));
return -1;
}
@@ -382,7 +399,12 @@ static int handle_ipmi_command(sd_bus_message *m, void *user_data, sd_bus_error
r = ipmi_netfn_router(netfn, cmd, (void *)request, (void *)response, &resplen);
if(r != 0)
{
- fprintf(stderr,"ERROR:[0x%X] handling NetFn:[0x%X], Cmd:[0x%X]\n",r, netfn, cmd);
+#ifdef __IPMI_DEBUG__
+ log<level::ERR>("ERROR in handling NetFn",
+ entry("ERRNO=0x%X", -r),
+ entry("NET_FUN=0x%X", netfn),
+ entry("CMD=0x%X", cmd));
+#endif
resplen = 0;
}
else
@@ -397,7 +419,7 @@ static int handle_ipmi_command(sd_bus_message *m, void *user_data, sd_bus_error
r = send_ipmi_message(m, sequence, netfn, lun, cmd, response[0],
((unsigned char *)response) + 1, resplen);
if (r < 0) {
- fprintf(stderr, "Failed to send the response message\n");
+ log<level::ERR>("Failed to send the response message");
return -1;
}
@@ -451,7 +473,7 @@ void ipmi_register_callback_handlers(const char* ipmi_lib_path)
if(ipmi_lib_path == NULL)
{
- fprintf(stderr,"ERROR; No handlers to be registered for ipmi.. Aborting\n");
+ log<level::ERR>("No handlers to be registered for ipmi.. Aborting");
assert(0);
}
else
@@ -475,14 +497,18 @@ void ipmi_register_callback_handlers(const char* ipmi_lib_path)
{
handler_fqdn = ipmi_lib_path;
handler_fqdn += handler_list[num_handlers]->d_name;
- printf("Registering handler:[%s]\n",handler_fqdn.c_str());
+#ifdef __IPMI_DEBUG__
+ log<level::DEBUG>("Registering handler",
+ entry("HANDLER=%s", handler_fqdn.c_str()));
+#endif
lib_handler = dlopen(handler_fqdn.c_str(), RTLD_NOW);
if(lib_handler == NULL)
{
- fprintf(stderr,"ERROR opening [%s]: %s\n",
- handler_fqdn.c_str(), dlerror());
+ log<level::ERR>("ERROR opening",
+ entry("HANDLER=%s", handler_fqdn.c_str()),
+ entry("ERROR=%s", dlerror()));
}
// Wipe the memory allocated for this particular entry.
free(handler_list[num_handlers]);
@@ -557,8 +583,8 @@ int main(int argc, char *argv[])
/* Connect to system bus */
r = sd_bus_open_system(&bus);
if (r < 0) {
- fprintf(stderr, "Failed to connect to system bus: %s\n",
- strerror(-r));
+ log<level::ERR>("Failed to connect to system bus",
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -567,7 +593,7 @@ int main(int argc, char *argv[])
if (r < 0)
{
log<level::ERR>("Failure to create sd_event handler",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -583,7 +609,9 @@ int main(int argc, char *argv[])
// Watch for BT messages
r = sd_bus_add_match(bus, &ipmid_slot, FILTER, handle_ipmi_command, NULL);
if (r < 0) {
- fprintf(stderr, "Failed: sd_bus_add_match: %s : %s\n", strerror(-r), FILTER);
+ log<level::ERR>("Failed: sd_bus_add_match",
+ entry("FILTER=%s", FILTER),
+ entry("ERRNO=0x%X", -r));
goto finish;
}
@@ -613,7 +641,7 @@ int main(int argc, char *argv[])
if (r < 0)
{
log<level::ERR>("Failure in processing request",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
goto finish;
}
}
diff --git a/ipmisensor.cpp b/ipmisensor.cpp
index 3bca4e7..2e987d0 100644
--- a/ipmisensor.cpp
+++ b/ipmisensor.cpp
@@ -238,19 +238,18 @@ int findindex(const uint8_t sensor_type, int offset, int *index) {
return rc;
}
-void debug_print_ok_to_dont_care(uint8_t stype, int offset)
-{
- printf("LOOKATME: Sensor should not be reported: Type 0x%02x, Offset 0x%02x\n",
- stype, offset);
-}
-
bool shouldReport(uint8_t sensorType, int offset, int *index) {
bool rc = false;
if (findindex(sensorType, offset, index)) { rc = true; }
-
- if (rc==false) { debug_print_ok_to_dont_care(sensorType, offset); }
+ if (rc == false) {
+#ifdef __IPMI_DEBUG__
+ log<level::DEBUG>("LOOKATME: Sensor should not be reported",
+ entry("SENSORTYPE=0x%02x", sensorType),
+ entry("OFFSET=0x%02x", offset));
+#endif
+ }
return rc;
}
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 618aa54..1feef5b 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -408,7 +408,8 @@ ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
{
sensor_data_t *reqptr = (sensor_data_t*)request;
- printf("IPMI SET_SENSOR [0x%02x]\n",reqptr->sennum);
+ log<level::DEBUG>("IPMI SET_SENSOR",
+ entry("SENSOR_NUM=0x%02x", reqptr->sennum));
/*
* This would support the Set Sensor Reading command for the presence
@@ -1002,29 +1003,21 @@ ipmi_ret_t ipmi_sen_get_sdr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_sen_functions()
{
// <Wildcard Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_SENSOR, IPMI_CMD_WILDCARD);
ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD,
nullptr, ipmi_sen_wildcard,
PRIVILEGE_USER);
// <Get Sensor Type>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE);
ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE,
nullptr, ipmi_sen_get_sensor_type,
PRIVILEGE_USER);
// <Set Sensor Reading and Event Status>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_SENSOR, IPMI_CMD_SET_SENSOR);
ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR,
nullptr, ipmi_sen_set_sensor,
PRIVILEGE_OPERATOR);
// <Get Sensor Reading>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",
- NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING);
ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING,
nullptr, ipmi_sen_get_sensor_reading,
PRIVILEGE_USER);
diff --git a/softoff/mainapp.cpp b/softoff/mainapp.cpp
index c6c1858..3a47cc4 100644
--- a/softoff/mainapp.cpp
+++ b/softoff/mainapp.cpp
@@ -41,7 +41,7 @@ int main(int argc, char** argv)
if (r < 0)
{
log<level::ERR>("Failure to create sd_event handler",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
return -1;
}
@@ -65,7 +65,7 @@ int main(int argc, char** argv)
if (r < 0)
{
log<level::ERR>("Failure in processing request",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
return -1;
}
}
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 4a3166c..f76cd4f 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -81,7 +81,7 @@ void SoftPowerOff::hostControlEvent(sdbusplus::message::message& msg)
if (r < 0)
{
log<level::ERR>("Failure to start Host shutdown wait timer",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
}
else
{
@@ -120,7 +120,7 @@ auto SoftPowerOff::responseReceived(HostResponse response) -> HostResponse
if (r < 0)
{
log<level::ERR>("Failure to STOP the timer",
- entry("ERROR=%s", strerror(-r)));
+ entry("ERRNO=0x%X", -r));
}
// This marks the completion of soft power off sequence.
diff --git a/storageaddsel.cpp b/storageaddsel.cpp
index 2b41d56..c662502 100644
--- a/storageaddsel.cpp
+++ b/storageaddsel.cpp
@@ -94,20 +94,21 @@ size_t getfilestream(const char *fn, uint8_t **buffer) {
r = fseek(fp, 0, SEEK_END);
if (r) {
- fprintf(stderr,"Fseek failed\n");
+ log<level::ERR>("Fseek failed");
goto fclose_fp;
}
size = ftell(fp);
if (size == -1L) {
- fprintf(stderr,"Ftell failed for %s\n", strerror(errno));
+ log<level::ERR>("Ftell failed",
+ entry("ERROR=%s", strerror(errno)));
size = 0;
goto fclose_fp;
}
r = fseek(fp, 0, SEEK_SET);
if (r) {
- fprintf(stderr,"Fseek failed\n");
+ log<level::ERR>("Fseek failed");
size = 0;
goto fclose_fp;
}
@@ -117,7 +118,7 @@ size_t getfilestream(const char *fn, uint8_t **buffer) {
r = fread(*buffer, 1, size, fp);
if ( r != size) {
size = 0;
- fprintf(stderr,"Fread failed\n");
+ log<level::ERR>("Fread failed\n");
}
fclose_fp:
@@ -181,8 +182,7 @@ int create_esel_description(const uint8_t *buffer, Entry::Level level,
r = asprintf(message, "A %s has experienced an error of level %d",
m, static_cast<uint32_t>(level) );
if (r == -1) {
- fprintf(stderr,
- "Failed to allocate memory for ESEL description\n");
+ log<level::ERR>("Failed to allocate memory for ESEL description");
}
free(m);
@@ -229,7 +229,8 @@ void send_esel(uint16_t recordid) {
sz = getfilestream(path, &buffer);
if (sz == 0) {
- printf("Error file does not exist %d\n",__LINE__);
+ log<level::ERR>("Error file does not exist",
+ entry("FILENAME=%s", path));
return;
}
@@ -239,7 +240,7 @@ void send_esel(uint16_t recordid) {
r = send_esel_to_dbus(desc, sev, inventoryPath, buffer, sz);
if (r < 0) {
- fprintf(stderr, "Failed to send esel to dbus\n");
+ log<level::ERR>("Failed to send esel to dbus");
}
free(desc);
diff --git a/storagehandler.cpp b/storagehandler.cpp
index b222fa7..d1392e6 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -79,7 +79,6 @@ ipmi_ret_t ipmi_storage_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- printf("Handling STORAGE WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
// Status code.
ipmi_ret_t rc = IPMI_CC_INVALID;
*data_len = 0;
@@ -435,8 +434,6 @@ ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
uint64_t host_time_usec = 0;
uint32_t resp = 0;
- printf("IPMI Handling GET-SEL-TIME\n");
-
try
{
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
@@ -472,8 +469,8 @@ ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return IPMI_CC_UNSPECIFIED_ERROR;
}
- printf("Host time: %" PRIu64 ", %s",
- host_time_usec, getTimeString(host_time_usec));
+ log<level::DEBUG>("Host time:",
+ entry("HOST_TIME=%s", getTimeString(host_time_usec)));
// Time is really long int but IPMI wants just uint32. This works okay until
// the number of seconds since 1970 overflows uint32 size.. Still a whole
@@ -499,15 +496,9 @@ ipmi_ret_t ipmi_storage_set_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
uint32_t secs = *static_cast<uint32_t*>(request);
*data_len = 0;
- printf("Handling Set-SEL-Time:[0x%X], Cmd:[0x%X], Data:[0x%X]\n",
- netfn, cmd, secs);
-
secs = le32toh(secs);
microseconds usec{seconds(secs)};
- printf("To Set host time: %" PRIu64 ", %s",
- usec.count(), getTimeString(usec.count()));
-
try
{
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
@@ -554,8 +545,6 @@ ipmi_ret_t ipmi_storage_reserve_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
if( ++g_sel_reserve == 0)
g_sel_reserve = 1;
- printf("IPMI Handling RESERVE-SEL 0x%04x\n", g_sel_reserve);
-
*data_len = sizeof(g_sel_reserve);
// Pack the actual response
@@ -575,8 +564,6 @@ ipmi_ret_t ipmi_storage_add_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
recordid = ((uint16_t)p->eventdata[1] << 8) | p->eventdata[2];
- printf("IPMI Handling ADD-SEL for record 0x%04x\n", recordid);
-
*data_len = sizeof(g_sel_reserve);
// Pack the actual response
@@ -703,57 +690,44 @@ ipmi_ret_t ipmi_get_repository_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_storage_functions()
{
// <Wildcard Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_WILDCARD);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_WILDCARD, NULL, ipmi_storage_wildcard,
PRIVILEGE_USER);
// <Get SEL Info>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_INFO);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_INFO, NULL, getSELInfo,
PRIVILEGE_USER);
// <Get SEL Time>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_TIME);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_TIME, NULL, ipmi_storage_get_sel_time,
PRIVILEGE_USER);
// <Set SEL Time>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_SET_SEL_TIME);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_SET_SEL_TIME, NULL, ipmi_storage_set_sel_time,
PRIVILEGE_OPERATOR);
// <Reserve SEL>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_RESERVE_SEL);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SEL, NULL, ipmi_storage_reserve_sel,
PRIVILEGE_USER);
// <Get SEL Entry>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL, getSELEntry,
PRIVILEGE_USER);
// <Delete SEL Entry>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_DELETE_SEL);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_DELETE_SEL, NULL, deleteSELEntry,
PRIVILEGE_OPERATOR);
// <Add SEL Entry>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_ADD_SEL);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_ADD_SEL, NULL, ipmi_storage_add_sel,
PRIVILEGE_OPERATOR);
// <Clear SEL>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_CLEAR_SEL);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_CLEAR_SEL, NULL, clearSEL,
PRIVILEGE_OPERATOR);
// <Get FRU Inventory Area Info>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_STORAGE,
- IPMI_CMD_GET_FRU_INV_AREA_INFO);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_FRU_INV_AREA_INFO, NULL,
ipmi_storage_get_fru_inv_area_info, PRIVILEGE_OPERATOR);
// <Add READ FRU Data
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_STORAGE,
- IPMI_CMD_READ_FRU_DATA);
ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_READ_FRU_DATA, NULL,
ipmi_storage_read_fru_data, PRIVILEGE_OPERATOR);
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index b98ac12..d363233 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -25,8 +25,6 @@ ipmi_ret_t ipmi_app_read_event(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
{
ipmi_ret_t rc = IPMI_CC_OK;
- printf("IPMI APP READ EVENT command received\n");
-
struct oem_sel_timestamped oem_sel = {0};
*data_len = sizeof(struct oem_sel_timestamped);
@@ -68,8 +66,6 @@ ipmi_ret_t ipmi_app_get_msg_flags(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// Generic return from IPMI commands.
ipmi_ret_t rc = IPMI_CC_OK;
- printf("IPMI APP GET MSG FLAGS returning with [bit:2] set\n");
-
// From IPMI spec V2.0 for Get Message Flags Command :
// bit:[1] from LSB : 1b = Event Message Buffer Full.
// Return as 0 if Event Message Buffer is not supported,
@@ -93,7 +89,9 @@ ipmi_ret_t ipmi_app_set_bmc_global_enables(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
*data_len = 0;
// Event and message logging enabled by default so return for now
+#ifdef __IPMI_DEBUG__
printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n");
+#endif
return rc;
}
@@ -111,18 +109,14 @@ void register_netfn_app_functions()
{
// <Read Event Message Buffer>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_READ_EVENT);
ipmi_register_callback(NETFUN_APP, IPMI_CMD_READ_EVENT, NULL, ipmi_app_read_event,
SYSTEM_INTERFACE);
// <Set BMC Global Enables>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP,
- IPMI_CMD_SET_BMC_GLOBAL_ENABLES);
ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_BMC_GLOBAL_ENABLES, NULL,
ipmi_app_set_bmc_global_enables, SYSTEM_INTERFACE);
// <Get Message Flags>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_MSG_FLAGS);
ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_MSG_FLAGS, NULL, ipmi_app_get_msg_flags,
SYSTEM_INTERFACE);
diff --git a/testaddsel.cpp b/testaddsel.cpp
index 90f63a2..55cf07d 100644
--- a/testaddsel.cpp
+++ b/testaddsel.cpp
@@ -27,32 +27,37 @@ int find_openbmc_path(const uint8_t num, dbus_interface_t *interface) {
r = mapper_get_service(bus, objname, &busname);
if (r < 0) {
- fprintf(stderr, "Failed to get %s busname: %s\n",
- objname, strerror(-r));
+ log<level::ERR>("Failed to get busname",
+ entry("BUS=%s", objname),
+ entry("ERRNO=0x%X", -r));
goto final;
}
r = sd_bus_message_new_method_call(bus,&m,busname,objname,busname,"getObjectFromByteId");
if (r < 0) {
- fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
+ log<level::ERR>("Failed to create a method call",
+ entry("ERRNO=0x%X", -r));
}
r = sd_bus_message_append(m, "sy", type, num);
if (r < 0) {
- fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
+ log<level::ERR>("Failed to create a input parameter",
+ entry("ERRNO=0x%X", -r));
}
// Call the IPMI responder on the bus so the message can be sent to the CEC
r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
- fprintf(stderr, "Failed to call the method: %s", strerror(-r));
+ log<level::ERR>("Failed to call the method",
+ entry("ERRNO=0x%X", -r));
goto final;
}
r = sd_bus_message_read(reply, "(sss)", &str1, &str2, &str3);
if (r < 0) {
- fprintf(stderr, "Failed to get a response: %s", strerror(-r));
+ log<level::ERR>("Failed to get a response",
+ entry("ERRNO=0x%X", -r));
goto final;
}
@@ -99,8 +104,8 @@ int main(int argc, char *argv[])
/* Connect to system bus */
r = sd_bus_open_system(&bus);
if (r < 0) {
- fprintf(stderr, "Failed to connect to system bus: %s\n",
- strerror(-r));
+ log<level::ERR>("Failed to connect to system bus",
+ entry("ERRNO=0x%X", -r));
goto finish;
}
diff --git a/testit.cpp b/testit.cpp
index 072b5d7..37bb146 100644
--- a/testit.cpp
+++ b/testit.cpp
@@ -15,7 +15,7 @@ unsigned char g_sensortype [][2] = {
uint8_t find_type_for_sensor_number(uint8_t sensor_number) {
int i=0;
- uint8_t rc;
+ uint8_t rc;
while (g_sensortype[i][0] != 0xff) {
if (g_sensortype[i][1] == sensor_number) {
@@ -38,9 +38,6 @@ char g_results_value[64];
int set_sensor_dbus_state_s(unsigned char number, const char *member, const char *value) {
- printf("Attempting to log 0x%02x via %s with a value of %s\n",
- number, member, value);
-
strcpy(g_results_method, member);
strcpy(g_results_value, value);
@@ -48,12 +45,8 @@ int set_sensor_dbus_state_s(unsigned char number, const char *member, const char
}
int set_sensor_dbus_state_y(unsigned char number, char const* member, uint8_t value) {
-
- char val[2];
-
- printf("Attempting to log Variant Sensor 0x%02x via %s with a value of 0x%02x\n",
- number, member, value);
+ char val[2];
snprintf(val, 2, "%d", value);
@@ -81,7 +74,7 @@ uint8_t testrec_procfailed[] = {0x02, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
// Virtual Sensor 5, setting a Value of 0h
uint8_t testrec_bootprogress[] = {0x05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00};
-// Virtual Sensor setting a boot count
+// Virtual Sensor setting a boot count
uint8_t testrec_bootcount[] = {0x01, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
// Invalid sensor number
@@ -89,12 +82,16 @@ uint8_t testrec_invalidnumber[]= {0x35, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
int check_results(int rc, const char *method, const char *value) {
- if (strcmp(g_results_method, method)) {
- printf("ERROR: Method Failed, expect %s found %s\n", method, g_results_method);
+ if (strcmp(g_results_method, method)) {
+ log<level::ERR>("Method Failed",
+ entry("EXPECT=%s", method),
+ entry("GOT=%s", g_results_method));
return -1;
}
if (strcmp(g_results_value, value)) {
- printf("ERROR: Value failed, expected %s found %s\n", value, g_results_value);
+ log<level::ERR>("Value failed",
+ entry("EXPECT=%s", value),
+ entry("GOT=%s", g_results_method));
return -2;
}
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 787a8fc..96a462d 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -361,7 +361,6 @@ ipmi_ret_t ipmi_transport_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- printf("Handling TRANSPORT WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
// Status code.
ipmi_ret_t rc = IPMI_CC_INVALID;
*data_len = 0;
@@ -965,17 +964,14 @@ void register_netfn_transport_functions()
// so creating it here.
createNetworkTimer();
// <Wildcard Command>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_WILDCARD);
ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_WILDCARD, NULL, ipmi_transport_wildcard,
PRIVILEGE_USER);
// <Set LAN Configuration Parameters>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_SET_LAN);
ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_SET_LAN, NULL, ipmi_transport_set_lan,
PRIVILEGE_ADMIN);
// <Get LAN Configuration Parameters>
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_TRANSPORT, IPMI_CMD_GET_LAN);
ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_GET_LAN, NULL, ipmi_transport_get_lan,
PRIVILEGE_OPERATOR);
OpenPOWER on IntegriCloud