diff options
Diffstat (limited to 'src/usr/ipmi')
-rw-r--r-- | src/usr/ipmi/ipmichassiscontrol.C | 5 | ||||
-rw-r--r-- | src/usr/ipmi/ipmirp.C | 47 |
2 files changed, 50 insertions, 2 deletions
diff --git a/src/usr/ipmi/ipmichassiscontrol.C b/src/usr/ipmi/ipmichassiscontrol.C index 1d17c366e..ff4161e25 100644 --- a/src/usr/ipmi/ipmichassiscontrol.C +++ b/src/usr/ipmi/ipmichassiscontrol.C @@ -36,6 +36,7 @@ #include <errl/errlentry.H> #include <ipmi/ipmichassiscontrol.H> #include <ipmi/ipmiif.H> +#include <initservice/istepdispatcherif.H> /******************************************************************************/ // Globals/Constants @@ -75,6 +76,10 @@ errlHndl_t chassisControl(const uint8_t i_chassisControlState ) IPMI_TRAC("Chassis control : BMC returned not ok CC[%x]",cc); } + // power off command has been sent to the BMC, tell the istep dispacher to + // stop executing steps. + INITSERVICE::stopIpl(); + return err_ipmi; } } // namespace diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C index c7e702e0f..4c5db3f19 100644 --- a/src/usr/ipmi/ipmirp.C +++ b/src/usr/ipmi/ipmirp.C @@ -40,6 +40,7 @@ #include <sys/task.h> #include <initservice/taskargs.H> #include <initservice/initserviceif.H> +#include <initservice/istepdispatcherif.H> #include <sys/vfs.h> #include <targeting/common/commontargeting.H> @@ -459,6 +460,9 @@ void IpmiRP::handlePowerMessage( IPMI::oemSEL* i_event ) break; } + // tell the istep dispacher to stop executing isteps + INITSERVICE::stopIpl(); + // register for the post memory flush callback INITSERVICE::registerShutdownEvent(iv_msgQ, IPMI::MSG_STATE_GRACEFUL_SHUTDOWN, @@ -470,6 +474,7 @@ void IpmiRP::handlePowerMessage( IPMI::oemSEL* i_event ) // initiate the shutdown processing in the background INITSERVICE::doShutdown(SHUTDOWN_STATUS_GOOD,true); + } while (0); } @@ -563,6 +568,7 @@ void IpmiRP::execute(void) while (true) { + msg_t* msg = msg_wait(iv_msgQ); const IPMI::msg_type msg_type = @@ -682,15 +688,41 @@ void IpmiRP::execute(void) iv_shutdown_msg = msg; // Reply to this message - #ifdef CONFIG_CONSOLE - CONSOLE::displayf(NULL, "IPMI: shutdown complete"); + CONSOLE::displayf(NULL, "IPMI: shutdown complete\n"); CONSOLE::flush(); #endif } break; + // begin a graceful reboot initated by us + case IPMI::MSG_STATE_INITATE_POWER_CYCLE: + { + msg_free(msg); + +#ifdef CONFIG_CONSOLE + CONSOLE::displayf(NULL, "IPMI: Initiate power cycle"); + CONSOLE::flush(); +#endif + // setup the power cmd modifier to tell the bmc to + // do a power reset + iv_chassis_power_mod = IPMI::CHASSIS_POWER_RESET; + + // register for the post memory flush callback + INITSERVICE::registerShutdownEvent(iv_msgQ, + IPMI::MSG_STATE_GRACEFUL_SHUTDOWN, + INITSERVICE::POST_MEM_FLUSH_NOTIFY_LAST); + + iv_graceful_shutdown_pending = true; + lwsync(); + + // initiate the shutdown processing in the background + INITSERVICE::doShutdown(SHUTDOWN_STATUS_GOOD,true); + + } + break; + }; // There's a good chance the interface will be idle right after @@ -1047,6 +1079,17 @@ namespace IPMI } /// + /// @brief kick off a reboot + /// + void initiateReboot() + { + static msg_q_t mq = Singleton<IpmiRP>::instance().msgQueue(); + msg_t * msg = msg_allocate(); + msg->type = IPMI::MSG_STATE_INITATE_POWER_CYCLE; + msg_send(mq, msg); + } + + /// /// @brief Maximum buffer for data (max xport - header) /// size_t max_buffer(void) |