diff options
-rwxr-xr-x | apphandler.C | 36 | ||||
-rw-r--r-- | apphandler.h | 15 |
2 files changed, 42 insertions, 9 deletions
diff --git a/apphandler.C b/apphandler.C index 9d53552..40cd79d 100755 --- a/apphandler.C +++ b/apphandler.C @@ -134,8 +134,8 @@ ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return -1; } - // Start watchdog - r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"start"); + // Stop the current watchdog if any + r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"stop"); if (r < 0) { fprintf(stderr, "Failed to add the start method object: %s\n", strerror(-r)); return -1; @@ -146,6 +146,21 @@ ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return -1; } + // Start the watchdog if requested + if (reqptr->t_use & 0x40) + { + r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"start"); + if (r < 0) { + fprintf(stderr, "Failed to add the start method object: %s\n", strerror(-r)); + return -1; + } + r = sd_bus_call(bus, m, 0, &error, &reply); + if (r < 0) { + fprintf(stderr, "Failed to call the start method: %s\n", strerror(-r)); + return -1; + } + } + sd_bus_error_free(&error); sd_bus_message_unref(m); @@ -188,7 +203,18 @@ ipmi_ret_t ipmi_app_reset_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return rc; } +ipmi_ret_t ipmi_app_set_bmc_global_enables(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) +{ + ipmi_ret_t rc = IPMI_CC_OK; + *data_len = 0; + + // Event and message logging enabled by default so return for now + printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n"); + return rc; +} @@ -231,6 +257,12 @@ void register_netfn_app_functions() 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); + + 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); + return; } diff --git a/apphandler.h b/apphandler.h index 2c4ea22..2957437 100644 --- a/apphandler.h +++ b/apphandler.h @@ -1,16 +1,17 @@ #ifndef __HOST_IPMI_APP_HANDLER_H__ #define __HOST_IPMI_APP_HANDLER_H__ -// IPMI commands for net functions. +// IPMI commands for App net functions. enum ipmi_netfn_app_cmds { // Get capability bits - IPMI_CMD_RESET_WD = 0x22, - IPMI_CMD_SET_WD = 0x24, - IPMI_CMD_GET_CAP_BIT = 0x36, - IPMI_CMD_GET_DEVICE_ID = 0x00, - IPMI_CMD_SET_ACPI = 0x06, - IPMI_CMD_READ_EVENT = 0x35, + IPMI_CMD_GET_DEVICE_ID = 0x01, + IPMI_CMD_SET_ACPI = 0x06, + IPMI_CMD_RESET_WD = 0x22, + IPMI_CMD_SET_WD = 0x24, + IPMI_CMD_SET_BMC_GLOBAL_ENABLES = 0x2E, + IPMI_CMD_READ_EVENT = 0x35, + IPMI_CMD_GET_CAP_BIT = 0x36, }; |