diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/errl/errlreasoncodes.H | 3 | ||||
-rw-r--r-- | src/include/usr/errl/errludstate.H | 69 | ||||
-rw-r--r-- | src/include/usr/initservice/initserviceif.H | 22 | ||||
-rw-r--r-- | src/usr/errl/errl.mk | 3 | ||||
-rw-r--r-- | src/usr/errl/errlentry.C | 16 | ||||
-rw-r--r-- | src/usr/errl/errludstate.C | 68 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludparserfactoryerrl.H | 6 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludstate.H | 113 | ||||
-rw-r--r-- | src/usr/initservice/baseinitsvc/initservice.C | 45 | ||||
-rw-r--r-- | src/usr/initservice/baseinitsvc/initservice.H | 24 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/istepdispatcher.C | 4 |
11 files changed, 366 insertions, 7 deletions
diff --git a/src/include/usr/errl/errlreasoncodes.H b/src/include/usr/errl/errlreasoncodes.H index 7d36eb745..dfe0eb8fc 100644 --- a/src/include/usr/errl/errlreasoncodes.H +++ b/src/include/usr/errl/errlreasoncodes.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -76,6 +76,7 @@ namespace ERRORLOG ERRL_UDT_SENSOR = 0x08, ERRL_UDT_STRING_SET = 0x09, ERRL_UDT_BUILD = 0x0A, + ERRL_UDT_SYSSTATE = 0x0B, }; // Identifiers for ERRL user data subsection versions diff --git a/src/include/usr/errl/errludstate.H b/src/include/usr/errl/errludstate.H new file mode 100644 index 000000000..14405ec15 --- /dev/null +++ b/src/include/usr/errl/errludstate.H @@ -0,0 +1,69 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/errl/errludstate.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* [+] 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 */ +#ifndef ERRL_UDSYSSTATE_H +#define ERRL_UDSYSSTATE_H + +/** + * @file errludsysstate.H + * + * Defines the ErrlUserDetailsState class that adds system state + * information to an error log as user detail data + */ + +#include <errl/errluserdetails.H> +#include <stdint.h> + + +//Forward reference +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsSysState + * + * Adds system state information to an error log + */ +class ErrlUserDetailsSysState : public ErrlUserDetails +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsSysState(); + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsSysState(); + +private: + // Disabled + ErrlUserDetailsSysState(const ErrlUserDetailsSysState &); + ErrlUserDetailsSysState & operator=(const ErrlUserDetailsSysState &); +}; + +} + +#endif diff --git a/src/include/usr/initservice/initserviceif.H b/src/include/usr/initservice/initserviceif.H index 8251bdb94..d2d61c4bd 100644 --- a/src/include/usr/initservice/initserviceif.H +++ b/src/include/usr/initservice/initserviceif.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -175,6 +175,26 @@ inline bool spBaseServicesEnabled() return spBaseServicesEnabled; } + + +/** + * @brief Save Istep Step and Substep for use by error logging + * @param[in] i_step, Istep Step + * @param[in] i_subStep, Istep subStep + * @return none + */ +void ShadowIstepData( uint8_t i_step, + uint8_t i_subStep ); + +/** + * @brief Extract Istep Step and Substep + * @param[out] o_step, Istep Step + * @param[out] o_subStep, Istep subStep + * @return none + */ +void GetIstepData( uint8_t & o_step, + uint8_t & o_subStep ); + } diff --git a/src/usr/errl/errl.mk b/src/usr/errl/errl.mk index 43bbd5df6..ce1c5c0e8 100644 --- a/src/usr/errl/errl.mk +++ b/src/usr/errl/errl.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -38,4 +38,5 @@ OBJS += errludbacktrace.o OBJS += errludlogregister.o OBJS += errludcallout.o OBJS += errludsensor.o +OBJS += errludstate.o OBJS += errlmanager_common.o diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index c05d10d1d..ea93a0ad0 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -44,6 +44,7 @@ #include <errl/errludstring.H> #include <errl/errluserdetails.H> #include <errl/errludattribute.H> +#include <errl/errludstate.H> #include <trace/interface.H> #include <arch/ppc.H> #include <hwas/common/hwasCallout.H> @@ -99,6 +100,21 @@ ErrlEntry::ErrlEntry(const errlSeverity_t i_sev, #endif // Collect the Backtrace and add it to the error log iv_pBackTrace = new ErrlUserDetailsBackTrace(); + +#ifndef __HOSTBOOT_RUNTIME + // Add the istep data to the vector of sections for this error log + ErrlUserDetailsSysState * l_pErrlUserDetailsSysState = + new ErrlUserDetailsSysState(); + + ErrlUD * l_pUdSection = new ErrlUD( l_pErrlUserDetailsSysState, + sizeof(ErrlUserDetailsSysState), + ERRL_COMP_ID, + 1, + ERRL_UDT_SYSSTATE ); + + iv_SectionVector.push_back( l_pUdSection ); +#endif + // Automatically add a software callout if asked if( i_hbSwError ) { diff --git a/src/usr/errl/errludstate.C b/src/usr/errl/errludstate.C new file mode 100644 index 000000000..f31bccf4f --- /dev/null +++ b/src/usr/errl/errludstate.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/errludstate.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* [+] 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 errludsysstate.C + * + * @brief Implementation of ErrlUserDetailsSysState + */ +#include <errl/errludstate.H> +#include <errl/errlreasoncodes.H> +#include <initservice/initserviceif.H> + +namespace ERRORLOG +{ + + ErrlUserDetailsSysState::ErrlUserDetailsSysState() + { + //***** Memory Layout ***** + // 1 bytes : Major Istep + // 1 bytes : Minor Istep + const size_t TOTAL_SIZE = 2; + + uint8_t l_iStep = 0; + uint8_t l_subStep = 0; + +#ifndef __HOSTBOOT_RUNTIME + INITSERVICE::GetIstepData( l_iStep, + l_subStep ); +#endif + + uint8_t* l_buf = reinterpret_cast<uint8_t*>( + reallocUsrBuf(TOTAL_SIZE)); + memset( l_buf, 0, TOTAL_SIZE ); + l_buf[0] = l_iStep; + l_buf[1] = l_subStep; + + // Set up ErrlUserDetails instance variables + iv_CompId = ERRL_COMP_ID; + iv_Version = 1; + iv_SubSection = ERRL_UDT_SYSSTATE; + } + + ErrlUserDetailsSysState::~ErrlUserDetailsSysState() + { + + } +} diff --git a/src/usr/errl/plugins/errludparserfactoryerrl.H b/src/usr/errl/plugins/errludparserfactoryerrl.H index 3859e8250..923632852 100644 --- a/src/usr/errl/plugins/errludparserfactoryerrl.H +++ b/src/usr/errl/plugins/errludparserfactoryerrl.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,6 +39,7 @@ #include "errludcallout.H" #include "errludsensor.H" #include "errludbuild.H" +#include "errludstate.H" namespace ERRORLOG { @@ -67,7 +68,8 @@ public: registerParser<ErrlUserDetailsParserCallout>(ERRL_UDT_CALLOUT); registerParser<ErrlUserDetailsParserSensor>(ERRL_UDT_SENSOR); registerParser<ErrlUserDetailsParserBuild>(ERRL_UDT_BUILD); - } + registerParser<ErrlUserDetailsParserSysState>(ERRL_UDT_SYSSTATE); + } private: diff --git a/src/usr/errl/plugins/errludstate.H b/src/usr/errl/plugins/errludstate.H new file mode 100644 index 000000000..ac6517b17 --- /dev/null +++ b/src/usr/errl/plugins/errludstate.H @@ -0,0 +1,113 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludstate.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* [+] 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 */ +#ifndef ERRL_UDSTATEP_H +#define ERRL_UDSTATEP_H + +/** + * @file errludsensor.H + * + * Defines the ErrlUserDetailsParserState class that parses system + * state info from user detail in an error log + */ + +#include "errluserdetails.H" +#include <targeting/common/target.H> + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsParserSysState + * + * Parses System state information from user detail in an error log + */ +class ErrlUserDetailsParserSysState :public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserSysState() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserSysState() {} + + /** + * @brief Parses State user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing Istep state data + * @param i_buflen Length of the buffer + */ + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + //***** Memory Layout ***** + // 1 bytes : Major Istep + // 1 bytes : Minor Istep + const size_t TOTAL_SIZE = 2; + + uint8_t* l_data = static_cast<uint8_t*>(i_pBuffer); + + if( i_buflen >= TOTAL_SIZE ) + { + i_parser.PrintNumber("Current Major Istep", "%d", + l_data[0]); + i_parser.PrintNumber("Current Minor Istep", "%d", + l_data[1]); + + if( i_buflen > TOTAL_SIZE ) + { + // Print out extra data as hex so that an old parser will + // still display new data that gets logged in the code + i_parser.PrintHexDump( (l_data+2), i_buflen-2 ); + } + } + + else + { + // Just print out whatever we have if it is less than + // the data size we are aware of + i_parser.PrintNumber("State Buffer length", "0x%X", i_buflen); + i_parser.PrintNumber("Expected length", "0x%X", TOTAL_SIZE); + i_parser.PrintHexDump(i_pBuffer, i_buflen); + } + } + +private: + // Disabled + ErrlUserDetailsParserSysState(const ErrlUserDetailsParserSysState &); + ErrlUserDetailsParserSysState & operator=( + const ErrlUserDetailsParserSysState &); +}; + +} + +#endif diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C index b16fd213e..8445a4df7 100644 --- a/src/usr/initservice/baseinitsvc/initservice.C +++ b/src/usr/initservice/baseinitsvc/initservice.C @@ -610,7 +610,9 @@ InitService& InitService::getTheInstance( ) InitService::InitService( ) : - iv_shutdownInProgress(false) + iv_shutdownInProgress(false), + iv_iStep( 0 ), + iv_iSubStep( 0 ) { mutex_init(&iv_registryMutex); } @@ -958,6 +960,27 @@ bool InitService::unregisterShutdownEvent(msg_q_t i_msgQ) return result; } + +void InitService::ShadowIstepData( uint8_t i_step, + uint8_t i_subStep ) +{ + // save the inputs + iv_iStep = i_step; + iv_iSubStep = i_subStep; + return; +} + + +void InitService::GetIstepData( uint8_t & o_step, + uint8_t & o_subStep ) +{ + // extract the data + o_step = iv_iStep; + o_subStep = iv_iSubStep; + return; +} + + /** * @see src/include/usr/initservice/initservicif.H */ @@ -976,4 +999,24 @@ bool unregisterShutdownEvent(msg_q_t i_msgQ) return Singleton<InitService>::instance().unregisterShutdownEvent(i_msgQ); } + +void ShadowIstepData( uint8_t i_step, + uint8_t i_subStep ) +{ + Singleton<InitService>::instance().ShadowIstepData( i_step, + i_subStep ); + return; +} + + +void GetIstepData( uint8_t & o_step, + uint8_t & o_subStep ) +{ + Singleton<InitService>::instance().GetIstepData( o_step, + o_subStep ); + + return; +} + + } // namespace diff --git a/src/usr/initservice/baseinitsvc/initservice.H b/src/usr/initservice/baseinitsvc/initservice.H index 70b1f8427..18e76ef49 100644 --- a/src/usr/initservice/baseinitsvc/initservice.H +++ b/src/usr/initservice/baseinitsvc/initservice.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -240,6 +240,25 @@ public: uint64_t i_masterHBInstance = 0xffffffffffffffffull, uint32_t i_error_info = 0); + /** + * @brief Save Istep Step and Substep for use by error logging + * @param[in] i_step, Istep Step + * @param[in] i_subStep, Istep subStep + * @return none + */ + void ShadowIstepData( uint8_t i_step, + uint8_t i_subStep ); + + /** + * @brief Extract Istep Step and Substep + * @param[out] o_step, Istep Step + * @param[out] o_subStep, Istep subStep + * @return none + */ + void GetIstepData( uint8_t & o_step, + uint8_t & o_subStep ); + + protected: /** @@ -306,6 +325,9 @@ private: mutex_t iv_registryMutex; bool iv_shutdownInProgress; + uint8_t iv_iStep; // shadow of current istep / substep + uint8_t iv_iSubStep; // for error logs + }; // class InitService } // namespace INITSERVICE diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index 56be31a44..0cebd9cea 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -46,6 +46,7 @@ #include <initservice/isteps_trace.H> // ISTEPS_TRACE buffer #include <initservice/initsvcudistep.H> // InitSvcUserDetailsIstep #include <initservice/taskargs.H> // TASK_ENTRY_MACRO +#include <initservice/initserviceif.H> #include <targeting/common/targetservice.H> #include <targeting/attrsync.H> #include <fapi2/plat_attr_override_sync.H> @@ -838,6 +839,9 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep, errlHndl_t err = NULL; o_doReconfig = false; + INITSERVICE::ShadowIstepData( static_cast<uint8_t>(i_istep), + static_cast<uint8_t>(i_substep) ); + // Get the Task Info for this step const TaskInfo * theStep = findTaskInfo(i_istep, i_substep); |