diff options
author | Mike Jones <mjjones@us.ibm.com> | 2012-11-14 09:44:46 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-11-26 11:51:29 -0600 |
commit | b8c326b959a9f1bcb905397eecdc0ebfd0db5884 (patch) | |
tree | 2d45c44fc2a80eb0a73e36c3b27865657ab1f54c /src/usr | |
parent | 34fff20c4ebd6684e324b04fd5d2c3a7049ea09a (diff) | |
download | talos-hostboot-b8c326b959a9f1bcb905397eecdc0ebfd0db5884.tar.gz talos-hostboot-b8c326b959a9f1bcb905397eecdc0ebfd0db5884.zip |
HWPF: Add FAPI_SET_SBE_ERROR
When a function extracts an SBE error value, this macro is called which calls
FAPI_SET_HWP_ERROR with the correct error enumerator. This ensures that all
error actions specified in the Error Information XML file are performed. This
macro is generated at build time from the Error Information XML files.
Change-Id: If43dfc7fc2d904408e92d1d640f050e5025bde4b
RTC: 51583
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2333
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index 1b30df0c3..d6ff26259 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -51,6 +51,7 @@ # mjjones 09/19/12 Generate FFDC ID enumeration # Generate fapiCollectRegFfdc.C file # mjjones 10/23/12 Minor fix for Cronus compile failure +# mjjones 11/09/12 Generate fapiSetSbeError.H # # End Change Log ****************************************************** @@ -90,6 +91,7 @@ if ($numArgs < 2) 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"); + print (" - fapiSetSbeError.H. Macro to create an SBE error\n"); exit(1); } @@ -244,6 +246,11 @@ $crFile .= "/"; $crFile .= "fapiCollectRegFfdc.C"; open(CRFILE, ">", $crFile); +my $sbFile = $ARGV[0]; +$sbFile .= "/"; +$sbFile .= "fapiSetSbeError.H"; +open(SBFILE, ">", $sbFile); + #------------------------------------------------------------------------------ # Print start of file information to fapiHwpErrorInfo.H #------------------------------------------------------------------------------ @@ -286,6 +293,38 @@ print CRFILE " switch (i_ffdcId)\n"; print CRFILE " {\n"; #------------------------------------------------------------------------------ +# Print start of file information to fapiSetSbeError.H +#------------------------------------------------------------------------------ +print SBFILE "// fapiSetSbeError.H\n"; +print SBFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; +print SBFILE "// When SBE code creates an error, it produces an error value\n"; +print SBFILE "// that matches a value in the HwpReturnCode enum in\n"; +print SBFILE "// fapiHwpReturnCodes.H. The SBE uses the __ASSEMBLER__\n"; +print SBFILE "// primitives in fapiHwpReturnCodes.H to do this. The function\n"; +print SBFILE "// that extracts the error value from the SBE needs to call\n"; +print SBFILE "// FAPI_SET_HWP_ERROR to create the error and get all the\n"; +print SBFILE "// actions in the error XML file performed, but that macro can\n"; +print SBFILE "// only be called with the enumerator, not the value. This\n"; +print SBFILE "// FAPI_SET_SBE_ERROR macro can be called instead, it calls\n"; +print SBFILE "// FAPI_SET_HWP_ERROR with the correct error enumerator.\n"; +print SBFILE "// Errors containing <sbeError/> in their XML are supported\n"; +print SBFILE "// in this macro.\n\n"; +print SBFILE "// Note that it is expected that this macro will be called\n"; +print SBFILE "// in one place (the function that extracts the error from\n"; +print SBFILE "// the SBE), if this changes and it is called in multiple\n"; +print SBFILE "// places then the macro could be turned into a function to\n"; +print SBFILE "// avoid the code size increase of expanding the macro in\n"; +print SBFILE "// multiple places. The function approach is slightly more\n"; +print SBFILE "// complicated, there is an extra C file and the function\n"; +print SBFILE "// must take a parameter for the generic chip ID in the error\n"; +print SBFILE "// XML.\n\n"; +print SBFILE "#ifndef FAPISETSBEERROR_H_\n"; +print SBFILE "#define FAPISETSBEERROR_H_\n\n"; +print SBFILE "#define FAPI_SET_SBE_ERROR(RC, ERRVAL)\\\n"; +print SBFILE "switch (ERRVAL)\\\n"; +print SBFILE "{\\\n"; + +#------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ foreach my $argnum (1 .. $#ARGV) @@ -330,6 +369,16 @@ foreach my $argnum (1 .. $#ARGV) setErrorEnumValue($err->{rc}); #---------------------------------------------------------------------- + # If this is an SBE error, add it to fapiSetSbeError.H + #---------------------------------------------------------------------- + if (exists $err->{sbeError}) + { + print SBFILE " case fapi::$err->{rc}:\\\n"; + print SBFILE " FAPI_SET_HWP_ERROR(RC, $err->{rc});\\\n"; + print SBFILE " break;\\\n"; + } + + #---------------------------------------------------------------------- # Print the CALL_FUNCS_TO_COLLECT_FFDC macro to fapiHwpErrorInfo.H #---------------------------------------------------------------------- print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC) "; @@ -362,7 +411,7 @@ foreach my $argnum (1 .. $#ARGV) { #------------------------------------------------------------------ # Check that expected fields are present - #---------------------------------------------------------------------- + #------------------------------------------------------------------ if (! exists $collectRegisterFfdc->{id}) { print ("fapiParseErrorInfo.pl ERROR. id missing from collectRegisterFfdc\n"); @@ -671,16 +720,25 @@ foreach my $key (keys %ffdcNameToValueHash) print EIFILE "};\n\n"; print EIFILE "}\n\n"; - #------------------------------------------------------------------------------ # Print end of file information to fapiHwpErrorInfo.H #------------------------------------------------------------------------------ print EIFILE "\n\n#endif\n"; #------------------------------------------------------------------------------ +# Print end of file information to fapiSetSbeError.H +#------------------------------------------------------------------------------ +print SBFILE " default:\\\n"; +print SBFILE " RC.setFapiError(fapi::FAPI_RC_UNRECOGNIZED_SBE_ERROR);\\\n"; +print SBFILE " RC.addEIFfdc(0, &ERRVAL, sizeof(ERRVAL));\\\n"; +print SBFILE " break;\\\n"; +print SBFILE "}\n\n"; +print SBFILE "#endif\n"; + +#------------------------------------------------------------------------------ # Close output files #------------------------------------------------------------------------------ close(RCFILE); close(EIFILE); close(CRFILE); - +close(SBFILE); |