summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/fapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/hwpf/fapi')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl90
1 files changed, 51 insertions, 39 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
index a54883164..db8fa48e5 100755
--- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2011-2012
#
# p1
#
@@ -20,8 +20,7 @@
#
# Origin: 30
#
-# IBM_PROLOG_END
-
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script will parse HWP Error XML files and create required
# FAPI code. The FAPI files created are:
@@ -48,6 +47,7 @@
# mjjones 03/22/12 Generate hash values for enums
# mjjones 05/15/12 Detect duplicate error rcs
# mjjones 05/21/12 Detect duplicate ids/hashes across files
+# mjjones 06/27/12 Add assembler output for SBE usage
#
# End Change Log ******************************************************
@@ -135,21 +135,6 @@ $eiFile .= "fapiHwpErrorInfo.H";
open(EIFILE, ">", $eiFile);
#------------------------------------------------------------------------------
-# Print start of file information to fapiHwpReturnCodes.H
-#------------------------------------------------------------------------------
-print RCFILE "// fapiHwpReturnCodes.H\n";
-print RCFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
-print RCFILE "#ifndef FAPIHWPRETURNCODES_H_\n";
-print RCFILE "#define FAPIHWPRETURNCODES_H_\n\n";
-print RCFILE "namespace fapi\n";
-print RCFILE "{\n\n";
-print RCFILE "/**\n";
-print RCFILE " * \@brief Enumeration of HWP return codes\n";
-print RCFILE " *\/\n";
-print RCFILE "enum HwpReturnCode\n";
-print RCFILE "{\n";
-
-#------------------------------------------------------------------------------
# Print start of file information to fapiHwpErrorInfo.H
#------------------------------------------------------------------------------
print EIFILE "// fapiHwpErrorInfo.H\n";
@@ -170,8 +155,8 @@ my $callout = 'callout';
my $deconfigure = 'deconfigure';
my $gard = 'gard';
-my %enumHash;
-my %errorRcHash;
+my %errNameToErrValueHash;
+my %errValuePresentHash;
#------------------------------------------------------------------------------
# For each XML file
@@ -205,45 +190,50 @@ foreach my $argnum (1 .. $#ARGV)
exit(1);
}
- if (exists($errorRcHash{$err->{rc}}))
+ if (! exists $err->{description})
{
- # Two different errors with the same rc!
- print ("fapiParseErrorInfo.pl ERROR. Duplicate error rc ",
- $err->{rc}, "\n");
+ print ("fapiParseErrorInfo.pl ERROR. description missing\n");
exit(1);
}
- $errorRcHash{$err->{rc}} = 1;
-
- if (! exists $err->{description})
+ #----------------------------------------------------------------------
+ # Check that the error name is not a duplicate
+ #----------------------------------------------------------------------
+ if (exists($errNameToErrValueHash{$err->{rc}}))
{
- print ("fapiParseErrorInfo.pl ERROR. description missing\n");
+ # Two different errors with the same name!
+ print ("fapiParseErrorInfo.pl ERROR. Duplicate error name ",
+ $err->{rc}, "\n");
exit(1);
}
#----------------------------------------------------------------------
- # Print the return code enum to fapiHwpReturnCodes.H
- # The enumerator value for each error is a hash value generated from
- # the errpr name, this ties a specific enumerator value to a specific
+ # Figure out the error value. This is a hash value generated from the
# error name. This is done for Cronus so that if a HWP is not
# recompiled against a new eCMD/Cronus version where the errors have
- # changed then there will not be a mismatch in enumerator values.
+ # changed then there will not be a mismatch in error values.
# This is a 24bit hash value because FAPI has a requirement that the
# top byte of the 32 bit error value be zero to store flags indicating
# the creator of the error
#----------------------------------------------------------------------
- my $attrHash128Bit = md5_hex($err->{rc});
- my $attrHash24Bit = substr($attrHash128Bit, 0, 6);
- print RCFILE " $err->{rc} = 0x$attrHash24Bit,\n";
+ my $errHash128Bit = md5_hex($err->{rc});
+ my $errHash24Bit = substr($errHash128Bit, 0, 6);
- if (exists($enumHash{$attrHash24Bit}))
+ #----------------------------------------------------------------------
+ # Check that the error value is not a duplicate
+ #----------------------------------------------------------------------
+ if (exists($errValuePresentHash{$errHash24Bit}))
{
# Two different errors generate the same hash-value!
- print ("fapiParseAttributeInfo.pl ERROR. Duplicate error rc hash value\n");
+ print ("fapiParseAttributeInfo.pl ERROR. Duplicate error hash value\n");
exit(1);
}
- $enumHash{$attrHash24Bit} = 1;
+ #----------------------------------------------------------------------
+ # Update the hashes with the error name and ID
+ #----------------------------------------------------------------------
+ $errValuePresentHash{$errHash24Bit} = 1;
+ $errNameToErrValueHash{$err->{rc}} = $errHash24Bit;
#----------------------------------------------------------------------
# Print the CALL_FUNC_TO_ANALYZE_ERROR macro to fapiHwpErrorInfo.H
@@ -416,10 +406,32 @@ foreach my $argnum (1 .. $#ARGV)
}
#------------------------------------------------------------------------------
-# Print end of file information to fapiHwpReturnCodes.H
+# Print the fapiHwpReturnCodes.H file
#------------------------------------------------------------------------------
+print RCFILE "// fapiHwpReturnCodes.H\n";
+print RCFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
+print RCFILE "#ifndef FAPIHWPRETURNCODES_H_\n";
+print RCFILE "#define FAPIHWPRETURNCODES_H_\n\n";
+print RCFILE "#ifndef __ASSEMBLER__\n";
+print RCFILE "namespace fapi\n";
+print RCFILE "{\n\n";
+print RCFILE "/**\n";
+print RCFILE " * \@brief Enumeration of HWP return codes\n";
+print RCFILE " *\/\n";
+print RCFILE "enum HwpReturnCode\n";
+print RCFILE "{\n";
+foreach my $key (keys %errNameToErrValueHash)
+{
+ print RCFILE " $key = 0x$errNameToErrValueHash{$key},\n";
+}
print RCFILE "};\n\n";
print RCFILE "}\n\n";
+print RCFILE "#else\n";
+foreach my $key (keys %errNameToErrValueHash)
+{
+ print RCFILE " .set $key, 0x$errNameToErrValueHash{$key}\n";
+}
+print RCFILE "#endif\n";
print RCFILE "#endif\n";
#------------------------------------------------------------------------------
OpenPOWER on IntegriCloud