diff options
author | Mike Jones <mjjones@us.ibm.com> | 2013-01-22 09:41:25 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-02-08 16:49:45 -0600 |
commit | caf328ccd931de4ce4e4d285d1a4e5ddd151abb5 (patch) | |
tree | 650c28362fef4b7fd3d8e727d2b13e25f119434b /src/usr/errl/plugins | |
parent | 7c50ac8fa046052334326fd4f3c8447cb0c9514d (diff) | |
download | talos-hostboot-caf328ccd931de4ce4e4d285d1a4e5ddd151abb5.tar.gz talos-hostboot-caf328ccd931de4ce4e4d285d1a4e5ddd151abb5.zip |
ERRL: Create Hostboot error log SRC/UD parser and deliver to FSP bld
A new script called genErrlParsers will scan the Hostboot code for
error log tags and create a SRC parser for each component. The
script will also scan the Hostboot code for plugin directories
containing User Detail Data parsers and will create a makefile
that is used by the FSP to build each component's SRC/UD parser.
Change-Id: I7113f6cd8069447a1caaa199aff199b663d59072
RTC: 47518
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2975
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/errl/plugins')
-rw-r--r-- | src/usr/errl/plugins/ERRL_COMP_ID_Parse.C | 34 | ||||
-rw-r--r-- | src/usr/errl/plugins/errlParse.C | 67 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludbacktrace.H | 150 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludcallout.H | 83 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludlogregister.H | 83 | ||||
-rwxr-xr-x | src/usr/errl/plugins/errludparser.H | 89 | ||||
-rwxr-xr-x | src/usr/errl/plugins/errludparserfactory.H | 130 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludparserfactoryerrl.H | 76 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludstring.H | 83 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludtarget.H | 251 | ||||
-rwxr-xr-x | src/usr/errl/plugins/errluserdetails.H | 103 | ||||
-rw-r--r-- | src/usr/errl/plugins/fips.mk | 45 | ||||
-rw-r--r-- | src/usr/errl/plugins/makefile | 56 | ||||
-rw-r--r-- | src/usr/errl/plugins/plugins.mk | 35 |
14 files changed, 1082 insertions, 203 deletions
diff --git a/src/usr/errl/plugins/ERRL_COMP_ID_Parse.C b/src/usr/errl/plugins/ERRL_COMP_ID_Parse.C new file mode 100644 index 000000000..1e916b014 --- /dev/null +++ b/src/usr/errl/plugins/ERRL_COMP_ID_Parse.C @@ -0,0 +1,34 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/HBERRL_COMP_ID_Parse.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/* + * @file ERRL_COMP_ID_Parse.C + * + * Creates the ERRL User Detail Data Parser + */ +#include "errludparser.H" +#include "errludparserfactoryerrl.H" + +ERRL_MAKE_UD_PARSER(ERRORLOG::ErrlUserDetailsParserFactoryErrl, + hbfw::ERRL_COMP_ID) + diff --git a/src/usr/errl/plugins/errlParse.C b/src/usr/errl/plugins/errlParse.C deleted file mode 100644 index daefc640c..000000000 --- a/src/usr/errl/plugins/errlParse.C +++ /dev/null @@ -1,67 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/usr/errl/plugins/errlParse.C $ - * - * 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_TAG - */ -/** - * @file initsvcParse.C - * - * errl user detail data and src parser - */ - -//------------------------------------------------------------------------------ -// User detail data parser -//------------------------------------------------------------------------------ -#include "symbols.H" -#include <errl/errludparser.H> -#include <errl/errludparserfactoryerrl.H> -ERRL_MAKE_UD_PARSER(ERRORLOG::ErrlUserDetailsParserFactoryErrl, HBERRL_COMP_ID) - -//------------------------------------------------------------------------------ -// Src parser (call code generated by scanforsrc.pl) -//------------------------------------------------------------------------------ - -// FSP include -#include <srcisrc.H> - -// Hostboot include -#include <hostBootSrcParse.H> - -static bool hbSrcParse( ErrlUsrParser & i_parser, const SrciSrc & i_src ) -{ - uint32_t src = 0; - - sscanf( i_src.getAsciiString(), "%X", &src ); - - // Call this function in obj/genfiles/hostBootSrcParse.H (a script-generated - // file) which serves for any Hostboot component. This will cause - // the FSP errl tool to add the tagged information to the primary SRC - // section of the error log. For example, the developer description - // (devdesc) tag and associated info as well as the other tags describing - // the userdata1 and userdata2 words. - printErrorTags( i_parser, (src & 0xFFFF), i_src.moduleId() ); - - return false; -} - -// Create an instance of SrcPlugin by type (instead of the usual component). -static errl::SrcPlugin g_SrcPlugin( HBERRL_COMP_ID, hbSrcParse ); - diff --git a/src/usr/errl/plugins/errludbacktrace.H b/src/usr/errl/plugins/errludbacktrace.H new file mode 100644 index 000000000..ad60e9c3e --- /dev/null +++ b/src/usr/errl/plugins/errludbacktrace.H @@ -0,0 +1,150 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludbacktrace.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDBACKTRACE_H +#define ERRL_UDBACKTRACE_H + +/** + * @file errludbacktrace.H + * + * Defines the ErrlUserDetailsParserBackTrace class that parses backtrace FFDC + * user detail in an error log + */ + +#include "errluserdetails.H" +#include "symbols.H" +#include <vector> + +namespace ERRORLOG +{ + +/** + * @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 + diff --git a/src/usr/errl/plugins/errludcallout.H b/src/usr/errl/plugins/errludcallout.H new file mode 100644 index 000000000..3346c6487 --- /dev/null +++ b/src/usr/errl/plugins/errludcallout.H @@ -0,0 +1,83 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludcallout.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDCALLOU_H +#define ERRL_UDCALLOU_H + +/** + * @file errludcallout.H + * + * Defines the ErrlUserDetailsParserCallout class that parses + * callout user detail in an error log + */ + +#include "errluserdetails.H" + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsCallout + * + * Parses Callout user detail in an error log + */ +class ErrlUserDetailsParserCallout : public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserCallout() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserCallout() {} + + /** + * @brief Parses callout 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 + { + // TODO fix when parser fixed + // RTC 41707 + } + +private: + // Disabled + ErrlUserDetailsParserCallout(const ErrlUserDetailsParserCallout &); + ErrlUserDetailsParserCallout & operator=( + const ErrlUserDetailsParserCallout &); +}; + +} + +#endif + diff --git a/src/usr/errl/plugins/errludlogregister.H b/src/usr/errl/plugins/errludlogregister.H new file mode 100644 index 000000000..f7f19ae2d --- /dev/null +++ b/src/usr/errl/plugins/errludlogregister.H @@ -0,0 +1,83 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludlogregister.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDLOGREGISTER_H +#define ERRL_UDLOGREGISTER_H + +/** + * @file errludlogregister.H + * + * Defines the ErrlUserDetailsParserLogRegister class that parses register FFDC + * user detail in an error log + */ + +#include "errluserdetails.H" + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsLogRegister + * + * Parses LogRegister user detail in an error log + */ +class ErrlUserDetailsParserLogRegister : public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserLogRegister() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserLogRegister() {} + + /** + * @brief Parses register 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 + { + // TODO fix when parser if fix + // RTC 41707 + } + +private: + // Disabled + ErrlUserDetailsParserLogRegister(const ErrlUserDetailsParserLogRegister &); + ErrlUserDetailsParserLogRegister & operator=( + const ErrlUserDetailsParserLogRegister &); +}; + +} + +#endif + diff --git a/src/usr/errl/plugins/errludparser.H b/src/usr/errl/plugins/errludparser.H new file mode 100755 index 000000000..c3b1f95a8 --- /dev/null +++ b/src/usr/errl/plugins/errludparser.H @@ -0,0 +1,89 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludparser.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDPARSER_H +#define ERRL_UDPARSER_H + +/** + * @file errludparser.H + * + * To create a function that errl calls to parse user detail data, a + * component's plugin/<comp>Parse.C file should include this file and call the + * ERRL_MAKE_UD_PARSER macro + */ + +#include <netinet/in.h> + +/** + * @brief Endian swap a uint64_t. This is not provided by in.h + */ +inline uint64_t ntohll( uint64_t i ) +#if __BYTE_ORDER == __LITTLE_ENDIAN +{ + // CONTEXT_x86_nfp + uint64_t hi; + uint64_t lo; + uint32_t * pword = reinterpret_cast<uint32_t*>(&i); + + hi = ntohl( *pword ); + lo = ntohl( *(pword+1) ); + + return (hi<<32)|lo; +} +#elif __BYTE_ORDER == __BIG_ENDIAN +{ + // CONTEXT_ppc (or maybe CONTEXT_aix_nfp) + return i; +} +#else +#error Unexpected endian context. +#endif + +// FSP includes +#include <errlplugins.H> +#include <errlusrparser.H> +#include "hbfwUdIds.H" + +/** + * @brief Macro that generates a function and plugin object to parse a + * component's error log user detail data + */ +#define ERRL_MAKE_UD_PARSER(FACTORY, COMPID) \ +static bool myDataParse(\ + ErrlUsrParser& i_parser, void* i_buffer, uint32_t i_buflen,\ + errlver_t i_ver, errlsubsec_t i_sst)\ +{\ + bool l_rc = false;\ + FACTORY l_factory;\ + ERRORLOG::ErrlUserDetailsParser * l_pParser =\ + l_factory.createParser(i_sst);\ + if (l_pParser)\ + {\ + l_rc = true;\ + l_pParser->parse(i_ver, i_parser, i_buffer, i_buflen);\ + }\ + return l_rc;\ +}\ +static errl::DataPlugin g_DataPlugin(COMPID, myDataParse); + +#endif + diff --git a/src/usr/errl/plugins/errludparserfactory.H b/src/usr/errl/plugins/errludparserfactory.H new file mode 100755 index 000000000..50df87623 --- /dev/null +++ b/src/usr/errl/plugins/errludparserfactory.H @@ -0,0 +1,130 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludparserfactory.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDPARSERFACTORY_H +#define ERRL_UDPARSERFACTORY_H + +/** + * @file errludparserfactory.H + * + * Defines the ErrlUserDetailsParserFactory base class + */ +#include "errluserdetails.H" +#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. + */ +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 + diff --git a/src/usr/errl/plugins/errludparserfactoryerrl.H b/src/usr/errl/plugins/errludparserfactoryerrl.H new file mode 100644 index 000000000..5fffc1a98 --- /dev/null +++ b/src/usr/errl/plugins/errludparserfactoryerrl.H @@ -0,0 +1,76 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludparserfactoryerrl.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDPARSERFACTORYERRL_H +#define ERRL_UDPARSERFACTORYERRL_H + +/** + * @file errludparserfactoryerrl.H + * + * Defines the errlUserDetailsParserFactoryErrl.H class +*/ +#include "errludparserfactory.H" +#include "errludstring.H" +#include "errludtarget.H" +#include "errludbacktrace.H" +#include "errludattribute.H" +#include "errludlogregister.H" +#include "errludcallout.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>(ERRL_UDT_STRING); + registerParser<ErrlUserDetailsParserTarget>(ERRL_UDT_TARGET); + registerParser<ErrlUserDetailsParserBackTrace>(ERRL_UDT_BACKTRACE); + registerParser<ErrlUserDetailsParserAttribute>(ERRL_UDT_ATTRIBUTE); + registerParser<ErrlUserDetailsParserLogRegister>(ERRL_UDT_LOGREGISTER); + registerParser<ErrlUserDetailsParserCallout>(ERRL_UDT_CALLOUT); + } + +private: + + // Disabled + ErrlUserDetailsParserFactoryErrl(const ErrlUserDetailsParserFactoryErrl &); + ErrlUserDetailsParserFactoryErrl & operator=( + const ErrlUserDetailsParserFactoryErrl &); +}; + +} + +#endif + diff --git a/src/usr/errl/plugins/errludstring.H b/src/usr/errl/plugins/errludstring.H new file mode 100644 index 000000000..f12281c16 --- /dev/null +++ b/src/usr/errl/plugins/errludstring.H @@ -0,0 +1,83 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludstring.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDSTRING_H +#define ERRL_UDSTRING_H + +/** + * @file errludstring.H + * + * Defines the ErrlUserDetailsParserString class that parser string FFDC + * user detail in an error log + */ + +#include "errluserdetails.H" +#include <string.h> + +namespace ERRORLOG +{ + +/** + * @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 + diff --git a/src/usr/errl/plugins/errludtarget.H b/src/usr/errl/plugins/errludtarget.H new file mode 100644 index 000000000..61a4d8cf9 --- /dev/null +++ b/src/usr/errl/plugins/errludtarget.H @@ -0,0 +1,251 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludtarget.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDTARGET_H +#define ERRL_UDTARGET_H + +/** + * @file errludTarget.H + * + * Defines the ErrlUserDetailsParserTarget class that parses Target FFDC + * user detail in an error log + */ + +#include "errluserdetails.H" +#include <string.h> + +namespace ERRORLOG +{ + +/** + * @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); + const char *attrData; + uint32_t i = 0; + + // errlog data + uint8_t *l_ptr = static_cast<uint8_t *>(i_pBuffer); + + // TODO: needs to be updated to handle merged records + + if (*l_ptr == 1) // special - master + { + i_parser.PrintString(NULL, "MASTER_PROCESSOR_CHIP_TARGET_SENTINEL"); + } + else + { + l_ptr += sizeof(uint8_t); // past the marker + + // first 4 are always the same + if (i_buflen >= sizeof(uint32_t) + 3 * sizeof(uint8_t)) + { + char sHuid[12]; + sprintf(sHuid, "0x%x",*((uint32_t *)l_ptr)); + i_parser.PrintString("ATTR_HUID", sHuid); + i += sizeof(uint32_t); + l_ptr += sizeof(uint32_t); + + // CLASS + switch (*l_ptr) { + case 0x00: { attrData = "CLASS_NA"; break; } + case 0x01: { attrData = "CLASS_CARD"; break; } + case 0x02: { attrData = "CLASS_ENC"; break; } + case 0x03: { attrData = "CLASS_CHIP"; break; } + case 0x04: { attrData = "CLASS_UNIT"; break; } + case 0x05: { attrData = "CLASS_DEV"; break; } + case 0x06: { attrData = "CLASS_SYS"; break; } + case 0x07: { attrData = "CLASS_LOGICAL_CARD"; break; } + case 0x08: { attrData = "CLASS_MAX"; break; } + default: { attrData = "UNKNOWN CLASS"; break; } + } // switch + i_parser.PrintString("ATTR_CLASS", attrData); + i ++; + l_ptr ++; + + // TYPE + switch (*l_ptr) { + // TODO: RTC 50828: make these build-time dynamic based + // on values in obj/genfiles/attributeenums.H + case 0x00: { attrData = "TYPE_NA"; break; } + case 0x01: { attrData = "TYPE_SYS"; break; } + case 0x02: { attrData = "TYPE_NODE"; break; } + case 0x03: { attrData = "TYPE_DIMM"; break; } + case 0x04: { attrData = "TYPE_MEMBUF"; break; } + case 0x05: { attrData = "TYPE_PROC"; break; } + case 0x06: { attrData = "TYPE_EX"; break; } + case 0x07: { attrData = "TYPE_CORE"; break; } + case 0x08: { attrData = "TYPE_L2"; break; } + case 0x09: { attrData = "TYPE_L3"; break; } + case 0x0A: { attrData = "TYPE_L4"; break; } + case 0x0B: { attrData = "TYPE_MCS"; break; } + case 0x0C: { attrData = "TYPE_MBS"; break; } + case 0x0D: { attrData = "TYPE_MBA"; break; } + case 0x0E: { attrData = "TYPE_XBUS"; break; } + case 0x0F: { attrData = "TYPE_ABUS"; break; } + case 0x10: { attrData = "TYPE_PCI"; break; } + case 0x11: { attrData = "TYPE_DPSS"; break; } + case 0x12: { attrData = "TYPE_APSS"; break; } + case 0x13: { attrData = "TYPE_OCC"; break; } + case 0x14: { attrData = "TYPE_PSI"; break; } + case 0x15: { attrData = "TYPE_FSP"; break; } + case 0x16: { attrData = "TYPE_PNOR"; break; } + case 0x17: { attrData = "TYPE_LAST_IN_RANGE"; break; } + default: { attrData = "UNKNOWN TYPE"; break; } + } // switch + i_parser.PrintString("ATTR_TYPE", attrData); + i++; + l_ptr++; + + // MODEL + switch (*l_ptr) { + // TODO: RTC 50828: make these build-time dynamic based + // on values in obj/genfiles/attributeenums.H + case 0x00: { attrData = "MODEL_NA"; break; } + case 0x10: { attrData = "MODEL_RESERVED"; break; } + case 0x11: { attrData = "MODEL_VENICE"; break; } + case 0x12: { attrData = "MODEL_MURANO"; break; } + case 0x30: { attrData = "MODEL_CENTAUR"; break; } + case 0x50: { attrData = "MODEL_JEDEC"; break; } + case 0x51: { attrData = "MODEL_CDIMM"; break; } + case 0x70: { attrData = "MODEL_POWER8"; break; } + default: { attrData = "UNKNOWN MODEL"; break; } + } // switch + i_parser.PrintString("ATTR_MODEL", attrData); + i++; + l_ptr++; + } + +// TODO RTC 50828 The following for loop hangs +#if 0 + for (; i < i_buflen; ) + { + if ((*l_ptr == 0x15) || // ATTR_PHYS_PATH + (*l_ptr == 0x16)) // ATTR_AFFINITY_PATH + { + l_ptr++; + const char *pathString; + char outString[128]; + // from targeting/common/entitypath.[CH] + // entityPath is PATH_TYPE:4, NumberOfElements:4, + // [Element, Instance#] + // PATH_TYPE + const uint8_t pathTypeLength = *((uint8_t *)l_ptr); + l_ptr++; + const uint8_t pathType = (pathTypeLength & 0xF0) >> 4; + switch (pathType) { + case 0x01: pathString = "Logical:"; break; + case 0x02: pathString = "Physical:"; break; + case 0x03: pathString = "Device:"; break; + case 0x04: pathString = "Power:"; break; + default: pathString = "Unknown:"; break; + } + uint32_t dataSize = sprintf(outString, "%s",pathString); + const uint8_t pathSize = (pathTypeLength & 0x0F); + uint8_t *lElementInstance = ((uint8_t *)l_ptr); + l_ptr += pathSize * sizeof(uint8_t); + for (uint32_t j=0;j<pathSize;j += 2) { + switch (lElementInstance[j]) { + // TODO: RTC 50828: make these build-time dynamic based + // on values in obj/genfiles/attributeenums.H + case 0x01: pathString = "/Sys"; break; + case 0x02: pathString = "/Node"; break; + case 0x03: pathString = "/DIMM"; break; + case 0x04: pathString = "/Membuf"; break; + case 0x05: pathString = "/Proc"; break; + case 0x06: pathString = "/EX"; break; + case 0x07: pathString = "/Core"; break; + case 0x08: pathString = "/L2"; break; + case 0x09: pathString = "/L3"; break; + case 0x0A: pathString = "/L4"; break; + case 0x0B: pathString = "/MCS"; break; + case 0x0C: pathString = "/MBS"; break; + case 0x0D: pathString = "/MBA"; break; + case 0x0E: pathString = "/XBUS"; break; + case 0x0F: pathString = "/ABUS"; break; + case 0x10: pathString = "/PCI"; break; + case 0x11: pathString = "/DPSS"; break; + case 0x12: pathString = "/APSS"; break; + case 0x13: pathString = "/OCC"; break; + case 0x14: pathString = "/PSI"; break; + case 0x15: pathString = "/FSP"; break; + case 0x16: pathString = "/PNOR"; break; + default: pathString = "/Unknown"; break; + } // switch + // copy next part in, overwritting previous terminator + dataSize += sprintf(outString + dataSize, + "%s%d", pathString, + lElementInstance[j+1]); + } // for + if (*l_ptr == 0x15) // ATTR_PHYS_PATH + { + i_parser.PrintString("ATTR_PHYS_PATH", outString); + } + else + { + i_parser.PrintString("ATTR_AFFINITY_PATH", outString); + } + } + } // for +#endif + } + } // parse() + +private: + // Disabled + ErrlUserDetailsParserTarget(const ErrlUserDetailsParserTarget &); + ErrlUserDetailsParserTarget & operator=( + const ErrlUserDetailsParserTarget &); +}; + +} + +#endif + diff --git a/src/usr/errl/plugins/errluserdetails.H b/src/usr/errl/plugins/errluserdetails.H new file mode 100755 index 000000000..12efbc28b --- /dev/null +++ b/src/usr/errl/plugins/errluserdetails.H @@ -0,0 +1,103 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errluserdetails.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* */ +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_ERRLUSERDETAILS_H +#define ERRL_ERRLUSERDETAILS_H + +/** + * @file errluserdetails.H + * + * Defines the ErrlUserDetailsParser base class + * + * For each class derived from ErrlUserDetails used to create user detail data, + * derive a class from ErrlUserDetailsParser to parse user detail data + */ +#include <stdint.h> + +namespace ERRORLOG +{ + +/** + * + * @class ErrlUserDetailsParser + * + * 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. + */ +class ErrlUserDetailsParser +{ +public: + + /** + * @brief Constructor + * + */ + ErrlUserDetailsParser() + { + } + + /** + * @brief Destructor + * + */ + virtual ~ErrlUserDetailsParser() + { + } + + /** + * @brief Parses user detail data from an error log + * + * Parses the supplied user detail data and outputs info to i_parser. This + * is a pure virtual function that must be overridden by a concrete derived + * class that is specific to a particular component, version and subsection + * + * @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, + void * i_pBuffer, + const uint32_t i_buflen) const = 0; + +private: + + // Disabled + ErrlUserDetailsParser(const ErrlUserDetailsParser &); + ErrlUserDetailsParser & operator=(const ErrlUserDetailsParser &); +}; + +} +#endif + diff --git a/src/usr/errl/plugins/fips.mk b/src/usr/errl/plugins/fips.mk deleted file mode 100644 index 1db670df3..000000000 --- a/src/usr/errl/plugins/fips.mk +++ /dev/null @@ -1,45 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/errl/plugins/fips.mk $ -# -# 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 - -# This is a FipS makefile. The 'hb errlparser' step will copy it -# to a FipS build tree and assign a value for HBCOMPS as it is copied. - - -.if ( $(CONTEXT) == "x86.nfp" || $(CONTEXT) == "ppc" ) - -EXPINC_SUBDIRS = $(HBCOMPS) -EXPLIB_SUBDIRS = $(HBCOMPS) -OBJECTS_SUBDIRS = $(HBCOMPS) -SUBDIRS = $(HBCOMPS) -EXPSHLIB_SUBDIRS = $(HBCOMPS) - -.elif ( $(CONTEXT) == "aix.nfp" ) - -EXPINC_SUBDIRS = -EXPLIB_SUBDIRS = -OBJECTS_SUBDIRS = -SUBDIRS = -EXPSHLIB_SUBDIRS = -.endif - -.include <${RULES_MK}> diff --git a/src/usr/errl/plugins/makefile b/src/usr/errl/plugins/makefile deleted file mode 100644 index 8bb94fb91..000000000 --- a/src/usr/errl/plugins/makefile +++ /dev/null @@ -1,56 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/errl/plugins/errl/makefile $ -# -# 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 - - -# This is a FipS makefile. This file and C sources will be built -# in a FipS tree. - -# All Hostboot plugins/makefile should .include ../plugins.mk -.include "../plugins.mk" - - -ERRL_PLUGIN = libB-0100 -ERRL_OBJS = errlParse.o symbols.o - - -CFLAGS += -O0 - -.if ( $(CONTEXT) == "x86.nfp" ) - -LIBRARIES = ${ERRL_PLUGIN}.a -EXPLIBS = ${ERRL_PLUGIN}.a -${ERRL_PLUGIN}.a_OFILES = ${ERRL_OBJS} - -.else - -BUILD_SHARED_OBJS = -SHARED_LIBRARIES EXPSHLIBS = ${ERRL_PLUGIN}.so -${ERRL_PLUGIN}.so_EXTRA_LIBS = libbase.so - -${ERRL_PLUGIN}.so_SHLDFLAGS += ${SHLDFLAGS} -Wl,-soname,${.TARGET} - -${ERRL_PLUGIN}.so_OFILES = ${ERRL_OBJS} - -.endif - -.include <${RULES_MK}> diff --git a/src/usr/errl/plugins/plugins.mk b/src/usr/errl/plugins/plugins.mk deleted file mode 100644 index fd1d90b2a..000000000 --- a/src/usr/errl/plugins/plugins.mk +++ /dev/null @@ -1,35 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/errl/plugins/plugins.mk $ -# -# 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 - -# This is a FipS makefile. It will be copied to the directory above -# the directories for Hostboot components that build an errl plugin. - -# Hostboot plugin makefiles should include this makefile with -# .include "../plugins.mk" -# in order to set CFLAGS. Eventually, there may be other global -# settings common to all Hostboot makefiles. This makefile -# provides a common place for such changes. - - -CFLAGS += -DERRL_TOOLS -DPARSER -I${HOSTBOOTROOT}/obj/genfiles -I${HOSTBOOTROOT}/src/include/usr - |