summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorMonte Copeland <copelanm@us.ibm.com>2011-11-09 14:16:19 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-11-16 12:57:42 -0600
commitc1fd3de01dcf928cfbd917fb9fe08661808e14ba (patch)
tree9aba4ccaaa885911e81485fdb62066da2519d590 /src/build
parentf82613312075baf4ba5bafcf9ed55b1ef9b533eb (diff)
downloadtalos-hostboot-c1fd3de01dcf928cfbd917fb9fe08661808e14ba.tar.gz
talos-hostboot-c1fd3de01dcf928cfbd917fb9fe08661808e14ba.zip
Errl.pm for error log handling via perl debug framework
Change-Id: Idf79ba5e147afba2d98e926b73263adf9714e604 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/489 Tested-by: Jenkins Server Reviewed-by: Monte K. Copeland <copelanm@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/debug/Hostboot/Errl.pm160
-rwxr-xr-xsrc/build/debug/simics-debug-framework.py1
-rwxr-xr-xsrc/build/simics/hb-simdebug.py236
3 files changed, 245 insertions, 152 deletions
diff --git a/src/build/debug/Hostboot/Errl.pm b/src/build/debug/Hostboot/Errl.pm
new file mode 100755
index 000000000..9e8a7efd1
--- /dev/null
+++ b/src/build/debug/Hostboot/Errl.pm
@@ -0,0 +1,160 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/Hostboot/Errl.pm $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2011
+#
+# 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;
+use File::Temp;
+
+package Hostboot::Errl;
+use Exporter;
+our @EXPORT_OK = ('main');
+
+
+sub getTempFileName
+{
+ my $fh = File::Temp->new( TEMPLATE => 'tempXXXXX',
+ DIR => '/tmp',
+ SUFFIX => '.bin', );
+ return $fh->filename;
+}
+
+
+
+sub main
+{
+ my $moduleName = shift;
+ # print "Module name: $moduleName\n";
+
+ my $listArg = " -l "; # default action is to list
+ my $displayArg = ""; # for -d <error log id>
+ my $traceArg = ""; # for the name of the hbot string file
+
+ my %hashh = %{(shift)};
+ my $temp;
+ foreach $temp (keys(%hashh))
+ {
+ # print "$temp=" . $hashh{$temp} . "\n";
+
+ if ( $temp eq "display" )
+ {
+ $displayArg = " -d ".$hashh{$temp};
+
+ # display <id> overrides default behavior to list them all
+ $listArg = "";
+ }
+ elsif( $temp eq "trace" )
+ {
+ $traceArg = " -t ".$hashh{$temp};
+ }
+ elsif( length($temp) eq 0 )
+ {
+ ; # apparently $temp can be empty
+ }
+ else
+ {
+ ::userDisplay "Unknown parameter $temp\n";
+ die;
+ }
+ }
+
+ my ($symAddr, $symSize) = ::findSymbolAddress("ERRORLOG::g_ErrlStorage");
+ if (not defined $symAddr)
+ {
+ ::userDisplay "Couldn't find symbol ERRORLOG::g_ErrlStorage\n";
+ die;
+ }
+
+ # Size of buffer resides at offset zero of buffer for length of 4
+ my $errlSize;
+ $errlSize = ::read32( $symAddr );
+
+ # read entire buffer
+ my $errlBuffer;
+ $errlBuffer = ::readData( $symAddr, $errlSize );
+
+ # write buffer to a temporary file
+ my $tempFile = getTempFileName();
+ open( ERRLDATA, "> $tempFile" ) or die "Can not write temporary file $tempFile\n";
+ binmode ERRLDATA;
+ print ERRLDATA $errlBuffer;
+ close( ERRLDATA );
+
+ my $imagePath;
+ $imagePath = ::determineImagePath();
+ if (not defined $imagePath)
+ {
+ ::userDisplay "Can not find img path to errlparser binary.\n";
+ die;
+ }
+
+ my $errlParser;
+ $errlParser = $imagePath."/errlparser";
+ if( not -x $errlParser )
+ {
+ ::userDisplay "Can not find errlparser binary in img directory.\n";
+ die;
+ }
+
+ if( length( $traceArg ) eq 0 )
+ {
+ # string file not given; supply a default if possible
+ my $defaultStringFile = $imagePath."/hbotStringFile";
+ if( -f $defaultStringFile )
+ {
+ $traceArg = " -t ".$defaultStringFile;
+ }
+ }
+
+
+ my $cmdLine;
+ $cmdLine = "$errlParser $tempFile $displayArg $traceArg $listArg";
+ # ::userDisplay "$cmdLine\n";
+ open ERRLPARSER, "$cmdLine |";
+ while (my $line = <ERRLPARSER>)
+ {
+ ::userDisplay $line;
+ }
+
+ # delete temporary file
+ unlink( $tempFile );
+
+
+ return 0;
+}
+
+sub help
+{
+
+ ::userDisplay "Tool: Errl\n";
+ ::userDisplay "\tList or display the error log entries.\n";
+ ::userDisplay "\n";
+ ::userDisplay " Options:\n";
+ ::userDisplay "\tdisplay=<id> - Display a specific error log by id.\n";
+ ::userDisplay "\tdisplay=all - Display all error logs in the repository.\n";
+ ::userDisplay "\n";
+ ::userDisplay " The default behavior is to list all the committed error\n";
+ ::userDisplay " logs unless requested to display a specific error log\n";
+ ::userDisplay " or all error logs.\n";
+
+}
+
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py
index 5be2f8c37..458b2fc35 100755
--- a/src/build/debug/simics-debug-framework.py
+++ b/src/build/debug/simics-debug-framework.py
@@ -214,6 +214,7 @@ def register_hb_debug_framework_tools():
lambda options:
run_hb_debug_framework(toolname, options))(tool),
args = [arg(str_t, "options", "?", "")],
+ alias = "hb-debug-" + tool,
type = ["hostboot-commands"],
short = "Runs the debug framework for tool " + tool,
doc = usage)
diff --git a/src/build/simics/hb-simdebug.py b/src/build/simics/hb-simdebug.py
index 2ecf7bac3..238220417 100755
--- a/src/build/simics/hb-simdebug.py
+++ b/src/build/simics/hb-simdebug.py
@@ -70,29 +70,29 @@ def print_istep_list( inList ):
print
print "-----------------------------------------------------------"
print " StepName Num Who Mode Description "
- print "-----------------------------------------------------------"
+ 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"
+ 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.
+
+# 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.
+# 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"
+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"
+ StatusStr = "salerno_chip.regdump SCOM 0x13012685 -f ./scom.out"
## get response
(result, statusOutput) = quiet_run_command( StatusStr, output_modes.regular )
@@ -101,68 +101,68 @@ def getStatusReg():
file = open( "./scom.out_SCOM_0X13012685", "rU" )
statusOutput = file.readlines()
file.close()
-
- #print result
- #print "............"
+
+ #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.
+
+# 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.
+# 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 "------------------------------------------------------------------"
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)
-
+
+ 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 )
+ 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
+ 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"
+ print "-----------------------------------------------------------------"
+
+## run command = "sN"
def sCommand( inList, scommand ) :
i = int(scommand)
j = 0
for substep in inList[i] :
- ## print "-----------------"
+ ## print "-----------------"
##print "run IStep %d %s ..."%(i, substep)
- ##print "-----------------"
+ ##print "-----------------"
runIStep( i, j, inList )
j = j+1
- return
-
+ return
+
def find_in_inList( inList, substepname) :
for i in range(0,len(inList)) :
for j in range( 0, len(inList[i])) :
@@ -170,33 +170,33 @@ def find_in_inList( inList, substepname) :
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 )
-
-
+ break;
+
+ return ( len(inList), len(inList[i]), False )
+
+
## possible commands:
## list
## istepmode
## sN
## sN..M
-## <substepname1>..<substepname2>
+## <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
-
+ 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')
+ # 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')
@@ -207,57 +207,27 @@ def istepHB( str_arg1, inList):
print "multiple ISteps:" + scommand
# list of substeps = "sM..N"
(M, N) = scommand.split('..')
- #print M + "-" + N
+ #print M + "-" + N
for x in range( (int(M,16)), (int(N,16)+1) ) :
sCommand( inList, x )
return
- else:
+ 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
-
-
-#------------------------------------------------------------------------------
-# Function to dump error logs
-#------------------------------------------------------------------------------
-def errlHB(symsFile, errlParser, flag, logid, stringFile):
-
- # "constants"
- L3_SIZE = 0x800000
- dumpFile = "hbdump.out"
-
- print
-
- #dump L3
- string = "memory_image_ln0.save %s 0 0x%x"%(dumpFile,L3_SIZE)
- #print string
- result = run_command(string)
- #print result
-
- if logid == "all":
- string = "./%s %s %s %s -t %s| tee Errorlogs"%(errlParser,dumpFile,symsFile,flag,stringFile)
- else:
- string = "./%s %s %s %s %s -t %s| tee Errorlogs"%(errlParser,dumpFile,symsFile,flag,logid,stringFile)
- #print string
- os.system(string)
- os.system("rm hbdump.out")
-
- print "\n\nData saved to %s/Errorlogs"%(os.getcwd())
-
- return
+ return
#===============================================================================
@@ -269,7 +239,7 @@ default_stringFile = "hbotStringFile"
#------------------------------------------------
#------------------------------------------------
new_command("hb-trace",
- (lambda comp: run_hb_debug_framework("Trace",
+ (lambda comp: run_hb_debug_framework("Trace",
("components="+comp) if comp else "")),
[arg(str_t, "comp", "?", None),
],
@@ -304,14 +274,14 @@ new_command("hb-printk",
short = "Display the kernel printk buffer",
doc = """
Parameters: \n
-
+
Defaults: \n
'syms' = './hbicore.syms' \n\n
Examples: \n
hb-printk \n
""")
-
+
#------------------------------------------------
#------------------------------------------------
def hb_dump():
@@ -337,31 +307,31 @@ Examples: \n
#------------------------------------------------
# implement isteps
#------------------------------------------------
-def hb_istep(str_arg1):
+def hb_istep(str_arg1):
- ## preprocess inputs,
+ ## 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 flag_t
+
+ if str_arg1 == None:
print_istep_list( inList )
else:
- print "args=%s" % str(str_arg1)
+ print "args=%s" % str(str_arg1)
istepHB( str_arg1, inList, )
-
+
return None
-
+
new_command("hb-istep",
hb_istep,
[ arg(str_t, "syms", "?", None),
@@ -372,7 +342,7 @@ new_command("hb-istep",
short = "Run IStep commands using the SPLess HostBoot interface",
doc = """
Parameters: \n
-
+
Defaults: \n
Examples: \n
@@ -381,51 +351,15 @@ Examples: \n
hb-istep -s0..4
hb-istep poweron
hb-istep poweron..clock_frequency_set
- """)
-
+ """)
+
#------------------------------------------------
#------------------------------------------------
-default_flag = "-l"
-default_logid = "all"
-default_errlParser = "errlparser"
-def hb_errl(logid, logidStr, flg_list, flg_detail):
- #print "logid=%s" % str(logid)
- #print "logidStr=%s" % str(logidStr)
- #print "flg_list=%s" % str(flg_list)
- #print "flg_detail=%s" % str(flg_detail)
-
- syms = default_syms
- errlParser = default_errlParser
-
- if flg_list and flg_detail:
- print "ERROR: enter either '-l' or '-d [<logid | all>]'"
- return None
-
- flag = default_flag
- id = default_logid
- if flg_list:
- flag = "-l"
- if flg_detail:
- flag = "-d"
- if logid != None:
- id = str(logid)
-
- if (flag == "-l") and (logid or logidStr):
- print "ERROR: enter either '-l' or '-d [<logid | all>]'"
- return None
-
- if logidStr and (logid or (logidStr.lower() != "all")):
- print "ERROR: enter <logid> or 'all'"
- return None
-
- print "syms=%s" % str(syms)
- print "errlParser=%s" % str(errlParser)
- #print "logid=%s" % str(id)
- errlHB(syms, errlParser, flag, id, default_stringFile)
- return None
-
new_command("hb-errl",
- hb_errl,
+ (lambda logid, logidStr, flg_l, flg_d:
+ run_hb_debug_framework("Errl",
+ ("display="+(str(logid) if logid else logidStr) if flg_d else ""
+ ))),
[ arg(int_t, "logid", "?", None),
arg(str_t, "logidStr", "?", None),
arg(flag_t, "-l"),
@@ -442,16 +376,14 @@ Parameters: \n
Defaults: \n
'flag' = '-l' \n
- 'syms' = './hbicore.syms' \n
- 'errlParser' = ./errlparser'\n
Examples: \n
hb_errl [-l]\n
hb-errl -d 1\n
hb-errl -d [all]\n
""")
-
-
+
+
#------------------------------------------------
#------------------------------------------------
def hb_singlethread():
OpenPOWER on IntegriCloud