summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-10-06 15:30:27 -0500
committerMIKE J. JONES <mjjones@us.ibm.com>2011-10-11 16:24:46 -0500
commit17f630f5c2fabea998708dc2b2cb33120c388079 (patch)
tree148f26d81d8d33600a25eeda969a8169565978c8 /src/usr
parent8c062af8b6bd50a59823c7ec430ec5fc019052d2 (diff)
downloadtalos-hostboot-17f630f5c2fabea998708dc2b2cb33120c388079.tar.gz
talos-hostboot-17f630f5c2fabea998708dc2b2cb33120c388079.zip
HWPF: Error Information Updates
Change-Id: I9857638a35f21489e32448af3bf95e0155954b29 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/425 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/hwpf/fapi/fapiErrorInfo.C155
-rw-r--r--src/usr/hwpf/fapi/fapiErrorInfoMem.C98
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl387
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCode.C301
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCodeDataRef.C87
-rw-r--r--src/usr/hwpf/fapi/makefile5
-rw-r--r--src/usr/hwpf/hwp/fapiHwpErrorInfo.xml29
-rwxr-xr-xsrc/usr/hwpf/hwp/fapiTestHwpAttr.C4
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwpConfig.C4
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwpError.C68
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwpFfdc.C16
-rw-r--r--src/usr/hwpf/makefile3
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwpInvoker.C247
-rw-r--r--src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C8
-rw-r--r--src/usr/hwpf/test/fapiRcTest.C681
-rw-r--r--src/usr/hwpf/test/fapiTargetTest.C25
16 files changed, 1123 insertions, 995 deletions
diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C
index 42fb7ec8f..f052c8b70 100644
--- a/src/usr/hwpf/fapi/fapiErrorInfo.C
+++ b/src/usr/hwpf/fapi/fapiErrorInfo.C
@@ -23,7 +23,7 @@
/**
* @file fapiErrorInfo.C
*
- * @brief Implements the Error Info structs and classes
+ * @brief Implements the ErrorInfo structs and classes
*/
/*
@@ -32,6 +32,7 @@
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 08/05/2011 Created
* mjjones 08/24/2011 Added ErrorInfoGard.
+ * mjjones 09/22/2011 Major updates
*/
#include <fapiErrorInfo.H>
@@ -41,137 +42,117 @@ namespace fapi
{
//******************************************************************************
-// ErrorInfoCallout Constructor
+// ErrorInfoFfdc Constructor
//******************************************************************************
-ErrorInfoCallout::ErrorInfoCallout(const TargetType i_targetType,
- const uint32_t i_targetPos,
- const CalloutPriority i_priority)
-: iv_targetType(i_targetType),
- iv_targetPos(i_targetPos),
- iv_priority(i_priority)
+ErrorInfoFfdc::ErrorInfoFfdc(const void * i_pFfdc,
+ const uint32_t i_size)
+: iv_size(i_size)
{
-
+ iv_pFfdc = new uint8_t[i_size];
+ memcpy(iv_pFfdc, i_pFfdc, i_size);
}
//******************************************************************************
-// ErrorInfoGard Constructor
+// ErrorInfoFfdc Copy Constructor
//******************************************************************************
-ErrorInfoGard::ErrorInfoGard(const TargetType i_targetType,
- const uint32_t i_targetPos)
-: iv_targetType(i_targetType),
- iv_targetPos(i_targetPos)
+ErrorInfoFfdc::ErrorInfoFfdc(const ErrorInfoFfdc & i_right)
+: iv_size(i_right.iv_size)
{
-
+ iv_pFfdc = new uint8_t[i_right.iv_size];
+ memcpy(iv_pFfdc, i_right.iv_pFfdc, i_right.iv_size);
}
//******************************************************************************
-// ErrorInfoFfdc Constructor
+// ErrorInfoFfdc Destructor
//******************************************************************************
-ErrorInfoFfdc::ErrorInfoFfdc(const TargetType i_targetType,
- const uint32_t i_targetPos,
- const FfdcHwpToken i_ffdcHwpToken)
-: iv_targetType(i_targetType),
- iv_targetPos(i_targetPos),
- iv_ffdcHwpToken(i_ffdcHwpToken)
+ErrorInfoFfdc::~ErrorInfoFfdc()
{
-
+ delete [] iv_pFfdc;
+ iv_pFfdc = NULL;
}
//******************************************************************************
-// ErrorInfoRecord Default Constructor
+// ErrorInfoFfdc Assignment Operator
//******************************************************************************
-ErrorInfoRecord::ErrorInfoRecord()
-: iv_rc(FAPI_RC_SUCCESS),
- iv_pDescription(NULL)
+ErrorInfoFfdc & ErrorInfoFfdc::operator=(const ErrorInfoFfdc & i_right)
{
-
+ delete [] iv_pFfdc;
+ iv_pFfdc = new uint8_t[i_right.iv_size];
+ memcpy(iv_pFfdc, i_right.iv_pFfdc, i_right.iv_size);
+ iv_size = i_right.iv_size;
+ return *this;
}
//******************************************************************************
-// ErrorInfoRecord Copy constructor
+// ErrorInfoFfdc getData function
//******************************************************************************
-ErrorInfoRecord::ErrorInfoRecord(const ErrorInfoRecord & i_right)
-: iv_rc(i_right.iv_rc),
- iv_callouts(i_right.iv_callouts),
- iv_gards(i_right.iv_gards),
- iv_ffdcs(i_right.iv_ffdcs),
- iv_pDescription(NULL)
+const void * ErrorInfoFfdc::getData(uint32_t & o_size) const
{
- // Perform deep copy of the description string
- if (i_right.iv_pDescription)
- {
- iv_pDescription = new char[strlen(i_right.iv_pDescription) + 1];
- strcpy(iv_pDescription, i_right.iv_pDescription);
- }
+ o_size = iv_size;
+ return iv_pFfdc;
}
//******************************************************************************
-// ErrorInfoRecord Destructor
+// ErrorInfoCallout Constructor
//******************************************************************************
-ErrorInfoRecord::~ErrorInfoRecord()
+ErrorInfoCallout::ErrorInfoCallout(const Target & i_target,
+ const CalloutPriority i_priority)
+: iv_target(i_target),
+ iv_priority(i_priority)
{
- delete [] iv_pDescription;
+
}
//******************************************************************************
-// ErrorInfoRecord Assignment operator
+// ErrorInfoDeconfig Constructor
//******************************************************************************
-ErrorInfoRecord & ErrorInfoRecord::operator=(const ErrorInfoRecord & i_right)
+ErrorInfoDeconfig::ErrorInfoDeconfig(const Target & i_target)
+: iv_target(i_target)
{
- // Test for self assignment
- if (this != &i_right)
- {
- iv_rc = i_right.iv_rc;
- iv_callouts = i_right.iv_callouts;
- iv_gards = i_right.iv_gards;
- iv_ffdcs = i_right.iv_ffdcs;
-
- // Perform deep copy of the description string
- delete [] iv_pDescription;
- iv_pDescription = NULL;
-
- if (i_right.iv_pDescription)
- {
- iv_pDescription = new char[strlen(i_right.iv_pDescription) + 1];
- strcpy(iv_pDescription, i_right.iv_pDescription);
- }
- }
- return *this;
+
}
//******************************************************************************
-// ErrorInfoRecord setDescription function
+// ErrorInfoGard Constructor
//******************************************************************************
-void ErrorInfoRecord::setDescription(const char * i_pDescription)
+ErrorInfoGard::ErrorInfoGard(const Target & i_target)
+: iv_target(i_target)
{
- delete [] iv_pDescription;
- iv_pDescription = new char[strlen(i_pDescription) + 1];
- strcpy(iv_pDescription, i_pDescription);
+
}
//******************************************************************************
-// ErrorInfoRecord getDescription function
+// ErrorInfo Destructor
//******************************************************************************
-const char * ErrorInfoRecord::getDescription()
+ErrorInfo::~ErrorInfo()
{
- return iv_pDescription;
-}
+ for (ErrorInfo::ErrorInfoFfdcItr_t l_itr = iv_ffdcs.begin();
+ l_itr != iv_ffdcs.end(); ++l_itr)
+ {
+ delete (*l_itr);
+ (*l_itr) = NULL;
+ }
+ for (ErrorInfo::ErrorInfoCalloutItr_t l_itr = iv_callouts.begin();
+ l_itr != iv_callouts.end(); ++l_itr)
+ {
+ delete (*l_itr);
+ (*l_itr) = NULL;
+ }
-//******************************************************************************
-// ErrorInfoRepository Default Constructor
-//******************************************************************************
-ErrorInfoRepository::ErrorInfoRepository()
-{
- // Does nothing
-}
+ for (ErrorInfo::ErrorInfoDeconfigItr_t l_itr = iv_deconfigs.begin();
+ l_itr != iv_deconfigs.end(); ++l_itr)
+ {
+ delete (*l_itr);
+ (*l_itr) = NULL;
+ }
-//******************************************************************************
-// ErrorInfoRepository Destructor
-//******************************************************************************
-ErrorInfoRepository::~ErrorInfoRepository()
-{
- // Does nothing
+ for (ErrorInfo::ErrorInfoGardItr_t l_itr = iv_gards.begin();
+ l_itr != iv_gards.end(); ++l_itr)
+ {
+ delete (*l_itr);
+ (*l_itr) = NULL;
+ }
}
}
diff --git a/src/usr/hwpf/fapi/fapiErrorInfoMem.C b/src/usr/hwpf/fapi/fapiErrorInfoMem.C
deleted file mode 100644
index e238b4d87..000000000
--- a/src/usr/hwpf/fapi/fapiErrorInfoMem.C
+++ /dev/null
@@ -1,98 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/hwpf/fapi/fapiErrorInfoMem.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// 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
-/**
- * @file fapiErrorInfoMem.C
- *
- * @brief Implements the ErrorInfoRepositoryMem class
- */
-
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 08/08/2011 Created
- */
-
-#include <fapiErrorInfoMem.H>
-#include <fapiPlatTrace.H>
-
-namespace fapi
-{
-
-//******************************************************************************
-// ErrorInfoRepository Instance function
-//******************************************************************************
-ErrorInfoRepository& ErrorInfoRepository::Instance()
-{
- // Use a static function variable. The ErrorInfoRepositoryMem singleton will
- // be constructed on the first call to this function.
- static ErrorInfoRepositoryMem instance;
- return instance;
-}
-
-//******************************************************************************
-// ErrorInfoRepositoryMem Default Constructor
-//******************************************************************************
-ErrorInfoRepositoryMem::ErrorInfoRepositoryMem()
-{
- // Initialize the repository with records
- init();
-}
-
-//******************************************************************************
-// ErrorInfoRepositoryMem Destructor
-//******************************************************************************
-ErrorInfoRepositoryMem::~ErrorInfoRepositoryMem()
-{
- // Does nothing
-}
-
-//******************************************************************************
-// ErrorInfoRepositoryMem find function
-//******************************************************************************
-ReturnCode ErrorInfoRepositoryMem::find(const uint32_t i_rc,
- ErrorInfoRecord & o_record)
-{
- // Iterate over vector of tables, until the correct one is found
- ErrorInfoRecordItr_t l_it;
-
- for (l_it = iv_errorInfoRecords.begin(); l_it != iv_errorInfoRecords.end();
- ++l_it)
- {
- if ((*l_it).iv_rc == i_rc)
- {
- FAPI_INF("ErrorInfoRepositoryMem: Found record, rc: 0x%x", i_rc);
- o_record = *l_it;
- break;
- }
- }
-
- if (l_it == iv_errorInfoRecords.end())
- {
- FAPI_ERR("ErrorInfoRepositoryMem: Not found record, rc: 0x%x", i_rc);
- }
-
- return FAPI_RC_SUCCESS;
-}
-
-}
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
index 07d92a172..b17940e64 100755
--- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -27,10 +27,7 @@
# FAPI code. The FAPI files created are:
#
# 1/ fapiHwpReturnCodes.H - HwpReturnCode enumeration
-# FfdcHwpToken enumeration
-# 2/ fapiCollectFfdc.C - fapiCollectFfdc function implementation
-# 3/ fapiErrorInfoMemInit.C - ErrorInfoRepositoryMem::init
-# implementation
+# 2/ fapiHwpErrorInfo.H - Error Information macros
#
# Author: CamVan Nguyen and Mike Jones
#
@@ -44,6 +41,7 @@
# mjjones 07/05/11 Take output dir as parameter
# mjjones 08/08/11 Large update to create more code
# mjjones 08/24/11 Parse GARD info
+# mjjones 09/22/11 New Error Info Design
#
# End Change Log ******************************************************
@@ -54,6 +52,38 @@
use strict;
#------------------------------------------------------------------------------
+# Subroutine that checks if an entry exists in an array. If it doesn't exist
+# then it is added. The index of the entry within the array is returned
+#------------------------------------------------------------------------------
+sub addEntryToArray
+{
+ my ($arrayref, $entry ) = @_;
+
+ my $match = 0;
+ my $index = 0;
+
+ foreach my $element (@$arrayref)
+ {
+ if ($element eq $entry)
+ {
+ $match = 1;
+ last;
+ }
+ else
+ {
+ $index++;
+ }
+ }
+
+ if (!($match))
+ {
+ push(@$arrayref, $entry);
+ }
+
+ return $index;
+}
+
+#------------------------------------------------------------------------------
# Print Command Line Help
#------------------------------------------------------------------------------
my $numArgs = $#ARGV + 1;
@@ -82,21 +112,10 @@ $rcFile .= "/";
$rcFile .= "fapiHwpReturnCodes.H";
open(RCFILE, ">", $rcFile);
-my $ffFile = $ARGV[0];
-$ffFile .= "/";
-$ffFile .= "fapiCollectFfdc.C";
-open(FFFILE, ">", $ffFile);
-
-my $miFile = $ARGV[0];
-$miFile .= "/";
-$miFile .= "fapiErrorInfoMemInit.C";
-open(MIFILE, ">", $miFile);
-
-#------------------------------------------------------------------------------
-# Create arrays of FFDC HWPs and their data types
-#------------------------------------------------------------------------------
-my @ffdcHwps;
-my @ffdcHwpsData;
+my $eiFile = $ARGV[0];
+$eiFile .= "/";
+$eiFile .= "fapiHwpErrorInfo.H";
+open(EIFILE, ">", $eiFile);
#------------------------------------------------------------------------------
# Print start of file information to fapiHwpReturnCodes.H
@@ -115,44 +134,24 @@ print RCFILE "{\n";
print RCFILE " RC_SUCCESS,\n";
#------------------------------------------------------------------------------
-# Print start of file information to fapiCollectFfdc.C
+# Print start of file information to fapiHwpErrorInfo.H
#------------------------------------------------------------------------------
-print FFFILE "// fapiCollectFfdc.C\n";
-print FFFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
-print FFFILE "#include <stdint.h>\n";
-print FFFILE "#include <fapiFfdcHwpData.H>\n";
-print FFFILE "#include <fapiHwpExecutor.H>\n";
-print FFFILE "#include <fapiHwpReturnCodes.H>\n";
-print FFFILE "#include <fapiReturnCode.H>\n";
-print FFFILE "#include <string.h>\n\n";
-print FFFILE "namespace fapi\n";
-print FFFILE "{\n\n";
-print FFFILE "ReturnCode fapiCollectFfdc(const FfdcHwpToken i_token,\n";
-print FFFILE " const Target & i_target,\n";
-print FFFILE " uint8_t * & o_pFfdc,\n";
-print FFFILE " uint32_t & o_size)\n";
-print FFFILE "{\n";
-print FFFILE " ReturnCode l_rc;\n\n";
-print FFFILE " switch (i_token)\n";
-print FFFILE " {\n";
-
-#------------------------------------------------------------------------------
-# Print start of file information to fapiErrorInfoMemInit.C
-#------------------------------------------------------------------------------
-print MIFILE "// fapiErrorInfoMemInit.C\n";
-print MIFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
-print MIFILE "#include <fapiErrorInfoMem.H>\n\n";
-print MIFILE "namespace fapi\n";
-print MIFILE "{\n\n";
-print MIFILE "void ErrorInfoRepositoryMem::init()\n";
-print MIFILE "{\n";
+print EIFILE "// fapiHwpErrorInfo.H\n";
+print EIFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
+print EIFILE "#ifndef FAPIHWPERRORINFO_H_\n";
+print EIFILE "#define FAPIHWPERRORINFO_H_\n\n";
+print EIFILE "/**\n";
+print EIFILE " * \@brief Error Information macros\n";
+print EIFILE " *\/\n";
#------------------------------------------------------------------------------
# Element names
#------------------------------------------------------------------------------
+my $collectFfdc = 'collectFfdc';
my $ffdc = 'ffdc';
-my $gard = 'gard';
my $callout = 'callout';
+my $deconfigure = 'deconfigure';
+my $gard = 'gard';
#------------------------------------------------------------------------------
# For each XML file
@@ -160,14 +159,16 @@ my $callout = 'callout';
foreach my $argnum (1 .. $#ARGV)
{
my $infile = $ARGV[$argnum];
+ my $count = 0;
#--------------------------------------------------------------------------
- # Read XML file. Note that there may be multiple ffdc/gard/callout elements
- # so use the ForceArray option with these to ensure that XML::Simple
- # creates an array even for single elements of these types
+ # Read XML file. Note that there may be multiple collectFfdc/ffdc/callout/
+ # deconfigure/gard elements so use the ForceArray option with these to
+ # ensure that XML::Simple creates an array even for single elements of
+ # these types
#--------------------------------------------------------------------------
# read XML file
- my $errors = $xml->XMLin($infile, ForceArray => [$ffdc, $gard, $callout]);
+ my $errors = $xml->XMLin($infile, ForceArray => [$collectFfdc, $ffdc, $callout, $deconfigure, $gard]);
# Uncomment to get debug output of all errors
#print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
@@ -198,215 +199,189 @@ foreach my $argnum (1 .. $#ARGV)
print RCFILE " $err->{rc},\n";
#----------------------------------------------------------------------
- # Print the return code and description to fapiErrorInfoMemInit.C
+ # Print the CALL_FUNC_TO_ANALYZE_ERROR macro to fapiHwpErrorInfo.H
#----------------------------------------------------------------------
- print MIFILE " {\n";
- print MIFILE " ErrorInfoRecord l_record;\n";
- print MIFILE " l_record.iv_rc = $err->{rc};\n";
- print MIFILE " l_record.setDescription(\"$err->{description}\");\n";
+ print EIFILE "#define $err->{rc}_CALL_FUNC_TO_ANALYZE_ERROR(RC) ";
+
+ if (exists $err->{callFunc})
+ {
+ print EIFILE "FAPI_EXEC_HWP(RC, $err->{callFunc})\n";
+ }
+ else
+ {
+ print EIFILE "\n";
+ }
#----------------------------------------------------------------------
- # For each Callout element
+ # Print the CALL_FUNCS_TO_COLLECT_FFDC macro to fapiHwpErrorInfo.H
#----------------------------------------------------------------------
- foreach my $callout (@{$err->{callout}})
- {
- #------------------------------------------------------------------
- # Check that expected fields are present
- #------------------------------------------------------------------
- if (! exists $callout->{targetType})
- {
- print ("fapiParseErrorInfo.pl ERROR. Callout targetType missing\n");
- exit(1);
- }
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC) ";
+ $count = 0;
- if (! exists $callout->{targetPos})
+ foreach my $collectFfdc (@{$err->{collectFfdc}})
+ {
+ if ($count == 0)
{
- print ("fapiParseErrorInfo.pl ERROR. Callout targetPos missing\n");
- exit(1);
+ print EIFILE "{ fapi::ReturnCode l_tempRc; ";
}
+ $count++;
- if (! exists $callout->{priority})
- {
- print ("fapiParseErrorInfo.pl ERROR. Callout priority missing\n");
- exit(1);
- }
+ print EIFILE "FAPI_EXEC_HWP(l_tempRc, $collectFfdc, RC); ";
+ }
- #------------------------------------------------------------------
- # Print the Callout data to fapiErrorInfoMemInit.C
- #------------------------------------------------------------------
- print MIFILE " {\n";
- print MIFILE " ErrorInfoCallout l_callout($callout->{targetType}, ";
- print MIFILE "$callout->{targetPos}, $callout->{priority});\n";
- print MIFILE " l_record.iv_callouts.push_back(l_callout);\n";
- print MIFILE " }\n";
+ if ($count > 0)
+ {
+ print EIFILE "}";
}
+ print EIFILE "\n";
+
#----------------------------------------------------------------------
- # For each Gard element
+ # Print the ADD_ERROR_INFO macro to fapiHwpErrorInfo.H
#----------------------------------------------------------------------
- foreach my $gard (@{$err->{gard}})
+ print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) ";
+
+ # Array of EI Objects
+ my @eiObjects;
+
+ my $eiObjectStr = "const void * l_objects[] = {";
+ my $eiEntryStr = "fapi::ReturnCode::ErrorInfoEntry l_entries[] = {";
+ my $eiEntryCount = 0;
+
+ # Local FFDC
+ foreach my $ffdc (@{$err->{ffdc}})
{
- #------------------------------------------------------------------
- # Check that expected fields are present
- #------------------------------------------------------------------
- if (! exists $gard->{targetType})
- {
- print ("fapiParseErrorInfo.pl ERROR. Gard targetType missing\n");
- exit(1);
- }
+ # Add the FFDC data to the EI Object array if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $ffdc);
- if (! exists $gard->{targetPos})
+ # Add an EI entry to eiEntryStr.
+ if ($eiEntryCount > 0)
{
- print ("fapiParseErrorInfo.pl ERROR. Gard targetPos missing\n");
- exit(1);
+ $eiEntryStr .= ", ";
}
-
- #------------------------------------------------------------------
- # Print the Gard data to fapiErrorInfoMemInit.C
- #------------------------------------------------------------------
- print MIFILE " {\n";
- print MIFILE " ErrorInfoGard l_gard($gard->{targetType}, ";
- print MIFILE "$gard->{targetPos});\n";
- print MIFILE " l_record.iv_gards.push_back(l_gard);\n";
- print MIFILE " }\n";
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_FFDC, $objNum, fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc)}";
+ $eiEntryCount++;
}
- #----------------------------------------------------------------------
- # For each FFDC element
- #----------------------------------------------------------------------
- foreach my $ffdc (@{$err->{ffdc}})
+ # Target callouts
+ foreach my $callout (@{$err->{callout}})
{
- #------------------------------------------------------------------
- # Check that expected fields are present
- #------------------------------------------------------------------
- if (! exists $ffdc->{targetType})
+ if (! exists $callout->{target})
{
- print ("fapiParseErrorInfo.pl ERROR. FFDC targetType missing\n");
+ print ("fapiParseErrorInfo.pl ERROR. Callout target missing\n");
exit(1);
}
- if (! exists $ffdc->{targetPos})
+ if (! exists $callout->{priority})
{
- print ("fapiParseErrorInfo.pl ERROR. FFDC targetPos missing\n");
+ print ("fapiParseErrorInfo.pl ERROR. Callout priority missing\n");
exit(1);
}
- if (! exists $ffdc->{ffdcHwp})
+ # Check the type
+ print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$callout->{target}); ";
+
+ # Add the Target to the objectlist if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $callout->{target});
+
+ # Add an EI entry to eiEntryStr
+ if ($eiEntryCount > 0)
{
- print ("fapiParseErrorInfo.pl ERROR. FFDC ffdcHwp missing\n");
- exit(1);
+ $eiEntryStr .= ", ";
}
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_CALLOUT, $objNum, fapi::PRI_$callout->{priority}}";
+ $eiEntryCount++;
+ }
- if (! exists $ffdc->{ffdcHwpData})
+ # Target deconfigures
+ foreach my $deconfigure (@{$err->{deconfigure}})
+ {
+ if (! exists $deconfigure->{target})
{
- print ("fapiParseErrorInfo.pl ERROR. FFDC ffdcHwpData missing\n");
+ print ("fapiParseErrorInfo.pl ERROR. Deconfigure target missing\n");
exit(1);
}
- #------------------------------------------------------------------
- # Print the FFDC data to fapiErrorInfoMemInit.C
- #------------------------------------------------------------------
- print MIFILE " {\n";
- print MIFILE " ErrorInfoFfdc l_ffdc($ffdc->{targetType}, ";
- print MIFILE "$ffdc->{targetPos}, $ffdc->{ffdcHwp}Token);\n";
- print MIFILE " l_record.iv_ffdcs.push_back(l_ffdc);\n";
- print MIFILE " }\n";
-
- #------------------------------------------------------------------
- # Record the FFDC HWP and its data if not already recorded
- #------------------------------------------------------------------
- my $match = 0;
-
- foreach my $ffdcHwp (@ffdcHwps)
+ # Check the type
+ print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$deconfigure->{target}); ";
+
+ # Add the Target to the objectlist if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $deconfigure->{target});
+
+ # Add an EI entry to eiEntryStr
+ if ($eiEntryCount > 0)
+ {
+ $eiEntryStr .= ", ";
+ }
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_DECONF, $objNum}";
+ $eiEntryCount++;
+ }
+
+ # Target Gards
+ foreach my $gard (@{$err->{gard}})
+ {
+ if (! exists $gard->{target})
{
- if ($ffdcHwp eq $ffdc->{ffdcHwp})
- {
- $match = 1;
- }
+ print ("fapiParseErrorInfo.pl ERROR. Gard target missing\n");
+ exit(1);
}
- if (!($match))
+ # Check the type
+ print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$gard->{target}); ";
+
+ # Add the Target to the objectlist if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $gard->{target});
+
+ # Add an EI entry to eiEntryStr
+ if ($eiEntryCount > 0)
{
- push(@ffdcHwps, $ffdc->{ffdcHwp});
- push(@ffdcHwpsData, $ffdc->{ffdcHwpData});
+ $eiEntryStr .= ", ";
}
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_GARD, $objNum}";
+ $eiEntryCount++;
}
- #----------------------------------------------------------------------
- # Print the Error Information Record submit to fapiErrorInfoMemInit.C
- #----------------------------------------------------------------------
- print MIFILE " iv_errorInfoRecords.push_back(l_record);\n";
- print MIFILE " }\n\n";
- }
-}
+ # Complete $eiEntryStr
+ $eiEntryStr .= "};";
-#------------------------------------------------------------------------------
-# Print end of HwpReturnCode enum to fapiHwpReturnCodes.H
-#------------------------------------------------------------------------------
-print RCFILE "};\n\n";
+ # Add all objects to $eiObjectStr
+ my $objCount = 0;
-#------------------------------------------------------------------------------
-# Print FfdcHwpToken enum to fapiHwpReturnCodes.H
-#------------------------------------------------------------------------------
-print RCFILE "/**\n";
-print RCFILE " * \@brief Enumeration of tokens representing FFDC HWPs\n";
-print RCFILE " *\/\n";
-print RCFILE "enum FfdcHwpToken\n";
-print RCFILE "{\n";
+ foreach my $eiObject (@eiObjects)
+ {
+ if ($objCount > 0)
+ {
+ $eiObjectStr .= ", ";
+ }
+ $eiObjectStr .= "&$eiObject";
+ $objCount++;
+ }
+ $eiObjectStr .= "};";
-foreach my $ffdcHwp (@ffdcHwps)
-{
- print RCFILE " $ffdcHwp", "Token,\n";
+ # Print info to file
+ if ($eiEntryCount > 0)
+ {
+ print EIFILE "{$eiObjectStr $eiEntryStr ";
+ print EIFILE "RC.addErrorInfo(l_objects, l_entries, $eiEntryCount);}\n\n";
+ }
+ }
}
-print RCFILE "};\n\n";
-
#------------------------------------------------------------------------------
# Print end of file information to fapiHwpReturnCodes.H
#------------------------------------------------------------------------------
+print RCFILE "};\n\n";
print RCFILE "}\n\n";
print RCFILE "#endif\n";
#------------------------------------------------------------------------------
-# Print FFDC function calls to fapiCollectFfdc.C
-#------------------------------------------------------------------------------
-for (my $i = 0; $i < scalar(@ffdcHwps); $i++)
-{
- print FFFILE " case $ffdcHwps[$i]Token:\n";
- print FFFILE " {\n";
- print FFFILE " $ffdcHwpsData[$i] l_ffdc;\n";
- print FFFILE " FAPI_EXEC_HWP(l_rc, $ffdcHwps[$i], i_target, l_ffdc);\n\n";
- print FFFILE " if (!l_rc)\n";
- print FFFILE " {\n";
- print FFFILE " o_pFfdc = new uint8_t[sizeof(l_ffdc)];\n";
- print FFFILE " o_size = sizeof(l_ffdc);\n";
- print FFFILE " memcpy(o_pFfdc, &l_ffdc, sizeof(l_ffdc));\n";
- print FFFILE " }\n";
- print FFFILE " }\n";
- print FFFILE " break;\n";
-}
-
-print FFFILE " default:\n";
-print FFFILE " l_rc = FAPI_RC_FFDC_HWP_NOT_FOUND;\n";
-print FFFILE " break;\n";
-
-print FFFILE " }\n\n";
-print FFFILE " return l_rc;\n";
-print FFFILE "}\n\n";
-
-#------------------------------------------------------------------------------
-# Print end of file information to fapiCollectFfdc.C
+# Print end of file information to fapiHwpErrorInfo.H
#------------------------------------------------------------------------------
-print FFFILE "}\n\n";
-
-#------------------------------------------------------------------------------
-# Print end of file information to fapiErrorInfoMemInit.C
-#------------------------------------------------------------------------------
-print MIFILE "}\n\n}\n";
+print EIFILE "\n\n#endif\n";
#------------------------------------------------------------------------------
# Close output files
#------------------------------------------------------------------------------
close(RCFILE);
-close(FFFILE);
-close(MIFILE);
+close(EIFILE);
+
diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C
index 06064704d..411177264 100644
--- a/src/usr/hwpf/fapi/fapiReturnCode.C
+++ b/src/usr/hwpf/fapi/fapiReturnCode.C
@@ -38,10 +38,12 @@
* and Error Target if
* FAPI_RC_SUCCESS is assigned to
* ReturnCode
+ * mjjones 09/22/2011 Added ErrorInfo Support
*/
#include <fapiReturnCode.H>
#include <fapiReturnCodeDataRef.H>
+#include <fapiPlatTrace.H>
namespace fapi
{
@@ -50,8 +52,7 @@ namespace fapi
// Default Constructor
//******************************************************************************
ReturnCode::ReturnCode() :
- iv_rcValue(FAPI_RC_SUCCESS), iv_pPlatDataRef(NULL), iv_pHwpFfdcRef(NULL),
- iv_pErrTarget(NULL)
+ iv_rcValue(FAPI_RC_SUCCESS), iv_pDataRef(NULL)
{
}
@@ -60,8 +61,7 @@ ReturnCode::ReturnCode() :
// Constructor
//******************************************************************************
ReturnCode::ReturnCode(const uint32_t i_rcValue) :
- iv_rcValue(i_rcValue), iv_pPlatDataRef(NULL), iv_pHwpFfdcRef(NULL),
- iv_pErrTarget(NULL)
+ iv_rcValue(i_rcValue), iv_pDataRef(NULL)
{
}
@@ -70,26 +70,13 @@ ReturnCode::ReturnCode(const uint32_t i_rcValue) :
// Copy Constructor
//******************************************************************************
ReturnCode::ReturnCode(const ReturnCode & i_right) :
- iv_rcValue(i_right.iv_rcValue), iv_pPlatDataRef(i_right.iv_pPlatDataRef),
- iv_pHwpFfdcRef(i_right.iv_pHwpFfdcRef), iv_pErrTarget(NULL)
+ iv_rcValue(i_right.iv_rcValue), iv_pDataRef(i_right.iv_pDataRef)
{
- // Note shallow copy of data ref pointers. Both ReturnCodes now point to the
- // same data
-
- // Increment the data ref counts and create a new copy of the error target
- if (iv_pPlatDataRef)
- {
- (void) iv_pPlatDataRef->incRefCount();
- }
-
- if (iv_pHwpFfdcRef)
- {
- (void) iv_pHwpFfdcRef->incRefCount();
- }
-
- if (i_right.iv_pErrTarget)
+ // Note shallow copy of data ref pointer. Both ReturnCodes now point to any
+ // associated data. If there is data, increment the data ref count
+ if (iv_pDataRef)
{
- iv_pErrTarget = new Target(*i_right.iv_pErrTarget);
+ iv_pDataRef->incRefCount();
}
}
@@ -98,11 +85,8 @@ ReturnCode::ReturnCode(const ReturnCode & i_right) :
//******************************************************************************
ReturnCode::~ReturnCode()
{
- // Remove interest in any data references and delete any Error Target
- (void) removePlatData();
- (void) removeHwpFfdc();
- delete iv_pErrTarget;
- iv_pErrTarget = NULL;
+ // Forget about any associated data
+ forgetData();
}
//******************************************************************************
@@ -113,34 +97,20 @@ ReturnCode & ReturnCode::operator=(const ReturnCode & i_right)
// Test for self assignment
if (this != &i_right)
{
- // Remove interest in any data references and delete any Error Target
- (void) removePlatData();
- (void) removeHwpFfdc();
- delete iv_pErrTarget;
- iv_pErrTarget = NULL;
-
- // Copy instance variables. Note shallow copy of data ref pointers. Both
- // ReturnCodes now point to the same data
- iv_rcValue = i_right.iv_rcValue;
- iv_pPlatDataRef = i_right.iv_pPlatDataRef;
- iv_pHwpFfdcRef = i_right.iv_pHwpFfdcRef;
+ // Forget about any associated data
+ forgetData();
- // Increment the data ref counts and create a new copy of the error tgt
- if (iv_pPlatDataRef)
- {
- (void) iv_pPlatDataRef->incRefCount();
- }
-
- if (iv_pHwpFfdcRef)
- {
- (void) iv_pHwpFfdcRef->incRefCount();
- }
+ // Note shallow copy of data ref pointer. Both ReturnCodes now point to
+ // any associated data. If there is data, increment the data ref count
+ iv_rcValue = i_right.iv_rcValue;
+ iv_pDataRef = i_right.iv_pDataRef;
- if (i_right.iv_pErrTarget)
+ if (iv_pDataRef)
{
- iv_pErrTarget = new Target(*i_right.iv_pErrTarget);
+ iv_pDataRef->incRefCount();
}
}
+
return *this;
}
@@ -151,19 +121,27 @@ ReturnCode & ReturnCode::operator=(const uint32_t i_rcValue)
{
iv_rcValue = i_rcValue;
- if (ok())
+ if (iv_rcValue == FAPI_RC_SUCCESS)
{
- // Remove interest in any data references and delete any Error Target
- (void) removePlatData();
- (void) removeHwpFfdc();
- delete iv_pErrTarget;
- iv_pErrTarget = NULL;
+ // Forget about any associated data
+ forgetData();
}
return *this;
}
//******************************************************************************
+// resetError function
+//******************************************************************************
+void ReturnCode::resetError(const uint32_t i_rcValue)
+{
+ iv_rcValue = i_rcValue;
+
+ // Forget about any associated data
+ forgetData();
+}
+
+//******************************************************************************
// ok function
//******************************************************************************
bool ReturnCode::ok() const
@@ -180,16 +158,24 @@ ReturnCode::operator uint32_t() const
}
//******************************************************************************
+// setPlatData function
+//******************************************************************************
+void ReturnCode::setPlatData(void * i_pData)
+{
+ ensureDataRefExists();
+ iv_pDataRef->setPlatData(i_pData);
+}
+
+//******************************************************************************
// getPlatData function
//******************************************************************************
void * ReturnCode::getPlatData() const
{
void * l_pData = NULL;
- if (iv_pPlatDataRef)
+ if (iv_pDataRef)
{
- // Get the data
- l_pData = iv_pPlatDataRef->getData();
+ l_pData = iv_pDataRef->getPlatData();
}
return l_pData;
@@ -202,56 +188,120 @@ void * ReturnCode::releasePlatData()
{
void * l_pData = NULL;
- if (iv_pPlatDataRef)
+ if (iv_pDataRef)
{
- // Release the data
- l_pData = iv_pPlatDataRef->releaseData();
-
- // Remove interest in ReturnCodePlatDataRef
- (void) removePlatData();
+ l_pData = iv_pDataRef->releasePlatData();
}
return l_pData;
}
//******************************************************************************
-// setPlatData function
+// addErrorInfo function
//******************************************************************************
-void ReturnCode::setPlatData(void * i_pData)
+void ReturnCode::addErrorInfo(const void * const * i_pObjects,
+ const ErrorInfoEntry * i_pEntries,
+ const uint8_t i_count)
{
- // Remove interest in ReturnCodePlatDataRef
- (void) removePlatData();
+ for (uint32_t i = 0; i < i_count; i++)
+ {
+ // Figure out the object of this entry
+ const void * l_pObject = i_pObjects[i_pEntries[i].iv_object];
+
+ if (i_pEntries[i].iv_type == EI_TYPE_FFDC)
+ {
+ // Get the size of the object to add as FFDC
+ int8_t l_size = i_pEntries[i].iv_data1;
+
+ if (l_size > 0)
+ {
+ // This is a regular FFDC data object that can be directly
+ // memcopied
+ FAPI_ERR("addErrorInfo: Adding FFDC, size: %d", l_size);
+ addEIFfdc(l_pObject, l_size);
+ }
+ else
+ {
+ // This is a special FFDC data object
+ if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB)
+ {
+ // The FFDC is a ecmdDataBufferBase
+ FAPI_ERR("addErrorInfo: Adding ecmdDB FFDC");
+ const ecmdDataBufferBase * l_pDb =
+ static_cast<const ecmdDataBufferBase *>(l_pObject);
+ ReturnCodeFfdc::addEIFfdc(*this, *l_pDb);
+ }
+ else
+ {
+ FAPI_ERR("addErrorInfo: Unrecognized FFDC data: %d",
+ l_size);
+ }
+ }
+ }
+ else if (i_pEntries[i].iv_type == EI_TYPE_CALLOUT)
+ {
+ // Get a pointer to the Target to callout and the priority
+ const Target * l_pTarget = static_cast<const Target *>(l_pObject);
+ CalloutPriority l_pri =
+ static_cast<CalloutPriority>(i_pEntries[i].iv_data1);
+
+ // Add the ErrorInfo
+ FAPI_ERR("addErrorInfo: Adding callout, pri: %d", l_pri);
+ addEICallout(*l_pTarget, l_pri);
+ }
+ else if (i_pEntries[i].iv_type == EI_TYPE_DECONF)
+ {
+ // Get a pointer to the Target to deconfigure
+ const Target * l_pTarget = static_cast<const Target *>(l_pObject);
+
+ // Add the ErrorInfo
+ FAPI_ERR("addErrorInfo: Adding deconfigure");
+ addEIDeconfigure(*l_pTarget);
+ }
+ else if (i_pEntries[i].iv_type == EI_TYPE_GARD)
+ {
+ // Get a pointer to the Target to create a GARD record for
+ const Target * l_pTarget = static_cast<const Target *>(l_pObject);
- // Create a new ReturnCodePlatDataRef which points to the data
- iv_pPlatDataRef = new ReturnCodePlatDataRef(i_pData);
+ // Add the ErrorInfo
+ FAPI_ERR("addErrorInfo: Adding GARD");
+ addEIGard(*l_pTarget);
+ }
+ else
+ {
+ FAPI_ERR("addErrorInfo: Unrecognized EI type: %d",
+ i_pEntries[i].iv_type);
+ }
+ }
}
//******************************************************************************
-// getHwpFfdc function
+// addEIFfdc function
//******************************************************************************
-const void * ReturnCode::getHwpFfdc(uint32_t & o_size) const
+void ReturnCode::addEIFfdc(const void * i_pFfdc,
+ const uint32_t i_size)
{
- const void * l_pFfdc = NULL;
-
- if (iv_pHwpFfdcRef)
- {
- // Get the HwpFfdc
- l_pFfdc = iv_pHwpFfdcRef->getData(o_size);
- }
-
- return l_pFfdc;
+ // Create a ErrorInfoFfdc object and add it to the Error Information
+ FAPI_ERR("addEIFfdc: Adding FFDC, size: %d", i_size);
+ ensureDataRefExists();
+ ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_pFfdc, i_size);
+ iv_pDataRef->getCreateErrorInfo().iv_ffdcs.push_back(l_pFfdc);
}
+
//******************************************************************************
-// setHwpFfdc function
+// getErrorInfo function
//******************************************************************************
-void ReturnCode::setHwpFfdc(const void * i_pFfdc, const uint32_t i_size)
+const ErrorInfo * ReturnCode::getErrorInfo() const
{
- // Remove interest in ReturnCodeHwpFfdcRef
- (void) removeHwpFfdc();
+ ErrorInfo * l_pErrorInfo = NULL;
- // Create a new ReturnCodeHwpFfdcRef which contains the HwpFfdc
- iv_pHwpFfdcRef = new ReturnCodeHwpFfdcRef(i_pFfdc, i_size);
+ if (iv_pDataRef != NULL)
+ {
+ l_pErrorInfo = iv_pDataRef->getErrorInfo();
+ }
+
+ return l_pErrorInfo;
}
//******************************************************************************
@@ -274,59 +324,66 @@ ReturnCode::returnCodeCreator ReturnCode::getCreator() const
}
//******************************************************************************
-// setErrTarget function
+// ensureDataRefExists function
//******************************************************************************
-void ReturnCode::setErrTarget(const Target & i_target)
+void ReturnCode::ensureDataRefExists()
{
- if ((iv_rcValue != FAPI_RC_SUCCESS) && (iv_pErrTarget == NULL))
+ if (!iv_pDataRef)
{
- // Create a copy of the target
- iv_pErrTarget = new Target(i_target);
+ iv_pDataRef = new ReturnCodeDataRef();
}
}
//******************************************************************************
-// getErrTarget function
+// forgetData function
//******************************************************************************
-Target * ReturnCode::getErrTarget() const
+void ReturnCode::forgetData()
{
- return iv_pErrTarget;
-}
-
-//******************************************************************************
-// removePlatData function
-//******************************************************************************
-void ReturnCode::removePlatData()
-{
- if (iv_pPlatDataRef)
+ if (iv_pDataRef)
{
- // Decrement the ReturnCodePlatDataRef refcount
- if (iv_pPlatDataRef->decRefCountCheckZero())
+ // Decrement the refcount
+ if (iv_pDataRef->decRefCountCheckZero())
{
// Refcount decremented to zero. No other ReturnCode points to the
- // ReturnCodePlatDataRef object, delete it
- delete iv_pPlatDataRef;
+ // ReturnCodeDataRef object, delete it
+ delete iv_pDataRef;
}
- iv_pPlatDataRef = NULL;
+ iv_pDataRef = NULL;
}
}
//******************************************************************************
-// removeHwpFfdc function
+// addEICallout function
//******************************************************************************
-void ReturnCode::removeHwpFfdc()
+void ReturnCode::addEICallout(const Target & i_target,
+ const CalloutPriority i_priority)
{
- if (iv_pHwpFfdcRef)
- {
- // Decrement the ReturnCodeHwpFfdcRef refcount
- if (iv_pHwpFfdcRef->decRefCountCheckZero())
- {
- // Refcount decremented to zero. No other ReturnCode points to the
- // ReturnCodeHwpFfdcRef object, delete it
- delete iv_pHwpFfdcRef;
- }
- iv_pHwpFfdcRef = NULL;
- }
+ // Create a ErrorInfoCallout object and add it to the Error Information
+ ensureDataRefExists();
+ ErrorInfoCallout * l_pCallout = new ErrorInfoCallout(i_target, i_priority);
+ iv_pDataRef->getCreateErrorInfo().iv_callouts.push_back(l_pCallout);
+}
+
+//******************************************************************************
+// addEIDeconfigure function
+//******************************************************************************
+void ReturnCode::addEIDeconfigure(const Target & i_target)
+{
+ // Create a ErrorInfoDeconfig object and add it to the Error Information
+ ensureDataRefExists();
+ ErrorInfoDeconfig * l_pDeconfig = new ErrorInfoDeconfig(i_target);
+ iv_pDataRef->getCreateErrorInfo().iv_deconfigs.push_back(l_pDeconfig);
+}
+
+//******************************************************************************
+// addEIGard function
+//******************************************************************************
+void ReturnCode::addEIGard(const Target & i_target)
+{
+ // Create a ErrorInfoGard object and add it to the Error Information
+ ensureDataRefExists();
+ ErrorInfoGard * l_pGard = new ErrorInfoGard(i_target);
+ iv_pDataRef->getCreateErrorInfo().iv_gards.push_back(l_pGard);
}
}
diff --git a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C
index 60fcdd45b..2cc20c747 100644
--- a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C
+++ b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C
@@ -35,6 +35,7 @@
* mjjones 06/30/2011 Added #include
* mjjones 07/05/2011 Removed const from data
* mjjones 07/25/2011 Added support for FFDC
+ * mjjones 09/22/2100 Added support for Error Info
*/
#include <string.h>
@@ -46,28 +47,35 @@ namespace fapi
{
//******************************************************************************
-// ReturnCodeDataRef Constructor
+// Constructor
//******************************************************************************
-ReturnCodeDataRef::ReturnCodeDataRef() :
- iv_refCount(1)
+ReturnCodeDataRef::ReturnCodeDataRef()
+: iv_refCount(1),
+ iv_pPlatData(NULL),
+ iv_pErrorInfo(NULL)
{
}
//******************************************************************************
-// ReturnCodeDataRef Destructor
+// Destructor
//******************************************************************************
ReturnCodeDataRef::~ReturnCodeDataRef()
{
if (iv_refCount != 0)
{
- FAPI_ERR("ReturnCodeDataRef. Bug. Destruct with refcount");
+ FAPI_ERR("ReturnCodeDataRef. Bug. Destruct with refcount: %d",
+ iv_refCount);
fapiAssert(false);
}
+
+ deletePlatData();
+ delete iv_pErrorInfo;
+ iv_pErrorInfo = NULL;
}
//******************************************************************************
-// ReturnCodeDataRef incRefCount function
+// incRefCount function
//******************************************************************************
void ReturnCodeDataRef::incRefCount()
{
@@ -77,7 +85,7 @@ void ReturnCodeDataRef::incRefCount()
}
//******************************************************************************
-// ReturnCodeDataRef decRefCountCheckZero function
+// decRefCountCheckZero function
//******************************************************************************
bool ReturnCodeDataRef::decRefCountCheckZero()
{
@@ -97,68 +105,57 @@ bool ReturnCodeDataRef::decRefCountCheckZero()
}
//******************************************************************************
-// ReturnCodePlatDataRef Constructor
+// setPlatData function
//******************************************************************************
-ReturnCodePlatDataRef::ReturnCodePlatDataRef(void * i_pData) :
- iv_pData(i_pData)
+void ReturnCodeDataRef::setPlatData(void * i_pPlatData)
{
+ // Delete any current PlatData
+ if (iv_pPlatData)
+ {
+ FAPI_ERR("ReturnCodeDataRef. setPlatData when existing data");
+ deletePlatData();
+ }
+ iv_pPlatData = i_pPlatData;
}
//******************************************************************************
-// ReturnCodePlatDataRef Destructor
-//******************************************************************************
-ReturnCodePlatDataRef::~ReturnCodePlatDataRef()
-{
- // Call platform implemented deleteData
- (void) deleteData();
-}
-
-//******************************************************************************
-// ReturnCodePlatDataRef getData function
+// getPlatData function
//******************************************************************************
-void * ReturnCodePlatDataRef::getData() const
+void * ReturnCodeDataRef::getPlatData() const
{
- return iv_pData;
+ return iv_pPlatData;
}
//******************************************************************************
-// ReturnCodePlatDataRef releaseData function
+// releasePlatData function
//******************************************************************************
-void * ReturnCodePlatDataRef::releaseData()
+void * ReturnCodeDataRef::releasePlatData()
{
- void * l_pData = iv_pData;
- iv_pData = NULL;
- return l_pData;
+ void * l_pPlatData = iv_pPlatData;
+ iv_pPlatData = NULL;
+ return l_pPlatData;
}
//******************************************************************************
-// ReturnCodeHwpFfdcRef Constructor
+// getErrorInfo function
//******************************************************************************
-ReturnCodeHwpFfdcRef::ReturnCodeHwpFfdcRef(const void * i_pFfdc,
- const uint32_t i_size)
-: iv_size(i_size)
+ErrorInfo * ReturnCodeDataRef::getErrorInfo()
{
- iv_pFfdc = new uint8_t[i_size];
- memcpy(iv_pFfdc, i_pFfdc, i_size);
+ return iv_pErrorInfo;
}
//******************************************************************************
-// ReturnCodeHwpFfdcRef Destructor
+// getCreateErrorInfo function
//******************************************************************************
-ReturnCodeHwpFfdcRef::~ReturnCodeHwpFfdcRef()
+ErrorInfo & ReturnCodeDataRef::getCreateErrorInfo()
{
- delete [] iv_pFfdc;
- iv_pFfdc = NULL;
-}
+ if (iv_pErrorInfo == NULL)
+ {
+ iv_pErrorInfo = new ErrorInfo();
+ }
-//******************************************************************************
-// ReturnCodeHwpFfdcRef getData function
-//******************************************************************************
-const void * ReturnCodeHwpFfdcRef::getData(uint32_t & o_size) const
-{
- o_size = iv_size;
- return iv_pFfdc;
+ return *iv_pErrorInfo;
}
}
diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile
index a2ea9275f..31124d43b 100644
--- a/src/usr/hwpf/fapi/makefile
+++ b/src/usr/hwpf/fapi/makefile
@@ -32,10 +32,7 @@ OBJS = fapiReturnCode.o \
fapiReturnCodeDataRef.o \
fapiTarget.o \
fapiHwAccess.o \
- fapiErrorInfo.o \
- fapiErrorInfoMem.o \
- fapiErrorInfoMemInit.o \
- fapiCollectFfdc.o
+ fapiErrorInfo.o
include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
index fb7e20439..62cd3badd 100644
--- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
+++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
@@ -27,29 +27,30 @@
<!-- *********************************************************************** -->
<hwpError>
<rc>RC_TEST_ERROR_A</rc>
- <description>Test Error A for a HWP operating on a PROC_CHIP</description>
+ <description>Test Error A</description>
+ <!-- Call hwpTestFfdc1 to collect FFDC from the master chip -->
+ <collectFfdc>hwpTestFfdc1, MASTER_CHIP</collectFfdc>
+ <!-- Collect local FFDC FFDC_DATA_1 -->
+ <ffdc>FFDC_DATA_1</ffdc>
+ <!-- Callout MASTER_CHIP HIGH -->
<callout>
- <!-- The callout is the PROC_CHIP itself -->
- <targetType>TARGET_TYPE_PROC_CHIP</targetType>
- <targetPos>0</targetPos>
+ <target>MASTER_CHIP</target>
<priority>HIGH</priority>
</callout>
+ <!-- Deconfigure MASTER_CHIP -->
+ <deconfigure>
+ <target>MASTER_CHIP</target>
+ </deconfigure>
+ <!-- Create GARD record for MASTER_CHIP -->
<gard>
- <!-- The PROC_CHIP itself should be garded -->
- <targetType>TARGET_TYPE_PROC_CHIP</targetType>
- <targetPos>0</targetPos>
+ <target>MASTER_CHIP</target>
</gard>
- <ffdc>
- <!-- FFDC needs to be collected from the PROC_CHIP itself -->
- <targetType>TARGET_TYPE_PROC_CHIP</targetType>
- <targetPos>0</targetPos>
- <ffdcHwp>hwpTestFfdc1</ffdcHwp>
- <ffdcHwpData>TestFfdc1</ffdcHwpData>
- </ffdc>
</hwpError>
<!-- *********************************************************************** -->
<hwpError>
<rc>RC_TEST_ERROR_B</rc>
<description>Test Error B</description>
+ <!-- Call hwpTestAnalyzeError on MASTER_CHIP to analyze the error -->
+ <callFunc>hwpTestAnalyzeError, MASTER_CHIP</callFunc>
</hwpError>
</hwpErrors>
diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
index 6cf43ee6a..d8693d610 100755
--- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
@@ -33,6 +33,7 @@
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 06/30/2011 Created.
* mjjones 09/07/2011 Update to test scratch attrs
+ * mjjones 10/06/2011 Updates traces
*
*/
@@ -46,7 +47,7 @@ extern "C"
//******************************************************************************
fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
{
- FAPI_INF("Performing HWP: hwpTestAttributes");
+ FAPI_INF("hwpTestAttributes: Start HWP");
// Attempt to call the attribute get/set macros for the scratch attributes
fapi::ReturnCode l_rc;
@@ -996,6 +997,7 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
} while (0);
+ FAPI_INF("hwpTestAttributes: End HWP");
return l_rc;
}
diff --git a/src/usr/hwpf/hwp/fapiTestHwpConfig.C b/src/usr/hwpf/hwp/fapiTestHwpConfig.C
index ce47b82df..41f89d01e 100644
--- a/src/usr/hwpf/hwp/fapiTestHwpConfig.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpConfig.C
@@ -32,6 +32,7 @@
* Flag Defect/Feature User Date Description
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 09/12/2011 Created.
+ * mjjones 10/06/2011 Updated traces.
*
*/
@@ -45,7 +46,7 @@ extern "C"
//******************************************************************************
fapi::ReturnCode hwpTestConfig(const fapi::Target & i_chip)
{
- FAPI_INF("Performing HWP: hwpTestConfig");
+ FAPI_INF("hwpTestConfig: Start HWP");
// Print the ecmd string of the chip
char l_string[fapi::MAX_ECMD_STRING_LEN] = {0};
@@ -110,6 +111,7 @@ fapi::ReturnCode hwpTestConfig(const fapi::Target & i_chip)
}
}
+ FAPI_INF("hwpTestConfig: End HWP");
return l_rc;
}
diff --git a/src/usr/hwpf/hwp/fapiTestHwpError.C b/src/usr/hwpf/hwp/fapiTestHwpError.C
index d1d7e5e5c..e0d2ef6da 100644
--- a/src/usr/hwpf/hwp/fapiTestHwpError.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpError.C
@@ -33,6 +33,8 @@
* mjjones 08/08/2011 Created.
* camvanng 09/06/2011 Added code to test
* fapiLogError
+ * mjjones 10/06/2011 Major updates due to new
+ * ErrorInfo design
*
*/
@@ -42,54 +44,60 @@ extern "C"
{
//******************************************************************************
+// hwpTestAnalyzeError function
+//******************************************************************************
+fapi::ReturnCode hwpTestAnalyzeError(const fapi::Target & i_target)
+{
+ FAPI_INF("hwpTestAnalyzeError: Start HWP (analysis HWP)");
+
+ // This HWP analyses an error condition to decide what the error actually is
+ // In real life, this HWP may look at chip error registers
+ fapi::ReturnCode l_rc;
+
+ // Local FFDC that needs to be captured
+ uint32_t l_ffdc = 0x12345678;
+
+ // Analysis reveals that the error is RC_TEST_ERROR_A
+ FAPI_ERR("hwpTestAnalyzeError: Generating RC_TEST_ERROR_A");
+
+ const fapi::Target & MASTER_CHIP = i_target;
+ uint32_t & FFDC_DATA_1 = l_ffdc;
+ FAPI_SET_HWP_ERROR(l_rc, RC_TEST_ERROR_A);
+
+ FAPI_INF("hwpTestAnalyzeError: End HWP");
+ return l_rc;
+}
+
+//******************************************************************************
// hwpTestError function
//******************************************************************************
fapi::ReturnCode hwpTestError(const fapi::Target & i_target)
{
- FAPI_INF("Performing HWP: hwpTestError");
+ FAPI_INF("hwpTestError: Start HWP");
- fapi::ReturnCode l_rc = fapi::RC_TEST_ERROR_A;
+ fapi::ReturnCode l_rc;
- // Add some local FFDC to the ReturnCode
- uint32_t l_ffdc = 0x12345678;
- l_rc.setHwpFfdc(l_ffdc);
+ // Error RC_TEST_ERROR_B encountered, the error information requests that
+ // hwpTestAnalyzeError be called to analyze the error condition
+ FAPI_ERR("hwpTestError: Generating RC_TEST_ERROR_B");
+ const fapi::Target & MASTER_CHIP = i_target;
+ FAPI_SET_HWP_ERROR(l_rc, RC_TEST_ERROR_B);
// Log the error
fapiLogError(l_rc);
- // Check that the return code is set to success and any data or Error
- // Target references are cleared
+ // Check that the return code is set to success
if (!l_rc.ok())
{
FAPI_ERR("Performing HWP: hwpTestError: rc is 0x%x, " \
"expected success", static_cast<uint32_t>(l_rc));
}
- if (l_rc.getErrTarget() != NULL)
- {
- FAPI_ERR("Performing HWP: hwpTestError: getErrTarget " \
- "returned non-null pointer");
- }
-
- if (l_rc.getPlatData() != NULL)
- {
- FAPI_ERR("Performing HWP: hwpTestError: getPlatData " \
- "returned non-null pointer");
- }
-
- uint32_t l_size = 0;
- if (l_rc.getHwpFfdc(l_size) != NULL)
- {
- FAPI_ERR("Performing HWP: hwpTestError: getHwpFFDC " \
- "returned non-null pointer");
- }
-
// Reset the return code
- l_rc = fapi::RC_TEST_ERROR_A;
-
- // Add some local FFDC to the ReturnCode
- l_rc.setHwpFfdc(reinterpret_cast<void *>(&l_ffdc), sizeof(uint32_t));
+ FAPI_ERR("hwpTestError: Generating RC_TEST_ERROR_B");
+ FAPI_SET_HWP_ERROR(l_rc, RC_TEST_ERROR_B);
+ FAPI_INF("hwpTestError: End HWP");
return l_rc;
}
diff --git a/src/usr/hwpf/hwp/fapiTestHwpFfdc.C b/src/usr/hwpf/hwp/fapiTestHwpFfdc.C
index 69d3fb57a..57cc8fd3c 100644
--- a/src/usr/hwpf/hwp/fapiTestHwpFfdc.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpFfdc.C
@@ -31,6 +31,8 @@
* Flag Defect/Feature User Date Description
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 08/08/2011 Created.
+ * mjjones 10/06/2011 Updated due to new ErrorInfo
+ * design.
*
*/
@@ -43,17 +45,17 @@ extern "C"
// hwpTestFfdc1 function
//******************************************************************************
fapi::ReturnCode hwpTestFfdc1(const fapi::Target & i_target,
- fapi::TestFfdc1 & o_ffdc)
+ fapi::ReturnCode & o_rc)
{
- FAPI_INF("Performing FFDC HWP: hwpTestFfdc1");
+ FAPI_INF("hwpTestFfdc1: Start HWP (FFDC HWP)");
- // Just set data to output structure. A real FFDC HWP would do a hardware
- // access to get FFDC
- fapi::ReturnCode l_rc;
+ // Collect a uint64_t worth of FFDC
+ uint64_t l_ffdc = 0x1122334455667788ULL;
- o_ffdc.iv_data = 0x11223344;
+ fapi::ReturnCodeFfdc::addEIFfdc(o_rc, l_ffdc);
- return l_rc;
+ FAPI_INF("hwpTestFfdc1: End HWP");
+ return fapi::FAPI_RC_SUCCESS;
}
} // extern "C"
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
index 48f46c401..96d42c7e5 100644
--- a/src/usr/hwpf/makefile
+++ b/src/usr/hwpf/makefile
@@ -23,8 +23,7 @@
ROOTPATH = ../../..
MODULE = hwpf
-FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiCollectFfdc.C \
- fapiErrorInfoMemInit.C
+FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiHwpErrorInfo.H
FAPI_ATTR_TARGETS = fapiAttributeIds.H
GENFILES = ${FAPI_ERROR_TARGETS} ${FAPI_ATTR_TARGETS}
diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
index 63e5aea97..6ba6beebd 100644
--- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
+++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
@@ -31,206 +31,89 @@
#include <fapiPlatTrace.H>
#include <fapiErrorInfo.H>
#include <fapiPlatReasonCodes.H>
-#include <fapiCollectFfdc.H>
#include <errl/errlentry.H>
namespace fapi
{
//******************************************************************************
-// findErrInfoTarget. Finds a target identified by an error information record
-// (for callout, garding or FFDC collection).
+// processEIFfdcs.
+// Processes any FFDC in the ReturnCode Error Information
//******************************************************************************
-Target findErrInfoTarget(const TargetType i_targetType,
- const uint32_t i_targetPos,
- const Target & i_errorTarget)
+void processEIFfdcs(const ErrorInfo & i_errInfo,
+ errlHndl_t io_pError)
{
- Target l_target;
-
- // Note that the Error Target is the target of the failed HWP
- if (i_targetType == i_errorTarget.getType())
- {
- // The error info target type is the same as the Error Target.
- // Therefore the error info target IS the error target
- l_target = i_errorTarget;
- }
- else
+ // Iterate through the FFDCs, adding each to the error log
+ // TODO Should all of the FFDC sections be added as a single blob? There is
+ // overhead to adding lots of different sections.
+ uint32_t l_size;
+ const void * l_pFfdc;
+
+ for (ErrorInfo::ErrorInfoFfdcCItr_t l_itr = i_errInfo.iv_ffdcs.begin();
+ l_itr != i_errInfo.iv_ffdcs.end(); ++l_itr)
{
- // The error info target type is different from the Error Target. Figure
- // out the error info target from the target type and pos (relative to
- // the Error Target
- // TODO
- FAPI_ERR("findErrInfoTarget: Error Info Target determination TBD");
- }
+ l_pFfdc = (*l_itr)->getData(l_size);
- return l_target;
-}
+ FAPI_ERR("processEIFfdcs: Adding %d bytes of FFDC to errlog",
+ l_size);
-//******************************************************************************
-// processErrInfoCallouts. Looks at the callout information in an error
-// information record and adds callouts to the supplied error log
-//******************************************************************************
-void processErrInfoCallouts(ErrorInfoRecord & i_errInfoRecord,
- const Target & i_errorTarget,
- errlHndl_t o_pError)
-{
- // Iterate through callouts, adding each callout to the error log
- for (ErrorInfoRecord::ErrorInfoCalloutItr_t l_itr =
- i_errInfoRecord.iv_callouts.begin();
- l_itr != i_errInfoRecord.iv_callouts.end(); ++l_itr)
- {
- // Find the Target to callout
- Target l_target = findErrInfoTarget((*l_itr).iv_targetType,
- (*l_itr).iv_targetPos,
- i_errorTarget);
-
- if (l_target.getType() == TARGET_TYPE_NONE)
- {
- FAPI_ERR("processErrInfoCallouts: Callout target not found");
- }
- else
- {
- // TODO Add callout to error log
- FAPI_ERR("processErrInfoCallouts: Adding callout TBD");
- }
+ // TODO Which comp id and section numbers should be used and how will
+ // FFDC be parsed?
+ io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size);
}
}
//******************************************************************************
-// processErrInfoGards. Looks at the gard information in an error information
-// record and gards targets
+// processEICallouts
+// Processes any Callout requests in the ReturnCode Error Information
//******************************************************************************
-void processErrInfoGards(ErrorInfoRecord & i_errInfoRecord,
- const Target & i_errorTarget,
- errlHndl_t o_pError)
+void processEICallouts(const ErrorInfo & i_errInfo,
+ errlHndl_t io_pError)
{
- // Iterate through gard requests garding each target
- for (ErrorInfoRecord::ErrorInfoGardItr_t l_itr =
- i_errInfoRecord.iv_gards.begin();
- l_itr != i_errInfoRecord.iv_gards.end(); ++l_itr)
+ // Iterate through the callout requestss, adding each to the error log
+ for (ErrorInfo::ErrorInfoCalloutCItr_t l_itr =
+ i_errInfo.iv_callouts.begin();
+ l_itr != i_errInfo.iv_callouts.end(); ++l_itr)
{
- // Find the Target to gard
- Target l_target = findErrInfoTarget((*l_itr).iv_targetType,
- (*l_itr).iv_targetPos,
- i_errorTarget);
-
- if (l_target.getType() == TARGET_TYPE_NONE)
- {
- FAPI_ERR("processErrInfoGards: Gard target not found");
- }
- else
- {
- // TODO gard Target
- FAPI_ERR("processErrInfoGards: Garding TBD");
- }
+ // TODO Add callout to error log
+ FAPI_ERR("processEICallouts: Adding target callout to errlog (TODO). Type: 0x%x. Pri: 0x%x",
+ (*l_itr)->iv_target.getType(), (*l_itr)->iv_priority);
}
}
//******************************************************************************
-// processErrInfoFfdcs. Looks at the FFDC information in an error information
-// record, collects the FFDC and adds it to the supplied error log
+// processEIDeconfigs
+// Processes any Deconfig requests in the ReturnCode Error Information
//******************************************************************************
-void processErrInfoFfdcs(ErrorInfoRecord & i_errInfoRecord,
- const Target & i_errorTarget,
- errlHndl_t o_pError)
+void processEIDeconfigs(const ErrorInfo & i_errInfo,
+ errlHndl_t io_pError)
{
- // Iterate through FFDC info, collecting and adding FFDC to the error log
- for(ErrorInfoRecord::ErrorInfoFfdcItr_t l_itr =
- i_errInfoRecord.iv_ffdcs.begin();
- l_itr != i_errInfoRecord.iv_ffdcs.end(); ++l_itr)
+ // Iterate through the deconfigure requests, deconfiguring each target
+ for (ErrorInfo::ErrorInfoDeconfigCItr_t l_itr =
+ i_errInfo.iv_deconfigs.begin();
+ l_itr != i_errInfo.iv_deconfigs.end(); ++l_itr)
{
- // Find the Target to collect FFDC from
- Target l_target = findErrInfoTarget((*l_itr).iv_targetType,
- (*l_itr).iv_targetPos,
- i_errorTarget);
-
- if (l_target.getType() == TARGET_TYPE_NONE)
- {
- FAPI_ERR("processErrInfoFfdcs: FFDC target not found");
- }
- else
- {
- // Collect FFDC. The token identifies the HWP to call to get FFDC
- FfdcHwpToken l_token = (*l_itr).iv_ffdcHwpToken;
- uint8_t * l_pFfdc = NULL;
- uint32_t l_size = 0;
-
- ReturnCode l_rc = fapiCollectFfdc(l_token, l_target, l_pFfdc,
- l_size);
-
- if (l_rc)
- {
- // Error collecting FFDC, just ignore
- FAPI_ERR("processErrInfoFfdcs: Error collecting FFDC. Token: %d",
- l_token);
- }
- else
- {
- // Add FFDC to error log and delete
- // TODO Which comp id and section numbers should be used and how
- // will FFDC be parsed?
- FAPI_ERR("processErrInfoFfdcs: Adding %d bytes of FFDC to log. Token: %d",
- l_size, l_token);
- o_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size);
- delete [] l_pFfdc;
- l_pFfdc = NULL;
- }
-
- }
+ // TODO Deconfigure target
+ FAPI_ERR("processEIDeconfigs: Deconfiguring target (TODO). Type: 0x%x",
+ (*l_itr)->iv_target.getType());
}
}
+
//******************************************************************************
-// processErrInfo. Looks for an error information record associated with the
-// specified HWP generated return code and processes it
+// processEiGards
+// Processes any Gard requests in the ReturnCode Error Information
//******************************************************************************
-void processErrInfo(const ReturnCode & i_rc,
- errlHndl_t o_pError)
+void processEiGards(const ErrorInfo & i_errInfo,
+ errlHndl_t io_pError)
{
- // Get the error info record from the Error Info Repository
- ErrorInfoRecord l_record;
- ErrorInfoRepository::Instance().find(i_rc, l_record);
-
- if (l_record.iv_rc != i_rc)
+ // Iterate through gard requests, creating a GARD record for each target
+ for (ErrorInfo::ErrorInfoGardCItr_t l_itr = i_errInfo.iv_gards.begin();
+ l_itr != i_errInfo.iv_gards.end(); ++l_itr)
{
- // Error Info Record not found. This should not happen
- FAPI_ERR("processErrInfo: No record found for 0x%x",
- static_cast<uint32_t>(i_rc));
- }
- else
- {
- // Error Info Record found
- const char * l_pDescription = l_record.getDescription();
-
- if (l_pDescription)
- {
- FAPI_ERR("processErrInfo: Record found for 0x%x: %s",
- static_cast<uint32_t>(i_rc), l_pDescription);
- }
- else
- {
- FAPI_ERR("processErrInfo: Record found for 0x%x: (no description)",
- static_cast<uint32_t>(i_rc));
- }
-
- // Extract the Error Target (the Target of the failing HWP)
- Target * l_pErrTarget = i_rc.getErrTarget();
-
- if (l_pErrTarget == NULL)
- {
- FAPI_ERR("processErrInfo: Record contains no error target");
- }
- else
- {
- // Process the Error Info Record callout information
- processErrInfoCallouts(l_record, *l_pErrTarget, o_pError);
-
- // Process the Error Info Record gard information
- processErrInfoGards(l_record, *l_pErrTarget, o_pError);
-
- // Process the Error Info Record FFDC information
- processErrInfoFfdcs(l_record, *l_pErrTarget, o_pError);
- }
+ // TODO Create GARD record for target
+ FAPI_ERR("processEIGards: Garding target (TODO). Type: 0x%x",
+ (*l_itr)->iv_target.getType());
}
}
@@ -274,21 +157,23 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc)
RC_HWP_ERROR,
static_cast<uint32_t>(io_rc));
- // Add any HWP FFDC stored in the ReturnCode to the error log
- uint32_t l_sz = 0;
- const void * l_pHwpFfdc = io_rc.getHwpFfdc(l_sz);
+ // Get the Error Information Pointer
+ const ErrorInfo * l_pErrorInfo = NULL;
- if (l_sz)
+ l_pErrorInfo = io_rc.getErrorInfo();
+
+ if (l_pErrorInfo)
{
- // TODO Which comp id and section numbers should be used and how
- // will FFDC be parsed?
- FAPI_ERR("fapiRcToErrl: Adding %d bytes of HWP FFDC to errlog",
- l_sz);
- l_pError->addFFDC(HWPF_COMP_ID, l_pHwpFfdc, l_sz);
+ // There is error information associated with the ReturnCode
+ processEIFfdcs(*l_pErrorInfo, l_pError);
+ processEICallouts(*l_pErrorInfo, l_pError);
+ processEIDeconfigs(*l_pErrorInfo, l_pError);
+ processEiGards(*l_pErrorInfo, l_pError);
+ }
+ else
+ {
+ FAPI_ERR("fapiRcToErrl: No Error Information");
}
-
- // Process the error info record for this error
- processErrInfo(io_rc, l_pError);
}
else
{
@@ -308,7 +193,7 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc)
static_cast<uint32_t>(io_rc));
}
- // Set the ReturnCode to success, this will delete any HWP FFDC or PLAT
+ // Set the ReturnCode to success, this will delete any ErrorInfo or PLAT
// DATA associated with the ReturnCode
io_rc = FAPI_RC_SUCCESS;
}
diff --git a/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C
index 3dd2b5a0f..1389dc38e 100644
--- a/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C
+++ b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C
@@ -37,15 +37,15 @@ namespace fapi
{
//******************************************************************************
-// deleteData function
+// deletePlatData function
//******************************************************************************
-void ReturnCodePlatDataRef::deleteData()
+void ReturnCodeDataRef::deletePlatData()
{
FAPI_DBG("ReturnCodePlatDataRef::deleteData");
// HostBoot platform uses iv_pData to point at an error log.
- delete (static_cast<errlHndl_t>(iv_pData));
- iv_pData = NULL;
+ delete (static_cast<errlHndl_t>(iv_pPlatData));
+ iv_pPlatData = NULL;
}
}
diff --git a/src/usr/hwpf/test/fapiRcTest.C b/src/usr/hwpf/test/fapiRcTest.C
index 1877f6a89..335266fb2 100644
--- a/src/usr/hwpf/test/fapiRcTest.C
+++ b/src/usr/hwpf/test/fapiRcTest.C
@@ -32,6 +32,7 @@
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 04/13/2011 Created.
* mjjones 07/26/2011 Added more tests
+ * mjjones 09/23/2011 Updated test for ErrorInfo
*
*/
@@ -73,6 +74,10 @@ uint32_t rcTest1()
FAPI_ERR("rcTest1. testing rc returned true");
l_result = 3;
}
+ else
+ {
+ FAPI_INF("rcTest1. Success!");
+ }
}
}
@@ -126,6 +131,10 @@ uint32_t rcTest2()
FAPI_ERR("rcTest2. Creator is 0x%x, expected HWP", l_creator);
l_result = 3;
}
+ else
+ {
+ FAPI_INF("rcTest2. Success!");
+ }
}
}
@@ -149,8 +158,7 @@ uint32_t rcTest3()
if (l_codeCheck != l_code)
{
- FAPI_ERR("rcTest3. Code is 0x%x, expected 0x%x", l_codeCheck,
- l_code);
+ FAPI_ERR("rcTest3. Code is 0x%x, expected 0x%x", l_codeCheck, l_code);
l_result = 1;
}
else
@@ -169,6 +177,10 @@ uint32_t rcTest3()
FAPI_ERR("rcTest3. testing rc returned false");
l_result = 3;
}
+ else
+ {
+ FAPI_INF("rcTest3. Success!");
+ }
}
}
@@ -192,7 +204,7 @@ uint32_t rcTest4()
// Ensure that the equality comparison returns true
if (!(l_rc == l_rc2))
{
- FAPI_ERR("rcTest5. 1. Equality comparison false");
+ FAPI_ERR("rcTest4. 1. Equality comparison false");
l_result = 1;
}
else
@@ -200,7 +212,7 @@ uint32_t rcTest4()
// Ensure that the inequality comparison returns false
if (l_rc != l_rc2)
{
- FAPI_ERR("rcTest5. 2. Inequality comparison true");
+ FAPI_ERR("rcTest4. 2. Inequality comparison true");
l_result = 2;
}
else
@@ -211,7 +223,7 @@ uint32_t rcTest4()
// Ensure that the equality comparison returns false
if (l_rc == l_rc2)
{
- FAPI_ERR("rcTest5. 3. Equality comparison true");
+ FAPI_ERR("rcTest4. 3. Equality comparison true");
l_result = 3;
}
else
@@ -219,9 +231,13 @@ uint32_t rcTest4()
// Ensure that the inequality comparison returns true
if (!(l_rc != l_rc2))
{
- FAPI_ERR("rcTest5. 4. Inequality comparison false");
+ FAPI_ERR("rcTest4. 4. Inequality comparison false");
l_result = 4;
}
+ else
+ {
+ FAPI_INF("rcTest4. Success!");
+ }
}
}
}
@@ -246,7 +262,7 @@ uint32_t rcTest5()
// same return code value
if (!(l_rc == l_code))
{
- FAPI_ERR("rcTest6. 1. Equality comparison false");
+ FAPI_ERR("rcTest5. 1. Equality comparison false");
l_result = 1;
}
else
@@ -255,7 +271,7 @@ uint32_t rcTest5()
// the same return code value
if (l_rc != l_code)
{
- FAPI_ERR("rcTest6. 2. Inequality comparison true");
+ FAPI_ERR("rcTest5. 2. Inequality comparison true");
l_result = 2;
}
else
@@ -264,7 +280,7 @@ uint32_t rcTest5()
// to a different return code value
if (l_rc == l_code2)
{
- FAPI_ERR("rcTest6. 3. Equality comparison true");
+ FAPI_ERR("rcTest5. 3. Equality comparison true");
l_result = 3;
}
else
@@ -273,9 +289,13 @@ uint32_t rcTest5()
// comparing to a different return code value
if (!(l_rc != l_code2))
{
- FAPI_ERR("rcTest6. 4. Inequality comparison false");
+ FAPI_ERR("rcTest5. 4. Inequality comparison false");
l_result = 4;
}
+ else
+ {
+ FAPI_INF("rcTest5. Success!");
+ }
}
}
}
@@ -302,7 +322,7 @@ uint32_t rcTest6()
if (l_pData != NULL)
{
- FAPI_ERR("rcTest7. getPlatData did not return NULL");
+ FAPI_ERR("rcTest6. getPlatData did not return NULL");
l_result = 1;
}
else
@@ -314,9 +334,13 @@ uint32_t rcTest6()
if (l_pData != NULL)
{
- FAPI_ERR("rcTest7. releasePlatData did not return NULL");
+ FAPI_ERR("rcTest6. releasePlatData did not return NULL");
l_result = 2;
}
+ else
+ {
+ FAPI_INF("rcTest6. Success!");
+ }
}
return l_result;
@@ -347,7 +371,7 @@ uint32_t rcTest7()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest8. 1. getPlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest7. 1. getPlatData returned unexpected data ptr");
l_result = 1;
}
else
@@ -358,9 +382,13 @@ uint32_t rcTest7()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest8. 2. getPlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest7. 2. getPlatData returned unexpected data ptr");
l_result = 2;
}
+ else
+ {
+ FAPI_INF("rcTest7. Success!");
+ }
}
// Release the data to avoid ReturnCode from deleting in on destruction
@@ -394,7 +422,7 @@ uint32_t rcTest8()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest9. getPlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest8. getPlatData returned unexpected data ptr");
l_result = 1;
}
else
@@ -405,9 +433,13 @@ uint32_t rcTest8()
if (l_pMyDataCheck != NULL)
{
- FAPI_ERR("rcTest9. 2. getPlatData returned non NULL ptr");
+ FAPI_ERR("rcTest8. 2. getPlatData returned non NULL ptr");
l_result = 2;
}
+ else
+ {
+ FAPI_INF("rcTest8. Success!");
+ }
}
return l_result;
@@ -439,7 +471,7 @@ uint32_t rcTest9()
// Ensure that the two ReturnCodes are the same
if (l_rc != l_rc2)
{
- FAPI_ERR("rcTest10. ReturnCodes differ");
+ FAPI_ERR("rcTest9. ReturnCodes differ");
l_result = 1;
}
else
@@ -449,7 +481,7 @@ uint32_t rcTest9()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest10. 1. getPlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest9. 1. getPlatData returned unexpected data ptr");
l_result = 2;
}
else
@@ -460,9 +492,13 @@ uint32_t rcTest9()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest10. 2. getPlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest9. 2. getPlatData returned unexpected data ptr");
l_result = 3;
}
+ else
+ {
+ FAPI_INF("rcTest9. Success!");
+ }
}
}
@@ -500,7 +536,7 @@ uint32_t rcTest10()
// Ensure that the two ReturnCodes are the same
if (l_rc != l_rc2)
{
- FAPI_ERR("rcTest11. ReturnCodes differ");
+ FAPI_ERR("rcTest10. ReturnCodes differ");
l_result = 1;
}
else
@@ -510,7 +546,7 @@ uint32_t rcTest10()
if (l_pMyDataCheck != l_pMyData)
{
- FAPI_ERR("rcTest11. releasePlatData returned unexpected data ptr");
+ FAPI_ERR("rcTest10. releasePlatData returned unexpected data ptr");
l_result = 2;
}
else
@@ -521,9 +557,13 @@ uint32_t rcTest10()
if (l_pMyDataCheck != NULL)
{
- FAPI_ERR("rcTest11. releasePlatData returned non NULL ptr");
+ FAPI_ERR("rcTest10. releasePlatData returned non NULL ptr");
l_result = 3;
}
+ else
+ {
+ FAPI_INF("rcTest10. Success!");
+ }
}
}
@@ -531,206 +571,321 @@ uint32_t rcTest10()
}
//******************************************************************************
-// rcTest11. Ensures that the getHwpFfdc functions works when there is no FFDC
+// rcTest11. Ensures that the getErrorInfo function works when there is no
+// ErrorInfo
//******************************************************************************
uint32_t rcTest11()
{
uint32_t l_result = 0;
// Create a ReturnCode
- uint32_t l_code = 6;
- ReturnCode l_rc(l_code);
+ ReturnCode l_rc;
- // Ensure that the getHwpFfdc function returns NULL
- const void * l_pFfdc = reinterpret_cast<const void *> (0x12345678);
+ // Ensure that the getErrorInfo function returns NULL
+ const ErrorInfo * l_pErrInfo =
+ reinterpret_cast<const ErrorInfo *> (0x12345678);
- // Get FFDC pointer
- uint32_t l_size = 0;
- l_pFfdc = l_rc.getHwpFfdc(l_size);
+ l_pErrInfo = l_rc.getErrorInfo();
- if (l_pFfdc != NULL)
+ if (l_pErrInfo != NULL)
{
- FAPI_ERR("rcTest11. getHwpFfdc did not return NULL");
+ FAPI_ERR("rcTest11. getErrorInfo did not return NULL");
l_result = 1;
}
+ else
+ {
+ FAPI_INF("rcTest11. Success!");
+ }
return l_result;
}
//******************************************************************************
-// rcTest12. Ensures that the getHwpFfdc function works when there is FFDC
+// rcTest12. Ensures that the getErrorInfo function works when there is
+// ErrorInfo
//******************************************************************************
uint32_t rcTest12()
{
uint32_t l_result = 0;
- uint32_t l_code = 10;
// Create a ReturnCode
- ReturnCode l_rc(l_code);
+ ReturnCode l_rc;
+ l_rc = 5;
+
+ // Create a DIMM target
+ uint32_t l_targetHandle = 3;
+ Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
+
+ // Create some FFDC
+ uint8_t l_ffdc = 0x12;
+
+ // Add error information to the ReturnCode
+ const void * l_objects[] = {&l_ffdc, &l_target};
+ fapi::ReturnCode::ErrorInfoEntry l_entries[] =
+ {{fapi::ReturnCode::EI_TYPE_FFDC, 0,
+ fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc)},
+ {fapi::ReturnCode::EI_TYPE_CALLOUT, 1, fapi::PRI_MEDIUM},
+ {fapi::ReturnCode::EI_TYPE_DECONF, 1},
+ {fapi::ReturnCode::EI_TYPE_GARD, 1}};
+ l_rc.addErrorInfo(l_objects, l_entries, 4);
+
+ do
+ {
+ // Check that the Error Info can be retrieved
+ const ErrorInfo * l_pErrInfo = NULL;
+ l_pErrInfo = l_rc.getErrorInfo();
- // Add HwpFfdc.
- uint32_t l_myData[2] = {4, 5};
- void * l_pMyData = reinterpret_cast<void *> (l_myData);
- (void) l_rc.setHwpFfdc(l_pMyData, sizeof(l_myData));
+ if (l_pErrInfo == NULL)
+ {
+ FAPI_ERR("rcTest12. getErrorInfo returned NULL");
+ l_result = 1;
+ break;
+ }
- // Ensure that getHwpFfdc returns a pointer to the same data
- uint32_t l_size = 0;
- const uint32_t * l_pMyDataCheck = reinterpret_cast<const uint32_t *>
- (l_rc.getHwpFfdc(l_size));
+ // Check the FFDC error information
+ if (l_pErrInfo->iv_ffdcs.size() != 1)
+ {
+ FAPI_ERR("rcTest12. %d FFDCs", l_pErrInfo->iv_ffdcs.size());
+ l_result = 2;
+ break;
+ }
- if (l_size != sizeof(l_myData))
- {
- FAPI_ERR("rcTest12. getHwpFfdc returned bad size %d", l_size);
- l_result = 1;
- }
- else if ((l_pMyDataCheck[0] != 4) || (l_pMyDataCheck[1] != 5))
- {
- FAPI_ERR("rcTest12. getHwpFfdc returned bad data");
- l_result = 2;
+ uint32_t l_size = 0;
+ const void * l_pFfdc = NULL;
+
+ l_pFfdc = l_pErrInfo->iv_ffdcs[0]->getData(l_size);
+
+ if (l_size != sizeof(l_ffdc))
+ {
+ FAPI_ERR("rcTest12. FFDC size is %d", l_size);
+ l_result = 3;
+ break;
+ }
+
+ const uint8_t * l_pFfdcCheck = static_cast<const uint8_t *>(l_pFfdc);
+ if (*l_pFfdcCheck != 0x12)
+ {
+ FAPI_ERR("rcTest12. FFDC is 0x%x", *l_pFfdcCheck);
+ l_result = 4;
+ break;
+ }
+
+ // Check the callout error information
+ if (l_pErrInfo->iv_callouts.size() != 1)
+ {
+ FAPI_ERR("rcTest12. %d callouts", l_pErrInfo->iv_ffdcs.size());
+ l_result = 5;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest12. callout target mismatch");
+ l_result = 6;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[0]->iv_priority != PRI_MEDIUM)
+ {
+ FAPI_ERR("rcTest12. callout priority mismatch");
+ l_result = 7;
+ break;
+ }
+
+ // Check the deconfig error information
+ if (l_pErrInfo->iv_deconfigs.size() != 1)
+ {
+ FAPI_ERR("rcTest12. %d deconfigs", l_pErrInfo->iv_deconfigs.size());
+ l_result = 8;
+ break;
+ }
+
+ if (l_pErrInfo->iv_deconfigs[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest12. deconfig target mismatch");
+ l_result = 9;
+ break;
+ }
+
+ // Check the GARD error information
+ if (l_pErrInfo->iv_gards.size() != 1)
+ {
+ FAPI_ERR("rcTest12. %d gards", l_pErrInfo->iv_gards.size());
+ l_result = 10;
+ break;
+ }
+
+ if (l_pErrInfo->iv_gards[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest12. gard target mismatch");
+ l_result = 11;
+ break;
+ }
+
+ FAPI_INF("rcTest12. Success!");
}
+ while(0);
return l_result;
}
//******************************************************************************
-// rcTest13. Ensures that the copy constructor works when there is FFDC and that
-// the getHwpFfdc function works
+// rcTest13. Ensures that the copy constructor works when there is ErrorInfo
//******************************************************************************
uint32_t rcTest13()
{
uint32_t l_result = 0;
- uint32_t l_code = 10;
// Create a ReturnCode
- ReturnCode l_rc(l_code);
+ ReturnCode l_rc;
+ l_rc = 5;
- // Add HwpFfdc.
- uint32_t l_myData[2] = {4, 5};
- void * l_pMyData = reinterpret_cast<void *> (l_myData);
- (void) l_rc.setHwpFfdc(l_pMyData, sizeof(l_myData));
+ // Create a DIMM target
+ uint32_t l_targetHandle = 3;
+ Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
+
+ // Add error information to the ReturnCode
+ const void * l_objects[] = {&l_target};
+ fapi::ReturnCode::ErrorInfoEntry l_entries[] =
+ {{fapi::ReturnCode::EI_TYPE_GARD, 0}};
+ l_rc.addErrorInfo(l_objects, l_entries, 1);
// Create a ReturnCode using the copy constructor
ReturnCode l_rc2(l_rc);
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
+ do
{
- FAPI_ERR("rcTest13. ReturnCodes differ");
- l_result = 1;
- }
- else
- {
- // Ensure that getHwpFfdc returns a pointer to the same data from l_rc
- uint32_t l_size = 0;
- const uint32_t * l_pMyDataCheck = reinterpret_cast<const uint32_t *>
- (l_rc.getHwpFfdc(l_size));
+ // Ensure that the two ReturnCodes are the same
+ if (l_rc != l_rc2)
+ {
+ FAPI_ERR("rcTest13. ReturnCodes differ");
+ l_result = 1;
+ break;
+ }
+
+ // Ensure that getErrorInfo returns correct information from l_rc
+ const ErrorInfo * l_pErrInfo = NULL;
- if (l_size != sizeof(l_myData))
+ l_pErrInfo = l_rc.getErrorInfo();
+
+ if (l_pErrInfo == NULL)
{
- FAPI_ERR("rcTest13. getHwpFfdc returned bad size %d", l_size);
+ FAPI_ERR("rcTest13. getErrorInfo returned NULL");
l_result = 2;
+ break;
}
- else if ((l_pMyDataCheck[0] != 4) || (l_pMyDataCheck[1] != 5))
+
+ if (l_pErrInfo->iv_gards.size() != 1)
{
- FAPI_ERR("rcTest13. getHwpFfdc returned bad data");
+ FAPI_ERR("rcTest13. %d gards", l_pErrInfo->iv_gards.size());
l_result = 3;
+ break;
}
- else
+
+ if (l_pErrInfo->iv_gards[0]->iv_target != l_target)
{
- // Ensure that getHwpFfdc returns a pointer to the same data from
- // l_rc2
- uint32_t l_size2 = 0;
- const uint32_t * l_pMyDataCheck2 = reinterpret_cast<const uint32_t *>
- (l_rc2.getHwpFfdc(l_size2));
+ FAPI_ERR("rcTest13. gard target mismatch");
+ l_result = 4;
+ break;
+ }
- if (l_size2 != sizeof(l_myData))
- {
- FAPI_ERR("rcTest13. getHwpFfdc(2) returned bad size %d",
- l_size2);
- l_result = 4;
- }
- else if ((l_pMyDataCheck2[0] != 4) || (l_pMyDataCheck2[1] != 5))
- {
- FAPI_ERR("rcTest13. getHwpFfdc(2) returned bad data");
- l_result = 5;
- }
+ // Ensure that getErrorInfo from l_rc2 returns the same pointer
+ const ErrorInfo * l_pErrInfo2 = l_rc2.getErrorInfo();
+
+ if (l_pErrInfo != l_pErrInfo2)
+ {
+ FAPI_ERR("rcTest13. error info mismatch");
+ l_result = 5;
+ break;
}
+
+ FAPI_INF("rcTest13. Success!");
}
+ while(0);
return l_result;
}
//******************************************************************************
-// rcTest14. Ensures that the assignment operator works when there is FFDC and
-// that the getHwpFfdc function works
+// rcTest14. Ensures that the assignment operator works when there ErrorInfo
//******************************************************************************
uint32_t rcTest14()
{
uint32_t l_result = 0;
- uint32_t l_code = 10;
// Create a ReturnCode
- ReturnCode l_rc(l_code);
+ ReturnCode l_rc;
+ l_rc = 5;
+
+ // Create a DIMM target
+ uint32_t l_targetHandle = 3;
+ Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
- // Add HwpFfdc.
- uint32_t l_myData[2] = {4, 5};
- void * l_pMyData = reinterpret_cast<void *> (l_myData);
- (void) l_rc.setHwpFfdc(l_pMyData, sizeof(l_myData));
+ // Add error information to the ReturnCode
+ const void * l_objects[] = {&l_target};
+ fapi::ReturnCode::ErrorInfoEntry l_entries[] =
+ {{fapi::ReturnCode::EI_TYPE_GARD, 0}};
+ l_rc.addErrorInfo(l_objects, l_entries, 1);
// Create a ReturnCode using the assignment operator
ReturnCode l_rc2;
l_rc2 = l_rc;
- // Ensure that the two ReturnCodes are the same
- if (l_rc != l_rc2)
- {
- FAPI_ERR("rcTest14. ReturnCodes differ");
- l_result = 1;
- }
- else
+ do
{
- // Ensure that getHwpFfdc returns a pointer to the same data from l_rc
- uint32_t l_size = 0;
- const uint32_t * l_pMyDataCheck = reinterpret_cast<const uint32_t *>
- (l_rc.getHwpFfdc(l_size));
+ // Ensure that the two ReturnCodes are the same
+ if (l_rc != l_rc2)
+ {
+ FAPI_ERR("rcTest14. ReturnCodes differ");
+ l_result = 1;
+ break;
+ }
+
+ // Ensure that getErrorInfo returns correct information from l_rc
+ const ErrorInfo * l_pErrInfo = NULL;
+
+ l_pErrInfo = l_rc.getErrorInfo();
- if (l_size != sizeof(l_myData))
+ if (l_pErrInfo == NULL)
{
- FAPI_ERR("rcTest14. getHwpFfdc returned bad size %d", l_size);
+ FAPI_ERR("rcTest14. getErrorInfo returned NULL");
l_result = 2;
+ break;
}
- else if ((l_pMyDataCheck[0] != 4) || (l_pMyDataCheck[1] != 5))
+
+ if (l_pErrInfo->iv_gards.size() != 1)
{
- FAPI_ERR("rcTest14. getHwpFfdc returned bad data");
+ FAPI_ERR("rcTest14. %d gards", l_pErrInfo->iv_gards.size());
l_result = 3;
+ break;
}
- else
+
+ if (l_pErrInfo->iv_gards[0]->iv_target != l_target)
{
- // Ensure that getHwpFfdc returns a pointer to the same data from
- // l_rc2
- uint32_t l_size2 = 0;
- const uint32_t * l_pMyDataCheck2 = reinterpret_cast<const uint32_t *>
- (l_rc2.getHwpFfdc(l_size2));
+ FAPI_ERR("rcTest14. gard target mismatch");
+ l_result = 4;
+ break;
+ }
- if (l_size2 != sizeof(l_myData))
- {
- FAPI_ERR("rcTest14. getHwpFfdc(2) returned bad size %d",
- l_size2);
- l_result = 4;
- }
- else if ((l_pMyDataCheck2[0] != 4) || (l_pMyDataCheck2[1] != 5))
- {
- FAPI_ERR("rcTest14. getHwpFfdc(2) returned bad data");
- l_result = 5;
- }
+ // Ensure that getErrorInfo from l_rc2 returns the same pointer
+ const ErrorInfo * l_pErrInfo2 = l_rc2.getErrorInfo();
+
+ if (l_pErrInfo != l_pErrInfo2)
+ {
+ FAPI_ERR("rcTest14. error info mismatch");
+ l_result = 5;
+ break;
}
+
+ FAPI_INF("rcTest14. Success!");
}
+ while(0);
return l_result;
}
//******************************************************************************
-// rcTest15. Ensures that the setErrTarget function works when there is no error
+// rcTest15. Ensures that setting the ReturnCode to success clears ErrorInfo
//******************************************************************************
uint32_t rcTest15()
{
@@ -738,102 +893,242 @@ uint32_t rcTest15()
// Create a ReturnCode
ReturnCode l_rc;
+ l_rc = 5;
- // Create a Target
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+ // Create a DIMM target
+ uint32_t l_targetHandle = 3;
+ Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
- // Set the error target
- l_rc.setErrTarget(l_target);
+ // Add error information to the ReturnCode
+ const void * l_objects[] = {&l_target};
+ fapi::ReturnCode::ErrorInfoEntry l_entries[] =
+ {{fapi::ReturnCode::EI_TYPE_GARD, 0}};
+ l_rc.addErrorInfo(l_objects, l_entries, 1);
- // Retreive the Error target (should be null because no error)
- Target * l_pTarget = l_rc.getErrTarget();
+ // Set the ReturnCode to success
+ l_rc = FAPI_RC_SUCCESS;
- if (l_pTarget != NULL)
+ // Check that there is no ErrorInfo
+ const ErrorInfo * l_pErrInfo = NULL;
+
+ l_pErrInfo = l_rc.getErrorInfo();
+
+ if (l_pErrInfo != NULL)
{
- FAPI_ERR("rcTest15. getErrTarget returned non-null pointer");
+ FAPI_ERR("rcTest15. getErrorInfo returned NULL");
l_result = 1;
}
-
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
+ else
+ {
+ FAPI_INF("rcTest15. Success!");
+ }
return l_result;
}
//******************************************************************************
-// rcTest16. Ensures that the setErrTarget function works when there is an error
+// rcTest16. Ensures that multiple Error Info of each type can be added
//******************************************************************************
uint32_t rcTest16()
{
uint32_t l_result = 0;
- // Create a ReturnCode with an error
- ReturnCode l_rc(8);
+ // Create a ReturnCode
+ ReturnCode l_rc;
+ l_rc = 5;
+
+ // Create 2 targets
+ uint32_t l_targetHandle = 3;
+ Target l_target(TARGET_TYPE_DIMM, &l_targetHandle);
+
+ uint32_t l_targetHandle2 = 4;
+ Target l_target2(TARGET_TYPE_MCS_CHIPLET, &l_targetHandle2);
+
+ // Create 2 FFDCs
+ uint8_t l_ffdc = 0x12;
+ uint32_t l_ffdc2 = 0x12345678;
+
+ // Add error information to the ReturnCode
+ const void * l_objects[] = {&l_ffdc, &l_ffdc2, &l_target, &l_target2};
+ fapi::ReturnCode::ErrorInfoEntry l_entries[] =
+ {{fapi::ReturnCode::EI_TYPE_FFDC, 0,
+ fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc)},
+ {fapi::ReturnCode::EI_TYPE_FFDC, 1,
+ fapi::ReturnCodeFfdc::getErrorInfoFfdcSize(l_ffdc2)},
+ {fapi::ReturnCode::EI_TYPE_CALLOUT, 2, fapi::PRI_HIGH},
+ {fapi::ReturnCode::EI_TYPE_CALLOUT, 3, fapi::PRI_LOW},
+ {fapi::ReturnCode::EI_TYPE_DECONF, 2},
+ {fapi::ReturnCode::EI_TYPE_DECONF, 3},
+ {fapi::ReturnCode::EI_TYPE_GARD, 2},
+ {fapi::ReturnCode::EI_TYPE_GARD, 3}};
+ l_rc.addErrorInfo(l_objects, l_entries, 8);
+
+ do
+ {
+ // Check that the Error Info can be retrieved
+ const ErrorInfo * l_pErrInfo = NULL;
+ l_pErrInfo = l_rc.getErrorInfo();
- // Create a Target
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+ if (l_pErrInfo == NULL)
+ {
+ FAPI_ERR("rcTest16. getErrorInfo returned NULL");
+ l_result = 1;
+ break;
+ }
- // Set the error target
- l_rc.setErrTarget(l_target);
+ // Check the FFDC error information
+ if (l_pErrInfo->iv_ffdcs.size() != 2)
+ {
+ FAPI_ERR("rcTest16. %d FFDCs", l_pErrInfo->iv_ffdcs.size());
+ l_result = 2;
+ break;
+ }
- // Retreive the Error target
- Target * l_pTarget = l_rc.getErrTarget();
+ uint32_t l_size = 0;
+ const void * l_pFfdc = NULL;
- if (*l_pTarget != l_target)
- {
- FAPI_ERR("rcTest16. getErrTarget returned bad target");
- l_result = 1;
- }
+ l_pFfdc = l_pErrInfo->iv_ffdcs[0]->getData(l_size);
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
+ if (l_size != sizeof(l_ffdc))
+ {
+ FAPI_ERR("rcTest16. FFDC[0] size is %d", l_size);
+ l_result = 3;
+ break;
+ }
+
+ const uint8_t * l_pFfdcCheck = static_cast<const uint8_t *>(l_pFfdc);
+ if (*l_pFfdcCheck != 0x12)
+ {
+ FAPI_ERR("rcTest16. FFDC[0] is 0x%x", *l_pFfdcCheck);
+ l_result = 4;
+ break;
+ }
+
+ l_pFfdc = l_pErrInfo->iv_ffdcs[1]->getData(l_size);
+
+ if (l_size != sizeof(l_ffdc2))
+ {
+ FAPI_ERR("rcTest16. FFDC[1] size is %d", l_size);
+ l_result = 5;
+ break;
+ }
+
+ const uint32_t * l_pFfdc2Check = static_cast<const uint32_t *>(l_pFfdc);
+ if (*l_pFfdc2Check != 0x12345678)
+ {
+ FAPI_ERR("rcTest16. FFDC[1] is 0x%x", *l_pFfdc2Check);
+ l_result = 6;
+ break;
+ }
+
+ // Check the callout error information
+ if (l_pErrInfo->iv_callouts.size() != 2)
+ {
+ FAPI_ERR("rcTest16. %d callouts", l_pErrInfo->iv_ffdcs.size());
+ l_result = 7;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest16. callout[0] target mismatch");
+ l_result = 8;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[0]->iv_priority != PRI_HIGH)
+ {
+ FAPI_ERR("rcTest16. callout[0] priority mismatch");
+ l_result = 9;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[1]->iv_target != l_target2)
+ {
+ FAPI_ERR("rcTest16. callout[1] target mismatch");
+ l_result = 10;
+ break;
+ }
+
+ if (l_pErrInfo->iv_callouts[1]->iv_priority != PRI_LOW)
+ {
+ FAPI_ERR("rcTest16. callout[1] priority mismatch");
+ l_result = 11;
+ break;
+ }
+
+ // Check the deconfig error information
+ if (l_pErrInfo->iv_deconfigs.size() != 2)
+ {
+ FAPI_ERR("rcTest16. %d deconfigs", l_pErrInfo->iv_deconfigs.size());
+ l_result = 12;
+ break;
+ }
+
+ if (l_pErrInfo->iv_deconfigs[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest16. deconfig[0] target mismatch");
+ l_result = 13;
+ break;
+ }
+
+ if (l_pErrInfo->iv_deconfigs[1]->iv_target != l_target2)
+ {
+ FAPI_ERR("rcTest16. deconfig[1] target mismatch");
+ l_result = 13;
+ break;
+ }
+
+ // Check the GARD error information
+ if (l_pErrInfo->iv_gards.size() != 2)
+ {
+ FAPI_ERR("rcTest16. %d gards", l_pErrInfo->iv_gards.size());
+ l_result = 14;
+ break;
+ }
+
+ if (l_pErrInfo->iv_gards[0]->iv_target != l_target)
+ {
+ FAPI_ERR("rcTest16. gard[0] target mismatch");
+ l_result = 15;
+ break;
+ }
+
+ if (l_pErrInfo->iv_gards[1]->iv_target != l_target2)
+ {
+ FAPI_ERR("rcTest16. gard[1] target mismatch");
+ l_result = 16;
+ break;
+ }
+
+ FAPI_INF("rcTest16. Success!");
+ }
+ while(0);
return l_result;
}
//******************************************************************************
-// rcTest17. Ensures that the setErrTarget function works when there is an error
-// and an existing Target
+// rcTest17. Ensures that static_cast can be applied to a ReturnCode
//******************************************************************************
uint32_t rcTest17()
{
uint32_t l_result = 0;
- // Create a ReturnCode with an error
- ReturnCode l_rc(8);
-
- // Create a Target
- uint8_t l_handle = 7;
- void * l_pHandle = reinterpret_cast<void *>(&l_handle);
- Target l_target(TARGET_TYPE_DIMM, l_pHandle);
-
- // Create another Target
- uint8_t l_handle2 = 8;
- void * l_pHandle2 = reinterpret_cast<void *>(&l_handle2);
- Target l_target2(TARGET_TYPE_DIMM, l_pHandle2);
-
- // Set the error target
- l_rc.setErrTarget(l_target);
-
- // Attempt to set the error target again (should not be set because there is
- // already an error target)
- l_rc.setErrTarget(l_target2);
+ // Create a ReturnCode
+ ReturnCode l_rc;
+ l_rc = 5;
- // Retreive the Error target
- Target * l_pTarget = l_rc.getErrTarget();
+ uint32_t l_check = static_cast<uint32_t>(l_rc);
- if (*l_pTarget != l_target)
+ if (l_check != 5)
{
- FAPI_ERR("rcTest17. getErrTarget returned bad target");
- l_result = 1;
+ FAPI_ERR("rcTest17. RC is not 5, it is 0x%x", l_check);
+ }
+ else
+ {
+ FAPI_INF("rcTest17. Success!");
}
-
- // Set the handle pointer to NULL to prevent any problem on destruction
- l_target.set(NULL);
return l_result;
}
diff --git a/src/usr/hwpf/test/fapiTargetTest.C b/src/usr/hwpf/test/fapiTargetTest.C
index 6977c61d4..92842c5b3 100644
--- a/src/usr/hwpf/test/fapiTargetTest.C
+++ b/src/usr/hwpf/test/fapiTargetTest.C
@@ -31,6 +31,7 @@
* Flag Defect/Feature User Date Description
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 04/13/2011 Created.
+ * mjjones 09/23/2011 Added Success traces
*
*/
@@ -67,6 +68,10 @@ uint32_t targetTest1()
FAPI_ERR("targetTest1. Type is 0x%x, expected NONE", l_type);
l_result = 2;
}
+ else
+ {
+ FAPI_INF("targetTest1. Success!");
+ }
}
return l_result;
@@ -102,6 +107,10 @@ uint32_t targetTest2()
FAPI_ERR("targetTest2. Type is 0x%x, expected DIMM", l_type);
l_result = 2;
}
+ else
+ {
+ FAPI_INF("targetTest2. Success!");
+ }
}
// Set the handle pointer to NULL to prevent any problem on destruction
@@ -146,6 +155,10 @@ uint32_t targetTest3()
FAPI_ERR("targetTest3. Type is 0x%x, expected DIMM", l_type);
l_result = 2;
}
+ else
+ {
+ FAPI_INF("targetTest3. Success!");
+ }
}
return l_result;
@@ -187,6 +200,10 @@ uint32_t targetTest4()
FAPI_ERR("targetTest4. Handles are not the same");
l_result = 2;
}
+ else
+ {
+ FAPI_INF("targetTest4. Success!");
+ }
}
return l_result;
@@ -229,6 +246,10 @@ uint32_t targetTest5()
FAPI_ERR("targetTest5. Handles are not the same");
l_result = 2;
}
+ else
+ {
+ FAPI_INF("targetTest5. Success!");
+ }
}
return l_result;
@@ -305,6 +326,10 @@ uint32_t targetTest6()
"false");
l_result = 6;
}
+ else
+ {
+ FAPI_INF("targetTest6. Success!");
+ }
}
}
}
OpenPOWER on IntegriCloud