summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/fapi
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-12-16 15:07:28 -0600
committerMIKE J. JONES <mjjones@us.ibm.com>2011-12-19 12:08:22 -0600
commitc6928c0fd5f3ca01ba3fc9a0421442a2849b26ba (patch)
treec2f2324b937dc9bb4c3a53b967e9625d36ff5706 /src/usr/hwpf/fapi
parent9702479b40c9f8265804d90d4586e8ae91805c5a (diff)
downloadblackbird-hostboot-c6928c0fd5f3ca01ba3fc9a0421442a2849b26ba.tar.gz
blackbird-hostboot-c6928c0fd5f3ca01ba3fc9a0421442a2849b26ba.zip
HWPF: Create HTML file listing supported HWPF attributes
Change-Id: I27f8d3e536abddffdd568caab4bbc8b7696f50d5 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/583 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/fapi')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseAttributeInfo.pl93
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl6
2 files changed, 90 insertions, 9 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
index e493255ec..110057794 100755
--- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
@@ -49,6 +49,8 @@
# enums
# mjjones 11/15/11 Move gen of fapiAttributeService.C
# to a different file
+# mjjones 12/16/11 Generate fapiAttributePlatCheck.H
+# Generate fapiAttributesSupported.html
#
# End Change Log ******************************************************
@@ -61,8 +63,11 @@ my $numArgs = $#ARGV + 1;
if ($numArgs < 2)
{
print ("Usage: fapiParseAttributeInfo.pl <output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n");
- print (" This perl script will parse attribute XML files and add\n");
- print (" attribute information to a file called fapiAttributeIds.H\n");
+ print (" This perl script will parse attribute XML files and create the following files:\n");
+ print (" - fapiAttributeIds.H. Contains IDs, type, value enums and other information\n");
+ 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");
exit(1);
}
@@ -76,13 +81,23 @@ my $xml = new XML::Simple (KeyAttr=>[]);
#use Data::Dumper;
#------------------------------------------------------------------------------
-# Open output file for writing
+# Open output files for writing
#------------------------------------------------------------------------------
my $aiFile = $ARGV[0];
$aiFile .= "/";
$aiFile .= "fapiAttributeIds.H";
open(AIFILE, ">", $aiFile);
+my $acFile = $ARGV[0];
+$acFile .= "/";
+$acFile .= "fapiAttributePlatCheck.H";
+open(ACFILE, ">", $acFile);
+
+my $asFile = $ARGV[0];
+$asFile .= "/";
+$asFile .= "fapiAttributesSupported.html";
+open(ASFILE, ">", $asFile);
+
#------------------------------------------------------------------------------
# Print Start of file information to fapiAttributeIds.H
#------------------------------------------------------------------------------
@@ -98,6 +113,28 @@ print AIFILE " *\/\n";
print AIFILE "enum AttributeId\n{\n";
#------------------------------------------------------------------------------
+# Print Start of file information to fapiAttributePlatCheck.H
+#------------------------------------------------------------------------------
+print ACFILE "// fapiAttributePlatCheck.H\n";
+print ACFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n";
+print ACFILE "// A platform can include it to ensure that it handles all HWPF\n";
+print ACFILE "// attributes\n\n";
+print ACFILE "#ifndef FAPIATTRIBUTEPLATCHECK_H_\n";
+print ACFILE "#define FAPIATTRIBUTEPLATCHECK_H_\n\n";
+
+#------------------------------------------------------------------------------
+# Print Start of file information to fapiAttributesSupported.html
+#------------------------------------------------------------------------------
+print ASFILE "<html>\n";
+print ASFILE "<body>\n\n";
+print ASFILE "<!-- fapiAttributesSupported.html -->\n";
+print ASFILE "<!-- This file is generated by perl script fapiParseAttributeInfo.pl -->\n";
+print ASFILE "<!-- It lists all HWPF attributes supported -->\n\n";
+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>";
+
+#------------------------------------------------------------------------------
# For each XML file
#------------------------------------------------------------------------------
foreach my $argnum (1 .. $#ARGV)
@@ -124,7 +161,7 @@ foreach my $argnum (1 .. $#ARGV)
exit(1);
}
- print AIFILE " ", $attr->{id}, ",\n";
+ print AIFILE " $attr->{id},\n";
};
}
@@ -158,13 +195,24 @@ foreach my $argnum (1 .. $#ARGV)
foreach my $attr (@{$attributes->{attribute}})
{
#----------------------------------------------------------------------
- # Print a comment with the attribute description to fapiAttributeIds.H
+ # Print a comment with the attribute ID fapiAttributeIds.H
+ #----------------------------------------------------------------------
+ print AIFILE "/* $attr->{id} */\n";
+
+ #----------------------------------------------------------------------
+ # Print the AttributeId and description to fapiAttributesSupported.html
#----------------------------------------------------------------------
- if ($attr->{description})
+ if (! exists $attr->{description})
{
- print AIFILE "/* $attr->{id}: $attr->{description} */\n";
+ print ("fapiParseAttributeInfo.pl ERROR. Att 'description' missing\n");
+ exit(1);
}
+ print ASFILE "<tr>\n";
+ print ASFILE " <td>$attr->{id}</td>\n";
+ print ASFILE " <td>$attr->{description}</td>\n";
+ print ASFILE "</tr>\n";
+
#----------------------------------------------------------------------
# Figure out the attribute array dimensions (if array)
#----------------------------------------------------------------------
@@ -259,6 +307,20 @@ foreach my $argnum (1 .. $#ARGV)
}
#----------------------------------------------------------------------
+ # Print the platform attribute checks to fapiAttributePlatCheck.H
+ #----------------------------------------------------------------------
+ if (exists $attr->{writeable})
+ {
+ print ACFILE "#ifndef $attr->{id}_SETMACRO\n";
+ print ACFILE "#error Platform does not support set of HWPF attr $attr->{id}\n";
+ print ACFILE "#endif\n";
+ }
+
+ print ACFILE "#ifndef $attr->{id}_GETMACRO\n";
+ print ACFILE "#error Platform does not support get of HWPF attr $attr->{id}\n";
+ print ACFILE "#endif\n\n";
+
+ #----------------------------------------------------------------------
# Print newline between each attribute's info to fapiAttributeIds.H
#----------------------------------------------------------------------
print AIFILE "\n";
@@ -272,6 +334,21 @@ print AIFILE "}\n\n";
print AIFILE "#endif\n";
#------------------------------------------------------------------------------
-# Close output file
+# Print End of file information to fapiAttributePlatCheck.H
+#------------------------------------------------------------------------------
+print ACFILE "#endif\n";
+
+#------------------------------------------------------------------------------
+# Print End of file information to fapiAttributesSupported.html
+#------------------------------------------------------------------------------
+print ASFILE "</table>\n\n";
+print ASFILE "</body>\n";
+print ASFILE "</html>\n";
+
+#------------------------------------------------------------------------------
+# Close output files
#------------------------------------------------------------------------------
close(AIFILE);
+close(ACFILE);
+close(ASFILE);
+
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
index e51e0a24e..dcf3d2858 100755
--- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -43,6 +43,7 @@
# mjjones 08/24/11 Parse GARD info
# mjjones 09/22/11 New Error Info Design
# camvanng 10/20/11 Fix bug
+# mjjones 12/16/11 Improved usage statement
#
# End Change Log ******************************************************
@@ -92,7 +93,10 @@ if ($numArgs < 2)
{
print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n");
print (" This perl script will parse HWP Error XML files and create\n");
- print (" required FAPI code\n");
+ print (" the following files:\n");
+ print (" - fapiHwpReturnCodes.H. HwpReturnCode enumeration (HWP generated errors)\n");
+ print (" - fapiHwpErrorInfo.H. Error information (used by FAPI_SET_HWP_ERROR\n");
+ print (" when a HWP generates an error)\n");
exit(1);
}
OpenPOWER on IntegriCloud