summaryrefslogtreecommitdiffstats
path: root/globalhandler.cpp
diff options
context:
space:
mode:
authorNan Li <william.bjlinan@hotmail.com>2016-08-22 15:00:21 +0800
committerPatrick Williams <patrick@stwcx.xyz>2016-10-06 02:56:03 +0000
commitbc759884ccc7bdb838a8cce3fe6d8d9c648dadc7 (patch)
treee95a4006116e59f3f13620532869f58d759966a3 /globalhandler.cpp
parent8d15fb490ea7db36ffacfe3dfaa5d8feb2a4ff0c (diff)
downloadphosphor-host-ipmid-bc759884ccc7bdb838a8cce3fe6d8d9c648dadc7.tar.gz
phosphor-host-ipmid-bc759884ccc7bdb838a8cce3fe6d8d9c648dadc7.zip
Add IPMI coldReset command support
* Implement by calling dbus method for coldReset * Optimize warmReset/coldReset code * Be implemented with related changes in skeleton repository Resolves openbmc/openbmc#437 Change-Id: Ia33805c73b5d345419918c467ef7b9cf6fbb246d Signed-off-by: Nan Li <william.bjlinan@hotmail.com>
Diffstat (limited to 'globalhandler.cpp')
-rw-r--r--globalhandler.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/globalhandler.cpp b/globalhandler.cpp
index caa94bb..2c3c994 100644
--- a/globalhandler.cpp
+++ b/globalhandler.cpp
@@ -76,7 +76,8 @@ finish:
return r;
}
-int dbus_warm_reset()
+
+int dbus_reset(const char *method)
{
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
@@ -100,12 +101,12 @@ int dbus_warm_reset()
* the method.
* Signatures and input arguments are provided by the arguments at the
* end.
- */
+ */
r = sd_bus_call_method(bus,
connection, /* service to contact */
control_object_name, /* object path */
control_intf_name, /* interface name */
- "warmReset", /* method name */
+ method, /* method name */
&error, /* object to return error in */
&m, /* return message on success */
NULL,
@@ -132,7 +133,7 @@ ipmi_ret_t ipmi_global_warm_reset(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
printf("Handling GLOBAL warmReset Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
// TODO: call the correct dbus method for warmReset.
- dbus_warm_reset();
+ dbus_reset("warmReset");
// Status code.
ipmi_ret_t rc = IPMI_CC_OK;
@@ -140,9 +141,26 @@ ipmi_ret_t ipmi_global_warm_reset(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return rc;
}
+ipmi_ret_t ipmi_global_cold_reset(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 GLOBAL coldReset Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
+
+ // TODO: call the correct dbus method for coldReset.
+ dbus_reset("coldReset");
+
+ // Status code.
+ ipmi_ret_t rc = IPMI_CC_OK;
+ *data_len = 0;
+ return rc;
+}
void register_netfn_global_functions()
{
+ printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_COLD_RESET);
+ ipmi_register_callback(NETFUN_APP, IPMI_CMD_COLD_RESET, NULL, ipmi_global_cold_reset);
+
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_WARM_RESET);
ipmi_register_callback(NETFUN_APP, IPMI_CMD_WARM_RESET, NULL, ipmi_global_warm_reset);
OpenPOWER on IntegriCloud