diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/initservice/istepdispatcher/istepdispatcher.C | 40 | ||||
-rw-r--r-- | src/usr/ipmi/ipmichassiscontrol.C | 81 | ||||
-rw-r--r-- | src/usr/ipmi/makefile | 3 | ||||
-rw-r--r-- | src/usr/sbe/sbe_resolve_sides.C | 78 | ||||
-rw-r--r-- | src/usr/sbe/sbe_resolve_sides.H | 9 | ||||
-rw-r--r-- | src/usr/sbe/sbe_update.C | 20 |
6 files changed, 149 insertions, 82 deletions
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index e74699d38..852907226 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -31,7 +31,6 @@ * */ - /******************************************************************************/ // Includes /******************************************************************************/ @@ -67,8 +66,10 @@ #include <pnor/pnorif.H> #include <ipmi/ipmiwatchdog.H> //IPMI watchdog timer #include <ipmi/ipmipowerstate.H> //IPMI System ACPI Power State +#include <ipmi/ipmichassiscontrol.H> #include <config.h> #include <ipmi/ipmisensor.H> +#include <ipmi/ipmiif.H> #include <initservice/bootconfigif.H> #include <trace/trace.H> @@ -531,11 +532,6 @@ errlHndl_t IStepDispatcher::executeAllISteps() err = failedDueToDeconfig(istep, substep, newIstep, newSubstep); } - // Otherwise shut down. The BMC watchdog reset will - // cause the system to reboot. The BMC allows 2 - // boot attempts from the primary side of PNOR and 1 - // from the golden side. After that the system would - // shut down and halt. else { #ifdef CONFIG_BMC_IPMI @@ -572,34 +568,26 @@ errlHndl_t IStepDispatcher::executeAllISteps() "not increment reboot count."); } - // @TODO RTC:124679 - Remove Once BMC Monitors - // Shutdown Attention - // Set Watchdog Timer before calling doShutdown() - TRACFCOMP( g_trac_initsvc,"executeAllISteps: " - "Set Watch Dog Timer To %d Seconds", - SET_WD_TIMER_IN_SECS); - - err = IPMIWATCHDOG::setWatchDogTimer( - SET_WD_TIMER_IN_SECS, // new time - static_cast<uint8_t> - (IPMIWATCHDOG::DO_NOT_STOP | - IPMIWATCHDOG::BIOS_FRB2), // default - IPMIWATCHDOG::TIMEOUT_HARD_RESET); + // Request BMC to do power cycle that sends shutdown + // and reset the host + err = IPMI::chassisControl + (IPMI::CHASSIS_POWER_CYCLE); + if (err) + { + TRACFCOMP(g_trac_initsvc, ERR_MRK + "FAIL executing chassisControl command"); + break; + } #endif #ifdef CONFIG_CONSOLE - #ifdef CONFIG_BMC_IPMI - CONSOLE::displayf(NULL, - "System Shutting Down In %d Seconds " - "To Perform Reconfiguration\n", - SET_WD_TIMER_IN_SECS); - #else CONSOLE::displayf(NULL, "System Shutting Down " "To Perform Reconfiguration\n"); - #endif CONSOLE::flush(); #endif + #ifndef CONFIG_BMC_IPMI shutdownDuringIpl(); + #endif } } // else return the error from doIstep diff --git a/src/usr/ipmi/ipmichassiscontrol.C b/src/usr/ipmi/ipmichassiscontrol.C new file mode 100644 index 000000000..1d17c366e --- /dev/null +++ b/src/usr/ipmi/ipmichassiscontrol.C @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/ipmi/ipmichassiscontrol.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** + * @file ipmichassiscontrol.C + * + * Ipmi send chassis control command + * + */ + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> +#include <errl/errlentry.H> +#include <ipmi/ipmichassiscontrol.H> +#include <ipmi/ipmiif.H> + +/******************************************************************************/ +// Globals/Constants +/******************************************************************************/ +// Defined in ipmidd.C +extern trace_desc_t * g_trac_ipmi; +#define IPMI_TRAC(printf_string,args...) \ + TRACFCOMP(g_trac_ipmi,"cc: " printf_string,##args) + +namespace IPMI +{ + +/******************************************************************************/ +// Functions +/******************************************************************************/ + +errlHndl_t chassisControl(const uint8_t i_chassisControlState ) +{ + errlHndl_t err_ipmi = NULL; + + size_t len = 1; // IPMI spec has request data at 1 bytes + + //create request data buffer + uint8_t* data = new uint8_t[len]; + + IPMI::completion_code cc = IPMI::CC_UNKBAD; + + data[0] = i_chassisControlState; + + err_ipmi = IPMI::sendrecv(IPMI::chassis_power_off(), cc, len, data); + + //cleanup buffer + delete[] data; + + if(cc != IPMI::CC_OK) + { + IPMI_TRAC("Chassis control : BMC returned not ok CC[%x]",cc); + } + + return err_ipmi; +} +} // namespace + diff --git a/src/usr/ipmi/makefile b/src/usr/ipmi/makefile index 9447bad37..50638b522 100644 --- a/src/usr/ipmi/makefile +++ b/src/usr/ipmi/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2015 +# Contributors Listed Below - COPYRIGHT 2011,2016 # [+] International Business Machines Corp. # # @@ -38,6 +38,7 @@ OBJS += ipmiwatchdog.o OBJS += ipmifruinv.o OBJS += ipmipowerstate.o OBJS += ipmiselrecord.o +OBJS += ipmichassiscontrol.o SUBDIRS += runtime.d #SUBDIRS += test.d diff --git a/src/usr/sbe/sbe_resolve_sides.C b/src/usr/sbe/sbe_resolve_sides.C index 90b996a21..b27372ee6 100644 --- a/src/usr/sbe/sbe_resolve_sides.C +++ b/src/usr/sbe/sbe_resolve_sides.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -42,8 +42,9 @@ #include <initservice/initserviceif.H> #include <console/consoleif.H> #include <config.h> -#include <ipmi/ipmiwatchdog.H> +#include <ipmi/ipmiif.H> #include <ipmi/ipmisensor.H> +#include <ipmi/ipmichassiscontrol.H> #include <sbe/sbeif.H> #include <sbe/sbereasoncodes.H> #include "sbe_resolve_sides.H" @@ -295,28 +296,29 @@ errlHndl_t resolveProcessorSbeSeeproms() l_restartNeeded); #ifdef CONFIG_BMC_IPMI - sbePreShutdownIpmiCalls(); + err = sbePreRebootIpmiCalls(); + if (err) + { + TRACFCOMP( g_trac_sbe,ERR_MRK"sbePreRebootIpmiCalls failed"); + break; + } #endif #ifdef CONFIG_CONSOLE - #ifdef CONFIG_BMC_IPMI - CONSOLE::displayf(SBE_COMP_NAME, "System Shutting Down In %d " - "Seconds To Perform SBE Update\n", - SET_WD_TIMER_IN_SECS); - #else - CONSOLE::displayf(SBE_COMP_NAME, "System Shutting Down To " + CONSOLE::displayf(SBE_COMP_NAME, "System Rebooting To " "Perform SBE Update\n"); - #endif CONSOLE::flush(); #endif +#ifndef CONFIG_BMC_IPMI TRACFCOMP( g_trac_sbe, INFO_MRK"resolveProcessorSbeSeeproms: Calling " "INITSERVICE::doShutdown() with " "SBE_UPDATE_REQUEST_REIPL = 0x%X", SBE_UPDATE_REQUEST_REIPL ); INITSERVICE::doShutdown(SBE_UPDATE_REQUEST_REIPL); +#endif } }while(0); @@ -1293,10 +1295,10 @@ errlHndl_t resolveImageHBBaddr(TARGETING::Target* i_target, #ifdef CONFIG_BMC_IPMI ///////////////////////////////////////////////////////////////////// -void sbePreShutdownIpmiCalls( void ) +errlHndl_t sbePreRebootIpmiCalls( void ) { errlHndl_t err = NULL; - TRACFCOMP( g_trac_sbe, ENTER_MRK"sbePreShutdownIpmiCalls"); + TRACFCOMP( g_trac_sbe, ENTER_MRK"sbePreRebootIpmiCalls"); do{ uint16_t count = 0; @@ -1307,7 +1309,7 @@ void sbePreShutdownIpmiCalls( void ) if ( err ) { TRACFCOMP( g_trac_sbe, - ERR_MRK"sbePreShutdownIpmiCalls: " + ERR_MRK"sbePreRebootIpmiCalls: " "FAIL Reading Reboot Sensor Count. " "Committing Error Log rc=0x%.4X eid=0x%.8X " "plid=0x%.8X, but continuing shutdown", @@ -1317,21 +1319,21 @@ void sbePreShutdownIpmiCalls( void ) err->collectTrace(SBE_COMP_NAME); errlCommit( err, SBE_COMP_ID ); - // No Break - Still Do Watchdog Timer Call + // No Break - Still do reboot } else { // Increment Reboot Count Sensor count++; TRACFCOMP( g_trac_sbe, - INFO_MRK"sbePreShutdownIpmiCalls: " + INFO_MRK"sbePreRebootIpmiCalls: " "Writing Reboot Sensor Count=%d", count); err = l_sensor.setRebootCount( count ); if ( err ) { TRACFCOMP( g_trac_sbe, - ERR_MRK"sbePreShutdownIpmiCalls: " + ERR_MRK"sbePreRebootIpmiCalls: " "FAIL Writing Reboot Sensor Count to %d. " "Committing Error Log rc=0x%.4X eid=0x%.8X " "plid=0x%.8X, but continuing shutdown", @@ -1342,43 +1344,37 @@ void sbePreShutdownIpmiCalls( void ) err->collectTrace(SBE_COMP_NAME); errlCommit( err, SBE_COMP_ID ); - // No Break - Still Do Watchdog Timer Call + // No Break - Still send chassis power cycle } } - // @todo RTC 124679 - Remove Once BMC Monitors Shutdown Attention - // Set Watchdog Timer before calling doShutdown() - TRACFCOMP( g_trac_sbe,"sbePreShutdownIpmiCalls: " - "Set Watch Dog Timer To %d Seconds", - SET_WD_TIMER_IN_SECS); - - err = IPMIWATCHDOG::setWatchDogTimer( - SET_WD_TIMER_IN_SECS, // new time - static_cast<uint8_t> - (IPMIWATCHDOG::DO_NOT_STOP | - IPMIWATCHDOG::BIOS_FRB2), // default - IPMIWATCHDOG::TIMEOUT_HARD_RESET); + TRACFCOMP( g_trac_sbe,"sbePreRebootIpmiCalls: " + "requesting chassis power cycle"); + + // Request BMC to do power cycle that sends shutdown + // and reset the host + err = IPMI::chassisControl(IPMI::CHASSIS_POWER_CYCLE); if(err) { - TRACFCOMP( g_trac_sbe, - ERR_MRK"sbePreShutdownIpmiCalls: " - "FAIL Setting Watch Dog Timer to %d seconds. " - "Committing Error Log rc=0x%.4X eid=0x%.8X " - "plid=0x%.8X, but continuing shutdown", - SET_WD_TIMER_IN_SECS, - err->reasonCode(), - err->eid(), - err->plid()); + TRACFCOMP( g_trac_sbe, + ERR_MRK"sbePreRebootIpmiCalls: " + "FAIL executing chassisiControl" + "Error Log rc=0x%.4X eid=0x%.8X " + "plid=0x%.8X ", + err->reasonCode(), + err->eid(), + err->plid()); err->collectTrace(SBE_COMP_NAME); - errlCommit(err, SBE_COMP_ID ); } + + }while(0); - TRACFCOMP( g_trac_sbe, EXIT_MRK"sbePreShutdownIpmiCalls"); + TRACFCOMP( g_trac_sbe, EXIT_MRK"sbePreRebootIpmiCalls"); - return; + return err; } #endif // CONFIG_BMC_IPMI diff --git a/src/usr/sbe/sbe_resolve_sides.H b/src/usr/sbe/sbe_resolve_sides.H index 25d442ec3..66797a92f 100644 --- a/src/usr/sbe/sbe_resolve_sides.H +++ b/src/usr/sbe/sbe_resolve_sides.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -252,12 +252,11 @@ namespace SBE #ifdef CONFIG_BMC_IPMI /** - * @brief Performs any necessary IPMI calls before shutting down the system + * @brief Performs any necessary IPMI calls before reboot the system * - * @return void Any generated Error Logs will be commited before the - * function returns + * @return errlHndl_t Error log handle on failure. */ - void sbePreShutdownIpmiCalls( void ); + errlHndl_t sbePreRebootIpmiCalls( void ); #endif } //end namespace SBE diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C index 8340d86ef..627c87013 100644 --- a/src/usr/sbe/sbe_update.C +++ b/src/usr/sbe/sbe_update.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* Contributors Listed Below - COPYRIGHT 2013,2016 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -420,28 +420,30 @@ namespace SBE } #ifdef CONFIG_BMC_IPMI - sbePreShutdownIpmiCalls(); + err = sbePreRebootIpmiCalls(); + if (err) + { + TRACFCOMP( g_trac_sbe,ERR_MRK"sbePreRebootIpmiCalls " + "failed"); + break; + } #endif #ifdef CONFIG_CONSOLE - #ifdef CONFIG_BMC_IPMI - CONSOLE::displayf(SBE_COMP_NAME, "System Shutting Down In %d " - "Seconds To Perform SBE Update\n", - SET_WD_TIMER_IN_SECS); - #else - CONSOLE::displayf(SBE_COMP_NAME, "System Shutting Down To " + CONSOLE::displayf(SBE_COMP_NAME, "System Rebooting To " "Perform SBE Update\n"); - #endif CONSOLE::flush(); #endif +#ifndef CONFIG_BMC_IPMI TRACFCOMP( g_trac_sbe, INFO_MRK"updateProcessorSbeSeeproms(): Calling " "INITSERVICE::doShutdown() with " "SBE_UPDATE_REQUEST_REIPL = 0x%X", SBE_UPDATE_REQUEST_REIPL ); INITSERVICE::doShutdown(SBE_UPDATE_REQUEST_REIPL); +#endif } /************************************************************/ |