Skip to content

Commit

Permalink
Log Hostboot state information in all error logs
Browse files Browse the repository at this point in the history
Add the Istep number and substep number to Hostboot Error Logs
to assist in problem debug. These items will be added as a user
data record to all Hostboot Error Logs prior to Runtime.

Change-Id: Ib5d269f3c1853d6d6856669744630dc130fa7094
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57172
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>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
dcrowell77 committed May 1, 2018
1 parent c78530b commit 38ec776
Show file tree
Hide file tree
Showing 11 changed files with 366 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/include/usr/errl/errlreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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
Expand Down
69 changes: 69 additions & 0 deletions src/include/usr/errl/errludstate.H
Original file line number Diff line number Diff line change
@@ -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
22 changes: 21 additions & 1 deletion src/include/usr/initservice/initserviceif.H
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
/* */
Expand Down Expand Up @@ -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 );

}


Expand Down
3 changes: 2 additions & 1 deletion src/usr/errl/errl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# Contributors Listed Below - COPYRIGHT 2015,2018
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -38,4 +38,5 @@ OBJS += errludbacktrace.o
OBJS += errludlogregister.o
OBJS += errludcallout.o
OBJS += errludsensor.o
OBJS += errludstate.o
OBJS += errlmanager_common.o
16 changes: 16 additions & 0 deletions src/usr/errl/errlentry.C
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 )
{
Expand Down
68 changes: 68 additions & 0 deletions src/usr/errl/errludstate.C
Original file line number Diff line number Diff line change
@@ -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()
{

}
}
6 changes: 4 additions & 2 deletions src/usr/errl/plugins/errludparserfactoryerrl.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -39,6 +39,7 @@
#include "errludcallout.H"
#include "errludsensor.H"
#include "errludbuild.H"
#include "errludstate.H"

namespace ERRORLOG
{
Expand Down Expand Up @@ -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:

Expand Down
113 changes: 113 additions & 0 deletions src/usr/errl/plugins/errludstate.H
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 38ec776

Please sign in to comment.