Skip to content

Commit

Permalink
Update set_sbe_error macro exceeds line length
Browse files Browse the repository at this point in the history
    -Undate macro to call a function for each RC value instead
     of inlining of all FFDC collection
    -Update parseErrorInfo.pl script to generate a new file which
     contains functions for use in new macro layout

Change-Id: I40a02fef07b3618b137a8e0c2bfa10c9756da600
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46719
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+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: ARAVIND T. NAIR <aravindnair@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46722
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
rjknight authored and dcrowell77 committed Oct 3, 2017
1 parent 5ae9e8b commit cf8e670
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/import/hwpf/fapi2/include/fapi2.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -39,7 +39,6 @@

// In turn includes the needed generated headers (hwp_ffd_classes, etc.)
#include <error_scope.H>
#include <set_sbe_error.H> // Generated file

#include <fapi2_hwp_executor.H>
#include <fapi2_attribute_service.H>
Expand Down
1 change: 1 addition & 0 deletions src/import/hwpf/fapi2/tools/parseErrorInfo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TARGETS += hwp_return_codes.H
TARGETS += hwp_error_info.H
TARGETS += hwp_ffdc_classes.H
TARGETS += set_sbe_error.H
TARGETS += set_sbe_error_funcs.H
TARGETS += collect_reg_ffdc_regs.C

CLEAN_TARGETS += $(GENPATH)/hwp_return_codes.H
Expand Down
73 changes: 54 additions & 19 deletions src/import/hwpf/fapi2/tools/parseErrorInfo.pl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ sub addFfdcMethod
$method_body .= " fapi2::getErrorInfoFfdcSize(i_value);\n return *this;\n }\n\n";
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
$methods->{$objectNumber}{localvar} =
"$ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber],invalid_data);";
"$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);";
$methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
}
else
Expand Down Expand Up @@ -336,7 +336,7 @@ sub addFfdcMethod
$method_body .= " }\n\n";
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
$methods->{$objectNumber}{localvar} =
"$buffer_ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber],invalid_data);";
"$buffer_ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);";
$methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
}

Expand Down Expand Up @@ -373,7 +373,7 @@ sub addFfdcMethod

$methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
$methods->{$objectNumber}{localvar} =
"$ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber],invalid_data);";
"$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);";
$methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc=$ffdc_uc;";
}
elsif ( $type eq $scom_addr_type )
Expand All @@ -394,7 +394,7 @@ sub addFfdcMethod
$method_body .= " return *this;}\n\n";
$methods->{$key}{member} = "$type $ffdc_uc;";
$methods->{$objectNumber}{localvar} =
"$type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber],invalid_data);";
"$type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);";
$methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
}
else
Expand Down Expand Up @@ -447,6 +447,11 @@ sub addFfdcMethod
$sbFile .= "set_sbe_error.H";
open( SBFILE, ">", $sbFile );

my $sbFuncFile = $arg_output_dir;
$sbFuncFile .= "/";
$sbFuncFile .= "set_sbe_error_funcs.H";
open( SBFUNFILE, ">", $sbFuncFile );

#------------------------------------------------------------------------------
# Print start of file information to hwp_error_info.H
#------------------------------------------------------------------------------
Expand All @@ -458,7 +463,6 @@ sub addFfdcMethod
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";
Expand Down Expand Up @@ -551,12 +555,26 @@ sub addFfdcMethod
print SBFILE "// XML.\n\n";
print SBFILE "#ifndef FAPI2_SETSBEERROR_H_\n";
print SBFILE "#define FAPI2_SETSBEERROR_H_\n\n";
print SBFILE "#include <set_sbe_error_funcs.H>\n\n";
print SBFILE "#define FAPI_SET_SBE_ERROR(RC,ERRVAL,FFDC_BUFFER,SBE_INSTANCE)\\\n";
print SBFILE "{\\\n";
print SBFILE "bool invalid_data = false;\\\n";
print SBFILE "switch (ERRVAL)\\\n";
print SBFILE "{\\\n";

print SBFUNFILE "#ifndef FAPI2_SETSBEERRORFUNCS_H_\n";
print SBFUNFILE "#define FAPI2_SETSBEERRORFUNCS_H_\n\n";
print SBFUNFILE "#include <hwp_return_codes.H>\n\n";
print SBFUNFILE "#include <hwp_ffdc_classes.H>\n\n";
print SBFUNFILE "#include <hwp_error_info.H>\n\n";

#print SBFUNFILE "namespace fapi2 {\n\n";
# used to convert each HwpReturnCode into a unique tupe
print SBFUNFILE "template<fapi2::HwpReturnCode T>\n";
print SBFUNFILE "struct hwpRcToType {\n";
print SBFUNFILE " enum { value = T };\n";
print SBFUNFILE "};\n";

#------------------------------------------------------------------------------
# For each XML file
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -1400,14 +1418,14 @@ sub addFfdcMethod

if ( ( exists $methods{$objCount}{object} ) )
{
$objectStr .= " $methods{$objCount}{object} \\\n";
$objectStr .= " $methods{$objCount}{object}\n";

}

if ( ( exists $methods{$objCount}{localvar} ) )
{
$objectStr .= " $methods{$objCount}{localvar} \\\n";
$objectStr .= " $methods{$objCount}{assignment_string} \\\n";
$objectStr .= " $methods{$objCount}{localvar}\n";
$objectStr .= " $methods{$objCount}{assignment_string}\n";
}
}
}
Expand All @@ -1427,10 +1445,10 @@ sub addFfdcMethod
if ( exists $errors->{sbeTarget} && ( $arg_local_ffdc eq undef ) )
{
$objectStr .= " fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>$errors->{sbeTarget}"
. " = fapi2::getTarget<fapi2::TARGET_TYPE_PROC_CHIP>(SBE_INSTANCE); \\\n";
$objectStr .= " l_obj.$errors->{sbeTarget}.ptr() = &$errors->{sbeTarget}; \\\n";
. " = fapi2::getTarget<fapi2::TARGET_TYPE_PROC_CHIP>(proc_instance); \n";
$objectStr .= " l_obj.$errors->{sbeTarget}.ptr() = &$errors->{sbeTarget};\n";
$objectStr .=
" l_obj.$errors->{sbeTarget}.size() = fapi2::getErrorInfoFfdcSize($errors->{sbeTarget}); \\\n";
" l_obj.$errors->{sbeTarget}.size() = fapi2::getErrorInfoFfdcSize($errors->{sbeTarget});\n";
}

$eiObjectStr .= "};";
Expand Down Expand Up @@ -1609,18 +1627,31 @@ sub addFfdcMethod
if ( exists $err->{sbeError} )
{
print SBFILE " case fapi2::$err->{rc}: \\\n";
print SBFILE " { \\\n fapi2::$class_name l_obj(";
print SBFILE "fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,RC);\\\n";
print SBFILE " { \\\n";
print SBFILE " invalid_data = setSbeError(hwpRcToType<fapi2::$err->{rc}>(),\\\n";
print SBFILE " RC,FFDC_BUFFER,SBE_INSTANCE);\\\n";

print SBFILE " break;\\\n }\\\n";

# update the sbe set error functions file with the new template function
# create a unique overloaded function for the return code value
print SBFUNFILE "inline bool setSbeError(hwpRcToType<fapi2::$err->{rc}>,fapi2::ReturnCode&i_rc,\n";
print SBFUNFILE " fapi2::sbeFfdc_t* i_ebuf,uint8_t proc_instance)\n";
print SBFUNFILE " {\n bool invalid_data = false;\n";
print SBFUNFILE " fapi2::$class_name l_obj(";
print SBFUNFILE "fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,i_rc);\n";

if ( !( $objectStr eq undef ) )
{
print SBFILE "$objectStr";
print SBFUNFILE "$objectStr";
}
print SBFILE " if(!invalid_data) \\\n";
print SBFILE " { \\\n";
print SBFILE " l_obj.execute(); \\\n";
print SBFILE " } \\\n";
print SBFILE " break; \\\n } \\\n";
print SBFUNFILE " if(!invalid_data)\n";
print SBFUNFILE " {\n";
print SBFUNFILE " l_obj.execute();\n";
print SBFUNFILE " }\n";
print SBFUNFILE " return invalid_data;\n";
print SBFUNFILE " }\n";

}

} #for each hwpError tag
Expand Down Expand Up @@ -1775,6 +1806,9 @@ sub addFfdcMethod
print SBFILE "}\n\n";
print SBFILE "#endif\n";

#print SBFUNFILE "}\n";
print SBFUNFILE "#endif\n";

#------------------------------------------------------------------------------
# Close output files
#------------------------------------------------------------------------------
Expand All @@ -1783,3 +1817,4 @@ sub addFfdcMethod
close(ECFILE);
close(CRFILE);
close(SBFILE);
close(SBFUNFILE);
1 change: 1 addition & 0 deletions src/usr/sbeio/sbe_fifodd.C
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <initservice/initserviceif.H>
#include <kernel/pagemgr.H>
#include <fapi2.H>
#include <set_sbe_error.H>
#include <sbeio/sbe_sp_intf.H>
#include <xscom/piberror.H>

Expand Down

0 comments on commit cf8e670

Please sign in to comment.