summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2013-06-24 12:35:57 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-07-10 16:29:19 -0500
commitb649b6d8ad62262517b7e0da90fbfd81283f4764 (patch)
tree25c868da431cc42dd201512df8b4a1b0048915f3 /src/build
parent8e6af8d1488285d670754de8f34ffba9ce57db92 (diff)
downloadtalos-hostboot-b649b6d8ad62262517b7e0da90fbfd81283f4764.tar.gz
talos-hostboot-b649b6d8ad62262517b7e0da90fbfd81283f4764.zip
Enhance hb-dump to support full memory extraction.
Change-Id: I74823572a4935d3c8c4d7999d8c00c0286de1523 RTC: 50233 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5170 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/debug/Hostboot/Dump.pm112
-rwxr-xr-xsrc/build/debug/fsp-memdump.sh161
-rw-r--r--src/build/mkrules/dist.rules.mk2
-rw-r--r--src/build/mkrules/dist.targets.mk5
-rwxr-xr-xsrc/build/simics/hb-simdebug.py41
-rwxr-xr-xsrc/build/tools/hb-parsedump.pl495
-rwxr-xr-xsrc/build/vpo/hb-dump30
-rwxr-xr-xsrc/build/vpo/hb-virtdebug.pl6
8 files changed, 284 insertions, 568 deletions
diff --git a/src/build/debug/Hostboot/Dump.pm b/src/build/debug/Hostboot/Dump.pm
index 9eb4ee11f..43ace962b 100755
--- a/src/build/debug/Hostboot/Dump.pm
+++ b/src/build/debug/Hostboot/Dump.pm
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
@@ -28,37 +28,123 @@ package Hostboot::Dump;
use Exporter;
our @EXPORT_OK = ('main');
-use constant L3_SIZE => 0x800000;
+use Fcntl qw(SEEK_SET);
+
+use constant MEMSTATE_NO_MEM => 0x0;
+use constant MEMSTATE_HALF_CACHE => 0x4;
+use constant MEMSTATE_FULL_CACHE => 0x8;
+use constant MEMSTATE_MS_32MEG => 0x20;
+use constant MEMSTATE_PRE_SECURE_BOOT => 0xff;
+
+use constant _KB => 1024;
+use constant _MB => 1024 * 1024;
+
+# Map the available memory at each state.
+our %memory_maps = (
+ MEMSTATE_NO_MEM() =>
+ # No memory has been initialized so we can only dump our static
+ # code load up to 512 - 4k. The 4k is a reserved space for the
+ # Secureboot Header.
+ [ 0, (512 - 4) * _KB
+ ],
+ MEMSTATE_PRE_SECURE_BOOT() =>
+ # Until the early secureboot operations have been done, we can
+ # only access the top 512k of each 1MB column. Need to avoid
+ # the hole for the MBOX DMA buffers (64K @ 3MB + 256K).
+ [ (512 - 4) * _KB, 4 * _KB,
+ 1 * _MB, 512 * _KB,
+ 2 * _MB, 512 * _KB,
+ 3 * _MB, 256 * _KB,
+ 3 * _MB + (256 + 64) * _KB, (256 - 64) * _KB
+ ],
+ MEMSTATE_HALF_CACHE() =>
+ # All of the first 4MB can now be read (except reserved MBOX).
+ [ 512 * _KB, 512 * _KB,
+ 1 * _MB + 512 * _KB, 512 * _KB,
+ 2 * _MB + 512 * _KB, 512 * _KB,
+ 3 * _MB + 512 * _KB, 512 * _KB
+ ],
+ MEMSTATE_FULL_CACHE() =>
+ # Add next full 4MB after we expand to the full cache.
+ [ 4 * _MB, 1 * _MB,
+ 5 * _MB, 1 * _MB,
+ 6 * _MB, 1 * _MB,
+ 7 * _MB, 1 * _MB
+ ],
+ MEMSTATE_MS_32MEG() =>
+ # Add next 24MB after we expand to memory.
+ [ 8 * _MB, 24 * _MB
+ ]
+);
+
+# Map the current state to the combined states available.
+our %memory_states = (
+ MEMSTATE_NO_MEM() => [ MEMSTATE_NO_MEM ],
+ MEMSTATE_PRE_SECURE_BOOT() => [ MEMSTATE_NO_MEM, MEMSTATE_PRE_SECURE_BOOT ],
+ MEMSTATE_HALF_CACHE() => [ MEMSTATE_NO_MEM, MEMSTATE_PRE_SECURE_BOOT,
+ MEMSTATE_HALF_CACHE ],
+ MEMSTATE_FULL_CACHE() => [ MEMSTATE_NO_MEM, MEMSTATE_PRE_SECURE_BOOT,
+ MEMSTATE_HALF_CACHE, MEMSTATE_FULL_CACHE ],
+ MEMSTATE_MS_32MEG() => [ MEMSTATE_NO_MEM, MEMSTATE_PRE_SECURE_BOOT,
+ MEMSTATE_HALF_CACHE, MEMSTATE_FULL_CACHE,
+ MEMSTATE_MS_32MEG ]
+);
sub main
{
my ($packName,$args) = @_;
- #Get current timestamp
+ # Parse 'debug' option.
+ my $debug = 0;
+ if (defined $args->{"debug"})
+ {
+ $debug = 1;
+ }
+
+ # Read the current memory state.
+ my ($memstate_addr, $memstate_size) =
+ ::findSymbolAddress("KernelMemState::state");
+ my $memstate = ::read32($memstate_addr + 4); # only need bottom 32 bits
+ ::userDisplay (sprintf "Current state is %x\n", $memstate) if $debug;
+
+ #Get current timestamp and open a corresponding file.
my $timeStamp = `date +%Y%m%d%H%M`;
chomp $timeStamp;
- #::userDisplay "timestamp: $timeStamp\n";
-
my $hbDumpFile = "hbdump.$timeStamp";
- ::userDisplay "Dumping L3 to Open output file $hbDumpFile..\n";
+ ::userDisplay "Dumping Hostboot to Open output file $hbDumpFile\n";
open( OUTFH, ">$hbDumpFile" ) or die "can't open $hbDumpFile: $!\n";
+ binmode(OUTFH);
+
+ # Read memory regions and output to file.
+ foreach my $state (@{$memory_states{int $memstate}})
+ {
+ my $regions = $memory_maps{int $state};
+
+ while (scalar(@{$regions}))
+ {
+ my $start = shift @{$regions};
+ my $length = shift @{$regions};
+ ::userDisplay (sprintf "\t%x@%x\n", $length, $start) if $debug;
- ## read in 8 MB!!
- my $data = ::readData( 0, L3_SIZE );
- write( OUTFH, $data );
- close( OUTFH ) or die "can't close $hbDumpFile: $!\n";
+ my $data = ::readData($start, $length);
+ seek OUTFH, $start, SEEK_SET;
+ print OUTFH $data;
+ }
+ }
+ # Close file.
+ close OUTFH;
#Check if hbDumpFile exists and is not empty
if (-s "$hbDumpFile" )
{
::userDisplay "\nHostBoot dump saved to $hbDumpFile.\n";
- ::userDisplay "Use hb-parsedump.pl program to parse the dump.\n";
+ ::userDisplay "Use the hb-dump-debug program to parse the dump.\n";
}
else
{
- ::userDisplay "\nWARNING: Cannot dump L3. Did you stop instructions?\n\n";
+ ::userDisplay "\nWARNING: Cannot dump HB. Did you stop instructions?\n\n";
unlink $hbDumpFile;
}
}
@@ -67,6 +153,6 @@ sub helpInfo
{
my %info = (
name => "Dump",
- intro => ["Dumps the entire L3 buffer to a file."],
+ intro => ["Dumps the entire Hostboot buffer to a file."],
);
}
diff --git a/src/build/debug/fsp-memdump.sh b/src/build/debug/fsp-memdump.sh
new file mode 100755
index 000000000..25d347fa4
--- /dev/null
+++ b/src/build/debug/fsp-memdump.sh
@@ -0,0 +1,161 @@
+#!/bin/sh
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/fsp-memdump.sh $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2013
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+
+
+# @fn usage
+# Print usage statement.
+usage()
+{
+ echo "memdump.sh <filename> [STATE|discover]"
+ echo
+ echo " STATE should be a two nibble hex value corresponding to the"
+ echo " MemSize enumeration in <kernel/memstate.H> or the ASCII string"
+ echo " 'discover'."
+ exit -1
+}
+
+# @fn dump
+# Extract a block of memory using cipgetmempba.
+#
+# @param addr - Address to extract.
+# @param size - Size (in bytes) to extract.
+dump()
+{
+ addr=$1
+ size=$2
+
+ memaddr=`expr $addr + $HRMOR`
+
+ echo "Extracting ${size}@${addr}"
+
+ cipgetmempba `printf "%08x" ${memaddr}` ${size} -fb /tmp/memdump.part
+ dd bs=1 if=/tmp/memdump.part of=${FILE} seek=${addr} count=${size} \
+ conv=notrunc
+ rm /tmp/memdump.part
+}
+
+# @fn discover
+# Read the HB descriptor to determine the current memory state and update the
+# STATE variable.
+discover()
+{
+ # Calculate hostboot descriptor address. (0x2000 + 8 + HRMOR)
+ descriptor_addr=`expr 8200 + $HRMOR`
+ descriptor_h=`printf "%08x" ${descriptor_addr}`
+
+ # Extract descriptor base address.
+ state_base_h=`cipgetmempba ${descriptor_h} 8 -ox -quiet | tail -n1`
+ state_base=`printf "%d" ${state_base_h}`
+
+ # Calculate offset for the state variable within the descriptor.
+ # Last byte of 3rd 8-byte entry. (16 + 7 + BASE + HRMOR)
+ state_addr=`expr 16 + 7 + ${state_base} + ${HRMOR}`
+ state_addr_h=`printf "%08x" ${state_addr}`
+
+ # Read state.
+ STATE=`cipgetmempba ${state_addr_h} 1 -ox -quiet | tail -n1 | sed "s/0x//"`
+}
+
+# Read filename and state.
+FILE=$1
+STATE=$2
+if [[ -z ${FILE} ]]; then
+ usage
+fi
+
+if [[ -z ${STATE} ]]; then
+ STATE=08
+fi
+
+# Calculate HRMOR (in decimal).
+HRMOR=`expr 128 \* 1024 \* 1024`
+
+# Using initial STATE, iterate through all the included states dumping each's
+# appropriate memory sections.
+while [[ ${STATE} != BREAK ]]
+do
+ case ${STATE} in
+ 00|0)
+ dump 0 520192
+ STATE=BREAK
+ ;;
+ ff|FF)
+ dump 520192 4096
+ dump 1048576 524288
+ dump 2097152 524288
+ dump 3145728 262144
+ dump 3473408 196608
+ STATE=00
+ ;;
+ 04|4)
+ dump 524288 524288
+ dump 1572864 524288
+ dump 2621440 524288
+ dump 3670016 524288
+ STATE=ff
+ ;;
+ 08|8)
+ dump 4194304 1048576
+ dump 5242880 1048576
+ dump 6291456 1048576
+ dump 7340032 1048576
+ STATE=04
+ ;;
+ 20)
+ dump 8388608 1048576
+ dump 9437184 1048576
+ dump 10485760 1048576
+ dump 11534336 1048576
+ dump 12582912 1048576
+ dump 13631488 1048576
+ dump 14680064 1048576
+ dump 15728640 1048576
+ dump 16777216 1048576
+ dump 17825792 1048576
+ dump 18874368 1048576
+ dump 19922944 1048576
+ dump 20971520 1048576
+ dump 22020096 1048576
+ dump 23068672 1048576
+ dump 24117248 1048576
+ dump 25165824 1048576
+ dump 26214400 1048576
+ dump 27262976 1048576
+ dump 28311552 1048576
+ dump 29360128 1048576
+ dump 30408704 1048576
+ dump 31457280 1048576
+ dump 32505856 1048576
+ STATE=08
+ ;;
+ discover) # Call discover function to determine state.
+ discover
+ ;;
+ *)
+ echo Unsupported STATE.
+ STATE=BREAK
+ ;;
+ esac
+done
+
diff --git a/src/build/mkrules/dist.rules.mk b/src/build/mkrules/dist.rules.mk
index b9b069920..31c5a9532 100644
--- a/src/build/mkrules/dist.rules.mk
+++ b/src/build/mkrules/dist.rules.mk
@@ -356,7 +356,7 @@ $(TARGET_DIR)/$(1)$(call __ODE_REMAKE_TARGET, $(2)) : \
@$$(call EXECUTE_IN_SANDBOX,\
mkdir -p $(firstword $(subst :, ,$(2))) && \
cd $(firstword $(subst :, ,$(2))) && \
- mk -O1 -a $(subst NOTARGET,,$(word 2, $(subst :, ,$(2)))),\
+ mk -O1 -j8 -a $(subst NOTARGET,,$(word 2, $(subst :, ,$(2)))),\
$(word 3, $(subst :, ,$(2))))
@touch $$@
endef
diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk
index 111b54e8a..fc42f8ad7 100644
--- a/src/build/mkrules/dist.targets.mk
+++ b/src/build/mkrules/dist.targets.mk
@@ -46,9 +46,9 @@ VALID_TARGETS = fsp vpo tools
# Format is <source file>:<comma separated targets>
#
COPY_FILES = \
- src/build/tools/hb-parsedump.pl:tools,vpo \
src/build/debug/hb-dump-debug:tools,vpo \
src/build/debug/vpo-debug-framework.pl:vpo \
+ src/build/debug/fsp-memdump.sh:tools,vpo \
src/build/vpo/hb-dump:vpo \
src/build/vpo/hb-istep:vpo \
src/build/vpo/hb-virtdebug.pl:vpo \
@@ -199,7 +199,8 @@ fsp.tar_CONTENTS = \
$(addsuffix :plugins/,\
$(call ROOTPATH_WILDCARD,obj/genfiles/plugins/hbfwSrcParse*.C)) \
$(addsuffix :plugins/,\
- $(call ROOTPATH_WILDCARD,src/usr/*/plugins/*))
+ $(call ROOTPATH_WILDCARD,src/usr/*/plugins/*)) \
+ src/build/debug/fsp-memdump.sh:src/build/debug/
#
# Portions of the FSP sandbox which must be rebuilt based on file changes.
diff --git a/src/build/simics/hb-simdebug.py b/src/build/simics/hb-simdebug.py
index 048546b46..28c8f9588 100755
--- a/src/build/simics/hb-simdebug.py
+++ b/src/build/simics/hb-simdebug.py
@@ -29,39 +29,6 @@ import datetime
import commands ## getoutput, getstatusoutput
import random
-#------------------------------------------------------------------------------
-# Function to dump L3
-#------------------------------------------------------------------------------
-def dumpL3():
-
- # "constants"
- L3_SIZE = 0x800000
- FULL_MEM_SIZE = 32*1024*1024 # 32 MB
-
- print
-
- # Get a timestamp on when dump was collected
- t = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
-
- # Get memory object.
- mem = conf.system_cmp0.phys_mem.map[0][1];
- if 'l3_cache_ram' in mem.name:
- offset = 0
- size = L3_SIZE
- else:
- offset = getHRMOR()
- size = FULL_MEM_SIZE
-
- #dump L3 to hbdump.<timestamp>
- string = "(system_cmp0.phys_mem)->map[0][1]->image.save hbdump.%s 0x%x 0x%x"%(t, offset, size)
- #print string
- result = run_command(string)
- #print result
-
- print "HostBoot dump saved to %s/hbdump.%s"%(os.getcwd(),t)
-
- return
-
#===============================================================================
# HOSTBOOT Commands
#===============================================================================
@@ -117,17 +84,13 @@ Examples: \n
#------------------------------------------------
#------------------------------------------------
-def hb_dump():
- dumpL3()
- return None
-
new_command("hb-dump",
- hb_dump,
+ lambda: run_hb_debug_framework("Dump", outputFile = "hb-dump.output"),
#alias = "hbt",
type = ["hostboot-commands"],
#see_also = ["hb-trace"],
see_also = [ ],
- short = "Dumps L3 to hbdump.<timestamp>",
+ short = "Dumps HB memory to hbdump.<timestamp>",
doc = """
Parameters: \n
diff --git a/src/build/tools/hb-parsedump.pl b/src/build/tools/hb-parsedump.pl
deleted file mode 100755
index 547b6e06f..000000000
--- a/src/build/tools/hb-parsedump.pl
+++ /dev/null
@@ -1,495 +0,0 @@
-#!/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
-# the code version, kernel printk buffer and components traces.
-#
-# Author: CamVan Nguyen
-# Last Updated: 07/06/2011
-#
-
-#
-# Usage:
-# hb-parsedump.pl <dumpfile> [--test]
-# [--img-path <path to .syms file, hbotStringFile, & errlparser>]
-# [--out-path <path to save output data>]\n");
-
-
-#------------------------------------------------------------------------------
-# Specify perl modules to use
-#------------------------------------------------------------------------------
-use strict;
-use warnings;
-use Cwd;
-use File::Basename;
-use File::Copy;
-
-#------------------------------------------------------------------------------
-# Constants
-#------------------------------------------------------------------------------
-use constant MAX_NUM_TRACE_BUFFERS => 48;
-use constant DESC_ARRAY_ENTRY_ADDR_SIZE => 8;
-use constant DESC_ARRAY_ENTRY_COMP_NAME_SIZE => 16;
-use constant TRAC_DEFAULT_BUFFER_SIZE => 0x0800;
-use constant TRAC_BUFFER_SIZE_OFFSET => 20;
-use constant TRAC_BUFFER_SIZE_SIZE => 4;
-
-
-#------------------------------------------------------------------------------
-# Forward Declaration
-#------------------------------------------------------------------------------
-sub getAddrNSize;
-sub readBinFile;
-sub readStringBinFile;
-sub writeBinFile;
-sub appendBinFile;
-sub printUsage;
-
-
-#==============================================================================
-# MAIN
-#==============================================================================
-
-
-#------------------------------------------------------------------------------
-# Print Command Line Help
-#------------------------------------------------------------------------------
-my $numArgs = $#ARGV + 1;
-if ($numArgs < 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);
-}
-
-#------------------------------------------------------------------------------
-# Parse the input argument(s)
-#------------------------------------------------------------------------------
-
-#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{'HB_IMGDIR'};
-if (defined ($hbDir))
-{
- unless ($hbDir ne "")
- {
- $hbDir = '.'; #Set to current directory
- }
-}
-else
-{
- $hbDir = '.'; #Set to current directory
-}
-
-# Save the user specifed dump file
-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 "--img-path")
- {
- if (($i + 1) >= $numArgs)
- {
- die "No value given for --img-path parameter.\n";
- }
- $i++;
- $hbDir = $ARGV[$i];
- }
- elsif ($ARGV[$i] eq "--out-path")
- {
- if (($i + 1) >= $numArgs)
- {
- die "No value given for --out-path parameter.\n";
- }
- $i++;
- $outDir = $ARGV[$i];
- }
- elsif ($ARGV[$i] eq "--test")
- {
- #Use hbicore_test.syms
- $hbSymsFile = 'hbicore_test.syms';
- }
- else
- {
- print "Invalid argument entered: $ARGV[$i]\n";
- exit(1);
- }
-}
-
-#Check for existence of .syms file and hbotStringFile
-if (!(-e "$hbDir/$hbSymsFile"))
-{
- die "Cannot find $hbDir/$hbSymsFile\n";
-}
-
-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 = "$outDir/dumpout.$hbDumpFileBase";
-if (-d $extDir)
-{
- print "ERROR: directory $extDir exists.\n";
- exit (1);
-}
-
-mkdir $extDir;
-
-
-#------------------------------------------------------------------------------
-# Open and read the .syms file
-#------------------------------------------------------------------------------
-open SYMSFILE, "$hbDir/$hbSymsFile" or
- die "ERROR: $hbDir/$hbSymsFile not found : $!";
-my @symslines = <SYMSFILE>; # Read it into an array
-close(SYMSFILE); # Close the file
-
-unless (@symslines)
-{
- print "ERROR: $hbDir/$hbSymsFile is empty\n";
- exit (1);
-}
-
-
-#------------------------------------------------------------------------------
-# Extract the code version / image id
-#------------------------------------------------------------------------------
-#Find address and size of the hbi_ImageId from the .syms file
-my $string = 'hbi_ImageId';
-my $buffer = 0;
-my ($addr, $size) = getAddrNSize($string, \@symslines);
-
-if (0 != $addr)
-{
- #Read the hbi_ImageId from dump file and save to file
- $buffer = readStringBinFile($hbDumpFile, $addr);
-
- chdir "$extDir";
- writeBinFile($string, $buffer);
- chdir "$cwd";
-}
-
-
-#------------------------------------------------------------------------------
-# Extract the kernel printk buffer
-#------------------------------------------------------------------------------
-#Find address and size of the kernel_printk_buffer from the .syms file
-$string = 'kernel_printk_buffer';
-($addr, $size) = getAddrNSize($string, \@symslines);
-
-if ((0 != $addr) && (0 != $size))
-{
- #Read the kernel printk buffer from dump file and save to file
- #$buffer = readBinFile($hbDumpFile, $addr, $size);
- $buffer = readStringBinFile($hbDumpFile, $addr);
- chdir "$extDir";
- writeBinFile($string, $buffer);
- chdir "$cwd";
-}
-
-
-#------------------------------------------------------------------------------
-# Extract the component traces
-#------------------------------------------------------------------------------
-#Find address and size of the g_desc_array from the .syms file
-$string = 'g_desc_array';
-($addr, $size) = getAddrNSize($string, \@symslines);
-
-if ((0 != $addr) && (0 != $size))
-{
- #Read the g_desc_array from dump file and save the trace buffers
- for (my $i = 0; $i < MAX_NUM_TRACE_BUFFERS; $i++)
- {
- #get the component name
- my $compName = readStringBinFile($hbDumpFile, $addr);
- chomp $compName;
- last if ($compName eq "");
-
- #get the component trace buffer address
- $addr += DESC_ARRAY_ENTRY_COMP_NAME_SIZE;
- $buffer = readBinFile($hbDumpFile, $addr, DESC_ARRAY_ENTRY_ADDR_SIZE);
- my $compBufAddr= unpack('H*',$buffer);
- $compBufAddr = hex $compBufAddr;
- #print "Component: $compName, $buffer, $compBufAddr\n";
- $addr += DESC_ARRAY_ENTRY_ADDR_SIZE;
-
- # read a portion of the buffer header to get its size
- $buffer = readBinFile($hbDumpFile,
- $compBufAddr+TRAC_BUFFER_SIZE_OFFSET,
- TRAC_BUFFER_SIZE_SIZE);
- my $compBufferSize = unpack('H*',$buffer);
- $compBufferSize = hex $compBufferSize;
-
-
- #read the component trace buffer and save to file
- #read the component trace buffer
- $buffer = readBinFile($hbDumpFile, $compBufAddr, $compBufferSize );
-
- chdir "$extDir";
-
- #append to tracBIN
- appendBinFile('tracBIN', $buffer);
-
- chdir "$cwd";
- }
-
- #check if file exists and is not empty
- if (-s $extDir.'/tracBIN')
- {
- #create tracMERG file
- $string = sprintf ("fsp-trace -s %s/%s %s/tracBIN > %s/tracMERG",
- $hbDir, $hbStringFile, $extDir, $extDir);
- #print "$string\n";
- `$string`;
-
- if (-s "$extDir/tracMERG")
- {
- #delete tracBIN file
- unlink $extDir.'/tracBIN';
- }
- }
-}
-
-#------------------------------------------------------------------------------
-# Extract the error logs
-#------------------------------------------------------------------------------
-#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 "\nDump extracted to $extDir\n";
-
-
-#==============================================================================
-# SUBROUTINES
-#==============================================================================
-
-#------------------------------------------------------------------------------
-# Parse the .syms data to find the relevant address and size for the data
-# requested.
-#------------------------------------------------------------------------------
-sub getAddrNSize($\@)
-{
- my $addr = 0;
- my $size = 0;
-
- my $string = $_[0];
- my (@array) = @{$_[1]};
- #print "$string\n";
- #print "@array\n";
-
- #search for string in array
- my @line = grep /$string/,@array;
- #print "@line\n";
-
- #if found string
- if (@line)
- {
- my @list = split(/,+/,$line[0]);
- #print "@list\n";
-
- $addr = hex $list[1];
- $size = hex $list[3];
- #print "$addr\n";
- #print "$size\n";
- }
-
- return($addr, $size);
-}
-
-#------------------------------------------------------------------------------
-# Read a block of data from a binary file.
-#------------------------------------------------------------------------------
-sub readBinFile($$$)
-{
- my ($file, $addr, $size) = @_;
- #print "$file, $addr, $size\n";
-
- #Open the dump file for reading
- open FILE, $file or die "ERROR: $file not found : $!";
- binmode FILE;
-
- seek FILE, $addr, 0 or die "Couldn't seek to $addr in $file: $!\n";
- #print tell FILE; print "\n";
- my $bytesRead = read(FILE, my $buffer, $size);
- #print tell FILE; print "\n";
- #print "#bytes read: $bytesRead\n";
- #print "buffer: $buffer\n";
-
- close (FILE);
- return ($buffer);
-}
-
-#------------------------------------------------------------------------------
-# Read a NULL terminated string from a binary file.
-#------------------------------------------------------------------------------
-sub readStringBinFile($$)
-{
- my ($file, $addr) = @_;
- #print "$file, $addr\n";
-
- #Open the dump file for reading
- open FILE, $file or die "ERROR: $file not found : $!";
- binmode FILE;
-
- local $/ = "\0"; #Set to NULL termination
- #my $tmp = $/;
- #$/ = "\0"; #Set to NULL termination
- seek FILE, $addr, 0 or die "Couldn't seek to $addr in $file: $!\n";
- #print tell FILE; print "\n";
- my $string = <FILE>;
- #print tell FILE; print "\n";
- chomp $string; #Remove NULL termination
- #print "$string\n";
- #$/ = $tmp; #Restore $/
-
- close (FILE);
- return ($string);
-}
-
-#------------------------------------------------------------------------------
-# Write a block of data to a binary file.
-#------------------------------------------------------------------------------
-sub writeBinFile($$)
-{
- my ($file, $buffer) = @_;
- open (FILE, ">$file") or die "ERROR: $file cannot be opened: $!";
- binmode FILE;
- print FILE $buffer;
- close (FILE);
-}
-
-#------------------------------------------------------------------------------
-# Append a block of data to a binary file.
-#------------------------------------------------------------------------------
-sub appendBinFile($$)
-{
- my ($file, $buffer) = @_;
- open (FILE, ">>$file") or die "ERROR: $file cannot be opened: $!";
- binmode FILE;
- print FILE $buffer;
- close (FILE);
-}
-
-#------------------------------------------------------------------------------
-# Print command line help
-#------------------------------------------------------------------------------
-sub printUsage()
-{
- print ("\nUsage: hb-parsedump.pl [--help] | <dumpfile> [--test]\n");
- print (" [--img-path <path to .syms file, hbotStringFile & errlparser>]\n");
- print (" [--out-path <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 HB_IMGDIR 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 (" --img-path: Overrides the automatically detected .syms file, hbotStringFile\n");
- print (" and errlparser in HB_IMGDIR 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 HB_IMGDIR if it is defined\n");
- print (" 3. from the current directory\n");
- print (" --out-path: 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
index eacbe9e35..af8de2927 100755
--- a/src/build/vpo/hb-dump
+++ b/src/build/vpo/hb-dump
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/vpo/hb-dump $
+# $Source: src/build/vpo/hb-dump $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script works on VBU and will dump the entire L3 cache
@@ -101,7 +101,7 @@ sub printUsage()
print (" [--out-path <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 (" Use the hb-dump-debug 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 HB_IMGDIR to the path of the file.\n\n");
print (" --help Prints usage information.\n");
diff --git a/src/build/vpo/hb-virtdebug.pl b/src/build/vpo/hb-virtdebug.pl
index d9bc88cfe..074f552be 100755
--- a/src/build/vpo/hb-virtdebug.pl
+++ b/src/build/vpo/hb-virtdebug.pl
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
@@ -577,7 +577,7 @@ if ($dumpAll)
if (-s "$hbDumpFile")
{
print "\nHostBoot dump saved to $hbDumpFile.\n";
- print "Use hb-parsedump.pl program to parse the dump.\n";
+ print "Use the hb-dump-debug program to parse the dump.\n";
}
else
{
@@ -799,7 +799,7 @@ sub printUsage()
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 hb-parsedump.pl program to expand and view data in the file.\n\n");
+ print (" Use the hb-dump-debug 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 HB_IMGDIR to the path\n");
print (" of the files.\n\n");
OpenPOWER on IntegriCloud