summaryrefslogtreecommitdiffstats
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
parent9702479b40c9f8265804d90d4586e8ae91805c5a (diff)
downloadtalos-hostboot-c6928c0fd5f3ca01ba3fc9a0421442a2849b26ba.tar.gz
talos-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>
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseAttributeInfo.pl93
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl6
-rw-r--r--src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml64
-rw-r--r--src/usr/hwpf/makefile14
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C5
5 files changed, 158 insertions, 24 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);
}
diff --git a/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
index 36a29c972..3019edd6c 100644
--- a/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
+++ b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
@@ -28,7 +28,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT8_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint8_t attribute 1</description>
+ <description>
+ Scratch uint8_t attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint8</valueType>
<writeable/>
</attribute>
@@ -36,7 +39,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT8_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint8_t attribute 2</description>
+ <description>
+ Scratch uint8_t attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint8</valueType>
<writeable/>
</attribute>
@@ -44,7 +50,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT32_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint32_t attribute 1</description>
+ <description>
+ Scratch uint32_t attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint32</valueType>
<writeable/>
</attribute>
@@ -52,7 +61,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT32_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint32_t attribute 2</description>
+ <description>
+ Scratch uint32_t attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint32</valueType>
<writeable/>
</attribute>
@@ -60,7 +72,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT64_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint64_t attribute 1</description>
+ <description>
+ Scratch uint64_t attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint64</valueType>
<writeable/>
</attribute>
@@ -68,7 +83,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT64_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint64_t attribute 2</description>
+ <description>
+ Scratch uint64_t attribute
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint64</valueType>
<enum>VAL_A = 3, VAL_B = 5, VAL_C = 0x23</enum>
<writeable/>
@@ -77,7 +95,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT8_ARRAY_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint8_t array ([32]) attribute 1</description>
+ <description>
+ Scratch uint8_t[32] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint8</valueType>
<array>32</array>
<writeable/>
@@ -86,7 +107,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT8_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint8_t array ([2][3][4]) attribute 2</description>
+ <description>
+ Scratch uint8_t[2][3][4] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint8</valueType>
<array>2 3 4</array>
<writeable/>
@@ -95,7 +119,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT32_ARRAY_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint32_t array ([8]) attribute 1</description>
+ <description>
+ Scratch uint32_t[8] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint32</valueType>
<array>8</array>
<writeable/>
@@ -104,7 +131,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT32_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint32_t array ([2][3]) attribute 2</description>
+ <description>
+ Scratch uint32_t[2][3] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint32</valueType>
<array>2,3</array>
<writeable/>
@@ -113,7 +143,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT64_ARRAY_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint64_t array ([4]) attribute 1</description>
+ <description>
+ Scratch uint64_t[4] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint64</valueType>
<array>4</array>
<writeable/>
@@ -122,7 +155,10 @@
<attribute>
<id>ATTR_SCRATCH_UINT64_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Scratch uint64_t array ([2][2]) attribute 2</description>
+ <description>
+ Scratch uint64_t[2][2] attribute.
+ Can be used by HWPs for testing.
+ </description>
<valueType>uint64</valueType>
<array> 2, 2 </array>
<enum>VAL_A, VAL_B, VAL_C</enum>
@@ -132,7 +168,9 @@
<attribute>
<id>ATTR_DUMMY_SCRATCH_PLAT_INIT_UINT8</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Dummy plat init uint8 attribute used for testing</description>
+ <description>
+ Dummy platInit uint8[1][3][5] attribute used for testing.
+ </description>
<valueType>uint8</valueType>
<platInit/>
<writeable/>
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
index 6a031cde9..290af15bd 100644
--- a/src/usr/hwpf/makefile
+++ b/src/usr/hwpf/makefile
@@ -57,6 +57,12 @@ PLAT_ERROR_TAG_TARGET = fapiHwpReasonCodes.H
# The FAPI attribute id file generated from Attribute XML files
FAPI_ATTR_ID_TARGET = fapiAttributeIds.H
+# The FAPI attribute platform check file generated from Attribute XML files
+FAPI_ATTR_PLAT_CHECK_TARGET = fapiAttributePlatCheck.H
+
+# The FAPI attributes supported HTML file generated from Attribute XML files
+FAPI_ATTRS_SUPPORTED_TARGET = fapiAttributesSupported.html
+
# The binary, list and attr files generated from Initfiles
# Generation depends on ifcompiler and fapiAttributeIds.H
HWP_IF_NAMES = $(notdir ${HWP_INITFILES})
@@ -78,6 +84,8 @@ GENFILES = ${IF_CMP_YACC_C_TARGET} \
${FAPI_ERROR_TARGETS} \
${PLAT_ERROR_TAG_TARGET} \
${FAPI_ATTR_ID_TARGET} \
+ ${FAPI_ATTR_PLAT_CHECK_TARGET} \
+ ${FAPI_ATTRS_SUPPORTED_TARGET} \
${HWP_IF_ALL_TARGETS} \
${FAPI_ATTR_IF_TARGET}
@@ -131,9 +139,11 @@ $(call GENTARGET, ${PLAT_ERROR_TAG_TARGET}) : \
$< $(dir $@) ${HWP_ERROR_XML_FILES}
#------------------------------------------------------------------------------
-# The FAPI attribute id file generated from Attribute XML files
+# The FAPI attribute id file, the FAPI attribute platform check file and the
+# FAPI attributes supported file generated from Attribute XML files
#------------------------------------------------------------------------------
-$(call GENTARGET, ${FAPI_ATTR_ID_TARGET}) : \
+$(call GENTARGET, ${FAPI_ATTR_ID_TARGET} ${FAPI_ATTR_PLAT_CHECK_TARGET} \
+ ${FAPI_ATTRS_SUPPORTED_TARGET}) : \
fapi/fapiParseAttributeInfo.pl ${HWP_ATTR_XML_FILES}
$< $(dir $@) ${HWP_ATTR_XML_FILES}
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index 06a5392bf..41e1ada6b 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -39,6 +39,11 @@
#include <hwpf/plat/fapiPlatAttributeService.H>
#include <hwpf/plat/fapiPlatReasonCodes.H>
+// The following file checks at compile time that all HWPF attributes are
+// handled by Hostboot. This is done to ensure that the HTML file listing
+// supported HWPF attributes lists attributes handled by Hostboot
+#include <fapiAttributePlatCheck.H>
+
//******************************************************************************
// Implementation
//******************************************************************************
OpenPOWER on IntegriCloud