diff options
-rw-r--r-- | src/include/usr/errl/errlentry.H | 4 | ||||
-rwxr-xr-x | src/include/usr/errl/errludparser.H | 91 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiErrorInfo.H | 49 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCode.H | 16 | ||||
-rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatReasonCodes.H | 26 | ||||
-rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H | 71 | ||||
-rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H | 172 | ||||
-rw-r--r-- | src/usr/errl/plugins/errlParse.C | 79 | ||||
-rw-r--r-- | src/usr/errl/test/errltest.H | 2 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiErrorInfo.C | 35 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 19 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/fapiHwpErrorInfo.xml | 9 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatHwpInvoker.C | 31 | ||||
-rw-r--r-- | src/usr/hwpf/plugins/hwpfParse.C | 31 | ||||
-rw-r--r-- | src/usr/hwpf/plugins/makefile | 47 | ||||
-rw-r--r-- | src/usr/hwpf/test/hwpftest.H | 4 | ||||
-rw-r--r-- | src/usr/initservice/plugins/initsvcParse.C | 36 |
17 files changed, 543 insertions, 179 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 1b71aa39d..de63212a1 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -302,8 +302,8 @@ public: ErrlUD * addFFDC(const compId_t i_compId, const void * i_dataPtr, const uint32_t i_ffdcLen, - const uint8_t i_ffdcVer = 0, - const uint8_t i_ffdcSubSect = 0); + const uint8_t i_ffdcVer, + const uint8_t i_ffdcSubSect); /** * @brief Append more data to an FFDC section. diff --git a/src/include/usr/errl/errludparser.H b/src/include/usr/errl/errludparser.H new file mode 100755 index 000000000..e80a3d9c8 --- /dev/null +++ b/src/include/usr/errl/errludparser.H @@ -0,0 +1,91 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/errl/errludparser.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_UDPARSER_H +#define ERRL_UDPARSER_H + +#ifdef PARSER + +/** + * @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> + +/** + * @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 +#endif + diff --git a/src/include/usr/hwpf/fapi/fapiErrorInfo.H b/src/include/usr/hwpf/fapi/fapiErrorInfo.H index 59f9d8b28..73512f5d0 100644 --- a/src/include/usr/hwpf/fapi/fapiErrorInfo.H +++ b/src/include/usr/hwpf/fapi/fapiErrorInfo.H @@ -33,6 +33,8 @@ * mjjones 08/09/2011 Created. * mjjones 08/24/2011 Added ErrorInfoGard. * mjjones 09/22/2011 Major updates + * mjjones 03/16/2012 Add FfdcType. Remove copy + * ctor and assignment operator */ #ifndef FAPIERRORINFO_H_ @@ -46,6 +48,19 @@ namespace fapi { /** + * @enum FfdcType + * + * This enumeration defines the possible types of FFDC data + */ +enum FfdcType +{ + FFDC_TYPE_NONE = 0, + FFDC_TYPE_TARGET = 1, // FFDC data is a Target ecmd-string + FFDC_TYPE_ECMDDBB = 2, // FFDC data is the contents of an ecmdDataBaseBuffer + FFDC_TYPE_DATA = 3, // FFDC data is just raw data +}; + +/** * @class ErrorInfoFfdc * * This class contains a copy of some FFDC data @@ -58,16 +73,11 @@ public: * * @param[in] i_pFfdc Pointer to the FFDC to copy * @param[in] i_size Size of the FFDC to copy + * @param[in] i_type Type of the FFDC to copy */ ErrorInfoFfdc(const void * i_pFfdc, - const uint32_t i_size); - - /** - * @brief Copy Constructor - * - * @param[in] i_right Reference to ErrorInfoFfdc to copy from - */ - ErrorInfoFfdc(const ErrorInfoFfdc & i_right); + const uint32_t i_size, + const FfdcType i_type); /** * @brief Destructor @@ -75,15 +85,6 @@ public: ~ErrorInfoFfdc(); /** - * @brief Assignment Operator - * - * @param[in] i_right Reference to ErrorInfoFfdc to assign from - * - * @return ErrorInfoFfdc &. Reference to this ErrorInfoFfdc - */ - ErrorInfoFfdc & operator=(const ErrorInfoFfdc & i_right); - - /** * @brief Get a pointer to the FfdcData * * @param[out] o_size Reference to uint32_t that is filled in with the FFDC @@ -93,6 +94,13 @@ public: */ const void * getData(uint32_t & o_size) const; + /** + * @brief Get the FfdcData type + * + * @return FfdcType. FFDC type + */ + FfdcType getType() const; + private: // Pointer to the FFDC @@ -100,6 +108,13 @@ private: // Size of the FFDC uint32_t iv_size; + + // Type of the FFDC + FfdcType iv_type; + + // Disabled + ErrorInfoFfdc(const ErrorInfoFfdc &); + ErrorInfoFfdc & operator=(const ErrorInfoFfdc &); }; /** diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H index 504e82c9a..34271c1a9 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCode.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H @@ -40,6 +40,7 @@ * mjjones 11/10/2011 Use ecmdDataBufferBase * mjjones 01/12/2012 Enforce correct usage * mjjones 02/22/2012 Allow user to add Target FFDC + * mjjones 03/16/2012 Add type to FFDC data */ #ifndef FAPIRETURNCODE_H_ @@ -296,15 +297,14 @@ public: * This is called by: * - addErrorInfo * - ReturnCodeFfdc::addEIFfdc (function template) - * - FFDC HWPs (HWPs written to collect FFDC) - * - * Use ReturnCodeFfdc::addEIFfdc to add FFDC data using the data identifier * * @param[in] i_pFfdc Pointer to the FFDC to copy * @param[in] i_size Size of the FFDC to copy + * @param[in] i_type Type of the FFDC to copy */ void addEIFfdc(const void * i_pFfdc, - const uint32_t i_size); + const uint32_t i_size, + const FfdcType i_type); /** * @brief Get a pointer to any ErrorInfo @@ -464,7 +464,7 @@ namespace ReturnCodeFfdc void addEIFfdc(ReturnCode & o_rc, const T & i_ffdc) { - o_rc.addEIFfdc(&i_ffdc, sizeof(T)); + o_rc.addEIFfdc(&i_ffdc, sizeof(T), FFDC_TYPE_DATA); } /** @@ -485,7 +485,8 @@ namespace ReturnCodeFfdc // Deliberately not checking return code from extract to save code space i_ffdc.extract(l_pData, 0, i_ffdc.getBitLength()); - o_rc.addEIFfdc(l_pData, (i_ffdc.getWordLength() * 4)); + o_rc.addEIFfdc(l_pData, (i_ffdc.getWordLength() * 4), + FFDC_TYPE_ECMDDBB); delete [] l_pData; } @@ -500,7 +501,8 @@ namespace ReturnCodeFfdc const fapi::Target & i_ffdc) { const char * l_ecmdString = i_ffdc.toEcmdString(); - o_rc.addEIFfdc(l_ecmdString, (strlen(l_ecmdString) + 1)); + o_rc.addEIFfdc(l_ecmdString, (strlen(l_ecmdString) + 1), + FFDC_TYPE_TARGET); } /** diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H index 9afc348fc..5d37d1ad5 100644 --- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H +++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H @@ -27,6 +27,9 @@ namespace fapi { + /** + * @brief Defines the HWPF::PLAT error log module IDs + */ enum hwpfModuleId { // HWP generated errors @@ -47,11 +50,14 @@ namespace fapi }; - // Note that for HWP generated errors (MOD_HWP_RC_TO_ERRL), the - // reason code is in the generated fapiHwpReasonCodes.H file - + /** + * @brief Defines the HWPF::PLAT error log reason codes + */ enum hwpfReasonCode { + // Note that for HWP generated errors (MOD_HWP_RC_TO_ERRL), the + // reason code is in the generated fapiHwpReasonCodes.H file + // FAPI generated errors (see fapiReturnCodes.H) RC_INVALID_ATTR_GET = HWPF_COMP_ID | 0x01, @@ -65,9 +71,20 @@ namespace fapi RC_ATTR_BASE_BAD_PARAM = HWPF_COMP_ID | 0x16, RC_INVALID_NUM_PARENT_CHIP = HWPF_COMP_ID | 0x17, }; + + /** + * @brief Defines the HWPF::PLAT (Hostboot) error log user detail data + * sections + */ + enum hwpfUserDetailDataSubSection + { + HWPF_UDT_HWP_TARGET = 1, + HWPF_UDT_HWP_ECMDDBB = 2, + HWPF_UDT_HWP_DATA = 3, + }; }; -// HostBoot ErrorLog tags for FAPI errors +// HostBoot ErrorLog tags for FAPI errors (see fapiReturnCodes.H) /*@ * @errortype * @moduleid MOD_FAPI_RC_TO_ERRL @@ -75,5 +92,4 @@ namespace fapi * @devdesc InitFile HW Procedure requested an invalid attribute */ - #endif diff --git a/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H b/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H new file mode 100644 index 000000000..e9db032a4 --- /dev/null +++ b/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H @@ -0,0 +1,71 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/plat/fapiPlatUdParserFactory.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 FAPIPLATUDPARSERFACTORY_H +#define FAPIPLATUDPARSERFACTORY_H + +#ifdef PARSER + +/** + * @file fapiPlatHwpUdDecode.H + * + * Defines the PlatUserDetailsParserFactory class + */ +#include <hwpf/plat/fapiPlatUdParserHwp.H> +#include <hwpf/plat/fapiPlatReasonCodes.H> +#include <errl/errludparserfactory.H> + +namespace fapi +{ + +/** + * @class PlatUserDetailsParserFactory + * + * This factory produces ErrlUserDetailsParser objects to parse the specified + * PLAT user detail data. +*/ +class PlatUserDetailsParserFactory : public ERRORLOG::ErrlUserDetailsParserFactory +{ +public: + + /** + * @brief Constructor + */ + PlatUserDetailsParserFactory() + { + registerParser<PlatUserDetailsParserHwpTarget>(HWPF_UDT_HWP_TARGET); + registerParser<PlatUserDetailsParserHwpEcmddbb>(HWPF_UDT_HWP_ECMDDBB); + registerParser<PlatUserDetailsParserHwpData>(HWPF_UDT_HWP_DATA); + } + +private: + // Disabled + PlatUserDetailsParserFactory(const PlatUserDetailsParserFactory &); + PlatUserDetailsParserFactory & operator=( + const PlatUserDetailsParserFactory &); +}; + +} + +#endif +#endif + diff --git a/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H b/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H new file mode 100644 index 000000000..a5b3e8190 --- /dev/null +++ b/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H @@ -0,0 +1,172 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/plat/fapiPlatUdParserHwp.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 FAPIPLATUDPARSERHWP_H +#define FAPIPLATUDPARSERHWP_H + +#ifdef PARSER + +/** + * @file fapiPlatUdParserHwp.H + * + * Defines ErrlUserDetailsParser subclasses to parse the different types of HWP + * FFDC added as user detail data to an error log. + * + * Note that there are no corresponding ErrlUserDetails subclasses to create + * the user detail data because it is created by the platform neutral + * fapi::ReturnCode + */ +#include <errl/errluserdetails.H> + +namespace fapi +{ + +/** + * @class PlatUserDetailsParserHwpTarget + * + * Parses HWP target string user detail in an error log. + */ +class PlatUserDetailsParserHwpTarget : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + PlatUserDetailsParserHwpTarget() {} + + /** + * @brief Destructor + */ + virtual ~PlatUserDetailsParserHwpTarget() {} + + /** + * @brief Parses HWP target string user detail in 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 ecmd string", static_cast<char *>(i_pBuffer)); + } + +private: + // Disabled + PlatUserDetailsParserHwpTarget(const PlatUserDetailsParserHwpTarget &); + PlatUserDetailsParserHwpTarget & operator=( + const PlatUserDetailsParserHwpTarget &); +}; + +/** + * @class PlatUserDetailsParserHwpEcmddbb + * + * Parses HWP ecmdDataBufferBase user detail in an error log. +*/ +class PlatUserDetailsParserHwpEcmddbb : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + PlatUserDetailsParserHwpEcmddbb() {} + + /** + * @brief Destructor + */ + virtual ~PlatUserDetailsParserHwpEcmddbb() {} + + /** + * @brief Parses HWP ecmdDataBufferBase user detail in 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("ecmd data buffer data", NULL); + i_parser.PrintHexDump(i_pBuffer, i_buflen); + } + +private: + // Disabled + PlatUserDetailsParserHwpEcmddbb(const PlatUserDetailsParserHwpEcmddbb &); + PlatUserDetailsParserHwpEcmddbb & operator=( + const PlatUserDetailsParserHwpEcmddbb &); +}; + +/** + * @class PlatUserDetailsParserHwpData + * + * Parses HWP raw data user detail in an error log. +*/ +class PlatUserDetailsParserHwpData : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + PlatUserDetailsParserHwpData() {} + + /** + * @brief Destructor + */ + virtual ~PlatUserDetailsParserHwpData() {} + + /** + * @brief Parses HWP raw data user detail in 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("HWP FFDC data", NULL); + i_parser.PrintHexDump(i_pBuffer, i_buflen); + } + +private: + // Disabled + PlatUserDetailsParserHwpData(const PlatUserDetailsParserHwpData &); + PlatUserDetailsParserHwpData & operator=( + const PlatUserDetailsParserHwpData &); +}; + +} + +#endif +#endif + diff --git a/src/usr/errl/plugins/errlParse.C b/src/usr/errl/plugins/errlParse.C index bd859ad42..8e5005e34 100644 --- a/src/usr/errl/plugins/errlParse.C +++ b/src/usr/errl/plugins/errlParse.C @@ -24,79 +24,26 @@ /** * @file initsvcParse.C * - * errl user data parser + * errl user detail data and src parser */ -#include <netinet/in.h> -// FSP includes -#include <errlplugins.H> -#include <errlusrparser.H> -#include <srcisrc.H> - -// Hostboot includes. -#include <hbotcompid.H> -#include <hostBootSrcParse.H> +//------------------------------------------------------------------------------ +// User detail data parser +//------------------------------------------------------------------------------ #include "symbols.H" - -//------------------------------------------------------------- -// endian switch a uint64 -// TODO all plugins are probably going to want this. - -static 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 - +#include <errl/errludparser.H> #include <errl/errludparserfactoryerrl.H> +ERRL_MAKE_UD_PARSER(ERRORLOG::ErrlUserDetailsParserFactoryErrl, HBERRL_COMP_ID) -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; +//------------------------------------------------------------------------------ +// Src parser (call code generated by scanforsrc.pl) +//------------------------------------------------------------------------------ - // Create a ErrlUserDetailsParserFactoryErrl object - ERRORLOG::ErrlUserDetailsParserFactoryErrl l_factory; - - // Use the factory to create a ErrlUserDetailsParser object - 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; -} - -// Map my Hostboot component ID to the function above. -// static errl::DataPlugin g_DataPlugin( HBERRL_COMP_ID, hberrl_DataParse ); -static errl::DataPlugin g_DataPlugin( HBERRL_COMP_ID, myDataParse ); +// FSP include +#include <srcisrc.H> -//---------------------------------------------------------------------------- -// Call the code generated by scanforsrc.pl +// Hostboot include +#include <hostBootSrcParse.H> static bool hbSrcParse( ErrlUsrParser & i_parser, const SrciSrc & i_src ) { diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H index 8075ed232..9fbc02fcc 100644 --- a/src/usr/errl/test/errltest.H +++ b/src/usr/errl/test/errltest.H @@ -125,7 +125,7 @@ public: // really short user data const char * pch = "A"; - pffdc = l_err->addFFDC( DEVFW_COMP_ID, pch, strlen( pch )); + pffdc = l_err->addFFDC( DEVFW_COMP_ID, pch, strlen( pch ), 0, 0); if ( NULL == pffdc ) { TS_FAIL("testErrl1: addFFDC() output NULL pointer"); diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C index f052c8b70..7bc25a058 100644 --- a/src/usr/hwpf/fapi/fapiErrorInfo.C +++ b/src/usr/hwpf/fapi/fapiErrorInfo.C @@ -33,6 +33,8 @@ * mjjones 08/05/2011 Created * mjjones 08/24/2011 Added ErrorInfoGard. * mjjones 09/22/2011 Major updates + * mjjones 03/16/2012 Add FfdcType. Remove copy + * ctor and assignment operator */ #include <fapiErrorInfo.H> @@ -45,24 +47,15 @@ namespace fapi // ErrorInfoFfdc Constructor //****************************************************************************** ErrorInfoFfdc::ErrorInfoFfdc(const void * i_pFfdc, - const uint32_t i_size) -: iv_size(i_size) + const uint32_t i_size, + const FfdcType i_type) +: iv_size(i_size), iv_type(i_type) { iv_pFfdc = new uint8_t[i_size]; memcpy(iv_pFfdc, i_pFfdc, i_size); } //****************************************************************************** -// ErrorInfoFfdc Copy Constructor -//****************************************************************************** -ErrorInfoFfdc::ErrorInfoFfdc(const ErrorInfoFfdc & i_right) -: iv_size(i_right.iv_size) -{ - iv_pFfdc = new uint8_t[i_right.iv_size]; - memcpy(iv_pFfdc, i_right.iv_pFfdc, i_right.iv_size); -} - -//****************************************************************************** // ErrorInfoFfdc Destructor //****************************************************************************** ErrorInfoFfdc::~ErrorInfoFfdc() @@ -72,24 +65,20 @@ ErrorInfoFfdc::~ErrorInfoFfdc() } //****************************************************************************** -// ErrorInfoFfdc Assignment Operator +// ErrorInfoFfdc getData function //****************************************************************************** -ErrorInfoFfdc & ErrorInfoFfdc::operator=(const ErrorInfoFfdc & i_right) +const void * ErrorInfoFfdc::getData(uint32_t & o_size) const { - delete [] iv_pFfdc; - iv_pFfdc = new uint8_t[i_right.iv_size]; - memcpy(iv_pFfdc, i_right.iv_pFfdc, i_right.iv_size); - iv_size = i_right.iv_size; - return *this; + o_size = iv_size; + return iv_pFfdc; } //****************************************************************************** -// ErrorInfoFfdc getData function +// ErrorInfoFfdc getType function //****************************************************************************** -const void * ErrorInfoFfdc::getData(uint32_t & o_size) const +FfdcType ErrorInfoFfdc::getType() const { - o_size = iv_size; - return iv_pFfdc; + return iv_type; } //****************************************************************************** diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C index 2de1f8e13..a8e13cabc 100644 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ b/src/usr/hwpf/fapi/fapiReturnCode.C @@ -41,6 +41,7 @@ * mjjones 09/22/2011 Added ErrorInfo Support * mjjones 01/12/2012 Enforce correct usage * mjjones 02/22/2012 Allow user to add Target FFDC + * mjjones 03/16/2012 Add type to FFDC data */ #include <fapiReturnCode.H> @@ -65,7 +66,10 @@ ReturnCode::ReturnCode() : ReturnCode::ReturnCode(const ReturnCodes i_rcValue) : iv_rcValue(i_rcValue), iv_pDataRef(NULL) { - + if (i_rcValue != FAPI_RC_SUCCESS) + { + FAPI_ERR("ctor: Creating error 0x%x", i_rcValue); + } } //****************************************************************************** @@ -151,6 +155,7 @@ ReturnCode::operator uint32_t() const //****************************************************************************** void ReturnCode::setFapiError(const ReturnCodes i_rcValue) { + FAPI_ERR("setFapiError: Creating FAPI error 0x%x", i_rcValue); iv_rcValue = i_rcValue; // Forget about any associated data (this is a new error) @@ -162,6 +167,7 @@ void ReturnCode::setFapiError(const ReturnCodes i_rcValue) //****************************************************************************** void ReturnCode::setEcmdError(const uint32_t i_rcValue) { + FAPI_ERR("setEcmdError: Creating ECMD error 0x%x", i_rcValue); iv_rcValue = i_rcValue; // Forget about any associated data (this is a new error) @@ -173,6 +179,7 @@ void ReturnCode::setEcmdError(const uint32_t i_rcValue) //****************************************************************************** void ReturnCode::setPlatError(void * i_pData) { + FAPI_ERR("setPlatError: Creating PLAT error"); iv_rcValue = FAPI_RC_PLAT_ERR_SEE_DATA; // Forget about any associated data (this is a new error) @@ -244,7 +251,7 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, { // This is a regular FFDC data object that can be directly // memcopied - addEIFfdc(l_pObject, l_size); + addEIFfdc(l_pObject, l_size, FFDC_TYPE_DATA); } else { @@ -252,7 +259,6 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB) { // The FFDC is a ecmdDataBufferBase - FAPI_ERR("addErrorInfo: Adding ecmdDB FFDC"); const ecmdDataBufferBase * l_pDb = static_cast<const ecmdDataBufferBase *>(l_pObject); ReturnCodeFfdc::addEIFfdc(*this, *l_pDb); @@ -260,7 +266,6 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_TARGET) { // The FFDC is a fapi::Target - FAPI_ERR("addErrorInfo: Adding fapi::Target FFDC"); const fapi::Target * l_pTarget = static_cast<const fapi::Target *>(l_pObject); ReturnCodeFfdc::addEIFfdc(*this, *l_pTarget); @@ -313,12 +318,12 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, // addEIFfdc function //****************************************************************************** void ReturnCode::addEIFfdc(const void * i_pFfdc, - const uint32_t i_size) + const uint32_t i_size, + const FfdcType i_type) { // Create a ErrorInfoFfdc object and add it to the Error Information - FAPI_ERR("addEIFfdc: Adding FFDC, size: %d", i_size); ensureDataRefExists(); - ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_pFfdc, i_size); + ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_pFfdc, i_size, i_type); iv_pDataRef->getCreateErrorInfo().iv_ffdcs.push_back(l_pFfdc); } diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml index 34b4a6752..880af55e6 100644 --- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml +++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml @@ -20,8 +20,7 @@ Origin: 30 IBM_PROLOG_END --> -<!-- XML file specifying HW Procedure generated errors. --> -<!-- This is just the initial test version. HWPs will replace with an official version. --> +<!-- XML file specifying Test HW Procedure generated errors. --> <hwpErrors> <!-- *********************************************************************** --> @@ -30,10 +29,12 @@ <description>HWP Unit Test expected error A</description> <!-- Call hwpTestFfdc1 to collect FFDC from the master chip --> <collectFfdc>hwpTestFfdc1, MASTER_CHIP</collectFfdc> - <!-- Collect local FFDC FFDC_DATA_1 --> + <!-- Add some data as FFDC --> <ffdc>FFDC_DATA_1</ffdc> - <!-- Collect local FFDC FFDC_DATA_BUF --> + <!-- Add an ecmdDataBufferBase as FFDC --> <ffdc>FFDC_DATA_BUF</ffdc> + <!-- Add a Target as FFDC --> + <ffdc>MASTER_CHIP</ffdc> <!-- Callout MASTER_CHIP HIGH --> <callout> <target>MASTER_CHIP</target> diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C index 7a31ca610..d0dfa7355 100644 --- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C +++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C @@ -43,23 +43,32 @@ namespace fapi void processEIFfdcs(const ErrorInfo & i_errInfo, errlHndl_t io_pError) { - // Iterate through the FFDCs, adding each to the error log - // TODO Should all of the FFDC sections be added as a single blob? There is - // overhead to adding lots of different sections. - uint32_t l_size; - const void * l_pFfdc; + // Iterate through the FFDC sections, adding each to the error log + uint32_t l_size = 0; + const void * l_pFfdc = NULL; + FfdcType l_type = FFDC_TYPE_NONE; for (ErrorInfo::ErrorInfoFfdcCItr_t l_itr = i_errInfo.iv_ffdcs.begin(); l_itr != i_errInfo.iv_ffdcs.end(); ++l_itr) { l_pFfdc = (*l_itr)->getData(l_size); + l_type = (*l_itr)->getType(); - FAPI_ERR("processEIFfdcs: Adding %d bytes of FFDC to errlog", - l_size); - - // TODO Which comp id and section numbers should be used and how will - // FFDC be parsed? - io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size); + if (l_type == FFDC_TYPE_TARGET) + { + io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1, + HWPF_UDT_HWP_TARGET); + } + else if (l_type == FFDC_TYPE_ECMDDBB) + { + io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1, + HWPF_UDT_HWP_ECMDDBB); + } + else + { + io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1, + HWPF_UDT_HWP_DATA); + } } } diff --git a/src/usr/hwpf/plugins/hwpfParse.C b/src/usr/hwpf/plugins/hwpfParse.C new file mode 100644 index 000000000..c68d77d6a --- /dev/null +++ b/src/usr/hwpf/plugins/hwpfParse.C @@ -0,0 +1,31 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/hwpf/plugins/hwpfParse.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 +/** + * @file hwpfParse.C + * + * HWPF user data parser + */ +#include <errl/errludparser.H> +#include <hwpf/plat/fapiPlatUdParserFactory.H> +ERRL_MAKE_UD_PARSER(fapi::PlatUserDetailsParserFactory, HWPF_COMP_ID) + diff --git a/src/usr/hwpf/plugins/makefile b/src/usr/hwpf/plugins/makefile new file mode 100644 index 000000000..891249f93 --- /dev/null +++ b/src/usr/hwpf/plugins/makefile @@ -0,0 +1,47 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/plugins/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. + +# Include the common hostboot plugins makefile +.include "../plugins.mk" + +MY_PLUGIN = libB-0900 +MY_OBJS = hwpfParse.o + +.if ( $(CONTEXT) == "x86.nfp" ) + +LIBRARIES = ${MY_PLUGIN}.a +EXPLIBS = ${MY_PLUGIN}.a +${MY_PLUGIN}.a_OFILES = ${MY_OBJS} + +.else + +BUILD_SHARED_OBJS = +SHARED_LIBRARIES EXPSHLIBS = ${MY_PLUGIN}.so +${MY_PLUGIN}.so_EXTRA_LIBS = libbase.so +${MY_PLUGIN}.so_SHLDFLAGS += ${SHLDFLAGS} -Wl,-soname,${.TARGET} +${MY_PLUGIN}.so_OFILES = ${MY_OBJS} + +.endif + +.include <${RULES_MK}> diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H index 21e26ca2c..e482f4caa 100644 --- a/src/usr/hwpf/test/hwpftest.H +++ b/src/usr/hwpf/test/hwpftest.H @@ -189,11 +189,11 @@ public: */ void testHwpf2() { - // Call a test hardware procedure errlHndl_t l_err = NULL; - // Set processor chip to NULL. The target is not used by this HWP + // Get the master processor chip TARGETING::Target* l_pTarget = NULL; + TARGETING::targetService().masterProcChipTargetHandle(l_pTarget); // Create a FAPI Target and invoke the hwpTestError HWP. The HWP // returns an error to test out error handling diff --git a/src/usr/initservice/plugins/initsvcParse.C b/src/usr/initservice/plugins/initsvcParse.C index 227c3f85b..e8894ca4e 100644 --- a/src/usr/initservice/plugins/initsvcParse.C +++ b/src/usr/initservice/plugins/initsvcParse.C @@ -25,39 +25,7 @@ * * Initservice user data parser */ -#include <netinet/in.h> - -// FSP includes -#include <errlplugins.H> -#include <errlusrparser.H> - -// Hostboot includes +#include <errl/errludparser.H> #include <initservice/initsvcudparserfactory.H> - -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; - - // Create a InitSvcUserDetailsParserFactory object - INITSERVICE::InitSvcUserDetailsParserFactory l_factory; - - // Use the factory to create a ErrlUserDetailsParser object - 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; -} - -// Map my Hostboot component ID to the function above. -static errl::DataPlugin g_DataPlugin(INITSVC_COMP_ID, myDataParse ); +ERRL_MAKE_UD_PARSER(INITSERVICE::InitSvcUserDetailsParserFactory, INITSVC_COMP_ID) |