diff options
author | Mike Jones <mjjones@us.ibm.com> | 2012-03-12 10:12:01 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-03-16 09:13:39 -0500 |
commit | 8a1168142bd3f273dbd4edf841c53a3ae394cd5e (patch) | |
tree | 94029d881fa5b89d186073859c7de2fd6dcdfcb8 /src/include | |
parent | ff8472f5e338d17194b5a1300b9553dd1ac3a241 (diff) | |
download | talos-hostboot-8a1168142bd3f273dbd4edf841c53a3ae394cd5e.tar.gz talos-hostboot-8a1168142bd3f273dbd4edf841c53a3ae394cd5e.zip |
ERRL: Ensure all Hostboot code uses ErrlUserDetails framework.
RTC: 36920
Change-Id: I82667c8e63e8a99b9cc7eb1dfbbbdbe1c3b2bb2a
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/730
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/errl/errlUserDetailsTarget.H | 171 | ||||
-rw-r--r-- | src/include/usr/errl/errlreasoncodes.H | 8 | ||||
-rw-r--r-- | src/include/usr/errl/errludbacktrace.H | 184 | ||||
-rwxr-xr-x | src/include/usr/errl/errludparserfactory.H | 134 | ||||
-rw-r--r-- | src/include/usr/errl/errludparserfactoryerrl.H | 73 | ||||
-rw-r--r-- | src/include/usr/errl/errludstring.H | 118 | ||||
-rw-r--r-- | src/include/usr/errl/errludtarget.H | 141 | ||||
-rwxr-xr-x | src/include/usr/errl/errluserdetails.H | 145 | ||||
-rw-r--r-- | src/include/usr/errl/hberrltypes.H | 23 | ||||
-rw-r--r-- | src/include/usr/hbotcompid.H | 18 | ||||
-rw-r--r-- | src/include/usr/initservice/initsvcreasoncodes.H | 5 | ||||
-rw-r--r-- | src/include/usr/initservice/initsvcudistep.H | 139 | ||||
-rw-r--r-- | src/include/usr/initservice/initsvcudparserfactory.H | 69 | ||||
-rw-r--r-- | src/include/usr/mbox/mbox_reasoncodes.H | 8 | ||||
-rw-r--r-- | src/include/usr/targeting/targreasoncodes.H | 12 |
15 files changed, 936 insertions, 312 deletions
diff --git a/src/include/usr/errl/errlUserDetailsTarget.H b/src/include/usr/errl/errlUserDetailsTarget.H deleted file mode 100644 index 2fcce1545..000000000 --- a/src/include/usr/errl/errlUserDetailsTarget.H +++ /dev/null @@ -1,171 +0,0 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/errl/errlUserDetailsTarget.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END -#ifndef ERRL_USERDETAILS_TARGET_H -#define ERRL_USERDETAILS_TARGET_H - -/** - * @file ErrlTarget.H - * - * Target FFDC Helper - * - * Framework defining how User Detail Data sections of error logs should - * be created and parsed. - * - * Creation methods will show up when the PARSER macro is NOT defined. - * These will compile and run under HostBoot. - * - * Parsing methods will show up when the PARSER macro IS defined. - * These will compile and run in the errl tool. - * -*/ - -/*****************************************************************************/ -// I n c l u d e s -/*****************************************************************************/ -#include <stdint.h> -#include <errl/errluserdetails.H> -#include <targeting/targetservice.H> - -namespace ERRORLOG -{ - -#ifndef PARSER - -class ErrlUserDetailsTarget : public ErrlUserDetails -{ -public: - - /** - * @brief Constructor - * - */ - ErrlUserDetailsTarget(const TARGETING::Target * i_target); - - /** - * @brief Destructor - * - */ - virtual ~ErrlUserDetailsTarget(); - - /** - * @brief Adds or appends FFDC data to error log - * - * @param i_errl - * Error log handle to add detail data to. - * - * @param i_buf - * pointer to the new data buffer to be added/appended. - * - * @param i_len - * length of the new data buffer to be added/appended in bytes - * - * @return none - * - */ - void addToLog( errlHndl_t i_errl, void *i_buf, const uint32_t i_len ); - -private: - - // Disabled - ErrlUserDetailsTarget(const ErrlUserDetailsTarget &); - ErrlUserDetailsTarget & operator=(const ErrlUserDetailsTarget &); - - const TARGETING::Target *iv_pTarget; -}; - -#else // (if PARSER defined) - -/** - * @brief Target FFDC Helper - * - * Framework defining how User Detail Data sections of error logs should - * be created and parsed. - * - * Creation methods will show up when the PARSER macro is NOT defined. - * These will compile and run under HostBoot. - * - * Parsing methods will show up when the PARSER macro IS defined. - * These will compile and run in the errl tool. - * -*/ - -class ErrlUserDetailsTarget : public ErrlUserDetails -{ -public: - - /** - * @brief Constructor - * - */ - ErrlUserDetailsTarget() : ErrlUserDetails() {} - - /** - * @brief Destructor - * - */ - virtual ~ErrlUserDetailsTarget() {} - - /** - * @brief Parses 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 detail data - * - * @param i_buflen - * Length of the buffer - * - * @return None - * - */ - virtual void parse(errlver_t i_version, - ErrlUsrParser & i_parser, - const void * i_pBuffer, const uint32_t i_buflen) const - { - char * l_ptr = i_pBuffer; - for (uint32_t i = 0; i < i_buflen; ) - { - i_parser.PrintString( "", l_ptr ); - i += strlen(l_ptr) + 1; - l_ptr += strlen(l_ptr) + 1; - } - } - -private: - - // Disabled - ErrlUserDetailsTarget(const ErrlUserDetailsTarget &); - ErrlUserDetailsTarget & operator=(const ErrlUserDetailsTarget &); - -}; - -#endif - -} - -#endif diff --git a/src/include/usr/errl/errlreasoncodes.H b/src/include/usr/errl/errlreasoncodes.H index 00b156f7e..89d31e1d4 100644 --- a/src/include/usr/errl/errlreasoncodes.H +++ b/src/include/usr/errl/errlreasoncodes.H @@ -36,7 +36,7 @@ enum { HBERRL_FIRST_MODULE_ID = 0x00, - HBERRL_USERDETAILS_MODULE_ID = 1, + HBERRL_USERDATA_TEST_MOD_ID = 1, HBERRL_TEST_MOD_ID = 2, //........ HBERRL_LAST_MODULE_ID = 0xFF @@ -46,10 +46,8 @@ enum enum errlReasonCode { HBERRL_FIRST_ERR = HBERRL_COMP_ID | 0x01, - HBERRL_FILENAME_TEST = HBERRL_COMP_ID | 0x02, - HBERRL_ERRORMSG_TEST = HBERRL_COMP_ID | 0x03, - HBERRL_XMLTOKEN_TEST = HBERRL_COMP_ID | 0x04, - HBERRL_TEST_REASON_CODE = HBERRL_COMP_ID | 0x0F, + HBERRL_TEST_STRING_UD = HBERRL_COMP_ID | 0x02, + HBERRL_TEST_REASON_CODE = HBERRL_COMP_ID | 0x03, //........ HBERRL_LAST_ERR = HBERRL_COMP_ID | 0xFF }; diff --git a/src/include/usr/errl/errludbacktrace.H b/src/include/usr/errl/errludbacktrace.H new file mode 100644 index 000000000..193064e36 --- /dev/null +++ b/src/include/usr/errl/errludbacktrace.H @@ -0,0 +1,184 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludbacktrace.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef ERRL_UDBACKTRACE_H +#define ERRL_UDBACKTRACE_H + +/** + * @file errludbacktrace.H + * + * Defines the following classes: + * + * ErrlUserDetailsBackTrace: Adds backtrace FFDC to an error log as user detail + * data + * ErrlUserDetailsParserBackTrace: Parses backtrace FFDC user detail in an + * error log + */ + +#include <errl/errluserdetails.H> + +namespace ERRORLOG +{ + +#ifndef PARSER + +/** + * @class ErrlUserDetailsBackTrace + * + * Adds backtrace FFDC to an error log as user detail data +*/ +class ErrlUserDetailsBackTrace : public ErrlUserDetails +{ +public: + /** + * @brief Constructor + * + * Captures the backtrace internally + */ + ErrlUserDetailsBackTrace(); + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsBackTrace(); + +private: + // Disabled + ErrlUserDetailsBackTrace(const ErrlUserDetailsBackTrace &); + ErrlUserDetailsBackTrace & operator=(const ErrlUserDetailsBackTrace &); +}; + +#else // (if PARSER defined) + +/** + * @class ErrlUserDetailsParserBackTrace + * + * Parses backtrace user detail in an error log +*/ +class ErrlUserDetailsParserBackTrace : public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserBackTrace() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserBackTrace() {} + + /** + * @brief Parses backtrace 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 detail 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 + { + // This buffer contains a number of 64-bit frame pointers. + + // A character vector for storing a backtrace entry and the space + // required for the header (frame number and address (with some padding + // for safety)) and the symbol name. This vector is resized if a longer + // symbol name is encountered. + const uint8_t BACKTRACE_ENTRY_HEADER_SIZE = 32; + const uint8_t BACKTRACE_ENTRY_SYMBOL_SIZE = 64; + std::vector<char> l_traceEntry(BACKTRACE_ENTRY_HEADER_SIZE + + BACKTRACE_ENTRY_SYMBOL_SIZE); + + // Initialize l_the symbol table. + const char * l_pSymFile = "hbicore.syms"; + hbSymbolTable symTab; + int readRC = symTab.readSymbols( l_pSymFile ); + if( readRC ) + { + i_parser.PrintString( "Symbols not found", l_pSymFile ); + // symTab.nearestSymbol() will return NULL because of this. + // Carry on. + } + + const char * l_pErrlEntry = "ErrlEntry::ErrlEntry"; + const char * l_pLabel = "Backtrace"; + + // loop thru the buffer which is an array of 64-bit addresses + uint64_t * p64 = static_cast<uint64_t *>(i_pBuffer); + int l_count = i_buflen / sizeof( uint64_t ); + for( int i = 0; i < l_count; i++ ) + { + // endian convert the stack address + uint64_t l_addr = ntohll(*p64); + + // get nearest symbol + const char * l_pSymbol = symTab.nearestSymbol( l_addr ); + + if( l_pSymbol ) + { + if( strstr( l_pSymbol, l_pErrlEntry )) + { + // hackish, makes for better looking output + // it's in every backtrace (jan2012) + l_pSymbol = l_pErrlEntry; + } + + uint16_t l_traceSize = + (BACKTRACE_ENTRY_HEADER_SIZE + strlen(l_pSymbol) + 1); + + if (l_traceEntry.size() < l_traceSize) + { + l_traceEntry.resize(l_traceSize); + } + sprintf(&(l_traceEntry[0]), + "#%2d %016llX %s", i, l_addr, l_pSymbol); + } + else + { + sprintf(&(l_traceEntry[0]),"#%2d %016llX", i, l_addr); + } + i_parser.PrintString( l_pLabel, &(l_traceEntry[0]) ); + + // next stack address in the buffer + p64++; + + // don't print the label for subsequent backtraces + l_pLabel = ""; + } + } + +private: + // Disabled + ErrlUserDetailsParserBackTrace(const ErrlUserDetailsParserBackTrace &); + ErrlUserDetailsParserBackTrace & operator=( + const ErrlUserDetailsParserBackTrace &); +}; + +#endif + +} + +#endif + diff --git a/src/include/usr/errl/errludparserfactory.H b/src/include/usr/errl/errludparserfactory.H new file mode 100755 index 000000000..ea39297cc --- /dev/null +++ b/src/include/usr/errl/errludparserfactory.H @@ -0,0 +1,134 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludparserfactory.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef ERRL_UDPARSERFACTORY_H +#define ERRL_UDPARSERFACTORY_H + +#ifdef PARSER + +/** + * @file errludparserfactory.H + * + * Defines the ErrlUserDetailsParserFactory base class + */ +#include <map> + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsParserFactory + * + * This is a factory that produces ErrlUserDetailsParser objects. If a component + * creates user detail data then it should derive a class from this and register + * all of its ErrlUserDetailsParser classes with it. The parse file in the + * plugins directory can then call the factory to create parser objects to parse + * any user detail data. + * + * This class is only compiled when PARSER is defined + */ +class ErrlUserDetailsParserFactory +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserFactory() + { + } + + /** + * @brief Destructor + */ + ~ErrlUserDetailsParserFactory() + { + } + + /** + * @brief Register a class derived from ErrlUserDetailsParser with the + * factory that can parse user detail data with the specified + * subsection. + * + * @param i_subSection The user detail data subsection that is parsed by + * class T + */ + template<typename T> + void registerParser(const errlsubsec_t i_subSection) + { + iv_createObjectMap[i_subSection] = &(createParserObject<T>); + } + + /** + * @brief Create an object of type ErrlUserDetailsParser that can parse + * user detail data with the specified subsection. The returned + * pointer will be polymorphic and will actually point to a type + * derived from ErrlUserDetailsParser. + * + * @param i_subSection The user detail data subsection to parse + * + * @return ErrlUserDetailsParser * + * Pointer to a ErrlUserDetailsParser object. Null if there is no + * parser registered for the specified subsection. The user must delete + * the object after use. + */ + ErrlUserDetailsParser * createParser(const errlsubsec_t i_subSection) + { + std::map<errlsubsec_t, createParserObject_t>::const_iterator itr = + iv_createObjectMap.find(i_subSection); + + if (itr != iv_createObjectMap.end()) + { + // Call the object creator function (createParserObject) + return((itr->second)()); + } + return NULL; + } + +private: + /** + * @brief Creates a ErrlUserDetailsParser of the specified derived type + * + * @return ErrlUserDetailsParser * Pointer to newly created object + */ + template<typename T> + static ErrlUserDetailsParser * createParserObject() + { + return new T(); + } + + // Function pointer type of createParserObject + typedef ErrlUserDetailsParser *(*createParserObject_t)(); + + // Map of subsections and their createobject function + std::map<errlsubsec_t, createParserObject_t> iv_createObjectMap; + + // Disabled + ErrlUserDetailsParserFactory(const ErrlUserDetailsParserFactory &); + ErrlUserDetailsParserFactory & operator=( + const ErrlUserDetailsParserFactory &); +}; + +} + +#endif +#endif + diff --git a/src/include/usr/errl/errludparserfactoryerrl.H b/src/include/usr/errl/errludparserfactoryerrl.H new file mode 100644 index 000000000..510265e89 --- /dev/null +++ b/src/include/usr/errl/errludparserfactoryerrl.H @@ -0,0 +1,73 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludparserfactoryerrl.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef ERRL_UDPARSERFACTORYERRL_H +#define ERRL_UDPARSERFACTORYERRL_H + +#ifdef PARSER + +/** + * @file errludparserfactoryerrl.H + * + * Defines the errlUserDetailsParserFactoryErrl.H class +*/ +#include <errl/errludstring.H> +#include <errl/errludtarget.H> +#include <errl/errludbacktrace.H> +#include <errl/errludparserfactory.H> + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsParserFactoryErrl + * + * This factory produces ErrlUserDetailsParser objects to parse the specified + * ERRL user detail data. +*/ +class ErrlUserDetailsParserFactoryErrl : public ErrlUserDetailsParserFactory +{ +public: + + /** + * @brief Constructor + */ + ErrlUserDetailsParserFactoryErrl() + { + registerParser<ErrlUserDetailsParserString>(HBERRL_UDT_STRING); + registerParser<ErrlUserDetailsParserTarget>(HBERRL_UDT_TARGET); + registerParser<ErrlUserDetailsParserBackTrace>(HBERRL_UDT_BACKTRACE); + } + +private: + + // Disabled + ErrlUserDetailsParserFactoryErrl(const ErrlUserDetailsParserFactoryErrl &); + ErrlUserDetailsParserFactoryErrl & operator=( + const ErrlUserDetailsParserFactoryErrl &); +}; + +} + +#endif +#endif + diff --git a/src/include/usr/errl/errludstring.H b/src/include/usr/errl/errludstring.H new file mode 100644 index 000000000..fb72c5498 --- /dev/null +++ b/src/include/usr/errl/errludstring.H @@ -0,0 +1,118 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludstring.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef ERRL_UDSTRING_H +#define ERRL_UDSTRING_H + +/** + * @file errludstring.H + * + * Defines the following classes: + * + * ErrlUserDetailsString: Adds string FFDC to an error log as user detail data + * ErrlUserDetailsParserString: Parses string FFDC user detail in an error log +*/ + +#include <errl/errluserdetails.H> + +namespace ERRORLOG +{ + +#ifndef PARSER + +/** + * @class ErrlUserDetailsString + * + * Adds String FFDC to an error log as user detail data + */ +class ErrlUserDetailsString : public ErrlUserDetails +{ +public: + /** + * @brief Constructor + * + * Captures the supplied string internally + * + * @param i_pString Pointer to string to capture as user detail data + */ + ErrlUserDetailsString(const char * i_pString); + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsString(); + +private: + // Disabled + ErrlUserDetailsString(const ErrlUserDetailsString &); + ErrlUserDetailsString & operator=(const ErrlUserDetailsString &); +}; + +#else // (if PARSER defined) + +/** + * @class ErrlUserDetailsString + * + * Parses String user detail in an error log +*/ +class ErrlUserDetailsParserString : public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserString() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserString() {} + + /** + * @brief Parses string 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 detail 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 + { + i_parser.PrintString("String data", static_cast<char *>(i_pBuffer)); + } + +private: + // Disabled + ErrlUserDetailsParserString(const ErrlUserDetailsParserString &); + ErrlUserDetailsParserString & operator=( + const ErrlUserDetailsParserString &); +}; + +#endif + +} + +#endif + diff --git a/src/include/usr/errl/errludtarget.H b/src/include/usr/errl/errludtarget.H new file mode 100644 index 000000000..3ec24fc60 --- /dev/null +++ b/src/include/usr/errl/errludtarget.H @@ -0,0 +1,141 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludtarget.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef ERRL_UDTARGET_H +#define ERRL_UDTARGET_H + +/** + * @file errludTarget.H + * + * Defines the following classes: + * + * ErrlUserDetailsTarget: Adds Target FFDC to an error log as user detail data + * ErrlUserDetailsParserTarget: Parses Target FFDC user detail in an error log +*/ + +#include <errl/errluserdetails.H> + +// Forward reference +namespace TARGETING +{ + class Target; +} + +namespace ERRORLOG +{ + +#ifndef PARSER + +/** + * @class ErrlUserDetailsTarget + * + * Adds Target FFDC to an error log as user detail data +*/ +class ErrlUserDetailsTarget : public ErrlUserDetails +{ +public: + /** + * @brief Constructor + * + * Captures the supplied Target's FFDC data internally + * + * @param i_pTarget Pointer to Target to capture as user detail data + */ + ErrlUserDetailsTarget(const TARGETING::Target * i_pTarget); + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsTarget(); + + /** + * @brief Adds the Target as user detail data to an error log + * + * @param i_errl Error log to add detail data to. + */ + virtual void addToLog(errlHndl_t i_errl); + +private: + // Target pointer + const TARGETING::Target * iv_pTarget; + + // Disabled + ErrlUserDetailsTarget(const ErrlUserDetailsTarget &); + ErrlUserDetailsTarget & operator=(const ErrlUserDetailsTarget &); +}; + +#else // (if PARSER defined) + +/** + * @class ErrlUserDetailsParserTarget + * + * Parses Target FFDC user detail in an error log +*/ +class ErrlUserDetailsParserTarget : public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserTarget() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserTarget() {} + + /** + * @brief Parses Target 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 detail 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 + { + i_parser.PrintString("Target data", NULL); + char * l_ptr = static_cast<char *>(i_pBuffer); + for (uint32_t i = 0; i < i_buflen; ) + { + i_parser.PrintString(NULL, l_ptr); + i += strlen(l_ptr) + 1; + l_ptr += strlen(l_ptr) + 1; + } + } + +private: + // Disabled + ErrlUserDetailsParserTarget(const ErrlUserDetailsParserTarget &); + ErrlUserDetailsParserTarget & operator=( + const ErrlUserDetailsParserTarget &); +}; + +#endif + +} + +#endif + diff --git a/src/include/usr/errl/errluserdetails.H b/src/include/usr/errl/errluserdetails.H index 7dd052650..75a00c115 100755 --- a/src/include/usr/errl/errluserdetails.H +++ b/src/include/usr/errl/errluserdetails.H @@ -26,51 +26,29 @@ /** * @file errluserdetails.H * - * Error Log User Detail Data Helper + * Defines the ErrlUserDetails and ErrlUserDetailsParser base classes * - * Framework defining how User Detail Data sections of error logs should - * be created and parsed. - * - * Creation methods will show up when the PARSER macro is NOT defined. - * These will compile and run under HostBoot. - * - * Parsing methods will show up when the PARSER macro IS defined. - * These will compile and run in the errl tool. - * -*/ - -// -// @page ErrlUserDetails Error Log User Details -// -// - - -/*****************************************************************************/ -// I n c l u d e s -/*****************************************************************************/ - - -// safe to include these, PARSER or no PARSER -#include <hbotcompid.H> // list of compid's supported -#include <errl/hberrltypes.H> // errlver_t, errlsubsec_t - - - + * Derive a class from ErrlUserDetails to create user detail data + * Derive a class from ErrlUserDetailsParser to parse user detail data + */ +#include <stdint.h> +#include <errl/hberrltypes.H> // errlver_t, errlsubsec_t #ifndef PARSER -#include <errl/errlentry.H> // addFFDC, appendFFDC + +#include <errl/errlentry.H> namespace ERRORLOG { - /** - * @brief ERRL User Data Details - * - * HostBoot Support - base class for Errorlog User Details. + * @class ErrlUserDetails * + * This class creates user detail data. If a component creates user detail data + * then for each different type of data it should derive a class from this. * -*/ + * This class is only compiled when PARSER is not defined. + */ class ErrlUserDetails { public: @@ -80,7 +58,6 @@ public: * * Sets up instance variables. A derived class should set up the instance * variables to reflect a specific format of user detail data - * */ ErrlUserDetails(); @@ -88,82 +65,56 @@ public: * @brief Destructor * * Performs any necessary cleanup - * */ virtual ~ErrlUserDetails(); /** - * @brief Adds or appends more user detail data to error log + * @brief Adds user detail data to an error log * - * Adds or appends user detail data stored in the internal buffer to - * the error log - * Subclasses should override if the detail data is not stored in the + * Adds the user detail data stored in the internal buffer to the error + * log. Subclasses should override if the detail data is not stored in the * internal buffer. * - * @param i_errl - * Error log handle to add detail data to. - * This will call appendFFDC() in the errorlog. - * - * @param i_pappendBuf - * pointer to the new data buffer to append. - * - * @param i_pappendBufLen - * length of the new data buffer to append in bytes. - * - * @return None - * + * @param i_errl Error log handle to add detail data to. */ - virtual void addToLog( - errlHndl_t i_errl, - const void *i_paddBuf=NULL, - const uint32_t i_addBufLen=0 ); + virtual void addToLog(errlHndl_t i_errl); protected: /** * @brief Allocates the internal data buffer for storing detail data * - * If the internal buffer is already allocated then it is freed. The - * data buffer is allocated with the specified size. - * - * @param i_size - * Size of buffer + * If the internal buffer is already allocated then it is reallocated and + * the contents preserved (up to the lesser of the new and old sizes). * - * @return uint8_t* - * Pointer to the data buffer + * @param i_size Size of buffer * + * @return uint8_t* Pointer to the data buffer */ - uint8_t * allocUsrBuf(const uint32_t i_size); + uint8_t * reallocUsrBuf(const uint32_t i_size); /** * @brief Returns the size of the internal data buffer * - * @return uint32_t - * Size of the internal data buffer - * + * @return uint32_t Size of the internal data buffer */ uint32_t getUsrBufSize() const; /** * Protected Data: ID of component adding user details */ - compId_t iv_CompId; + compId_t iv_CompId; /** * Protected Data: Version number of the user details */ - errlver_t iv_Version; + errlver_t iv_Version; /** * Protected Data: Subsection number of the user details */ errlsubsec_t iv_SubSection; - /** - * Pointer to the ErrlFFDC passed back by addFFDC() - */ - ErrlFFDC *iv_pErrlFFDC; - private: // Disabled @@ -176,31 +127,27 @@ private: */ uint8_t * iv_pBuffer; // Pointer to internal buffer uint32_t iv_BufLen; // Length of internal buffer - }; -} // namespace + +} #else // (if PARSER defined) +namespace ERRORLOG +{ + /** * - * @brief Error Log User Detail Data Helper - * - * Framework defining how User Detail Data sections of error logs should - * be created and parsed. + * @class ErrlUserDetailsParser * - * Creation methods will show up when the PARSER macro is NOT defined. - * These will compile and run under HostBoot. + * This is an abstract base class that defines how user detail error log data + * should be parsed. For every different format of user detail data, a + * component should create a class that derives from this class. * - * Parsing methods will show up when the PARSER macro IS defined. - * These will compile and run in the errl tool. + * This is only compiled when PARSER is defined. * */ -namespace ERRORLOG -{ - - -class ErrlUserDetails +class ErrlUserDetailsParser { public: @@ -208,16 +155,15 @@ public: * @brief Constructor * */ - ErrlUserDetails() + ErrlUserDetailsParser() { - } /** * @brief Destructor * */ - virtual ~ErrlUserDetails() + virtual ~ErrlUserDetailsParser() { } @@ -245,19 +191,18 @@ public: */ virtual void parse(errlver_t i_version, ErrlUsrParser & i_parser, - const void * i_pBuffer, + void * i_pBuffer, const uint32_t i_buflen) const = 0; private: // Disabled - ErrlUserDetails(const ErrlUserDetails &); - ErrlUserDetails & operator=(const ErrlUserDetails &); + ErrlUserDetailsParser(const ErrlUserDetailsParser &); + ErrlUserDetailsParser & operator=(const ErrlUserDetailsParser &); }; -} // namespace - - -#endif //PARSER +} #endif +#endif + diff --git a/src/include/usr/errl/hberrltypes.H b/src/include/usr/errl/hberrltypes.H index 3bb767b0c..35b7a0417 100644 --- a/src/include/usr/errl/hberrltypes.H +++ b/src/include/usr/errl/hberrltypes.H @@ -35,31 +35,21 @@ * */ #include <hbotcompid.H> // compId_t +#include <stdint.h> /** * @brief Pointer to an ErrlEntry object */ namespace ERRORLOG { class ErrlEntry; }; - - // Identifiers for Hostboot ERRL user-defined data sections. // Range: 0 .. 255 -enum +enum errlUserDataType_t { - HBERRL_SST_NOFORMAT = 0, - HBERRL_SST_DEFAULT = 0, - HBERRL_VER_DEFAULT = 0, // 0,0 not handled - HBERRL_SST_PRESIDENT = 1, // testing - HBERRL_SST_FIRSTLADY = 2, // testing - HBERRL_SST_STRING = 3, // null-ended string - HBERRL_VER_STRINGNAME = 0, // label: "Name" - HBERRL_VER_STRINGTASK = 1, // label: "Task" - HBERRL_VER_STRINGTASKNAME = 2, // label: "Task name" - HBERRL_VER_STRINGATTRNAME = 3, // label: "Attribute name" - HBERRL_VER_STRINGFILENAME = 4, // label: "File name" - HBERRL_VER_STRINGPROCNAME = 5, // label: "Procedure name" - HBERRL_SST_BACKTRACE = 4, // backtrace + HBERRL_UDT_NOFORMAT = 0, + HBERRL_UDT_STRING = 1, + HBERRL_UDT_TARGET = 2, + HBERRL_UDT_BACKTRACE = 3, }; @@ -294,7 +284,6 @@ enum errlTermState_t enum errlUserDataType_t { ERRL_UDT_TRACE = 0x0C, // A trace buffer - ERRL_UDT_TARGET_FFDC = 0x0D, // A target FFDC buffer }; diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H index 6e812ea5b..df0280f14 100644 --- a/src/include/usr/hbotcompid.H +++ b/src/include/usr/hbotcompid.H @@ -178,23 +178,21 @@ const compId_t SPD_COMP_ID = 0x1000; const char SPD_COMP_NAME[] = "spd"; //@} -/** @name MBOX +/** @name HBMBOX * MBOX component */ //@{ -const compId_t MBOX_COMP_ID = 0x1100; -const char MBOX_COMP_NAME[] = "mbox"; +const compId_t HBMBOX_COMP_ID = 0x1100; +const char HBMBOX_COMP_NAME[] = "mbox"; //@} -/** @name RESERVED - * Reserved component ID. x3100 is the component ID - * of FipS ERRL component. Due to our use of - * of the FipS errl tool, let no Hostboot component - * use this component ID. +/** @name FIPS_ERRL + * Used to add component trace to an error log + * so that it can be decoded by the FSP errlog parser */ //@{ -const compId_t RESERVED_COMP_ID = 0x3100; -const char RESERVED_COMP_NAME[] = "reserved"; +const compId_t FIPS_ERRL_COMP_ID = 0x3100; +const char FIPS_ERRL_COMP_NAME[] = "hb-trace"; // ---------------------------------------------------------- // CXXTEST Unit Test, reserve compid near the end... diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 2fe48948d..9d15c5ef3 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -111,6 +111,11 @@ enum InitServiceReasonCode }; +enum InitServiceUserDetailDataSubSection +{ + INIT_SVC_UDT_ISTEP = 0x01, +}; + }; // namespace INITSERVICE #endif diff --git a/src/include/usr/initservice/initsvcudistep.H b/src/include/usr/initservice/initsvcudistep.H new file mode 100644 index 000000000..9dc8f2106 --- /dev/null +++ b/src/include/usr/initservice/initsvcudistep.H @@ -0,0 +1,139 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/initservice/initsvcudistep.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef INITSVC_UDSTEP_H +#define INITSVC_UDSTEP_H + +/** + * @file initsvcudistep.H + * + * Defines the following classes: + * + * InitSvcUserDetailsIstep: Adds IStep FFDC to an error log as user detail data + * InitSvcUserDetailsParserIstep: Parses IStep FFDC user detail in an error log +*/ + +#include <errl/errluserdetails.H> + +namespace INITSERVICE +{ + +/** + * @struct InitSvcUserDetailsIstepData + * + * Defines the user detail data + */ +struct InitSvcUserDetailsIstepData +{ + uint16_t iv_step; + uint16_t iv_substep; + char iv_pIstepname[0]; +}; + +#ifndef PARSER + +/** + * @class InitSvcUserDetailsIstep + * + * Adds IStep FFDC to an error log as user detail data + */ +class InitSvcUserDetailsIstep : public ERRORLOG::ErrlUserDetails +{ +public: + /** + * @brief Constructor + * + * Captures the supplied IStep FFDC data internally + * + * @param i_pIstepname Istep name + * @param i_step Step number + * @param i_substep Sub-step number + */ + InitSvcUserDetailsIstep(const char * i_pIstepname, + const uint16_t i_step, + const uint16_t i_substep); + + /** + * @brief Destructor + */ + virtual ~InitSvcUserDetailsIstep(); + +private: + // Disabled + InitSvcUserDetailsIstep(const InitSvcUserDetailsIstep &); + InitSvcUserDetailsIstep & operator=(const InitSvcUserDetailsIstep &); +}; + +#else // (if PARSER defined) + +/** + * @class InitSvcUserDetailsParserIstep + * + * Parses Istep user detail in an error log +*/ +class InitSvcUserDetailsParserIstep : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + InitSvcUserDetailsParserIstep() {} + + /** + * @brief Destructor + */ + virtual ~InitSvcUserDetailsParserIstep() {} + + /** + * @brief Parses Istep 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 detail 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 + { + InitSvcUserDetailsIstepData * l_pData = + static_cast<InitSvcUserDetailsIstepData *>(i_pBuffer); + + i_parser.PrintString("IStep name", l_pData->iv_pIstepname); + i_parser.PrintNumber("Step", "%d", ntohs(l_pData->iv_step)); + i_parser.PrintNumber("Sub-step", "%d", ntohs(l_pData->iv_substep)); + } + +private: + // Disabled + InitSvcUserDetailsParserIstep(const InitSvcUserDetailsParserIstep &); + InitSvcUserDetailsParserIstep & operator=( + const InitSvcUserDetailsParserIstep &); +}; + +#endif + +} + +#endif + diff --git a/src/include/usr/initservice/initsvcudparserfactory.H b/src/include/usr/initservice/initsvcudparserfactory.H new file mode 100644 index 000000000..ea1178282 --- /dev/null +++ b/src/include/usr/initservice/initsvcudparserfactory.H @@ -0,0 +1,69 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/initservice/initsvcudparserfactory.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef INITSVC_UDPARSERFACTORY_H +#define INITSVC_UDPARSERFACTORY_H + +#ifdef PARSER + +/** + * @file initsvcudparserfactory.H + * + * Defines the InitSvcUserDetailsParserFactory.H class +*/ +#include <initservice/initsvcudistep.H> +#include <initservice/initsvcreasoncodes.H> +#include <errl/errludparserfactory.H> + +namespace INITSERVICE +{ + +/** + * @class InitSvcUserDetailsParserFactory + * + * This factory produces ErrlUserDetailsParser objects to parse the specified + * InitService user detail data. +*/ +class InitSvcUserDetailsParserFactory : public ERRORLOG::ErrlUserDetailsParserFactory +{ +public: + + /** + * @brief Constructor + */ + InitSvcUserDetailsParserFactory() + { + registerParser<InitSvcUserDetailsParserIstep>(INIT_SVC_UDT_ISTEP); + } + +private: + + // Disabled + InitSvcUserDetailsParserFactory(const InitSvcUserDetailsParserFactory &); + InitSvcUserDetailsParserFactory & operator=( + const InitSvcUserDetailsParserFactory &); +}; + +} + +#endif +#endif diff --git a/src/include/usr/mbox/mbox_reasoncodes.H b/src/include/usr/mbox/mbox_reasoncodes.H index 126eb2f75..0ee58ff58 100644 --- a/src/include/usr/mbox/mbox_reasoncodes.H +++ b/src/include/usr/mbox/mbox_reasoncodes.H @@ -36,10 +36,10 @@ namespace MBOX enum MBOXReasonCode { - RC_INVALID_LENGTH = MBOX_COMP_ID | 0x01, - RC_INVALID_MESSAGE_TYPE = MBOX_COMP_ID | 0x02, - RC_NO_PERM_TO_SEND = MBOX_COMP_ID | 0x03, - RC_MSG_PENDING = MBOX_COMP_ID | 0x04, + RC_INVALID_LENGTH = HBMBOX_COMP_ID | 0x01, + RC_INVALID_MESSAGE_TYPE = HBMBOX_COMP_ID | 0x02, + RC_NO_PERM_TO_SEND = HBMBOX_COMP_ID | 0x03, + RC_MSG_PENDING = HBMBOX_COMP_ID | 0x04, }; }; diff --git a/src/include/usr/targeting/targreasoncodes.H b/src/include/usr/targeting/targreasoncodes.H index 42b14eba5..4e6f1108e 100644 --- a/src/include/usr/targeting/targreasoncodes.H +++ b/src/include/usr/targeting/targreasoncodes.H @@ -29,15 +29,17 @@ namespace TARGETING { enum TargetingModuleId { - TARG_MOD_ATTRRP = 0x01, + TARG_MOD_TEST = 0x01, + TARG_MOD_ATTRRP = 0x02, }; enum TargetingReasonCode { - TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x01, - TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x02, - TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x03, - TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x04, + TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01, + TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02, + TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03, + TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04, + TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05, }; }; |