diff options
Diffstat (limited to 'src/usr/trace')
-rw-r--r-- | src/usr/trace/interface.C | 26 | ||||
-rw-r--r-- | src/usr/trace/runtime/makefile | 6 | ||||
-rw-r--r-- | src/usr/trace/runtime/rt_service.C | 16 | ||||
-rw-r--r-- | src/usr/trace/runtime/test/makefile | 31 | ||||
-rw-r--r-- | src/usr/trace/service.H | 6 |
5 files changed, 79 insertions, 6 deletions
diff --git a/src/usr/trace/interface.C b/src/usr/trace/interface.C index f7d8e68ff..af7040fdf 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,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,10 +34,14 @@ #include <util/singleton.H> #include <stdarg.h> #include <limits.h> +#include <string.h> #include "compdesc.H" #include "service.H" +#if __HOSTBOOT_RUNTIME +#include "runtime/rt_rsvdtracebufservice.H" +#endif namespace TRACE { @@ -105,15 +109,31 @@ namespace TRACE void * o_data, size_t i_bufferSize ) { + size_t l_bufferSize(0); + ComponentDesc* l_comp = Singleton<ComponentList>::instance().getDescriptor(i_comp, 0); if (NULL == l_comp) { - return 0; +#if __HOSTBOOT_RUNTIME + // All the components will have a corresponding CompDescriptor, + // if buffer is created. RSVD_MEM_TRACE is a speacial case without + // a corresponding compDescriptor. Check for RSVD_MEM_TRACE, if + // not RSVD_MEM_TRACE then return 0. + if(strcmp( i_comp, "RSVD_MEM_TRACE") == 0) + { + l_bufferSize = Singleton<RsvdTraceBufService>:: + instance().getBuffer(o_data,i_bufferSize); + } +#endif } - return Singleton<Service>::instance().getBuffer(l_comp, + else + { + l_bufferSize = Singleton<Service>::instance().getBuffer(l_comp, o_data, i_bufferSize); + } + return l_bufferSize; } void flushBuffers() diff --git a/src/usr/trace/runtime/makefile b/src/usr/trace/runtime/makefile index c7307e0cd..8974e15c0 100644 --- a/src/usr/trace/runtime/makefile +++ b/src/usr/trace/runtime/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2017 +# Contributors Listed Below - COPYRIGHT 2013,2018 # [+] International Business Machines Corp. # # @@ -26,6 +26,8 @@ HOSTBOOT_RUNTIME = 1 ROOTPATH = ../../../.. MODULE = trace_rt +SUBDIRS += test.d + OBJS += interface.o OBJS += assert.o OBJS += compdesc.o @@ -34,6 +36,8 @@ OBJS += rt_service.o OBJS += bufferpage.o OBJS += rt_daemon.o OBJS += rt_buffer.o +OBJS += rt_rsvdtracebuffer.o +OBJS += rt_rsvdtracebufservice.o VPATH += .. diff --git a/src/usr/trace/runtime/rt_service.C b/src/usr/trace/runtime/rt_service.C index 476e6052d..d3dbde773 100644 --- a/src/usr/trace/runtime/rt_service.C +++ b/src/usr/trace/runtime/rt_service.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,6 +38,7 @@ #include <util/align.H> #include <runtime/interface.h> #include <util/singleton.H> +#include "rt_rsvdtracebufservice.H" namespace TRACE { @@ -52,6 +53,9 @@ namespace TRACE iv_buffers[BUFFER_SLOW] = nullptr; iv_buffers[BUFFER_FAST] = new Buffer(iv_daemon); + // Force create the Reserved Trace Buffer Service object + iv_rsvdtracebufservice = &(Singleton<RsvdTraceBufService>::instance()); + iv_compList = &(Singleton<ComponentList>::instance()); } @@ -240,6 +244,11 @@ namespace TRACE // "Commit" entry to buffer. l_buffer->commitEntry(l_entry); + // Copy the trace entry in to the Reserved Trace Buffer too + iv_rsvdtracebufservice->writeEntry(i_td, + reinterpret_cast<char*>(&l_entry->data[0]), + l_realSize); + } while(0); } @@ -384,6 +393,11 @@ namespace TRACE // "Commit" entry to buffer. l_buffer->commitEntry(l_entry); + // Copy the trace entry in to the Reserved Trace Buffer too + iv_rsvdtracebufservice->writeEntry(i_td, + reinterpret_cast<char*>(&l_entry->data[0]), + l_realSize); + } while(0); } diff --git a/src/usr/trace/runtime/test/makefile b/src/usr/trace/runtime/test/makefile new file mode 100644 index 000000000..b0ad1841c --- /dev/null +++ b/src/usr/trace/runtime/test/makefile @@ -0,0 +1,31 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/trace/runtime/test/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2013,2018 +# [+] 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG +HOSTBOOT_RUNTIME = 1 +ROOTPATH = ../../../../.. + +MODULE = testrsvdtracebuf_rt +TESTS = testrsvdtracebuf.H + +include ${ROOTPATH}/config.mk diff --git a/src/usr/trace/service.H b/src/usr/trace/service.H index afe2c18f7..fdb4b460b 100644 --- a/src/usr/trace/service.H +++ b/src/usr/trace/service.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -71,6 +71,7 @@ namespace TRACE class DaemonIf; class ComponentList; class trace_entry_stamp_t; + class RsvdTraceBufService; /** @class Service * @@ -189,6 +190,9 @@ namespace TRACE #else /** Runtime daemon **/ TRACEDAEMON::Daemon * iv_daemon; + + /** Runtime Reserved Trace Buffer Service **/ + RsvdTraceBufService * iv_rsvdtracebufservice; #endif }; } |