diff options
author | Monte Copeland <copelanm@us.ibm.com> | 2011-11-16 09:02:17 -0600 |
---|---|---|
committer | MIKE J. JONES <mjjones@us.ibm.com> | 2011-11-21 12:32:19 -0600 |
commit | d4b2086e646ac2444539bac0750af82e5e0b5d7c (patch) | |
tree | cf754de98935df10870b5aa96b2ec9cb270e8c8e /src/include | |
parent | 11c80c5abcf203e5a65098ea047fd6d2a6e607cc (diff) | |
download | talos-hostboot-d4b2086e646ac2444539bac0750af82e5e0b5d7c.tar.gz talos-hostboot-d4b2086e646ac2444539bac0750af82e5e0b5d7c.zip |
collectTrace to allow partial trace buffer collection
Change-Id: I06ce6df416f38c4619281180ea8515c90f8f2fab
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/498
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Tested-by: Jenkins Server
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ctype.h | 45 | ||||
-rwxr-xr-x | src/include/string_ext.h | 45 | ||||
-rw-r--r-- | src/include/usr/errl/errlentry.H | 23 | ||||
-rw-r--r-- | src/include/usr/trace/trace.H | 63 | ||||
-rw-r--r-- | src/include/util/align.H | 18 |
5 files changed, 145 insertions, 49 deletions
diff --git a/src/include/ctype.h b/src/include/ctype.h new file mode 100644 index 000000000..46e89c2ab --- /dev/null +++ b/src/include/ctype.h @@ -0,0 +1,45 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/ctype.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 +#ifndef __CTYPE_H +#define __CTYPE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Converts lowercase letter to uppercase + * + * If no such conversion is possible then the input is returned unchanged + * + * @param[in] Input letter + * @return int. Uppercase letter + */ +int toupper(int); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/src/include/string_ext.h b/src/include/string_ext.h new file mode 100755 index 000000000..a09e8782e --- /dev/null +++ b/src/include/string_ext.h @@ -0,0 +1,45 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/string_ext.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 +#ifndef __STRING_EXT_H +#define __STRING_EXT_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Converts lowercase string to uppercase + * + * Any characters that cannot be converted are left unchanged + * + * @param[in] s Pointer to c-string that is converted to uppercase + * @return char *. Pointer to beginning of string (same as 's' parameter) + */ +char* strupr(char* s); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 5046cd1c6..b3e856996 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -329,19 +329,26 @@ public: /** * @brief Collect component trace - * The given component's trace is collected (if possible) - * and added to the log's data sections. The amount of data - * added is the smallest of the log's available space (up to - * 1024 bytes of trace) or the given input max. + * The trace buffer named is collected and added to the error + * log. The amount of traces is controlled by the i_max parameter. + * When zero, or left to default, the full trace buffer is copied. + * Otherwise, i_max size must be big enough to hold a trace buffer + * header (40 bytes) plus some trace data. For example, a trace + * entry with n bytes of data is n+28 bytes in size. * - * @param[in] i_Name Component Name - * @param[in] i_Max Upper limit of trace to capture. + * Note that component names given in hbotcompid.H do not necessarily + * map to the names of trace buffers created by that component. + * Trace buffer names are case insensitive. + * + * @param[in] i_name Trace buffer name + * @param[in] i_max Size of trace to capture. * * @return A Boolean indication of success. False likely means - * the component name input is not found. + * the trace buffer name given is not found. However, check the ERRL + * trace buffer for the cause of the failure. */ bool collectTrace(const char i_name[], - const uint32_t i_max = 0); + const uint64_t i_max = 0); diff --git a/src/include/usr/trace/trace.H b/src/include/usr/trace/trace.H index c5d0a0d2a..6450a42a1 100644 --- a/src/include/usr/trace/trace.H +++ b/src/include/usr/trace/trace.H @@ -206,29 +206,36 @@ public: /** - * @brief Retrieve full trace buffer for component i_comp. + * @brief Retrieve the trace buffer named by i_pName * * Caller must allocate memory for the output buffer. Caller may * first query the size of the buffer by calling with the desired - * component/trace buffer name and with o_data null and with i_bufferSize - * zero. The value returned will be the buffer size. Caller then - * allocates the buffer and calls again. + * buffer name and with o_data null and i_bufferSize + * zero. The value returned will be the full buffer size. Caller + * allocates the buffer and calls again. + * + * The buffer provided can be less than the full size of the desired + * buffer. In that case, this function will copy as many of the most + * recent traces into the output buffer as will fit. The buffer must + * be big enough to hold a trace buffer header (40 bytes). * - * @param [in] i_pComp pointer to name string - * @param [out] o_data pointer to where data will be stored - * @param [in] i_bufferSize size of buffer in bytes + * i_bufferSize may be larger that the desired trace buffer. + * + * @param [in] i_pName name of trace buffer + * @param [out] o_data pointer to output buffer + * @param [in] i_bufferSize size of output buffer in bytes * * @return Count of bytes copied, or if given null parameters, - * the size of the buffer, or else zero for error, perhaps the - * component name/trace buffer name is not found. + * the size of the buffer. Returns zero for error, perhaps the + * component name/trace buffer name is not found, or perhaps + * the size of the provided buffer is unreasonable. */ - uint64_t getBuffer( const char * i_pComp, + uint64_t getBuffer( const char * i_pName, void * o_data, uint64_t i_bufferSize ); - protected: /** @@ -283,34 +290,20 @@ private: /** - * @brief Retrieve partial trace buffer for component i_comp + * @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. * - * 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 [in] i_pName Buffer name to search. * - * @param [in] i_td_ptr Trace descriptor of buffer to retrieve. - * @param [out] o_data Pre-allocated pointer to where data will be stored. - * @param [in,out] io_size Size of trace data to retrieve (input) - * Actual size of trace data stored (output) - * - * @return Non-zero return code on error + * @return trace descriptor for the name, or nul if not found. */ - int32_t getBufferPartial(const trace_desc_t * i_td_ptr, - void *o_data, - uint32_t *io_size); + trace_desc_t * findTdByName( const char *i_pName ); + + + - /** - * @brief Retrieve trace descriptor for input component name - * - * @param [in] i_comp Component name to retrieve trace descriptor for. - * - * @return Valid trace descriptor on success, NULL on failure. - */ - trace_desc_t * getTd(const char *i_comp); /** * @brief Reset all trace buffers diff --git a/src/include/util/align.H b/src/include/util/align.H index 55073256d..8ba0e06b9 100644 --- a/src/include/util/align.H +++ b/src/include/util/align.H @@ -25,14 +25,20 @@ #include <limits.h> -// Return a number >= input that is aligned on a 4-byte boundary -#define ALIGN_4(u) ((u + 0x3ull) & ~0x3ull) +// Return a number >= input that is aligned up to the next 4-byte boundary +#define ALIGN_4(u) (((u) + 0x3ull) & ~0x3ull) -// Return a number >= input that is aligned on a 8-byte bounday -#define ALIGN_8(u) ((u + 0x7ull) & ~0x7ull) +// Return a number <= input that is rounded down to nearest 4-byte boundary +#define ALIGN_DOWN_4(u) ((u) & ~3ull) -// Return a number >= input that is aligned on a page boundary -#define ALIGN_PAGE(u) ((u + (PAGESIZE-1)) & ~(PAGESIZE-1)) +// Return a number >= input that is aligned up to the next 8-byte bounday +#define ALIGN_8(u) (((u) + 0x7ull) & ~0x7ull) + +// Return a number <= input that is rounded down to nearest 8-byte boundary +#define ALIGN_DOWN_8(u) ((u) & ~7ull) + +// Return a number >= input that is aligned up to the next page boundary +#define ALIGN_PAGE(u) (((u) + (PAGESIZE-1)) & ~(PAGESIZE-1)) // Return a number <= input that is aligned on a page boundary #define ALIGN_PAGE_DOWN(u) ((u) - (u)%PAGESIZE) |