summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorDean Sanner <dsanner@us.ibm.com>2016-05-15 12:03:54 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-06-24 10:56:44 -0400
commitaa513a3a39202bcbc5294cd1ef6618ecbe151bf8 (patch)
tree03a13ac3ed32fe5d30027a25e1033912f5698cc0 /src/usr
parent7e8f95823e071367bc17bb95113239324f06e5d5 (diff)
downloadblackbird-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/usr')
-rw-r--r--src/usr/initservice/istepdispatcher/sptask.C202
-rw-r--r--src/usr/trace/daemon/daemon.C24
-rw-r--r--src/usr/trace/daemon/daemon.H11
-rw-r--r--src/usr/trace/daemonif.C13
-rw-r--r--src/usr/trace/daemonif.H11
-rw-r--r--src/usr/trace/interface.C14
-rw-r--r--src/usr/trace/service.C10
-rw-r--r--src/usr/trace/service.H9
8 files changed, 212 insertions, 82 deletions
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:
OpenPOWER on IntegriCloud