summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/plat
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-09-24 20:38:58 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-10-04 16:51:04 -0500
commit9c88d3c004d60d016c4d3bf5a3c2988cce7121c9 (patch)
tree28eb4e6671d865a4c6897ab34ad1fee231a98202 /src/usr/hwpf/plat
parentd05fe5a6cb9d9dfa92954db9923603fdb6c8adca (diff)
downloadtalos-hostboot-9c88d3c004d60d016c4d3bf5a3c2988cce7121c9.tar.gz
talos-hostboot-9c88d3c004d60d016c4d3bf5a3c2988cce7121c9.zip
HWPF: Allow automatic collection of register FFDC data when HWP error created
If HWP Error XML contains an element called <collectRegisterFfdc> which identifies the registers to collect as FFDC then when the error is created, those registers are automatically collected and stored in the error log. Also create Hostboot parsers to parse the data. Change-Id: I521527b97e0db0c808db81773ba0fe9aa00477ad RTC: 46029 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1866 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/plat')
-rwxr-xr-xsrc/usr/hwpf/plat/fapiPlatCreateHwpErrParser.pl256
-rwxr-xr-xsrc/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl153
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwpInvoker.C74
3 files changed, 288 insertions, 195 deletions
diff --git a/src/usr/hwpf/plat/fapiPlatCreateHwpErrParser.pl b/src/usr/hwpf/plat/fapiPlatCreateHwpErrParser.pl
new file mode 100755
index 000000000..762e7280b
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatCreateHwpErrParser.pl
@@ -0,0 +1,256 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/hwpf/plat/fapiPlatCreateHwpErrParser.pl $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+
+#
+# Purpose: This perl script will parse HWP Error XML files and create a
+# file containing functions that parses the return code and FFDC
+# data in HWP error logs
+#
+# Author: Mike Jones
+#
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 2)
+{
+ print ("Usage: fapiPlatCreateHwpErrParser.pl <output dir> <filename1> <filename2> ...\n");
+ print (" This perl script will parse HWP Error XML files and create\n");
+ print (" a file called fapiPlatHwpErrParser.H that contains functions to\n");
+ print (" parse the return code and FFDC data in HWP error logs\n");
+ exit(1);
+}
+
+#------------------------------------------------------------------------------
+# Specify perl modules to use
+#------------------------------------------------------------------------------
+use Digest::MD5 qw(md5_hex);
+use XML::Simple;
+my $xml = new XML::Simple (KeyAttr=>[]);
+
+# Uncomment to enable debug output
+#use Data::Dumper;
+
+#------------------------------------------------------------------------------
+# Open output files for writing
+#------------------------------------------------------------------------------
+my $rcFile = $ARGV[0];
+$rcFile .= "/";
+$rcFile .= "fapiPlatHwpErrParser.H";
+open(TGFILE, ">", $rcFile);
+
+#------------------------------------------------------------------------------
+# Print start of file information
+#------------------------------------------------------------------------------
+print TGFILE "// fapiPlatHwpErrParser.H\n";
+print TGFILE "// This file is generated by perl script fapiPlatCreateHwpErrParser.pl\n\n";
+print TGFILE "#ifndef FAPIPLATHWPERRPARSER_H_\n";
+print TGFILE "#define FAPIPLATHWPERRPARSER_H_\n\n";
+print TGFILE "#ifdef PARSER\n\n";
+print TGFILE "namespace fapi\n";
+print TGFILE "{\n\n";
+print TGFILE "void fapiParseHwpRc(ErrlUsrParser & i_parser,\n";
+print TGFILE " void * i_pBuffer,\n";
+print TGFILE " const uint32_t i_buflen)\n";
+print TGFILE "{\n";
+print TGFILE " uint32_t l_rc = ntohl(*(static_cast<uint32_t *>(i_pBuffer)));\n\n";
+print TGFILE " switch(l_rc)\n";
+print TGFILE " {\n";
+
+#------------------------------------------------------------------------------
+# For each XML file
+#------------------------------------------------------------------------------
+foreach my $argnum (1 .. $#ARGV)
+{
+ #--------------------------------------------------------------------------
+ # Read XML file
+ #--------------------------------------------------------------------------
+ my $infile = $ARGV[$argnum];
+ my $errors = $xml->XMLin($infile, ForceArray => ['hwpError']);
+
+ # Uncomment to get debug output of all errors
+ #print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
+
+ #--------------------------------------------------------------------------
+ # For each Error
+ #--------------------------------------------------------------------------
+ foreach my $err (@{$errors->{hwpError}})
+ {
+ #----------------------------------------------------------------------
+ # Get the description, remove newlines, leading and trailing spaces and
+ # multiple spaces
+ #----------------------------------------------------------------------
+ my $desc = $err->{description};
+ $desc =~ s/\n/ /g;
+ $desc =~ s/^ +//g;
+ $desc =~ s/ +$//g;
+ $desc =~ s/ +/ /g;
+
+ #----------------------------------------------------------------------
+ # Print the RC description
+ # Note that this uses the same code to calculate the error enum value
+ # as fapiParseErrorInfo.pl. This code must be kept in sync
+ #----------------------------------------------------------------------
+ my $errHash128Bit = md5_hex($err->{rc});
+ my $errHash24Bit = substr($errHash128Bit, 0, 6);
+
+ print TGFILE " case 0x$errHash24Bit:\n";
+ print TGFILE " i_parser.PrintString(\"HWP Error description\", \"$desc\");\n";
+ print TGFILE " break;\n";
+ }
+}
+
+#------------------------------------------------------------------------------
+# Print end of fapiParseHwpRc function
+#------------------------------------------------------------------------------
+print TGFILE " default:\n";
+print TGFILE " i_parser.PrintNumber(\"Unrecognized Error ID\", \"0x%x\", l_rc);\n";
+print TGFILE " }\n";
+print TGFILE "}\n\n";
+
+#------------------------------------------------------------------------------
+# Print start of fapiParseHwpFfdc function
+#------------------------------------------------------------------------------
+print TGFILE "void fapiParseHwpFfdc(ErrlUsrParser & i_parser,\n";
+print TGFILE " void * i_pBuffer,\n";
+print TGFILE " const uint32_t i_buflen)\n";
+print TGFILE "{\n";
+print TGFILE " const uint32_t CFAM_DATA_LEN = 4;\n";
+print TGFILE " const uint32_t SCOM_DATA_LEN = 8;\n";
+print TGFILE " uint8_t * l_pBuffer = static_cast<uint8_t *>(i_pBuffer);\n";
+print TGFILE " int32_t l_buflen = i_buflen;\n\n";
+print TGFILE " // The first uint32_t is the FFDC ID\n";
+print TGFILE " uint32_t * l_pFfdcId = static_cast<uint32_t *>(i_pBuffer);\n";
+print TGFILE " uint32_t l_ffdcId = ntohl(*l_pFfdcId);\n";
+print TGFILE " l_pBuffer += sizeof(l_ffdcId);\n";
+print TGFILE " l_buflen -= sizeof(l_ffdcId);\n";
+print TGFILE " switch(l_ffdcId)\n";
+print TGFILE " {\n";
+
+#------------------------------------------------------------------------------
+# For each XML file
+#------------------------------------------------------------------------------
+foreach my $argnum (1 .. $#ARGV)
+{
+ #--------------------------------------------------------------------------
+ # Read XML file
+ #--------------------------------------------------------------------------
+ my $infile = $ARGV[$argnum];
+ my $errors = $xml->XMLin($infile, ForceArray =>
+ ['hwpError', 'ffdc', 'registerFfdc', 'cfamRegister', 'scomRegister']);
+
+ # Uncomment to get debug output of all errors
+ #print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
+
+ #--------------------------------------------------------------------------
+ # If it is an FFDC section resulting from a <hwpError><ffdc> element, print
+ # out the FFDC name and hexdump the data
+ #--------------------------------------------------------------------------
+ foreach my $err (@{$errors->{hwpError}})
+ {
+ foreach my $ffdc (@{$err->{ffdc}})
+ {
+ #------------------------------------------------------------------
+ # Figure out the FFDC ID stored in the data. This is calculated in
+ # the same way as fapiParseErrorInfo.pl. This code must be kept in
+ # sync
+ #------------------------------------------------------------------
+ my $ffdcName = $err->{rc} . "_";
+ $ffdcName = $ffdcName . $ffdc;
+ my $ffdcHash128Bit = md5_hex($ffdcName);
+ my $ffdcHash32Bit = substr($ffdcHash128Bit, 0, 8);
+
+ print TGFILE " case 0x$ffdcHash32Bit:\n";
+ print TGFILE " i_parser.PrintString(\"FFDC:\", \"$ffdcName\");\n";
+ print TGFILE " if (l_buflen) ";
+ print TGFILE "{i_parser.PrintHexDump(l_pBuffer, l_buflen);}\n";
+ print TGFILE " break;\n";
+ }
+ }
+
+ #--------------------------------------------------------------------------
+ # If it is an FFDC section resulting from a <registerFfdc> element, print
+ # out the ID and walk through the registers, printing each out
+ #--------------------------------------------------------------------------
+ foreach my $registerFfdc (@{$errors->{registerFfdc}})
+ {
+ #----------------------------------------------------------------------
+ # Figure out the FFDC ID stored in the data. This is calculated in the
+ # same way as fapiParseErrorInfo.pl. This code must be kept in sync
+ #----------------------------------------------------------------------
+ my $ffdcName = $registerFfdc->{id};
+ my $ffdcHash128Bit = md5_hex($ffdcName);
+ my $ffdcHash32Bit = substr($ffdcHash128Bit, 0, 8);
+ print TGFILE " case 0x$ffdcHash32Bit:\n";
+ print TGFILE " i_parser.PrintString(\"Register FFDC:\", \"$ffdcName\");\n";
+
+ foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}})
+ {
+ print TGFILE " l_buflen -= CFAM_DATA_LEN;\n";
+ print TGFILE " if (l_buflen)\n";
+ print TGFILE " {\n";
+ print TGFILE " i_parser.PrintString(NULL, \"$cfamRegister\");\n";
+ print TGFILE " i_parser.PrintHexDump(l_pBuffer, CFAM_DATA_LEN);\n";
+ print TGFILE " }\n";
+ print TGFILE " l_pBuffer+= CFAM_DATA_LEN;\n";
+ }
+
+ foreach my $scomRegister (@{$registerFfdc->{scomRegister}})
+ {
+ print TGFILE " l_buflen -= SCOM_DATA_LEN;\n";
+ print TGFILE " if (l_buflen)\n";
+ print TGFILE " {\n";
+ print TGFILE " i_parser.PrintString(NULL, \"$scomRegister\");\n";
+ print TGFILE " i_parser.PrintHexDump(l_pBuffer, SCOM_DATA_LEN);\n";
+ print TGFILE " }\n";
+ print TGFILE " l_pBuffer+= SCOM_DATA_LEN;\n";
+ }
+
+ print TGFILE " break;\n";
+ }
+}
+
+#------------------------------------------------------------------------------
+# Print end of fapiParseHwpFfdc function
+#------------------------------------------------------------------------------
+print TGFILE " default:\n";
+print TGFILE " i_parser.PrintNumber(\"Unrecognized FFDC\", \"0x%x\", l_ffdcId);\n";
+print TGFILE " }\n\n";
+print TGFILE "}\n\n";
+
+#------------------------------------------------------------------------------
+# Print end of file info
+#------------------------------------------------------------------------------
+print TGFILE "}\n\n";
+print TGFILE "#endif\n";
+print TGFILE "#endif\n";
+
+#------------------------------------------------------------------------------
+# Close output file
+#------------------------------------------------------------------------------
+close(TGFILE);
+
diff --git a/src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl b/src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl
deleted file mode 100755
index a73a1dd77..000000000
--- a/src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/hwpf/plat/fapiPlatCreateHwpRcDecoder.pl $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2012
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or otherwise
-# divested of its trade secrets, irrespective of what has been
-# deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
-# IBM_PROLOG_END_TAG
-
-#
-# 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
-#
-
-use strict;
-
-#------------------------------------------------------------------------------
-# Print Command Line Help
-#------------------------------------------------------------------------------
-my $numArgs = $#ARGV + 1;
-if ($numArgs < 2)
-{
- print ("Usage: fapiPlatCreateHwpRcDecoder.pl <output dir> <filename1> <filename2> ...\n");
- print (" This perl script will parse HWP Error XML files and create\n");
- print (" a file containing a function that decodes HWP RC values\n");
- exit(1);
-}
-
-#------------------------------------------------------------------------------
-# Specify perl modules to use
-#------------------------------------------------------------------------------
-use Digest::MD5 qw(md5_hex);
-use XML::Simple;
-my $xml = new XML::Simple (ForceArray=>[qw(hwpError)]);
-
-# Uncomment to enable debug output
-#use Data::Dumper;
-
-#------------------------------------------------------------------------------
-# Open output files for writing
-#------------------------------------------------------------------------------
-my $rcFile = $ARGV[0];
-$rcFile .= "/";
-$rcFile .= "fapiPlatHwpRcDecode.H";
-open(TGFILE, ">", $rcFile);
-
-#------------------------------------------------------------------------------
-# Print start of file information
-#------------------------------------------------------------------------------
-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 "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
-#------------------------------------------------------------------------------
-foreach my $argnum (1 .. $#ARGV)
-{
- #--------------------------------------------------------------------------
- # Read XML file
- #--------------------------------------------------------------------------
- my $infile = $ARGV[$argnum];
- my $errors = $xml->XMLin($infile);
-
- # Uncomment to get debug output of all errors
- #print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
-
- #--------------------------------------------------------------------------
- # For each Error
- #--------------------------------------------------------------------------
- foreach my $err (@{$errors->{hwpError}})
- {
- #----------------------------------------------------------------------
- # Check that expected fields are present
- #----------------------------------------------------------------------
- if (! exists $err->{rc})
- {
- print ("fapiPlatCreateHwpRcDecoder.pl ERROR. rc missing\n");
- exit(1);
- }
-
- if (! exists $err->{description})
- {
- print ("fapiPlatCreateHwpRcDecoder.pl ERROR. description missing\n");
- exit(1);
- }
-
- #----------------------------------------------------------------------
- # Get the description, remove newlines, leading and trailing spaces and
- # multiple spaces
- #----------------------------------------------------------------------
- my $desc = $err->{description};
- $desc =~ s/\n/ /g;
- $desc =~ s/^ +//g;
- $desc =~ s/ +$//g;
- $desc =~ s/ +/ /g;
-
- #----------------------------------------------------------------------
- # Print the RC decode
- # Note that this uses the same code to calculate the attribute
- # enumerator as fapiParseErrorInfo.pl. This code must be kept in sync
- # with fapiParseErrorInfo.pl.
- #----------------------------------------------------------------------
- my $attrHash128Bit = md5_hex($err->{rc});
- my $attrHash24Bit = substr($attrHash128Bit, 0, 6);
-
- print TGFILE " case 0x$attrHash24Bit:\n";
- print TGFILE " return \"$desc\";\n";
- print TGFILE " break;\n";
- }
-}
-
-#------------------------------------------------------------------------------
-# 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 file
-#------------------------------------------------------------------------------
-close(TGFILE);
-
diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
index b2d716797..2680a9035 100644
--- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
+++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/plat/fapiPlatHwpInvoker.C $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/plat/fapiPlatHwpInvoker.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
/**
* @file fapiPlatHwpInvoker.C
*
@@ -46,36 +45,27 @@ void processEIFfdcs(const ErrorInfo & i_errInfo,
{
// Iterate through the FFDC sections, adding each to the error log
uint32_t l_size = 0;
- const void * l_pFfdc = NULL;
- FfdcType l_type = FFDC_TYPE_NONE;
for (ErrorInfo::ErrorInfoFfdcCItr_t l_itr = i_errInfo.iv_ffdcs.begin();
l_itr != i_errInfo.iv_ffdcs.end(); ++l_itr)
{
- l_pFfdc = (*l_itr)->getData(l_size);
- l_type = (*l_itr)->getType();
+ const void * l_pFfdc = (*l_itr)->getData(l_size);
+ uint32_t l_ffdcId = (*l_itr)->getFfdcId();
- if (l_type == FFDC_TYPE_TARGET)
- {
- io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1,
- HWPF_UDT_HWP_TARGET);
- }
- else if (l_type == FFDC_TYPE_ECMDDBB)
- {
- io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1,
- HWPF_UDT_HWP_ECMDDBB);
- }
- else
- {
- io_pError->addFFDC(HWPF_COMP_ID, l_pFfdc, l_size, 1,
- HWPF_UDT_HWP_DATA);
+ // Add the FFDC ID as the first word, then the FFDC data
+ ERRORLOG::ErrlUD * l_pUD = io_pError->addFFDC(
+ HWPF_COMP_ID, &l_ffdcId, sizeof(l_ffdcId), 1, HWPF_UDT_HWP_FFDC);
+
+ if (l_pUD)
+ {
+ io_pError->appendToFFDC(l_pUD, l_pFfdc, l_size);
}
}
}
//******************************************************************************
// processEICDGs
-// Processes any Callout/Deconfigure/GARD requests in the ReturnCode Error
+// Processes any Callout/Deconfigure/GARD requests in the ReturnCode Error
// Information
//******************************************************************************
void processEICDGs(const ErrorInfo & i_errInfo,
OpenPOWER on IntegriCloud