diff options
Diffstat (limited to 'src/usr/hwpf')
| -rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 1 | ||||
| -rw-r--r-- | src/usr/hwpf/hwp/fapiHwpErrorInfo.xml | 8 | ||||
| -rwxr-xr-x | src/usr/hwpf/hwp/fapiTestHwpAttr.C | 31 | ||||
| -rw-r--r-- | src/usr/hwpf/makefile | 9 | ||||
| -rwxr-xr-x | src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl | 161 | ||||
| -rw-r--r-- | src/usr/hwpf/plat/fapiPlatHwpInvoker.C | 57 | 
6 files changed, 224 insertions, 43 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 34d08ef54..2d7051b5e 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -341,6 +341,7 @@ print AIFILE "#endif\n";  print ASFILE "    else\n";  print ASFILE "    {\n";  print ASFILE "        FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n"; +print ASFILE "        ReturnCodeFfdc::addEIFfdc(l_rc, static_cast<uint32_t>(i_id));";  print ASFILE "        l_rc = FAPI_RC_INVALID_ATTR_GET;\n";  print ASFILE "    }\n\n";  print ASFILE "    if (l_rc)\n"; diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml index df40e1010..817d06c34 100644 --- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml +++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml @@ -27,7 +27,7 @@    <!-- *********************************************************************** -->    <hwpError>      <rc>RC_TEST_ERROR_A</rc> -    <description>Test Error A</description> +    <description>HWP Unit Test expected error A</description>      <!-- Call hwpTestFfdc1 to collect FFDC from the master chip -->      <collectFfdc>hwpTestFfdc1, MASTER_CHIP</collectFfdc>      <!-- Collect local FFDC FFDC_DATA_1 --> @@ -49,7 +49,7 @@    <!-- *********************************************************************** -->    <hwpError>      <rc>RC_TEST_ERROR_B</rc> -    <description>Test Error B</description> +    <description>HWP Unit Test expected error B</description>      <!-- Call hwpTestAnalyzeError on MASTER_CHIP to analyze the error -->      <callFunc>hwpTestAnalyzeError, MASTER_CHIP</callFunc>    </hwpError> @@ -77,4 +77,8 @@      <rc>RC_HWP_EXEC_INITFILE_TEST_FAILED</rc>      <description>HWP Exec InitFile test case failed </description>    </hwpError> +  <hwpError> +    <rc>RC_HWP_ATTR_UNIT_TEST_FAIL</rc> +    <description>HWP Attribute Unit Test failed</description> +  </hwpError>  </hwpErrors> diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C index 03a0f9f1e..1fae73b75 100755 --- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C +++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C @@ -38,6 +38,7 @@   *                          mjjones     10/15/2011  Test scratch attributes   *                          mjjones     10/17/2011  Update scratch test   *                          camvanng    10/26/2011  Update scratch test + *                          mjjones     10/28/2011  Fix error generation   */  #include <fapiTestHwpAttr.H> @@ -83,7 +84,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint8 != 7)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. GET returned %d",                       l_uint8);              break; @@ -125,7 +126,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint8 != 6)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_2. GET returned %d",                       l_uint8);              break; @@ -167,7 +168,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint32 != 5)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. GET returned %d",                       l_uint32);              break; @@ -209,7 +210,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint32 != 4)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_2. GET returned %d",                       l_uint32);              break; @@ -251,7 +252,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint64 != 3)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. GET returned %d",                       static_cast<uint32_t>(l_uint64));              break; @@ -293,7 +294,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint64 != 2)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_2. GET returned %d",                       static_cast<uint32_t>(l_uint64));              break; @@ -346,7 +347,7 @@ fapi::ReturnCode hwpTestAttributes()          {              if (l_uint8array1[i] != (i + 1))              { -                l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                  FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_1. GET [%d] returned %d",                            i, l_uint8array1[i]);                  break; @@ -428,7 +429,7 @@ fapi::ReturnCode hwpTestAttributes()                  {                      if (l_uint8array2[i][j][k] != l_uint8++)                      { -                        l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                        FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                          FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. GET [%d:%d:%d] returned %d",                                   i, j, k, l_uint8array2[i][j][k]);                          break; @@ -507,7 +508,7 @@ fapi::ReturnCode hwpTestAttributes()          {              if (l_uint32array1[i] != (i + 1))              { -                l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                  FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_1. GET [%d] returned %d",                            i, l_uint32array1[i]);                  break; @@ -581,7 +582,7 @@ fapi::ReturnCode hwpTestAttributes()              {                  if (l_uint32array2[i][j] != l_uint32++)                  { -                    l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                    FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                      FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_2. GET [%d:%d] returned %d",                               i, j, l_uint32array2[i][j]);                      break; @@ -652,7 +653,7 @@ fapi::ReturnCode hwpTestAttributes()          {              if (l_uint64array1[i] != (i + 1))              { -                l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                  FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_1. GET [%d] returned %d",                            i, static_cast<uint32_t>(l_uint64array1[i]));                  break; @@ -726,7 +727,7 @@ fapi::ReturnCode hwpTestAttributes()              {                  if (l_uint64array2[i][j] != l_uint64++)                  { -                    l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                    FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                      FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_2. GET [%d:%d] returned %d",                               i, j, static_cast<uint32_t>(l_uint64array2[i][j]));                      break; @@ -786,7 +787,7 @@ fapi::ReturnCode hwpTestAttributes()          // Check value          if (l_uint64 != fapi::ATTR_SCRATCH_UINT64_2_VAL_C)          { -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_2. GET returned %d (enum)",                       static_cast<uint32_t>(l_uint64));              break; @@ -835,7 +836,7 @@ fapi::ReturnCode hwpTestAttributes()              if (l_val != 0)              { -                l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; +                FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);                  FAPI_ERR("hwpTestAttributes: ID: %d. Get returned %d",                           l_ids[i], static_cast<uint32_t>(l_val));                  break; @@ -863,8 +864,8 @@ fapi::ReturnCode hwpTestAttributes()          }          else          { +            FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL);              FAPI_ERR("hwpTestAttributes: Did not get error from fapiGetInitFileAttr"); -            l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;              break;          } diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile index 1842daae7..7749368ec 100644 --- a/src/usr/hwpf/makefile +++ b/src/usr/hwpf/makefile @@ -25,7 +25,9 @@ MODULE = hwpf  FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiHwpErrorInfo.H  FAPI_ATTR_TARGETS = fapiAttributeIds.H fapiAttributeService.C -GENFILES = ${FAPI_ERROR_TARGETS} ${FAPI_ATTR_TARGETS} +FAPI_HWP_ERROR_TAGS = fapiHwpReasonCodes.H + +GENFILES = ${FAPI_ERROR_TARGETS} ${FAPI_ATTR_TARGETS} ${FAPI_HWP_ERROR_TAGS}  SUBDIRS = fapi.d hwp.d plat.d test.d @@ -40,3 +42,8 @@ $(call GENTARGET, $(FAPI_ERROR_TARGETS)) : \  $(call GENTARGET, $(FAPI_ATTR_TARGETS)) : \  	    fapi/fapiParseAttributeInfo.pl hwp/fapiHwpAttributeInfo.xml   	$< $(dir $@) $(filter-out $<,$^) + +$(call GENTARGET, $(FAPI_HWP_ERROR_TAGS)) : \ +		plat/fapiCreateHwpErrorTags.pl hwp/fapiHwpErrorInfo.xml +	$< $(dir $@) $(filter-out $<,$^) + diff --git a/src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl b/src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl new file mode 100755 index 000000000..572d7360e --- /dev/null +++ b/src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl @@ -0,0 +1,161 @@ +#!/usr/bin/perl +#  IBM_PROLOG_BEGIN_TAG +#  This is an automatically generated prolog. +# +#  $Source: src/usr/hwpf/plat/fapiCreateHwpErrorTags.pl $ +# +#  IBM CONFIDENTIAL +# +#  COPYRIGHT International Business Machines Corp. 2011 +# +#  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 + +# +# Purpose:  This perl script will parse HWP Error XML files and create required +#           HostBoot ReasonCodes and Error Log Tags. It creates file +#           fapiHwpReasonCodes.H: +# +# Author: Mike Jones +# + +use strict; + +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +if ($numArgs < 2) +{ +    print ("Usage: fapiCreateHwpErrorTags.pl <output dir> <filename1> <filename2> ...\n"); +    print ("  This perl script will parse HWP Error XML files and create\n"); +    print ("  required HostBoot ReasonCodes and Error Log tags\n"); +    exit(1); +} + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use XML::Simple; +my $xml = new XML::Simple (KeyAttr=>[]); + +# Uncomment to enable debug output +#use Data::Dumper; + +#------------------------------------------------------------------------------ +# Open output files for writing +#------------------------------------------------------------------------------ +my $rcFile = $ARGV[0]; +$rcFile .= "/"; +$rcFile .= "fapiHwpReasonCodes.H"; +open(TGFILE, ">", $rcFile); + +#------------------------------------------------------------------------------ +# Print start of file information +#------------------------------------------------------------------------------ +print TGFILE "// fapiHwpReasonCodes.H\n"; +print TGFILE "// This file is generated by perl script fapiCreateHwpErrorTags.pl\n\n"; +print TGFILE "#ifndef FAPIHWPREASONCODES_H_\n"; +print TGFILE "#define FAPIHWPREASONCODES_H_\n\n"; +print TGFILE "#include <fapiHwpReturnCodes.H>\n\n"; +print TGFILE "namespace fapi\n"; +print TGFILE "{\n\n"; +print TGFILE "enum hwpReasonCode\n"; +print TGFILE "{\n"; + +#------------------------------------------------------------------------------ +# For each XML file +#------------------------------------------------------------------------------ +foreach my $argnum (1 .. $#ARGV) +{ +    #-------------------------------------------------------------------------- +    # Read XML file +    #-------------------------------------------------------------------------- +    my $infile = $ARGV[$argnum]; +    my $errors = $xml->XMLin($infile); + +    # Uncomment to get debug output of all errors +    #print "\nFile: ", $infile, "\n", Dumper($errors), "\n"; + +    #-------------------------------------------------------------------------- +    # For each Error +    #-------------------------------------------------------------------------- +    foreach my $err (@{$errors->{hwpError}}) +    { +        #---------------------------------------------------------------------- +        # Check that expected fields are present +        #---------------------------------------------------------------------- +        if (! exists $err->{rc}) +        { +            print ("fapiParseErrorInfo.pl ERROR. rc missing\n"); +            exit(1); +        } + +        if (! exists $err->{description}) +        { +            print ("fapiParseErrorInfo.pl ERROR. description missing\n"); +            exit(1); +        } + +        #---------------------------------------------------------------------- +        # Print the ReasonCode +        #---------------------------------------------------------------------- +        print TGFILE "    __$err->{rc} = HWPF_COMP_ID | $err->{rc},\n"; +    } +} + +#------------------------------------------------------------------------------ +# Print end of reason code enumeration and fapi namespace +#------------------------------------------------------------------------------ +print TGFILE "};\n\n"; +print TGFILE "}\n\n"; + +#------------------------------------------------------------------------------ +# For each XML file +#------------------------------------------------------------------------------ +foreach my $argnum (1 .. $#ARGV) +{ +    #-------------------------------------------------------------------------- +    # Read XML file +    #-------------------------------------------------------------------------- +    my $infile = $ARGV[$argnum]; +    my $errors = $xml->XMLin($infile); + +    #-------------------------------------------------------------------------- +    # For each Error +    #-------------------------------------------------------------------------- +    foreach my $err (@{$errors->{hwpError}}) +    { +        #---------------------------------------------------------------------- +        # Print the Error Log tag +        #---------------------------------------------------------------------- +        print TGFILE "/*\@\n"; +        print TGFILE " * \@errortype\n"; +        print TGFILE " * \@moduleid     MOD_HWP_RC_TO_ERRL\n"; +        print TGFILE " * \@reasoncode   __$err->{rc}\n"; +        print TGFILE " * \@devdesc      $err->{description}\n"; +        print TGFILE " */\n\n"; +    } +} + +#------------------------------------------------------------------------------ +# Print end of file information +#------------------------------------------------------------------------------ +print TGFILE "#endif\n"; + +#------------------------------------------------------------------------------ +# Close output files +#------------------------------------------------------------------------------ +close(TGFILE); + diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C index 6ba6beebd..7a31ca610 100644 --- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C +++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C @@ -143,24 +143,22 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc)              FAPI_ERR("fapiRcToErrl: HWP error: 0x%x",                       static_cast<uint32_t>(io_rc)); -            // TODO What should the severity be? Should it be in the error -            // record -            /*@ -             * @errortype -             * @moduleid     MOD_RC_TO_ERRL -             * @reasoncode   RC_HWP_ERROR -             * @userdata1    Return Code Value -             * @devdesc      Error from HWP -             */ +            // TODO What should the severity be? Should it be in the error info? + +            // The errlog reason code is the HWPF compID and the rcValue LSB +            uint32_t l_rcValue = static_cast<uint32_t>(io_rc); +            uint16_t l_reasonCode = l_rcValue; +            l_reasonCode &= 0xff; +            l_reasonCode |= HWPF_COMP_ID; + +            // HostBoot errlog tags for HWP errors are in generated file +            // fapiHwpReasonCodes.H              l_pError = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, -                                               MOD_RC_TO_ERRL, -                                               RC_HWP_ERROR, -                                               static_cast<uint32_t>(io_rc)); +                                               MOD_HWP_RC_TO_ERRL, +                                               l_reasonCode);              // Get the Error Information Pointer -            const ErrorInfo * l_pErrorInfo = NULL; - -            l_pErrorInfo = io_rc.getErrorInfo(); +            const ErrorInfo * l_pErrorInfo = io_rc.getErrorInfo();              if (l_pErrorInfo)              { @@ -180,17 +178,26 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc)              // FAPI error. Create an error log              FAPI_ERR("fapiRcToErrl: FAPI error: 0x%x",                       static_cast<uint32_t>(io_rc)); -            /*@ -             * @errortype -             * @moduleid     MOD_RC_TO_ERRL -             * @reasoncode   RC_FAPI_ERROR -             * @userdata1    Return Code Value -             * @devdesc      FAPI Error -             */ + +            // The errlog reason code is the HWPF compID and the rcValue LSB +            uint32_t l_rcValue = static_cast<uint32_t>(io_rc); +            uint16_t l_reasonCode = l_rcValue; +            l_reasonCode &= 0xff; +            l_reasonCode |= HWPF_COMP_ID; + +            // HostBoot errlog tags for FAPI errors are in fapiPlatReasonCodes.H              l_pError = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, -                                               MOD_RC_TO_ERRL, -                                               RC_FAPI_ERROR, -                                               static_cast<uint32_t>(io_rc)); +                                               MOD_FAPI_RC_TO_ERRL, +                                               l_reasonCode); + +            // FAPI may have added FFDC Error Information. +            // Get the Error Information Pointer +            const ErrorInfo * l_pErrorInfo = io_rc.getErrorInfo(); + +            if (l_pErrorInfo) +            { +                processEIFfdcs(*l_pErrorInfo, l_pError); +            }          }          // Set the ReturnCode to success, this will delete any ErrorInfo or PLAT  | 

