diff options
Diffstat (limited to 'src/usr/hwpf/fapi/fapiParseAttributeInfo.pl')
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index deb2fa174..0f3f10d1f 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -65,6 +65,8 @@ # mjjones 11/05/12 Generate fapiAttributeIds.txt # Generate fapiAttributeEnums.txt # mjjones 03/21/13 Add fapi namespace to Chip EC Feature macro +# mjjones 02/27/13 Generate fapiAttrInfo.csv +# Generate fapiAttrEnumInfo.csv # # End Change Log ****************************************************** @@ -83,8 +85,8 @@ if ($numArgs < 2) print (" - fapiAttributePlatCheck.H. Contains compile time checks that all attributes are\n"); print (" handled by the platform\n"); print (" - fapiAttributesSupported.html Contains the HWPF attributes supported\n"); - print (" - fapiAttributeIds.txt Used to xlate between AttrID string and value\n"); - print (" - fapiAttributeEnums.txt Used to xlate between AttrEnum string and value\n"); + print (" - fapiAttrInfo.csv Used to process Attribute Override Text files\n"); + print (" - fapiAttrEnumInfo.csv Used to process Attribute Override Text files\n"); exit(1); } @@ -130,12 +132,12 @@ open(ASFILE, ">", $asFile); my $itFile = $ARGV[0]; $itFile .= "/"; -$itFile .= "fapiAttributeIds.txt"; +$itFile .= "fapiAttrInfo.csv"; open(ITFILE, ">", $itFile); my $etFile = $ARGV[0]; $etFile .= "/"; -$etFile .= "fapiAttributeEnums.txt"; +$etFile .= "fapiAttrEnumInfo.csv"; open(ETFILE, ">", $etFile); #------------------------------------------------------------------------------ @@ -211,6 +213,28 @@ print ASFILE "<h4>HWPF Attributes supported by this build.</h4>\n"; print ASFILE "<table border=\"4\">\n"; print ASFILE "<tr><th>Attribute ID</th><th>Attribute Description</th></tr>"; +#------------------------------------------------------------------------------ +# Print Start of file information to fapiAttrInfo.csv +#------------------------------------------------------------------------------ +print ITFILE "# fapiAttrInfo.csv\n"; +print ITFILE "# This file is generated by perl script fapiParseAttributeInfo.pl\n"; +print ITFILE "# It lists information about FAPI attributes and is used to\n"; +print ITFILE "# process FAPI Attribute text files (overrides/syncs)\n"; +print ITFILE "# Format:\n"; +print ITFILE "# <FAPI-ATTR-ID-STR>,<LAYER-ATTR-ID-STR>,<ATTR-ID-VAL>,<ATTR-TYPE>\n"; +print ITFILE "# Note that for the AttributeTanks at the FAPI layer, the\n"; +print ITFILE "# FAPI-ATTR-ID-STR and LAYER-ATTR-ID-STR will be identical\n"; + +#------------------------------------------------------------------------------ +# Print Start of file information to fapiAttrEnumInfo.csv +#------------------------------------------------------------------------------ +print ETFILE "# fapiAttrEnumInfo.csv\n"; +print ETFILE "# This file is generated by perl script fapiParseAttributeInfo.pl\n"; +print ETFILE "# It lists information about FAPI attribute enumeratorss and is\n"; +print ETFILE "# used to process FAPI Attribute text files (overrides/syncs)\n"; +print ETFILE "# Format:\n"; +print ETFILE "# <ENUM-STR>,<ENUM-VAL>\n"; + my %attrIdHash; # Records which Attribute IDs have been used my %attrValHash; # Records which Attribute values have been used @@ -258,8 +282,6 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } - $attrIdHash{$attr->{id}} = 1; - # Calculate a 28 bit hash value. my $attrHash128Bit = md5_hex($attr->{id}); my $attrHash28Bit = substr($attrHash128Bit, 0, 7); @@ -267,9 +289,6 @@ foreach my $argnum (1 .. $#ARGV) # Print the attribute ID/value to fapiAttributeIds.H print AIFILE " $attr->{id} = 0x$attrHash28Bit,\n"; - # Print the attribute ID/value to fapiAttributeIds.txt - print ITFILE "$attr->{id} 0x$attrHash28Bit\n"; - if (exists($attrValHash{$attrHash28Bit})) { # Two different attributes generate the same hash-value! @@ -278,6 +297,7 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } + $attrIdHash{$attr->{id}} = $attrHash28Bit; $attrValHash{$attrHash28Bit} = 1; }; } @@ -352,6 +372,7 @@ foreach my $argnum (1 .. $#ARGV) #---------------------------------------------------------------------- # Print the typedef for each attribute's val type to fapiAttributeIds.H + # Print the attribute information to fapiAttrInfo.csv #---------------------------------------------------------------------- if (exists $attr->{chipEcFeature}) { @@ -369,14 +390,20 @@ foreach my $argnum (1 .. $#ARGV) if ($attr->{valueType} eq 'uint8') { print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . + "$arrayDimensions\n"; } elsif ($attr->{valueType} eq 'uint32') { print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u32" . + "$arrayDimensions\n"; } elsif ($attr->{valueType} eq 'uint64') { print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u64" . + "$arrayDimensions\n"; } else { @@ -463,9 +490,9 @@ foreach my $argnum (1 .. $#ARGV) # Print the attribute enum to fapiAttributeIds.H print AIFILE " ENUM_$attr->{id}_${val}"; - # Print the attribute enum to fapiAttributeEnums.txt + # Print the attribute enum to fapiAttrEnumInfo.csv my $attrEnumTxt = "$attr->{id}_${val}\n"; - $attrEnumTxt =~ s/= //; + $attrEnumTxt =~ s/ = /,/; print ETFILE $attrEnumTxt; if ($attr->{valueType} eq 'uint64') |