summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/errl/errlentry.C107
-rw-r--r--src/usr/errl/errlffdc.C68
-rw-r--r--src/usr/errl/errlffdc.H87
-rw-r--r--src/usr/errl/errlmanager.C74
-rw-r--r--src/usr/errl/errlsctn.C32
-rw-r--r--src/usr/errl/errlsctn.H127
-rw-r--r--src/usr/errl/errlsctnhdr.C38
-rw-r--r--src/usr/errl/errlsctnhdr.H76
-rw-r--r--src/usr/errl/errlservicecodes.H30
-rw-r--r--src/usr/errl/makefile8
-rw-r--r--src/usr/errl/test/errltest.H143
-rw-r--r--src/usr/errl/test/makefile6
-rw-r--r--src/usr/example/example.C25
-rw-r--r--src/usr/makefile2
14 files changed, 822 insertions, 1 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C
new file mode 100644
index 000000000..fcff1c204
--- /dev/null
+++ b/src/usr/errl/errlentry.C
@@ -0,0 +1,107 @@
+/**
+ * @file errlentry.C
+ *
+ * @brief Implementation of ErrlEntry class
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <trace/interface.H>
+#include <hbotcompid.H>
+#include "errlsctn.H"
+#include "errlffdc.H"
+
+namespace ERRORLOG
+{
+
+// Trace definition
+trace_desc_t* g_trac_errl = NULL;
+TRAC_INIT(&g_trac_errl, "ERRL", 4096);
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlEntry::ErrlEntry(const errlSeverity_t i_sev,
+ const uint8_t i_modId,
+ const uint16_t i_reasonCode,
+ const uint64_t i_user1,
+ const uint64_t i_user2)
+:iv_reasonCode(i_reasonCode),
+iv_sev(i_sev),
+iv_eventType(ERRL_ETYPE_NOT_APPLICABLE),
+iv_subSys(EPUB_RESERVED_0),
+iv_srcType(SRC_ERR_INFO),
+iv_termState(TERM_STATE_UNKNOWN),
+iv_modId(i_modId),
+iv_user1(i_user1),
+iv_user2(i_user2),
+iv_sections(NULL)
+{
+ iv_logId = theErrlManager::instance().getUniqueErrId();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlEntry::~ErrlEntry()
+{
+ // Free memory of all sections
+ for (std::vector<ErrlSctn*>::iterator l_itr = iv_sections.begin();
+ l_itr != iv_sections.end(); ++l_itr)
+ {
+ delete (*l_itr);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlFFDC* ErrlEntry::addFFDC(const compId_t i_compId,
+ const void * i_dataPtr,
+ const uint32_t i_ffdcLen,
+ const uint8_t i_ffdcVer,
+ const uint8_t i_ffdcSubSect)
+{
+ ErrlFFDC* l_ffdcSection = NULL;
+
+ if ( (i_dataPtr == NULL) || (i_ffdcLen == 0) )
+ {
+ TRACFCOMP(ERRORLOG::g_trac_errl, "Invalid FFDC data pointer or size, no add");
+ }
+ else
+ {
+ // Create
+ l_ffdcSection = new ErrlFFDC(i_compId, i_dataPtr, i_ffdcLen,
+ i_ffdcVer, i_ffdcSubSect);
+ // Add to error log
+ addSection(l_ffdcSection);
+ }
+
+ return l_ffdcSection;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void ErrlEntry::appendToFFDC(ErrlFFDC* i_ffdcPtr,
+ const void *i_dataPtr,
+ const uint32_t i_dataLen)
+{
+ //@todo Need to support append data to an existing FFDC data block
+ return;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void ErrlEntry::addSection(ErrlSctn* i_sctn)
+{
+ // Add pointer
+ iv_sections.push_back(i_sctn);
+ return;
+}
+
+
+
+} // End namespace
+
diff --git a/src/usr/errl/errlffdc.C b/src/usr/errl/errlffdc.C
new file mode 100644
index 000000000..6fc4388fa
--- /dev/null
+++ b/src/usr/errl/errlffdc.C
@@ -0,0 +1,68 @@
+/**
+ * @file errlffdc.C
+ *
+ * @brief Implementation of ErrlFFDC class
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <trace/interface.H>
+#include "errlffdc.H"
+#include "errlsctn.H"
+
+namespace ERRORLOG
+{
+
+extern trace_desc_t* g_trac_errl;
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlFFDC::ErrlFFDC(const compId_t i_compId,
+ const void* i_ffdcPtr,
+ const uint32_t i_ffdcLen,
+ const uint8_t i_ffdcVer,
+ const uint8_t i_ffdcSubSect)
+: ErrlSctn(i_compId, i_ffdcVer, i_ffdcSubSect),
+ iv_data( NULL ),
+ iv_size( 0 )
+{
+ addData(i_ffdcPtr, i_ffdcLen);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlFFDC::~ErrlFFDC()
+{
+ // Free FFDC data memory
+ delete iv_data;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void ErrlFFDC::addData(const void *i_data,
+ const uint32_t i_size)
+{
+ // Resize memory block
+ iv_data = (uint8_t*)realloc(iv_data, iv_size + i_size);
+
+ // Make sure reallocate call successes
+ if (iv_data != NULL)
+ {
+ // Copy data to new area
+ memcpy(iv_data + iv_size, i_data, i_size);
+
+ // Total extra data
+ iv_size += i_size;
+ }
+ else
+ {
+ TRACFCOMP(g_trac_errl, "ErrlFFDC::addData() - Reallocate memory failed!");
+ }
+}
+
+
+} // End namespace
diff --git a/src/usr/errl/errlffdc.H b/src/usr/errl/errlffdc.H
new file mode 100644
index 000000000..7e945527e
--- /dev/null
+++ b/src/usr/errl/errlffdc.H
@@ -0,0 +1,87 @@
+#ifndef ERRLFFDC_H
+#define ERRLFFDC_H
+/**
+ * @file errlffdc.H
+ *
+ * @brief FFDC data section within ErrlEntry object
+ *
+ * This header file contains the definition of FFDC data class that
+ * is attached within the ErrlEntry object.
+ *
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdint.h>
+#include <stdlib.h>
+#include "errlsctn.H"
+
+
+namespace ERRORLOG
+{
+
+/**
+ * @brief Abstract an FFDC data section in an error log
+ * This class contains FFDC data that users add to an error log.
+ */
+class ErrlFFDC: public ErrlSctn
+{
+
+public:
+
+ /**
+ * @brief Constructor
+ * Create a user data FFDC section with the given
+ * input data.
+ *
+ * @param[in] i_compId Creator (component id)
+ * @param[in] i_ffdcPtr Data pointer
+ * @param[in] i_ffdcLen Data length (bytes)
+ * @param[in] i_ffdcVer Data identifier
+ * @param[in] i_ffdcSubSect Sub section identifier
+ *
+ * @return void
+ */
+ ErrlFFDC(const compId_t i_compId,
+ const void* i_ffdcPtr,
+ const uint32_t i_ffdcLen,
+ const uint8_t i_ffdcVer,
+ const uint8_t i_ffdcSubSect);
+
+
+ /**
+ * @brief Cleanup ( destructor )
+ *
+ * Releases allocated resources
+ *
+ */
+ ~ErrlFFDC();
+
+ /**
+ * @brief Appends data to the section
+ * Grows the section by the given amount
+ *
+ * @param[in] i_data Pointer to data source
+ * @param[in] i_size Data size (bytes)
+ *
+ * @return None
+ */
+ void addData(const void *i_data,
+ const uint32_t i_size);
+
+private:
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlFFDC(const ErrlFFDC& i_right);
+ ErrlFFDC& operator=(const ErrlFFDC& i_right);
+
+ uint8_t* iv_data; // Data Pointer
+ uint32_t iv_size; // Data Length
+};
+
+
+} // End namespace
+
+#endif //ERRLFFDC_H
diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C
new file mode 100644
index 000000000..d3501e8ae
--- /dev/null
+++ b/src/usr/errl/errlmanager.C
@@ -0,0 +1,74 @@
+/**
+ * @file errlmanager.C
+ *
+ * @brief Implementation of ErrlManager class
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <errl/errlmanager.H>
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+
+namespace ERRORLOG
+{
+
+extern trace_desc_t* g_trac_errl;
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlManager::ErrlManager()
+:iv_currLogId(0)
+{
+ //@todo
+ // This is done in order to avoid reading logID from PNOR for every
+ // error log created.
+ // When ErrlManager singleton instantiated:
+ // 1. Parse the last committed error from PNOR
+ // 2. Get the logID from that error
+ // 3. Load iv_currLogId with that value.
+ // 4. When next error is committed, assign the next ID value to it
+ // before writing to PNOR.
+
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlManager::~ErrlManager()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void ErrlManager::commitErrLog(errlHndl_t& io_err)
+{
+ // If NULL, put out warning trace
+ if (io_err == NULL)
+ {
+ //@thi TRACFCOMP(g_trac_errl, "commitErrLog() - NULL pointer");
+ }
+ else
+ {
+ // Assign a unique error ID to the committed log
+ uint32_t l_errId = getUniqueErrId();
+ io_err->setLogId(l_errId);
+
+ // @todo:
+ // - Flatten error into PNOR
+
+ delete io_err;
+ io_err = NULL;
+ }
+ return;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+uint32_t ErrlManager::getUniqueErrId()
+{
+ return (__sync_add_and_fetch(&iv_currLogId, 1));
+}
+
+} // End namespace
diff --git a/src/usr/errl/errlsctn.C b/src/usr/errl/errlsctn.C
new file mode 100644
index 000000000..75d06c5bb
--- /dev/null
+++ b/src/usr/errl/errlsctn.C
@@ -0,0 +1,32 @@
+/**
+ * @file errlsctn.C
+ *
+ * @brief Implementation of ErrlSctn class
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include "errlsctn.H"
+
+namespace ERRORLOG
+{
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlSctn::ErrlSctn(const compId_t i_compId,
+ const uint8_t i_sctnVer,
+ const uint8_t i_subSect)
+:iv_header(i_compId, i_sctnVer, i_subSect)
+{
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlSctn::~ErrlSctn()
+{
+
+}
+
+} // end namespace
diff --git a/src/usr/errl/errlsctn.H b/src/usr/errl/errlsctn.H
new file mode 100644
index 000000000..800665d48
--- /dev/null
+++ b/src/usr/errl/errlsctn.H
@@ -0,0 +1,127 @@
+#ifndef ERRLSCTN_H
+#define ERRLSCTN_H
+/**
+ * @file errlsctn.H
+ *
+ * @brief Base class that abstracts a section in an error log.
+ * A section may be used to store unique data for the
+ * error such as FFDC, Software error information, etc...
+ *
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdint.h>
+#include <stdlib.h>
+#include <errl/errltypes.H>
+#include "errlsctnhdr.H"
+
+namespace ERRORLOG
+{
+
+/**
+ * @brief Base class that abstracts a section in an error log object.
+ */
+class ErrlSctn
+{
+
+public:
+
+ /**
+ * @brief Constructor
+ * Initializes the base object with section information
+ *
+ * @param[in] i_compId Component Id of the caller
+ * @param[in] i_sctnVer A user supplied identifier which
+ * classifies the data in the section
+ * @param[in] i_subSect A user supplied sub section identifier
+ * which classifies the data. This in
+ * conjunction with the version can be used
+ * to decode the data.
+ * @return void
+ *
+ */
+ ErrlSctn(const compId_t i_compId,
+ const uint8_t i_sctnVer,
+ const uint8_t i_subSect);
+
+ /**
+ * @brief Default destructor
+ *
+ * @return void
+ */
+ virtual ~ErrlSctn();
+
+ //@todo - Need to add serialization interfaces for ErrlSctn object.
+ // Serialization method (boost serialization?) for HostBoot
+ // is currently not yet determined.
+ // Note: stream is currently not supported
+
+ /**
+ * @brief Get section's version
+ *
+ * @return Section version (uint8_t)
+ *
+ */
+ uint8_t sctnVer() const;
+
+ /**
+ * @brief Get section's subsection type
+ *
+ * @return Subsection type (uint8_t)
+ *
+ */
+ uint8_t subSect() const;
+
+ /**
+ * @brief Get section's component Id
+ *
+ * @return Component Id of the section creator
+ *
+ */
+ compId_t compId() const;
+
+private:
+
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlSctn(const ErrlSctn& i_right);
+ ErrlSctn& operator=(const ErrlSctn& i_right);
+
+ // Section header
+ ErrlSctnHdr iv_header;
+
+};
+
+//-----------------------------------------------------------------------
+// In-line functions
+//-----------------------------------------------------------------------
+
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+inline uint8_t ErrlSctn::sctnVer() const
+{
+ return iv_header.iv_sctnVer;
+}
+
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+inline uint8_t ErrlSctn::subSect() const
+{
+ return iv_header.iv_subSect;
+}
+
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+inline compId_t ErrlSctn::compId() const
+{
+ return iv_header.iv_compId;
+}
+
+
+} // End namespace
+
+#endif //ERRLSCTN_H
+
diff --git a/src/usr/errl/errlsctnhdr.C b/src/usr/errl/errlsctnhdr.C
new file mode 100644
index 000000000..a663b34b9
--- /dev/null
+++ b/src/usr/errl/errlsctnhdr.C
@@ -0,0 +1,38 @@
+/**
+ * @file errlsctnhdr.C
+ *
+ * @brief Abstract header of all error log's sections
+ *
+ * This header file contains the definition of common section header in
+ * each error log's section
+ *
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include "errlsctnhdr.H"
+
+namespace ERRORLOG
+{
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlSctnHdr::ErrlSctnHdr(const compId_t i_compId,
+ const uint8_t i_sctnVer,
+ const uint8_t i_subSect)
+:iv_compId(i_compId),
+iv_sctnVer(i_sctnVer),
+iv_subSect(i_subSect)
+{
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+ErrlSctnHdr::~ErrlSctnHdr()
+{
+
+}
+
+} // End namespace
diff --git a/src/usr/errl/errlsctnhdr.H b/src/usr/errl/errlsctnhdr.H
new file mode 100644
index 000000000..cd741f42f
--- /dev/null
+++ b/src/usr/errl/errlsctnhdr.H
@@ -0,0 +1,76 @@
+#ifndef ERRLSCTNHDR_H
+#define ERRLSCTNHDR_H
+/**
+ * @file errlsctnhdr.H
+ *
+ * @brief This file contain the class that abstracts the header of
+ * an error log section.
+ *
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdint.h>
+#include <stdlib.h>
+#include <errl/errltypes.H>
+#include <hbotcompid.H>
+
+namespace ERRORLOG
+{
+
+/**
+ * @brief This class abstracts a header of a section in an error log object
+ */
+class ErrlSctnHdr
+{
+ // ErrlSctn needs to set the header's parameters
+ friend class ErrlSctn;
+
+ /**
+ * @brief Section header constructor
+ *
+ * @param[in] i_compId Component Id of the caller
+ * @param[in] i_sctnVer A user supplied identifier which
+ * classifies the data in the section
+ * @param[in] i_subSect A user supplied sub section identifier
+ * which classifies the data. This in
+ * conjunction with the version can be used
+ * to decode the data.
+ * @return void
+ */
+ ErrlSctnHdr(const compId_t i_compId,
+ const uint8_t i_sctnVer,
+ const uint8_t i_subSect);
+
+ /**
+ * @brief Default destructor
+ *
+ * @return void
+ */
+ ~ErrlSctnHdr();
+
+ //@todo - Need to add serialization interfaces for ErrlSctnHdr object.
+ // Serialization method (boost serialization?) for HostBoot
+ // is currently not yet determined.
+ // Note: stream is currently not supported
+
+private:
+
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlSctnHdr(const ErrlSctnHdr& i_right);
+ ErrlSctnHdr& operator=(const ErrlSctnHdr& i_right);
+
+ // Data
+ compId_t iv_compId;
+ uint8_t iv_sctnVer;
+ uint8_t iv_subSect;
+
+};
+
+} // End namespace
+
+#endif //ERRLSCTNHDR_H
+
diff --git a/src/usr/errl/errlservicecodes.H b/src/usr/errl/errlservicecodes.H
new file mode 100644
index 000000000..8884d6cd1
--- /dev/null
+++ b/src/usr/errl/errlservicecodes.H
@@ -0,0 +1,30 @@
+#ifndef __ERRL_SERVICE_CODE_H
+#define __ERRL_SERVICE_CODE_H
+
+/**
+ * @file errlservicecodes.H
+ *
+ * @brief Reason code and Module ID definitions for ERRL component.
+ *
+ */
+
+#include <hbotcompid.H>
+
+// Module IDs for ERRL component
+enum
+{
+ ERRL_FIRST_MODULE_ID = 0x00,
+ //........
+ ERRL_LAST_MODULE_ID = 0xFF
+};
+
+// Reason codes for ERRL component
+enum errlReasonCode
+{
+ ERRL_FIRST_ERR = ERRL_COMP_ID | 0x01,
+ //........
+ ERRL_LAST_ERR = ERRL_COMP_ID | 0xFF
+};
+
+
+#endif
diff --git a/src/usr/errl/makefile b/src/usr/errl/makefile
new file mode 100644
index 000000000..22cd0ce00
--- /dev/null
+++ b/src/usr/errl/makefile
@@ -0,0 +1,8 @@
+ROOTPATH = ../../..
+MODULE = errl
+
+OBJS = errlentry.o errlmanager.o errlsctn.o errlffdc.o errlsctnhdr.o
+
+SUBDIRS = test.d
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H
new file mode 100644
index 000000000..ab3f40b65
--- /dev/null
+++ b/src/usr/errl/test/errltest.H
@@ -0,0 +1,143 @@
+#ifndef __ERRLTEST_H
+#define __ERRLTEST_H
+
+/**
+ * @file errltest.H
+ *
+ * @brief Test case for Error Logging
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <errl/errltypes.H>
+
+#define TEST_REASON_CODE 0x0F0F
+#define TEST_SEVERITY ERRORLOG::ERRL_SEV_INFORMATIONAL
+#define TEST_MOD_ID 0x0022
+#define TEST_USR_DATA_1 0x8000000000000001
+#define TEST_USR_DATA_2 0x9000000000000003
+#define TEST_RETURN_CODE 0xF0F0
+
+class ErrlTest: public CxxTest::TestSuite
+{
+public:
+
+
+ /**
+ * @brief Test error log creation
+ * - Create an error log
+ * - Verify data of created log
+ * - Commit an error log
+ * - Delete an error log
+ */
+ void testErrl1(void)
+ {
+ // Create an error log
+ errlHndl_t l_err = new ERRORLOG::ErrlEntry(
+ TEST_SEVERITY,
+ TEST_MOD_ID,
+ TEST_REASON_CODE,
+ TEST_USR_DATA_1,
+ TEST_USR_DATA_2);
+
+ // Make sure log is created
+ if (l_err == NULL)
+ {
+ TS_FAIL("testErrl1: createErrlLog() outputs NULL pointer!");
+ }
+
+ // Verify log data
+ else if (l_err->sev() != ERRORLOG::ERRL_SEV_INFORMATIONAL)
+ {
+ TS_FAIL("testErrl1: createErrlLog() returns incorrect severity!");
+ }
+ else if (l_err->reasonCode() != TEST_REASON_CODE)
+ {
+ TS_FAIL("testErrl1: createErrlLog() returns incorrect reason code!");
+ }
+ else if (l_err->eventType() != ERRORLOG::ERRL_ETYPE_NOT_APPLICABLE)
+ {
+ TS_FAIL("testErrl1: createErrlLog() returns incorrect event type!");
+ }
+ else if (l_err->subSys() != ERRORLOG::EPUB_RESERVED_0)
+ {
+ TS_FAIL("testErrl1: createErrlLog() returns incorrect sub system!");
+ }
+ else if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO)
+ {
+ TS_FAIL("testErrl1: createErrlLog() returns incorrect SRC type!");
+ }
+ else if (l_err->termState() != ERRORLOG::TERM_STATE_UNKNOWN)
+ {
+ TS_FAIL("testErrl1: termState() returns incorrect term state!");
+ }
+ else
+ {
+ // Commit error log
+ ERRORLOG::theErrlManager::instance().commitErrLog(l_err);
+ // Make sure error log has been deleted by manager
+ if (l_err != NULL)
+ {
+ TS_FAIL("testErrl1: commitErrLog() did not delete error!");
+ }
+ }
+ }
+
+ /**
+ * @brief Test error log parameter settings
+ */
+ void testErrl2(void)
+ {
+ // Create an error log
+ errlHndl_t l_err = new ERRORLOG::ErrlEntry(
+ TEST_SEVERITY,
+ TEST_MOD_ID,
+ TEST_REASON_CODE,
+ TEST_USR_DATA_1,
+ TEST_USR_DATA_2);
+
+ // Make sure log is created
+ if (l_err == NULL)
+ {
+ TS_FAIL("testErrl2: createErrlLog() returns NULL pointer!");
+ }
+ else
+ {
+ // Set and verify log data
+ l_err->setSev(ERRORLOG::ERRL_SEV_UNKNOWN);
+ l_err->setEventType(ERRORLOG::ERRL_ETYPE_CAPACITY_UPGRADE);
+ l_err->setSubSys(ERRORLOG::EPUB_UNKNOWN);
+ l_err->setSrcType(ERRORLOG::SRC_ERR_INFO);
+ l_err->setTermState(ERRORLOG::TERM_STATE_NO_FLAGS);
+
+ if (l_err->sev() != ERRORLOG::ERRL_SEV_UNKNOWN)
+ {
+ TS_FAIL("testErrl2: setSev() fails!");
+ }
+ else if (l_err->eventType() != ERRORLOG::ERRL_ETYPE_CAPACITY_UPGRADE)
+ {
+ TS_FAIL("testErrl2: setEventType() fails!");
+ }
+ else if (l_err->subSys() != ERRORLOG::EPUB_UNKNOWN)
+ {
+ TS_FAIL("testErrl2: setSubSys() fails!");
+ }
+ else if (l_err->srcType() != ERRORLOG::SRC_ERR_INFO)
+ {
+ TS_FAIL("testErrl2: setSrcType() fails!");
+ }
+ else if (l_err->termState() != ERRORLOG::TERM_STATE_NO_FLAGS)
+ {
+ TS_FAIL("testErrl2: setTermState() fails!");
+ }
+
+ // Delete the log
+ delete l_err;
+ l_err = NULL;
+
+ }
+ }
+};
+
+#endif
diff --git a/src/usr/errl/test/makefile b/src/usr/errl/test/makefile
new file mode 100644
index 000000000..d27860550
--- /dev/null
+++ b/src/usr/errl/test/makefile
@@ -0,0 +1,6 @@
+ROOTPATH = ../../../..
+
+MODULE = testerrl
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/example/example.C b/src/usr/example/example.C
index 803f719b0..536100368 100644
--- a/src/usr/example/example.C
+++ b/src/usr/example/example.C
@@ -4,6 +4,8 @@
#include <sys/task.h>
#include <trace/interface.H>
#include <example/example.H>
+#include <example/examplerc.H>
+#include <errl/errlentry.H>
//static mutex_t value = mutex_create();
trace_desc_t *g_trac_test = NULL;
@@ -25,3 +27,26 @@ uint64_t example1_function()
return l_rc;
}
+
+// This example shows how to create an error log with passed-in
+// defined parameters
+void example2_create_errorlog_function()
+{
+ /*@
+ * @errortype
+ * @moduleid MY_MODULE_ID_1
+ * @reasoncode MY_REASON_CODE_1
+ * @userdata1 Meaning of userdata1 value
+ * @userdata2 Meaning of userdata2 value
+ * @devdesc Example of creating an error log
+ */
+ errlHndl_t l_err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ MY_MODULE_ID_1,
+ MY_REASON_CODE_1,
+ 0x8000000000000001,
+ 0x9000000000000003);
+ delete l_err;
+ l_err = NULL;
+ return;
+}
diff --git a/src/usr/makefile b/src/usr/makefile
index 7f48ff5c6..aa24cf6cd 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -1,6 +1,6 @@
ROOTPATH = ../..
OBJS = module_init.o
-SUBDIRS = example.d trace.d cxxtest.d
+SUBDIRS = example.d trace.d cxxtest.d errl.d
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud