summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2016-04-07 14:14:26 -0500
committerBill Hoffa <wghoffa@us.ibm.com>2016-06-02 09:23:41 -0500
commitd4e4d0d4af9447731eecf660c41b9e5000eca5eb (patch)
tree4da265ef123aa63cb3dd05e71d2b78f776286d7a /src/import/hwpf
parent52ce221973aba37342075c49931797cd780efeb2 (diff)
downloadtalos-hostboot-d4e4d0d4af9447731eecf660c41b9e5000eca5eb.tar.gz
talos-hostboot-d4e4d0d4af9447731eecf660c41b9e5000eca5eb.zip
Procedure crashes when trying to query an EC feature
-Updated queryEcFeature to have two parts, base attribute reading is now in a library, while feature checking logic is now in small individual inline functions. Change-Id: I4c3685d6a85946297af31f7f3da4d918bca88039 RTC:151184 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23025 Tested-by: Jenkins Server Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23029 Tested-by: FSP CI Jenkins
Diffstat (limited to 'src/import/hwpf')
-rw-r--r--src/import/hwpf/fapi2/include/fapi2_chip_ec_feature.H58
-rw-r--r--src/import/hwpf/fapi2/src/fapi2.mk1
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/createIfAttrService.pl2
-rw-r--r--src/import/hwpf/fapi2/tools/parseAttributeInfo.mk2
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/parseAttributeInfo.pl167
5 files changed, 76 insertions, 154 deletions
diff --git a/src/import/hwpf/fapi2/include/fapi2_chip_ec_feature.H b/src/import/hwpf/fapi2/include/fapi2_chip_ec_feature.H
deleted file mode 100644
index 7402ec652..000000000
--- a/src/import/hwpf/fapi2/include/fapi2_chip_ec_feature.H
+++ /dev/null
@@ -1,58 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: hwpf/fapi2/include/fapi2_chip_ec_feature.H $ */
-/* */
-/* IBM CONFIDENTIAL */
-/* */
-/* EKB Project */
-/* */
-/* COPYRIGHT 2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* The source code for this program is not published or otherwise */
-/* divested of its trade secrets, irrespective of what has been */
-/* deposited with the U.S. Copyright Office. */
-/* */
-/* IBM_PROLOG_END_TAG */
-///
-/// @file fapi2_chip_ec_feature.H
-///
-/// @brief Defines the queryChipEcFeature function that allows HWPs to
-/// query if a particular chip has a feature determined by its EC level.
-/// Chip EC features are specified in attribute XML files and the
-/// queryChipEcFeature function implementation is auto-generated.
-/// HWPs should not call this function directly, but should access the
-/// corresponding HWPF attribute using FAPI_ATTR_GET
-///
-
-#ifndef FAPI2CHIPECFEATURE_H_
-#define FAPI2CHIPECFEATURE_H_
-
-#include <stdint.h>
-#include <target.H>
-#include <return_code.H>
-#include <attribute_ids.H>
-
-namespace fapi2
-{
-
-///
-/// @brief Queries if a Chip has a particular feature
-///
-/// This should only be called by FAPI during the processing of a FAPI_ATTR_GET
-/// for a Chip EC Feature attribute
-///
-/// @param[in] i_id Attribute ID of the Chip EC Feature
-/// @param[in] i_target Reference to chip target
-/// @param[out] o_hasFeature Set to 1 if chip has feature else 0
-/// @return ReturnCode. Zero on success, else platform specified error
-///
-template< TargetType K >
-ReturnCode queryChipEcFeature(AttributeId i_id,
- const Target<K>& i_target,
- uint8_t& o_hasFeature);
-}
-
-#endif
diff --git a/src/import/hwpf/fapi2/src/fapi2.mk b/src/import/hwpf/fapi2/src/fapi2.mk
index 6e0064291..99175ca72 100644
--- a/src/import/hwpf/fapi2/src/fapi2.mk
+++ b/src/import/hwpf/fapi2/src/fapi2.mk
@@ -26,7 +26,6 @@
FAPI2_MODULE_OBJS += error_info.o
FAPI2_MODULE_OBJS += ffdc.o
FAPI2_MODULE_OBJS += fapi2_attribute_service.o
-FAPI2_MODULE_OBJS += fapi2_chip_ec_feature.o
# Define common source and include paths.
define FAPI2_MODULE_INCLUDES
diff --git a/src/import/hwpf/fapi2/tools/createIfAttrService.pl b/src/import/hwpf/fapi2/tools/createIfAttrService.pl
index 5f24f8b0c..e72b8dac7 100755
--- a/src/import/hwpf/fapi2/tools/createIfAttrService.pl
+++ b/src/import/hwpf/fapi2/tools/createIfAttrService.pl
@@ -8,7 +8,7 @@
#
# EKB Project
#
-# COPYRIGHT 2015
+# COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
diff --git a/src/import/hwpf/fapi2/tools/parseAttributeInfo.mk b/src/import/hwpf/fapi2/tools/parseAttributeInfo.mk
index 441cc4bc9..831d5291a 100644
--- a/src/import/hwpf/fapi2/tools/parseAttributeInfo.mk
+++ b/src/import/hwpf/fapi2/tools/parseAttributeInfo.mk
@@ -26,7 +26,7 @@ SOURCES += $(FAPI2_ATTR_XML)
SOURCES += $(GENPATH)/empty_attribute.xml
TARGETS += attribute_ids.H
-TARGETS += fapi2_chip_ec_feature.C
+TARGETS += fapi2_chip_ec_feature.H
TARGETS += attribute_plat_check.H
TARGETS += attributesSupported.html
TARGETS += attrInfo.csv
diff --git a/src/import/hwpf/fapi2/tools/parseAttributeInfo.pl b/src/import/hwpf/fapi2/tools/parseAttributeInfo.pl
index e78c89d6b..35fd0977e 100755
--- a/src/import/hwpf/fapi2/tools/parseAttributeInfo.pl
+++ b/src/import/hwpf/fapi2/tools/parseAttributeInfo.pl
@@ -8,7 +8,7 @@
#
# EKB Project
#
-# COPYRIGHT 2015
+# COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -36,12 +36,12 @@ if (($numArgs < 1) || ($arg_output_dir eq undef))
print ("Usage: parseAttributeInfo.pl --output-dir=<output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n");
print (" This perl script will parse attribute XML files and create the following files:\n");
print (" - attribute_ids.H. Contains IDs, type, value enums and other information\n");
- print (" - fapi2_chip_ec_feature.C. Contains a function to query chip EC features\n");
- print (" - attribute_plat_check.H Contains compile time checks that all attributes are\n");
- print (" handled by the platform\n");
- print (" - attributesSupported.html Contains the HWPF attributes supported\n");
- print (" - attrInfo.csv Used to process Attribute Override Text files\n");
- print (" - attrEnumInfo.csv Used to process Attribute Override Text files\n");
+ print (" - fapi2_chip_ec_feature.H Contains a function to query chip EC features\n");
+ print (" - attribute_plat_check.H Contains compile time checks that all attributes are\n");
+ print (" handled by the platform\n");
+ print (" - attributesSupported.html Contains the HWPF attributes supported\n");
+ print (" - attrInfo.csv Used to process Attribute Override Text files\n");
+ print (" - attrEnumInfo.csv Used to process Attribute Override Text files\n");
exit(1);
}
@@ -70,10 +70,11 @@ $aiFile .= "/";
$aiFile .= "attribute_ids.H";
open(AIFILE, ">", $aiFile);
-my $ecFile = $arg_output_dir;
-$ecFile .= "/";
-$ecFile .= "fapi2_chip_ec_feature.C";
-open(ECFILE, ">", $ecFile);
+my $ecHFile = $arg_output_dir;
+$ecHFile .= "/";
+$ecHFile .= "fapi2_chip_ec_feature.H";
+open(ECHFILE, ">", $ecHFile);
+
my $acFile = $arg_output_dir;
$acFile .= "/";
@@ -123,48 +124,45 @@ print AIFILE " *\/\n";
print AIFILE "enum AttributeId\n{\n";
#------------------------------------------------------------------------------
-# Print Start of file information to fapi2_chip_ec_feature.C
-#------------------------------------------------------------------------------
-print ECFILE "// fapi2_chip_ec_feature.C\n";
-print ECFILE "// This file is generated by perl script parseAttributeInfo.pl\n";
-print ECFILE "// It implements the queryfapi2_chip_ec_feature function\n\n";
-print ECFILE "#include <fapi2_chip_ec_feature.H>\n";
-print ECFILE "#include <fapi2_attribute_service.H>\n";
-print ECFILE "#include <plat_trace.H>\n\n";
-print ECFILE "namespace fapi2\n";
-print ECFILE "{\n\n";
-print ECFILE "template< TargetType K >\n";
-print ECFILE "ReturnCode queryChipEcFeature(AttributeId i_id,\n";
-print ECFILE " const Target<K>& i_pTarget,\n";
-print ECFILE " uint8_t & o_hasFeature)\n";
-print ECFILE "{\n";
-print ECFILE " o_hasFeature = false;\n";
-print ECFILE " ReturnCode l_rc;\n";
-print ECFILE " uint8_t l_chipName = 0;\n";
-print ECFILE " uint8_t l_chipEc = 0;\n\n";
-print ECFILE " Target<TARGET_TYPE_ALL> l_target;\n\n";
-print ECFILE " if (i_pTarget.isChiplet())\n";
-print ECFILE " {\n";
-print ECFILE " l_target = i_pTarget.getParent();\n";
-print ECFILE " }\n\n";
-print ECFILE " if (!l_rc)\n";
-print ECFILE " {\n";
-print ECFILE " l_rc = FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_NAME, l_target, l_chipName);\n\n";
-print ECFILE " if (l_rc)\n";
-print ECFILE " {\n";
-print ECFILE " FAPI_ERR(\"queryChipEcFeature: error getting chip name\");\n";
-print ECFILE " }\n";
-print ECFILE " else\n";
-print ECFILE " {\n";
-print ECFILE " l_rc = FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_EC, l_target, l_chipEc);\n\n";
-print ECFILE " if (l_rc)\n";
-print ECFILE " {\n";
-print ECFILE " FAPI_ERR(\"queryChipEcFeature: error getting chip ec\");\n";
-print ECFILE " }\n";
-print ECFILE " else\n";
-print ECFILE " {\n";
-print ECFILE " switch (i_id)\n";
-print ECFILE " {\n";
+# Print Start of file information to fapi2_chip_ec_feature.H
+#------------------------------------------------------------------------------
+print ECHFILE "// This file is generated by perl script parseAttributeInfo.pl\n";
+print ECHFILE "// It implements the fapi2_chip_ec_feature function\n\n";
+print ECHFILE "#ifndef __FAPI2_CHIP_EC_FEATURE_H_\n";
+print ECHFILE "#define __FAPI2_CHIP_EC_FEATURE_H_\n";
+print ECHFILE "#include <fapi2_attribute_service.H>\n";
+print ECHFILE "#include <attribute_ids.H>\n";
+print ECHFILE "namespace fapi2\n";
+print ECHFILE "{\n\n";
+print ECHFILE "// create a unique type from an int ( or attribute id) \n";
+print ECHFILE "template<int I>\n";
+print ECHFILE "struct int2Type {\n";
+print ECHFILE "enum { value = I };\n";
+print ECHFILE "};\n";
+print ECHFILE "ReturnCode queryChipEcAndName(\n";
+print ECHFILE " const Target<fapi2::TARGET_TYPE_PROC_CHIP |\n";
+print ECHFILE " fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target,\n";
+print ECHFILE " fapi2::ATTR_NAME_Type& , fapi2::ATTR_EC_Type & );\n\n";
+print ECHFILE "template<int T>\n";
+print ECHFILE "ReturnCode queryChipEcFeature(int2Type<T> id,\n";
+print ECHFILE " const Target<fapi2::TARGET_TYPE_PROC_CHIP |\n";
+print ECHFILE " fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target,\n";
+print ECHFILE " uint8_t & o_hasFeature)\n";
+print ECHFILE "{\n";
+print ECHFILE " fapi2::ATTR_NAME_Type l_chipName;\n";
+print ECHFILE " fapi2::ATTR_EC_Type l_chipEc;\n\n";
+print ECHFILE " o_hasFeature = 0;\n\n";
+print ECHFILE " ReturnCode l_rc = queryChipEcAndName(i_target, l_chipName, l_chipEc);\n";
+print ECHFILE " if (l_rc)\n";
+print ECHFILE " {\n";
+print ECHFILE " FAPI_ERR(\"queryChipEcFeature: error getting chip name\");\n";
+print ECHFILE " }\n";
+print ECHFILE " else\n";
+print ECHFILE " {\n";
+print ECHFILE " o_hasFeature = hasFeature(int2Type<T>(), l_chipName, l_chipEc);\n";
+print ECHFILE " }\n";
+print ECHFILE " return l_rc;\n";
+print ECHFILE "}\n\n";
#------------------------------------------------------------------------------
# Print Start of file information to attribute_plat_check.H
@@ -560,8 +558,8 @@ foreach my $argnum (0 .. $#ARGV)
# compile failure if a set is attempted
#------------------------------------------------------------------
print AIFILE "#define $attr->{id}_GETMACRO(ID, PTARGET, VAL) \\\n";
- print AIFILE " PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi2::FAPI2_RC_SUCCESS : \\\n";
- print AIFILE " fapi2::queryChipEcFeature(ID, PTARGET, VAL)\n";
+ print AIFILE " PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi2::ReturnCode() : \\\n";
+ print AIFILE " queryChipEcFeature(fapi2::int2Type<ID>(), PTARGET, VAL)\n";
print AIFILE "#define $attr->{id}_SETMACRO(ID, PTARGET, VAL) ";
print AIFILE "CHIP_EC_FEATURE_ATTRIBUTE_NOT_WRITABLE\n";
}
@@ -579,13 +577,19 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
# If the attribute is a Chip EC Feature, print the chip EC feature
- # query to fapi2_chip_ec_feature.C
+ # query to fapi2_chip_ec_feature.H
#----------------------------------------------------------------------
+ # Each EC attribute will generate a new inline overloaded version of
+ # hasFeature with the attribute specific logic
if (exists $attr->{chipEcFeature})
{
my $chipCount = 0;
- print ECFILE " case $attr->{id}:\n";
- print ECFILE " if (\n";
+ print ECHFILE " inline uint8_t hasFeature(int2Type<$attr->{id}>,\n";
+ print ECHFILE " fapi2::ATTR_NAME_Type i_name,\n";
+ print ECHFILE " fapi2::ATTR_EC_Type i_ec)\n";
+ print ECHFILE " {\n";
+ print ECHFILE " uint8_t hasFeature = 0;\n\n";
+ print ECHFILE " if(";
foreach my $chip (@{$attr->{chipEcFeature}->{chip}})
{
@@ -644,17 +648,17 @@ foreach my $argnum (0 .. $#ARGV)
if ($chipCount > 1)
{
- print ECFILE " ||\n";
+ print ECHFILE " ||\n\t";
}
- print ECFILE " ((l_chipName == $chip->{name}) &&\n";
- print ECFILE " (l_chipEc $test $chip->{ec}->{value}))\n";
+ print ECHFILE "((i_name == $chip->{name}) && ";
+ print ECHFILE " (i_ec $test $chip->{ec}->{value}))";
}
-
- print ECFILE " )\n";
- print ECFILE " {\n";
- print ECFILE " o_hasFeature = true;\n";
- print ECFILE " }\n";
- print ECFILE " break;\n";
+ print ECHFILE ")\n";
+ print ECHFILE " {\n";
+ print ECHFILE " hasFeature = 1;\n";
+ print ECHFILE " }\n";
+ print ECHFILE " return hasFeature;\n";
+ print ECHFILE " };\n";
}
#----------------------------------------------------------------------
@@ -689,31 +693,8 @@ foreach my $argnum (0 .. $#ARGV)
print AIFILE "}\n\n";
print AIFILE "#endif\n";
-#------------------------------------------------------------------------------
-# Print End of file information to fapi2_chip_ec_feature.C
-#------------------------------------------------------------------------------
-print ECFILE " default:\n";
-print ECFILE " FAPI_ERR(\"queryChipEcFeature: Unknown feature 0x%x\",\n";
-print ECFILE " i_id);\n";
-print ECFILE " l_rc = FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET;\n";
-print ECFILE " break;\n";
-print ECFILE " }\n\n";
-print ECFILE " if (o_hasFeature)\n";
-print ECFILE " {\n";
-print ECFILE " FAPI_INF(\"queryChipEcFeature: Chip (0x%x:0x%x) has ";
-print ECFILE "feature (0x%x)\", l_chipName, l_chipEc, i_id);\n";
-print ECFILE " }\n";
-print ECFILE " else\n";
-print ECFILE " {\n";
-print ECFILE " FAPI_INF(\"queryChipEcFeature: Chip (0x%x:0x%x) does not ";
-print ECFILE "have feature (0x%x)\", l_chipName, l_chipEc, i_id);\n";
-print ECFILE " }\n";
-print ECFILE " }\n";
-print ECFILE " }\n";
-print ECFILE " }\n";
-print ECFILE " return l_rc;\n";
-print ECFILE "}\n\n";
-print ECFILE "}\n";
+print ECHFILE "}\n";
+print ECHFILE "#endif\n";
#------------------------------------------------------------------------------
@@ -750,7 +731,7 @@ print FEFILE "};\n";
# Close output files
#------------------------------------------------------------------------------
close(AIFILE);
-close(ECFILE);
+close(ECHFILE);
close(ACFILE);
close(ASFILE);
close(ITFILE);
OpenPOWER on IntegriCloud