summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/debug/Hostboot/AttrDump.pm70
-rw-r--r--src/build/debug/Hostboot/CallFunc.pm56
-rw-r--r--src/usr/targeting/common/test/testcommontargeting.H38
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl55
4 files changed, 179 insertions, 40 deletions
diff --git a/src/build/debug/Hostboot/AttrDump.pm b/src/build/debug/Hostboot/AttrDump.pm
new file mode 100755
index 000000000..8d8dfafa0
--- /dev/null
+++ b/src/build/debug/Hostboot/AttrDump.pm
@@ -0,0 +1,70 @@
+
+use strict;
+
+package Hostboot::AttrDump;
+use Exporter;
+our @EXPORT_OK = ('main');
+require Hostboot::CallFunc;
+
+sub main
+{
+ my ($packName,$args) = @_;
+
+ # Parse 'debug' option.
+ my $debug = 0;
+ if (defined $args->{"debug"})
+ {
+ $debug = 1;
+ }
+
+ # Parse 'force' argument.
+ my $force = 0;
+ if (defined $args->{"force"})
+ {
+ $force = 1;
+ }
+
+ # Parse 'trace' argument.
+ my $trace = (::findSymbolAddress("TARGETING::g_trac_targeting"))[0];
+ if (defined $args->{"trace"})
+ {
+ $trace = (::findSymbolAddress($args->{"trace"}))[0];
+ }
+ if( $debug )
+ {
+ my $tmp2 = $args->{"trace"};
+ ::userDisplay("\ntrace: $trace ($tmp2)\n");
+ }
+
+ # Parse 'target' argument.
+ my $huid = 0; # dump all targets
+ if (defined $args->{"huid"})
+ {
+ $huid = hex($args->{"huid"});
+ }
+ if( $debug )
+ {
+ ::userDisplay("huid: $huid\n");
+ }
+
+ my @dumpparms;
+ push( @dumpparms, $trace );
+ push( @dumpparms, $huid );
+ Hostboot::CallFunc::execFunc( "TARGETING::dumpAllAttributes2(trace_buf_head**, unsigned int)", $debug, $force, \@dumpparms );
+
+ return 0;
+}
+
+sub helpInfo
+{
+ my %info = (
+ name => "AttrDump",
+ intro => ["Dumps all Attributes to trace."],
+ options => {
+ "huid" => ["HUID of target to dump (default is to dump all targets)."],
+ "trace" => ["Trace buffer to use (default=g_trac_targ)."],
+ "force" => ["Run command even if state does not appear correct."],
+ "debug" => ["More debug output."],
+ },
+ );
+}
diff --git a/src/build/debug/Hostboot/CallFunc.pm b/src/build/debug/Hostboot/CallFunc.pm
index a6e9bf417..64c5f8573 100644
--- a/src/build/debug/Hostboot/CallFunc.pm
+++ b/src/build/debug/Hostboot/CallFunc.pm
@@ -1,3 +1,25 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/Hostboot/CallFunc.pm $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2011 - 2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or other-
+# wise divested of its trade secrets, irrespective of what has
+# been deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END
use strict;
package Hostboot::CallFunc;
@@ -66,12 +88,36 @@ sub main
$force = 1;
}
+ my $error = execFunc( $function, $debug, $force, @parms );
+ if( $error )
+ {
+ return;
+ }
+}
+
+sub execFunc
+{
+ my $function = shift;
+ my $debug = shift;
+ my $force = shift;
+ my $parms_arg = shift;
+ my @parms = @{$parms_arg};
+
+ if( $debug )
+ {
+ ::userDisplay("function = $function.\n");
+ my $tmparg;
+ foreach $tmparg (@parms)
+ {
+ ::userDisplay("arg = $tmparg.\n");
+ }
+ }
# Ensure environment is in the proper state for running instructions.
if (!::readyForInstructions())
{
::userDisplay "Cannot execute while unable to run instructions.\n";
- return;
+ return 1;
}
# Find symbol's TOC address.
@@ -87,7 +133,7 @@ sub main
if ((not defined $toc) || (not defined $address))
{
::userDisplay "Cannot find symbol to execute $function.\n";
- return;
+ return 1;
}
# Verify kernel isn't busy with an outstanding request.
@@ -95,7 +141,7 @@ sub main
(0 == $force))
{
::userDisplay "Another command is still pending.\n";
- return;
+ return 1;
}
# Write entry point (function TOC) and parameters into debug structure.
@@ -136,9 +182,9 @@ sub main
if (0 == ::read8($address + CALLFUNC_DEBUG_COMPLETE_OFFSET))
{
::userDisplay "Command failed to complete.\n";
- return;
+ return 1;
}
-
+
# Display return value.
::userDisplay ::read64($address + CALLFUNC_DEBUG_RETVAL_OFFSET)."\n";
}
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