summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/errlsctn.C
diff options
context:
space:
mode:
authorMonte Copeland <copelanm@us.ibm.com>2011-10-24 09:30:49 -0500
committerMonte K. Copeland <copelanm@us.ibm.com>2011-10-31 11:07:10 -0500
commit723239d5a14fe82713a2aa57fef3130534b15a41 (patch)
treeb6d19b1d1d66ec9ea4acd19c0dfdb47bcf86babd /src/usr/errl/errlsctn.C
parentf2794eed87ca9c35140c601dfcbb5baf299d834b (diff)
downloadtalos-hostboot-723239d5a14fe82713a2aa57fef3130534b15a41.tar.gz
talos-hostboot-723239d5a14fe82713a2aa57fef3130534b15a41.zip
Error log changes for Sprint 6
Change-Id: I44ad678cfae8cd84e5370391dc7e20d74f59c9ca Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/449 Tested-by: Jenkins Server Reviewed-by: Mark W. Wenning <wenning@us.ibm.com> Reviewed-by: Monte K. Copeland <copelanm@us.ibm.com>
Diffstat (limited to 'src/usr/errl/errlsctn.C')
-rw-r--r--src/usr/errl/errlsctn.C114
1 files changed, 16 insertions, 98 deletions
diff --git a/src/usr/errl/errlsctn.C b/src/usr/errl/errlsctn.C
index d82a6869f..14e815bf5 100644
--- a/src/usr/errl/errlsctn.C
+++ b/src/usr/errl/errlsctn.C
@@ -23,15 +23,19 @@
/**
* @file errlsctn.C
*
- * @brief Implementation of ErrlSctn class
+ * @brief Implementation of ErrlSctn class.
*/
/*****************************************************************************/
// I n c l u d e s
/*****************************************************************************/
-#include <trace/interface.H>
-#include "errlsctn.H"
#include <assert.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+
namespace ERRORLOG
{
@@ -41,110 +45,24 @@ extern trace_desc_t* g_trac_errl;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-ErrlSctn::ErrlSctn(const compId_t i_compId,
- const uint8_t i_sctnVer,
- const uint8_t i_subSect)
-:iv_ErrlSctnHdr(i_compId, i_sctnVer, i_subSect),iv_pData(NULL),iv_cbData(0)
-{
-}
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-ErrlSctn::~ErrlSctn()
+ErrlSctn::ErrlSctn( const uint16_t i_sid,
+ const uint16_t i_slen,
+ const uint8_t i_ver,
+ const uint8_t i_sst,
+ const compId_t i_compId ) :
+ iv_header( i_sid, i_slen, i_ver, i_sst, i_compId )
{
- delete iv_pData;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-uint64_t ErrlSctn::addData(const void *i_data, const uint64_t i_size)
-{
- uint64_t l_rc = 0;
-
- // Expected new size of user data.
- uint64_t l_newsize = iv_cbData + i_size;
-
- // Resize memory block
- iv_pData = static_cast<uint8_t*>(realloc(iv_pData, l_newsize));
- // Make sure reallocate call succeeds
- if (iv_pData != NULL)
- {
- // Copy new data to new area, past existing data (if any)
- memcpy( iv_pData+iv_cbData, i_data, i_size );
-
- // Save new size of the user-provided data.
- l_rc = iv_cbData = l_newsize;
- }
- else
- {
- TRACFCOMP( g_trac_errl,
- "ErrlFFDC::addData() - Reallocate memory failed!");
- }
- return l_rc;
}
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-uint64_t ErrlSctn::flattenedSize()
-{
- return sizeof(section_header_t) + iv_cbData;
-}
-
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-uint64_t ErrlSctn::flatten( void* io_pBuffer, uint64_t i_bufsize )
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlSctn::~ErrlSctn()
{
- uint64_t l_flatCount = 0;
-
- do
- {
- l_flatCount = flattenedSize();
- if( i_bufsize < l_flatCount )
- {
- // error path, return 0
- TRACFCOMP( g_trac_errl, "Invalid buffer size" );
- l_flatCount = 0;
- break;
- }
- // CPPASSERT() makes an assertion to the compiler, and if the
- // expression is false, the compile will end in error. If these
- // compiler asserts should fail, then the packed structures
- // defined in errl/errltypes.H will need to be adjusted.
- CPPASSERT( 2 == sizeof(iv_ErrlSctnHdr.iv_compId));
- CPPASSERT( 1 == sizeof(iv_ErrlSctnHdr.iv_sctnVer));
- CPPASSERT( 1 == sizeof(iv_ErrlSctnHdr.iv_subSect));
- CPPASSERT( 0 == sizeof( section_header_t ) % sizeof( uint32_t ));
-
-
- // Marshall the data into a section_header_t
- section_header_t l_Header;
- memset( &l_Header, 0, sizeof( l_Header ));
- l_Header.cbHeader = sizeof( l_Header );
- l_Header.cbSection = iv_cbData;
- l_Header.compId = iv_ErrlSctnHdr.iv_compId;
- l_Header.sctnVer = iv_ErrlSctnHdr.iv_sctnVer;
- l_Header.subSect = iv_ErrlSctnHdr.iv_subSect;
-
-
- // Write data to caller's memory.
- char * l_pchar = static_cast<char *>(io_pBuffer);
- memcpy( l_pchar, &l_Header, sizeof( l_Header ));
- l_pchar += sizeof( l_Header );
-
- // Write any user-defined data.
- if( iv_cbData )
- {
- memcpy( l_pchar, iv_pData, iv_cbData );
- }
- }
- while( 0 );
-
- return l_flatCount;
}
-
} // end namespace
OpenPOWER on IntegriCloud