summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2012-01-30 14:54:47 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-02-07 17:15:01 -0600
commit1ae3dfacaccbcb9bdb1b0e8306118844331a6e10 (patch)
tree3169dcec4299ecfcc5c81d8d283781b316a32e76 /src/build
parent914b46ba52822c63799ebf60ebcc4df200d3371b (diff)
downloadtalos-hostboot-1ae3dfacaccbcb9bdb1b0e8306118844331a6e10.tar.gz
talos-hostboot-1ae3dfacaccbcb9bdb1b0e8306118844331a6e10.zip
RTC 35744: Add Features to hb-istep
- branch save_po_file_setup_clear - bug that prints warning: Argument "<@istepnum>" isn't numeric in array element at ./hb-istep line 253, <FH> line 17. Argument "<@substepnum>" isn't numeric in array element at ./hb-istep line 253, <FH> line 17. This turns out to be caused by one of the new template files. - The istep numbers in Dean's document do not match the istep #'s printed for "hb-istep list" . Suggest removing the istep numbers for now, just list the names. - Currently if you type run by accident and the try "hb-istep istepmode", hb-istep will hang and eventually timeout because HostBoot has run past the point where it checks for istep mode. Suggest adding a global flag to HostBoot that hb-istep script can check to see if hostboot has already checked for Istep mode. - remove scanforisteps.pl and replace with grep/sed/sort line in makefile - this is from an old review with Patrick. - change to new vbutools dir and use HBDIR env variable. Change-Id: I67b01a2078ebe1a7949de55097415f185c5d5261 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/644 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/vpo/VBU_Cacheline.pm118
-rwxr-xr-xsrc/build/vpo/hb-istep270
2 files changed, 246 insertions, 142 deletions
diff --git a/src/build/vpo/VBU_Cacheline.pm b/src/build/vpo/VBU_Cacheline.pm
index 23a1d30da..3c9197ed2 100755
--- a/src/build/vpo/VBU_Cacheline.pm
+++ b/src/build/vpo/VBU_Cacheline.pm
@@ -75,26 +75,9 @@ sub SetFlags;
############################################
my $CLfile = "./istepmodereg.dma";
my $CORE = "-c3";
-my $SIM_CLOCKS = "4000000";
+## my $SIM_CLOCKS = "4000000";
+my $SIM_CLOCKS = "2000000";
-## later...
-my $vbuToolsDir = "/gsa/ausgsa/projects/h/hostboot/vbutools";
-
-
-my $DUMPCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_dump_l3";
-my $LOADCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_load_l3";
-## my $FLUSHCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_l2_flush.x86 $CORE";
-my $FLUSHCMD = "/afs/awd/projects/eclipz/lab/p8/compiled_procs/procs/p8_l2_flush_wrap.x86 $CORE -quiet";
-my $FLUSHQUERY = "/afs/awd.austin.ibm.com/projects/eclipz/lab/p8/gsiexe/p8_check_l3";
-my $RUNCLKSCMD = "simclock";
-
-my $QUERYCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_query";
-my $STOPCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_stop";
-my $STARTCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_start";
-## ## later...
-## ## my $QUERYCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -query";
-## ## my $STOPCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -stop";
-## ## my $STARTCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -start";
#############################################
## Internal Globals
@@ -107,6 +90,42 @@ my $CLtest = 0;
my $L2_Flushed = 0;
+my $vbuToolsDir = "/gsa/ausgsa/projects/h/hostboot/vbutools/latest";
+
+
+my $DUMPCMD = "$vbuToolsDir/p8_dump_l3";
+my $LOADCMD = "$vbuToolsDir/p8_load_l3";
+my $FLUSHCMD = "$vbuToolsDir/p8_l2_flush_wrap.x86 $CORE -quiet";
+my $FLUSHQUERY = "$vbuToolsDir/p8_check_l3";
+my $RUNCLKSCMD = "simclock";
+
+## @todo $$$$$
+## NOTE: need to be able to specify thread (-t ) and core (-c ), they
+## should not be hardwired
+my $QUERYCMD = "$vbuToolsDir/p8_thread_control.x86 -query $CORE -t0";
+my $STOPCMD = "$vbuToolsDir/p8_thread_control.x86 -stop $CORE -tall";
+my $STARTCMD = "$vbuToolsDir/p8_thread_control.x86 -start $CORE -tall";
+
+my $RESETCMD = "$vbuToolsDir/p8_thread_control.x86 -sreset_auto $CORE";
+
+
+## old dirs and tools, SAVE
+## my $DUMPCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_dump_l3";
+## my $LOADCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_load_l3";
+## ## my $FLUSHCMD = "/afs/awd/projects/eclipz/lab/p8/gsiexe/p8_l2_flush.x86 $CORE";
+## my $FLUSHCMD = "/afs/awd/projects/eclipz/lab/p8/compiled_procs/procs/p8_l2_flush_wrap.x86 $CORE -quiet";
+## my $FLUSHQUERY = "/afs/awd.austin.ibm.com/projects/eclipz/lab/p8/gsiexe/p8_check_l3";
+## my $RUNCLKSCMD = "simclock";
+
+## my $QUERYCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_query";
+## my $STOPCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_stop";
+## my $STARTCMD = "/gsa/pokgsa/home/m/c/mcguirej/public/auto/rel/P8bin/p8_ins_start";
+## ## ## later...
+## ## ## my $QUERYCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -query";
+## ## ## my $STOPCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -stop";
+## ## ## my $STARTCMD = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86 -start";
+
+
##
#==============================================================================
# SUBROUTINES
@@ -124,7 +143,7 @@ sub readcacheline( $ )
## my $hexaddr = sprintf( "0x%x", $addr );
my $hexaddr = sprintf( "%x", $addr );
- if ( $CLdebug ) { print STDOUT "-- Read cacheline at $hexaddr...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- Read cacheline at $hexaddr...\n"; }
## Stop simulation so we can read L3 properly
P8_Ins_Stop();
@@ -133,7 +152,7 @@ sub readcacheline( $ )
P8_Flush_L2();
$cmd = "$DUMPCMD $hexaddr 1 -f $CLfile -b $CORE";
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- run $cmd ...\n"; }
( system( $cmd ) == 0 )
or die "$cmd failed $? : $! \n";
@@ -194,7 +213,7 @@ sub writecacheline( $ )
P8_Ins_Stop();
$cmd = "$LOADCMD -o $hexaddr -f $CLfile -b $CORE";
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- run $cmd ...\n"; }
( system( $cmd ) == 0 )
or die "$cmd failed, $? : $! \n";
@@ -212,24 +231,24 @@ sub P8_Ins_Query()
my $cmd = "$QUERYCMD";
my $retstr = "";
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- run $cmd ...\n"; }
## execute it with backticks so we can get the output.
$retstr = `$cmd`;
if ( $? != 0 ) { die "$cmd failed $? : $! \n"; }
- chomp( $retstr );
-
- if ( $CLdebug ) { print STDOUT "-- P8_Ins_Query returned $retstr\n"; }
-
- if ( ($retstr ne "STOPPED" )
- && ($retstr ne "RUNNING" )
- )
+ if ( $retstr =~ m/Quiesced/ )
+ {
+ return "STOPPED";
+ }
+ elsif ( $retstr =~ m/Running/ )
+ {
+ return "RUNNING";
+ }
+ else
{
die "invalid string \"$retstr\" from P8_Ins_Query\n";
- }
-
- return $retstr;
+ }
}
@@ -242,7 +261,10 @@ sub P8_Ins_Start()
if ( P8_Ins_Query() eq "STOPPED" )
{
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( !$CLdebug )
+ { $cmd .= " -quiet"; }
+ else
+ { print STDERR __LINE__, "-- run $cmd ...\n"; }
( system( $cmd ) == 0 )
or die "$cmd failed $? : $! \n";
@@ -253,7 +275,7 @@ sub P8_Ins_Start()
}
else
{
- if ($CLdebug) { print STDOUT "-- P8_Ins_Start: already RUNNING\n"; }
+ if ($CLdebug) { print STDERR __LINE__, "-- P8_Ins_Start: already RUNNING\n"; }
}
}
@@ -268,14 +290,18 @@ sub P8_Ins_Stop()
if ( P8_Ins_Query() eq "RUNNING" )
{
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( ! $CLdebug )
+ { $cmd .= " -quiet"; }
+ else
+ { print STDERR __LINE__, "-- run $cmd ...\n"; }
+
( system( $cmd ) == 0 )
or die "$cmd failed $? : $! \n";
}
else
{
- if ($CLdebug) { print STDOUT "-- P8_Ins_Stop: already STOPPED\n"; }
+ if ($CLdebug) { print STDERR __LINE__, "-- P8_Ins_Stop: already STOPPED\n"; }
}
}
@@ -323,7 +349,7 @@ sub P8_Flush_L2()
if ( !$L2_Flushed )
{
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- run $cmd ...\n"; }
( system( $cmd ) == 0 )
or die "$cmd failed $? : $! \n";
@@ -331,7 +357,7 @@ sub P8_Flush_L2()
$L2_Flushed = 1;
}
- if ($CLdebug) { print STDOUT "-- P8_FLush_L2 : $L2_Flushed\n"; }
+ if ($CLdebug) { print STDERR __LINE__, "-- P8_FLush_L2 : $L2_Flushed\n"; }
}
@@ -343,7 +369,7 @@ sub RunClocks()
{
my $cmd = 0;
- if ( $CLdebug ) { printf STDOUT "-- RunClocks()\n"; }
+ if ( $CLdebug ) { printf STDERR __LINE__, "-- RunClocks()\n"; }
## Check, and start instructions if necessary
if ( P8_Ins_Query( ) ne "RUNNING" )
@@ -353,7 +379,7 @@ sub RunClocks()
}
$cmd = "$RUNCLKSCMD $SIM_CLOCKS -quiet";
- if ( $CLdebug ) { print STDOUT "-- run $cmd ...\n"; }
+ if ( $CLdebug ) { print STDERR __LINE__, "-- run $cmd ...\n"; }
( system( $cmd ) == 0 )
or die "$cmd failed, $? : $! \n";
@@ -372,7 +398,7 @@ sub CLread( $ )
my $CLoffset = ( hex($addr) & (~0xffffff80) );
my $result = 0; ## 64-bit hex
- if ( $CLdebug ) { printf STDOUT "-- CLread( %s ) : CLbase=0x%x, CLoffset=0x%x\n", $addr, $CLbase, $CLoffset }
+ if ( $CLdebug ) { printf STDERR __LINE__, "-- CLread( %s ) : CLbase=0x%x, CLoffset=0x%x\n", $addr, $CLbase, $CLoffset }
readcacheline( $CLbase );
@@ -393,7 +419,7 @@ sub CLread( $ )
if ( $CLdebug )
{
- printf STDOUT "-- CLread( %s ) = 0x%lx ", $addr, $result;
+ printf STDERR __LINE__, "-- CLread( %s ) = 0x%lx ", $addr, $result;
dumpcacheline(" " );
}
@@ -412,7 +438,7 @@ sub CLwrite( $$ )
my $CLdata = hex($data);
my $result = 0;
- if ( $CLdebug ) { printf STDOUT "-- CLwrite( %s, %s ) : CLbase=0x%x, CLoffset=0x%x, CLdata=0x%lx\n",
+ if ( $CLdebug ) { printf STDERR __LINE__, "-- CLwrite( %s, %s ) : CLbase=0x%x, CLoffset=0x%x, CLdata=0x%lx\n",
$addr, $data, $CLbase, $CLoffset, $CLdata; }
## clear the cacheline file
@@ -448,7 +474,7 @@ sub dumpcacheline()
if ( $CLdebug )
{
- print STDOUT "-- $comment, dump cache file :\n";
+ print STDERR __LINE__, "-- $comment, dump cache file :\n";
system( "xxd $CLfile" );
}
@@ -463,7 +489,7 @@ sub SetFlags( $$ )
if ( $CLdebug )
{
- print STDOUT "-- CLdebug=$CLdebug, CLtest=$CLtest\n";
+ print STDERR __LINE__, "-- CLdebug=$CLdebug, CLtest=$CLtest\n";
}
}
diff --git a/src/build/vpo/hb-istep b/src/build/vpo/hb-istep
index ba4630a14..da29eaf00 100755
--- a/src/build/vpo/hb-istep
+++ b/src/build/vpo/hb-istep
@@ -50,6 +50,8 @@ use strict;
use warnings;
use POSIX;
use Getopt::Long;
+use File::Basename;
+use lib dirname (__FILE__);
## 64-bit input
## argh, not compatable with GetOpt!! use bigint;
@@ -61,6 +63,7 @@ use VBU_Cacheline;
#------------------------------------------------------------------------------
# Forward Declaration
#------------------------------------------------------------------------------
+sub main;
sub printUsage;
sub get_istep_list;
sub print_istep_list;
@@ -72,9 +75,9 @@ sub resume_istep;
#------------------------------------------------------------------------------
# Constants
#------------------------------------------------------------------------------
-my $CSVfile = "isteplist.csv";
-my $hbSymsFile = "hbicore.syms"; #Use hbicore.syms
my $CORE = "-c3";
+my $ISTEP_MODE_ON_SIGNATURE = "4057b0074057b007";
+my $ISTEP_MODE_OFF_SIGNATURE = "700b7504700b7504";
#------------------------------------------------------------------------------
@@ -86,8 +89,10 @@ my $opt_normalmode = 0;
my $opt_command = "";
my $opt_list = 0;
my $opt_help = 0;
-my $opt_cmdfile = 0; ## batchmode, later
my $opt_resume = 0; ## resume istep from break point
+my $opt_clear_trace = 0; ## submit command 01
+my $opt_cmdfile = 0; ## batchmode, later
+my $opt_setup = ""; ## run Jim's script to start up the model
my @inList;
$inList[10][10] = ();
@@ -108,80 +113,124 @@ my $g_SeqNum = 0;
#==============================================================================
## get any environment variables
+## Assume that all the tools, files, etc are in the same directory that
+## we are in.
+
+
+my $pgmDir = `dirname $0`;
+chomp( $pgmDir );
+
my $hbDir = $ENV{'HBDIR'};
-if (defined ($hbDir))
+if ( ! defined( $hbDir) || ( $hbDir eq "" ) )
{
- unless ($hbDir ne "")
- {
- $hbDir = '.'; #Set to current directory
- }
-}
-else
-{
- $hbDir = '.'; #Set to current directory
-}
+ $hbDir = $pgmDir; ## Set to tool directory
+}
-# print $#ARGV;
-if ( ($#ARGV < 0) or ($opt_help) )
+my $CSVfile = "$hbDir/isteplist.csv";
+my $hbSymsFile = "$hbDir/hbicore.syms"; #Use hbicore.syms
+
+## print $#ARGV;
+if ( $#ARGV < 0 )
{
printUsage();
exit 0 ;
}
-
-
#------------------------------------------------------------------------------
# Parse optional input arguments
#------------------------------------------------------------------------------
-GetOptions( "help" => \$opt_help,
+GetOptions( "help|?" => \$opt_help,
"istepmode" => \$opt_istepmode,
"normalmode" => \$opt_normalmode,
"list" => \$opt_list,
"command=s" => \$opt_command,
- "cmdfile" => \$opt_cmdfile,
- "resume" => \$opt_resume,
-
+ "resume" => \$opt_resume,
+ "clear-trace" => \$opt_clear_trace,
+ "cmdfile" => \$opt_cmdfile,
+ "setup=s" => \$opt_setup,
+
"debug" => \$opt_debug,
);
-
+
+##-----------------------------------------------------------------------------
+## check for access to the files we need.
+##-----------------------------------------------------------------------------
+if ( ! -e "$hbSymsFile" ) { die "Can't find symbols file $hbSymsFile\n"; }
+if ( ! -e "$CSVfile" ) { die "Can't find isteplist file $hbSymsFile\n"; }
+
##
-## find the istep mode, command, and status registers in the syms file
+## find the istep mode, command, and status registers in the syms file
+## find the location of clear_trace in HostBoot
##
-my $istepmodereg = `grep "SPLESS::g_SPLess_IStepMode_Reg" $hbDir/$hbSymsFile | awk -F"," '{print \$2}'`;
+my $istepmodereg = `grep "SPLESS::g_SPLess_IStepMode_Reg" $hbSymsFile | awk -F"," '{print \$2}'`;
chomp $istepmodereg;
-my $commandreg = `grep "SPLESS::g_SPLess_Command_Reg" $hbDir/$hbSymsFile | awk -F"," '{print \$2}'`;
+my $commandreg = `grep "SPLESS::g_SPLess_Command_Reg" $hbSymsFile | awk -F"," '{print \$2}'`;
chomp $commandreg;
-my $statusreg = `grep "SPLESS::g_SPLess_Status_Reg" $hbDir/$hbSymsFile | awk -F"," '{print \$2}'` ;
+my $statusreg = `grep "SPLESS::g_SPLess_Status_Reg" $hbSymsFile | awk -F"," '{print \$2}'` ;
chomp $statusreg;
+
+##-----------------------------------------------------------------------------
+## Start processing options
+##-----------------------------------------------------------------------------
if ( $opt_debug )
{
- print STDOUT "istepmode = $opt_istepmode\n";
- print STDOUT "normalmode = $opt_normalmode\n";
- print STDOUT "command = $opt_command\n";
- print STDOUT "debug = $opt_debug\n";
+ print STDERR "\n----- DEBUG: ----------------------------------- \n";
+ print STDERR "help = $opt_help\n";
+ print STDERR "istepmode = $opt_istepmode\n";
+ print STDERR "normalmode = $opt_normalmode\n";
+ print STDERR "list = $opt_list\n";
+ print STDERR "command = $opt_command\n";
+ print STDERR "cmdfile = $opt_cmdfile\n";
+ print STDERR "setup = $opt_setup\n";
+ print STDERR "clear-trace = $opt_clear_trace\n";
+ print STDERR "debug = $opt_debug\n";
- print STDOUT "hbDir = $hbDir\n";
- print STDOUT "hbSymsFile = $hbSymsFile\n";
- print STDOUT "istepmodereg = $istepmodereg\n";
- print STDOUT "commandreg = $commandreg\n";
- print STDOUT "statusreg = $statusreg\n";
+ print STDERR "pgmDir = $pgmDir\n";
+ print STDERR "hbDir = $hbDir\n";
+ print STDERR "hbSymsFile = $hbSymsFile\n";
+ print STDERR "istepmodereg = $istepmodereg\n";
+ print STDERR "commandreg = $commandreg\n";
+ print STDERR "statusreg = $statusreg\n";
VBU_Cacheline::SetFlags( 1, 0 );
-}
-
-
-## fetch the ISTEP csv list
-get_istep_list();
+}
-if ( $opt_list )
+if ( $opt_help )
{
- print_istep_list();
+ printUsage();
exit;
}
+##
+## run the main loop. Yes, I did this on purpose.
+## Idea is (later) to pass this an array / hash of options and use
+## GetOptionsFromArray() to parse them.
+## That way I can either pass it @ARGV or an array processed from the cmdfile
+##
+main();
+
+
+
+#==============================================================================
+# SUBROUTINES
+#==============================================================================
+sub main()
+{
+ print STDOUT "\n";
+
+ ## fetch the ISTEP csv list
+ get_istep_list();
+
+ if ( $opt_list )
+ {
+ print_istep_list();
+ exit;
+ }
+
+
## VPO cannot be running when we start.
my $qstr = VBU_Cacheline::P8_Ins_Query();
if ( $qstr ne "STOPPED" )
@@ -190,46 +239,54 @@ if ( $opt_list )
VBU_Cacheline::P8_Ins_Stop();
}
-##
-## Process resume
-##
-if ( $opt_resume )
-{
- resume_istep();
- ## exit; ??
-}
-##
-## process --Istep Mode command
-## IStepModeStr = "cpu0_0_0_3->scratch=0x4057b007_4057b007"
-## NormalModeStr = "cpu0_0_0_3->scratch=0x700b7504_700b7504"
-##
-if ( $opt_istepmode == 1 )
-{
- print STDOUT "ENable istepmode\n";
- setMode( "istep" );
-}
+ ##
+ ## Process resume
+ ##
+ if ( $opt_resume )
+ {
+ resume_istep();
+ ## exit; ??
+ }
-if ( $opt_normalmode == 1 )
-{
- print STDOUT "DISable istepmode\n";
- setMode( "normal" );
-}
+ ##
+ ## process --Istep Mode command
+ ## IStepModeStr = "cpu0_0_0_3->scratch=0x4057b007_4057b007"
+ ## NormalModeStr = "cpu0_0_0_3->scratch=0x700b7504_700b7504"
+ ##
+ if ( $opt_istepmode == 1 )
+ {
+ my $result = VBU_Cacheline::CLread( $istepmodereg );
+ if ( $opt_debug ) { print STDERR __LINE__, "-- Entry: IStep Mode Reg = $result"; }
+ if ( $result =~ /^.*$ISTEP_MODE_OFF_SIGNATURE/ )
+ {
+ print STDOUT "Sorry, HostBoot has already started in automatic mode. Please restart and then try again.\n";
+ exit;
+ }
-##
-## Process other commands
-##
-if ( $opt_command ne "" )
-{
- if ( $opt_debug ) { print STDOUT "== process command \"$opt_command\" \n"; }
- parse_command( $opt_command );
-}
+ print STDOUT "ENable istepmode\n";
+ setMode( "istep" );
+ }
+ if ( $opt_normalmode == 1 )
+ {
+ print STDOUT "DISable istepmode\n";
+ setMode( "normal" );
+ }
+
+
+ ##
+ ## Process other commands
+ ##
+ if ( $opt_command ne "" )
+ {
+ if ( $opt_debug ) { print STDERR "== __LINE__ process command \"$opt_command\" \n"; }
+ parse_command( $opt_command );
+ }
+
+} ## end main
-#==============================================================================
-# SUBROUTINES
-#==============================================================================
#------------------------------------------------------------------------------
# Print command line help
@@ -244,18 +301,23 @@ sub printUsage()
print STDOUT " [--command <foo>] (run named istep \"foo\")\n" ;
print STDOUT " [--command <foo>..<bar>] (run named isteps \"foo\" through \"bar\")\n" ;
print STDOUT " [--resume] (resume an istep that is at a break point)\n" ;
-
print STDOUT "\n" ;
+## print STDOUT " [--cmdfile] (get commands from a batchfile)\n";
+## print STDOUT " [--setup] (bring up AWAN and wait for further commands)\n";
+## print STDOUT " [--clear-trace] (clear trace buffers before starting)\n";
+## print STDOUT "\n" ;
}
+##
## read in file with csv istep list and store in inList
+##
sub get_istep_list()
{
my $istep, my $substep, my $name ;
- open( FH, "< $hbDir/$CSVfile") or die "can't open $hbDir/$CSVfile : $!";
+ open( FH, "< $CSVfile") or die "can't open $CSVfile : $!";
while( <FH> )
{
@@ -270,6 +332,9 @@ sub get_istep_list()
close( FH );
}
+##
+## print the istep list to the screen.
+##
sub print_istep_list( )
{
my $hdrflag = 1;
@@ -299,6 +364,10 @@ sub print_istep_list( )
} ## end for $i
}
+
+##
+##
+##
sub find_in_inList( $ )
{
my ( $substepname ) = @_;
@@ -322,7 +391,7 @@ sub find_in_inList( $ )
##
## keep trying to get status until seqnum syncs up
-
+##
sub getSyncStatus( )
{
# set # of retries
@@ -343,7 +412,7 @@ sub getSyncStatus( )
## dump printk similar to the Jim McGuire's script
## dumpPrintk();
- $result = CLread( $statusreg );
+ $result = VBU_Cacheline::CLread( $statusreg );
$seqnum = ( ( $result & 0x3f00000000000000 ) >> 56 );
if ( $seqnum == $g_SeqNum )
{
@@ -360,6 +429,9 @@ sub getSyncStatus( )
}
+##
+## Run an istep
+##
sub runIStep( $$ )
{
my ( $istep, $substep) = @_;
@@ -403,12 +475,12 @@ sub runIStep( $$ )
printf STDOUT "Istep %d.%d returned Status: 0x%x\n", $stsIStep, $stsSubstep, $istepStatus ;
}
print STDOUT "-----------------------------------------------------------------\n";
- }
-
+ }
}
-
-## run command = "sN"
+##
+## run command = "sN"
+##
sub sCommand( $ )
{
my ( $scommand ) = @_;
@@ -436,8 +508,10 @@ sub sCommand( $ )
}
}
-
-sub parse_command()
+##
+## parse --command [command] option and execute it.
+##
+sub parse_command( $ )
{
my ( $command ) = @_;
my @execlist;
@@ -450,13 +524,13 @@ sub parse_command()
if ( $command =~ m/^s+[0-9].*/ )
{
## run "s" command
- if ($opt_debug) { print STDOUT "===== s command : ", $command, ":\n"; }
+ if ($opt_debug) { print STDERR __LINE__, "===== s command : ", $command, ":\n"; }
substr( $command, 0, 1, "" );
if ( isdigit( $command ) )
{
# command = "sN"
- if ($opt_debug) { print STDOUT "===== single IStep: ", $command, "\n"; }
+ if ($opt_debug) { print STDERR __LINE__, "===== single IStep: ", $command, "\n"; }
sCommand( $command );
}
else
@@ -464,7 +538,7 @@ sub parse_command()
# list of substeps = "sM..N"
( $M, $N ) = split( /\.\./, $command );
- if ($opt_debug) { print STDOUT "===== multiple ISteps: ", $M, "-", $N, "\n"; }
+ if ($opt_debug) { print STDERR "===== multiple ISteps: ", $M, "-", $N, "\n"; }
for ( my $x=$M; $x<$N+1; $x++ )
{
sCommand( $x );
@@ -476,7 +550,7 @@ sub parse_command()
## <substep name>, or <substep name>..<substep name>
@ss_list = split( /\.\./, $command );
- if ($opt_debug) { print STDOUT "===== named commands : ", @ss_list, "\n"; }
+ if ($opt_debug) { print STDERR __LINE__, "===== named commands : ", @ss_list, "\n"; }
( $istepM, $substepM, $foundit) = find_in_inList( $ss_list[0] );
$istepN = $istepM;
@@ -511,8 +585,10 @@ sub parse_command()
}
}
-## write to scratch reg 3 to set istep or normal mode, check return status
-sub setMode( )
+##
+## write to scratch reg 3 to set istep or normal mode, check return status
+##
+sub setMode( $ )
{
my ( $cmd ) = @_;
my $count = 0;
@@ -540,8 +616,8 @@ sub setMode( )
if ( $opt_debug )
{
## readback and display
- $result = CLread( $istepmodereg );
- printf STDOUT "===== istepmodereg readback: 0x%lx\n", $result ;
+ $result = VBU_Cacheline::CLread( $istepmodereg );
+ printf STDERR __LINE__, "===== istepmodereg readback: 0x%lx\n", $result ;
}
@@ -553,12 +629,12 @@ sub setMode( )
## sequence number to see if it has changed. rinse and repeat.
VBU_Cacheline::RunClocks();
- $result = CLread( $statusreg );
+ $result = VBU_Cacheline::CLread( $statusreg );
$readybit = ( ( $result & 0x4000000000000000 ) >> 62 );
if ($opt_debug)
- { printf STDOUT "===== setMode: count=%d, result=0x%lx, readybit=0x%x\n", $count, $result, $readybit }
+ { printf STDERR __LINE__, "===== setMode: count=%d, result=0x%lx, readybit=0x%x\n", $count, $result, $readybit }
if ( $readybit == $expected )
{
@@ -576,6 +652,7 @@ sub setMode( )
}
}
+
sub resume_istep()
{
my $byte0;
@@ -618,3 +695,4 @@ sub resume_istep()
}
__END__
+
OpenPOWER on IntegriCloud