summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2015-03-27 08:08:19 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-04-09 21:46:23 -0500
commit57418ff030858142537c455488fcd6267ad13957 (patch)
treeeb79f8a61c93e96f3584a51df77d8e5f20d14648
parentd65b978c7f64f5fcb2fd957840920b513642a7bc (diff)
downloadtalos-hostboot-57418ff030858142537c455488fcd6267ad13957.tar.gz
talos-hostboot-57418ff030858142537c455488fcd6267ad13957.zip
Chassis power cycle does not have correct action
-Fix power control sequence to issue a power cycle reqest when a chassis power cycle modifyer is sent in BMC request. Change-Id: Ib3fb9da6e916d6faa7c4cfd50184d4133af62c34 CQ:SW297663 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16776 Tested-by: Jenkins Server Reviewed-by: Brian Silver <bsilver@us.ibm.com> Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/ipmi/ipmiif.H7
-rw-r--r--src/usr/ipmi/ipmirp.C34
-rw-r--r--src/usr/ipmi/ipmirp.H5
3 files changed, 38 insertions, 8 deletions
diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H
index e65252a58..689d249b5 100644
--- a/src/include/usr/ipmi/ipmiif.H
+++ b/src/include/usr/ipmi/ipmiif.H
@@ -56,6 +56,13 @@ namespace IPMI
MSG_LAST_TYPE = MSG_STATE_GRACEFUL_SHUTDOWN,
};
+ // chassis power off request types
+ enum power_request_type
+ {
+ CHASSIS_POWER_OFF = 0x00,
+ CHASSIS_POWER_CYCLE = 0x02,
+ };
+
// Used in the factory for creating the proper subclass.
enum message_type
{
diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C
index de1b219cd..f02ab4306 100644
--- a/src/usr/ipmi/ipmirp.C
+++ b/src/usr/ipmi/ipmirp.C
@@ -77,7 +77,8 @@ IpmiRP::IpmiRP(void):
iv_retries(IPMI::g_retries),
iv_shutdown_msg(NULL),
iv_shutdown_now(false),
- iv_graceful_shutdown_pending(false)
+ iv_graceful_shutdown_pending(false),
+ iv_chassis_power_mod(IPMI::CHASSIS_POWER_OFF)
{
mutex_init(&iv_mutex);
sync_cond_init(&iv_cv);
@@ -447,13 +448,32 @@ void IpmiRP::lastChanceEventHandler(void)
}
else if ( event->iv_cmd[0] == IPMI::power_off().second )
{
- // handle the graceful shutdown message
- IPMI_TRAC("Graceful shutdown request received");
+ // if the event type is "soft off" then update the modifier to send
+ // a power off to the BMC, otherwise all other requests will be
+ // handled as a power cycle
+ if( event->iv_cmd[1] == IPMI::CHASSIS_POWER_OFF )
+ {
+ iv_chassis_power_mod = IPMI::CHASSIS_POWER_OFF;
+
+ // handle the graceful shutdown message
+ IPMI_TRAC("Graceful shutdown request received");
#ifdef CONFIG_CONSOLE
- CONSOLE::displayf(NULL, "IPMI: shutdown requested");
- CONSOLE::flush();
+ CONSOLE::displayf(NULL, "IPMI: shutdown requested");
+ CONSOLE::flush();
+#endif
+
+ }
+ else
+ {
+ // handle the message as a power cycle request
+ IPMI_TRAC("IPMI power cycle request received");
+ iv_chassis_power_mod = IPMI::CHASSIS_POWER_CYCLE;
+#ifdef CONFIG_CONSOLE
+ CONSOLE::displayf(NULL, "IPMI: power cycle requested");
+ CONSOLE::flush();
#endif
+ }
// register for the post memory flush callback
INITSERVICE::registerShutdownEvent(iv_msgQ,
@@ -607,8 +627,8 @@ void IpmiRP::execute(void)
size_t len = 1;
uint8_t* data = new uint8_t[len];
- // send the force shutdown option.
- data[0] = 0;
+ // send the correct chassis power modifier.
+ data[0] = iv_chassis_power_mod;
IPMI::Message* ipmi_msg = IPMI::Message::factory(
IPMI::chassis_power_off(), len, data, IPMI::TYPE_ASYNC);
diff --git a/src/usr/ipmi/ipmirp.H b/src/usr/ipmi/ipmirp.H
index 3cfeedb6b..6db0c9b1f 100644
--- a/src/usr/ipmi/ipmirp.H
+++ b/src/usr/ipmi/ipmirp.H
@@ -250,9 +250,12 @@ class IpmiRP
msg_t * iv_shutdown_msg; //!< shutdown msg to respond to
bool iv_shutdown_now; //!< shutdown now
- //!< handle ipmi soft power off request
+ //!< handle ipmi chassis power off request
bool iv_graceful_shutdown_pending;
+ //!< handle ipmi chassis power off request modifier
+ IPMI::power_request_type iv_chassis_power_mod;
+
// Disallow copying this class.
IpmiRP& operator=(const IpmiRP&);
IpmiRP(const IpmiRP&);
OpenPOWER on IntegriCloud