summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/kernel/console.H4
-rw-r--r--src/include/usr/errl/errlreasoncodes.H1
-rw-r--r--src/include/usr/errl/errludprintk.H69
-rw-r--r--src/usr/errl/errludprintk.C49
-rw-r--r--src/usr/errl/makefile4
-rw-r--r--src/usr/initservice/baseinitsvc/initservice.C7
6 files changed, 131 insertions, 3 deletions
diff --git a/src/include/kernel/console.H b/src/include/kernel/console.H
index 74ab75408..22bd3c5b0 100644
--- a/src/include/kernel/console.H
+++ b/src/include/kernel/console.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2010,2013 */
+/* COPYRIGHT International Business Machines Corp. 2010,2014 */
/* */
/* p1 */
/* */
@@ -54,4 +54,6 @@ class Console : public Util::ConsoleBufferInterface
char * iv_buffer;
};
+extern char kernel_printk_buffer[Console::BUFFER_SIZE];
+
#endif
diff --git a/src/include/usr/errl/errlreasoncodes.H b/src/include/usr/errl/errlreasoncodes.H
index f4cac6249..2a3a690ba 100644
--- a/src/include/usr/errl/errlreasoncodes.H
+++ b/src/include/usr/errl/errlreasoncodes.H
@@ -70,6 +70,7 @@ namespace ERRORLOG
ERRL_UDT_ATTRIBUTE = 0x04,
ERRL_UDT_LOGREGISTER = 0x05,
ERRL_UDT_CALLOUT = 0x06,
+ ERRL_UDT_PRINTK = 0x07,
};
};
diff --git a/src/include/usr/errl/errludprintk.H b/src/include/usr/errl/errludprintk.H
new file mode 100644
index 000000000..5717169ae
--- /dev/null
+++ b/src/include/usr/errl/errludprintk.H
@@ -0,0 +1,69 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/errl/errludprintk.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2014 */
+/* */
+/* 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 ERRL_UDPRINTK_H
+#define ERRL_UDPRINTK_H
+
+/**
+ * @file errludprintk.H
+ *
+ * Defines the ErrlUserDetailsPrintk class that adds a portion of the printk
+ * buffers as FFDC to an error log as user detail data.
+ */
+
+#include <stdint.h>
+#include <errl/errluserdetails.H>
+
+namespace ERRORLOG
+{
+
+ class ErrlUserDetailsPrintk : public ErrlUserDetails
+ {
+ public:
+ enum { DEFAULT_SIZE_BYTES = 256 };
+
+ /** @brief Constructor
+ *
+ * Captures the printk buffer.
+ *
+ * @param[in] i_size - Amount (in bytes) of data to capture.
+ */
+ explicit ErrlUserDetailsPrintk(size_t i_size = DEFAULT_SIZE_BYTES)
+ {
+ _capturePrintk(i_size);
+ }
+
+ /** @brief Destructor
+ */
+ virtual ~ErrlUserDetailsPrintk() {};
+
+ private:
+ //Disabled.
+ ErrlUserDetailsPrintk(const ErrlUserDetailsPrintk&);
+ ErrlUserDetailsPrintk& operator=(const ErrlUserDetailsPrintk&);
+
+ void _capturePrintk(size_t);
+ };
+
+}
+
+#endif
diff --git a/src/usr/errl/errludprintk.C b/src/usr/errl/errludprintk.C
new file mode 100644
index 000000000..f4838c7d2
--- /dev/null
+++ b/src/usr/errl/errludprintk.C
@@ -0,0 +1,49 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/errl/errludprintk.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2014 */
+/* */
+/* 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 */
+#include <errl/errludprintk.H>
+#include <errl/errlreasoncodes.H>
+#include <kernel/console.H>
+#include <algorithm>
+#include <string.h>
+
+namespace ERRORLOG
+{
+
+ void ErrlUserDetailsPrintk::_capturePrintk(size_t i_size)
+ {
+ // Determine existing size of printk buffer.
+ size_t printkSize = strnlen(kernel_printk_buffer, Console::BUFFER_SIZE);
+ i_size = std::min(i_size, printkSize);
+
+ // Copy trailing i_size to UD buffer.
+ uint8_t* buffer = reallocUsrBuf(i_size);
+ memcpy(buffer, &kernel_printk_buffer[printkSize - i_size], i_size);
+
+ // Set up ErrlUserDetails instance variables.
+ iv_CompId = ERRL_COMP_ID;
+ iv_Version = 1;
+ iv_SubSection = ERRL_UDT_PRINTK;
+
+ }
+
+};
diff --git a/src/usr/errl/makefile b/src/usr/errl/makefile
index 544fa9695..cfeb85dc2 100644
--- a/src/usr/errl/makefile
+++ b/src/usr/errl/makefile
@@ -5,7 +5,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2013
+# COPYRIGHT International Business Machines Corp. 2011,2014
#
# p1
#
@@ -26,7 +26,7 @@ MODULE = errl
OBJS = errlentry.o errlmanager.o errlsctn.o errlsctnhdr.o errlprvt.o errluh.o \
errlud.o errlsrc.o errluserdetails.o backtrace.o errludtarget.o \
errludstring.o errludbacktrace.o errludattribute.o errludlogregister.o \
- errludcallout.o
+ errludcallout.o errludprintk.o
SUBDIRS = test.d parser.d runtime.d
diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C
index 2b1db6b35..3a437b933 100644
--- a/src/usr/initservice/baseinitsvc/initservice.C
+++ b/src/usr/initservice/baseinitsvc/initservice.C
@@ -47,6 +47,7 @@
#include <errl/errludstring.H>
+#include <errl/errludprintk.H>
#include <initservice/taskargs.H> // TASK_ENTRY_MACRO
@@ -262,6 +263,9 @@ errlHndl_t InitService::startTask(
INITSERVICE::WAIT_TASK_FAILED,
l_tidretrc, l_childsts, hbSwError);
+ // Add Printk Buffer for FFDC.
+ ERRORLOG::ErrlUserDetailsPrintk().addToLog(l_errl);
+
// If the task crashed, then the l_childerrl is either NULL or
// contains an RC indicating that the issue causing the child
// to crash has already been reported. Therefore, reduce the
@@ -390,6 +394,9 @@ errlHndl_t InitService::executeFn(
INITSERVICE::WAIT_FN_FAILED,
l_tidretrc, l_childsts, hbSwError);
+ // Add Printk Buffer for FFDC.
+ ERRORLOG::ErrlUserDetailsPrintk().addToLog(l_errl);
+
// If the task crashed, then the l_childerrl is either NULL or
// contains an RC indicating that the issue causing the child
// to crash has already been reported. Therefore, reduce the
OpenPOWER on IntegriCloud