From a0c2aa6132a0b49975327f5aa9238d1d3e2b750b Mon Sep 17 00:00:00 2001 From: Elizabeth Liner Date: Wed, 25 Jan 2017 15:14:11 -0600 Subject: Adding in support for PHYP SRC and all 9 words Change-Id: I82c5b42c2167970437dae1323aa4aabed62068c9 RTC:158762 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37514 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Tested-by: Jenkins OP Build CI Reviewed-by: Daniel M. Crowell --- src/include/usr/errl/errlentry.H | 32 +++++++++- src/include/usr/errl/errlsrc.H | 44 +++++++++++--- src/include/usr/errl/hberrltypes.H | 55 +++++++++-------- src/usr/errl/errlentry.C | 24 +++++++- src/usr/errl/errlsrc.C | 103 ++++++++++++++++++++++++-------- src/usr/errl/runtime/test/rt_errltest.H | 8 +-- src/usr/errl/test/errltest.H | 8 +-- 7 files changed, 202 insertions(+), 72 deletions(-) diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 2837d61ac..dde25243e 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -134,8 +134,34 @@ public: const uint16_t i_reasonCode, const uint64_t i_user1 = 0, const uint64_t i_user2 = 0, - const bool i_hbSwError = false ); + const bool i_hbSwError = false); + /** + * @brief ErrlEntry constructor. Builds an error log with info + * constructed from the input. + * Event type, Sub System, SRC type, and Terminate state are defaulted + * to the most common values for Host Boot environment. These values + * can also be set to specific values by users if needed. + * For available values, see errltypes.H + * To understand the meaning of these values, refer to the + * Platform Event Log and SRC PLDD at: https://mcdoc.boeblingen.de. + * ibm.com/out/out.ViewDocument.php?documentid=1675 + * + * The backtrace is captured as user detail data. Use removeBackTrace to + * remove + * + * The order of parameters is arranged so that Host Boot error log + * is as close to SP as possible. + * + * @param[in] i_sev Log's severity. See errltypes.H for + * available values + * @param[in] i_srcWords The SRC words that will fill in other + * parameters + * @return None + */ + + ErrlEntry(const errlSeverity_t i_sev, + uint32_t i_srcWords[9]); /** * @brief Destructor * @@ -766,9 +792,9 @@ private: private: // Data Members + ErrlSrc iv_Src; // primary SRC section ErrlPrvt iv_Private; // private header object ErrlUH iv_User; // user header object - ErrlSrc iv_Src; // primary SRC section std::vector iv_SectionVector; // list of user defined sections std::vector iv_btAddrs; // list of addresses for the backtrace ErrlUserDetailsBackTrace * iv_pBackTrace; // Pointer to back trace diff --git a/src/include/usr/errl/errlsrc.H b/src/include/usr/errl/errlsrc.H index 33f2a4fb0..e08be1893 100644 --- a/src/include/usr/errl/errlsrc.H +++ b/src/include/usr/errl/errlsrc.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -82,6 +84,14 @@ private: uint64_t i_user1, uint64_t i_user2 ); + /** + * @brief Constructor. Pass in items destined for the primary SRC + * section in the error log. + * + * @param[in] i_srcWords SRC Words + * + */ + ErrlSrc( uint32_t i_srcWords[9]); /** @brief Destructor. */ ~ErrlSrc(); @@ -150,15 +160,31 @@ private: */ uint64_t aschex2bin(char c) const; + /* + * @brief Fill in the SRC words with current data. This is called + * at the beginning of flatten() + */ + void setSRCWords(); + + /* + * @brief Fill in the other class variables from the src words. + * This is only called if we go through the correct constructor + */ + void formatSRCWords(); + // Instance data - srcType_t iv_srcType : 8; // SRC type, the ?? in SRC ??xxxxxx - uint8_t iv_modId; // module ID - uint16_t iv_reasonCode; // reason code - epubSubSystem_t iv_ssid : 8 ; // subsystem type, the ?? in SRC xx??xxxx - uint64_t iv_user1; // user data 1 - uint64_t iv_user2; // user data 2 - bool iv_deconfig; // true if there is a deconfigure callout - bool iv_gard; // true if there is a gard callout + srcType_t iv_srcType : 8; // SRC type, the ?? in SRC ??xxxxxx + uint8_t iv_modId; // module ID + uint16_t iv_reasonCode; // reason code + epubSubSystem_t iv_ssid : 8 ; // subsystem type, the ?? in SRC xx??xxxx + uint64_t iv_user1; // user data 1 + uint64_t iv_user2; // user data 2 + bool iv_deconfig; // true if there is a deconfigure callout + bool iv_gard; // true if there is a gard callout + uint32_t iv_srcWords[9]; // filled in to match what PRD needs + + //when true, the error log is formed from the given src words. + bool iv_fromSRCWords; }; diff --git a/src/include/usr/errl/hberrltypes.H b/src/include/usr/errl/hberrltypes.H index 427029305..7ed897f40 100644 --- a/src/include/usr/errl/hberrltypes.H +++ b/src/include/usr/errl/hberrltypes.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -84,6 +84,36 @@ namespace ERRORLOG { class ErrlEntry; }; ( (TO_UINT32(TWO_UINT8_TO_UINT16(mostleft_8, left_8)) << 16) | \ (TO_UINT32(TWO_UINT8_TO_UINT16(right_8, mostright_8))) ) + +/** + * @brief SRC type definitions + * Needs to fit into 1 byte for flattening purposes. + * + * This represents the byte in an SRC in position + * XX...... such as BC in BC81F00B. + * + * Refer to errlentry.H and this setter: + * void ErrlEntry::setSrcType(const srcType_t i_srcType) + * + */ +enum srcType_t +{ + SRCI_INTERVENTION_REQ = 0xA1, + SRCI_MACH_CHECK = 0xB1, + SRCI_ERR_INFO = 0xB1, + SRCI_IPL_STATUS = 0xC1, + SRCI_GENERAL_STATUS = 0xD1, + SRCI_DUMP_STATUS = 0xD1, + + HBT_INTERVENTION_REQ = 0xAC, + HBT_ERR_INFO = 0xBC, + HBT_IPL_STATUS = 0xCC, + HBT_GENERAL_STATUS = 0xDC, + + POWR_PHYP_STATUS = 0x10, +}; + + namespace ERRORLOG { @@ -204,29 +234,6 @@ enum errlEventType_t ERRL_ETYPE_CAPACITY_UPGRADE = 0x60, }; - - - -/** - * @brief SRC type definitions - * Needs to fit into 1 byte for flattening purposes. - * - * This represents the byte in an SRC in position - * XX...... such as BC in BC81F00B. - * - * Refer to errlentry.H and this setter: - * void ErrlEntry::setSrcType(const srcType_t i_srcType) - * - */ -enum srcType_t -{ - SRC_INTERVENTION_REQ = 0xAC, - SRC_ERR_INFO = 0xBC, - SRC_IPL_STATUS = 0xCC, - SRC_GENERAL_STATUS = 0xDC, -}; - - /** * @brief Sub system definitions * Needs to fit into 1 byte for flattening purposes. diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index e05691874..d11c40608 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -192,11 +192,9 @@ ErrlEntry::ErrlEntry(const errlSeverity_t i_sev, const uint64_t i_user1, const uint64_t i_user2, const bool i_hbSwError ) : + iv_Src( HBT_ERR_INFO, i_modId, i_reasonCode, i_user1, i_user2 ), iv_Private( static_cast(i_reasonCode & 0xFF00)), iv_User( i_sev ), - // The SRC_ERR_INFO becomes part of the SRC; example, B1 in SRC B180xxxx - // iv_Src assigns the epubSubSystem_t; example, 80 in SRC B180xxxx - iv_Src( SRC_ERR_INFO, i_modId, i_reasonCode, i_user1, i_user2 ), iv_termState(TERM_STATE_UNKNOWN), iv_sevFinal(false), iv_skipShowingLog(true) @@ -216,6 +214,26 @@ ErrlEntry::ErrlEntry(const errlSeverity_t i_sev, } } +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +ErrlEntry::ErrlEntry(const errlSeverity_t i_sev, + uint32_t i_srcWords[9] ): + iv_Src( i_srcWords ), + iv_Private( static_cast((iv_Src.iv_reasonCode) & 0xFF00)), + iv_User( i_sev ), + iv_termState(TERM_STATE_UNKNOWN), + iv_sevFinal(false), + iv_skipShowingLog(true) +{ + #ifdef CONFIG_ERRL_ENTRY_TRACE + TRACFCOMP( g_trac_errl, ERR_MRK"Error created : Source Words=[0]:%.4X,[1]:%.4X,[2]:%.4X,[3]:%.4X,[4]:%.4X,[5]:%.4X,[6]:%.4X,[7]:%.4X,[8]:%.4X",i_srcWords[0],i_srcWords[1],i_srcWords[2],i_srcWords[3],i_srcWords[4],i_srcWords[5],i_srcWords[6],i_srcWords[7],i_srcWords[8]); + #else + TRACDCOMP( g_trac_errl, ERR_MRK"Error created : Source Words=[0]:%.4X,[1]:%.4X,[2]:%.4X,[3]:%.4X,[4]:%.4X,[5]:%.4X,[6]:%.4X,[7]:%.4X,[8]:%.4X",i_srcWords[0],i_srcWords[1],i_srcWords[2],i_srcWords[3],i_srcWords[4],i_srcWords[5],i_srcWords[6],i_srcWords[7],i_srcWords[8]); + #endif + // Collect the Backtrace and add it to the error log + iv_pBackTrace = new ErrlUserDetailsBackTrace(); +} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// ErrlEntry::~ErrlEntry() diff --git a/src/usr/errl/errlsrc.C b/src/usr/errl/errlsrc.C index 2d0217004..1c16691a9 100644 --- a/src/usr/errl/errlsrc.C +++ b/src/usr/errl/errlsrc.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -54,7 +56,7 @@ ErrlSrc::ErrlSrc( srcType_t i_srcType, uint8_t i_modId, uint16_t i_reasonCode, uint64_t i_user1, - uint64_t i_user2 ) : + uint64_t i_user2) : ErrlSctn( ERRL_SID_PRIMARY_SRC, ErrlSrc::SLEN, @@ -68,11 +70,28 @@ ErrlSrc::ErrlSrc( srcType_t i_srcType, iv_user1( i_user1 ), iv_user2( i_user2 ), iv_deconfig(false), - iv_gard(false) + iv_gard(false), + iv_fromSRCWords(false) { } +ErrlSrc::ErrlSrc( uint32_t i_srcWords[9]) : + ErrlSctn( ERRL_SID_PRIMARY_SRC, + ErrlSrc::SLEN, + ErrlSrc::VER, + ErrlSrc::SST, + 0 ), // Component ID zero for now. + iv_srcType( (srcType_t) ((i_srcWords[0] & 0xFF000000) >> 24) ), + iv_ssid( EPUB_FIRMWARE_SUBSYS), + iv_fromSRCWords(true) +{ + for(int i=0; i<9; i++) + { + iv_srcWords[i] = i_srcWords[i]; + } + formatSRCWords(); +} //**************************************************************************** // @@ -97,6 +116,11 @@ uint64_t ErrlSrc::flatten( void * o_pBuffer, const uint64_t i_cbBuffer ) do { + if(!iv_fromSRCWords) + { + setSRCWords(); + } + if( i_cbBuffer < flatSize() ) { TRACFCOMP( g_trac_errl, "ErrlSrc::flatten: buffer too small"); @@ -127,33 +151,15 @@ uint64_t ErrlSrc::flatten( void * o_pBuffer, const uint64_t i_cbBuffer ) // Use reserved1 word to stash the reason code for easy extract in // unflatten rather than parsing srcString - psrc->reserved1 = iv_reasonCode; + psrc->reserved1 = iv_srcWords[0] >> 8; CPPASSERT( ErrlSrc::SLEN == sizeof(pelSRCSection_t)-iv_header.flatSize()); psrc->srcLength = ErrlSrc::SLEN; - // SRC format - psrc->word2 = 0x000000E0; // SRCI_HBT_FORMAT - - // Stash the Hostboot module id into hex word 3 - psrc->moduleId = iv_modId; - - // set deconfigure and/or gard bits - if (iv_deconfig) - { - psrc->word5 |= ErrlSrc::DECONFIG_BIT; // deconfigure - } - if (iv_gard) - { - psrc->word5 |= ErrlSrc::GARD_BIT; // GARD - } - - // set ACK bit - means unacknowledged - psrc->word5 |= ErrlSrc::ACK_BIT; // ACK + psrc->word2 = iv_srcWords[1]; - // Stash the Hostboot long long words into the hexwords of the SRC. - psrc->word6 = iv_user1; // spans 6-7 - psrc->word8 = iv_user2; // spans 8-9 + psrc->moduleId = iv_srcWords[2]; + psrc->word5 = iv_srcWords[4]; // spans 4-8 // Build the char string for the SRC. uint32_t l_u32; @@ -219,6 +225,53 @@ uint64_t ErrlSrc::aschex2bin(char c) const return c; } +void ErrlSrc::setSRCWords() +{ + + //word 0 = reason code and SRC length + iv_srcWords[0] = 0xBC000000 || (iv_reasonCode) ; + + //word 1 = SRC format + iv_srcWords[1] = 0x000000E0; // SRCI_HBT_FORMAT + + //word 2 = Hostboot module ID + iv_srcWords[2] = iv_modId; + + //word 4 deconfigure, gard and ack bits. + if (iv_deconfig) + { + iv_srcWords[4] |= ErrlSrc::DECONFIG_BIT; // deconfigure + } + if (iv_gard) + { + iv_srcWords[4] |= ErrlSrc::GARD_BIT; // GARD + } + + // set ACK bit - means unacknowledged + iv_srcWords[4] |= ErrlSrc::ACK_BIT; // ACK + + //word 5 = First half of the hostboot long long word user1 + iv_srcWords[5] = (uint32_t) ((uint64_t)iv_user1 >> 32); + //word 6 = Second half of the hostboot long long word user1 + iv_srcWords[6] = (uint32_t) ( iv_user1 & 0xFFFFFFFF); + //word 7 = First half of the hostboot long long word user2 + iv_srcWords[7] = (uint32_t) ((uint64_t) iv_user2 >> 32); + //word 8 = Second half of the hostboot long long word user2 + iv_srcWords[8] = (uint32_t) ( iv_user2 & 0xFFFFFFFF); + + return; +} + +void ErrlSrc::formatSRCWords() +{ + iv_reasonCode = (iv_srcWords[0] && 0x3F00) >> 8; + iv_modId = iv_srcWords[2]; + iv_user1 = ((uint64_t)iv_srcWords[5] << 32) || (iv_srcWords[6]); + iv_user2 = ((uint64_t)iv_srcWords[7] << 32) || (iv_srcWords[8]); + + return; +} + } // namespace diff --git a/src/usr/errl/runtime/test/rt_errltest.H b/src/usr/errl/runtime/test/rt_errltest.H index 0a98c07df..404205920 100644 --- a/src/usr/errl/runtime/test/rt_errltest.H +++ b/src/usr/errl/runtime/test/rt_errltest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* Contributors Listed Below - COPYRIGHT 2013,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -173,7 +173,7 @@ public: break; } - if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO) + if (l_err->srcType() != HBT_ERR_INFO) { TS_FAIL("testErrl1: createErrlLog() returns incorrect SRC type!"); break; @@ -231,7 +231,7 @@ public: l_err->setSev(ERRORLOG::ERRL_SEV_UNKNOWN); l_err->setEventType(ERRORLOG::ERRL_ETYPE_CAPACITY_UPGRADE); l_err->setSubSys(ERRORLOG::EPUB_UNKNOWN); - l_err->setSrcType(ERRORLOG::SRC_ERR_INFO); + l_err->setSrcType(HBT_ERR_INFO); l_err->setTermState(ERRORLOG::TERM_STATE_NO_FLAGS); if (l_err->sev() != ERRORLOG::ERRL_SEV_UNKNOWN) @@ -246,7 +246,7 @@ public: { TS_FAIL("testErrl2: setSubSys() fails!"); } - else if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO) + else if (l_err->srcType() != HBT_ERR_INFO) { TS_FAIL("testErrl2: setSrcType() fails!"); } diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H index 3de01fb52..f4368049c 100644 --- a/src/usr/errl/test/errltest.H +++ b/src/usr/errl/test/errltest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -241,7 +241,7 @@ public: break; } - if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO) + if (l_err->srcType() != HBT_ERR_INFO) { TS_FAIL("testErrl1: createErrlLog() returns incorrect SRC type!"); break; @@ -299,7 +299,7 @@ public: l_err->setSev(ERRORLOG::ERRL_SEV_UNKNOWN); l_err->setEventType(ERRORLOG::ERRL_ETYPE_CAPACITY_UPGRADE); l_err->setSubSys(ERRORLOG::EPUB_UNKNOWN); - l_err->setSrcType(ERRORLOG::SRC_ERR_INFO); + l_err->setSrcType(HBT_ERR_INFO); l_err->setTermState(ERRORLOG::TERM_STATE_NO_FLAGS); if (l_err->sev() != ERRORLOG::ERRL_SEV_UNKNOWN) @@ -314,7 +314,7 @@ public: { TS_FAIL("testErrl2: setSubSys() fails!"); } - else if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO) + else if (l_err->srcType() != HBT_ERR_INFO) { TS_FAIL("testErrl2: setSrcType() fails!"); } -- cgit v1.2.1