diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2011-09-14 10:35:31 -0500 |
---|---|---|
committer | CAMVAN T. NGUYEN <ctnguyen@us.ibm.com> | 2011-09-14 17:36:44 -0500 |
commit | 3447d024f2d28912e894fe7f94281a645a7d4568 (patch) | |
tree | 0229e5bbd162be615e39725e2e7e4b378b1931c8 /src | |
parent | 4dd7fda6921996b76bca7f03210416669e8b779d (diff) | |
download | talos-hostboot-3447d024f2d28912e894fe7f94281a645a7d4568.tar.gz talos-hostboot-3447d024f2d28912e894fe7f94281a645a7d4568.zip |
Added function to dump and parse error logs to hostboot dump and parse tools.
Added new tools hb-trace, hb-errl, hb-printk, hb-dump for vbu/vpo debug.
Added support for ecmd options, more error checking and misc enhancements.
Change-Id: I8f5ed666a1d99ff894015e07a20595fcac8727b5
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/343
Tested-by: Jenkins Server
Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/build/citest/autocitest | 16 | ||||
-rwxr-xr-x | src/build/simics/hb-simdebug.py | 140 | ||||
-rwxr-xr-x | src/build/tools/cpfiles.pl | 5 | ||||
-rwxr-xr-x | src/build/tools/hb-parsedump.pl (renamed from src/build/tools/exthbdump.pl) | 179 | ||||
-rwxr-xr-x | src/build/vpo/hb-dump | 144 | ||||
-rwxr-xr-x | src/build/vpo/hb-errl | 196 | ||||
-rwxr-xr-x | src/build/vpo/hb-printk | 144 | ||||
-rwxr-xr-x | src/build/vpo/hb-trace | 158 | ||||
-rwxr-xr-x | src/build/vpo/hb-virtdebug.pl (renamed from src/build/tools/hb-dump.pl) | 355 | ||||
-rw-r--r-- | src/usr/errl/parser/errlparser.C | 25 |
10 files changed, 1135 insertions, 227 deletions
diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest index b9cd1cbd4..3a1a4fcaf 100755 --- a/src/build/citest/autocitest +++ b/src/build/citest/autocitest @@ -77,22 +77,6 @@ function runtraceHB() echo "Collect traceHB info..." `pwd` - autosim $NOWIN --simcmd "@os.environ[\"HOSTBOOT_STRINGFILE\"]=\"${SBXHOME}/img/hbotStringFile\" " - if [ $? -ne 0 ] ; then - echo "ERROR 1: Unable to run $?" - stopsim - stopserver - exit 1 - fi - - autosim $NOWIN --simcmd "@os.environ[\"HOSTBOOT_SYMS\"]=\"${SBXHOME}/img/hbicore_test.syms\" " - if [ $? -ne 0 ] ; then - echo "ERROR 2: Unable to run $?" - stopsim - stopserver - exit 1 - fi - autosim $NOWIN --simcmd "run-python-file ${SBXHOME}/src/build/simics/hb-simdebug.py" if [ $? -ne 0 ] ; then echo "ERROR 3: Unable to run $?" diff --git a/src/build/simics/hb-simdebug.py b/src/build/simics/hb-simdebug.py index 7e42621d3..a611cbf13 100755 --- a/src/build/simics/hb-simdebug.py +++ b/src/build/simics/hb-simdebug.py @@ -1,20 +1,25 @@ -############################################################################# -# $IBMCopyrightBlock: +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# IBM Confidential +# $Source: src/build/simics/hb-simdebug.py $ # -# Licensed Internal Code Source Materials +# IBM CONFIDENTIAL # -# IBM HostBoot Licensed Internal Code +# COPYRIGHT International Business Machines Corp. 2011 # -# (C) Copyright IBM Corp. 2011 +# p1 # -# 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. -#$ -############################################################################# - +# 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 # *** hb-simdebug.py # # Script to extract and display formatted trace in simics @@ -441,7 +446,7 @@ def istepHB( str_arg1, inList): #------------------------------------------------------------------------------ # Function to dump error logs #------------------------------------------------------------------------------ -def errlHB(symsFile, flag, logid): +def errlHB(symsFile, errlParser, flag, logid): # "constants" L3_SIZE = 0x800000 @@ -455,10 +460,10 @@ def errlHB(symsFile, flag, logid): result = run_command(string) #print result - if logid == 0: - string = "./errlparser %s %s %s| tee Errorlogs"%(dumpFile,symsFile,flag) + if logid == "all": + string = "./%s %s %s %s| tee Errorlogs"%(errlParser,dumpFile,symsFile,flag) else: - string = "./errlparser %s %s %s %d| tee Errorlogs"%(dumpFile,symsFile,flag,logid) + string = "./%s %s %s %s %s| tee Errorlogs"%(errlParser,dumpFile,symsFile,flag,logid) #print string os.system(string) os.system("rm hbdump.out") @@ -478,32 +483,23 @@ default_stringFile = "hbotStringFile" #------------------------------------------------ #------------------------------------------------ -def hb_trace(str_arg1, str_arg2, str_arg3): - if ((str_arg1 == None) or (str_arg1 == "all") or (str_arg1 == "ALL") or (str_arg1 == "All")): - str_arg1 = default_comp - if str_arg2 == None: - if os.environ.has_key("HOSTBOOT_SYMS"): - str_arg2 = str(os.environ.get("HOSTBOOT_SYMS")) - else: - str_arg2 = default_syms - if str_arg3 == None: - if os.environ.has_key("HOSTBOOT_STRINGFILE"): - str_arg3 = str(os.environ.get("HOSTBOOT_STRINGFILE")) - else: - str_arg3 = default_stringFile +def hb_trace(comp): + syms = default_syms + stringFile = default_stringFile + + if comp == None: + comp = default_comp - print "comp=%s" % str(str_arg1) + print "comp=%s" % str(comp) - print "syms=%s" % str(str_arg2) - print "StringFile=%s" % str(str_arg3) - traceHB(str_arg1, str_arg2, str_arg3) + print "syms=%s" % str(syms) + print "StringFile=%s" % str(stringFile) + traceHB(comp, syms, stringFile) return None new_command("hb-trace", hb_trace, [arg(str_t, "comp", "?", None), - arg(str_t, "syms", "?", None), - arg(str_t, "stringFile", "?", None), ], #alias = "hbt", type = ["hostboot-commands"], @@ -512,9 +508,7 @@ new_command("hb-trace", short = "Display the hostboot trace", doc = """ Parameters: \n - in = component name \n - in = SYMS file \n - in = hostboot string file \n + in = component name(s) \n Defaults: \n 'comp' = all buffers \n @@ -523,28 +517,21 @@ Defaults: \n Examples: \n hb-trace \n - hb-trace all \n + hb-trace ERRL\n hb-trace "ERRL,INITSERVICE" \n - hb-trace ERRL ../hbicore.syms <git.repo>/img/hbotStringFile \n """) #------------------------------------------------ #------------------------------------------------ -def hb_printk(str_arg1): - if str_arg1 == None: - if os.environ.has_key("HOSTBOOT_SYMS"): - str_arg1 = str(os.environ.get("HOSTBOOT_SYMS")) - else: - str_arg1 = default_syms - - print "syms=%s" % str(str_arg1) - printkHB(str_arg1) +def hb_printk(): + syms = default_syms + + print "syms=%s" % str(syms) + printkHB(syms) return None new_command("hb-printk", hb_printk, - [arg(str_t, "syms", "?", None), - ], #alias = "hbt", type = ["hostboot-commands"], #see_also = ["hb-trace"], @@ -552,14 +539,12 @@ new_command("hb-printk", short = "Display the kernel printk buffer", doc = """ Parameters: \n - in = SYMS file \n Defaults: \n 'syms' = './hbicore.syms' \n\n Examples: \n hb-printk \n - hb-printk ../hbicore.syms \n """) #------------------------------------------------ @@ -636,16 +621,19 @@ Examples: \n #------------------------------------------------ #------------------------------------------------ default_flag = "-l" -default_logid = 0 -def hb_errl(syms, flg_list, flg_detail, logid): - if syms == None: - if os.environ.has_key("HOSTBOOT_SYMS"): - syms = str(os.environ.get("HOSTBOOT_SYMS")) - else: - syms = default_syms +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>'" + print "ERROR: enter either '-l' or '-d [<logid | all>]'" return None flag = default_flag @@ -654,23 +642,29 @@ def hb_errl(syms, flg_list, flg_detail, logid): flag = "-l" if flg_detail: flag = "-d" - if logid == 0: - print "Error: enter '-d <logid>'" - return None - else: - id = logid + 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 "logid=%d" % int(id) - errlHB(syms, flag, id) + print "errlParser=%s" % str(errlParser) + #print "logid=%s" % str(id) + errlHB(syms, errlParser, flag, id) return None new_command("hb-errl", hb_errl, - [arg(str_t, "syms", "?", None), + [ arg(int_t, "logid", "?", None), + arg(str_t, "logidStr", "?", None), arg(flag_t, "-l"), arg(flag_t, "-d"), - arg(int_t, "logid", "?", 0) ], #alias = "hbt", type = ["hostboot-commands"], @@ -679,17 +673,17 @@ new_command("hb-errl", short = "Display the hostboot error logs", doc = """ Parameters: \n - in = SYMS file \n in = option for dumping error logs\n Defaults: \n 'flag' = '-l' \n 'syms' = './hbicore.syms' \n + 'errlParser' = ./errlparser'\n Examples: \n - hb-errl -l \n + hb_errl [-l]\n hb-errl -d 1\n - hb-errl ./hbicore_test.syms -l\n + hb-errl -d [all]\n """) diff --git a/src/build/tools/cpfiles.pl b/src/build/tools/cpfiles.pl index 682a6b9f7..ca79ed5a4 100755 --- a/src/build/tools/cpfiles.pl +++ b/src/build/tools/cpfiles.pl @@ -55,10 +55,9 @@ 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", +my @files = ("src/build/tools/hb-parsedump.pl", + "src/build/simics/*", "src/usr/errl/parser/bin/errlparser", - "src/build/simics/hb-simdebug.py", "img/hbotStringFile", "img/hbicore.syms", "img/hbicore_test.syms", diff --git a/src/build/tools/exthbdump.pl b/src/build/tools/hb-parsedump.pl index 82c055e27..9816eca8c 100755 --- a/src/build/tools/exthbdump.pl +++ b/src/build/tools/hb-parsedump.pl @@ -1,4 +1,26 @@ #!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/tools/hb-parsedump.pl $ +# +# 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 # # Purpose: This perl script will parse a hostboot dump file and extract @@ -10,7 +32,9 @@ # # Usage: -# exthbdump.pl <path/hbDumpFile> <path/symsFile> +# hb-parsedump.pl <dumpfile> [--test] +# [--in <path to .syms file, hbotStringFile, & errlparser>] +# [--out <path to save output data>]\n"); #------------------------------------------------------------------------------ @@ -39,6 +63,7 @@ sub readBinFile; sub readStringBinFile; sub writeBinFile; sub appendBinFile; +sub printUsage; #============================================================================== @@ -52,26 +77,30 @@ sub appendBinFile; my $numArgs = $#ARGV + 1; if ($numArgs < 1) { - print ("\nUsage: exthbdump.pl <dumpfile> [--test] [--dir <path to .syms file & hbotStringFile>]\n\n"); - print (" This program will parse the hostboot dump file specified\n"); - print (" and extract the code version, kernel printk buffer and traces\n"); - print (" to the current directory.\n\n"); - print (" User should copy the relevant .syms file and hbotStringFile\n"); - print (" to the current directory or set the env variable HBDIR to the path\n"); - print (" of the hbicore.syms/hbicore_test.syms files & hbotStringFile.\n\n"); - print (" User should also copy the fsp-trace program to the current directory\n"); - print (" or set the env variable PATH to include the path to the program.\n\n"); - print (" --dir: Override the automatically detected .syms and hbotStringFile\n"); - print (" in HBDIR or the current directory. This program will search\n"); - print (" for the files in the following order:\n"); - print (" 1. from the path specified by user\n"); - print (" 2. from HBDIR if it is defined\n"); - print (" 3. from the current directory\n"); - print (" --test: Use the hbicore_test.syms file vs the hbicore.syms file\n"); - print ("\nNOTE: User can run cpfiles.pl from the git repository to\n"); - print (" copy all files needed to parse the hostboot dump to the current\n"); - print (" directory prior to running this program.\n"); - exit(1); + #Print command line help + print ("ERROR: Enter the hostboot dump file.\n"); + printUsage(); + exit (1); +} +elsif ($numArgs > 6) +{ + #Print command line help + print ("ERROR: Too many arguments entered.\n"); + printUsage(); + exit (1); +} +elsif (($ARGV[0] eq "--help") || ($ARGV[0] eq "-h")) +{ + #Print command line help + printUsage(); + exit (0); +} +elsif (substr($ARGV[0], 0, 1) eq '-') +{ + #Print command line help + print ("ERROR: Enter the hostboot dump file.\n"); + printUsage(); + exit (1); } #------------------------------------------------------------------------------ @@ -81,6 +110,9 @@ if ($numArgs < 1) #Initialize default settings my $hbSymsFile = "hbicore.syms"; my $hbStringFile = "hbotStringFile"; +my $hbErrlParser = "errlparser"; +my $cwd = getcwd(); +my $outDir = $cwd; #Default = current working directory my $hbDir = $ENV{'HBDIR'}; if (defined ($hbDir)) @@ -99,18 +131,34 @@ else my $hbDumpFile = $ARGV[0]; my $hbDumpFileBase = basename($hbDumpFile); +#check if file exists and is not empty +if (!(-s $hbDumpFile)) +{ + die "$hbDumpFile is not found or is empty.\n"; + +} + # Save the optional user specified arguments for (my $i=1; $i<$numArgs; $i++) { - if ($ARGV[$i] eq "--dir") + if ($ARGV[$i] eq "--in") { if (($i + 1) >= $numArgs) { - die "No value given for --dir parameter.\n"; + die "No value given for --in parameter.\n"; } $i++; $hbDir = $ARGV[$i]; } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + $outDir = $ARGV[$i]; + } elsif ($ARGV[$i] eq "--test") { #Use hbicore_test.syms @@ -134,19 +182,25 @@ if (!(-e "$hbDir/$hbStringFile")) die "Cannot find $hbDir/$hbStringFile\n"; } +if (!(-e "$hbDir/$hbErrlParser")) +{ + die "Cannot find $hbDir/$hbErrlParser\n"; +} + #------------------------------------------------------------------------------ #Print the files used #------------------------------------------------------------------------------ print "hostboot dump file: $hbDumpFile\n"; print "hostboot syms file: $hbDir/$hbSymsFile\n"; print "hostboot string file: $hbDir/$hbStringFile\n"; +print "hostboot errlog parser: $hbDir/$hbErrlParser\n"; #------------------------------------------------------------------------------ # Create dumpout subdir for extracted dump #------------------------------------------------------------------------------ #print getcwd()."\n"; -my $extDir = "dumpout.$hbDumpFileBase"; +my $extDir = "$outDir/dumpout.$hbDumpFileBase"; if (-d $extDir) { print "ERROR: directory $extDir exists.\n"; @@ -186,7 +240,7 @@ if (0 != $addr) chdir "$extDir"; writeBinFile($string, $buffer); - chdir "../"; + chdir "$cwd"; } @@ -204,7 +258,7 @@ if ((0 != $addr) && (0 != $size)) $buffer = readStringBinFile($hbDumpFile, $addr); chdir "$extDir"; writeBinFile($string, $buffer); - chdir "../"; + chdir "$cwd"; } @@ -217,10 +271,6 @@ $string = 'g_desc_array'; if ((0 != $addr) && (0 != $size)) { - #make subdir component_traces to store all traces - my $traceDir = $extDir.'/component_traces'; - mkdir $traceDir; - #Read the g_desc_array from dump file and save the trace buffers for (my $i = 0; $i < MAX_NUM_TRACE_BUFFERS; $i++) { @@ -238,44 +288,62 @@ if ((0 != $addr) && (0 != $size)) $addr += DESC_ARRAY_ENTRY_ADDR_SIZE; #read the component trace buffer and save to file + #read the component trace buffer $buffer = readBinFile($hbDumpFile, $compBufAddr, TRAC_DEFAULT_BUFFER_SIZE); - chdir "$traceDir"; - - writeBinFile($compName, $buffer); + chdir "$extDir"; - #also append to tracBIN + #append to tracBIN appendBinFile('tracBIN', $buffer); - chdir "../../"; + chdir "$cwd"; } #check if file exists and is not empty - if (-s $traceDir.'/tracBIN') + if (-s $extDir.'/tracBIN') { #create tracMERG file $string = sprintf ("fsp-trace -s %s/%s %s/tracBIN > %s/tracMERG", - $hbDir, $hbStringFile, $traceDir, $traceDir); + $hbDir, $hbStringFile, $extDir, $extDir); #print "$string\n"; `$string`; - if (-s "$traceDir/tracMERG") + if (-s "$extDir/tracMERG") { #delete tracBIN file - unlink $traceDir.'/tracBIN'; + unlink $extDir.'/tracBIN'; } } } #------------------------------------------------------------------------------ -# Save dump file to dumpout dir +# Extract the error logs #------------------------------------------------------------------------------ -copy ($hbDumpFile, $extDir) or die "Copy failed: $!"; +#Create error log file and write list header to file +my $errlFile = "$extDir/Errorlogs"; +open (ERRLFILE, ">$errlFile") or die "Couldn't open $errlFile!"; +print ERRLFILE "Error Log List:\n\n"; +close(ERRLFILE); + +#Invoke errlparser to parse and save the list of error logs +my $command = sprintf ("$hbDir/$hbErrlParser $hbDumpFile $hbDir/$hbSymsFile >> $errlFile"); +#print "$command\n"; +`$command`; + +#Write error log detail header +open (ERRLFILE, ">>$errlFile") or die "Couldn't open $errlFile!"; +print ERRLFILE "\n\nError Log Details:\n\n"; +close(ERRLFILE); + +#Invoke errlparser to parse and save the individual error log detail data +$command = sprintf ("$hbDir/$hbErrlParser $hbDumpFile $hbDir/$hbSymsFile -d >> $errlFile"); +#print "$command\n"; +`$command`; #------------------------------------------------------------------------------ # Print location of dumpout dir #------------------------------------------------------------------------------ -print "Dump extracted to ./$extDir\n"; +print "\nDump extracted to $extDir\n"; #============================================================================== @@ -388,3 +456,30 @@ sub appendBinFile($$) print FILE $buffer; close (FILE); } + +#------------------------------------------------------------------------------ +# Print command line help +#------------------------------------------------------------------------------ +sub printUsage() +{ + print ("\nUsage: hb-parsedump.pl [--help] | <dumpfile> [--test]\n"); + print (" [--in <path to .syms file, hbotStringFile & errlparser>]\n"); + print (" [--out <path to save output data>]\n\n"); + print (" This program will parse the hostboot dump file specified\n"); + print (" and extract the code version, kernel printk buffer, component\n"); + print (" traces & error logs.\n\n"); + print (" User should copy the relevant .syms file, hbotStringFile and errlparser\n"); + print (" to the current directory or set the env variable HBDIR to the path\n"); + print (" of the files.\n\n"); + print (" User should also set the env variable PATH to include the path to the fsp-trace"); + print (" program.\n\n"); + print (" --in: Override the automatically detected .syms file, hbotStringFile\n"); + print (" and errlparser in HBDIR or the current directory.\n"); + print (" This program will search for the files in the following order:\n"); + print (" 1. from the path specified by user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out: Directory where the output data will be saved.\n"); + print (" Default path is the current directory.\n"); + print (" --test: Use the hbicore_test.syms file vs the hbicore.syms file\n"); +} diff --git a/src/build/vpo/hb-dump b/src/build/vpo/hb-dump new file mode 100755 index 000000000..276fad24e --- /dev/null +++ b/src/build/vpo/hb-dump @@ -0,0 +1,144 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/vpo/hb-dump $ +# +# 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 + +# +# Purpose: This perl script works on VBU and will dump the entire L3 cache +# +# Author: CamVan Nguyen +# Last Updated: 09/07/2011 +# + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use strict; +use warnings; + + +#------------------------------------------------------------------------------ +# Forward Declaration +#------------------------------------------------------------------------------ +sub printUsage; + + +#============================================================================== +# MAIN +#============================================================================== + +#------------------------------------------------------------------------------ +# Parse optional input arguments +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +#print "num args = $numArgs\n"; +#print "argument list = @ARGV\n"; + +my $hbDir = $ENV{'HBDIR'}; +if (defined ($hbDir)) +{ + unless ($hbDir ne "") + { + $hbDir = '.'; #Set to current directory + } +} +else +{ + $hbDir = '.'; #Set to current directory +} + +for (my $i=0; $i<$numArgs; $i++) +{ + if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) + { + #Print command line help + printUsage(); + exit (0); + } + elsif ($ARGV[$i] eq "--in") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --in parameter.\n"; + } + $i++; + $hbDir = $ARGV[$i]; + } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + } + elsif ($ARGV[$i] !~ m/^-[cknsp]\d+/) + { + print "Invalid argument entered: $ARGV[$i]\n"; + printUsage(); + exit(1); + } +} + + +#------------------------------------------------------------------------------ +# Dump L3 +#------------------------------------------------------------------------------ +my $command = "$hbDir/hb-virtdebug.pl @ARGV"; +system($command); + + +#============================================================================== +# SUBROUTINES +#============================================================================== + +#------------------------------------------------------------------------------ +# Print command line help +#------------------------------------------------------------------------------ +sub printUsage() +{ + print ("\nUsage: hb-dump [--help] | [--in <path to hb-virtdebug.pl>]\n"); + print (" [--out <path to save output data>]\n"); + print (" [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); + print (" This program dumps the entire L3 to a file.\n"); + print (" Use the hb-parsedump.pl program to expand and view data in the file.\n\n"); + print (" User should copy hb-virtdebug.pl to the current directory or set\n"); + print (" the env variable HBDIR to the path of the file.\n\n"); + print (" --help Prints usage information.\n"); + print (" --in Overrides the automatically detected hb-virtdebug.pl file\n"); + print (" in HBDIR or the current directory.\n"); + print (" This program will search for the file in the "); + print ("following order:\n"); + print (" 1. from the path specified by the user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out Directory where the output data will be saved.\n"); + print (" Default path is the current directory.\n"); + print (" -k# Specify which cage to act on (default = 0).\n"); + print (" -n# Specify which node to act on (default = 0).\n"); + print (" -s# Specify which slot to act on (default = 0).\n"); + print (" -p# Specify which chip position to act on (default = 0).\n"); + print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); + print ("\n NOTE: This program will not work if user has not stopped instructions\n"); + print (" prior to running this program.\n"); +} + diff --git a/src/build/vpo/hb-errl b/src/build/vpo/hb-errl new file mode 100755 index 000000000..64f7cc9f4 --- /dev/null +++ b/src/build/vpo/hb-errl @@ -0,0 +1,196 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/vpo/hb-errl $ +# +# 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 + +# +# Purpose: This perl script works on VBU and will dump error log buffer +# +# Author: CamVan Nguyen +# Last Updated: 09/07/2011 +# + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use strict; +use warnings; +use POSIX; + + +#------------------------------------------------------------------------------ +# Forward Declaration +#------------------------------------------------------------------------------ +sub printUsage; + + +#============================================================================== +# MAIN +#============================================================================== + +#------------------------------------------------------------------------------ +# Parse optional input arguments +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +#print "num args = $numArgs\n"; +#print "argument list = @ARGV\n"; + +my $hbDir = $ENV{'HBDIR'}; +if (defined ($hbDir)) +{ + unless ($hbDir ne "") + { + $hbDir = '.'; #Set to current directory + } +} +else +{ + $hbDir = '.'; #Set to current directory +} + +my $dumpErrlList = 0; +my $dumpErrlDtl = 0; +my @errlOpt; +for (my $i=0; $i<$numArgs; $i++) +{ + if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) + { + #Print command line help + printUsage(); + exit (0); + } + elsif ($ARGV[$i] eq "--in") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --in parameter.\n"; + } + $i++; + $hbDir = $ARGV[$i]; + } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + } + elsif (($ARGV[$i] eq "-d") && ($dumpErrlList == 0)) + { + $dumpErrlDtl = 1; + + #save the error log option & remove it from @ARGV + push(@errlOpt, $ARGV[$i]); + splice(@ARGV, $i, 1); + $numArgs--; + $i--; + + last if (($i + 1) >= $numArgs); + $i++; + + if (substr($ARGV[$i], 0, 1) eq '-') + { + $i--; + } + else + { + if (($ARGV[$i] =~ /all/i) || isdigit($ARGV[$i])) + { + #save the error log option & remove it from @ARGV + push(@errlOpt, $ARGV[$i]); + splice(@ARGV, $i, 1); + $numArgs--; + $i--; + } + else + { + die "ERROR: Enter logid or 'all'" + } + } + } + elsif (($ARGV[$i] eq "-l") && ($dumpErrlDtl == 0)) + { + $dumpErrlList = 1; + + #save the error log option & remove it from @ARGV + push(@errlOpt, $ARGV[$i]); + splice(@ARGV, $i, 1); + $numArgs--; + $i--; + } + elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) + { + print "Invalid argument entered: $ARGV[$i]\n"; + printUsage(); + exit(1); + } +} + + +#------------------------------------------------------------------------------ +# Dump the error log(s) +#------------------------------------------------------------------------------ +my $command = "$hbDir/hb-virtdebug.pl --errl @errlOpt @ARGV"; +system($command); + + +#============================================================================== +# SUBROUTINES +#============================================================================== + +#------------------------------------------------------------------------------ +# Print command line help +#------------------------------------------------------------------------------ +sub printUsage() +{ + print ("\nUsage: hb-errl [--help] | [-l | -d [<logid>|all]]\n"); + print (" [--in <path to .syms file, hb-virtdebug.pl & errlparser>]\n"); + print (" [--out <path to save output data>]\n"); + print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); + print (" This program retrieves the error log(s) from L3.\n"); + print (" User should copy the relevant .syms file, hb-virtdebug.pl & errlparser\n"); + print (" to the current directory or set the env variable HBDIR to the path\n"); + print (" of the files.\n\n"); + print (" --help Prints usage information.\n"); + print (" --in Overrides the automatically detected .syms file,\n"); + print (" hb-virtdebug.pl & errlparser in HBDIR or the current directory.\n"); + print (" This program will search for the files in the "); + print ("following order:\n"); + print (" 1. from the path specified by the user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out Directory where the output data will be saved.\n"); + print (" Default path is the current directory.\n"); + print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); + print (" -l Dumps a listing of all the error logs\n"); + print (" -d <logid> Dumps detailed data of the specified error log.\n"); + print (" -d [all] Dumps detailed data of all error logs\n"); + print (" -k# Specify which cage to act on (default = 0).\n"); + print (" -n# Specify which node to act on (default = 0).\n"); + print (" -s# Specify which slot to act on (default = 0).\n"); + print (" -p# Specify which chip position to act on (default = 0).\n"); + print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); + print ("\n NOTE: This program will not work if user has not stopped instructions\n"); + print (" prior to running this program.\n"); +} + diff --git a/src/build/vpo/hb-printk b/src/build/vpo/hb-printk new file mode 100755 index 000000000..95ad98e26 --- /dev/null +++ b/src/build/vpo/hb-printk @@ -0,0 +1,144 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/vpo/hb-printk $ +# +# 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 + +# +# Purpose: This perl script works on VBU and will dump kernel printk buffer +# +# Author: CamVan Nguyen +# Last Updated: 09/07/2011 +# + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use strict; +use warnings; + + +#------------------------------------------------------------------------------ +# Forward Declaration +#------------------------------------------------------------------------------ +sub printUsage; + + +#============================================================================== +# MAIN +#============================================================================== + +#------------------------------------------------------------------------------ +# Parse optional input arguments +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +#print "num args = $numArgs\n"; +#print "argument list = @ARGV\n"; + +my $hbDir = $ENV{'HBDIR'}; +if (defined ($hbDir)) +{ + unless ($hbDir ne "") + { + $hbDir = '.'; #Set to current directory + } +} +else +{ + $hbDir = '.'; #Set to current directory +} + +for (my $i=0; $i<$numArgs; $i++) +{ + if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) + { + #Print command line help + printUsage(); + exit (0); + } + elsif ($ARGV[$i] eq "--in") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --in parameter.\n"; + } + $i++; + $hbDir = $ARGV[$i]; + } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + } + elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) + { + print "Invalid argument entered: $ARGV[$i]\n"; + printUsage(); + exit(1); + } +} + + +#------------------------------------------------------------------------------ +# Dump the kernel printk buffer +#------------------------------------------------------------------------------ +my $command = "$hbDir/hb-virtdebug.pl --printk @ARGV"; +system($command); + + +#============================================================================== +# SUBROUTINES +#============================================================================== + +#------------------------------------------------------------------------------ +# Print command line help +#------------------------------------------------------------------------------ +sub printUsage() +{ + print ("\nUsage: hb-printk [--help] | [--in <path to .syms file & hb-virtdebug.pl>]\n"); + print (" [--out <path to save output data>]\n"); + print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); + print (" This program retrieves the kernel printk buffer from L3.\n"); + print (" User should copy the relevant .syms file & hb-virtdebug.pl to the\n"); + print (" current directory or set the env variable HBDIR to the path of the files.\n\n"); + print (" --help Prints usage information.\n"); + print (" --in Overrides the automatically detected .syms file &\n"); + print (" hb-virtebug.pl in HBDIR or the current directory.\n"); + print (" This program will search for the files in the "); + print ("following order:\n"); + print (" 1. from the path specified by the user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out Directory where the output data will be saved.\n"); + print (" Default path is the current directory.\n"); + print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); + print (" -k# Specify which cage to act on (default = 0).\n"); + print (" -n# Specify which node to act on (default = 0).\n"); + print (" -s# Specify which slot to act on (default = 0).\n"); + print (" -p# Specify which chip position to act on (default = 0).\n"); + print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); + print ("\n NOTE: This program will not work if user has not stopped instructions\n"); + print (" prior to running this program.\n"); +} + diff --git a/src/build/vpo/hb-trace b/src/build/vpo/hb-trace new file mode 100755 index 000000000..5b3556c80 --- /dev/null +++ b/src/build/vpo/hb-trace @@ -0,0 +1,158 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/vpo/hb-trace $ +# +# 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 + +# +# Purpose: This perl script works on VBU and will dump the component trace +# buffers. +# +# Author: CamVan Nguyen +# Last Updated: 09/07/2011 +# + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use strict; +use warnings; + + +#------------------------------------------------------------------------------ +# Forward Declaration +#------------------------------------------------------------------------------ +sub printUsage; + + +#============================================================================== +# MAIN +#============================================================================== + +#------------------------------------------------------------------------------ +# Parse optional input arguments +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +#print "num args = $numArgs\n"; +#print "argument list = @ARGV\n"; + +my $hbDir = $ENV{'HBDIR'}; +if (defined ($hbDir)) +{ + unless ($hbDir ne "") + { + $hbDir = '.'; #Set to current directory + } +} +else +{ + $hbDir = '.'; #Set to current directory +} + +# Skip the component names +my $i = 0; +for ($i=0; $i<$numArgs; $i++) +{ + last if (substr($ARGV[$i], 0, 1) eq '-') +} + +# Parse the other arguments +for ( ;$i<$numArgs; $i++) +{ + if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) + { + #Print command line help + printUsage(); + exit (0); + } + elsif ($ARGV[$i] eq "--in") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --in parameter.\n"; + } + $i++; + $hbDir = $ARGV[$i]; + } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + } + elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) + { + print "Invalid argument entered: $ARGV[$i]\n"; + printUsage(); + exit(1); + } +} + + +#------------------------------------------------------------------------------ +# Dump the component trace buffer(s) +#------------------------------------------------------------------------------ +my $command = "$hbDir/hb-virtdebug.pl --trace @ARGV"; +system($command); + + +#============================================================================== +# SUBROUTINES +#============================================================================== + +#------------------------------------------------------------------------------ +# Print command line help +#------------------------------------------------------------------------------ +sub printUsage() +{ + print ("\nUsage: hb-trace [--help] | [<compName1> <compName2> ...]\n"); + print (" [--in <path to .syms file, hbotStringFile & hb-virtdebug.pl>]\n"); + print (" [--out <path to save output data>]\n"); + print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); + print (" This program retrieves the component trace buffer(s) from L3.\n"); + print (" User should copy the relevant .syms file, hbotStringFile & hb-virtdebug.pl\n"); + print (" to the current directory or set the env variable HBDIR to the path of "); + print ("the files.\n\n"); + print (" User should also set the env variable PATH to include the path to the "); + print ("fsp-trace program.\n\n"); + print (" --help Prints usage information.\n"); + print (" --in Overrides the automatically detected .syms file,\n"); + print (" hbotStringFile & hb-virtdebug.pl in HBDIR or the\n"); + print (" current directory.\n"); + print (" This program will search for the files in the "); + print ("following order:\n"); + print (" 1. from the path specified by the user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out Directory where the output data will be saved.\n"); + print (" Default path is the current directory.\n"); + print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); + print (" -k# Specify which cage to act on (default = 0).\n"); + print (" -n# Specify which node to act on (default = 0).\n"); + print (" -s# Specify which slot to act on (default = 0).\n"); + print (" -p# Specify which chip position to act on (default = 0).\n"); + print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); + print ("\n NOTE: This program will not work if user has not stopped instructions\n"); + print (" prior to running this program.\n"); +} + diff --git a/src/build/tools/hb-dump.pl b/src/build/vpo/hb-virtdebug.pl index 0c6a777a0..577d17b87 100755 --- a/src/build/tools/hb-dump.pl +++ b/src/build/vpo/hb-virtdebug.pl @@ -1,4 +1,26 @@ #!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/vpo/hb-virtdebug.pl $ +# +# 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 # # Purpose: This perl script works on VBU and will dump either the entire L3 or @@ -14,6 +36,7 @@ use strict; use warnings; use POSIX; +use Cwd; #------------------------------------------------------------------------------ @@ -41,21 +64,29 @@ sub printUsage; # MAIN #============================================================================== - #------------------------------------------------------------------------------ # Parse optional input arguments #------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; #print "num args = $numArgs\n"; +#print "arg list: @ARGV\n"; #Initialize default settings my $hbSymsFile = "hbicore.syms"; #Use hbicore.syms my $hbStringFile = "hbotStringFile"; +my $hbErrlParser = "errlparser"; my $dumpPrintk = 0; #Flag to dump printk my $dumpTrace = 0; #Flag to dump trace buffers +my $dumpErrl = 0; #Flag to dump error logs +my $dumpErrlList = 1; #Flag to dump a listing of all error logs +my $dumpErrlDtl = 0; #Flag to dump error log detail data +my $errLogId = "all"; #Error log id; default = all my $dumpAll = 1; #Flag to dump everything my @comp; #Array of component trace buffers to dump my @symsLines; #Array to store the .syms file data +my $outDir = getcwd(); #Default = current working directory +my @ecmdOpt; #Array of ecmd options +my $core = "3"; #Default is core 3 my $hbDir = $ENV{'HBDIR'}; if (defined ($hbDir)) @@ -78,15 +109,24 @@ for (my $i=0; $i<$numArgs; $i++) printUsage(); exit (0); } - elsif ($ARGV[$i] eq "--dir") + elsif ($ARGV[$i] eq "--in") { if (($i + 1) >= $numArgs) { - die "No value given for --dir parameter.\n"; + die "No value given for --in parameter.\n"; } $i++; $hbDir = $ARGV[$i]; } + elsif ($ARGV[$i] eq "--out") + { + if (($i + 1) >= $numArgs) + { + die "No value given for --out parameter.\n"; + } + $i++; + $outDir = $ARGV[$i]; + } elsif ($ARGV[$i] eq "--test") { #Use hbicore_test.syms @@ -115,6 +155,53 @@ for (my $i=0; $i<$numArgs; $i++) push (@comp, $ARGV[$i]); } } + elsif ($ARGV[$i] eq "--errl") + { + #Set flag to dump the error logs + $dumpErrl = 1; + $dumpAll = 0; + + last if (($i + 1) >= $numArgs); + $i++; + + if ($ARGV[$i] eq "-d") + { + $dumpErrlList = 0; + $dumpErrlDtl = 1; + + last if (($i + 1) >= $numArgs); + $i++; + + if (substr($ARGV[$i], 0, 1) eq '-') + { + $i--; + } + else + { + if (isdigit($ARGV[$i])) + { + $errLogId = $ARGV[$i]; + } + else + { + die "ERROR: Enter logid or 'all'" + unless ($ARGV[$i] =~ /all/i); + } + } + } + elsif ($ARGV[$i] ne "-l") + { + $i--; + } + } + elsif ($ARGV[$i] =~ m/^-[c](\d+)/) + { + $core = $1; + } + elsif ($ARGV[$i] =~ m/^-[knsp]\d+/) + { + push(@ecmdOpt, $ARGV[$i]); + } else { print "Invalid argument entered: $ARGV[$i]\n"; @@ -123,12 +210,16 @@ for (my $i=0; $i<$numArgs; $i++) } } +push(@ecmdOpt, "-c$core"); +#print "ecmd options = @ecmdOpt\n"; + + #------------------------------------------------------------------------------ # Check for files needed to dump printk and component traces #------------------------------------------------------------------------------ if (!$dumpAll) { - #Need .syms file for both printk and traces + #Need .syms file for error logs, printk and traces if (!(-e "$hbDir/$hbSymsFile")) { die "Cannot find $hbDir/$hbSymsFile\n"; @@ -140,6 +231,12 @@ if (!$dumpAll) die "Cannot find $hbDir/$hbStringFile\n"; } + #Need errlparser for error logs + if (!(-e "$hbDir/$hbErrlParser") && $dumpErrl) + { + die "Cannot find $hbDir/$hbErrlParser\n"; + } + #Print the files that will be used print "hostboot syms file: $hbDir/$hbSymsFile\n"; @@ -148,6 +245,10 @@ if (!$dumpAll) print "hostboot string file: $hbDir/$hbStringFile\n"; } + if ($dumpErrl) + { + print "hostboot error log parser: $hbDir/$hbErrlParser\n"; + } #------------------------------------------------------------------------------ # Open and read the .syms file #------------------------------------------------------------------------------ @@ -164,14 +265,21 @@ if (!$dumpAll) } #------------------------------------------------------------------------------ +# Output reminder to stop instructions +#------------------------------------------------------------------------------ +print "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; +print "\nREMINDER: User need to stop instructions prior to running this program.\n"; +print "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"; + +#------------------------------------------------------------------------------ #Flush L2 - this step is needed in order to dump L3 quickly #------------------------------------------------------------------------------ my $command = ""; $command = "/afs/awd.austin.ibm.com/projects/eclipz/lab/p8/gsiexe/p8_runso.x86 "; $command .= "/afs/awd.austin.ibm.com/projects/eclipz/lab/p8/gsiexe/p8_l2_flush_x86.so "; -$command .= "-c3 -debug5.6"; -#print "$command\n"; -system("$command"); +$command .= "@ecmdOpt -debug5.6"; +print "$command\n"; +die if (system("$command") != 0); #------------------------------------------------------------------------------ @@ -192,7 +300,9 @@ if ($dumpPrintk) if ((0 != $addr) && (0 != $size)) { - print "Reading the kernel printk buffer...\n\n"; + print "\nReading the kernel printk buffer...\n\n"; + + $string = "$outDir/$string"; $offset = $addr % CACHE_LINE_SIZE; $cacheLines = ceil($size / CACHE_LINE_SIZE); @@ -203,20 +313,28 @@ if ($dumpPrintk) #print "addr $addr, offset $offset, size $size, cacheLines $cacheLines\n"; #Read the kernel printk buffer from L3 and save to file - $command = sprintf ("time p8_dump_l3 %x $cacheLines -f $string -b -c3", + $command = sprintf ("p8_dump_l3 %x $cacheLines -f $string -b @ecmdOpt", $addr); - #print "$command\n"; - system("$command"); - - #Extract and save just the kernel printk buffer - $buffer = readStringBinFile($string, $offset); - writeBinFile($string, $buffer); - - #Output to screen - print "\nKernel printk buffer:"; - print "\n=====================\n\n$buffer\n"; - print "\n=====================\n\n"; - print "Data saved to file $string\n\n"; + print "$command\n"; + die if (system("$command") != 0); + + if (-s $string) + { + #Extract and save just the kernel printk buffer + $buffer = readStringBinFile($string, $offset); + + writeBinFile($string, $buffer); + + #Output to screen + print "\nKernel printk buffer:"; + print "\n=====================\n\n$buffer\n"; + print "\n=====================\n\n"; + print "Data saved to file $string\n\n"; + } + else + { + print "\nWARNING: Cannot read the kernel printk buffer.\n"; + } } } @@ -232,7 +350,9 @@ if ($dumpTrace) if ((0 != $addr) && (0 != $size)) { - print "Reading the component trace buffer(s)...\n\n"; + print "\nReading the component trace buffer(s)...\n\n"; + + $string = "$outDir/$string"; #Read the g_desc_array from L3 and save to file $offset = $addr % CACHE_LINE_SIZE; @@ -243,14 +363,14 @@ if ($dumpTrace) } #print "addr $addr, offset $offset, size $size, cacheLines $cacheLines\n"; - $command = sprintf ("time p8_dump_l3 %x $cacheLines -f $string -b -c3", + $command = sprintf ("p8_dump_l3 %x $cacheLines -f $string -b @ecmdOpt", $addr); - #print "$command\n"; - system("$command"); + print "$command\n"; + die if (system("$command") != 0); #Save the trace buffers $addr = $offset; - for (my $i = 0; $i < MAX_NUM_TRACE_BUFFERS; $i++) + for (my $i = 0; ($i < MAX_NUM_TRACE_BUFFERS) && (-s $string); $i++) { #Get the component name my $compName = readStringBinFile($string, $addr); @@ -275,52 +395,56 @@ if ($dumpTrace) } #print "$compName, addr $compBufAddr, offset $offset, cacheLines $cacheLines\n"; - $command = sprintf ("time p8_dump_l3 %x $cacheLines -f trace.out -b -c3", + $command = sprintf ("p8_dump_l3 %x $cacheLines -f $outDir/trace.out -b @ecmdOpt", $compBufAddr); - #print "$command\n"; - system("$command"); + print "$command\n"; + die if (system("$command") != 0); #Extract just the component trace - $buffer = readBinFile("trace.out", $offset, TRAC_DEFAULT_BUFFER_SIZE); + $buffer = readBinFile("$outDir/trace.out", $offset, TRAC_DEFAULT_BUFFER_SIZE); #Append to tracBIN - appendBinFile('tracBIN', $buffer); - unlink "trace.out"; + appendBinFile("$outDir/tracBIN", $buffer); + unlink "$outDir/trace.out"; } } #Check if file exists and is not empty - if (-s "tracBIN") + if (-z $string) + { + print "\nWARNING: Cannot read the component trace buffers.\n"; + } + elsif (-s "$outDir/tracBIN") { print "\n"; #create tracMERG file - `fsp-trace -s $hbDir/$hbStringFile tracBIN | tee tracMERG`; + `fsp-trace -s $hbDir/$hbStringFile $outDir/tracBIN | tee $outDir/tracMERG`; #Check if file exists and is not empty #This will be false if the fsp-trace tool cannot be found - if (-s "tracMERG") + if (-s "$outDir/tracMERG") { - open FILE, "tracMERG" or die "ERROR: $!"; + open FILE, "$outDir/tracMERG" or die "ERROR: $!"; my @lines = <FILE>; # Read it into an array close(FILE); # Close the file print "\nComponent trace buffer(s):"; print "\n==========================\n\n"; print "@lines\n"; # Output to screen print "\n==========================\n\n"; - print "Data saved to file tracMERG\n\n"; + print "Data saved to $outDir/tracMERG\n\n"; #delete tracBIN file - unlink "tracBIN"; + unlink "$outDir/tracBIN"; } else { - print "\nData saved to file tracBIN\n\n"; + print "\nData saved to $outDir/tracBIN\n\n"; } } else { - print "\nComponent trace buffer(s) not found\n\n"; + print "\nComponent trace buffer(s) not found.\n\n"; } #Delete g_desc_array file @@ -330,48 +454,94 @@ if ($dumpTrace) #------------------------------------------------------------------------------ -#Dump the entire L3 to a file +# Dump the error logs #------------------------------------------------------------------------------ -if ($dumpAll) +if ($dumpErrl) { - print "Dumping L3...\n\n"; + #Find address and size of the g_ErrlStorage from the .syms file + $string = 'g_ErrlStorage'; + ($addr, $size) = getAddrNSize($string, \@symsLines); - #Get current timestamp - my $timeStamp = strftime "%Y%m%d%H%M\n", localtime; - chomp $timeStamp; - #print "timestamp: $timeStamp\n"; + if ((0 != $addr) && (0 != $size)) + { + print "\nReading the error log(s)...\n\n"; - #Dump L3 to file - my $hbDumpFile = "hbdump.$timeStamp"; - $command = "time p8_dump_l3 0 65536 -f $hbDumpFile -b -c3"; - #print "$command\n"; - system("$command"); + $string = "$outDir/$string"; - print "\nDump saved to $hbDumpFile.\n"; + #Read the binary error log buffer from L3 and save to file + $offset = $addr % CACHE_LINE_SIZE; + $cacheLines = ceil($size / CACHE_LINE_SIZE); + if ($offset != 0) + { + $cacheLines += 1; + } + #print "addr $addr, offset $offset, size $size, cacheLines $cacheLines\n"; - #Check if we can extract the dump - if ((-e "$hbDir/exthbdump.pl") && - (-e "$hbDir/$hbSymsFile") && - (-e "$hbDir/$hbStringFile")) - { - if ($hbSymsFile eq "hbicore_test.syms") + $command = sprintf ("p8_dump_l3 %x $cacheLines -f $string -b @ecmdOpt", + $addr); + print "$command\n"; + die if (system("$command") != 0); + + if (-s $string) { - $command = "$hbDir/exthbdump.pl $hbDumpFile --dir $hbDir --test"; + #Extract and save just the error log buffer + $buffer = readBinFile($string, $offset, $size); + writeBinFile($string, $buffer); + + #Parse error log buffer and save to file + my $hbErrlFile = "$outDir/Errorlogs"; + if ($dumpErrlList) + { + $command = sprintf("$hbDir/$hbErrlParser $string|tee $hbErrlFile"); + } + else + { + $command = sprintf("$hbDir/$hbErrlParser $string -d $errLogId |tee $hbErrlFile"); + } + die if (system("$command") != 0); + + if (-s $hbErrlFile) + { + print "\n\nData saved to file $hbErrlFile\n\n"; + unlink "$string"; + } } else { - $command = "$hbDir/exthbdump.pl $hbDumpFile --dir $hbDir"; + print "\nWARNING: Cannot read the error logs.\n"; } + } +} - print "\nExtracting dump...\n"; - #print "$command\n"; - system"$command"; - #print "Dump extracted to dumpout.$hbDumpFile\n\n"; +#------------------------------------------------------------------------------ +#Dump the entire L3 to a file +#------------------------------------------------------------------------------ +if ($dumpAll) +{ + print "\nDumping L3...\n\n"; + + #Get current timestamp + my $timeStamp = strftime "%Y%m%d%H%M\n", localtime; + chomp $timeStamp; + #print "timestamp: $timeStamp\n"; + + #Dump L3 to file + my $hbDumpFile = "$outDir/hbdump.$timeStamp"; + $command = "p8_dump_l3 0 65536 -f $hbDumpFile -b @ecmdOpt"; + print "$command\n"; + die if (system("$command") != 0); + + #Check if hbDumpFile exists and is not empty + if (-s "$hbDumpFile") + { + print "\nHostBoot dump saved to $hbDumpFile.\n"; + print "Use hb-parsedump.pl program to parse the dump.\n"; } else { - print "Use exthbdump.pl to extract and view dump.\n\n"; + print "\nWARNING: Cannot dump L3. Did you stop instructions?\n\n"; + unlink $hbDumpFile; } } @@ -492,26 +662,41 @@ sub appendBinFile($$) #------------------------------------------------------------------------------ sub printUsage() { - print ("\nUsage: hb-dump.pl [--help] | [--dir <path to .syms file & hbotStringFile>]\n"); - print (" [--test] [--printk]\n"); - print (" [--trace [<compName1 compName2 compName3 ...>]]\n\n"); - print (" This program dumps the user requested data from L3.\n"); + print ("\nUsage: hb-virtdebug.pl [--help] | [--in <path to .syms file, hbotStringFile & errlparser>]\n"); + print (" [--out <path to save output data>]\n"); + print (" [--test] [--errl [-l | -d [<logid>|all]] [--printk]\n"); + print (" [--trace [<compName1 compName2 compName3 ...>]]\n"); + print (" [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); + print (" This program retrieves the user requested data from L3.\n"); print (" If no options are specified, this program will dump the entire L3 to a file.\n"); - print (" Use the exthbdump.pl program to parse and view data in the file.\n\n"); - print (" User should copy the relevant .syms file and hbotStringFile\n"); + print (" Use the hb-parsedump.pl program to expand and view data in the file.\n\n"); + print (" User should copy the relevant .syms file, hbotStringFile & errlparser\n"); print (" to the current directory or set the env variable HBDIR to the path\n"); - print (" of the hbicore.syms/hbicore_test.syms files & hbotStringFile.\n\n"); - print (" User should also copy the fsp-trace program to the current directory\n"); - print (" or set the env variable PATH to include the path to the program.\n\n"); - print (" --help: Prints usage information\n"); - print (" --dir: Override the automatically detected .syms and hbotStringFile\n"); - print (" in HBDIR or the current directory. This program will search\n"); - print (" for the files in the following order:\n"); - print (" 1. from the path specified by user\n"); - print (" 2. from HBDIR if it is defined\n"); - print (" 3. from the current directory\n"); - print (" --test: Use the hbicore_test.syms file vs the hbicore.syms file\n"); - print (" --printk: Dumps the kernel printk buffer only\n"); - print (" --trace: Dumps all or just the user specified component trace buffer(s)\n"); + print (" of the files.\n\n"); + print (" User should also set the env variable PATH to include the path to the fsp-trace program.\n\n"); + print (" --help Prints usage information\n"); + print (" --in Overrides the automatically detected .syms file,\n"); + print (" hbotStringFile & errlparser in HBDIR or the current\n"); + print (" directory. This program will search for the files in\n"); + print (" the following order:\n"); + print (" 1. from the path specified by user\n"); + print (" 2. from HBDIR if it is defined\n"); + print (" 3. from the current directory\n"); + print (" --out Directory where the output data will be saved\n"); + print (" Default path is the current directory\n"); + print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); + print (" --errl Dumps the error logs\n"); + print (" -l Dumps a listing of all the error logs\n"); + print (" -d <logid> Dumps detailed data of the specified error log\n"); + print (" -d [all] Dumps detailed data of all error logs\n"); + print (" --printk Dumps the kernel printk buffer only\n"); + print (" --trace Dumps all or just the user specified component trace buffer(s)\n"); + print (" -k# Specify which cage to act on (default = 0)\n"); + print (" -n# Specify which node to act on (default = 0)\n"); + print (" -s# Specify which slot to act on (default = 0)\n"); + print (" -p# Specify which chip position to act on (default = 0)\n"); + print (" -c# Specify which core/chipUnit to act on (default = 3)\n"); + print ("\n NOTE: This program will not work if user has not stopped instructions\n"); + print (" prior to running this program.\n"); } diff --git a/src/usr/errl/parser/errlparser.C b/src/usr/errl/parser/errlparser.C index 684dbf2a7..127080f5f 100644 --- a/src/usr/errl/parser/errlparser.C +++ b/src/usr/errl/parser/errlparser.C @@ -48,7 +48,7 @@ using namespace ERRORLOG; #define USAGE "\ Usage:\n\ \n\ -errlparser [-i] <imagefile> [[-s] <symsfile>] [-l | -d <logid>] [-v]\n\ +errlparser [-i] <imagefile> [[-s] <symsfile>] [-l | -d [<logid>|all]] [-v]\n\ \n\ Arguments:\n\ <imagefile> data file name\n\ @@ -575,6 +575,7 @@ int main( int argc, char *argv[] ) int fVerbose = 0; int fList = 1; int fDetail = 0; + int fAll = 0; int fFound = 0; @@ -598,15 +599,23 @@ int main( int argc, char *argv[] ) i++; if( i >= argc ) { - fprintf( stdout, "Provide -d <logid>\n" ); - exit( 2 ); + // nothing after -d + fAll = 1; } - int c = sscanf( argv[i], "%d", &ulLogId ); - if( c != 1 ) + else if( 0 == strcmp( argv[i], "all" )) { - fprintf( stdout, "Provide -d <decimal log ID>\n" ); - exit( 2 ); + fAll = 1; + } + else + { + int c = sscanf( argv[i], "%d", &ulLogId ); + if( c != 1 ) + { + fprintf( stdout, "Provide -d <decimal log ID>\n" ); + exit( 2 ); + } } + fList = 0; fDetail = 1; } @@ -774,7 +783,7 @@ int main( int argc, char *argv[] ) printf( "%s\n", szDivider ); PrintErrlSummary( perr ); } - else if(( fDetail ) && ( perr->logId == ulLogId )) + else if(( fDetail ) && (( perr->logId == ulLogId ) || (fAll))) { // Print the detail for the one error log. printf( "%s\n", szDivider ); |