summaryrefslogtreecommitdiffstats
path: root/src/usr/trace
diff options
context:
space:
mode:
authorMonte Copeland <copelanm@us.ibm.com>2011-10-24 09:30:49 -0500
committerMonte K. Copeland <copelanm@us.ibm.com>2011-10-31 11:07:10 -0500
commit723239d5a14fe82713a2aa57fef3130534b15a41 (patch)
treeb6d19b1d1d66ec9ea4acd19c0dfdb47bcf86babd /src/usr/trace
parentf2794eed87ca9c35140c601dfcbb5baf299d834b (diff)
downloadtalos-hostboot-723239d5a14fe82713a2aa57fef3130534b15a41.tar.gz
talos-hostboot-723239d5a14fe82713a2aa57fef3130534b15a41.zip
Error log changes for Sprint 6
Change-Id: I44ad678cfae8cd84e5370391dc7e20d74f59c9ca Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/449 Tested-by: Jenkins Server Reviewed-by: Mark W. Wenning <wenning@us.ibm.com> Reviewed-by: Monte K. Copeland <copelanm@us.ibm.com>
Diffstat (limited to 'src/usr/trace')
-rw-r--r--src/usr/trace/trace.C75
1 files changed, 46 insertions, 29 deletions
diff --git a/src/usr/trace/trace.C b/src/usr/trace/trace.C
index f14978854..447fad968 100644
--- a/src/usr/trace/trace.C
+++ b/src/usr/trace/trace.C
@@ -785,47 +785,64 @@ trace_desc_t * Trace::getTd(const char *i_comp)
return(l_td);
}
-/******************************************************************************/
-// getBuffer - TODO
-/******************************************************************************/
-int32_t Trace::getBuffer(const trace_desc_t *i_td_ptr,
- void *o_data)
-{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
- int64_t l_rc = 0;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
- if((i_td_ptr) && (o_data != NULL))
+
+/*****************************************************************************/
+// getBuffer() called by ErrlEntry.CollectTrace()
+// Return how many bytes copied, or if given a null pointer or zero buffer
+// size, then return the size of the buffer.
+//
+// Otherwise return zero on error; perhaps the component name/trace buffer
+// name is not found.
+
+uint64_t Trace::getBuffer( const char * i_pComp,
+ void * o_data,
+ uint64_t i_bufferSize )
+{
+ int64_t l_rc = 0;
+ trace_desc_t * l_pDescriptor = NULL;
+
+ do
{
- // Get the lock
- // TODO Mutex
-#if 0
- l_rc = UTIL_MUTEX_GET(&iv_trac_mutex,TRAC_INTF_MUTEX_TIMEOUT);
- if(l_rc != 0)
+ l_pDescriptor = getTd( i_pComp );
+ if( NULL == l_pDescriptor )
{
- // Badness
+ break;
}
- else
+
+ if( ( NULL == o_data ) || ( 0 == i_bufferSize ))
{
- l_rc = SUCCESS;
+ // return how big is the buffer.
+ l_rc = TRAC_DEFAULT_BUFFER_SIZE;
+ break;
}
-#endif
- // Copy it's buffer into temp one
- memcpy(o_data,i_td_ptr,(size_t)TRAC_DEFAULT_BUFFER_SIZE);
- // Always try to release even if error above
- // TODO - mutex
- //UTIL_MUTEX_PUT(&iv_trac_mutex);
+ // Not to exceed buffer size.
+ uint64_t l_copyCount = i_bufferSize;
+ if( i_bufferSize > TRAC_DEFAULT_BUFFER_SIZE )
+ {
+ l_copyCount = TRAC_DEFAULT_BUFFER_SIZE;
+ }
+
+ // Get the lock
+ mutex_lock(&iv_trac_mutex);
+
+ // Copy buffer to caller's space
+ memcpy( o_data, l_pDescriptor, (size_t)l_copyCount );
+
+ mutex_unlock(&iv_trac_mutex);
+
+ l_rc = l_copyCount;
}
+ while( 0 );
- return(l_rc);
+ return l_rc;
}
+
+
+
#if 0
/******************************************************************************/
// getBufferPartial - TODO
OpenPOWER on IntegriCloud