diff options
Diffstat (limited to 'src/usr/errl')
-rw-r--r-- | src/usr/errl/errlentry.C | 24 | ||||
-rw-r--r-- | src/usr/errl/errlsrc.C | 103 | ||||
-rw-r--r-- | src/usr/errl/runtime/test/rt_errltest.H | 8 | ||||
-rw-r--r-- | src/usr/errl/test/errltest.H | 8 |
4 files changed, 107 insertions, 36 deletions
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<compId_t>(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) @@ -218,6 +216,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<compId_t>((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() { // Free memory of all sections 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!"); } |