From f54d606af645343351d086b1de237f021f38cb21 Mon Sep 17 00:00:00 2001 From: Nick Bofferding Date: Fri, 21 Jul 2017 11:15:42 -0500 Subject: 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 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Michael Baiocchi Reviewed-by: Marshall J. Wilks Reviewed-by: Stephen M. Cprek Reviewed-by: William G. Hoffa --- src/include/usr/initservice/initsvcreasoncodes.H | 1 + src/include/usr/initservice/istepdispatcherif.H | 14 ++++++---- src/include/usr/ipmi/ipmiif.H | 34 +++++++++++++++++++----- 3 files changed, 38 insertions(+), 11 deletions(-) (limited to 'src/include') diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 31910bcef..29f73e253 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -77,6 +77,7 @@ enum InitServiceReasonCode //termination_rc SHUTDOWN_NOT_RECONFIG_LOOP = INITSVC_COMP_ID | 0x10, ISTEP_SKIP_ATTEMPTED = INITSVC_COMP_ID | 0x11, + ISTEP_PROCESSING_DISABLED = INITSVC_COMP_ID | 0x12, }; enum InitServiceUserDetailDataSubSection diff --git a/src/include/usr/initservice/istepdispatcherif.H b/src/include/usr/initservice/istepdispatcherif.H index 752f9ffff..1694c7942 100644 --- a/src/include/usr/initservice/istepdispatcherif.H +++ b/src/include/usr/initservice/istepdispatcherif.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -78,12 +78,16 @@ void stopIpl( void ); #ifdef CONFIG_BMC_IPMI /** - * @brief This function is to be used by external code to - * initate a system reboot via IPMI commands - * - * @return Nothing + * @brief This function is to be used by external code to + * initiate a system reboot via IPMI commands */ void requestReboot( void ); + +/** + * @brief This function is to be used by external code to + * initiate a system power off via IPMI commands + */ +void requestPowerOff( void ); #endif /** diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H index 09f0c4830..4dd5e7cbb 100644 --- a/src/include/usr/ipmi/ipmiif.H +++ b/src/include/usr/ipmi/ipmiif.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -54,13 +54,30 @@ namespace IPMI MSG_STATE_GRACEFUL_SHUTDOWN, - // initate a reboot request - MSG_STATE_INITATE_POWER_CYCLE, + // initiate a reboot request + MSG_STATE_INITIATE_POWER_CYCLE, // Used to check range. Leave as last. - MSG_LAST_TYPE = MSG_STATE_INITATE_POWER_CYCLE, + MSG_LAST_TYPE = MSG_STATE_INITIATE_POWER_CYCLE, }; + /** + * @brief Returns whether IPMI message type is related to + * system shutdown/reboot or not + * + * @param[in] i_msgType IPMI message type in question + * + * @return bool True or false value indicating whether requested IPMI + * message type is related to system shutdown/reboot or not + */ + inline bool validShutdownRebootMsgType(const msg_type i_msgType) + { + return ( (i_msgType == MSG_STATE_SHUTDOWN) + || (i_msgType == MSG_STATE_SHUTDOWN_SEL) + || (i_msgType == MSG_STATE_GRACEFUL_SHUTDOWN) + || (i_msgType == MSG_STATE_INITIATE_POWER_CYCLE)); + } + // chassis power off request types enum power_request_type { @@ -349,11 +366,16 @@ namespace IPMI size_t max_buffer(void); /** - * Tells ipmirp to start a graceful reboot sequence - * + * @brief Initiate a graceful reboot sequence via the IPMI resource + * provider */ void initiateReboot(); + /** + * @brief Initiate a power off sequence via the IPMI resource provider + */ + void initiatePowerOff(); + /** * Structure to return BMC/IPMI information in */ -- cgit v1.2.3