summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf/fapi2
diff options
context:
space:
mode:
authorBrian Silver <bsilver@us.ibm.com>2015-03-16 07:57:37 -0500
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 13:40:20 -0600
commit3e1eb47ac126fc9a0c7e36b57fd85b414e14d21d (patch)
tree5f206f5d91c5735238af2b114eed7ef7ec8601a7 /src/import/hwpf/fapi2
parent3bb48d75411345dc6f01ed5b19c632c90702d463 (diff)
downloadblackbird-hostboot-3e1eb47ac126fc9a0c7e36b57fd85b414e14d21d.tar.gz
blackbird-hostboot-3e1eb47ac126fc9a0c7e36b57fd85b414e14d21d.zip
FFDC class generation changes for caps, errors
Change from lower-case to upper Fix method chaining for empty classes -Wall changes Rearrange headers to need only error_scope.H Change-Id: I034fd84d05f53f36079b2b50b4ab338bf8d5bdb9 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16437 Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com> Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: Brian Silver <bsilver@us.ibm.com> Tested-by: Brian Silver <bsilver@us.ibm.com>
Diffstat (limited to 'src/import/hwpf/fapi2')
-rw-r--r--src/import/hwpf/fapi2/include/buffer_traits.H4
-rw-r--r--src/import/hwpf/fapi2/include/error_scope.H1
-rw-r--r--src/import/hwpf/fapi2/src/error_info.C8
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/parseErrorInfo.pl72
4 files changed, 52 insertions, 33 deletions
diff --git a/src/import/hwpf/fapi2/include/buffer_traits.H b/src/import/hwpf/fapi2/include/buffer_traits.H
index cf4df1bea..b016d3850 100644
--- a/src/import/hwpf/fapi2/include/buffer_traits.H
+++ b/src/import/hwpf/fapi2/include/buffer_traits.H
@@ -86,8 +86,8 @@ namespace fapi2
constexpr static B size(const T& i_buffer)
{
return (bit_length(i_buffer) +
- (parameterTraits<E>::bit_length - 1)) /
- parameterTraits<E>::bit_length;
+ (parameterTraits<E>::bit_length() - 1)) /
+ parameterTraits<E>::bit_length();
}
///
diff --git a/src/import/hwpf/fapi2/include/error_scope.H b/src/import/hwpf/fapi2/include/error_scope.H
index d510c6de9..e6e2a5085 100644
--- a/src/import/hwpf/fapi2/include/error_scope.H
+++ b/src/import/hwpf/fapi2/include/error_scope.H
@@ -34,6 +34,7 @@
#include <thread>
#include <stdio.h>
#include <return_code.H>
+#include <hwp_ffdc_classes.H>
/// @cond
#define FAPI_VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N
diff --git a/src/import/hwpf/fapi2/src/error_info.C b/src/import/hwpf/fapi2/src/error_info.C
index b4e350292..9d44eb58b 100644
--- a/src/import/hwpf/fapi2/src/error_info.C
+++ b/src/import/hwpf/fapi2/src/error_info.C
@@ -118,9 +118,9 @@ namespace fapi2
const CalloutPriorities::CalloutPriority i_priority):
iv_target(i_target),
iv_callout(i_callout),
+ iv_calloutPriority(i_priority),
iv_deconfigure(i_deconfigure),
- iv_gard(i_gard),
- iv_calloutPriority(i_priority)
+ iv_gard(i_gard)
{}
///
@@ -271,7 +271,7 @@ namespace fapi2
///
void ErrorInfoEntryProcCallout::addErrorInfo(
std::shared_ptr<ErrorInfo> i_info,
- const void* const* i_object) const
+ const void* const* ) const
{
ErrorInfoProcedureCallout* ei = new ErrorInfoProcedureCallout(
static_cast<ProcedureCallouts::ProcedureCallout>(iv_procedure),
@@ -396,7 +396,7 @@ namespace fapi2
///
void ErrorInfoEntryCollectTrace::addErrorInfo(
std::shared_ptr<ErrorInfo> i_info,
- const void* const* i_object) const
+ const void* const* ) const
{
ErrorInfoCollectTrace* ei = new ErrorInfoCollectTrace(
static_cast<CollectTraces::CollectTrace>(iv_eieTraceId));
diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
index 1e3dcbba0..f4a0107b4 100755
--- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
+++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
@@ -250,7 +250,9 @@ sub addFfdcMethod
my $ffdc_uc = shift;
my $class_name = shift;
my $type = shift;
- my $ffdc_lc = lc($ffdc_uc);
+
+ # Remove the leading *_
+ $class_name = (split (/_/, $class_name, 2))[1];
# If we didn't get a type passed in, this element will get an ffdc_t pair.
$type = $ffdc_type if ($type eq undef);
@@ -258,9 +260,9 @@ sub addFfdcMethod
# Mangle the uppercase name if needed
$ffdc_uc = $mangle_names{$ffdc_uc} if ($mangle_names{$ffdc_uc} ne undef);
- my $key = $ffdc_lc.$type;
- my $key_target = $ffdc_lc.$target_ffdc_type;
- my $key_ffdc = $ffdc_lc.$ffdc_type;
+ my $key = $ffdc_uc.$type;
+ my $key_target = $ffdc_uc.$target_ffdc_type;
+ my $key_ffdc = $ffdc_uc.$ffdc_type;
# Check to see if this element already has been recorded with this
# type or a target type. Note the effect we're shooting for here is
@@ -280,10 +282,13 @@ sub addFfdcMethod
my $method = "";
my $method_body = "";
+ # If we're generating empty classes, not using an argument name will avoid the unused parameter warnings
+ my $param = ($arg_empty_ffdc eq undef) ? "i_value" : "";
+
if ($type eq $ffdc_type)
{
$method = "\n template< typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr >\n";
- $method .= " $class_name& set_$ffdc_lc(const T& i_value)\n";
+ $method .= " $class_name& set_$ffdc_uc(const T& $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 ";
@@ -293,7 +298,7 @@ sub addFfdcMethod
{
# Two methods - one for integral buffers and one for variable_buffers
$method = "\n template< typename T >\n";
- $method .= " $class_name& set_$ffdc_lc(const fapi2::buffer<T>& i_value)\n";
+ $method .= " $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 ";
@@ -301,7 +306,7 @@ sub addFfdcMethod
elsif ($type eq $variable_buffer_ffdc_type)
{
- $method = "\n $class_name& set_$ffdc_lc(const fapi2::variable_buffer& i_value)\n";
+ $method = "\n $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
$method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
# No need to add the member here, it was added with fapi2::buffer. And we can't have variable
@@ -310,13 +315,13 @@ sub addFfdcMethod
else
{
- $method = "\n $class_name& set_$ffdc_lc(const $type& i_value)\n";
+ $method = "\n $class_name& set_$ffdc_uc(const $type& $param)\n";
$method_body .= " {$ffdc_uc = &i_value; return *this;}\n\n";
$methods->{$key}{member} = "const $type* $ffdc_uc;\n ";
}
- $method .= ($arg_empty_ffdc eq undef) ? $method_body : " {}\n\n";
+ $method .= ($arg_empty_ffdc eq undef) ? $method_body : " {return *this;}\n\n";
$methods->{$key}{method} = $method;
}
@@ -356,8 +361,9 @@ print EIFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n
print EIFILE "#ifndef FAPI2_HWPERRORINFO_H_\n";
print EIFILE "#define FAPI2_HWPERRORINFO_H_\n\n";
print EIFILE "#include <target.H>\n";
-print EIFILE "#include <return_code.H>\n";
print EIFILE "#include <plat_trace.H>\n";
+print EIFILE "#include <hwp_return_codes.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";
@@ -416,7 +422,15 @@ 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";
-
+print CRFILE " // void statments for the unused variables\n";
+print CRFILE " static_cast<void>(l_cfamData);\n";
+print CRFILE " static_cast<void>(l_scomData);\n";
+print CRFILE " static_cast<void>(l_ffdcSize);\n";
+print CRFILE " static_cast<const void>(i_target);\n";
+print CRFILE " static_cast<void>(o_rc);\n";
+print CRFILE " static_cast<void>(i_child);\n";
+print CRFILE " static_cast<void>(i_presChild);\n";
+print CRFILE " static_cast<void>(i_childOffsetMult);\n";
#------------------------------------------------------------------------------
# Print start of file information to setSbeError.H
#------------------------------------------------------------------------------
@@ -548,7 +562,7 @@ foreach my $argnum (0 .. $#ARGV)
for (my $i = 1; $i <= $#elements; $i++)
{
@elements[$i] =~ s/^\s+|\s+$//g;
- addFfdcMethod(\%methods, @elements[$i], lc($err->{rc}), @signature[$i-1]);
+ addFfdcMethod(\%methods, @elements[$i], $err->{rc}, @signature[$i-1]);
}
}
@@ -584,7 +598,7 @@ foreach my $argnum (0 .. $#ARGV)
print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{target}, ";
print EIFILE "fapi2::$id, RC, fapi2::TARGET_TYPE_NONE, fapi2::TARGET_TYPE_NONE); ";
addFfdcMethod(\%methods, $collectRegisterFfdc->{target},
- lc($err->{rc}), $target_ffdc_type);
+ $err->{rc}, $target_ffdc_type);
}
elsif (exists $collectRegisterFfdc->{childTargets})
{
@@ -601,7 +615,7 @@ foreach my $argnum (0 .. $#ARGV)
print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{childTargets}->{parent}, fapi2::$id, ";
print EIFILE "RC, fapi2::$collectRegisterFfdc->{childTargets}->{childType}, fapi2::TARGET_TYPE_NONE); ";
addFfdcMethod(\%methods, $collectRegisterFfdc->{childTargets}->{parent},
- lc($err->{rc}), $target_ffdc_type);
+ $err->{rc}, $target_ffdc_type);
}
elsif (exists $collectRegisterFfdc->{basedOnPresentChildren})
{
@@ -624,7 +638,7 @@ foreach my $argnum (0 .. $#ARGV)
print EIFILE "fapi2::TARGET_TYPE_NONE, fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, ";
print EIFILE "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier}); ";
addFfdcMethod(\%methods, $collectRegisterFfdc->{basedOnPresentChildren}->{target},
- lc($err->{rc}), $target_ffdc_type);
+ $err->{rc}, $target_ffdc_type);
}
else
{
@@ -671,7 +685,7 @@ foreach my $argnum (0 .. $#ARGV)
my $objNum = addEntryToArray(\@eiObjects, $ffdc);
# Add a method to the ffdc-gathering class
- addFfdcMethod(\%methods, $ffdc, lc($err->{rc}));
+ addFfdcMethod(\%methods, $ffdc, $err->{rc});
# Add an EI entry to eiEntryStr
$eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
@@ -693,8 +707,8 @@ foreach my $argnum (0 .. $#ARGV)
my $objNum = addEntryToArray(\@eiObjects, $buffer);
# Add a method to the ffdc-gathering class - one for each buffer type
- addFfdcMethod(\%methods, $buffer, lc($err->{rc}), $buffer_ffdc_type);
- addFfdcMethod(\%methods, $buffer, lc($err->{rc}), $variable_buffer_ffdc_type);
+ addFfdcMethod(\%methods, $buffer, $err->{rc}, $buffer_ffdc_type);
+ addFfdcMethod(\%methods, $buffer, $err->{rc}, $variable_buffer_ffdc_type);
# Add an EI entry to eiEntryStr
$eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
@@ -747,7 +761,7 @@ foreach my $argnum (0 .. $#ARGV)
$eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n";
# Add a method to the ffdc-gathering class
- addFfdcMethod(\%methods, $callout->{hw}->{refTarget}, lc($err->{rc}));
+ addFfdcMethod(\%methods, $callout->{hw}->{refTarget}, $err->{rc});
}
else
{
@@ -788,8 +802,8 @@ foreach my $argnum (0 .. $#ARGV)
my $objNum2 = addEntryToArray(\@eiObjects, $targets[1]);
# Add a method to the ffdc-gathering class
- addFfdcMethod(\%methods, $targets[0], lc($err->{rc}), $target_ffdc_type);
- addFfdcMethod(\%methods, $targets[1], lc($err->{rc}), $target_ffdc_type);
+ addFfdcMethod(\%methods, $targets[0], $err->{rc}, $target_ffdc_type);
+ addFfdcMethod(\%methods, $targets[1], $err->{rc}, $target_ffdc_type);
# Add an EI entry to eiEntryStr
$eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_BUS_CALLOUT; \\\n";
@@ -1010,7 +1024,7 @@ foreach my $argnum (0 .. $#ARGV)
my $objNum = addEntryToArray(\@eiObjects, $cdg);
# Add a method to the ffdc-gathering class
- addFfdcMethod(\%methods, $cdg, lc($err->{rc}), $target_ffdc_type);
+ addFfdcMethod(\%methods, $cdg, $err->{rc}, $target_ffdc_type);
# Add an EI entry to eiEntryStr
$eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CDG; \\\n";
@@ -1054,13 +1068,13 @@ foreach my $argnum (0 .. $#ARGV)
{
$childPort =
$cdgChildHash{$parent}->{$childType}->{childPort} ;
- addFfdcMethod(\%methods, $childPort, lc($err->{rc}));
+ addFfdcMethod(\%methods, $childPort, $err->{rc});
}
if (exists $cdgChildHash{$parent}->{$childType}->{childNumber})
{
$childNumber =
$cdgChildHash{$parent}->{$childType}->{childNumber} ;
- addFfdcMethod(\%methods, $childNumber, lc($err->{rc}));
+ addFfdcMethod(\%methods, $childNumber, $err->{rc});
}
if (exists $cdgChildHash{$parent}->{$childType}->{gard})
{
@@ -1070,7 +1084,7 @@ foreach my $argnum (0 .. $#ARGV)
# Add the Target to the objectlist if it doesn't already exist
my $objNum = addEntryToArray(\@eiObjects, $parent);
- addFfdcMethod(\%methods, $parent, lc($err->{rc}), $target_ffdc_type);
+ addFfdcMethod(\%methods, $parent, $err->{rc}, $target_ffdc_type);
# Add an EI entry to eiEntryStr
$eiEntryStr .=
@@ -1140,7 +1154,10 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
# Print the return code class to hwp_error_info.H
#----------------------------------------------------------------------
- my $class_name = lc($err->{rc});
+ my $class_name = $err->{rc};
+ # Remove everything upto and including the first _. This makes the ffdc class
+ # names different from the error code value enum names.
+ $class_name = (split (/_/, $class_name, 2))[1];
# Class declaration
print ECFILE "\nclass $class_name\n{\n public:\n";
@@ -1156,8 +1173,9 @@ foreach my $argnum (0 .. $#ARGV)
}
else
{
+ # Void expression keeps the compiler from complaining about the unused arguments.
print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err)\n";
- print ECFILE " {}\n";
+ print ECFILE " {static_cast<void>(i_sev); static_cast<void>(i_rc);}\n";
}
# Methods
OpenPOWER on IntegriCloud