summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/errlsrc.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/errl/errlsrc.C')
-rw-r--r--src/usr/errl/errlsrc.C103
1 files changed, 78 insertions, 25 deletions
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
OpenPOWER on IntegriCloud