diff options
author | Mike Jones <mjjones@us.ibm.com> | 2012-05-15 12:23:52 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-05-21 09:48:20 -0500 |
commit | a32430814a0f190f08102d776b886656060c8509 (patch) | |
tree | 474d426ac5deed8c97db6e5a56ebe8ad7a7e2959 /src/usr | |
parent | 2a98222faf80705d4de4ed5703166802cdacc491 (diff) | |
download | talos-hostboot-a32430814a0f190f08102d776b886656060c8509.tar.gz talos-hostboot-a32430814a0f190f08102d776b886656060c8509.zip |
HWPF: Add error checking to FAPI perl scripts and output ULL to 64bit enumerators
John Farrugia requested these changes:
fapiParseAttributeInfo.pl:
- Detect duplicate attribute ID
- Add 'ULL' to the end of 64 bit enumerators
fapiParseErrorInfo.pl
- Detect duplicate error RCs
Change-Id: I862ca9b4f37dc83026f7fcdc26676bbf724656a1
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1062
Tested-by: Jenkins Server
Reviewed-by: Van H. Lee <vanlee@us.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/fapiParseAttributeInfo.pl | 25 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 12 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/scratch_attributes.xml | 4 |
3 files changed, 37 insertions, 4 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 988bb208e..f1783e8a8 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -54,6 +54,8 @@ # mjjones 02/08/12 Handle attribute files with 1 entry # mjjones 03/22/12 Generate hash values for enums # mjjones 04/10/12 Process Chip EC Feature attributes +# mjjones 05/15/12 Detect duplicate attr ids and append +# ULL after 64bit enumerator # # End Change Log ****************************************************** @@ -192,6 +194,7 @@ foreach my $argnum (1 .. $#ARGV) { my $infile = $ARGV[$argnum]; my %enumHash; + my %attrIdHash; # read XML file. The ForceArray option ensures that there is an array of # elements even if there is only one such element in the file @@ -222,6 +225,16 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } + if (exists($attrIdHash{$attr->{id}})) + { + # Two different attributes with the same id! + print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id ", + $attr->{id}, "\n"); + exit(1); + } + + $attrIdHash{$attr->{id}} = 1; + # Calculate a 28 bit hash value. my $attrHash128Bit = md5_hex($attr->{id}); my $attrHash28Bit = substr($attrHash128Bit, 0, 7); @@ -230,7 +243,8 @@ foreach my $argnum (1 .. $#ARGV) if (exists($enumHash{$attrHash28Bit})) { # Two different attributes generate the same hash-value! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id hash value\n"); + print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id hash value for ", + $attr->{id}, "\n"); exit(1); } @@ -371,7 +385,14 @@ foreach my $argnum (1 .. $#ARGV) { # Remove leading spaces $val =~ s/^\s+//; - print AIFILE " ENUM_$attr->{id}_${val},\n"; + print AIFILE " ENUM_$attr->{id}_${val}"; + + if ($attr->{valueType} eq 'uint64') + { + print AIFILE "ULL"; + } + + print AIFILE ",\n"; } print AIFILE "};\n"; diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index 87a4cd12d..02f3354b1 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -46,6 +46,7 @@ # mjjones 12/16/11 Improved usage statement # mjjones 02/10/12 Allow err file with one element # mjjones 03/22/12 Generate hash values for enums +# mjjones 05/15/12 Detect duplicate error rcs # # End Change Log ****************************************************** @@ -176,6 +177,7 @@ foreach my $argnum (1 .. $#ARGV) my $infile = $ARGV[$argnum]; my $count = 0; my %enumHash; + my %errorRcHash; #-------------------------------------------------------------------------- # Read XML file. The ForceArray option ensures that there is an array of @@ -201,6 +203,16 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } + if (exists($errorRcHash{$err->{rc}})) + { + # Two different errors with the same rc! + print ("fapiParseErrorInfo.pl ERROR. Duplicate error rc ", + $err->{rc}, "\n"); + exit(1); + } + + $errorRcHash{$err->{rc}} = 1; + if (! exists $err->{description}) { print ("fapiParseErrorInfo.pl ERROR. description missing\n"); diff --git a/src/usr/hwpf/hwp/scratch_attributes.xml b/src/usr/hwpf/hwp/scratch_attributes.xml index b6905911d..0337a7263 100644 --- a/src/usr/hwpf/hwp/scratch_attributes.xml +++ b/src/usr/hwpf/hwp/scratch_attributes.xml @@ -92,7 +92,7 @@ Can be used by HWPs for testing. </description> <valueType>uint64</valueType> - <enum>VAL_A = 3, VAL_B = 5, VAL_C = 0x23</enum> + <enum>VAL_A = 0, VAL_B = 5, VAL_C = 0xffffffffffffffff</enum> <writeable/> </attribute> <!-- ********************************************************************* --> @@ -165,7 +165,7 @@ </description> <valueType>uint64</valueType> <array> 2, 2 </array> - <enum>VAL_A, VAL_B, VAL_C</enum> + <enum>VAL_A = 0x0123456789abcdef, VAL_B = 0, VAL_C = 0xffffffffffffffff</enum> <writeable/> </attribute> <!-- ********************************************************************* --> |