diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/sys/mm.h | 7 | ||||
-rw-r--r-- | src/include/sys/sync.h | 90 | ||||
-rwxr-xr-x | src/include/usr/cxxtest/TestSuite.H | 45 | ||||
-rw-r--r-- | src/include/usr/errl/errludlogregister.H | 1 | ||||
-rw-r--r-- | src/include/usr/trace/interface.H | 123 | ||||
-rw-r--r-- | src/include/usr/trace/trace.H | 370 |
6 files changed, 215 insertions, 421 deletions
diff --git a/src/include/sys/mm.h b/src/include/sys/mm.h index 1b21816a8..dca50d9a4 100644 --- a/src/include/sys/mm.h +++ b/src/include/sys/mm.h @@ -121,10 +121,6 @@ int mm_extend(MM_EXTEND_SIZE i_size = MM_EXTEND_REAL_MEMORY); */ int mm_linear_map(void *i_paddr, uint64_t i_size); -#ifdef __cplusplus -} -#endif - /** @fs mm_icache_invalidate() * @brief Invalidate the ICACHE for the given memory * @@ -144,5 +140,8 @@ void mm_icache_invalidate(void * i_addr, size_t i_cpu_word_count); */ uint64_t mm_virt_to_phys( void* i_vaddr ); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/include/sys/sync.h b/src/include/sys/sync.h index 58e5c9327..1463b3f6f 100644 --- a/src/include/sys/sync.h +++ b/src/include/sys/sync.h @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/sys/sync.h $ -// -// 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 +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/sys/sync.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* 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 */ #ifndef SYNC #define SYNC @@ -33,7 +33,7 @@ struct _futex_imp_t uint64_t iv_val; }; -typedef _futex_imp_t mutex_t; +typedef _futex_imp_t mutex_t; /** * Barrier object type @@ -53,7 +53,7 @@ typedef _barrier_imp_t barrier_t; /** * Conditional variable types */ -struct _cond_imp_t +struct _cond_imp_t { mutex_t * mutex; uint64_t sequence; @@ -83,7 +83,7 @@ void barrier_init (barrier_t * o_barrier, uint64_t i_count); /** - * @fn barrier_destroy + * @fn barrier_destroy * @brief Destroy a barrier * @param[in] i_barrier The barrier */ @@ -167,7 +167,7 @@ int sync_cond_wait(sync_cond_t * i_cond, mutex_t * i_mutex); * @pre This task must hold the lock on the mutex used in sync_cond_wait() * @pre sync_cond_wait() must have been called for conditional variable * @note failing to unlock the mutex after this call may cause the waiting - * task to remain blocked. If there is more than one task waiting on the + * task to remain blocked. If there is more than one task waiting on the * conditional variable then sync_cond_broadcast() should be used instead. */ void sync_cond_signal(sync_cond_t * i_cond); @@ -183,4 +183,42 @@ void sync_cond_signal(sync_cond_t * i_cond); */ void sync_cond_broadcast(sync_cond_t * i_cond); +/** @fn futex_wait + * @brief Perform a futex-wait operation. + * + * This system call is modeled after 'futex' under Linux. + * + * Will block the user space application until an address is signaled + * for waking. In order to prevent deadlock conditions where the address + * has already changed while the system-call is being processed, the + * address is checked against the currently known value. If the value has + * already changed then the function immediately returns. + * + * @param[in] i_addr - Address to wait for signal on. + * @param[in] i_val - Current value at that address. + * + * @return SUCCESS or EWOULDBLOCK. + * + * A return of EWOULDBLOCK indicates that *i_addr != i_val. + */ +int futex_wait(uint64_t * i_addr, uint64_t i_val); + +/** @fn futex_wake + * @brief Peform a futex-wake operation. + * + * This system call is modeled after 'futex' under Linux. + * + * Will awaken a number of tasks currently waiting to be signalled for an + * address. + * + * @param[in] i_addr - The address to signal. + * @param[in] i_count - The maximum number of tasks to awaken. + * + * @return SUCCESS. + * + * If less tasks than i_count are currently blocked, all blocked tasks will + * be awoken. + */ +int futex_wake(uint64_t * i_addr, uint64_t i_count); + #endif diff --git a/src/include/usr/cxxtest/TestSuite.H b/src/include/usr/cxxtest/TestSuite.H index f802a0ab5..cfeb76be0 100755 --- a/src/include/usr/cxxtest/TestSuite.H +++ b/src/include/usr/cxxtest/TestSuite.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/cxxtest/TestSuite.H $ -// -// 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 +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/cxxtest/TestSuite.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* 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 */ /** @file TestSuite.H * @@ -36,6 +36,7 @@ #include <stdint.h> #include <trace/interface.H> +#include <sys/sync.h> extern trace_desc_t *g_trac_test; diff --git a/src/include/usr/errl/errludlogregister.H b/src/include/usr/errl/errludlogregister.H index 27e4c4bb8..b590fc3b0 100644 --- a/src/include/usr/errl/errludlogregister.H +++ b/src/include/usr/errl/errludlogregister.H @@ -36,6 +36,7 @@ */ #include <errl/errluserdetails.H> +#include <stdarg.h> #ifndef PARSER diff --git a/src/include/usr/trace/interface.H b/src/include/usr/trace/interface.H index eb9ec184e..d4e2c9398 100644 --- a/src/include/usr/trace/interface.H +++ b/src/include/usr/trace/interface.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/tracinterface.H $ -// -// 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 +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/trace/interface.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* 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 */ #ifndef __TRACE_INTERFACE_H #define __TRACE_INTERFACE_H @@ -121,7 +121,11 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACDCOMP(des,printf_string,args...) \ - TRACE::Trace::trace_adal_write_all((des),__ALL_HASH(printf_string,-1),__LINE__,TRACE_DEBUG, ##args) + TRACE::trace_adal_write_all((des), \ + __ALL_HASH(printf_string,-1), \ + __LINE__, \ + TRACE_DEBUG, \ + ##args) /** @@ -140,11 +144,12 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field */ #define TRACDBIN(des,printf_string,address,len) \ - TRACE::Trace::trace_adal_write_bin(des,__ALL_HASH(printf_string,0), \ - __LINE__, \ - address, \ - len, \ - TRACE_DEBUG) + TRACE::trace_adal_write_bin((des), \ + __ALL_HASH(printf_string,0), \ + __LINE__, \ + address, \ + len, \ + TRACE_DEBUG) #endif /* HOSTBOOT_DEBUG */ #endif /* TRAC_DEBUG_OUT */ @@ -165,7 +170,11 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACFCOMP(des,printf_string,args...) \ - TRACE::Trace::trace_adal_write_all((des),__ALL_HASH(printf_string,-1),__LINE__,TRACE_FIELD, ##args) + TRACE::trace_adal_write_all((des), \ + __ALL_HASH(printf_string,-1), \ + __LINE__, \ + TRACE_FIELD, \ + ##args) /** @@ -183,11 +192,12 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field * @return void */ #define TRACFBIN(des,printf_string,address,len) \ - TRACE::Trace::trace_adal_write_bin(des,__ALL_HASH(printf_string,0), \ - __LINE__, \ - address, \ - len, \ - TRACE_FIELD) + TRACE::trace_adal_write_bin((des), \ + __ALL_HASH(printf_string,0), \ + __LINE__, \ + address, \ + len, \ + TRACE_FIELD) /** @@ -211,7 +221,11 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACSCOMP(des,printf_string,args...) \ - TRACE::Trace::trace_adal_write_all((des),__ALL_HASH(printf_string,-1),__LINE__,TRACE_DEBUG, ##args) + TRACE::trace_adal_write_all((des), \ + __ALL_HASH(printf_string,-1), \ + __LINE__, \ + TRACE_DEBUG, \ + ##args) /** @@ -269,7 +283,7 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string TRACSCOMP(__COMP_TD__, EXIT_MRK __COMP_NAMESPACE__ "::" __COMP_CLASS__ "::" __COMP_FN__ " " args) /** - * @fn void TRAC_INIT_BUFFER(des,comp_name, bufferSize) + * @fn void TRAC_INIT_BUFFER(des,comp_name, bufferSize, bufferType) * @brief Initializes trace buffer for component * * This function must be called before any other trace calls. It @@ -280,12 +294,27 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string * @param des A trac_desc_t * initialized to null by the using code. * @param comp_name This is the 15 character name of the component requesting * the trace buffer. Will be stored internally in upper case. - * @param bufferSize Requested length of the buffer, if 0 is entered the user will - * get default buffer size. Subject to maximum allowable size. + * @param bufferSize Requested length of the buffer, if 0 is entered the user + * will get default buffer size. Subject to maximum + * allowable size. + * @param bufferType Type (speed) of buffer. Defaults to BUFFER_FAST. * @return void + * + * @note The Hostboot implementation of trace does not have individual + * "buffers" to hold the trace entries, but does keep information to + * separately account for trace sizes. The bufferSize becomes a + * lower-bound on how much data the implementation will keep for the + * component. + * */ -#define TRAC_INIT_BUFFER(des,comp_name, bufferSize) \ - TRACE::Trace::getTheInstance().initBuffer((des), (comp_name), (bufferSize)) +#define TRAC_INIT_BUFFER(des,comp_name, bufferSize, bufferType...) \ + TRACE::initBuffer((des), (comp_name), (bufferSize), ## bufferType) + +/** + * @fn void TRAC_FLUSH_BUFFERS() + * @brief Flushes the traces to the continuous trace buffers. + */ +#define TRAC_FLUSH_BUFFERS() TRACE::flushBuffers() #ifdef __HIDDEN_TRACEIF_CLEARBUFFER @@ -296,7 +325,7 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string * @return void */ #define TRAC_CLEAR_BUFFERS() TRACE::Trace::getTheInstance().clearAllBuffers() -#endif +#endif /******************************************************************************* @@ -311,9 +340,12 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string append number in variable name. *******************************************************************************/ -#define TRAC_INIT_UNIQ(des, name, sz, ln) TRACE::TracInit static g_trac_##ln(des, name, sz) -#define TRAC_INIT_LINE(des, name, sz, ln) TRAC_INIT_UNIQ(des, name, sz, ln) -#define TRAC_INIT(des, name, sz) TRAC_INIT_LINE(des, name, sz, __LINE__) +#define TRAC_INIT_UNIQ(des, name, sz, ln, type...) \ + TRACE::TracInit static g_trac_##ln(des, name, sz, ## type) +#define TRAC_INIT_LINE(des, name, sz, ln, type...) \ + TRAC_INIT_UNIQ(des, name, sz, ln, ## type) +#define TRAC_INIT(des, name, sz, type...) \ + TRAC_INIT_LINE(des, name, sz, __LINE__, ## type) namespace TRACE { @@ -328,7 +360,8 @@ class TracInit /* Constructor */ /*------------------------------------------------------------------------*/ - TracInit(trace_desc_t **o_td, const char *i_comp,const size_t i_size); + TracInit(trace_desc_t **o_td, const char *i_comp, + const size_t i_size, uint8_t i_bufferType = TRACE::BUFFER_FAST); ~TracInit(); diff --git a/src/include/usr/trace/trace.H b/src/include/usr/trace/trace.H index 18b0a75df..802efe525 100644 --- a/src/include/usr/trace/trace.H +++ b/src/include/usr/trace/trace.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/trace/trace.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * 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_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/trace/trace.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* 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 */ /** * @file trace.H * @@ -32,126 +31,29 @@ #ifndef __TRACE_TRACE_H #define __TRACE_TRACE_H -/******************************************************************************/ -// Includes -/******************************************************************************/ #include <stdint.h> #include <trace/interface.H> -#include <util/singleton.H> -#include <sys/sync.h> -#include <stdarg.h> -#include <list> - - -/******************************************************************************/ -// Globals/Constants -/******************************************************************************/ - -const uint32_t TRACE_BUF_VERSION = 0x01; // Trace buffer version -const uint32_t TRACE_COMP_TRACE = 0x434F; // Component Field Trace - "CO" -const uint32_t TRACE_FIELDTRACE = 0x4654; // Field Trace - "FT" -const uint32_t TRACE_FIELDBIN = 0x4644; // Binary Field Trace - "FD" - -const uint32_t TRACE_DEBUG_ON = 1; //Set to this when debug trace on -const uint32_t TRACE_DEBUG_OFF = 0; //Set to this when debug trace off - -const uint32_t TRAC_COMP_SIZE = 16; // Max component name size -const uint32_t TRAC_MAX_ARGS = 9; // Max number of arguments in trace - -/******************************************************************************/ -// Typedef/Enumerations -/******************************************************************************/ - -typedef uint32_t trace_hash_val; // Hash values are 32 bytes - -/* - * @brief Structure is put at beginning of all trace buffers - */ -typedef struct trace_buf_head { - unsigned char ver; /*!< version of this struct (1) */ - unsigned char hdr_len; /*!< size of this struct in bytes */ - unsigned char time_flg; /*!< meaning of timestamp entry field */ - unsigned char endian_flg; /*!< flag for big ('B') or little ('L') endian*/ - char comp[TRAC_COMP_SIZE]; /*!< the buffer name as specified in init call*/ - uint32_t size; /*!< size of buffer, including this struct */ - uint32_t times_wrap; /*!< how often the buffer wrapped */ - uint32_t next_free; /*!< offset of the byte behind the latest entry*/ - uint32_t te_count; /*!< Updated each time a trace is done */ - uint32_t extracted; /*!< Not currently used */ -}trace_buf_head_t; - -/*! - * @brief Timestamp and thread id for each trace entry. - */ -typedef struct trace_entry_stamp { - uint32_t tbh; /*!< timestamp upper part */ - uint32_t tbl; /*!< timestamp lower part */ - uint32_t tid; /*!< process/thread id */ -}trace_entry_stamp_t; - -/* - * @brief Structure is used by adal app. layer to fill in trace info. - */ -typedef struct trace_entry_head { - uint16_t length; /*!< size of trace entry */ - uint16_t tag; /*!< type of entry: xTRACE xDUMP, (un)packed */ - uint32_t hash; /*!< a value for the (format) string */ - uint32_t line; /*!< source file line number of trace call */ -}trace_entry_head_t; -/* - * @brief Parameter traces can be all contained in one write. - */ -typedef struct trace_entire_entry { - trace_entry_stamp_t stamp; - trace_entry_head_t head; - uint64_t args[TRAC_MAX_ARGS + 1]; /*!< Add 1 for the required buffer size */ -} trace_entire_entry_t; +const uint32_t TRACE_DEBUG_ON = 1; //< Set to this when debug trace on +const uint32_t TRACE_DEBUG_OFF = 0; //< Set to this when debug trace off +const uint32_t TRAC_COMP_SIZE = 16; //< Max component name size +const uint32_t TRAC_MAX_ARGS = 9; //< Max number of arguments in trace -/* - * @brief Binary first writes header and time stamp. - */ -typedef struct trace_bin_entry { - trace_entry_stamp_t stamp; - trace_entry_head_t head; -} trace_bin_entry_t; +typedef uint32_t trace_hash_val; //< Hash values are 32 bits. -/** - * @brief New version name of this typedef - */ -typedef trace_buf_head_t trace_desc_t; - - -/******************************************************************************/ -// Trace Class -/******************************************************************************/ namespace TRACE { - -// Singleton definition -class Trace; -typedef Singleton<Trace> theTrace; - -// Forward declaration. -class TraceDaemon; - -/** - * @brief Trace Singleton Class - * - * This class managers the internals of the host boot trace implementation. -*/ -class Trace -{ - /* ErrlEntry will call getBuffer() */ - friend class ErrlEntry; + class ComponentDesc; // Forward declaration. -public: - /** - * @brief Get singleton instance of this class. - */ - static Trace& getTheInstance(); + /** @brief Buffer type that a component is directed to. */ + enum BUFFER_TYPES + { + BUFFER_SLOW, //< Traces are part of an infinite non-blocking buffer. + BUFFER_FAST, //< Traces are part of a smaller blocking buffer. + BUFFER_COUNT //< Number of trace buffers supported. + }; /** * @brief Initialize a trace buffer. @@ -164,14 +66,14 @@ public: * @param [out] o_td Trace descriptor to initialize * @param [in] i_comp Component name for trace buffer * @param [in] i_size Size to allocate for trace buffer + * @param [in] i_bufferType Type of buffer. * * @return void */ - void initBuffer(trace_desc_t **o_td, + void initBuffer(ComponentDesc **o_td, const char* i_comp, - size_t i_size ); - - + size_t i_size, + uint8_t i_bufferType = BUFFER_FAST); /** * @brief Write component trace out to input buffer @@ -187,13 +89,12 @@ public: * * @return void */ - static void trace_adal_write_all(trace_desc_t *io_td, + void trace_adal_write_all(ComponentDesc *io_td, const trace_hash_val i_hash, const char * i_fmt, const uint32_t i_line, const int32_t i_type, ...); - /** * @brief Write binary data out to trace buffer * @@ -209,14 +110,13 @@ public: * * @return void */ - static void trace_adal_write_bin(trace_desc_t * io_td, + void trace_adal_write_bin(ComponentDesc * io_td, const trace_hash_val i_hash, const uint32_t i_line, const void *i_ptr, const uint32_t i_size, const int32_t i_type); - /** * @brief Retrieve the trace buffer named by i_pName * @@ -242,194 +142,16 @@ public: * component name/trace buffer name is not found, or perhaps * the size of the provided buffer is unreasonable. */ - uint64_t getBuffer( const char * i_pName, - void * o_data, - uint64_t i_bufferSize ); + size_t getBuffer( const char * i_pName, + void * o_data, + size_t i_bufferSize ); /** * @brief flush Continuous trace buffers - * - */ - void flushContBuffers(); - -#if !defined(__HIDDEN_TRACEIF_CLEARBUFFER) -private: -#endif - - - - /** - * @brief Clear all component trace buffers. This has - * no effect on the merged buffer, aka tracBINARY. - * - * @return void - */ - void clearAllBuffers( ); - - - -protected: - - /** - * @brief Constructor for the trace object. - */ - Trace(); - - /** - * @brief Destructor for the trace object. - */ - ~Trace(); - - - - - -private: - - /** - * @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 - * @param [in] i_size Size of buffer - * - * @return void - * - */ - void initValuesBuffer(trace_desc_t *o_buf, - const char *i_comp, - size_t i_size); - - - /** - * @brief Write the trace data into the buffer - * - * Internal function responsible for copying the trace data into the appropriate - * buffer. - * - * @param [in,out] 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 writeData(trace_desc_t * io_td, - const void *i_ptr, - const uint32_t i_size); - - - - /** - * @brief Retrieve trace descriptor for input component name. - * If an exact match for the name is not found, then return nul. - * Internally, Trace keeps buffer names in upper case, and i_pName - * will be converted internally to upper case for the search. - * - * @param [in] i_pName Buffer name to search. - * - * @return trace descriptor for the name, or nul if not found. - */ - trace_desc_t * findTdByName( const char *i_pName ); - - - - - - /** - * @brief Reset all trace buffers - * - * TODO - Not Supported, may have no need in Hostboot for it. - * - * @return Non-zero return code on error - */ - // int32_t resetBuf(void); - - /** - * @brief Convert timestamp - * - * @param [out] o_entry Trace entry stamp to fill in the time info for. - * - * @return Void - */ - void convertTime(trace_entry_stamp_t *o_entry); - - // Disabled copy constructor and assignment operator - Trace(const Trace & right); - Trace & operator=(const Trace & right); - - /** - * @brief Write component trace out to input buffer - * - * @param [in,out] io_td Trace descriptor of buffer to write to. - * @param [in] i_hash Descriptive string hash value - * @param [in] i_fmt Formatting string - * @param [in] i_line Line number trace was done at - * @param [in] i_type Type of trace (TRACE_DEBUG, TRACE_FIELD) - * @param [in] i_args Variable argument list - * - * @return void */ - void _trace_adal_write_all(trace_desc_t *io_td, - const trace_hash_val i_hash, - const char * i_fmt, - const uint32_t i_line, - const int32_t i_type, va_list i_args); - - /** - * @brief Write binary data out to trace buffer - * - * @param [in,out] io_td Trace descriptor of buffer to write to. - * @param [in] i_hash Descriptive string hash value - * @param [in] i_line Line number trace was done at - * @param [in] i_ptr Pointer to binary data - * @param [in] i_size Size of binary data - * @param [in] i_type Type of trace (TRACE_DEBUG, TRACE_FIELD) - * - * @return void - */ - void _trace_adal_write_bin(trace_desc_t * io_td, - const trace_hash_val i_hash, - const uint32_t i_line, - const void *i_ptr, - const uint32_t i_size, - const int32_t i_type); - - /** - * @brief Private function to flush continuous trace buffers - */ - void _flushContBuffers(); - - /** - * @brief This function manages the usage of the two ping-pong buffers - * for handling the continuous trace support under VPO/VBU. - * - * @param [in] i_cbRequired number of bytes needed for the trace entry - * to be added to the active continuous trace buffer - * - * @return void - */ - void ManageContTraceBuffers(uint64_t i_cbRequired); - - // Mutex protecting/serializing writes to trace buffers. - mutex_t iv_trac_mutex; - - // Controls writing to tracBinary - bool iv_ContinuousTrace; - - // VPO/VBU continuous trace active buffer index - uint8_t iv_CurBuf; - - // sequence number - uint32_t iv_seqNum; - - // Trace Daemon for messages. - TraceDaemon* iv_daemon; + void flushBuffers(); }; -} // namespace TRACE +typedef TRACE::ComponentDesc trace_desc_t; #endif |