diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2017-07-21 11:15:42 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2017-07-28 10:43:42 -0400 |
commit | f54d606af645343351d086b1de237f021f38cb21 (patch) | |
tree | 5f0a86acb216888dc0f15e71c6032c0d795b444e /src/usr/ipmi | |
parent | 481baf1c81c945ce3d354097a6452cb8ecba38d6 (diff) | |
download | talos-hostboot-f54d606af645343351d086b1de237f021f38cb21.tar.gz talos-hostboot-f54d606af645343351d086b1de237f021f38cb21.zip |
Secure Boot: Shutdown after key transition
- Fence off istep path after istep dispatcher stops
- Automatically power off after a key transition has completed
- Added IPMI API to power off system
Change-Id: I74eaec08e86d0cbc46db6aa1674845c53bcf14d4
RTC: 174017
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43436
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com>
Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
-rw-r--r-- | src/usr/ipmi/ipmirp.C | 34 | ||||
-rw-r--r-- | src/usr/ipmi/ipmirp.H | 16 |
2 files changed, 38 insertions, 12 deletions
diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C index 4c5db3f19..6b1138783 100644 --- a/src/usr/ipmi/ipmirp.C +++ b/src/usr/ipmi/ipmirp.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -696,8 +696,8 @@ void IpmiRP::execute(void) } break; - // begin a graceful reboot initated by us - case IPMI::MSG_STATE_INITATE_POWER_CYCLE: + // begin a graceful reboot initiated by us + case IPMI::MSG_STATE_INITIATE_POWER_CYCLE: { msg_free(msg); @@ -1078,15 +1078,27 @@ namespace IPMI return err; } - /// - /// @brief kick off a reboot - /// + void initiateShutdownOrReboot(const IPMI::msg_type i_msgType) + { + const auto valid = IPMI::validShutdownRebootMsgType(i_msgType); + assert(valid,"BUG! IPMI message type of 0x%08X is not a valid shutdown " + "or reboot type",i_msgType); + static auto mq = Singleton<IpmiRP>::instance().msgQueue(); + auto pMsg = msg_allocate(); + assert(pMsg != nullptr,"BUG! msg_allocate returned nullptr."); + pMsg->type = i_msgType; + auto rc = msg_send(mq,pMsg); + assert(!rc,"BUG! msg_send failed with rc of %d",rc); + } + 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); + (void)initiateShutdownOrReboot(MSG_STATE_INITIATE_POWER_CYCLE); + } + + void initiatePowerOff() + { + (void)initiateShutdownOrReboot(MSG_STATE_GRACEFUL_SHUTDOWN); } /// @@ -1163,4 +1175,4 @@ namespace IPMI return l_info; } -}; +}; // End namespace IPMI diff --git a/src/usr/ipmi/ipmirp.H b/src/usr/ipmi/ipmirp.H index 9e8832555..0bbbaafb2 100644 --- a/src/usr/ipmi/ipmirp.H +++ b/src/usr/ipmi/ipmirp.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -267,4 +267,18 @@ class IpmiRP IpmiRP(const IpmiRP&); }; +namespace IPMI +{ + /** + * @brief Initiate generic IPMI shutdown/reboot request via the IPMI + * resource provider + * + * @param[in] i_msgType IPMI message type indicating the shutdown or reboot + * to request. Asserts if not a valid shutdown or reboot message type as + * determined by IPMI::validShutdownRebootMsgType(). + */ + void initiateShutdownOrReboot(IPMI::msg_type i_msgType); + +} // End IPMI namespace + #endif |