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 | |
parent | 7e8f95823e071367bc17bb95113239324f06e5d5 (diff) | |
download | talos-hostboot-aa513a3a39202bcbc5294cd1ef6618ecbe151bf8.tar.gz talos-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>
-rwxr-xr-x | src/build/debug/Hostboot/ContTrace.pm | 53 | ||||
-rwxr-xr-x | src/build/debug/Hostboot/Istep.pm | 51 | ||||
-rwxr-xr-x | src/build/debug/ecmd-debug-framework.pl | 10 | ||||
-rwxr-xr-x | src/build/debug/simics-debug-framework.pl | 7 | ||||
-rwxr-xr-x | src/build/debug/vpo-debug-framework.pl | 26 | ||||
-rw-r--r-- | src/include/usr/isteps/spless_255list.H | 100 | ||||
-rw-r--r-- | src/include/usr/trace/trace.H | 13 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/sptask.C | 202 | ||||
-rw-r--r-- | src/usr/trace/daemon/daemon.C | 24 | ||||
-rw-r--r-- | src/usr/trace/daemon/daemon.H | 11 | ||||
-rw-r--r-- | src/usr/trace/daemonif.C | 13 | ||||
-rw-r--r-- | src/usr/trace/daemonif.H | 11 | ||||
-rw-r--r-- | src/usr/trace/interface.C | 14 | ||||
-rw-r--r-- | src/usr/trace/service.C | 10 | ||||
-rw-r--r-- | src/usr/trace/service.H | 9 |
15 files changed, 388 insertions, 166 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 diff --git a/src/build/debug/ecmd-debug-framework.pl b/src/build/debug/ecmd-debug-framework.pl index 99e9a2857..19370dcc0 100755 --- a/src/build/debug/ecmd-debug-framework.pl +++ b/src/build/debug/ecmd-debug-framework.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2014 +# Contributors Listed Below - COPYRIGHT 2013,2016 # [+] International Business Machines Corp. # # @@ -360,14 +360,6 @@ sub extImageFile return $extImage; } -## -## Dummy function to match continuous trace call in VPO -## -sub checkContTrace -{ - -} - # @sub determinMemMode # # Determine the appropriate method to access memory diff --git a/src/build/debug/simics-debug-framework.pl b/src/build/debug/simics-debug-framework.pl index ec46eccd0..932a30f84 100755 --- a/src/build/debug/simics-debug-framework.pl +++ b/src/build/debug/simics-debug-framework.pl @@ -367,11 +367,4 @@ parseToolOpts($toolOpts); callToolModule($tool); -## -## Dummy function to match continuous trace call in VPO -## -sub checkContTrace -{ - -} diff --git a/src/build/debug/vpo-debug-framework.pl b/src/build/debug/vpo-debug-framework.pl index 4ba62b01c..24aa306e3 100755 --- a/src/build/debug/vpo-debug-framework.pl +++ b/src/build/debug/vpo-debug-framework.pl @@ -881,32 +881,6 @@ sub writeScom return; } -## -## Special case: only used in VPO -## Check the continuous trace Scom reg to see if we need to dump -## trace. -## This has to be executed as an external procedure so that it goes to the -## proper output file. -## -sub checkContTrace() -{ - my $SCRATCH_MBOX1 = 0x00050038; - my $contTrace = ""; - - $contTrace = ::readScom( $SCRATCH_MBOX1 ); - if ( $contTrace != 0 ) - { - ## activate continuous trace - system ("$hbToolsDir/hb-ContTrace --mute > /dev/null" ); - system ("cat hb-ContTrace.output >> tracMERG"); - - ## ContTrace might leave instructions stopped, turn them - ## back on here to make sure. - ::startInstructions("0"); - } - -} - # @sub getHRMOR # # Returns the HRMOR (0 for VPO). diff --git a/src/include/usr/isteps/spless_255list.H b/src/include/usr/isteps/spless_255list.H new file mode 100644 index 000000000..5bfca668a --- /dev/null +++ b/src/include/usr/isteps/spless_255list.H @@ -0,0 +1,100 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/spless_255list.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* 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. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __ISTEPS_SPLESS_255LIST_H +#define __ISTEPS_SPLESS_255LIST_H + +/** + * @file spless_255list.H + * + * This file DOES NOT contain real isteps. It contains control "isteps" + * for the SP Less communication/control path + * + * Please see the note in initsvcstructs.H for description of + * the ISTEPNAME macro. + * + */ + +#include <initservice/initsvcstructs.H> +#include <initservice/initsvcreasoncodes.H> +#include <config.h> + + +/** + * The following isteps are not used as normal isteps, but instead + * are for SPless communication/control of Hostboot. This is "weird" + * as it is not the normal use of isteps, but it takes advantage of + * an existing communication path, without adding a lot of extra + * code into hostboot. + * + * NOTE: These isteps are NEVER used for mainline boot and are only + * used for FSP Less communication + */ + +namespace INITSERVICE +{ + + // These constants are used by HB to handle the out of band + // "isteps". Note that the actual numbers must be in the + // Task info list so they get properly parsed into the + // isteplist.csv file + const uint8_t CONTROL_ISTEP = 0xFF; + const uint8_t CTL_CONT_TRACE_DISABLE = 0x00; + const uint8_t CTL_CONT_TRACE_ENABLE = 0x01; + const uint8_t FLUSH_TRACE_BUFS = 0x02; + + + const TaskInfo g_istep255[] = { + { + ISTEPNAME(255,0, "cont_trace_disable"), + NULL, + { NONE, EXT_IMAGE, IPL_NOOP, false } + }, + { + ISTEPNAME(255,1, "cont_trace_enable"), + NULL, + { NONE, EXT_IMAGE, IPL_NOOP, false } + }, + { + ISTEPNAME(255,2, "flush_trace_bufs"), + NULL, + { NONE, EXT_IMAGE, IPL_NOOP, false } + }, +}; + +const DepModInfo g_istep255Dependancies = { + { + NULL + } +}; + +const ExtTaskInfo g_istep255TaskList = { + &(g_istep255[0]), + ( sizeof(g_istep255)/sizeof(TaskInfo) ), + &g_istep255Dependancies +}; + +}; // end namespace + +#endif diff --git a/src/include/usr/trace/trace.H b/src/include/usr/trace/trace.H index d01003650..c934d18e7 100644 --- a/src/include/usr/trace/trace.H +++ b/src/include/usr/trace/trace.H @@ -181,6 +181,19 @@ namespace TRACE */ void flushBuffers(); +#ifndef __HOSTBOOT_RUNTIME + /** + * @brief Enable Continuous trace mode + * no-op for runtime + */ + void enableContinousTrace(); + + /** + * @brief Disable Continuous trace mode + * no-op for runtime + */ + void disableContinousTrace(); +#endif /** * @brief Return if debug trace is enabled for input trace descriptor * diff --git a/src/usr/initservice/istepdispatcher/sptask.C b/src/usr/initservice/istepdispatcher/sptask.C index 1f7c4c5c6..b63a154ce 100644 --- a/src/usr/initservice/istepdispatcher/sptask.C +++ b/src/usr/initservice/istepdispatcher/sptask.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,6 +46,7 @@ #include <trace/interface.H> // trace support +#include <trace/trace.H> // trace support #include <errl/errlentry.H> // errlHndl_t #include <initservice/initsvcudistep.H> // InitSvcUserDetailsIstep @@ -55,9 +56,10 @@ #include <console/consoleif.H> #include <config.h> +#include <isteps/spless_255list.H> // Non istep commands + #include "istepdispatcher.H" #include "splesscommon.H" -#include "istep_mbox_msgs.H" namespace INITSERVICE @@ -81,7 +83,119 @@ const uint64_t SINGLESTEP_PAUSE_S = 0; const uint64_t SINGLESTEP_PAUSE_NS = 10000000; /** - * @brief userConsoleComm + * @brief handle "control" istep messages + * + * Handle control messages (aka non istep) to do other + * thing than communicate with the istep dispatcher task + * message Q. Examples include trace enable/disable, etc + * + * @param[in,out] - Message to handle, status returned + * + * @return none + */ +void handleControlCmd( SPLessCmd & io_cmd ) +{ + //switch on the control command + switch(io_cmd.substep) + { + case CTL_CONT_TRACE_DISABLE: + TRACE::disableContinousTrace(); + break; + + case CTL_CONT_TRACE_ENABLE: + TRACE::enableContinousTrace(); + break; + + case FLUSH_TRACE_BUFS: + TRAC_FLUSH_BUFFERS(); + break; + + default: +#ifdef CONFIG_CONSOLE_OUTPUT_PROGRESS + CONSOLE::displayf(NULL, "Unknown control command %02x", io_cmd.substep); + CONSOLE::flush(); +#endif + TRACFCOMP( g_trac_initsvc, "splessComm: UNKNOWN control cmd %02x", + io_cmd.substep); + break; + } +} + +/** + * @brief handle istep commands + * + * Handle istep messages (aka non istep) that go + * directly to the istep dispatcher task message Q. + * + * @param[in,out] - Message to handle, status returned + * @param[in] -- SEND Istep message Q + * + * @return none + */ +void handleIstep( SPLessCmd & io_cmd, msg_q_t i_sendQ, + msg_q_t i_rcvQ) +{ + int l_sr_rc = 0; + msg_t *l_pMsg = msg_allocate(); + + // pass the command on to IstepDisp, block until reply + l_pMsg->type = ISTEP_MSG_TYPE; + l_pMsg->data[0] = + ( ( static_cast<uint64_t>(io_cmd.istep & 0xFF) << 32) | + ( static_cast<uint64_t>(io_cmd.substep & 0xFF ) ) ); + l_pMsg->data[1] = 0; + l_pMsg->extra_data = NULL; + +#ifdef CONFIG_CONSOLE_OUTPUT_PROGRESS + CONSOLE::displayf(NULL, "ISTEP %2d.%2d", io_cmd.istep, io_cmd.substep); + CONSOLE::flush(); +#endif + TRACFCOMP( g_trac_initsvc, + "splessComm: sendmsg type=0x%08x, d0=0x%016llx," + " d1=0x%016llx, x=%p", + l_pMsg->type, + l_pMsg->data[0], + l_pMsg->data[1], + l_pMsg->extra_data ); + // + // msg_sendrecv_noblk effectively splits the "channel" into + // a send Q and a receive Q + // + l_sr_rc = msg_sendrecv_noblk( i_sendQ, l_pMsg, i_rcvQ ); + // should never happen. + assert( l_sr_rc == 0 ); + + // This should unblock on any message sent on the Q, + l_pMsg = msg_wait( i_rcvQ ); + + TRACFCOMP( g_trac_initsvc, + "splessComm: rcvmsg type=0x%08x, d0=0x%016llx" + ", d1=0x%016llx, x=%p", + l_pMsg->type, + l_pMsg->data[0], + l_pMsg->data[1], + l_pMsg->extra_data ); + + if ( l_pMsg->type == BREAKPOINT ) + { + io_cmd.sts = SPLESS_AT_BREAK_POINT; + } + + // istep status is the hi word in the returned data 0 + // this should be either 0 or a plid from a returned errorlog + // Don't have enough space to store entire, PLID... just check + // If non zero + else if(static_cast<uint32_t>( l_pMsg->data[0] >> 32 ) !=0x0) + { + io_cmd.sts = SPLESS_ISTEP_FAIL; + } + + // free the message struct + msg_free( l_pMsg ); +} + +/** + * @brief splessComm * * Communicate with User Console on VPO or Simics. * Forwards commands to HostBoot (IStep Dispatcher) via a message Q. @@ -94,19 +208,16 @@ const uint64_t SINGLESTEP_PAUSE_NS = 10000000; * * @return none */ -void userConsoleComm( void * io_msgQ ) +void splessComm( void * io_msgQ ) { SPLessCmd l_cmd; SPLessCmd l_trigger; l_trigger.cmd.key = 0x15; //Random starting value - int l_sr_rc = 0; msg_q_t l_SendMsgQ = static_cast<msg_q_t>( io_msgQ ); - msg_t *l_pMsg = msg_allocate(); msg_q_t l_RecvMsgQ = msg_q_create(); - msg_t *l_pCurrentMsg = NULL; TRACFCOMP( g_trac_initsvc, - "userConsoleComm entry, args=%p", + "splessComm entry, args=%p", io_msgQ ); // initialize command status reg @@ -116,7 +227,7 @@ void userConsoleComm( void * io_msgQ ) writeCmdSts( l_cmd ); TRACFCOMP( g_trac_initsvc, - "userConsoleComm : readybit set." ); + "splessComm : readybit set." ); #ifdef CONFIG_CONSOLE_OUTPUT_PROGRESS #ifdef CONFIG_BMC_AST2400 @@ -128,9 +239,6 @@ void userConsoleComm( void * io_msgQ ) CONSOLE::flush(); #endif - - // set Current to our message on entry - l_pCurrentMsg = l_pMsg; // // Start the polling loop. // @@ -152,41 +260,22 @@ void userConsoleComm( void * io_msgQ ) // write the intermediate value back to the console. TRACFCOMP( g_trac_initsvc, - "userConsoleComm Write status (running) istep %d.%d", + "splessComm Write status (running) istep %d.%d", l_cmd.istep, l_cmd.substep ); writeCmdSts( l_cmd ); - // pass the command on to IstepDisp, block until reply - - l_pCurrentMsg->type = ISTEP_MSG_TYPE; - l_pCurrentMsg->data[0] = - ( ( static_cast<uint64_t>(l_cmd.istep & 0xFF) << 32) | - ( static_cast<uint64_t>(l_cmd.substep & 0xFF ) ) ); - l_pCurrentMsg->data[1] = 0; - l_pCurrentMsg->extra_data = NULL; + //Handle two types of commands -- istep and control + //Control is a major istep of 0xFF + if( l_cmd.istep != CONTROL_ISTEP) + { + handleIstep(l_cmd, l_SendMsgQ, l_RecvMsgQ); + } + else + { + handleControlCmd(l_cmd); -#ifdef CONFIG_CONSOLE_OUTPUT_PROGRESS - CONSOLE::displayf(NULL, "ISTEP %2d.%2d", l_cmd.istep, l_cmd.substep); - CONSOLE::flush(); -#endif - TRACFCOMP( g_trac_initsvc, - "userConsoleComm: sendmsg type=0x%08x, d0=0x%016llx," - " d1=0x%016llx, x=%p", - l_pCurrentMsg->type, - l_pCurrentMsg->data[0], - l_pCurrentMsg->data[1], - l_pCurrentMsg->extra_data ); - // - // msg_sendrecv_noblk effectively splits the "channel" into - // a send Q and a receive Q - // - l_sr_rc = msg_sendrecv_noblk( l_SendMsgQ, l_pCurrentMsg, l_RecvMsgQ ); - // should never happen. - assert( l_sr_rc == 0 ); - - // This should unblock on any message sent on the Q, - l_pCurrentMsg = msg_wait( l_RecvMsgQ ); + } // Update command/status reg when the command is done l_cmd.cmd.key = ++l_trigger.cmd.key; @@ -194,28 +283,6 @@ void userConsoleComm( void * io_msgQ ) l_cmd.cmd.readybit = true; l_cmd.cmd.gobit = false; - TRACFCOMP( g_trac_initsvc, - "userConsoleComm: rcvmsg type=0x%08x, d0=0x%016llx" - ", d1=0x%016llx, x=%p", - l_pCurrentMsg->type, - l_pCurrentMsg->data[0], - l_pCurrentMsg->data[1], - l_pCurrentMsg->extra_data ); - - if ( l_pCurrentMsg->type == BREAKPOINT ) - { - l_cmd.sts = SPLESS_AT_BREAK_POINT; - } - - // istep status is the hi word in the returned data 0 - // this should be either 0 or a plid from a returned errorlog - // Don't have enough space to store entire, PLID... just check - // If non zero - else if(static_cast<uint32_t>( l_pCurrentMsg->data[0] >> 32 ) !=0x0) - { - l_cmd.sts = SPLESS_ISTEP_FAIL; - } - writeCmdSts( l_cmd ); } // endif gobit @@ -242,10 +309,7 @@ void userConsoleComm( void * io_msgQ ) writeCmdSts( l_cmd ); TRACFCOMP( g_trac_initsvc, - "userConsoleComm exit" ); - - // free the message struct - msg_free( l_pMsg ); + "splessComm exit" ); // return to main to end task } @@ -261,7 +325,7 @@ void* spTask( void *io_pArgs ) task_detach(); // Start talking to VPO / Simics User console. - userConsoleComm( io_pArgs ); + splessComm( io_pArgs ); TRACFCOMP( g_trac_initsvc, "spTask exit." ); diff --git a/src/usr/trace/daemon/daemon.C b/src/usr/trace/daemon/daemon.C index d16a34653..447f25f55 100644 --- a/src/usr/trace/daemon/daemon.C +++ b/src/usr/trace/daemon/daemon.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -115,7 +115,7 @@ namespace TRACEDAEMON INITSERVICE::LOWEST_PRIORITY); // Clear scratch register. - writeScratchReg(0); + writeScratchReg(0, 0); // Loop handling messages. while (msg_t* msg = iv_service->iv_daemon->wait()) @@ -429,8 +429,6 @@ namespace TRACEDAEMON // Write debug structure with buffer information. g_debugSettings.bufferSize = i_size; g_debugSettings.bufferPage = i_buffer; - // Write scratch register indicating continuous trace is available. - writeScratchReg(1ull << 32); // Signal for simics. asm volatile("mr 4, %0; mr 5, %1" :: @@ -477,6 +475,10 @@ namespace TRACEDAEMON } else { + // Write scratch register indicating is available. + writeScratchReg(reinterpret_cast<uint64_t>(i_buffer) << 32, + i_size << 32); + // Wait for tools to extract the buffer. while(0 != readScratchReg()) { @@ -775,19 +777,29 @@ namespace TRACEDAEMON } - void Daemon::writeScratchReg(uint64_t i_value) + void Daemon::writeScratchReg(uint64_t i_value1, uint64_t i_value2) { size_t l_size = sizeof(uint64_t); errlHndl_t l_errl = deviceWrite(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL, - &i_value, l_size, + &i_value1, l_size, DEVICE_SCOM_ADDRESS(MB_SCRATCH_REGISTER_1)); if (l_errl) { errlCommit(l_errl, TRACE_COMP_ID); } + + l_errl = + deviceWrite(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL, + &i_value2, l_size, + DEVICE_SCOM_ADDRESS(MB_SCRATCH_REGISTER_2)); + + if (l_errl) + { + errlCommit(l_errl, TRACE_COMP_ID); + } } uint64_t Daemon::readScratchReg() diff --git a/src/usr/trace/daemon/daemon.H b/src/usr/trace/daemon/daemon.H index c84ad50bb..4c7f369d5 100644 --- a/src/usr/trace/daemon/daemon.H +++ b/src/usr/trace/daemon/daemon.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -96,9 +96,11 @@ namespace TRACEDAEMON /** Locklessly move a trace entry from one location to another. */ void replaceEntry(TRACE::Entry* from, TRACE::Entry* to); - /** Write mailbox scratch register to a value. */ - void writeScratchReg(uint64_t i_value); - /** Read mailbox scratch register. */ + /** Write mailbox scratch 1 & 2 registers to a values. + * scratch 1 contains the trace buffer address + * scratch 2 contains the trace buffer size */ + void writeScratchReg(uint64_t i_value1, uint64_t i_value2); + /** Read mailbox scratch 1 register. */ uint64_t readScratchReg(); /** Client-service object. */ @@ -124,6 +126,7 @@ namespace TRACEDAEMON /** Address of scratch register. */ static const uint32_t MB_SCRATCH_REGISTER_1 = 0x00050038; + static const uint32_t MB_SCRATCH_REGISTER_2 = 0x00050039; }; diff --git a/src/usr/trace/daemonif.C b/src/usr/trace/daemonif.C index 427b2c0bc..c6dd79219 100644 --- a/src/usr/trace/daemonif.C +++ b/src/usr/trace/daemonif.C @@ -5,7 +5,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. */ @@ -64,4 +66,13 @@ namespace TRACE } } + void DaemonIf::continousMode(bool i_enable) + { + msg_t* msg = msg_allocate(); + msg->type = TRACE_CONT_TRACE_STATE; + msg->data[0] = i_enable ? 0x1 : 0x0; //needs to be a zero/one + msg_sendrecv(iv_queue, msg); + msg_free(msg); + } + } diff --git a/src/usr/trace/daemonif.H b/src/usr/trace/daemonif.H index c9fca65d8..2fe45c432 100644 --- a/src/usr/trace/daemonif.H +++ b/src/usr/trace/daemonif.H @@ -5,7 +5,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. */ @@ -64,6 +66,13 @@ namespace TRACE */ void signal(bool i_blocking = false); + /** Allows the client to turn on/off continous mode. + * + * @param[in] i_enable - Indicates if this function should enable + * or disable continous mode + */ + void continousMode(bool i_enable); + friend class BufferTest; friend class TRACEDAEMON::Daemon; diff --git a/src/usr/trace/interface.C b/src/usr/trace/interface.C index 134940185..c7856e712 100644 --- a/src/usr/trace/interface.C +++ b/src/usr/trace/interface.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -117,6 +117,18 @@ namespace TRACE Singleton<Service>::instance().flushBuffers(); } +#ifndef __HOSTBOOT_RUNTIME + void enableContinousTrace() + { + Singleton<Service>::instance().enableContinous(); + } + + void disableContinousTrace() + { + Singleton<Service>::instance().disableContinous(); + } +#endif + bool isDebugEnabled(ComponentDesc * i_td) { return i_td->iv_debugEnabled; diff --git a/src/usr/trace/service.C b/src/usr/trace/service.C index d8039d9be..a3445c2ee 100644 --- a/src/usr/trace/service.C +++ b/src/usr/trace/service.C @@ -498,6 +498,16 @@ namespace TRACE iv_daemon->signal(true); } + void Service::enableContinous() + { + iv_daemon->continousMode(true); + } + + void Service::disableContinous() + { + iv_daemon->continousMode(false); + } + Service* Service::getGlobalInstance() { return &(Singleton<Service>::instance()); diff --git a/src/usr/trace/service.H b/src/usr/trace/service.H index 52cc81399..001242530 100644 --- a/src/usr/trace/service.H +++ b/src/usr/trace/service.H @@ -155,6 +155,15 @@ namespace TRACE */ uint8_t getTraceLite(); +#ifndef __HOSTBOOT_RUNTIME + /** @brief Enable Continous Trace mode (for FSPless) + */ + void enableContinous(); + + /** @brief Disable Continous Trace mode (for FSPless) + */ + void disableContinous(); +#endif friend class TRACEDAEMON::Daemon; private: |