diff options
author | Dean Sanner <dsanner@us.ibm.com> | 2016-05-15 12:03:54 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-06-24 10:56:44 -0400 |
commit | aa513a3a39202bcbc5294cd1ef6618ecbe151bf8 (patch) | |
tree | 03a13ac3ed32fe5d30027a25e1033912f5698cc0 /src/build/debug/Hostboot | |
parent | 7e8f95823e071367bc17bb95113239324f06e5d5 (diff) | |
download | blackbird-hostboot-aa513a3a39202bcbc5294cd1ef6618ecbe151bf8.tar.gz blackbird-hostboot-aa513a3a39202bcbc5294cd1ef6618ecbe151bf8.zip |
FSPless continous tracing support
- Updated trace daemon to output trace buf addr, size to
mbox scratch 1, 2
- Moved enable disable of continous trace to "istep" control
- Updated istep tool to dump traces to file and commandline
Change-Id: I2d9f48f5ed9878591ff9ab45fa18a98fc286ac1f
RTC:127346
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24565
Tested-by: Jenkins Server
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: FSP CI Jenkins
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/debug/Hostboot')
-rwxr-xr-x | src/build/debug/Hostboot/ContTrace.pm | 53 | ||||
-rwxr-xr-x | src/build/debug/Hostboot/Istep.pm | 51 |
2 files changed, 62 insertions, 42 deletions
diff --git a/src/build/debug/Hostboot/ContTrace.pm b/src/build/debug/Hostboot/ContTrace.pm index 05c53d75b..18c64dbb3 100755 --- a/src/build/debug/Hostboot/ContTrace.pm +++ b/src/build/debug/Hostboot/ContTrace.pm @@ -6,7 +6,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,2016 +# [+] International Business Machines Corp. +# # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,10 +29,6 @@ package Hostboot::ContTrace; use Exporter; our @EXPORT_OK = ('main'); -use constant CONT_TRACE_ENABLE_FLAG_OFFSET => 0; -use constant CONT_TRACE_BUFFER_SIZE => CONT_TRACE_ENABLE_FLAG_OFFSET + 2; -use constant CONT_TRACE_BUFFER_ADDR => CONT_TRACE_BUFFER_SIZE + 6; - use File::Temp ('tempfile'); sub main @@ -56,42 +54,19 @@ sub main $fsptrace_options = $fsptrace_options."-f "; } - my $symAddr = 0; - my $symSize = 0; - - ($symAddr, $symSize) = ::findSymbolAddress("TRACE::g_debugSettings"); - if (not defined $symAddr) - { - ::userDisplay "Cannot find symbol: TRACE::g_debugSettings.\n"; die; - } if (defined $args->{"enable-cont-trace"}) { - my $new_enable = $args->{"enable-cont-trace"}; - $new_enable = $new_enable ? 2 : 1; - - my $enable = ::read8($symAddr + CONT_TRACE_ENABLE_FLAG_OFFSET); - if ($dbgMsg) - { - ::userDisplay("current Cont Trace Enable Flag = $enable\n"); - } - if (($enable < 2) && ($new_enable == 2)) - { - # truncate tracMERG to 0 - system( "cp /dev/null tracMERG" ); - } - - ::write8($symAddr + CONT_TRACE_ENABLE_FLAG_OFFSET, $new_enable); - if ($dbgMsg) - { - $new_enable = ::read8($symAddr+CONT_TRACE_ENABLE_FLAG_OFFSET); - ::userDisplay("new Cont Trace Enable Flag = $new_enable\n"); - } + ::userDisplay("enable-cont-trace not supported anymore\n") + ::userDisplay("Use istep control with istep 255.0 to disable\n" + ::userDisplay("Use istep control with istep 255.1 to enable\n" return; } - my $trigger = ::readScom(0x00050038); + #HB will place the trace buffer address in MBOX_SCRATCH1 (0x50038) when + #there is a buf to be extracted. Trigger off of this + my $trigger = ::readScom(0x00050038, 8); if ($dbgMsg) { ::userDisplay("$trigger...\n"); @@ -116,8 +91,9 @@ sub main ($fh,$fname) = tempfile(); binmode($fh); - my $buffAddr = ::read64($symAddr + CONT_TRACE_BUFFER_ADDR); - my $buffSize = ::read16($symAddr + CONT_TRACE_BUFFER_SIZE); + #Trigger has the buffer, address MBOX_SCRATCH2 has size + my $buffAddr = $trigger >> 32; + my $buffSize = ::readScom(0x00050039, 8) >> 32; print $fh (::readData($buffAddr, $buffSize)); @@ -129,7 +105,9 @@ sub main ::userDisplay("$cycles\n"); } - ::writeScom(0x00050038, 0x0); + #Write MBOX_SCRATCH1 to zero to indicate to HB that we have + #extracted the buffer and it can continue on its way + ::writeScom(0x00050038, 8, 0x0); open TRACE, ($args->{"fsp-trace"}." -s ".::getImgPath(). "hbotStringFile $fsptrace_options $fname |") || die; @@ -156,7 +134,6 @@ sub helpInfo "fsp-trace=<path>" => ["Path to non-default fsp-trace utility."], "with-file-names" => ["Trace statements will include file name of place the", "trace was defined."], - "enable-cont-trace=<1|0>" => ["Turn on|off continuous trace"], "debug" => ["Turn on debug messages"], } ); diff --git a/src/build/debug/Hostboot/Istep.pm b/src/build/debug/Hostboot/Istep.pm index ebbcfc63c..8d1896932 100755 --- a/src/build/debug/Hostboot/Istep.pm +++ b/src/build/debug/Hostboot/Istep.pm @@ -64,6 +64,7 @@ no warnings 'portable'; package Hostboot::Istep; use Exporter; our @EXPORT_OK = ('main'); +use File::Temp ('tempfile'); #------------------------------------------------------------------------------ # Constants @@ -74,7 +75,7 @@ use constant SPLESS_SINGLE_ISTEP_CMD => 0x00; use constant SPLESS_RESUME_ISTEP_CMD => 0x01; use constant SPLESS_CLEAR_TRACE_CMD => 0x02; -use constant MAX_ISTEPS => 25; +use constant MAX_ISTEPS => 256; use constant MAX_SUBSTEPS => 25; ## Mailbox Scratchpad regs @@ -361,6 +362,48 @@ sub showHelp exit 0; } +## --------------------------------------------------------------------------- +## Check to see if there are trace buffers avail +## if so, extract and write them out +## --------------------------------------------------------------------------- +sub checkContTrace +{ + my $SCRATCH_MBOX1 = 0x00050038; + my $SCRATCH_MBOX2 = 0x00050039; + my $contTrace = ""; + my $ctName = "tracMERG.cont"; + + $contTrace = ::readScom( $SCRATCH_MBOX1, 8 ); + if ( $contTrace != 0 ) + { + my $fh; + my $fname; + my $contFile; + ($fh,$fname) = tempfile(); + open ($contFile, '>>', $ctName) or die "Can't open '$ctName' $!"; + binmode($fh); + + #contTrace has the buffer, address MBOX_SCRATCH2 has size + #MBOX Scratch regs are only valid from 0:31, shift to give a num + my $buffAddr = $contTrace >> 32; + my $buffSize = ::readScom($SCRATCH_MBOX2, 8) >> 32; + + print $fh (::readData($buffAddr, $buffSize)); + + #Write 0 to let HB know we extracted buf and it can continue + ::writeScom($SCRATCH_MBOX1, 8, 0x0); + + open TRACE, ("fsp-trace -s ".::getImgPath(). + "hbotStringFile $fname |") || die; + while (my $line = <TRACE>) + { + ::userDisplay $line; + print $contFile $line; + } + + unlink $fname; + } +} ## --------------------------------------------------------------------------- ## Dump environment variable specified. @@ -634,7 +677,7 @@ sub getSyncStatus( ) ## check to see if we need to dump trace - no-op in simics - ##::checkContTrace(); + checkContTrace(); $result = getStatus(); $running = ( ( $result & 0x2000000000000000 ) >> 61 ); @@ -682,13 +725,13 @@ sub runIStep( $$ ) sendCommand( $cmd ); - $result = getSyncStatus(); ## if result is -1 we have a timeout if ( $result == -1 ) { ::userDisplay "-----------------------------------------------------------------\n"; + exit; } else { @@ -899,7 +942,7 @@ sub setMode( $ ) if ( $opt_debug ) { ::userDisplay "=== checkContTrace\n"; } ## check to see if it's time to dump trace - no-op in simics - ::checkContTrace(); + checkContTrace(); if ( $opt_debug ) { ::userDisplay "=== isShutDown\n"; } ## check for system crash |