summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorVan Lee <vanlee@us.ibm.com>2012-01-18 11:20:33 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-02-01 17:12:09 -0600
commit06b768407e1d6e212aeed8be23f31dfb27f2a9cc (patch)
tree4cc7d0295a8efc225b243ea13983803bfda213f7 /src/usr
parent3537d669cce337e37790cf7be62a817cbc88c811 (diff)
downloadtalos-hostboot-06b768407e1d6e212aeed8be23f31dfb27f2a9cc.tar.gz
talos-hostboot-06b768407e1d6e212aeed8be23f31dfb27f2a9cc.zip
Common Errl FFDC Classes: DCUT - RTC4289
Change-Id: Ie0c7cc6422d30fe0b5449eb54aaa62ebb54774e7 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/618 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/errl/errlUserDetailsTarget.C79
-rw-r--r--src/usr/errl/makefile2
-rw-r--r--src/usr/hwpf/test/hwpftest.H6
-rw-r--r--src/usr/targeting/entitypath.C43
-rw-r--r--src/usr/targeting/target.C53
-rw-r--r--src/usr/targeting/test/targetingtest.H34
6 files changed, 209 insertions, 8 deletions
diff --git a/src/usr/errl/errlUserDetailsTarget.C b/src/usr/errl/errlUserDetailsTarget.C
new file mode 100644
index 000000000..ece6874bf
--- /dev/null
+++ b/src/usr/errl/errlUserDetailsTarget.C
@@ -0,0 +1,79 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/errl/errlUserDetailsTarget.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
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <hbotcompid.H> // list of compid's supported
+#include <errl/errlentry.H>
+#include <errl/errlUserDetailsTarget.H>
+#include <targeting/targetservice.H>
+
+namespace ERRORLOG
+{
+
+//#ifndef PARSER
+
+// Constructor
+ErrlUserDetailsTarget::ErrlUserDetailsTarget( TARGETING::Target * i_target ) :
+ ErrlUserDetails()
+{
+ iv_pTarget = i_target;
+}
+
+// Destructor
+ErrlUserDetailsTarget::~ErrlUserDetailsTarget() {}
+
+// @brief Add FFDC to an user detailed data section of the errorlog
+// Each data is always terminated with nul-char
+void ErrlUserDetailsTarget::addToLog( errlHndl_t i_errl,
+ void *i_buf, const uint32_t i_len )
+{
+ if (i_errl != NULL)
+ {
+ if (iv_pTarget == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
+ {
+ const char *l_bufPtr = "MASTER_PROCESSOR_CHIP_TARGET_SENTINEL";
+ iv_pErrlFFDC = i_errl->addFFDC( ERRL_COMP_ID,
+ l_bufPtr, strlen(l_bufPtr)+1,
+ ERRL_UDV_DEFAULT_VER_1,
+ ERRL_UDT_TARGET_FFDC );
+ }
+ else
+ {
+ uint32_t l_bufSize = 0;
+ char * l_bufPtr = NULL;
+
+ l_bufPtr = iv_pTarget->targetFFDC( l_bufSize );
+ if (l_bufPtr)
+ {
+ iv_pErrlFFDC = i_errl->addFFDC( ERRL_COMP_ID,
+ l_bufPtr, l_bufSize,
+ ERRL_UDV_DEFAULT_VER_1,
+ ERRL_UDT_TARGET_FFDC );
+ free (l_bufPtr);
+ }
+ }
+ }
+}
+
+}
diff --git a/src/usr/errl/makefile b/src/usr/errl/makefile
index 8020e07a9..bad776ee9 100644
--- a/src/usr/errl/makefile
+++ b/src/usr/errl/makefile
@@ -24,7 +24,7 @@ ROOTPATH = ../../..
MODULE = errl
OBJS = errlentry.o errlmanager.o errlsctn.o errlsctnhdr.o errlprvt.o errluh.o \
- errlud.o errlsrc.o errluserdetails.o backtrace.o
+ errlud.o errlsrc.o errluserdetails.o backtrace.o errlUserDetailsTarget.o
SUBDIRS = test.d parser.d
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
index 6368e93d5..4776ea41e 100644
--- a/src/usr/hwpf/test/hwpftest.H
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -49,7 +49,7 @@ struct hwpfTestArgs_t {
ifScom_t ifScom;
fapi::Target fapiTarget;
uint32_t count;
- tid_t tid;
+ tid_t tid;
struct {
uint64_t Write:1; // 1 = Write
uint64_t AttrTest:1; // 1 = run Attr access test
@@ -393,15 +393,13 @@ public:
TARGETING::Target* l_pTarget = NULL;
TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
- // Create a FAPI Target and invoke the hwpInitialTest HWP
fapi::Target l_fapiTarget(TARGET_TYPE_PROC_CHIP,
reinterpret_cast<void *> (l_pTarget));
// Test ATTR_EC attribute access through FAPI
uint8_t l_EC_R = 0xFF;
- fapi::Target *l_pfapiTarget = &l_fapiTarget;
- l_rc = FAPI_ATTR_GET(ATTR_EC, l_pfapiTarget, l_EC_R);
+ l_rc = FAPI_ATTR_GET(ATTR_EC, &l_fapiTarget, l_EC_R);
if (l_rc != fapi::FAPI_RC_SUCCESS)
{
TS_FAIL("testHwpf5: ATTR_EC. Error from GET");
diff --git a/src/usr/targeting/entitypath.C b/src/usr/targeting/entitypath.C
index c61ad87c3..d593937cd 100644
--- a/src/usr/targeting/entitypath.C
+++ b/src/usr/targeting/entitypath.C
@@ -101,7 +101,7 @@ EntityPath& EntityPath::removeLast()
assert(size() >= 1, TARG_LOC "EntityPath empty (size = %d); cannot remove "
"any path elements", size());
-
+
iv_pathElement[size() - 1].type = TYPE_NA;
iv_pathElement[size() - 1].instance = 0;
--iv_size;
@@ -229,7 +229,7 @@ const EntityPath::PathElement& EntityPath::operator[](
assert(i_index < size(), TARG_LOC "Caller specified invalid entity path "
"subscript of %d when size is only %d",i_index,size());
-
+
return iv_pathElement[i_index];
#undef TARG_FN
@@ -250,7 +250,7 @@ const EntityPath::PathElement EntityPath::pathElementOfType(
{
return iv_pathElement[x];
}
- }
+ }
PathElement na_path = { TYPE_NA, 0 };
return na_path;
@@ -429,6 +429,43 @@ void EntityPath::dump() const
#undef TARG_FN
}
+//******************************************************************************
+// EntityPath::toString
+//******************************************************************************
+
+char * EntityPath::toString() const
+{
+ #define TARG_FN "toString()"
+
+ void* l_ptr = NULL;
+ char* l_pString = NULL;
+ const char* l_ptr1 = NULL;
+ size_t l_len1, l_len2;
+
+ l_ptr1 = pathTypeAsString();
+ l_len1 = strlen( l_ptr1 ) + 1; // add 1 for the ':' char
+ // allocate extra 1 bytes for the nul char
+ l_pString = static_cast<char*>( malloc( l_len1 + 1 ) );
+ sprintf( l_pString, "%s:", l_ptr1 );
+
+ for (uint32_t i=0; i < size(); ++i)
+ {
+ l_ptr1 = pathElementTypeAsString( operator[](i).type );
+ l_len2 = strlen( l_ptr1 ) + 1; // add 1 for '/' char
+ // realloc with extra 33 bytes (more than enough)
+ // for the %d conversion and the nul char.
+ l_ptr = realloc( l_pString, (l_len1 + l_len2 + 33) );
+ l_pString = static_cast<char*>( l_ptr );
+ // append at the nul char of previous string
+ l_len2 = sprintf( l_pString + l_len1, "/%s%d",
+ l_ptr1, operator[](i).instance );
+ l_len1 += l_len2;
+ }
+
+ return (l_pString);
+
+ #undef TARG_FN
+}
#undef TARG_CLASS
#undef TARG_NAMESPACE
diff --git a/src/usr/targeting/target.C b/src/usr/targeting/target.C
index 714e614bd..10fbab4b8 100644
--- a/src/usr/targeting/target.C
+++ b/src/usr/targeting/target.C
@@ -178,6 +178,59 @@ Target::Target()
#undef TARG_FN
}
+//******************************************************************************
+// Target::targetFFDC()
+//******************************************************************************
+
+char * Target::targetFFDC( uint32_t & o_size ) const
+{
+ #define TARG_FN "targetFFDC(...)"
+
+ char l_buff[128];
+ char *l_pFFDC = NULL;
+ char *l_ptr = NULL;
+ void *l_ptr1 = NULL;
+ uint32_t l_len;
+
+ o_size = sprintf( l_buff, "Class = 0x%X, Type = 0x%X, Model = 0x%X",
+ getAttr<ATTR_CLASS>(),
+ getAttr<ATTR_TYPE>(),
+ getAttr<ATTR_MODEL>() );
+
+ l_pFFDC = static_cast<char*>( malloc( ++o_size ) );
+ memcpy( l_pFFDC, l_buff, o_size );
+
+ l_ptr = getAttr<ATTR_PHYS_PATH>().toString();
+ if (l_ptr)
+ {
+ l_len = strlen( l_ptr ) + 1;
+ l_ptr1 = realloc( l_pFFDC, o_size + l_len );
+ l_pFFDC = static_cast<char*>( l_ptr1 );
+ memcpy( l_pFFDC + o_size, l_ptr, l_len );
+ o_size += l_len;
+ free( l_ptr );
+ }
+
+ EntityPath l_entityPath;
+ if( tryGetAttr<ATTR_AFFINITY_PATH>(l_entityPath) )
+ {
+ l_ptr = l_entityPath.toString();
+ if (l_ptr)
+ {
+ l_len = strlen( l_ptr ) + 1;
+ l_ptr1 = realloc( l_pFFDC, o_size + l_len );
+ l_pFFDC = static_cast<char*>( l_ptr1 );
+ memcpy( l_pFFDC + o_size, l_ptr, l_len );
+ o_size += l_len;
+ free( l_ptr );
+ }
+ }
+
+ return l_pFFDC;
+
+ #undef TARG_FN
+}
+
#undef TARG_CLASS
#undef TARG_NAMESPACE
diff --git a/src/usr/targeting/test/targetingtest.H b/src/usr/targeting/test/targetingtest.H
index 25065e701..9ae8dcca6 100644
--- a/src/usr/targeting/test/targetingtest.H
+++ b/src/usr/targeting/test/targetingtest.H
@@ -56,6 +56,7 @@
#include <targeting/iterators/rangefilter.H>
#include <targeting/predicates/predicatectm.H>
#include <targeting/predicates/predicatepostfixexpr.H>
+#include <errl/errlUserDetailsTarget.H>
#include <kernel/console.H> //@fixme
@@ -1462,6 +1463,39 @@ class TargetingTestSuite: public CxxTest::TestSuite
TS_TRACE(EXIT_MRK "testHbMutexAttr");
}
+ void testErrlTargetFFDC()
+ {
+ TS_TRACE(ENTER_MRK "testErrlTargetFFDC" );
+
+ using namespace ERRORLOG;
+ using namespace TARGETING;
+ using namespace fapi;
+
+ // Get a reference to the target service
+ TargetService& l_service = targetService();
+
+ // Get the master proc target
+ TARGETING::Target* l_pTarget1 = NULL;
+ TARGETING::Target* l_pTarget2 = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+ l_service.masterProcChipTargetHandle( l_pTarget1);
+
+ ErrlUserDetailsTarget l_errlUdTarget1( l_pTarget1 );
+ ErrlUserDetailsTarget l_errlUdTarget2( l_pTarget2 );
+
+ // Create errorlogs to test FFDC capture of a target
+ errlHndl_t l_err1, l_err2;
+ l_err1 = new ErrlEntry( ERRL_SEV_UNRECOVERABLE, 1, 2, 3, 4);
+ l_err2 = new ErrlEntry( ERRL_SEV_UNRECOVERABLE, 5, 6, 7, 8);
+
+ l_errlUdTarget1.addToLog( l_err1, NULL, 0 );
+ l_errlUdTarget2.addToLog( l_err2, NULL, 0 );
+ l_errlUdTarget1.addToLog( l_err1, NULL, 0 );
+
+ ERRORLOG::errlCommit( l_err1, TARG_COMP_ID );
+ ERRORLOG::errlCommit( l_err2, TARG_COMP_ID );
+
+ TS_TRACE(EXIT_MRK "testErrlTargetFFDC");
+ }
};
#endif // End __TESTTARGETING_H
OpenPOWER on IntegriCloud