summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf/fapi2/tools
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2016-07-11 15:59:17 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-08-12 09:48:43 -0400
commit333bd2d69881f31cf6db145c33daf94c23397f9f (patch)
treefeaf1e28be98a9c1f2b49ce7b57ad577a2dff62c /src/import/hwpf/fapi2/tools
parent8a32eec46393c1dcd479af6c8815852494d39cf5 (diff)
downloadtalos-hostboot-333bd2d69881f31cf6db145c33daf94c23397f9f.tar.gz
talos-hostboot-333bd2d69881f31cf6db145c33daf94c23397f9f.zip
Update parseErrorInfo.pl to support collectFfdc tags for SBE
-Modified script to enable passing back from the SBE parameters for the collectFfdc fuction -Added sample code for collectFfdc tags to proc_example_errors.xml -Added sample collectFfdc function p9_collect_some_ffdc -Fixed compile issue in fapi2_variable_buffer_test which was a result of changes to the hwp_ffdc_classes generated by the script. Change-Id: I6abbbc05ed38e368eb0ff586a22cc5aba824bad4 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27048 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Deepak Kodihalli <dkodihal@in.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27459 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/hwpf/fapi2/tools')
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/parseErrorInfo.pl194
1 files changed, 134 insertions, 60 deletions
diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
index 4385d8db7..dd1c64d84 100755
--- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
+++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
@@ -57,6 +57,8 @@ my $xml = new XML::Simple (KeyAttr=>[]);
use Data::Dumper;
use Getopt::Long;
+
+my @eiObjects = ();
my $target_ffdc_type = "fapi2::Target<T>";
my $buffer_ffdc_type = "fapi2::buffer";
my $variable_buffer_ffdc_type = "fapi2::variable_buffer";
@@ -68,9 +70,10 @@ my $mcast_type = "fapi2::mcast_t";
my %signatures = ("proc_extract_pore_halt_ffdc" => ["por_base_state",
"por_halt_type_t",
"por_ffdc_offset_t"],
- "hwpTestFfdc1" => [$target_ffdc_type],
+ "proc_example" => ["uint32_t","uint8_t"],
"proc_extract_pore_base_ffdc" => ["por_base_state", "por_sbe_base_state"],
"proc_tp_collect_dbg_data" => [$target_ffdc_type],
+ "p9_collect_some_ffdc" => ["uint32_t","uint8_t"],
);
# There are some names used in the XML files which exist in either
@@ -287,6 +290,7 @@ sub addFfdcMethod
$methods->{$key}{type} = $type;
delete $methods->{$key_ffdc} if ($type eq $target_ffdc_type);
+
my $method = "";
my $method_body = "";
@@ -302,7 +306,9 @@ sub addFfdcMethod
{
$method_body = " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() =";
$method_body .= " fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
- $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
+ $methods->{$objectNumber}{localvar} = "$ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
+ $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
}
else
{
@@ -322,8 +328,9 @@ sub addFfdcMethod
$method = "\n template< typename T >\n";
$method .= " inline $class_name& set_$ffdc_uc(const fapi2::buffer<T>& $param)\n";
$method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
-
- $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
+ $methods->{$objectNumber}{localvar} = "$buffer_ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
+ $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
}
elsif ($type eq $variable_buffer_ffdc_type)
@@ -341,13 +348,33 @@ sub addFfdcMethod
$method .= " inline $class_name& set_$ffdc_uc(const $type& $param)\n";
$method_body .= " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
- $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
+ $methods->{$objectNumber}{localvar} = "$ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
+ $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc=$ffdc_uc";
}
else
{
- print ("ffdc type $type is unknown\n");
- exit(1);
+ $method .= "\tinline $class_name& set_$ffdc_uc($type $param)\n";
+
+ if(!$arg_local_ffdc)
+ {
+ $method_body = " { $ffdc_uc = i_value; ";
+ $method_body .= " return *this;}\n\n";
+ $methods->{$key}{member} = "$type $ffdc_uc;";
+ $methods->{$objectNumber}{localvar} = "$type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
+ $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
+ }
+ else
+ {
+ # need to use the objectNumber here so when we decode the info at the hwsv/hb side we have a point of
+ # reference and they will be copied into/out of the sbe buffer in the correct order
+ $method_body .= "\t{\n\t\tfapi2::g_FfdcData.ffdcData[$objectNumber].data= convertType(i_value);\n";
+ $method_body .= "\t\tfapi2::g_FfdcData.ffdcData[$objectNumber].size =";
+ $method_body .=" fapi2::getErrorInfoFfdcSize(i_value);\n";
+ $method_body .= "\t\tfapi2::g_FfdcData.ffdcLength += sizeof(sbeFfdc_t);\n";
+ $method_body .= "\t\treturn *this;\n\t};\n\n";
+ }
}
$method .= ($arg_empty_ffdc eq undef) ? $method_body : " {return *this;}\n\n";
@@ -392,7 +419,9 @@ print EIFILE "#define FAPI2_HWPERRORINFO_H_\n\n";
print EIFILE "#include <target.H>\n";
print EIFILE "#include <plat_trace.H>\n";
print EIFILE "#include <hwp_return_codes.H>\n";
+print EIFILE "#include <hwp_executor.H>\n";
print EIFILE "#include <set_sbe_error.H>\n";
+
print EIFILE "/**\n";
print EIFILE " * \@brief Error Information macros and HwpFfdcId enumeration\n";
print EIFILE " *\/\n";
@@ -403,16 +432,16 @@ print ECFILE "// hwp_ffdc_classes.H\n";
print ECFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
print ECFILE "#ifndef FAPI2_HWP_FFDC_CLASSES_H_\n";
print ECFILE "#define FAPI2_HWP_FFDC_CLASSES_H_\n\n";
-print ECFILE "#include <ffdc.H>\n";
+print ECFILE "#include <return_code.H>\n";
+print ECFILE "#include <fapi2_hwp_executor.H>\n";
+print ECFILE "#include <error_info.H>\n";
print ECFILE "#include <buffer.H>\n";
print ECFILE "#include <variable_buffer.H>\n" if ($arg_use_variable_buffers ne undef);
-print ECFILE "#include <error_info.H>\n";
-print ECFILE "#include <utils.H>\n";
print ECFILE "#include <hwp_error_info.H>\n";
print ECFILE "#if !defined(FAPI2_NO_FFDC) && !defined(MINIMUM_FFDC)\n";
-#print ECFILE "#include <collect_reg_ffdc.H>\n";
+print ECFILE "#include <ffdc_includes.H>\n";
+print ECFILE "//#include <collect_reg_ffdc.H>\n";
print ECFILE "#endif\n";
-#print ECFILE "#include <proc_extract_sbe_rc.H>\n\n";
print ECFILE "/**\n";
print ECFILE " * \@brief FFDC gathering classes\n";
print ECFILE " *\/\n";
@@ -491,11 +520,12 @@ print SBFILE "// must take a parameter for the generic chip ID in the error\n";
print SBFILE "// XML.\n\n";
print SBFILE "#ifndef FAPI2_SETSBEERROR_H_\n";
print SBFILE "#define FAPI2_SETSBEERROR_H_\n\n";
-print SBFILE "#define FAPI_SET_SBE_ERROR(RC, ERRVAL, FFDC_BUFFER)\\\n";
+print SBFILE "#define FAPI_SET_SBE_ERROR(RC,ERRVAL,FFDC_BUFFER)\\\n";
print SBFILE "{\\\n";
print SBFILE "switch (ERRVAL)\\\n";
print SBFILE "{\\\n";
+
#------------------------------------------------------------------------------
# For each XML file
#------------------------------------------------------------------------------
@@ -521,10 +551,13 @@ foreach my $argnum (0 .. $#ARGV)
#--------------------------------------------------------------------------
foreach my $err (@{$errors->{hwpError}})
{
- my $objectStr = "";
+ my $objectStr = undef;
# Hash of methods for the ffdc-gathering class
my %methods;
+ # Array of EI Objects
+ @eiObjects = ();
+
#----------------------------------------------------------------------
# Check that expected fields are present
#----------------------------------------------------------------------
@@ -558,42 +591,61 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
# Print the CALL_FUNCS_TO_COLLECT_FFDC macro to hwp_error_info.H
#----------------------------------------------------------------------
- print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC) ";
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC)";
- # For now, this code is removed. It appears to work just fine but
- # will require more of the fapi2 infrastructure to be in place.
- # Because the ffdc collection classes create members with real types,
- # the declarations of the types need to be visible - and they're not
- # right now. When we get further along, we can enable this code.
+ my $collectFfdcStr = "";
$count = 0;
foreach my $collectFfdc (@{$err->{collectFfdc}})
{
if ($count == 0)
{
- print EIFILE "{ fapi2::ReturnCode l_tempRc; ";
+ #this rc wont be used, except to indicate the FFDC collection failed
+ $collectFfdcStr = "\tfapi2::ReturnCode l_rc; \\\n";
+ # each collect ffdc function needs to populate this so we can add it to i_rc;
+ $collectFfdcStr .= "\tstd::vector<std::shared_ptr<ErrorInfoFfdc>>ffdc; \\\n";
}
$count++;
- print EIFILE "FAPI_EXEC_HWP(l_tempRc, $collectFfdc, RC); ";
-
# collectFfdc is a string we're going to stuff into FAPI_EXEC_HWP
# but we need to create the arguments in the ffdc class. The first
- # element inthe collectFfdc string is the function to call.
+ # element in the collectFfdc string is the function to call.
my @elements = split /,/, $collectFfdc;
-# my @signature = @{$signatures{@elements[0]}};
-#
-# $TODO RTC:154303 for SBE errors we need to get the parameters from the FFDC_BUFFER passed
+ my @signature = @{$signatures{@elements[0]}};
+
+ # build up the function call here
+ @elements[0] =~ s/^\s+|\s+$//g;
+ $collectFfdc = "@elements[0]" .",ffdc";
for (my $i = 1; $i <= $#elements; $i++)
{
+ $collectFfdc .= ",";
+
+ # the parameters will be in the l_objects, unused, but need to be
+ # counted for the SBE implementation
+ my $parameter = "static_cast<void*>(&"."@elements[$i])";
+
+ # Add the parameter to the object list if it doesn't already exist
+ #
+ my $objNum = addEntryToArray(\@eiObjects, $parameter);
+
+ # add a set method for each parameter too..
@elements[$i] =~ s/^\s+|\s+$//g;
- addFfdcMethod(\%methods, @elements[$i], $err->{rc});
+ addFfdcMethod(\%methods, @elements[$i], $err->{rc}, @signature[$i-1],$objNum);
+
+ $collectFfdc .= "@elements[$i]"
+
}
- }
+ #reset the vector before calling the ffdc funciton - only needed if there are more than one
+ #collectFfdc calls
+ if($count > 1 )
+ {
+ $collectFfdcStr .= "\tffdc.clear(); \\\n";
+ }
+ $collectFfdcStr .= "\tFAPI_EXEC_HWP(l_rc, $collectFfdc); \\\n";
+ $collectFfdcStr .= "\tiv_rc.addErrorInfo(ffdc);";
+
+ print EIFILE "\\\n{ \\\n$collectFfdcStr \\\n}";
+ } #end collectFfdc tag
- if ($count > 0)
- {
- print EIFILE "}";
- }
print EIFILE "\n";
#----------------------------------------------------------------------
@@ -683,8 +735,6 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) ";
- # Array of EI Objects
- my @eiObjects;
my $eiEntryStr = "";
my $eiObjectMap = ""; #object names to buffer address mapping
@@ -1160,6 +1210,8 @@ foreach my $argnum (0 .. $#ARGV)
# Add all objects to $eiObjectStr
my $objCount = 0;
+ # add ordinary types to eiObjectStr here
+
foreach my $eiObject (@eiObjects)
{
if ($objCount > 0)
@@ -1173,7 +1225,17 @@ foreach my $argnum (0 .. $#ARGV)
if ((exists $err->{sbeError}) )
{
- $objectStr .= "\t\tfapi2::ffdc_t $eiObject = getFfdcData(FFDC_BUFFER[$objCount]); \\\n";
+ if((exists $methods{$objCount}{object}))
+ {
+ $objectStr .= "\t\t$methods{$objCount}{object} \\\n";
+
+ }
+
+ if((exists $methods{$objCount}{localvar}))
+ {
+ $objectStr .= "\t\t$methods{$objCount}{localvar} \\\n";
+ $objectStr .= "\t\t$methods{$objCount}{assignment_string} \\\n";
+ }
}
}
else
@@ -1183,6 +1245,8 @@ foreach my $argnum (0 .. $#ARGV)
$objCount++;
}
+
+
$eiObjectStr .= "};";
@@ -1225,7 +1289,7 @@ foreach my $argnum (0 .. $#ARGV)
print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err):\n";
print ECFILE " iv_rc(i_rc),\n";
print ECFILE " iv_sev(i_sev)\n";
- print ECFILE " { FAPI_ERR(\"$err->{description}\"); }\n";
+ print ECFILE " { FAPI_ERR(\"$err->{description}\"); }\n\n";
}
else
{
@@ -1255,48 +1319,49 @@ foreach my $argnum (0 .. $#ARGV)
if(!$arg_local_ffdc)
{
# add a method to adjust the severity if desired
- print ECFILE " inline void setSev(const fapi2::errlSeverity_t i_sev)\n";
+ print ECFILE "\tinline void setSev(const fapi2::errlSeverity_t i_sev)\n";
if ($arg_empty_ffdc eq undef)
{
- print ECFILE " { iv_sev = i_sev; };\n\n";
+ print ECFILE "\t\t\t{ iv_sev = i_sev;};\n\n";
}
else
{
- print ECFILE " { static_cast<void>(i_sev); };\n\n";
+ print ECFILE "\t\t\t{ static_cast<void>(i_sev);};\n\n";
}
# add a method to read the severity if desired
- print ECFILE " inline fapi2::errlSeverity_t getSev() const\n";
+ print ECFILE "\tinline fapi2::errlSeverity_t getSev() const\n";
if ($arg_empty_ffdc eq undef)
{
- print ECFILE " { return iv_sev; };\n\n";
+ print ECFILE "\t\t\t{ return iv_sev; };\n\n";
}
else
{
- print ECFILE " { return fapi2::FAPI2_ERRL_SEV_UNDEFINED; };\n\n";
+ print ECFILE "\t\t\t{ return fapi2::FAPI2_ERRL_SEV_UNDEFINED; };\n\n";
}
}
if( $arg_local_ffdc eq undef )
{
+
# Stick the execute method at the end of the other methods. We allow
# passing in of the severity so that macros which call execute() can over-ride
# the default severity.
- print ECFILE " void execute(fapi2::errlSeverity_t" .
- " i_sev = fapi2::FAPI2_ERRL_SEV_UNDEFINED," .
+ print ECFILE "\tvoid execute(fapi2::errlSeverity_t " .
+ "i_sev = fapi2::FAPI2_ERRL_SEV_UNDEFINED," .
"bool commit = false )\n";
if ($arg_empty_ffdc eq undef )
{
- print ECFILE " {\n";
- print ECFILE " FAPI_SET_HWP_ERROR(iv_rc, $err->{rc});\n";
- print ECFILE " if( commit )\n";
- print ECFILE " {\n";
- print ECFILE " fapi2::logError(iv_rc, " .
+ print ECFILE "\t\t{\n";
+ print ECFILE "\t\t\tFAPI_SET_HWP_ERROR(iv_rc,$err->{rc});\n\n";
+ print ECFILE "\t\t\tif( commit )\n";
+ print ECFILE "\t\t\t{\n";
+ print ECFILE "\t\t\t\tfapi2::logError(iv_rc, " .
"(i_sev == fapi2::FAPI2_ERRL_SEV_UNDEFINED)" .
" ? iv_sev : i_sev);\n";
- print ECFILE " }\n";
- print ECFILE " }\n";
+ print ECFILE "\t\t\t}\n";
+ print ECFILE "\t\t}\n";
}
else
@@ -1310,14 +1375,18 @@ foreach my $argnum (0 .. $#ARGV)
# Instance variables
if ($arg_empty_ffdc eq undef)
{
- print ECFILE " public:\n ";
+ print ECFILE "\tpublic:\n";
foreach my $key (keys %methods)
{
- print ECFILE $methods{$key}{member};
+ if( !($methods{$key}{member} eq undef) )
+ {
+ print ECFILE "\t\t$methods{$key}{member}\n";
+ }
+
}
- print ECFILE "fapi2::ReturnCode& iv_rc;\n";
- print ECFILE " fapi2::errlSeverity_t iv_sev;\n";
+ print ECFILE "\t\tfapi2::ReturnCode& iv_rc;\n";
+ print ECFILE "\t\tfapi2::errlSeverity_t iv_sev;\n";
}
}
@@ -1337,9 +1406,15 @@ foreach my $argnum (0 .. $#ARGV)
if (exists $err->{sbeError})
{
print SBFILE "\tcase fapi2::$err->{rc}: \\\n";
- print SBFILE "\t{ \\\n$objectStr";
- print SBFILE "\t\tFAPI_SET_HWP_ERROR(RC, $err->{rc});\\\n";
- print SBFILE " break; \\\n\t} \\\n";
+ print SBFILE "\t{\\\n\t\t$class_name l_obj(";
+ print SBFILE "fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,RC);\\\n";
+
+ if(!($objectStr eq undef ))
+ {
+ print SBFILE "$objectStr";
+ }
+ print SBFILE "\t\tl_obj.execute(); \\\n";
+ print SBFILE "\t\tbreak; \\\n\t} \\\n";
}
}
@@ -1391,7 +1466,6 @@ foreach my $argnum (0 .. $#ARGV)
print CRFILE " l_scomAddresses.push_back($scomRegister);\n";
print CRFILE " l_ffdcSize += sizeof(l_scomData);\n";
}
-=cut NEED_P9_REGISTERS
print CRFILE " break;\n";
}
OpenPOWER on IntegriCloud