[Skiboot] [PATCH 2/2] ipmi-sel: Run power action immediately if host not up

Joel Stanley joel at jms.id.au
Tue Sep 15 13:10:07 AEST 2015


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 at jms.id.au>
---
 hw/ipmi/ipmi-sel.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index 4626d9d..c446dfc 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.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 rqeuested\n");
+		if (!debug_descriptor.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",
-- 
2.5.0



More information about the Skiboot mailing list