summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2013-01-07 17:29:47 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-01-14 14:56:46 -0600
commita84cc4b307526e9895747f2e78bb36c93582d796 (patch)
treea7d39903e0012b1637fc7723cb93862cad9d65ff /src/build
parent57eeca20f6cc9236834b763b6301d475ad9944f0 (diff)
downloadtalos-hostboot-a84cc4b307526e9895747f2e78bb36c93582d796.tar.gz
talos-hostboot-a84cc4b307526e9895747f2e78bb36c93582d796.zip
ECMD-based debug framework.
RTC: 47061 Change-Id: Ie77c553a6f4e67c11927ed8650f81ab80ae1672c Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2883 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/debug/Hostboot/Gcov.pm28
-rwxr-xr-xsrc/build/debug/Hostboot/Trace.pm2
-rwxr-xr-xsrc/build/debug/ecmd-debug-framework.pl405
3 files changed, 420 insertions, 15 deletions
diff --git a/src/build/debug/Hostboot/Gcov.pm b/src/build/debug/Hostboot/Gcov.pm
index 0ebfaaef3..cce539d6c 100755
--- a/src/build/debug/Hostboot/Gcov.pm
+++ b/src/build/debug/Hostboot/Gcov.pm
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/debug/Hostboot/Gcov.pm $
+# $Source: src/build/debug/Hostboot/Gcov.pm $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2012
+# COPYRIGHT International Business Machines Corp. 2012,2013
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# 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.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
use strict;
use File::Path;
use File::Basename;
diff --git a/src/build/debug/Hostboot/Trace.pm b/src/build/debug/Hostboot/Trace.pm
index 5e3adc05d..a124d8e17 100755
--- a/src/build/debug/Hostboot/Trace.pm
+++ b/src/build/debug/Hostboot/Trace.pm
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
diff --git a/src/build/debug/ecmd-debug-framework.pl b/src/build/debug/ecmd-debug-framework.pl
new file mode 100755
index 000000000..6021cf450
--- /dev/null
+++ b/src/build/debug/ecmd-debug-framework.pl
@@ -0,0 +1,405 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/ecmd-debug-framework.pl $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2013
+#
+# 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 otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+
+use Getopt::Long;
+use Pod::Usage;
+use IO::Seekable;
+use File::Temp ( 'tempfile' );
+use File::Basename;
+use lib dirname (__FILE__);
+
+use Hostboot::_DebugFramework;
+
+use constant DEFAULT_HRMOR => 128*1024*1024; # 128 MB.
+
+my $filename = basename (__FILE__);
+my $self = ($0 =~ m/$filename/);
+
+my $tool = "";
+my $testImage = 0;
+my $toolOptions = "";
+my $cfgHelp = 0;
+my $cfgMan = 0;
+my $toolHelp = 0;
+my $forceHRMOR = DEFAULT_HRMOR;
+
+my $imgPath = "";
+my $hbDir = $ENV{'HB_IMGDIR'};
+if (defined ($hbDir))
+{
+ if ($hbDir ne "")
+ {
+ $imgPath = "$hbDir/";
+ }
+}
+
+if (not $self)
+{
+ $tool = basename $0;
+}
+
+GetOptions("tool:s" => \$tool,
+ "tool-options:s" => \$toolOptions,
+ "test" => \$testImage,
+ "img-path:s" => \$imgPath,
+ "help" => \$cfgHelp,
+ "toolhelp" => \$toolHelp,
+ "force-hrmor:o" => \$forceHRMOR,
+ "man" => \$cfgMan) || pod2usage(-verbose => 0);
+pod2usage(-verbose => 1) if $cfgHelp;
+pod2usage(-verbose => 2) if $cfgMan;
+pod2usage(-verbose => 0) if ($tool eq "");
+
+if ($toolHelp)
+{
+ callToolModuleHelp($tool);
+}
+else
+{
+ # Determine the full image path.
+ $imgPath = determineImagePath($imgPath);
+
+ # Parse tool options and call module.
+ parseToolOpts($toolOptions);
+ callToolModule($tool);
+}
+
+exit 0;
+
+# @sub userDisplay
+#
+# Display parameters to the user.
+#
+# @param varargs - Items to display to the user.
+#
+sub userDisplay
+{
+ foreach my $value (@_)
+ {
+ print $value;
+ }
+}
+
+
+# @sub getImgPath
+#
+# Return file-system path to .../img/ subdirectory containin debug files.
+#
+sub getImgPath
+{
+ return $imgPath;
+}
+
+# @sub getIsTest
+#
+# Return boolean to determine if tools should look at test debug files or
+# normal debug files.
+#
+sub getIsTest
+{
+ return $testImage;
+}
+
+# @sub getEnv
+#
+# Return the environment that we are running in.
+#
+sub getEnv
+{
+ return "hw";
+}
+
+# @sub getHRMOR
+#
+# Returns the HRMOR (128MB for a real system).
+#
+sub getHRMOR
+{
+ return $forceHRMOR;
+}
+
+# @sub readData
+#
+# Reads a data blob from the system.
+#
+# @param addr - Address to read at.
+# @param size - Size (in bytes) to read.
+#
+# @return The blob of data requested.
+#
+sub readData
+{
+ my $addr = shift;
+ my $size = shift;
+
+ $addr = translateHRMOR($addr);
+
+ my (undef, $debugfile) = tempfile(OPEN => 0);
+ my (undef, $filename) = tempfile(OPEN => 0);
+ my $command = sprintf("cipgetmempba -fb %s %x %d -quiet > %s",
+ $filename,
+ $addr,
+ $size,
+ $debugfile);
+ if (system($command) != 0)
+ {
+ system("cat $debugfile");
+ }
+ unlink $debugfile;
+
+ my $result;
+ open FILE, $filename or die
+ "ERROR: $filename not found attempting getmempba";
+ binmode FILE;
+ read FILE, $result, $size;
+ close FILE;
+ unlink $filename;
+
+ return $result;
+}
+
+# @sub writeData
+#
+# Write a data blob to the system.
+#
+# @param addr - Address to read at.
+# @param size - Size (in bytes) to read.
+# @param value - Value to write.
+#
+sub writeData
+{
+ my $addr = shift;
+ my $size = shift;
+ my $value = shift;
+
+ $addr = translateHRMOR($addr);
+
+ my (undef, $debugfile) = tempfile(OPEN => 0);
+ my ($file, $filename) = tempfile();
+ binmode $file;
+ print $file $value;
+ close $file;
+
+ my $command = sprintf("cipputmempba -cft -fb %s %x -quiet > %s",
+ $filename,
+ $addr,
+ $debugfile);
+ ::userDisplay($command);
+ if (system($command) != 0)
+ {
+ system("cat $debugfile");
+ }
+ unlink $debugfile;
+
+ unlink $filename;
+
+ return;
+}
+
+# @sub readScom
+#
+# Perform a getscom operation.
+#
+# @param addr - Address to read at.
+# @param size - Size (in bytes) to read.
+#
+# @return Data from scom.
+#
+sub readScom
+{
+ my $addr = shift;
+ my $size = shift;
+
+ my $command = sprintf("getscom pu %x -quiet -ox",
+ $addr);
+ open OUTPUT, "$command |";
+ my $result = <OUTPUT>;
+ close OUTPUT;
+
+ $result =~ s/.*0x//;
+ $result = pack "H*", $result;
+
+ return $result;
+}
+
+# @sub writeScom
+#
+# Perform a putscom operation.
+#
+# @param addr - Address to write at.
+# @param size - Size (in bytes) to write.
+# @param data - Data to write.
+#
+sub writeScom
+{
+ my $addr = shift;
+ my $size = shift;
+ my $data = shift;
+
+ $data = unpack "H*", $result;
+
+ my $command = sprintf("putscom pu %x %s -quiet > /dev/null",
+ $addr, $data);
+
+ system($command);
+
+ return;
+}
+
+# @sub executeInstrCycles
+#
+# Execute a number of cycles.
+#
+# @param cycles - Number of cycles to execute.
+#
+sub executeInstrCycles
+{
+ my $cycles = shift;
+
+ system(sprintf "ecmddelay %dcycles", $cycles);
+}
+
+# @sub readyForInstructions
+#
+# Determines if system can execute cycles.
+#
+sub readyForInstructions
+{
+ return 1;
+}
+
+# @sub readExtImage
+#
+# Reads from the extended image file.
+#
+# @param addr - Address to read.
+# @param size - Size to read.
+sub readExtImage
+{
+ my $addr = shift;
+ my $size = shift;
+
+ my $extImage = extImageFile();
+
+ seek $extImage, $addr, SEEK_SET;
+
+ my $result = "";
+ read $extImage, $result, $size;
+
+ return $result;
+}
+
+# @sub extImageFile
+#
+# Returns a file descriptor to the extended image file.
+#
+my $extImage = 0;
+sub extImageFile
+{
+ if ($extImage == 0)
+ {
+ my $path = determineImagePath(getImgPath());
+
+ if (getIsTest())
+ {
+ $path = $path . "hbicore_test_extended.bin";
+ }
+ else
+ {
+ $path = $path . "hbicore_extended.bin";
+ }
+
+ print $path."\n";
+
+ open($extImage, "< $path") or die "Cannot find extended image";
+ binmode($extImage);
+ }
+
+ return $extImage;
+}
+
+##
+## Dummy function to match continuous trace call in VPO
+##
+sub checkContTrace
+{
+
+}
+
+
+__END__
+
+=head1 NAME
+
+ecmd-debug-framework.pl
+
+=head1 SYNOPSIS
+
+ecmd-debug-framework.pl [options] --tool=<module>
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<--tool>=MODULE
+
+Identify the tool module to execute.
+
+=item B<--tool-options>="OPTIONS"
+
+List of arguments to pass to the tool as options.
+
+=item B<--force-hrmor>=value
+
+Set the HRMOR to be a non-default value. The default is 128MB.
+
+=item B<--toolhelp>
+
+Displays the help message for a specific debug tool.
+
+=item B<--test>
+
+Use the hbicore_test.syms file instead of the default.
+
+=item B<--img-path>=PATH
+
+The path to the "img" directory where the syms file, etc is located.
+User can also set the env variable HBDIR to the path of the "img"
+directory instead of using this option.
+
+=item B<--help>
+
+Print a brief help message and exits.
+
+=item B<--man>
+
+Prints the manual page and exits.
+
+=back
+
+=head1 DESCRIPTION
+
+Executes a debug tool module against an ecmd target.
+
+=cut
OpenPOWER on IntegriCloud