summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-08-11 15:22:50 -0500
committerMark W. Wenning <wenning@us.ibm.com>2011-08-17 11:50:30 -0500
commiteede7fac946b94294433c675a6ed6c135a53b4fc (patch)
treeb8fb669896f646ca0a0e772deb07d46c30dea5a3 /src
parent04a01c63da3f9afc08b71c863127299e2d22462f (diff)
downloadtalos-hostboot-eede7fac946b94294433c675a6ed6c135a53b4fc.tar.gz
talos-hostboot-eede7fac946b94294433c675a6ed6c135a53b4fc.zip
RTC3582: Allow control of ISTEPs within HostBoot: "hb-istep" commands in python script to drive Simics and VBU console
- initial commit - working version - comment out debug prints - name/path of traceHB.py changed, had to change citest - fixes after review - fixes after review2 Change-Id: I5da961106052ae0b50bdaf68556a42538f2a8a40 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/258 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/citest/autocitest13
-rwxr-xr-xsrc/build/simics/hb-simdebug.py (renamed from src/build/trace/traceHB.py)246
-rwxr-xr-xsrc/build/simics/post_model_hook.simics2
-rwxr-xr-xsrc/build/tools/cpfiles.pl25
4 files changed, 273 insertions, 13 deletions
diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest
index fd92785e3..c604b35c6 100755
--- a/src/build/citest/autocitest
+++ b/src/build/citest/autocitest
@@ -40,7 +40,6 @@ function usage()
echo "usage:"
echo "$0 [--quiet] backing_tree_dir sandbox_name path_to_hbicore_test_img "
-
}
@@ -88,7 +87,7 @@ function runtraceHB()
exit 1
fi
- autosim $NOWIN --simcmd "run-python-file ${SBXHOME}/src/build/trace/traceHB.py"
+ autosim $NOWIN --simcmd "run-python-file ${SBXHOME}/src/build/simics/hb-simdebug.py"
if [ $? -ne 0 ] ; then
echo "ERROR 3: Unable to run $?"
stopsim
@@ -107,7 +106,7 @@ function runtraceHB()
}
-## mww verbose is the default.
+## verbose is the default.
VERBOSE=" --verbose"
if [ "$1" = "--quiet" ] ; then
VERBOSE=""
@@ -425,10 +424,10 @@ fi
echo "====> dump trace buffer(s)..."
runtraceHB 1> $SBXHOME/traceHB.log 2> /dev/null
if [ $? -ne 0 ] ; then
-echo "ERROR: Unable to run $?"
- stopsim
- stopserver
-exit 1
+ echo "ERROR: Unable to run $?"
+ stopsim
+ stopserver
+ exit 1
fi
########################################################
diff --git a/src/build/trace/traceHB.py b/src/build/simics/hb-simdebug.py
index bf1d46a46..44af5a098 100755
--- a/src/build/trace/traceHB.py
+++ b/src/build/simics/hb-simdebug.py
@@ -1,4 +1,21 @@
-# *** traceHB.py
+#############################################################################
+# $IBMCopyrightBlock:
+#
+# IBM Confidential
+#
+# Licensed Internal Code Source Materials
+#
+# IBM HostBoot Licensed Internal Code
+#
+# (C) Copyright IBM Corp. 2011
+#
+# 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.
+#$
+#############################################################################
+
+# *** hb-simdebug.py
#
# Script to extract and display formatted trace in simics
@@ -18,6 +35,7 @@ import configuration
import cli
import binascii
import datetime
+import commands ## getoutput, getstatusoutput
#------------------------------------------------------------------------------
# Function to dump the trace buffers
@@ -225,8 +243,179 @@ def dumpL3():
#------------------------------------------------------------------------------
-# Function to dump L3
+# Functions to run isteps
#------------------------------------------------------------------------------
+def print_istep_list( inList ):
+
+ zinList = [ "i0_sub0 0 CG F IStep0 substep0", \
+ "i0_sub1 0 CG F IStep1 substep1", \
+ "i1_sub0 1 CG F IStep1 substep1", \
+ "i55sub55 55 CG F bogus istep", \
+ ]
+ print
+ print "istep commands:."
+ print " istepmode - set IStep Mode flag in SCOM reg"
+ print
+ print "-----------------------------------------------------------"
+ print " StepName Num Who Mode Description "
+ print "-----------------------------------------------------------"
+ for line in zinList:
+ print line.strip()
+ print
+ print " Key:"
+ print " Who ---- "
+ print " C = Cronus"
+ print " G = GFW"
+ print " Mode ---- "
+ print " F = Fast Mode"
+ print " S = Slow Mode (Fast Mode + more)"
+ print " M = Manufacturing Mode"
+ return
+
+# normally this would be a loop to watch for the runningbit.
+# currently simics dumps all sorts of error lines every time a SCOM is
+# read, so HostBoot only updates every 1 sec. at that rate we only
+# need to sleep for 2 sec and we are sure to get it.
+# redo later after simics is fixed ...
+def getStatusReg():
+ ##StatusStr = "salerno_chip.regdump SCOM 0x13012685"
+ ## -f <file> dumps the output to <file>_SCOM_0X13012685
+ StatusStr = "salerno_chip.regdump SCOM 0x13012685 -f ./scom.out"
+
+ ## get response
+ (result, statusOutput) = quiet_run_command( StatusStr, output_modes.regular )
+ ## HACK: quiet_run_command() only returns the first line of a 4-line
+ ## output, pipe all lines to a file and then read it back.
+ file = open( "./scom.out_SCOM_0X13012685", "rU" )
+ statusOutput = file.readlines()
+ file.close()
+
+ #print result
+ #print "............"
+ #print statusOutput[0]
+ #print statusOutput[1]
+ #print statusOutput[2]
+ #print "..........."
+
+ (j1, j2, j3, j4, hiword, loword) = statusOutput[2].split()
+ return (hiword, loword)
+
+
+
+# normally this would be a loop to watch for the runningbit.
+# currently simics dumps all sorts of error lines every time a SCOM is
+# read, so HostBoot only updates every 1 sec. at that rate we only
+# need to sleep for 2 sec and we are sure to get it.
+# redo later after simics is fixed ...
+def runIStep( istep, substep, inList ):
+ print "------------------------------------------------------------------"
+ print "run %s :"%( inList[istep][substep] )
+ print " istep # = 0x%x / substep # = 0x%x :"%(istep, substep)
+
+ CommandStr = "salerno_chip.regwrite SCOM 0x13012684 \"0x80000000_%4.4x%4.4x\" 64"%(istep,substep)
+
+ #result = run_command( "run" )
+
+ ## send command to Hostboot
+ # print CommandStr
+ (result, out) = quiet_run_command(CommandStr, output_modes.regular )
+ #print result
+
+ time.sleep(2)
+
+ # result = run_command( "stop" )
+
+ (hiword, loword) = getStatusReg()
+ print hiword + " " + loword
+ runningbit = ( ( int(hiword,16) & 0x80000000 ) >> 31 )
+ readybit = ( ( int(hiword,16) & 0x40000000 ) >> 30 )
+ stsIStep = ( ( int(hiword,16) & 0x3fff0000 ) >> 16 )
+ stsSubstep = ( ( int(hiword,16) & 0x0000ffff ) )
+ taskStatus = ( ( int(loword,16) & 0xffff0000 ) >> 16 )
+ istepStatus = ( ( int(loword,16) & 0x0000ffff ) )
+ print
+ print "%s : returned Status : "%( inList[istep][substep] )
+ print "runningbit = 0x%x, readybit=0x%x"%(runningbit, readybit)
+ print "Istep 0x%x / Substep 0x%x Status: 0x%x 0x%x"%( stsIStep, stsSubstep, taskStatus, istepStatus )
+ print "-----------------------------------------------------------------"
+
+## run command = "sN"
+def sCommand( inList, scommand ) :
+ i = int(scommand)
+ j = 0
+ for substep in inList[i] :
+ ## print "-----------------"
+ ##print "run IStep %d %s ..."%(i, substep)
+ ##print "-----------------"
+ runIStep( i, j, inList )
+ j = j+1
+ return
+
+def find_in_inList( inList, substepname) :
+ for i in range(0,len(inList)) :
+ for j in range( 0, len(inList[i])) :
+ #print "%d %d"%(i,j)
+ if ( inList[i][j] == substepname ) :
+ #print "%s %d %d"%( inList[i][j], i, j )
+ return (i,j, True )
+ break;
+
+ return ( len(inList), len(inList[i]), False )
+
+
+## possible commands:
+## list
+## istepmode
+## sN
+## sN..M
+## <substepname1>..<substepname2>
+def istepHB( str_arg1, inList):
+ IStepModeStr = "salerno_chip.regwrite SCOM 0x13012686 \"0x4057b007_4057b007\" 64"
+
+ print "run isteps...."
+
+ if ( str_arg1 == "list" ): ## dump command list
+ print_istep_list( inList)
+ return
+
+ if ( str_arg1 == "istepmode" ): ## set IStep Mode in SCOM reg
+ print "Set Istep Mode"
+ (result, out) = quiet_run_command(IStepModeStr, output_modes.regular )
+ # print result
+ return
+
+ ## check to see if we have an 's' command (string starts with 's')
+ if ( str_arg1.startswith('s') ):
+ ## run "s" command
+ scommand = str_arg1.lstrip('s')
+ if scommand.isdigit():
+ # command = "sN"
+ sCommand( inList, scommand )
+ else:
+ print "multiple ISteps:" + scommand
+ # list of substeps = "sM..N"
+ (M, N) = scommand.split('..')
+ #print M + "-" + N
+ for x in range( (int(M,16)), (int(N,16)+1) ) :
+ sCommand( inList, x )
+ return
+ else:
+ ## substep name .. substep name
+ (ss_nameM, ss_nameN) = str_arg1.split("..")
+ (istepM, substepM, foundit) = find_in_inList( inList, ss_nameM )
+ if ( not foundit ) :
+ print( "Invalid substep %s"%(ss_nameM) )
+ return
+
+ (istepN, substepN, foundit) = find_in_inList( inList, ss_nameN )
+ if ( not foundit ) :
+ print( "Invalid substep %s"%(ss_nameN) )
+ return
+
+ for x in range( istepM, istepN+1 ) :
+ for y in range( substepM, substepN+1) :
+ runIStep( x, y, inList )
+ return
#===============================================================================
@@ -343,3 +532,56 @@ Defaults: \n
Examples: \n
hb-dump \n
""")
+
+#------------------------------------------------
+# implement isteps
+#------------------------------------------------
+def hb_istep(str_arg1):
+
+ ## preprocess inputs,
+ ## read in a file and translate to an inList
+ ## TODO read in default file
+ # TODO inPath = "istep_list.txt"
+ # TODO inFile = open( inPath, 'rU')
+ # TODO inList = inFile.readlines()
+ # TODO inFile.close()
+
+ ## set up demo inlist
+ inList = [ [ "i0_sub0", "i0_sub1" ],
+ [ "i1_sub0" ],
+ ]
+
+ ## print flag_t
+
+ if str_arg1 == None:
+ print_istep_list( inList )
+ else:
+ print "args=%s" % str(str_arg1)
+ istepHB( str_arg1, inList, )
+
+ return None
+
+new_command("hb-istep",
+ hb_istep,
+ [ arg(str_t, "syms", "?", None),
+ # arg(flag_t,"-s", "?", None),
+ ],
+ type = ["hostboot-commands"],
+ see_also = [ ],
+ short = "Run IStep commands using the SPLess HostBoot interface",
+ doc = """
+Parameters: \n
+
+Defaults: \n
+
+Examples: \n
+ hb-istep \n
+ hb-istep -s0 \n
+ hb-istep -s0..4
+ hb-istep poweron
+ hb-istep poweron..clock_frequency_set
+ """)
+
+
+
+ \ No newline at end of file
diff --git a/src/build/simics/post_model_hook.simics b/src/build/simics/post_model_hook.simics
index d87f999bc..46bfc478d 100755
--- a/src/build/simics/post_model_hook.simics
+++ b/src/build/simics/post_model_hook.simics
@@ -30,7 +30,7 @@
#setup traces
-run-python-file traceHB.py
+run-python-file hb-simdebug.py
#Load extended image and pnor.toc into phys_mem
#This will be merged into once the proper tools are written.
diff --git a/src/build/tools/cpfiles.pl b/src/build/tools/cpfiles.pl
index 41182a187..a6e218c63 100755
--- a/src/build/tools/cpfiles.pl
+++ b/src/build/tools/cpfiles.pl
@@ -1,4 +1,21 @@
#!/usr/bin/perl
+#############################################################################
+# $IBMCopyrightBlock:
+#
+# IBM Confidential
+#
+# Licensed Internal Code Source Materials
+#
+# IBM HostBoot Licensed Internal Code
+#
+# (C) Copyright IBM Corp. 2011
+#
+# 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.
+#$
+#############################################################################
+
#
# Purpose: This perl script needs to be executed from the
@@ -34,9 +51,10 @@ sub printUsage;
#List of files to copy. Path is relative to git repository.
my @files = ("src/build/tools/exthbdump.pl",
- "src/build/simics/post_model_hook.simics",
+ "src/build/simics/post_model_hook.simics",
"src/build/trace/traceHB.py",
"src/usr/errl/parser/bin/errlparser",
+ "src/build/simics/hb-simdebug.py",
"img/hbotStringFile",
"img/hbicore.syms",
"img/hbicore_test.syms",
@@ -44,8 +62,9 @@ my @files = ("src/build/tools/exthbdump.pl",
"img/hbicore_test.bin",
"img/hbicore.list",
"img/hbicore_test.list",
- "img/hbicore_extended.bin",
- "img/pnor.toc");
+ "img/hbicore_extended.bin",
+ "img/pnor.toc"
+ );
#Directories in base git repository
my @gitRepoDirs = ("img",
OpenPOWER on IntegriCloud