summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2012-04-03 15:35:56 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-27 13:15:05 -0500
commitabaf491814fa70cb24193eff4fae91919a25de4d (patch)
tree691622ddefdd666d5a849fc27a979d0efd9ef46f /src/usr
parentf373d5d3ed00d94202f2b32d75f1066ff4727938 (diff)
downloadtalos-hostboot-abaf491814fa70cb24193eff4fae91919a25de4d.tar.gz
talos-hostboot-abaf491814fa70cb24193eff4fae91919a25de4d.zip
Attribute Dump Debug Func
You can request a dump of all attributes for a given target using the HUID as the key. The command also allows you to specify which trace buffer the output should go into. Synopsis hb-AttrDump ["options"] Options: huid HUID of target to dump (default is to dump all targets). trace Trace buffer to use (default=g_trac_targ). debug More debug output. force Run command even if state does not appear correct. Ex: dump the attributes for sys0node0proc0 into FSIR trace hb-AttrDump "huid=0x00070001 trace=g_trac_fsir" RTC: 35202 Change-Id: Iab3b50af025f203bd5184481462603de9b4bc1a9 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/912 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/targeting/common/test/testcommontargeting.H38
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl55
2 files changed, 58 insertions, 35 deletions
diff --git a/src/usr/targeting/common/test/testcommontargeting.H b/src/usr/targeting/common/test/testcommontargeting.H
index e16671633..37430fdb2 100644
--- a/src/usr/targeting/common/test/testcommontargeting.H
+++ b/src/usr/targeting/common/test/testcommontargeting.H
@@ -50,11 +50,9 @@
#include <targeting/common/trace.H>
#include "unittest.H"
-//trace_desc_t* g_trac_targeting = NULL;
-//TRAC_INIT(&g_trac_targeting, "TARG", 4096);
-
namespace TARGETING {
-extern void dumpAllAttributes(trace_desc_t*);
+extern void dumpAllAttributes(TARG_TD_t,uint32_t);
+extern TARG_TD_t g_trac_targeting;
};
class CommonTargetingTestSuite: public CxxTest::TestSuite
@@ -66,10 +64,10 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
*/
void testTargetServiceClass()
{
- //@fixme - found a Data Storage Exception that needs to be fixed (Task
+ //@fixme - found a Data Storage Exception that needs to be fixed (Task
// RTC 35625)
return;
-
+
TARG_TS_TRACE(ENTER_MRK "testTargetServiceClass" );
using namespace TARGETING;
@@ -1352,8 +1350,8 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_TRACE(ENTER_MRK "testStringAttributes" );
using namespace TARGETING;
-
- do {
+
+ do {
TargetService& l_targetService = targetService();
@@ -1390,7 +1388,7 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
{
TARG_TS_FAIL("ERROR: Can not read l_nullString attribute");
}
-
+
// TC1.4: All bytes of the string must match the reference version
if(memcmp(l_nullStringReference,
l_nullString,
@@ -1409,9 +1407,9 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
{
TARG_TS_FAIL("ERROR: l_nullString does not strcmp to the empty string");
TARG_BIN("Actual (l_nullString)",
- l_nullString,sizeof(l_nullString));
+ l_nullString,sizeof(l_nullString));
}
-
+
// TC2: Test string attribute with only 1 character
// TC2.1: String storage size must match the stated size
ATTR_TEST_MIN_STRING_type l_minStringReference = {0};
@@ -1425,7 +1423,7 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
ATTR_TEST_MIN_STRING_max_chars+1);
}
- // TC2.2: String size must be non-zero
+ // TC2.2: String size must be non-zero
if(sizeof(l_minString) == 0)
{
TARG_TS_FAIL("ERROR: l_minString size is zero");
@@ -1436,8 +1434,8 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
{
TARG_TS_FAIL("ERROR: Can not read l_minString attribute");
}
-
- // TC2.4: All bytes in string must match the reference string
+
+ // TC2.4: All bytes in string must match the reference string
if(memcmp(l_minStringReference,
l_minString,
sizeof(l_minStringReference)))
@@ -1456,7 +1454,7 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_FAIL("ERROR l_minString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_minString)",
- l_minString,sizeof(l_minString));
+ l_minString,sizeof(l_minString));
}
// TC3: Test string with maximum number of characters (including NULL)
@@ -1505,7 +1503,7 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_FAIL("ERROR: l_maxString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_maxString)",
- l_maxString,sizeof(l_maxString));
+ l_maxString,sizeof(l_maxString));
}
// TC4: Test string with no supplied default value
@@ -1553,7 +1551,7 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_FAIL("ERROR: l_noDefaultString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_noDefaultString)",
- l_noDefaultString,sizeof(l_noDefaultString));
+ l_noDefaultString,sizeof(l_noDefaultString));
}
// TC5: Write string and read back
@@ -1587,12 +1585,6 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_TRACE(EXIT_MRK "testStringAttributes" );
}
-
- void testDump()
- {
- //fixme-remove this completely when RTC:38386 is done
- //TARGETING::dumpAllAttributes(g_trac_targeting);
- }
};
#endif // __TARGETING_COMMON_TESTCOMMONTARGETING_H
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index 842027137..eb344db53 100755
--- a/src/usr/targeting/common/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -110,9 +110,9 @@ my $xml = new XML::Simple (KeyAttr=>[]);
# Until full machine parseable workbook parsing splits out all the input files,
# use the intermediate representation containing the full host boot model.
# Aborts application if file name not found.
-my $attributes = $xml->XMLin($cfgHbXmlFile,
+my $attributes = $xml->XMLin($cfgHbXmlFile,
forcearray => ['enumerationType','attribute','hwpfToHbAttrMap']);
-my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile,
+my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile,
forcearray => ['attribute']);
# Perform some sanity validation of the model (so we don't have to later)
@@ -331,7 +331,7 @@ sub validateTargetTypesExtension {
my %elements = ( );
$elements{"id"} = { required => 1, isscalar => 1};
$elements{"attribute"} = { required => 1, isscalar => 1};
-
+
foreach my $targetTypeExtension (@{$attributes->{targetTypeExtension}})
{
validateSubElements("targetTypeExtension",1,
@@ -1353,9 +1353,9 @@ VERBATIM
######
#Create a .C file to dump all possible attributes
#####
-sub writeDumpFile {
+sub writeDumpFile {
my($attributes,$outFile) = @_;
-
+
#First setup the includes and function definition
print $outFile "#include <targeting/common/targetservice.H>\n";
print $outFile "#include <targeting/common/trace.H>\n";
@@ -1363,10 +1363,11 @@ sub writeDumpFile {
print $outFile "\n";
print $outFile "namespace TARGETING\n";
print $outFile "{\n";
- print $outFile " void dumpAllAttributes( TARG_TD_t i_trac )\n";
+ print $outFile " void dumpAllAttributes( TARG_TD_t i_trac, uint32_t i_huid )\n";
print $outFile " {\n";
print $outFile " using namespace TARGETING;\n";
print $outFile "\n";
+ print $outFile " bool foundit = false;\n";
print $outFile " TargetService& l_targetService = targetService();\n";
print $outFile "\n";
print $outFile " // Loop through every Target\n";
@@ -1375,13 +1376,29 @@ sub writeDumpFile {
print $outFile " ++l_targ )\n";
print $outFile " {\n";
+ # add a HUID check first so we can act on a single target
+ print $outFile " { //HUID Check\n";
+ print $outFile " AttributeTraits<ATTR_HUID>::Type huid;\n";
+ print $outFile " if( (*l_targ)->tryGetAttr<ATTR_HUID>(huid) ) {\n";
+ print $outFile " if( (i_huid != huid) && (i_huid != 0) )\n";
+ print $outFile " {\n";
+ print $outFile " //skip this target\n";
+ print $outFile " continue;\n";
+ print $outFile " }\n";
+ print $outFile " else\n";
+ print $outFile " {\n";
+ print $outFile " foundit = true;\n";
+ print $outFile " }\n";
+ print $outFile " }\n";
+ print $outFile " }\n";
+
# add the physical path first so we know where we are
print $outFile " { //Physical Path\n";
print $outFile " AttributeTraits<ATTR_PHYS_PATH>::Type tmp;\n";
print $outFile " if( (*l_targ)->tryGetAttr<ATTR_PHYS_PATH>(tmp) ) {\n";
print $outFile " char* tmpstring = tmp.toString();\n";
print $outFile " TRACFCOMP( i_trac, \"DUMP: --ATTR_PHYS_PATH=%s--\", tmpstring );\n";
- print $outFile " free(tmpstring);\n";
+ print $outFile " free(tmpstring);\n";
print $outFile " }\n";
print $outFile " }\n";
@@ -1451,7 +1468,7 @@ sub writeDumpFile {
print $outFile " if( (*l_targ)->tryGetAttr<ATTR_",$attribute->{id},">(tmp) ) {\n";
print $outFile " char* tmpstring = tmp.toString();\n";
print $outFile " TRACFCOMP( i_trac, \"DUMP: ",$attribute->{id},"=%s\", tmpstring );\n";
- print $outFile " free(tmpstring);\n";
+ print $outFile " free(tmpstring);\n";
print $outFile " }\n";
print $outFile " }\n";
}
@@ -1481,7 +1498,21 @@ sub writeDumpFile {
}
print $outFile " }\n";
+ print $outFile "\n";
+ print $outFile " if( !foundit )\n";
+ print $outFile " {\n";
+ print $outFile " TRACFCOMP( i_trac, \"DUMP: No Target found matching HUID=%.8X\", i_huid );\n";
+ print $outFile " }\n";
print $outFile " }\n";
+ print $outFile "\n";
+
+ # add another prototype that is easier to call from debug framework
+ print $outFile " void dumpAllAttributes2( trace_desc_t** i_trac, uint32_t i_huid )\n";
+ print $outFile " {\n";
+ print $outFile " dumpAllAttributes( *i_trac, i_huid );\n";
+ print $outFile " }\n";
+ print $outFile "\n";
+
print $outFile "}\n";
print $outFile "\n";
}
@@ -1588,9 +1619,9 @@ sub enumSpace {
# 4-byte enums instead of optimized enums. Note there are a few
# enumerations (primarily in PNOR header, etc.) that do not change size.
# That is intentional in order to make this the single point of control over
- # binary compatibility. Note that both FSP and Hostboot should always have
+ # binary compatibility. Note that both FSP and Hostboot should always have
# this policy in sync. Also note that when Hostboot and FSP use optimized
- # enums, they must also be compiled with -fshort-enums
+ # enums, they must also be compiled with -fshort-enums
# $space = 4;
return $space;
@@ -2404,14 +2435,14 @@ sub packAttribute {
}
# else use the last value
- packSingleSimpleTypeAttribute(\$binaryData,
+ packSingleSimpleTypeAttribute(\$binaryData,
\$attributes, \$attribute, $typeName, $val);
}
}
else
{
# Not an array attribute
- packSingleSimpleTypeAttribute(\$binaryData,
+ packSingleSimpleTypeAttribute(\$binaryData,
\$attributes, \$attribute,$typeName, $value);
}
OpenPOWER on IntegriCloud