diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2011-05-09 14:51:09 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-05-16 16:49:41 -0500 |
commit | 0ec3f482259bdcc1867fb884eb89a4c0c5fc026d (patch) | |
tree | 23ae2abc22750e836c0c7179958437837f4d8fef /src/usr/trace/trace.H | |
parent | 038fb97fb799935574a62821fa3eab7ef8ccc14c (diff) | |
download | talos-hostboot-0ec3f482259bdcc1867fb884eb89a4c0c5fc026d.tar.gz talos-hostboot-0ec3f482259bdcc1867fb884eb89a4c0c5fc026d.zip |
Initial trace support for host boot
Change-Id: Ib2450ae3d32549673ca8e1c814a7a11b5f1a0c09
Reviewed-on: http://gfwr801.rchland.ibm.com:8080/gerrit/69
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/trace/trace.H')
-rw-r--r-- | src/usr/trace/trace.H | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/usr/trace/trace.H b/src/usr/trace/trace.H new file mode 100644 index 000000000..8087e6c32 --- /dev/null +++ b/src/usr/trace/trace.H @@ -0,0 +1,132 @@ +/** + * @file trace.H + * + * @brief Internal trace definitions and functions +*/ + +#ifndef __TRACE_TRACE_H +#define __TRACE_TRACE_H + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> +#include <trace/interface.H> + +namespace TRACE +{ + +/******************************************************************************/ +// Globals/Constants +/******************************************************************************/ + +#define TRACE_BUF_VERSION 0x01; // Trace buffer version +#define TRACE_FIELDTRACE 0x4654 // Field Trace - "FT" +#define TRACE_FIELDBIN 0x4644 // Binary Field Trace - "FD" + +#define TRACE_DEBUG_ON 1 //Set to this when debug trace on +#define TRACE_DEBUG_OFF 0 //Set to this when debug trace off + + +/******************************************************************************/ +// Typedef/Enumerations +/******************************************************************************/ + +/******************************************************************************/ +// Function Prototypes +/******************************************************************************/ + +/** + * @brief Initialize a new trace buffer + * + * Internal function responsible setting up the defaults in a newly created + * trace buffer. + * + * @param[out] o_buf Trace descriptor of component buffer to initialize. + * @param[in] i_comp Component name + * + * @return void + * + */ +void trace_init_values_buffer(trace_desc_t *o_buf, + const char *i_comp); + + +/** + * @brief Write the trace data into the buffer + * + * Internal function responsible for copying the trace data into the appropriate + * buffer. + * + * @param[inout] io_td Trace descriptor of component buffer to write to. + * @param[in] i_ptr Pointer to data to copy into the trace buffer. + * @param[in] i_size Size of the i_ptr data to copy into the buffer. + * + * @return void + * + */ +void trace_write_data(trace_desc_t * io_td, + const void *i_ptr, + const uint32_t i_size); + + +/** + * @brief Retrieve full trace buffer for component i_comp + * + * This function assumes memory has already been allocated for + * the full trace buffer in o_data. + * + * @param i_td_ptr Trace descriptor of buffer to retrieve. + * @param o_data Pre-allocated pointer to where data will be stored. + * + * TODO - Not Supported Yet + * + * @return Non-zero return code on error + */ +int32_t trace_get_buffer(const trace_desc_t * i_td_ptr, + void *o_data); + +/** + * @brief Retrieve partial trace buffer for component i_comp + * + * This function assumes memory has already been allocated for + * the trace buffer (size io_size). This function will copy + * in up to io_size in bytes to the buffer and set io_size + * to the exact size that is copied in. + * + * TODO - Not Supported Yet + * + * @param i_td_ptr Trace descriptor of buffer to retrieve. + * @param o_data Pre-allocated pointer to where data will be stored. + * @param io_size Size of trace data to retrieve (input) + * Actual size of trace data stored (output) + * + * @return Non-zero return code on error + */ +int32_t trace_get_buffer_partial(const trace_desc_t * i_td_ptr, + void *o_data, + uint32_t *io_size); + +/** + * @brief Retrieve trace descriptor for input component name + * + * @param i_comp Component name to retrieve trace descriptor for. + * + * TODO - Not Supported Yet + * + * @return Valid trace descriptor on success, NULL on failure. + */ +trace_desc_t * trace_get_td(const char *i_comp); + +/** + * @brief Reset all trace buffers + * + * TODO - Not Supported Yet + * + * @return Non-zero return code on error + */ +int32_t trace_reset_buf(void); + +} // namespace TRACE + +#endif |