diff options
author | Joel Stanley <joel@jms.id.au> | 2015-09-15 12:40:07 +0930 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-09-30 21:16:07 +1000 |
commit | e8b107957ba0becac99ee0e233e446d0a29daaad (patch) | |
tree | 66b14b20001e2488be74f2a6f95379302d4ea2f4 | |
parent | 308f4889524576ca779add4756d83bb95b351af9 (diff) | |
download | skiboot-e8b107957ba0becac99ee0e233e446d0a29daaad.zip skiboot-e8b107957ba0becac99ee0e233e446d0a29daaad.tar.gz skiboot-e8b107957ba0becac99ee0e233e446d0a29daaad.tar.bz2 |
ipmi-sel: Run power action immediately if host not up
Our normal sequence for a soft power action (IPMI 'power soft' or
'power cycle') involve receiving a SEL from the BMC, sending a message
to Linux's opal platform support which instructs the host OS to shut
down, and finally the host will request OPAL to cut power.
When the host is not yet up we will send the message to /dev/null, and
no action will be taken. This patches changes that behaviour to perform
the action immediately if we know how.
Signed-off-by: Joel Stanley <joel@jms.id.au>
[stewart@linux.vnet.ibm.com: modify checking of OPAL_BOOT_COMPLETE flag, typo]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/ipmi/ipmi-sel.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c index 4626d9d..a179513 100644 --- a/hw/ipmi/ipmi-sel.c +++ b/hw/ipmi/ipmi-sel.c @@ -457,12 +457,24 @@ static void sel_power(uint8_t power) { switch (power) { case SOFT_OFF: - prlog(PR_NOTICE, "soft shutdown requested\n"); - opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF); + prlog(PR_NOTICE, "Soft shutdown requested\n"); + if (!(debug_descriptor.state_flags & OPAL_BOOT_COMPLETE) && + platform.cec_power_down) { + prlog(PR_NOTICE, "Host not up, shutting down now\n"); + platform.cec_power_down(IPMI_CHASSIS_PWR_DOWN); + } else { + opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF); + } break; case SOFT_REBOOT: - prlog(PR_NOTICE, "soft reboot rqeuested\n"); - opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_REBOOT); + prlog(PR_NOTICE, "Soft reboot requested\n"); + if (!(debug_descriptor.state_flags & OPAL_BOOT_COMPLETE) && + platform.cec_reboot) { + prlog(PR_NOTICE, "Host not up, rebooting now\n"); + platform.cec_reboot(); + } else { + opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_REBOOT); + } break; default: prlog(PR_WARNING, "requested bad power state: %02x\n", |