summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/fapi
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/fapi
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/fapi')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiCreateIfAttrService.pl31
-rw-r--r--src/usr/hwpf/fapi/fapiErrorInfo.C62
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseAttributeInfo.pl31
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl439
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCode.C63
-rw-r--r--src/usr/hwpf/fapi/makefile31
6 files changed, 450 insertions, 207 deletions
diff --git a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
index 912ba98a0..89c110c9d 100755
--- a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
+++ b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/fapi/fapiCreateIfAttrService.pl $
+# $Source: src/usr/hwpf/fapi/fapiCreateIfAttrService.pl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# 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
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script will parse HWP Attribute XML files and
# initfile attr files and create the fapiGetInitFileAttr() function
@@ -38,6 +38,7 @@
# mjjones 01/13/12 Use new ReturnCode interfaces
# mjjones 02/08/12 Handle attribute files with 1 entry
# mjjones 06/12/12 Handle privileged attributes
+# mjjones 09/28/12 Minor change to add FFDC on error
#
# End Change Log ******************************************************
@@ -282,7 +283,7 @@ if ($attCount > 0)
print ASFILE " {\n";
print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n";
print ASFILE " l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);\n";
-print ASFILE " ReturnCodeFfdc::addEIFfdc(l_rc, static_cast<uint32_t>(i_id));\n";
+print ASFILE " l_rc.addEIFfdc(0, &i_id, sizeof(i_id));\n";
print ASFILE " }\n\n";
print ASFILE " if (l_rc)\n";
print ASFILE " {\n";
diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C
index f1d5d81a0..5d4e9e716 100644
--- a/src/usr/hwpf/fapi/fapiErrorInfo.C
+++ b/src/usr/hwpf/fapi/fapiErrorInfo.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/fapi/fapiErrorInfo.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/fapi/fapiErrorInfo.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 fapiErrorInfo.C
*
@@ -38,6 +37,7 @@
* ctor and assignment operator
* mjjones 08/14/2012 Merge Callout/Deconfig/Gard
* structures into one
+ * mjjones 09/19/2012 Replace FFDC type with ID
*/
#include <fapiErrorInfo.H>
@@ -49,10 +49,10 @@ namespace fapi
//******************************************************************************
// ErrorInfoFfdc Constructor
//******************************************************************************
-ErrorInfoFfdc::ErrorInfoFfdc(const void * i_pFfdc,
- const uint32_t i_size,
- const FfdcType i_type)
-: iv_size(i_size), iv_type(i_type)
+ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId,
+ const void * i_pFfdc,
+ const uint32_t i_size)
+: iv_ffdcId(i_ffdcId), iv_size(i_size)
{
iv_pFfdc = new uint8_t[i_size];
memcpy(iv_pFfdc, i_pFfdc, i_size);
@@ -77,14 +77,6 @@ const void * ErrorInfoFfdc::getData(uint32_t & o_size) const
}
//******************************************************************************
-// ErrorInfoFfdc getType function
-//******************************************************************************
-FfdcType ErrorInfoFfdc::getType() const
-{
- return iv_type;
-}
-
-//******************************************************************************
// ErrorInfoCDG Constructor
//******************************************************************************
ErrorInfoCDG::ErrorInfoCDG(const Target & i_target)
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
index 4e092f90f..3a0ab3bea 100755
--- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/fapi/fapiParseAttributeInfo.pl $
+# $Source: src/usr/hwpf/fapi/fapiParseAttributeInfo.pl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# 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
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script will parse HWP Attribute XML files
# and add attribute information to a file called fapiAttributeIds.H
@@ -61,6 +61,7 @@
# parsing enumerations
# mjjones 06/12/12 Add new include file to fapiChipEcFeature.C
# mjjones 08/08/12 Output target types and if PlatInit
+# mjjones 09/28/12 Minor change to add FFDC on error
#
# End Change Log ******************************************************
@@ -593,7 +594,7 @@ print ECFILE " default:\n";
print ECFILE " FAPI_ERR(\"fapiQueryChipEcFeature: Unknown feature 0x%x\",\n";
print ECFILE " i_id);\n";
print ECFILE " l_rc.setFapiError(FAPI_RC_INVALID_CHIP_EC_FEATURE_GET);\n";
-print ECFILE " fapi::ReturnCodeFfdc::addEIFfdc(l_rc, i_id);\n";
+print ECFILE " l_rc.addEIFfdc(0, &i_id, sizeof(i_id));\n";
print ECFILE " break;\n";
print ECFILE " }\n\n";
print ECFILE " if (o_hasFeature)\n";
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
index db8fa48e5..68055799d 100755
--- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/fapi/fapiParseErrorInfo.pl $
+# $Source: src/usr/hwpf/fapi/fapiParseErrorInfo.pl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# 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
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script will parse HWP Error XML files and create required
# FAPI code. The FAPI files created are:
@@ -48,6 +48,8 @@
# mjjones 05/15/12 Detect duplicate error rcs
# mjjones 05/21/12 Detect duplicate ids/hashes across files
# mjjones 06/27/12 Add assembler output for SBE usage
+# mjjones 09/19/12 Generate FFDC ID enumeration
+# Generate fapiCollectRegFfdc.C file
#
# End Change Log ******************************************************
@@ -65,6 +67,44 @@ use strict;
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
#------------------------------------------------------------------------------
+# 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;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 2)
+{
+ print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n");
+ print (" This perl script will parse HWP Error XML files and create\n");
+ print (" the following files:\n");
+ print (" - fapiHwpReturnCodes.H. HwpReturnCode enumeration (HWP generated errors)\n");
+ print (" - fapiHwpErrorInfo.H. Error information (used by FAPI_SET_HWP_ERROR\n");
+ print (" when a HWP generates an error)\n");
+ print (" - fapiCollectRegFfdc.C. Function to collect register FFDC\n");
+ exit(1);
+}
+
+#------------------------------------------------------------------------------
+# Hashes containing error names/enum-values
+#------------------------------------------------------------------------------
+my %errNameToValueHash;
+my %errValuePresentHash;
+
+#------------------------------------------------------------------------------
+# Hashes containing ffdc names/enum-values
+#------------------------------------------------------------------------------
+my %ffdcNameToValueHash;
+my %ffdcValuePresentHash;
+
+#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
@@ -97,29 +137,93 @@ sub addEntryToArray
}
#------------------------------------------------------------------------------
-# Print Command Line Help
+# Subroutine that figures out an error enum value from an error name and stores
+# it in global hashes
#------------------------------------------------------------------------------
-my $numArgs = $#ARGV + 1;
-if ($numArgs < 2)
+sub setErrorEnumValue
{
- print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n");
- print (" This perl script will parse HWP Error XML files and create\n");
- print (" the following files:\n");
- print (" - fapiHwpReturnCodes.H. HwpReturnCode enumeration (HWP generated errors)\n");
- print (" - fapiHwpErrorInfo.H. Error information (used by FAPI_SET_HWP_ERROR\n");
- print (" when a HWP generates an error)\n");
- exit(1);
+ my $name = $_[0];
+
+ #--------------------------------------------------------------------------
+ # Check that the error name is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($errNameToValueHash{$name}))
+ {
+ # Two different errors with the same name!
+ print ("fapiParseErrorInfo.pl ERROR. Duplicate error name ", $name, "\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Figure out the error enum-value. This is a hash value generated from
+ # the error name. A hash is used for Cronus so that if a HWP is not
+ # recompiled against a new eCMD/Cronus version where the errors have
+ # changed then there will not be a mismatch in error values.
+ # This is a 24bit hash value because FAPI has a requirement that the
+ # top byte of the 32 bit error value be zero to store flags indicating
+ # the creator of the error
+ #--------------------------------------------------------------------------
+ my $errHash128Bit = md5_hex($name);
+ my $errHash24Bit = substr($errHash128Bit, 0, 6);
+
+ #--------------------------------------------------------------------------
+ # Check that the error enum-value is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($errValuePresentHash{$errHash24Bit}))
+ {
+ # Two different errors generate the same hash-value!
+ print ("fapiParseAttributeInfo.pl ERROR. Duplicate error hash value\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Update the hashes with the error name and ID
+ #--------------------------------------------------------------------------
+ $errValuePresentHash{$errHash24Bit} = 1;
+ $errNameToValueHash{$name} = $errHash24Bit;
}
#------------------------------------------------------------------------------
-# Specify perl modules to use
+# Subroutine that figures out an FFDC enum value from an FFDC name and stores
+# it in global hashes
#------------------------------------------------------------------------------
-use Digest::MD5 qw(md5_hex);
-use XML::Simple;
-my $xml = new XML::Simple (KeyAttr=>[]);
+sub setFfdcEnumValue
+{
+ my $name = $_[0];
-# Uncomment to enable debug output
-#use Data::Dumper;
+ #--------------------------------------------------------------------------
+ # Check that the FFDC name is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($ffdcNameToValueHash{$name}))
+ {
+ # Two different FFDCs with the same name!
+ print ("fapiParseErrorInfo.pl ERROR. Duplicate FFDC name ", $name, "\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Figure out the FFDC enum-value. This is a hash value generated from
+ # the FFDC name.
+ #--------------------------------------------------------------------------
+ my $ffdcHash128Bit = md5_hex($name);
+ my $ffdcHash32Bit = substr($ffdcHash128Bit, 0, 8);
+
+ #--------------------------------------------------------------------------
+ # Check that the error enum-value is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($ffdcValuePresentHash{$ffdcHash32Bit}))
+ {
+ # Two different FFDCs generate the same hash-value!
+ print ("fapiParseAttributeInfo.pl ERROR. Duplicate FFDC hash value\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Update the hashes with the error name and ID
+ #--------------------------------------------------------------------------
+ $ffdcValuePresentHash{$ffdcHash32Bit} = 1;
+ $ffdcNameToValueHash{$name} = $ffdcHash32Bit;
+}
#------------------------------------------------------------------------------
# Open output files for writing
@@ -134,6 +238,11 @@ $eiFile .= "/";
$eiFile .= "fapiHwpErrorInfo.H";
open(EIFILE, ">", $eiFile);
+my $crFile = $ARGV[0];
+$crFile .= "/";
+$crFile .= "fapiCollectRegFfdc.C";
+open(CRFILE, ">", $crFile);
+
#------------------------------------------------------------------------------
# Print start of file information to fapiHwpErrorInfo.H
#------------------------------------------------------------------------------
@@ -142,21 +251,37 @@ 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 " * \@brief Error Information macros and HwpFfdcId enumeration\n";
print EIFILE " *\/\n";
#------------------------------------------------------------------------------
-# Element names
+# Print start of file information to fapiCollectRegFfdc.C
#------------------------------------------------------------------------------
-my $hwpError = 'hwpError';
-my $collectFfdc = 'collectFfdc';
-my $ffdc = 'ffdc';
-my $callout = 'callout';
-my $deconfigure = 'deconfigure';
-my $gard = 'gard';
-
-my %errNameToErrValueHash;
-my %errValuePresentHash;
+print CRFILE "// fapiCollectRegFfdc.C\n";
+print CRFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
+print CRFILE "#include <stdint.h>\n";
+print CRFILE "#include <vector>\n";
+print CRFILE "#include <ecmdDataBufferBase.H>\n";
+print CRFILE "#include <fapiCollectRegFfdc.H>\n";
+print CRFILE "#include <fapiTarget.H>\n";
+print CRFILE "#include <fapiReturnCode.H>\n";
+print CRFILE "#include <fapiHwAccess.H>\n\n";
+print CRFILE "namespace fapi\n";
+print CRFILE "{\n";
+print CRFILE "void fapiCollectRegFfdc(const fapi::Target & i_target,\n";
+print CRFILE " const fapi::HwpFfdcId i_ffdcId,\n";
+print CRFILE " fapi::ReturnCode & o_rc)\n";
+print CRFILE "{\n";
+print CRFILE " FAPI_INF(\"fapiCollectRegFfdc. FFDC ID: 0x%x\", i_ffdcId);\n";
+print CRFILE " fapi::ReturnCode l_rc;\n";
+print CRFILE " ecmdDataBufferBase l_buf;\n";
+print CRFILE " uint32_t l_cfamData = 0;\n";
+print CRFILE " uint64_t l_scomData = 0;\n";
+print CRFILE " std::vector<uint32_t> l_cfamAddresses;\n";
+print CRFILE " std::vector<uint64_t> l_scomAddresses;\n";
+print CRFILE " uint32_t l_ffdcSize = 0;\n\n";
+print CRFILE " switch (i_ffdcId)\n";
+print CRFILE " {\n";
#------------------------------------------------------------------------------
# For each XML file
@@ -171,7 +296,8 @@ foreach my $argnum (1 .. $#ARGV)
# elements even if there is only one element
#--------------------------------------------------------------------------
my $errors = $xml->XMLin($infile, ForceArray =>
- [$hwpError, $collectFfdc, $ffdc, $callout, $deconfigure, $gard]);
+ ['hwpError', 'collectFfdc', 'ffdc', 'callout', 'deconfigure', 'gard',
+ 'registerFfdc', 'collectRegisterFfdc', 'cfamRegister', 'scomRegister']);
# Uncomment to get debug output of all errors
#print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
@@ -197,57 +323,9 @@ foreach my $argnum (1 .. $#ARGV)
}
#----------------------------------------------------------------------
- # Check that the error name is not a duplicate
- #----------------------------------------------------------------------
- if (exists($errNameToErrValueHash{$err->{rc}}))
- {
- # Two different errors with the same name!
- print ("fapiParseErrorInfo.pl ERROR. Duplicate error name ",
- $err->{rc}, "\n");
- exit(1);
- }
-
- #----------------------------------------------------------------------
- # Figure out the error value. This is a hash value generated from the
- # error name. This is done for Cronus so that if a HWP is not
- # recompiled against a new eCMD/Cronus version where the errors have
- # changed then there will not be a mismatch in error values.
- # This is a 24bit hash value because FAPI has a requirement that the
- # top byte of the 32 bit error value be zero to store flags indicating
- # the creator of the error
- #----------------------------------------------------------------------
- my $errHash128Bit = md5_hex($err->{rc});
- my $errHash24Bit = substr($errHash128Bit, 0, 6);
-
- #----------------------------------------------------------------------
- # Check that the error value is not a duplicate
- #----------------------------------------------------------------------
- if (exists($errValuePresentHash{$errHash24Bit}))
- {
- # Two different errors generate the same hash-value!
- print ("fapiParseAttributeInfo.pl ERROR. Duplicate error hash value\n");
- exit(1);
- }
-
- #----------------------------------------------------------------------
- # Update the hashes with the error name and ID
- #----------------------------------------------------------------------
- $errValuePresentHash{$errHash24Bit} = 1;
- $errNameToErrValueHash{$err->{rc}} = $errHash24Bit;
-
- #----------------------------------------------------------------------
- # Print the CALL_FUNC_TO_ANALYZE_ERROR macro to fapiHwpErrorInfo.H
- #----------------------------------------------------------------------
- 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";
- }
+ # Set the error enum value in a global hash
+ #---------------------------------------------------------------------
+ setErrorEnumValue($err->{rc});
#----------------------------------------------------------------------
# Print the CALL_FUNCS_TO_COLLECT_FFDC macro to fapiHwpErrorInfo.H
@@ -274,6 +352,34 @@ foreach my $argnum (1 .. $#ARGV)
print EIFILE "\n";
#----------------------------------------------------------------------
+ # Print the CALL_FUNCS_TO_COLLECT_REG_FFDC macro to fapiHwpErrorInfo.H
+ #----------------------------------------------------------------------
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC) ";
+
+ foreach my $collectRegisterFfdc (@{$err->{collectRegisterFfdc}})
+ {
+ #------------------------------------------------------------------
+ # Check that expected fields are present
+ #----------------------------------------------------------------------
+ if (! exists $collectRegisterFfdc->{id})
+ {
+ print ("fapiParseErrorInfo.pl ERROR. id missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+
+ if (! exists $collectRegisterFfdc->{target})
+ {
+ print ("fapiParseErrorInfo.pl ERROR. target missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+
+ print EIFILE "fapiCollectRegFfdc($collectRegisterFfdc->{target}, ";
+ print EIFILE "fapi::$collectRegisterFfdc->{id}, RC); ";
+ }
+
+ print EIFILE "\n";
+
+ #----------------------------------------------------------------------
# Print the ADD_ERROR_INFO macro to fapiHwpErrorInfo.H
#----------------------------------------------------------------------
print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) ";
@@ -288,6 +394,11 @@ foreach my $argnum (1 .. $#ARGV)
# Local FFDC
foreach my $ffdc (@{$err->{ffdc}})
{
+ # Set the FFDC enum value in a global hash. The name is <rc>_<ffdc>
+ my $ffdcName = $err->{rc} . "_";
+ $ffdcName = $ffdcName . $ffdc;
+ setFfdcEnumValue($ffdcName);
+
# Add the FFDC data to the EI Object array if it doesn't already exist
my $objNum = addEntryToArray(\@eiObjects, $ffdc);
@@ -296,7 +407,7 @@ foreach my $argnum (1 .. $#ARGV)
{
$eiEntryStr .= ", ";
}
- $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_FFDC, $objNum, fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc)}";
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_FFDC, $objNum, fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc), fapi::$ffdcName}";
$eiEntryCount++;
}
@@ -326,7 +437,7 @@ foreach my $argnum (1 .. $#ARGV)
{
$eiEntryStr .= ", ";
}
- $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_CALLOUT, $objNum, fapi::PRI_$callout->{priority}}";
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_CALLOUT, $objNum, fapi::PRI_$callout->{priority}, 0}";
$eiEntryCount++;
}
@@ -350,7 +461,7 @@ foreach my $argnum (1 .. $#ARGV)
{
$eiEntryStr .= ", ";
}
- $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_DECONF, $objNum}";
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_DECONF, $objNum, 0, 0}";
$eiEntryCount++;
}
@@ -374,7 +485,7 @@ foreach my $argnum (1 .. $#ARGV)
{
$eiEntryStr .= ", ";
}
- $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_GARD, $objNum}";
+ $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_GARD, $objNum, 0, 0}";
$eiEntryCount++;
}
@@ -403,9 +514,116 @@ foreach my $argnum (1 .. $#ARGV)
}
print EIFILE "\n\n";
}
+
+ #--------------------------------------------------------------------------
+ # For each registerFfdc.
+ #--------------------------------------------------------------------------
+ foreach my $registerFfdc (@{$errors->{registerFfdc}})
+ {
+ #----------------------------------------------------------------------
+ # Check that expected fields are present
+ #----------------------------------------------------------------------
+ if (! exists $registerFfdc->{id})
+ {
+ print ("fapiParseErrorInfo.pl ERROR. id missing from registerFfdc\n");
+ exit(1);
+ }
+
+ #----------------------------------------------------------------------
+ # Set the FFDC enum value in a global hash
+ #----------------------------------------------------------------------
+ setFfdcEnumValue($registerFfdc->{id});
+
+ #----------------------------------------------------------------------
+ # Generate code to capture the registers in fapiCollectRegFfdc.C
+ #----------------------------------------------------------------------
+ print CRFILE " case $registerFfdc->{id}:\n";
+
+ # Look for CFAM Register addresses
+ foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}})
+ {
+ # Extract the address
+ if ($cfamRegister =~ m/(0x\d+)/)
+ {
+ print CRFILE " l_cfamAddresses.push_back($1);\n";
+ print CRFILE " l_ffdcSize += sizeof(l_cfamData);\n";
+ }
+ else
+ {
+ print ("fapiParseErrorInfo.pl ERROR. CFAM address bad: $cfamRegister\n");
+ exit(1);
+ }
+ }
+
+ # Look for SCOM Register addresses
+ foreach my $scomRegister (@{$registerFfdc->{scomRegister}})
+ {
+ # Extract the address
+ if ($scomRegister =~ m/(0x[\dA-Za-z]+)/)
+ {
+ print CRFILE " l_scomAddresses.push_back($1);\n";
+ print CRFILE " l_ffdcSize += sizeof(l_scomData);\n";
+ }
+ else
+ {
+ print ("fapiParseErrorInfo.pl ERROR. SCOM address bad: $scomRegister\n");
+ exit(1);
+ }
+ }
+
+ print CRFILE " break;\n";
+ }
+
}
#------------------------------------------------------------------------------
+# Print end of file information to fapiCollectRegFfdc.C
+#------------------------------------------------------------------------------
+print CRFILE " default:\n";
+print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Invalid FFDC ID 0x%x\", ";
+print CRFILE "i_ffdcId);\n";
+print CRFILE " return;\n";
+print CRFILE " }\n\n";
+print CRFILE " uint8_t * l_pBuf = new uint8_t[l_ffdcSize];\n";
+print CRFILE " uint8_t * l_pData = l_pBuf;\n\n";
+print CRFILE " for (uint32_t i = 0; i < l_cfamAddresses.size(); i++)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetCfamRegister(i_target, l_cfamAddresses[i], l_buf);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: CFAM error for 0x%x\",";
+print CRFILE "l_cfamAddresses[i]);\n";
+print CRFILE " l_cfamData = 0xbaddbadd;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_cfamData = l_buf.getWord(0);\n";
+print CRFILE " }\n";
+print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_cfamData;\n";
+print CRFILE " l_pData += sizeof(l_cfamData);\n";
+print CRFILE " }\n\n";
+print CRFILE " for (uint32_t i = 0; i < l_scomAddresses.size(); i++)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetScom(i_target, l_scomAddresses[i], l_buf);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: SCOM error for 0x%x\",";
+print CRFILE "l_scomAddresses[i]);\n";
+print CRFILE " l_scomData = 0xbaddbaddbaddbadd;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_scomData = l_buf.getDoubleWord(0);\n";
+print CRFILE " }\n";
+print CRFILE " *(reinterpret_cast<uint64_t *>(l_pData)) = l_scomData;\n";
+print CRFILE " l_pData += sizeof(l_scomData);\n";
+print CRFILE " }\n\n";
+print CRFILE " o_rc.addEIFfdc(i_ffdcId, l_pBuf, l_ffdcSize);\n";
+print CRFILE " delete [] l_pBuf;\n";
+print CRFILE "}\n";
+print CRFILE "}\n";
+
+#------------------------------------------------------------------------------
# Print the fapiHwpReturnCodes.H file
#------------------------------------------------------------------------------
print RCFILE "// fapiHwpReturnCodes.H\n";
@@ -420,21 +638,39 @@ print RCFILE " * \@brief Enumeration of HWP return codes\n";
print RCFILE " *\/\n";
print RCFILE "enum HwpReturnCode\n";
print RCFILE "{\n";
-foreach my $key (keys %errNameToErrValueHash)
+foreach my $key (keys %errNameToValueHash)
{
- print RCFILE " $key = 0x$errNameToErrValueHash{$key},\n";
+ print RCFILE " $key = 0x$errNameToValueHash{$key},\n";
}
print RCFILE "};\n\n";
print RCFILE "}\n\n";
print RCFILE "#else\n";
-foreach my $key (keys %errNameToErrValueHash)
+foreach my $key (keys %errNameToValueHash)
{
- print RCFILE " .set $key, 0x$errNameToErrValueHash{$key}\n";
+ print RCFILE " .set $key, 0x$errNameToValueHash{$key}\n";
}
print RCFILE "#endif\n";
print RCFILE "#endif\n";
#------------------------------------------------------------------------------
+# Print the HwpFfdcId enumeration to fapiHwpErrorInfo.H
+#------------------------------------------------------------------------------
+print EIFILE "namespace fapi\n";
+print EIFILE "{\n\n";
+print EIFILE "/**\n";
+print EIFILE " * \@brief Enumeration of FFDC identifiers\n";
+print EIFILE " *\/\n";
+print EIFILE "enum HwpFfdcId\n";
+print EIFILE "{\n";
+foreach my $key (keys %ffdcNameToValueHash)
+{
+ print EIFILE " $key = 0x$ffdcNameToValueHash{$key},\n";
+}
+print EIFILE "};\n\n";
+print EIFILE "}\n\n";
+
+
+#------------------------------------------------------------------------------
# Print end of file information to fapiHwpErrorInfo.H
#------------------------------------------------------------------------------
print EIFILE "\n\n#endif\n";
@@ -444,4 +680,5 @@ print EIFILE "\n\n#endif\n";
#------------------------------------------------------------------------------
close(RCFILE);
close(EIFILE);
+close(CRFILE);
diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C
index 97b923406..b8dae8bed 100644
--- a/src/usr/hwpf/fapi/fapiReturnCode.C
+++ b/src/usr/hwpf/fapi/fapiReturnCode.C
@@ -47,11 +47,13 @@
* mjjones 07/11/2012 Remove a trace
* brianh 07/31/2012 performance/size optimizations
* mjjones 08/14/2012 Use new ErrorInfo structure
+ * mjjones 09/19/2012 Add FFDC ID to error info
*/
#include <fapiReturnCode.H>
#include <fapiReturnCodeDataRef.H>
#include <fapiPlatTrace.H>
+#include <fapiTarget.H>
namespace fapi
{
@@ -228,42 +230,51 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects,
{
for (uint32_t i = 0; i < i_count; i++)
{
- // Figure out the object of this entry
+ // Figure out the object that this FFDC refers to
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;
+ uint32_t l_ffdcId = i_pEntries[i].iv_data2;
if (l_size > 0)
{
// This is a regular FFDC data object that can be directly
// memcopied
- addEIFfdc(l_pObject, l_size, FFDC_TYPE_DATA);
+ addEIFfdc(l_ffdcId, l_pObject, l_size);
+ }
+ else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB)
+ {
+ // The FFDC is a ecmdDataBufferBase
+ const ecmdDataBufferBase * l_pDb =
+ static_cast<const ecmdDataBufferBase *>(l_pObject);
+
+ uint32_t * l_pData = new uint32_t[l_pDb->getWordLength()];
+
+ // getWordLength rounds up to the next 32bit boundary, ensure
+ // that after extracting, any unset bits are zero
+ l_pData[l_pDb->getWordLength() - 1] = 0;
+
+ // Deliberately not checking return code from extract
+ l_pDb->extract(l_pData, 0, l_pDb->getBitLength());
+ addEIFfdc(l_ffdcId, l_pData, (l_pDb->getWordLength() * 4));
+
+ delete [] l_pData;
+ }
+ else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_TARGET)
+ {
+ // The FFDC is a fapi::Target
+ const fapi::Target * l_pTarget =
+ static_cast<const fapi::Target *>(l_pObject);
+
+ const char * l_ecmdString = l_pTarget->toEcmdString();
+ addEIFfdc(l_ffdcId, l_ecmdString, (strlen(l_ecmdString) + 1));
}
else
{
- // This is a special FFDC data object
- if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB)
- {
- // The FFDC is a ecmdDataBufferBase
- const ecmdDataBufferBase * l_pDb =
- static_cast<const ecmdDataBufferBase *>(l_pObject);
- ReturnCodeFfdc::addEIFfdc(*this, *l_pDb);
- }
- else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_TARGET)
- {
- // The FFDC is a fapi::Target
- const fapi::Target * l_pTarget =
- static_cast<const fapi::Target *>(l_pObject);
- ReturnCodeFfdc::addEIFfdc(*this, *l_pTarget);
- }
- else
- {
- FAPI_ERR("addErrorInfo: Unrecognized FFDC data: %d",
- l_size);
- }
+ FAPI_ERR("addErrorInfo: Unrecognized FFDC data: %d", l_size);
}
}
else if (i_pEntries[i].iv_type == EI_TYPE_CALLOUT)
@@ -306,12 +317,12 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects,
//******************************************************************************
// addEIFfdc function
//******************************************************************************
-void ReturnCode::addEIFfdc(const void * i_pFfdc,
- const uint32_t i_size,
- const FfdcType i_type)
+void ReturnCode::addEIFfdc(const uint32_t i_ffdcId,
+ const void * i_pFfdc,
+ const uint32_t i_size)
{
// Create a ErrorInfoFfdc object and add it to the Error Information
- ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_pFfdc, i_size, i_type);
+ ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_ffdcId, i_pFfdc, i_size);
getCreateReturnCodeDataRef().getCreateErrorInfo().
iv_ffdcs.push_back(l_pFfdc);
}
diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile
index 5b3db9e72..ddb17b4b9 100644
--- a/src/usr/hwpf/fapi/makefile
+++ b/src/usr/hwpf/fapi/makefile
@@ -1,25 +1,25 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/fapi/makefile $
+# $Source: src/usr/hwpf/fapi/makefile $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# 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
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
ROOTPATH = ../../../..
MODULE = fapi
@@ -36,7 +36,8 @@ OBJS = fapiReturnCode.o \
fapiErrorInfo.o \
fapiAttributeService.o \
fapiChipEcFeature.o \
- fapiAttributeOverride.o
+ fapiAttributeOverride.o \
+ fapiCollectRegFfdc.o
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud