summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-03-23 16:04:35 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-27 12:21:51 -0500
commitf037d0552a46caae37b0e7371fc6ce4837ecce1c (patch)
treea83b8582455f5777222ce6390effb8a64862f408 /src
parent6a4e3754a25659758af50f8036f2642077166f15 (diff)
downloadtalos-hostboot-f037d0552a46caae37b0e7371fc6ce4837ecce1c.tar.gz
talos-hostboot-f037d0552a46caae37b0e7371fc6ce4837ecce1c.zip
HWPF: Hostboot errlogs should cope with HWP error IDs greater than 255
RTC: 39175 This is **part** of the work required for RTC 39175. When a HWP creates an error, the reason code is (HWPF_COMP_ID | errID). The errID is a single byte. Error log tags are automatically created so that the errors can be parsed. However at some point there will be more than 255 HWP errors so this scheme will not work. And more pressing is RTC 39175, the error IDs will change from 0, 1, 2, 3, to 32-bit hash codes. The new plan is to have a fixed reason code for HWP errors (HWPF_COMP_ID | RC_HWP_GENERATED_ERROR), the 32 bit error ID will be FFDC data which will be parsed by an auto-generated function. This also changes the expected HWPF unit test error to be committed by CXXTEST which is the subject of a request by Dan. Change-Id: I5669f2a53702649d4599556a9e380ec3725ca51b Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/792 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatReasonCodes.H23
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H1
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H53
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl6
-rw-r--r--src/usr/hwpf/makefile12
-rwxr-xr-xsrc/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl (renamed from src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl)87
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwpInvoker.C24
-rw-r--r--src/usr/hwpf/plat/fapiPlatUtil.C15
8 files changed, 140 insertions, 81 deletions
diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
index 5d37d1ad5..b48d43623 100644
--- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
+++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
@@ -32,11 +32,11 @@ namespace fapi
*/
enum hwpfModuleId
{
- // HWP generated errors
- MOD_HWP_RC_TO_ERRL = 0x01,
-
// FAPI generated errors
- MOD_FAPI_RC_TO_ERRL = 0x02,
+ MOD_FAPI_RC_TO_ERRL = 0x01,
+
+ // HWP generated errors
+ MOD_HWP_RC_TO_ERRL = 0x02,
// PLAT generated errors
MOD_FAPI_GET_CHILD_CHIPLETS = 0x03,
@@ -55,12 +55,12 @@ namespace fapi
*/
enum hwpfReasonCode
{
- // Note that for HWP generated errors (MOD_HWP_RC_TO_ERRL), the
- // reason code is in the generated fapiHwpReasonCodes.H file
-
- // FAPI generated errors (see fapiReturnCodes.H)
+ // FAPI generated errors (must match fapiReturnCodes.H)
RC_INVALID_ATTR_GET = HWPF_COMP_ID | 0x01,
+ // HWP generated errors
+ RC_HWP_GENERATED_ERROR = HWPF_COMP_ID | 0x0f,
+
// PLAT Errors generated by HostBoot code
RC_INVALID_REQUEST = HWPF_COMP_ID | 0x10,
RC_UNSUPPORTED_REQUEST = HWPF_COMP_ID | 0x11,
@@ -78,9 +78,10 @@ namespace fapi
*/
enum hwpfUserDetailDataSubSection
{
- HWPF_UDT_HWP_TARGET = 1,
- HWPF_UDT_HWP_ECMDDBB = 2,
- HWPF_UDT_HWP_DATA = 3,
+ HWPF_UDT_HWP_RCVALUE = 1,
+ HWPF_UDT_HWP_TARGET = 2,
+ HWPF_UDT_HWP_ECMDDBB = 3,
+ HWPF_UDT_HWP_DATA = 4,
};
};
diff --git a/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H b/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H
index e9db032a4..a8aab1817 100644
--- a/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H
+++ b/src/include/usr/hwpf/plat/fapiPlatUdParserFactory.H
@@ -52,6 +52,7 @@ public:
*/
PlatUserDetailsParserFactory()
{
+ registerParser<PlatUserDetailsParserHwpRcValue>(HWPF_UDT_HWP_RCVALUE);
registerParser<PlatUserDetailsParserHwpTarget>(HWPF_UDT_HWP_TARGET);
registerParser<PlatUserDetailsParserHwpEcmddbb>(HWPF_UDT_HWP_ECMDDBB);
registerParser<PlatUserDetailsParserHwpData>(HWPF_UDT_HWP_DATA);
diff --git a/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H b/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H
index a5b3e8190..f3cf8931e 100644
--- a/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H
+++ b/src/include/usr/hwpf/plat/fapiPlatUdParserHwp.H
@@ -36,11 +36,64 @@
* fapi::ReturnCode
*/
#include <errl/errluserdetails.H>
+#include <fapiPlatHwpRcDecode.H>
namespace fapi
{
/**
+ * @class PlatUserDetailsParserHwpRcValue
+ *
+ * Parses the HWP RcValue in an error log.
+ */
+class PlatUserDetailsParserHwpRcValue : public ERRORLOG::ErrlUserDetailsParser
+{
+public:
+ /**
+ * @brief Constructor
+ */
+ PlatUserDetailsParserHwpRcValue() {}
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~PlatUserDetailsParserHwpRcValue() {}
+
+ /**
+ * @brief Parses the HWP RcValue in an error log.
+ *
+ * @param i_version Version of the data
+ * @param i_parse ErrlUsrParser object for outputting information
+ * @param i_pBuffer Pointer to buffer containing detail data
+ * @param i_buflen Length of the buffer
+ */
+ virtual void parse(errlver_t i_version,
+ ErrlUsrParser & i_parser,
+ void * i_pBuffer,
+ const uint32_t i_buflen) const
+ {
+ uint32_t l_rcValue = ntohl(*(static_cast<uint32_t *>(i_pBuffer)));
+
+ const char * l_pDesc = fapiDecodeHwpRc(l_rcValue);
+
+ if (l_pDesc)
+ {
+ i_parser.PrintString("HWP Error description", l_pDesc);
+ }
+ else
+ {
+ i_parser.PrintNumber("Unrecognized Error ID", "0x%x", l_rcValue);
+ }
+ }
+
+private:
+ // Disabled
+ PlatUserDetailsParserHwpRcValue(const PlatUserDetailsParserHwpRcValue &);
+ PlatUserDetailsParserHwpRcValue & operator=(
+ const PlatUserDetailsParserHwpRcValue &);
+};
+
+/**
* @class PlatUserDetailsParserHwpTarget
*
* Parses HWP target string user detail in an error log.
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
index c3654d667..0aacea269 100755
--- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -137,7 +137,7 @@ print RCFILE " * \@brief Enumeration of HWP return codes\n";
print RCFILE " *\/\n";
print RCFILE "enum HwpReturnCode\n";
print RCFILE "{\n";
-print RCFILE " RC_SUCCESS,\n";
+print RCFILE " RC_SUCCESS = 0,\n";
#------------------------------------------------------------------------------
# Print start of file information to fapiHwpErrorInfo.H
@@ -163,6 +163,7 @@ my $gard = 'gard';
#------------------------------------------------------------------------------
# For each XML file
#------------------------------------------------------------------------------
+my $errId = 1;
foreach my $argnum (1 .. $#ARGV)
{
my $infile = $ARGV[$argnum];
@@ -201,7 +202,8 @@ foreach my $argnum (1 .. $#ARGV)
#----------------------------------------------------------------------
# Print the return code to fapiHwpReturnCodes.H
#----------------------------------------------------------------------
- print RCFILE " $err->{rc},\n";
+ print RCFILE " $err->{rc} = $errId,\n";
+ $errId++;
#----------------------------------------------------------------------
# Print the CALL_FUNC_TO_ANALYZE_ERROR macro to fapiHwpErrorInfo.H
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
index dc92e60c5..832c2615a 100644
--- a/src/usr/hwpf/makefile
+++ b/src/usr/hwpf/makefile
@@ -65,8 +65,8 @@ IF_CMP_COMPILER_TARGET = ifcompiler
# The FAPI return code and error info files generated from Error XML files
FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiHwpErrorInfo.H
-# The PLAT error tag file generated from Error XML files
-PLAT_ERROR_TAG_TARGET = fapiHwpReasonCodes.H
+# The PLAT HWP RC Decoder file generated from Error XML files
+PLAT_ERROR_HWP_RC_DECODER = fapiPlatHwpRcDecode.H
# The FAPI attribute id file generated from Attribute XML files
FAPI_ATTR_ID_TARGET = fapiAttributeIds.H
@@ -96,7 +96,7 @@ GENFILES = ${IF_CMP_YACC_C_TARGET} \
${IF_CMP_FLEX_TARGET} \
${IF_CMP_COMPILER_TARGET} \
${FAPI_ERROR_TARGETS} \
- ${PLAT_ERROR_TAG_TARGET} \
+ ${PLAT_ERROR_HWP_RC_DECODER} \
${FAPI_ATTR_ID_TARGET} \
${FAPI_ATTR_PLAT_CHECK_TARGET} \
${FAPI_ATTRS_SUPPORTED_TARGET} \
@@ -146,10 +146,10 @@ $(call GENTARGET, ${FAPI_ERROR_TARGETS}) : \
$< $(dir $@) ${HWP_ERROR_XML_FILES}
#------------------------------------------------------------------------------
-# The PLAT error tag file generated from Error XML files
+# The PLAT HWP RC Decoder file generated from Error XML files
#------------------------------------------------------------------------------
-$(call GENTARGET, ${PLAT_ERROR_TAG_TARGET}) : \
- plat/fapiCreateHwpErrorTags.pl ${HWP_ERROR_XML_FILES}
+$(call GENTARGET, ${PLAT_ERROR_HWP_RC_DECODER}) : \
+ plat/fapiPlatCreateHwpRcDecoder.pl ${HWP_ERROR_XML_FILES}
$< $(dir $@) ${HWP_ERROR_XML_FILES}
#------------------------------------------------------------------------------
diff --git a/src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl b/src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl
index 572d7360e..80a63c8ca 100755
--- a/src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl
+++ b/src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl
@@ -2,11 +2,11 @@
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl $
+# $Source: src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl $
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2012
#
# p1
#
@@ -23,9 +23,8 @@
# IBM_PROLOG_END
#
-# Purpose: This perl script will parse HWP Error XML files and create required
-# HostBoot ReasonCodes and Error Log Tags. It creates file
-# fapiHwpReasonCodes.H:
+# Purpose: This perl script will parse HWP Error XML files and create a
+# file containing a function that decodes HWP RC values
#
# Author: Mike Jones
#
@@ -38,9 +37,9 @@ use strict;
my $numArgs = $#ARGV + 1;
if ($numArgs < 2)
{
- print ("Usage: fapiCreateHwpErrorTags.pl <output dir> <filename1> <filename2> ...\n");
+ print ("Usage: fapiPlatCreateHwpRcDecoder.pl <output dir> <filename1> <filename2> ...\n");
print (" This perl script will parse HWP Error XML files and create\n");
- print (" required HostBoot ReasonCodes and Error Log tags\n");
+ print (" a file containing a function that decodes HWP RC values\n");
exit(1);
}
@@ -58,25 +57,28 @@ my $xml = new XML::Simple (KeyAttr=>[]);
#------------------------------------------------------------------------------
my $rcFile = $ARGV[0];
$rcFile .= "/";
-$rcFile .= "fapiHwpReasonCodes.H";
+$rcFile .= "fapiPlatHwpRcDecode.H";
open(TGFILE, ">", $rcFile);
#------------------------------------------------------------------------------
# Print start of file information
#------------------------------------------------------------------------------
-print TGFILE "// fapiHwpReasonCodes.H\n";
-print TGFILE "// This file is generated by perl script fapiCreateHwpErrorTags.pl\n\n";
-print TGFILE "#ifndef FAPIHWPREASONCODES_H_\n";
-print TGFILE "#define FAPIHWPREASONCODES_H_\n\n";
-print TGFILE "#include <fapiHwpReturnCodes.H>\n\n";
+print TGFILE "// fapiPlatHwpRcDecode.H\n";
+print TGFILE "// This file is generated by perl script fapiPlatCreateHwpRcDecoder.pl\n\n";
+print TGFILE "#ifndef FAPIPLATHWPRCDECODE_H_\n";
+print TGFILE "#define FAPIPLATHWPRCDECODE_H_\n\n";
+print TGFILE "#ifdef PARSER\n\n";
print TGFILE "namespace fapi\n";
print TGFILE "{\n\n";
-print TGFILE "enum hwpReasonCode\n";
+print TGFILE "const char * fapiDecodeHwpRc(const uint32_t i_rcValue)\n";
print TGFILE "{\n";
+print TGFILE " switch(i_rcValue)\n";
+print TGFILE " {\n";
#------------------------------------------------------------------------------
# For each XML file
#------------------------------------------------------------------------------
+my $errId = 1;
foreach my $argnum (1 .. $#ARGV)
{
#--------------------------------------------------------------------------
@@ -98,64 +100,49 @@ foreach my $argnum (1 .. $#ARGV)
#----------------------------------------------------------------------
if (! exists $err->{rc})
{
- print ("fapiParseErrorInfo.pl ERROR. rc missing\n");
+ print ("fapiPlatCreateHwpRcDecoder.pl ERROR. rc missing\n");
exit(1);
}
if (! exists $err->{description})
{
- print ("fapiParseErrorInfo.pl ERROR. description missing\n");
+ print ("fapiPlatCreateHwpRcDecoder.pl ERROR. description missing\n");
exit(1);
}
#----------------------------------------------------------------------
- # Print the ReasonCode
+ # Get the description, remove newlines, leading and trailing spaces and
+ # multiple spaces
#----------------------------------------------------------------------
- print TGFILE " __$err->{rc} = HWPF_COMP_ID | $err->{rc},\n";
- }
-}
+ my $desc = $err->{description};
+ $desc =~ s/\n/ /g;
+ $desc =~ s/^ +//g;
+ $desc =~ s/ +$//g;
+ $desc =~ s/ +/ /g;
-#------------------------------------------------------------------------------
-# Print end of reason code enumeration and fapi namespace
-#------------------------------------------------------------------------------
-print TGFILE "};\n\n";
-print TGFILE "}\n\n";
-
-#------------------------------------------------------------------------------
-# For each XML file
-#------------------------------------------------------------------------------
-foreach my $argnum (1 .. $#ARGV)
-{
- #--------------------------------------------------------------------------
- # Read XML file
- #--------------------------------------------------------------------------
- my $infile = $ARGV[$argnum];
- my $errors = $xml->XMLin($infile);
-
- #--------------------------------------------------------------------------
- # For each Error
- #--------------------------------------------------------------------------
- foreach my $err (@{$errors->{hwpError}})
- {
#----------------------------------------------------------------------
- # Print the Error Log tag
+ # Print the RC decode
#----------------------------------------------------------------------
- print TGFILE "/*\@\n";
- print TGFILE " * \@errortype\n";
- print TGFILE " * \@moduleid MOD_HWP_RC_TO_ERRL\n";
- print TGFILE " * \@reasoncode __$err->{rc}\n";
- print TGFILE " * \@devdesc $err->{description}\n";
- print TGFILE " */\n\n";
+ print TGFILE " case $errId:\n";
+ print TGFILE " return \"$desc\";\n";
+ print TGFILE " break;\n";
+ $errId++;
}
}
#------------------------------------------------------------------------------
# Print end of file information
#------------------------------------------------------------------------------
+print TGFILE " default:\n";
+print TGFILE " return NULL;\n";
+print TGFILE " }\n";
+print TGFILE "}\n\n";
+print TGFILE "}\n\n";
+print TGFILE "#endif\n";
print TGFILE "#endif\n";
#------------------------------------------------------------------------------
-# Close output files
+# Close output file
#------------------------------------------------------------------------------
close(TGFILE);
diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
index d0dfa7355..22e954e2d 100644
--- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
+++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
@@ -149,22 +149,24 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc)
else if (l_creator == ReturnCode::CREATOR_HWP)
{
// HWP Error. Create an error log
- FAPI_ERR("fapiRcToErrl: HWP error: 0x%x",
- static_cast<uint32_t>(io_rc));
+ uint32_t l_rcValue = static_cast<uint32_t>(io_rc);
+ FAPI_ERR("fapiRcToErrl: HWP error: 0x%x", l_rcValue);
// TODO What should the severity be? Should it be in the error info?
- // The errlog reason code is the HWPF compID and the rcValue LSB
- uint32_t l_rcValue = static_cast<uint32_t>(io_rc);
- uint16_t l_reasonCode = l_rcValue;
- l_reasonCode &= 0xff;
- l_reasonCode |= HWPF_COMP_ID;
-
- // HostBoot errlog tags for HWP errors are in generated file
- // fapiHwpReasonCodes.H
+ /*@
+ * @errortype
+ * @moduleid MOD_HWP_RC_TO_ERRL
+ * @reasoncode RC_HWP_GENERATED_ERROR
+ * @devdesc HW Procedure generated error. See User Data.
+ */
l_pError = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
MOD_HWP_RC_TO_ERRL,
- l_reasonCode);
+ RC_HWP_GENERATED_ERROR);
+
+ // Add the rcValue as FFDC. This will explain what the error was
+ l_pError->addFFDC(HWPF_COMP_ID, &l_rcValue, sizeof(l_rcValue), 1,
+ HWPF_UDT_HWP_RCVALUE);
// Get the Error Information Pointer
const ErrorInfo * l_pErrorInfo = io_rc.getErrorInfo();
diff --git a/src/usr/hwpf/plat/fapiPlatUtil.C b/src/usr/hwpf/plat/fapiPlatUtil.C
index 31f0b13ce..d5cbbf817 100644
--- a/src/usr/hwpf/plat/fapiPlatUtil.C
+++ b/src/usr/hwpf/plat/fapiPlatUtil.C
@@ -93,9 +93,15 @@ fapi::ReturnCode fapiDelay(uint64_t i_nanoSeconds, uint64_t i_simCycles)
void fapiLogError(fapi::ReturnCode & io_rc)
{
errlHndl_t l_pError = NULL;
+ bool l_unitTestError = false;
FAPI_ERR("fapiLogError: logging error");
+ if (fapi::RC_TEST_ERROR_A == static_cast<uint32_t>(io_rc))
+ {
+ l_unitTestError = true;
+ }
+
// Convert the return code to an error log.
// This will set the return code to FAPI_RC_SUCCESS and clear any PLAT Data,
// HWP FFDC data, and Error Target associated with it.
@@ -103,7 +109,14 @@ void fapiLogError(fapi::ReturnCode & io_rc)
// Commit the error log. This will delete the error log and set the handle
// to NULL.
- errlCommit(l_pError,HWPF_COMP_ID);
+ if (l_unitTestError)
+ {
+ errlCommit(l_pError, CXXTEST_COMP_ID);
+ }
+ else
+ {
+ errlCommit(l_pError, HWPF_COMP_ID);
+ }
}
//****************************************************************************
OpenPOWER on IntegriCloud