summaryrefslogtreecommitdiffstats
path: root/src/include/usr
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/include/usr
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/include/usr')
-rw-r--r--src/include/usr/errl/errlentry.H242
-rw-r--r--src/include/usr/errl/errlmanager.H19
-rw-r--r--src/include/usr/errl/errlprvt.H145
-rw-r--r--src/include/usr/errl/errlsctn.H106
-rw-r--r--src/include/usr/errl/errlsctnhdr.H164
-rw-r--r--src/include/usr/errl/errlsrc.H146
-rw-r--r--src/include/usr/errl/errltypes.H370
-rw-r--r--src/include/usr/errl/errlud.H185
-rw-r--r--src/include/usr/errl/errluh.H165
-rw-r--r--src/include/usr/hbotcompid.H14
-rw-r--r--src/include/usr/trace/trace.H48
11 files changed, 1393 insertions, 211 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H
index 5e5205fb8..51a0df843 100644
--- a/src/include/usr/errl/errlentry.H
+++ b/src/include/usr/errl/errlentry.H
@@ -38,6 +38,11 @@
#include <stdint.h>
#include <vector>
#include <errl/errltypes.H>
+#include <errl/errlsctn.H>
+#include <errl/errlprvt.H>
+#include <errl/errluh.H>
+#include <errl/errlsrc.H>
+#include <errl/errlud.H>
#include <hbotcompid.H>
namespace ERRORLOG
@@ -47,8 +52,15 @@ namespace ERRORLOG
// Forward class declarations
/*****************************************************************************/
class ErrlManager;
-class ErrlSctn;
-class ErrlFFDC;
+
+
+
+
+// In Sprint 6, the return from errl->addFFDC changed from
+// ErrlFFDC* to ErrlUD*. This typedef is for compatibility in
+// case anybody previously stored the return from errl->addFFDC() as
+// ErrlFFDC *.
+typedef ErrlUD ErrlFFDC;
/**
* @brief Host Boot Error log entry class.
@@ -63,6 +75,8 @@ class ErrlEntry
friend class ErrlManager;
+
+
public:
/**
* @brief ErrlEntry constructor. Builds an error log with info
@@ -123,6 +137,7 @@ public:
*/
errlSeverity_t sev() const;
+
/**
* @brief Set the log's severity
* The severity of a log determines how severe the
@@ -175,6 +190,19 @@ public:
/**
+ * @brief Get the unique platform log identifier (PLID) of the error log.
+ * In legacy FSP, you could have one platform log ID such that a
+ * of entry IDs (EIDs) related to a single PLID. So far in Hostboot,
+ * PLID == EID. As such, there is no setter in the ErrlEntry interface
+ * for EID. When flattened as PEL for export, EID will be set to PLID.
+ *
+ * @return The platform log ID of the error log.
+ */
+ uint32_t plid() const;
+
+
+
+ /**
* @brief Get the event type of the error log.
* See errl/errltypes.H
* @return errlEventType_t
@@ -247,6 +275,8 @@ public:
*/
void setTermState(const errlTermState_t i_termState);
+
+
/**
* @brief Allows the caller to add a chunk of data in a log
*
@@ -263,79 +293,92 @@ public:
* @return Pointer to FFDC section if successfully added.
* NULL if fails
*/
- ErrlFFDC* addFFDC(const compId_t i_compId,
- const void * i_dataPtr,
- const uint32_t i_ffdcLen,
- const uint8_t i_ffdcVer = 0,
- const uint8_t i_ffdcSubSect = 0);
+ ErrlUD * addFFDC(const compId_t i_compId,
+ const void * i_dataPtr,
+ const uint32_t i_ffdcLen,
+ const uint8_t i_ffdcVer = 0,
+ const uint8_t i_ffdcSubSect = 0);
/**
* @brief Append more data to an FFDC section.
*
- * @param[in] i_ffdcSctnPtr Pointer to FFDC section to add data to.
- * This pointer is returned when addFFDC
+ * @param[in] i_pErrlUD Pointer to the user-define section
+ * to add data to. This pointer is
+ * returned when addFFDC
* function is called earlier.
* @param[in] i_dataPtr Points to data block to be added
* @param[in] i_dataLen Length of data in bytes
*
* @return void
*/
- void appendToFFDC(ErrlFFDC* i_ffdcSctnPtr,
- const void *i_dataPtr,
- const uint32_t i_dataLen);
+ void appendToFFDC( ErrlUD * i_pErrlUD,
+ const void *i_dataPtr,
+ const uint32_t i_dataLen);
-
-
- /**
- * @brief Compute the flattened size of an error log.
- *
- * @return size in bytes of the flattened data.
- */
- uint64_t flattenedSize();
-
-
/**
- * @brief Flatten the data to caller's buffer.
+ * @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.
*
- * @param[in,out] io_buffer Points to data block to be filled
- * @param[in] i_cbBuffer Count of bytes in buffer supplied
+ * @param[in] i_Name Component Name
+ * @param[in] i_Max Upper limit of trace to capture.
*
- * @return Count of bytes copied to caller's
- * buffer or else zero if it does not fit.
+ * @return A Boolean indication of success. False likely means
+ * the component name input is not found.
*/
- uint64_t flatten( void * io_buffer, const uint64_t i_cbBuffer );
+ bool collectTrace(const char i_name[],
+ const uint32_t i_max = 0);
-private:
+private:
/**
- * @brief Disabled copy constructor and assignment operator
- */
- ErrlEntry(const ErrlEntry& i_right);
- ErrlEntry& operator=(const ErrlEntry& i_right);
+ * @brief The ErrlManager will call here to ask the
+ * ErrlEntry to assign the time of commit, and to assign
+ * the commiter's comp ID.
+ * The ErrlManager is the primary user of this call.
+ *
+ */
+ void commit( compId_t i_commiterComp );
/**
- * @brief Set the log's id
- * This function is called by the ErrlManager to
- * set this log's ID to a unique input number.
- * This is to be called by ErrlManager only.
+ * @brief Compute the flattened size of an error log. It is typical
+ * to call this function for the size of buffer required, then
+ * allocate a buffer, then call flatten().
+ * The ErrlManager is the primary user of this call.
*
- * There is no call to get the log id because it
- * would just be zero until the log is committed.
+ * @return Size in bytes of the flattened data.
+ */
+ uint64_t flattenedSize();
+
+
+ /**
+ * @brief Flatten the data to caller's buffer. The resulting flat
+ * data will be in PEL (platform event log) format.
+ * The ErrlManager is the primary user of this call.
*
- * @param[in] i_val Log ID as assigned by ErrlManager
+ * @param[in,out] o_buffer Points to data block to be filled
+ * @param[in] i_cbBuffer Count of bytes in buffer supplied
*
- * @return void
+ * @return Count of bytes copied to caller's
+ * buffer or else zero if it does not fit.
*/
- void setLogId(const uint32_t i_val);
+ uint64_t flatten( void * o_buffer, const uint64_t i_cbBuffer );
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlEntry(const ErrlEntry& i_right);
+ ErrlEntry& operator=(const ErrlEntry& i_right);
@@ -375,21 +418,6 @@ private:
const callOutPriority_t i_priority);
/**
- * @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.
- *
- * @param[in] i_Name Component Name
- * @param[in] i_Max Upper limit of trace to capture.
- *
- * @return None
- */
- void CollectTrace(const char i_Name[],
- const uint32_t i_Max = 0);
-
- /**
* @brief Adds a software section to the log which is
* mostly used as a stack call indicator
*
@@ -417,127 +445,101 @@ private:
private:
// Data Members
- uint16_t iv_reasonCode; // Comp ID and reason code, 2 nibbles ea
- errlSeverity_t iv_sev; // Log severity
- errlEventType_t iv_eventType; // Event type
- epubSubSystem_t iv_subSys; // Sub system
- srcType_t iv_srcType; // SRC type
- errlTermState_t iv_termState; // Terminate state
- uint8_t iv_modId; // Module ID
- uint64_t iv_user1; // Optional user data 1
- uint64_t iv_user2; // Optional user data 2
- uint64_t iv_CreationTime; // Time of instantiation
- uint32_t iv_logId; // This log's unique ID
- std::vector<ErrlSctn*> iv_SectionVector; // list of user sections
+ ErrlPrvt iv_Private; // private header object
+ ErrlUH iv_User; // user header object
+ ErrlSrc iv_Src; // primary SRC section
+ std::vector<ErrlUD*> iv_SectionVector; // list of user defined sections
+
+ // TODO need to interpret term state and terminate accordingly.
+ // TODO termstate is presently not being flattend into PEL
+ errlTermState_t iv_termState;
};
+
+
+
+
//-----------------------------------------------------------------------
// In-line functions
//-----------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
-inline errlSeverity_t ErrlEntry::sev() const
-{
- return iv_sev;
-}
-
-inline void ErrlEntry::setSev(const errlSeverity_t i_sev)
-{
- iv_sev = i_sev;
- return;
-}
-
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-inline uint16_t ErrlEntry::reasonCode() const
+inline uint32_t ErrlEntry::plid() const
{
- return iv_reasonCode;
+ return iv_Private.iv_plid;
}
-inline void ErrlEntry::setReasonCode( const uint16_t i_reasonCode )
-{
- iv_reasonCode = i_reasonCode;
- return;
-}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
inline uint8_t ErrlEntry::moduleId() const
{
- return iv_modId;
+ return iv_Src.iv_modId;
}
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
inline void ErrlEntry::setModuleId( const uint8_t i_moduleId )
{
- iv_modId = i_moduleId;
+ iv_Src.iv_modId = i_moduleId;
return;
}
+
+
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
-inline errlEventType_t ErrlEntry::eventType() const
+inline errlTermState_t ErrlEntry::termState() const
{
- return iv_eventType;
+ return iv_termState;
}
-inline void ErrlEntry::setEventType(const errlEventType_t i_eventType)
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+inline void ErrlEntry::setTermState(const errlTermState_t i_termState)
{
- iv_eventType = i_eventType;
+ iv_termState = i_termState;
return;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
-inline epubSubSystem_t ErrlEntry::subSys() const
+inline void ErrlEntry::setReasonCode( const uint16_t i_reasonCode )
{
- return iv_subSys;
+ iv_Src.iv_reasonCode = i_reasonCode;
+ return;
}
-inline void ErrlEntry::setSubSys(const epubSubSystem_t i_subSys)
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+inline uint16_t ErrlEntry::reasonCode() const
{
- iv_subSys = i_subSys;
- return;
+ return iv_Src.iv_reasonCode;
}
-
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
inline srcType_t ErrlEntry::srcType() const
{
- return iv_srcType;
+ return iv_Src.iv_srcType;
}
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
inline void ErrlEntry::setSrcType(const srcType_t i_srcType)
{
- iv_srcType = i_srcType;
+ iv_Src.iv_srcType = i_srcType;
return;
}
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-inline errlTermState_t ErrlEntry::termState() const
-{
- return iv_termState;
-}
-inline void ErrlEntry::setTermState(const errlTermState_t i_termState)
-{
- iv_termState = i_termState;
- return;
-}
-////////////////////////////////////////////////////////////////////////////
-// Called by errlmanager at log commit time.
-inline void ErrlEntry::setLogId(const uint32_t i_val)
-{
- iv_logId = i_val;
-}
} // End namespace
diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H
index 4f1275eef..d6d5c5a05 100644
--- a/src/include/usr/errl/errlmanager.H
+++ b/src/include/usr/errl/errlmanager.H
@@ -39,6 +39,10 @@
#include <sys/sync.h>
#include <vector>
#include <kernel/timemgr.H>
+#include <hbotcompid.H>
+
+
+
namespace ERRORLOG
{
@@ -59,11 +63,14 @@ namespace ERRORLOG
* linker issue in HostBoot (linker can't find singleton outside of
* a module).
*
- * @param[in,out] io_err Error log handle to be committed
+ * @param[in,out] io_err Error log handle to be committed
+ * @param[in] i_comitterComp Component committing the error log
*
* @return None
*/
-void errlCommit(errlHndl_t& io_err);
+
+// TODO Work item 4104 to make comitter comp required, no default.
+void errlCommit(errlHndl_t& io_err, compId_t i_committerComp = 0 );
/*****************************************************************************/
// Forward class declarations
@@ -100,7 +107,7 @@ public:
*
* @return None
*/
- void commitErrLog(errlHndl_t& io_err);
+ void commitErrLog(errlHndl_t& io_err, compId_t i_committerComp );
/**
* @brief Returns a unique error log ID
@@ -139,10 +146,10 @@ private:
ErrlManager(const ErrlManager& i_right);
ErrlManager& operator=(const ErrlManager& i_right);
+
/**
- * @brief
- * Current log ID: increment this when assigning log ID to a new errlog
- * as it is being committed.
+ * @brief Current log ID. As new error logs are created,
+ * this value will be used to assign the new error log its ID.
*/
uint32_t iv_currLogId;
diff --git a/src/include/usr/errl/errlprvt.H b/src/include/usr/errl/errlprvt.H
new file mode 100644
index 000000000..d8086b50b
--- /dev/null
+++ b/src/include/usr/errl/errlprvt.H
@@ -0,0 +1,145 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errlprvt.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 ERRLPRVT_H
+#define ERRLPRVT_H
+
+/**
+ * @file errlprvt.H
+ *
+ * @brief A class for the private header 'PH' section of an error log.
+ * Manages the data destined for the PEL PH section.
+ *
+*/
+
+#include <errl/errlsctnhdr.H>
+
+
+namespace ERRORLOG
+{
+
+class ErrlPrvt
+{
+
+ // ErrlEntry may access private elements of this class. Data items that
+ // you would expect to be part of ErrlEntry are actually instance data
+ // in this class.
+ friend class ErrlEntry;
+
+
+private:
+
+ enum constants
+ {
+ SLEN = 40, // section length w/o sizeof(ErrlSctnHdr)
+ SST = 0, // section type
+ VER = 1 // section version
+ // CSS_VER = 8 // TODO unused, relates to iv_cssver[]
+ };
+
+ /**
+ * @brief Constructor will initialize as much data in the private
+ * header as it can, including asking the ErrlManager for the error
+ * log ID. Also sets the time of creation.
+ *
+ * @param[in] i_CreatorCompId Creator of this error log.
+ */
+ ErrlPrvt( compId_t i_CreatorCompId );
+
+
+ /**
+ * @brief Destructor
+ */
+ ~ErrlPrvt();
+
+
+ /**
+ * @brief Disable copy constructor and assignment operator.
+ */
+ ErrlPrvt(const ErrlPrvt& i_right);
+ ErrlPrvt& operator=(const ErrlPrvt& i_right);
+
+
+ /**
+ * @brief Calculates the flattened size of this.
+ *
+ * @return Count of bytes needed to flatten this.
+ */
+ uint64_t flatSize() const;
+
+
+ /**
+ * @brief Flatten this to the output buffer given.
+ *
+ * @param[out] o_pBuffer Pointer to memory buffer where data will go.
+ * @param[in] i_cbBuffer Count of bytes in memory buffer.
+ * Call flatSize() first to know how big the
+ * buffer should be before calling flatten()
+ *
+ * @return Count of bytes flattened, or zero on error. The likely error
+ * is that the buffer is of insufficient size.
+ */
+ uint64_t flatten( void * o_pBuffer, const uint64_t i_cbBuffer );
+
+
+
+ // Instance data
+
+ ErrlSctnHdr iv_header; // section header for any/all sections
+
+ uint64_t iv_created; // TODO Expects BCD_time8_t, but using timebase
+ uint64_t iv_committed; // TODO Expects BCD_time8_t, but using timebase
+ uint8_t iv_cid; // Creator 'B' (enum errlCreator)
+ uint8_t iv_sctns; // count of sections
+ uint32_t iv_plid; // error log id
+
+ // uint8_t iv_cssver[CSS_VER]; // TODO unused now, do we need this?
+ // uint32_t iv_eid; // TODO Error ID now same as PLID
+
+
+};
+
+
+
+/*****************************************************************************/
+// Destructor
+
+inline ErrlPrvt::~ErrlPrvt()
+{
+}
+
+
+/*****************************************************************************/
+// Export data size
+
+inline uint64_t ErrlPrvt::flatSize() const
+{
+ return ( iv_header.flatSize() + ErrlPrvt::SLEN );
+}
+
+
+
+
+} // namespace
+
+
+#endif //ERRLPRVT_H
diff --git a/src/include/usr/errl/errlsctn.H b/src/include/usr/errl/errlsctn.H
new file mode 100644
index 000000000..bd31aec40
--- /dev/null
+++ b/src/include/usr/errl/errlsctn.H
@@ -0,0 +1,106 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errlsctn.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 ERRLSCTN_H
+#define ERRLSCTN_H
+/**
+ * @file errlsctn.H
+ *
+ * @brief Base class for adding sections of data to an error log.
+ * A section may be used to store unique data for the
+ * error such as SRC or user-defined data or
+ * component traces, etc.
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdint.h>
+#include <stdlib.h>
+#include <errl/errltypes.H>
+#include <hbotcompid.H>
+#include <errl/errlsctnhdr.H>
+
+
+
+namespace ERRORLOG
+{
+
+/**
+ * @brief Base class of a section in an error log object. Derivations
+ * may include ErrlCallHome, ErrlExtUH, ErrlSrc, ErrlUD, etc.
+ */
+class ErrlSctn
+{
+
+
+
+protected:
+
+ /**
+ * @brief Constructor
+ * Initializes the base object with section information
+ *
+ * @param[in] i_sid Section id
+ * @param[in] i_slen Section length
+ * @param[in] i_ver Section version
+ * @param[in] i_sst Subsection type
+ * @param[in] i_compId Component id
+ *
+ * @return void
+ */
+ ErrlSctn( const uint16_t i_sid,
+ const uint16_t i_slen,
+ const uint8_t i_ver,
+ const uint8_t i_sst,
+ const compId_t i_compId );
+
+
+ /**
+ * @brief Default destructor
+ *
+ * @return void
+ */
+ virtual ~ErrlSctn();
+
+
+
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlSctn(const ErrlSctn& i_right);
+ ErrlSctn& operator=(const ErrlSctn& i_right);
+
+
+
+ // PEL section header for flattening.
+ ErrlSctnHdr iv_header;
+
+};
+
+
+
+} // End namespace
+
+
+#endif //ERRLSCTN_H
+
diff --git a/src/include/usr/errl/errlsctnhdr.H b/src/include/usr/errl/errlsctnhdr.H
new file mode 100644
index 000000000..069fa58ba
--- /dev/null
+++ b/src/include/usr/errl/errlsctnhdr.H
@@ -0,0 +1,164 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errlsctnhdr.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 ERRLSCTNHDR_H
+#define ERRLSCTNHDR_H
+/**
+ * @file errlsctnhdr.H
+ *
+ * @brief This file contain the class that abstracts the header of
+ * an error log section. Every section in PEL binary data starts with
+ * eight bytes of data. This class manages those 8 bytes for all manner
+ * of PEL sections, including PH (private header), UH (user header),
+ * UD (user defined), etc.
+ *
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <stdint.h>
+#include <stdlib.h>
+#include <errl/errltypes.H>
+#include <hbotcompid.H>
+#include <string.h>
+
+namespace ERRORLOG
+{
+
+/**
+ * @brief class ErrlSctnHdr abstracts a header of each PEL section in an
+ * error log object. Objects of classes ErrlSctn, ErrlUH, ErrlPrvt
+ * have one of these.
+ */
+class ErrlSctnHdr
+{
+
+
+ // All these classes have a ErrlSctnHdr
+ friend class ErrlSctn;
+ friend class ErrlPrvt;
+ friend class ErrlUH;
+ friend class ErrlUD;
+ friend class ErrlSrc;
+
+
+
+private:
+
+ /**
+ * @brief Section header constructor
+ *
+ * Comp ID, section type and version uniquely identify exactly what
+ * kind of a section it is. These fields can be used by a post-dump
+ * parser to call the user-supplied parser code to interpret and
+ * the data nicely.
+ *
+ * @param[in] i_sid Section ID destined for iv_sid
+ * @param[in] i_slen Section length
+ * @param[in] i_ver Section version
+ * @param[in] i_sst Subsection type
+ * @param[in] i_compId Component Id of the caller
+ *
+ * @return void
+ */
+ ErrlSctnHdr( const uint16_t i_sid,
+ const uint16_t i_slen,
+ const uint8_t i_ver,
+ const uint8_t i_sst,
+ const compId_t i_compId );
+
+
+
+
+ /**
+ * @brief Default destructor
+ *
+ * @return void
+ */
+ ~ErrlSctnHdr();
+
+
+
+ /**
+ * @brief Disabled copy constructor and assignment operator
+ */
+ ErrlSctnHdr(const ErrlSctnHdr& i_right);
+ ErrlSctnHdr& operator=(const ErrlSctnHdr& i_right);
+
+
+
+
+ /**
+ * @brief Compute the flattened size of this.
+ *
+ * @return Size in bytes of the flattened data, which is 8
+ * for an ErrlSctnHdr.
+ */
+ uint64_t flatSize() const;
+
+
+
+ /**
+ * @brief Flatten to buffer provided.
+ *
+ * @param[in,out] o_buffer Points to data block to be filled
+ * @param[in] i_cbBuffer Count of bytes in buffer supplied
+ *
+ * @return Count of bytes copied to caller's
+ * buffer or else zero if it does not fit.
+ */
+ uint64_t flatten( void * o_pbuffer, const uint64_t i_cbBuffer );
+
+
+
+
+
+ // Instance data.
+ uint16_t iv_sid; // section id 'PH' 'UH' etc (errlSectionId_t)
+ uint16_t iv_slen; // section length
+ uint8_t iv_ver; // section version
+ uint8_t iv_sst; // subsection type
+ compId_t iv_compId; // hostboot component id
+
+
+};
+
+
+
+//***************************************************************************
+
+inline uint64_t ErrlSctnHdr::flatSize() const
+{
+ // 2 for section id (errlSectionId)
+ // 2 for section len
+ // 1 for ver
+ // 1 for subsection type
+ // 2 for component id
+ CPPASSERT( 8 == sizeof( pelSectionHeader_t ));
+ return sizeof( pelSectionHeader_t );
+}
+
+} // End namespace
+
+#endif //ERRLSCTNHDR_H
+
diff --git a/src/include/usr/errl/errlsrc.H b/src/include/usr/errl/errlsrc.H
new file mode 100644
index 000000000..ab48a93d8
--- /dev/null
+++ b/src/include/usr/errl/errlsrc.H
@@ -0,0 +1,146 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errlsrc.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 ERRLSRC_H
+#define ERRLSRC_H
+
+/**
+ * @file errlsrc.H
+ *
+ * @brief Manage the data that make up the 'PS' section in an
+ * error log PEL. PS stands for Primary System Reference Code, or SRC.
+ * Part of that data management is the flattening of data into PEL.
+ *
+*/
+
+#include <errl/errlsctn.H>
+#include <errl/errlsctnhdr.H>
+
+
+namespace ERRORLOG
+{
+
+class ErrlSrc : public ErrlSctn
+{
+
+ // ErrlEntry may access private elements of this class. Data items that
+ // you would expect to be part of ErrlEntry are actually instance data
+ // in this class.
+ friend class ErrlEntry;
+
+
+private:
+
+
+ enum constants
+ {
+ SLEN = 72, // section length w/o sizeof(ErrlSctnHdr)
+ SST = 1, // section type
+ VER = 1, // section version
+ SRCVER = 2, // SRC version (not section version)
+ WORDCOUNT = 9 // SRC word count
+ // CSS_VER = 8 // TODO unused, relates to iv_cssver[]
+ };
+
+
+ /**
+ * @brief Constructor. Pass in items destined for the primary SRC
+ * section in the error log.
+ *
+ * @param[in] i_srcType SRC type
+ * @param[in] i_modId Module ID
+ * @param[in] i_reasonCode Reason code
+ * @param[in] i_user1 User data 1
+ * @param[in] i_user2 User data 2
+ *
+ */
+ ErrlSrc( srcType_t i_srcType,
+ uint8_t i_modId,
+ uint16_t i_reasonCode,
+ uint64_t i_user1,
+ uint64_t i_user2 );
+
+
+ /** @brief Destructor. */
+ ~ErrlSrc();
+
+
+
+ /**
+ * @brief Disable copy constructor and assignment operator.
+ */
+ ErrlSrc(const ErrlSrc& i_right);
+ ErrlSrc& operator=(const ErrlSrc& i_right);
+
+
+
+ /**
+ * @brief Data export facility to flatten data to PEL.
+ * Exports the object into the 'PS' primary SRC PEL section.
+ *
+ * @param[out] o_pBuffer Pointer to buffer where flattened data will go.
+ * @param[in] i_cbBuffer Count of bytes in target buffer
+ *
+ */
+ uint64_t flatten( void * o_pBuffer, const uint64_t i_cbBuffer );
+
+ /**
+ * @brief Data export size. Presently, Hostboot returns
+ * creates an 80-byte PS section: 72 bytes in the SRC
+ * and 8 bytes for the PEL section header. This is the
+ * amount of flat storage (in bytes) required to
+ * store the object.
+ *
+ * @return Size in bytes.
+ *
+ */
+ uint64_t flatSize() const;
+
+
+ // Instance data
+ srcType_t iv_srcType; // SRC type, the ?? in SRC ??xxxxxx
+ uint8_t iv_modId; // module ID
+ uint16_t iv_reasonCode; // reason code
+ epubSubSystem_t iv_ssid; // subsystem type, the ?? in SRC xx??xxxx
+ uint64_t iv_user1; // user data 1
+ uint64_t iv_user2; // user data 2
+
+
+};
+
+
+//**************************************************************************
+// Hostboot PS SRC section generates minimal section with no additional
+// words of data.
+inline uint64_t ErrlSrc::flatSize() const
+{
+ // 72 bytes in SRC structure + 8 byte section header.
+ CPPASSERT( 80 == sizeof( pelSRCSection_t ));
+ return sizeof( pelSRCSection_t );
+}
+
+
+
+} // namespace
+
+#endif //ERRLSRC_H
+
diff --git a/src/include/usr/errl/errltypes.H b/src/include/usr/errl/errltypes.H
index 10d9e7542..af5067ea4 100644
--- a/src/include/usr/errl/errltypes.H
+++ b/src/include/usr/errl/errltypes.H
@@ -79,25 +79,114 @@ typedef ERRORLOG::ErrlEntry* errlHndl_t;
namespace ERRORLOG
{
+
+
+/**
+ * @brief Scope is found in user header section.
+
+ */
+enum errlScope_t
+{
+ ERRL_SCOPE_PLATFORM = 0x03, ///< Entire Platform
+};
+
+
+
+/**
+ * @brief Domain as found in user header section.
+ */
+enum errlDomain_t
+{
+ ERRL_DOMAIN_DEFAULT = 0xFF // Field based on Subsystem ID
+};
+
+
+/**
+ * @brief Vector as found in user header section.
+ */
+enum errlVector_t
+{
+ ERRL_VECTOR_DEFAULT = 0xFF // Vector that triggered the base class
+ // of problem in Problem Domain Field.
+ // Unique field based on Subsystem ID
+};
+
+
+
+/**
+ * @brief Platform Event Log actions
+ *
+ * Several action flags used to trigger various
+ * handling mechanisms for an event log such as
+ * calling home and sending to the hypervisor.
+ */
+enum errlActions_t
+{
+ ERRL_ACTION_NONE = 0x0000, // No action required
+};
+
+
+
+
+/**
+ * @brief Creator types.
+ */
+enum errlCreator_t
+{
+ ERRL_CID_HOSTBOOT = 'B',
+};
+
+
+
+
+/**
+ * @brief Enumeration of PEL section eyecatchers. These are
+ * usually handled as a uint16_t. See
+ * "eCLipz and P7 Platform Event Log and SRC PLDD" documentation
+ * https://mcdoc.boeblingen.de.ibm.com/out/out.ViewDocument.php?documentid=1675
+ */
+enum errlSectionId_t
+{
+ ERRL_SID_PRIVATE_HEADER = 0x5048, // PH private header
+ ERRL_SID_USER_HEADER = 0x5548, // UH user header
+ ERRL_SID_PRIMARY_SRC = 0x5053, // PS
+ ERRL_SID_USER_DEFINED = 0x5544 // UD user defined
+};
+
+
/**
* @brief Enumeration of error log severity.
* Needs to fit into 1 byte for flattening purposes.
+ *
+ * Severity resides in the user header of the PEL log.
+ *
+ * Refer to this ErrlEntry setter:
+ * void ErrlEntry::setSev(const errlSeverity_t i_sev)
*/
enum errlSeverity_t
{
- ERRL_SEV_INFORMATIONAL = 0x00,
- ERRL_SEV_UNRECOVERABLE = 0x10,
+ ERRL_SEV_INFORMATIONAL = 0x00,
+ ERRL_SEV_UNRECOVERABLE = 0x10,
ERRL_SEV_CRITICAL_SYS_TERM = 0x20,
- ERRL_SEV_UNKNOWN = 0xFF
+ ERRL_SEV_UNKNOWN = 0xFF
};
+
+
+
/**
* @brief Event (error) type
* Needs to fit into 1 byte for flattening purposes.
+ *
+ * Event type resides in user header of PEL log.
+ *
+ * Refer to this ErrlEntry setter:
+ * void ErrlEntry::setEventType(const errlEventType_t i_eventType)
*/
enum errlEventType_t
{
ERRL_ETYPE_NOT_APPLICABLE = 0x00,
+ ERRL_ETYPE_MISCELLANEOUS = 0x01,
ERRL_ETYPE_DUMP_NOTIFICATION = 0x08,
ERRL_ETYPE_USER_DECONFIG = 0x20,
ERRL_ETYPE_SYS_DECONFIG = 0x21,
@@ -105,39 +194,54 @@ enum errlEventType_t
ERRL_ETYPE_CAPACITY_UPGRADE = 0x60,
};
-/**
- * @brief Error log call out priority
- * Needs to fit into 1 byte for flattening purposes.
- */
-enum callOutPriority_t
-{
- CALLOUT_PRIORITY_LOW = 1,
- CALLOUT_PRIORITY_MED = 2,
- CALLOUT_PRIORITY_HIGH = 3,
-};
+
+
/**
- * @brief Error log procedure Id
+ * @brief SRC type definitions
* Needs to fit into 1 byte for flattening purposes.
+ *
+ * This represents the byte in an SRC in position
+ * XX...... such as B1 in B181F00B.
+ *
+ * Refer to errlentry.H and this setter:
+ * void ErrlEntry::setSrcType(const srcType_t i_srcType)
+ *
*/
-enum epubProcedureId_t
+enum srcType_t
{
- EPUB_PRC_NONE = 0x00,
+ SRC_INTERVENTION_REQ = 0xA1,
+ SRC_ERR_INFO = 0xB1,
+ SRC_IPL_STATUS = 0xC1,
+ SRC_GENERAL_STATUS = 0xD1,
};
+
+
+
/**
* @brief Sub system definitions
* Needs to fit into 1 byte for flattening purposes.
+ * This represents the byte in an SRC in position
+ * ..XX.... such as 81 in B181F00B.
+ *
+ * Refer to errentry.H and this setter:
+ * void ErrlEntry::setSubSys(const epubSubSystem_t i_subSys);
*/
enum epubSubSystem_t
{
- EPUB_RESERVED_0 = 0x00,
- EPUB_UNKNOWN = 0xFF,
+ EPUB_RESERVED_0 = 0x00,
+ EPUB_FIRMWARE_SUBSYS = 0x80,
+ EPUB_FIRMWARE_SP = 0x81,
+ EPUB_UNKNOWN = 0xFF,
};
+
+
/**
* @brief Terminating flag definitions
* Needs to fit into 1 word (32-bits) for flattening purposes.
+ * TODO Termination state and termination action.
*/
enum errlTermState_t
{
@@ -146,16 +250,41 @@ enum errlTermState_t
};
-/**
- * @brief SRC type definitions
- * Needs to fit into 1 byte for flattening purposes.
- */
-enum srcType_t
+
+
+/** @enum errlUserDataType_t
+ *
+ * These are section type identifiers for the ERRL component for
+ * user-defined data sections. For example, if somebody calls
+ * errl->collectTrace("INITSVC")
+ * then the resulting UD PEL section header will be tagged with
+ * component id: ERRL_COMP_ID
+ * section type: ERRL_UDT_TRACE
+ * version: ERRL_UDV_DEFAULT_VER_1
+ *
+ * Other components will have to code a similar enum so that
+ * the the errl parser/pretty printer can "dispatch" a user-defined
+ * PEL section to them for printing based on the three values in
+ * the UD PEL section: component id, section type, and version.
+ *
+ * The section type field in the PEL header is one byte long.
+ */
+enum errlUserDataType_t
{
- SRC_INTERVENTION_REQ = 0xA1,
- SRC_ERR_INFO = 0xB1,
- SRC_IPL_STATUS = 0xC1,
- SRC_GENERAL_STATUS = 0xD1,
+ ERRL_UDT_TRACE = 0x0C, // A trace buffer
+};
+
+
+/** @enum errlUserDataVersion
+ *
+ * Identifier for the version of user data in an error log.
+ * This value is used in conjuction with the type field to format
+ * of the additional data in an error log. Versions and type should
+ * be unique across subcomponents of the errl component.
+*/
+enum errlUserDataVersion
+{
+ ERRL_UDV_DEFAULT_VER_1 = 0x0001, // Version 1, default info
};
@@ -171,47 +300,6 @@ const uint32_t ERRL_STORAGE_SIZE = 65536;
/**
- * @brief Flattened error log header structure contains the basic
- * instance variables of the ErrlEntry class. Note the
- * alignment of the fields, and that the structure is packed.
- */
-typedef struct errl_header
-{
- uint32_t cbytes; // count of bytes in this struct
- uint32_t csections; // count of sections in this error log
- uint16_t reasonCode; // reason code
- uint8_t unused1; // need this for alignment
- uint8_t modId; // module id
- uint8_t sev; // severity
- uint8_t eventType; // event type
- uint8_t subSys; // subsystem
- uint8_t srcType; // SRC type
- uint32_t termState; // Terminate state
- uint32_t logId; // This log's unique ID
- uint64_t user1; // Optional user data 1
- uint64_t user2; // Optional user data 2
- uint64_t CreationTime; // time error log was created
-} __attribute__((packed)) errl_header_t;
-
-
-
-/**
- * @brief Error logs may have a number of sections/FFDC sections added.
- * This is a section header that preceeds the user-defined
- * data that follows this header. Note the alignment of the fields,
- * and that this structure is packed.
- */
-typedef struct section_header
-{
- uint32_t cbHeader; // count of bytes in this struct (flattening)
- uint32_t cbSection; // count of bytes in the user-added data
- uint16_t compId; // component id
- uint8_t sctnVer; // section version
- uint8_t subSect; // subsection
-} __attribute__((packed)) section_header_t;
-
-
-/**
* @brief The RAM storage for committed error logs starts with this
* header. This structure is org'ed at &g_ErrlStorage[0]. All
* offsets are based from &g_achErrlStorage[0], so the first
@@ -242,6 +330,152 @@ typedef struct marker
+
+
+
+/**
+ * @brief pelSectionHeader_t
+ *
+ * A PEL structure used to flatten error logs to PEL format.
+ *
+ * This structure represents the first 8 bytes of any PEL section.
+ * Populated by the flatten code of class ErrlSctnHdr for any PEL
+ * section. Classes ErrlUH, ErrlPrvt, and ErrlSctn each have a
+ * ErrlSctnHdr. User-defined sections derive from ErrlSctn, so
+ * their section header works though ErrlSctn parent class.
+ *
+ * When parsing a PEL data set, start at offset 0 (the
+ * first section). Then add "len" to know the starting offset
+ * of the second section, and so on.
+ *
+ * When pretty-printing a user-defined PEL section, the
+ * controlling logic will "dispatch" a PEL section to a
+ * user-supplied printing function based on the component ID,
+ * section type, and version.
+ */
+typedef struct pelsectionheader
+{
+ uint16_t sid; // section identifier
+ uint16_t len; // overall length of this section
+ uint8_t ver; // section version
+ uint8_t sst; // section type
+ uint16_t compId; // component ID
+} __attribute__((packed)) pelSectionHeader_t;
+
+
+
+/**
+ * @brief pelPrivateHeaderSection_t
+ *
+ * A PEL structure used to flatten error logs to PEL format.
+ *
+ * This structure represents an entire Private Header (PH)
+ * PEL section. This section is a fixed overall
+ * length of 48 bytes including the PEL section header.
+ * This the first section found in a flat PEL dataset.
+ * Populated by the flatten code of class ErrlPrvt.
+ *
+ * The component named in the section header is the
+ * creating component of the error log.
+ */
+typedef struct pelprivateheadersection
+{
+ pelSectionHeader_t sectionheader;
+ uint64_t creationTime;
+ uint64_t commitTime;
+ uint8_t creatorId; // 'B' for Hostboot
+ uint8_t reserved0;
+ uint8_t reserved1;
+ uint8_t sectionCount;
+ uint32_t reserved2;
+ uint64_t creatorImplementation;
+ uint32_t plid;
+ uint32_t eid;
+} __attribute__((packed)) pelPrivateHeaderSection_t;
+
+
+
+/**
+ * @brief pelUserHeaderSection_t
+ *
+ * A PEL structure used to flatten error logs to PEL format.
+ *
+ * This structure represents an entire User Header (UH)
+ * PEL section. This section is a fixed overall
+ * length of 0x18 bytes including the PEL section header.
+ * This the second section found in a flat PEL dataset.
+ * Populated by the flatten code of class ErrlUH.
+ *
+ * The component named in the section header is the
+ * committing component of the error log.
+ */
+typedef struct peluserheadersection
+{
+ pelSectionHeader_t sectionheader;
+ uint8_t ssid; // subsystem id
+ uint8_t scope; // event scope
+ uint8_t sev; // severity
+ uint8_t etype; // event type
+ uint32_t reserved0; // for error log return code
+ uint8_t domain; // TODO not used in Hostboot
+ uint8_t vector; // TODO not used in Hostboot
+ uint16_t actions; // TODO not used in Hostboot
+ uint32_t reserved1;
+} __attribute__((packed)) pelUserHeaderSection_t;
+
+
+
+
+/**
+ * @brief pelSRCSection_t
+ *
+ * A PEL structure used to flatten error logs to PEL format.
+ *
+ * This structure represents an entire Primary SRC (PS)
+ * PEL section. This section is a fixed overall
+ * length of 80 bytes including the PEL section header.
+ * This the usually the third section found in a flat PEL dataset.
+ * Populated by the flatten code of class ErrlSRC.
+ *
+ * Hostboot generates a minimal SRC as described under
+ * "Common Usage of the SRC Structure" (p.69) in the PEL
+ * reference (mcdoc 1675). The page numbers below refer
+ * to version 0.8 of that document.
+ */
+
+typedef struct pelsrcsection
+{
+ pelSectionHeader_t sectionheader;
+ uint8_t ver; // src version, usually a 2
+ uint8_t flags; // src flags
+ uint8_t reserved0;
+ uint8_t wordcount; // usually 9
+ uint16_t reserved1; // usually 0, but I put reasonCode here
+ uint16_t srcLength; // usually 72
+ // "Hex word 2" is the legacy nomenclature. p. 71.
+ // Low byte of this word is SRC format 0xF0.
+ uint32_t word2;
+ // "Hex word 3" p. 71
+ uint16_t word3;
+ uint8_t moduleId;
+ uint8_t reserved2;
+ // "Hex word 4" p. 71 last progress code
+ uint32_t word4;
+ // "Hex word 5" p. 72 error status flags, etc.
+ uint32_t word5;
+ // "Hex word 6-7" p. 72 optional, iv_user1
+ uint64_t word6;
+ // "Hex word 8-9" p. 72 optional, iv_user2
+ uint64_t word8;
+ char srcString[32];
+} __attribute__((packed)) pelSRCSection_t;
+
+
+
+
+
+
+
} // End namespace
#endif // ERRLTYPES_H
diff --git a/src/include/usr/errl/errlud.H b/src/include/usr/errl/errlud.H
new file mode 100644
index 000000000..30817e112
--- /dev/null
+++ b/src/include/usr/errl/errlud.H
@@ -0,0 +1,185 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errlud.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 ERRLUD_H
+#define ERRLUD_H
+/**
+ * @file errlud.H
+ *
+ * @brief Derive the ErrlUD (user defined) error log section from the
+ * more general ErrlSctn class.
+*/
+
+
+#include <errl/errlsctn.H>
+#include <errl/errlsctnhdr.H>
+
+
+
+namespace ERRORLOG
+{
+
+
+
+class ErrlUD : public ErrlSctn
+{
+
+
+ // ErrlEntry may access private elements of this class. Data items that
+ // you would expect to be part of ErrlEntry are actually instance data
+ // in this class.
+ friend class ErrlEntry;
+
+
+private:
+
+
+ /**
+ * @brief Constructor
+ *
+ * Create a user data section with the given input data.
+ *
+ * @param i_data Pointer to data
+ * @param i_size Length of data
+ * @param i_cid Component ID of the section
+ * @param i_ver Section version
+ * @param i_sst Section type
+ *
+ */
+ ErrlUD(
+ const void *i_data,
+ uint64_t i_size,
+ compId_t i_cid,
+ uint8_t i_ver,
+ uint8_t i_sst );
+
+
+
+ /**
+ * @brief Destructor
+ *
+ * Releases allocated resources
+ *
+ */
+ virtual ~ErrlUD();
+
+
+ /**
+ * @brief Disable copy constructor and assignment operator.
+ */
+ ErrlUD(const ErrlUD& i_right);
+ ErrlUD& operator=(const ErrlUD& i_right);
+
+
+ /**
+ * @brief Data export size. Amount of flat storage (in bytes) required to
+ * store the object.
+ *
+ * @return size in bytes
+ */
+ uint64_t flatSize();
+
+
+ /**
+ * @brief Data Export facility.
+ * Exports the object into the architecturally
+ * defined format for a user data section.
+ *
+ * @param[in,out] io_pBuffer Pointer to buffer where flat data will go.
+ * @param[in] i_cbBuffer Count of bytes in target buffer
+ *
+ */
+ uint64_t flatten( void * io_pBuffer, const uint64_t i_cbBuffer );
+
+
+
+
+
+ /**
+ * @brief Appends data to the section.
+ * Grows the section by the given amount
+ *
+ * @param[in] i_data Source data
+ * @param[in] i_size Additional size
+ *
+ * @return Size of new data or else zero on error.
+ *
+ */
+ uint64_t addData( const void *i_data, uint64_t i_size );
+
+
+
+
+ /**
+ * @brief Data size of the section
+ *
+ * The distinction is made between data size
+ * and object flat size. This method returns
+ * the size of the data only
+ *
+ * @return Length
+ *
+ */
+ uint64_t dataSize( void ) const;
+
+
+
+ /**
+ * @brief Data access
+ *
+ * Direct Access to the data of the object
+ * ( dangerous - use with caution )
+ *
+ * @return Data pointer
+ *
+ */
+ void * data( void ) const;
+
+
+
+
+ uint8_t * iv_pData; // Data Pointer
+ uint64_t iv_Size; // Data Length
+
+};
+
+
+
+/*****************************************************************************/
+// Get data size
+/*****************************************************************************/
+inline uint64_t ErrlUD::dataSize( void ) const
+{
+ return iv_Size;
+}
+
+
+/*****************************************************************************/
+// Data access pointer
+/*****************************************************************************/
+inline void * ErrlUD::data( void ) const
+{
+ return iv_pData;
+}
+
+} // namespace
+#endif /* ERRLUD_H */
diff --git a/src/include/usr/errl/errluh.H b/src/include/usr/errl/errluh.H
new file mode 100644
index 000000000..5768d85d1
--- /dev/null
+++ b/src/include/usr/errl/errluh.H
@@ -0,0 +1,165 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/errl/errluh.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 ERRLUH_H
+#define ERRLUH_H
+
+/**
+ * @file errluh.H
+ *
+ * @brief A class for the user header 'UH' section of an error log.
+ * This classes manages those ErrlEntry data items that are destined
+ * to be saved in the user header PEL section.
+*/
+
+#include <errl/errlentry.H>
+#include <errl/errlsctnhdr.H>
+
+
+namespace ERRORLOG
+{
+
+
+class ErrlUH
+{
+
+ // ErrlEntry may access private elements of this class. Data items that
+ // you would expect to be part of ErrlEntry are actually instance data
+ // in this class.
+ friend class ErrlEntry;
+
+
+
+private:
+
+ enum constants
+ {
+ // for generating UH section of PEL
+ SLEN = 16, // 16 does not include the 8 bytes of ErrlSctnHdr
+ VER = 1, // section version
+ SST = 0 // section type
+ };
+
+ /** @brief User header constructor. */
+ ErrlUH( errlSeverity_t i_sev );
+
+ /** @brief User header destructor. */
+ ~ErrlUH();
+
+
+ /**
+ * @brief Disable copy constructor and assignment operator.
+ */
+ ErrlUH(const ErrlUH& i_right);
+ ErrlUH& operator=(const ErrlUH& i_right);
+
+
+ /**
+ * @brief Data export size. Amount of flat storage (in bytes) required to
+ * store the object.
+ *
+ * @return size in bytes
+ */
+ uint64_t flatSize() const;
+
+
+ /**
+ * @brief Data Export facility. Flatten the object into PEL for the
+ * 'UH' user header section.
+ *
+ * @param[in,out] io_pBuffer Pointer to buffer where flat data will go.
+ * @param[in] i_cbBuffer Count of bytes in target buffer
+ *
+ */
+ uint64_t flatten( void * io_pBuffer, const uint64_t i_cbBuffer );
+
+
+ /** @brief Set the component ID into the user header.
+ * Only should be called from ErrlEntry instance.
+ * The component ID in the user header identifies
+ * the component that committed the error log.
+ *
+ * @param[in] i_compId component ID
+ */
+ void setComponentId( compId_t i_compId );
+
+
+
+
+ // Instance variables
+ // SctnHdr for 'UH' section
+ ErrlSctnHdr iv_header;
+
+
+ errlSeverity_t iv_severity;
+ errlEventType_t iv_etype;
+
+
+ // TODO may need getters/setters for these fields. Presently,
+ // they are defaulted at object creation time, and not set
+ // or gotten by anyone.
+ epubSubSystem_t iv_ssid;
+ errlDomain_t iv_domain;
+ errlVector_t iv_vector;
+ uint16_t iv_actions;
+ errlScope_t iv_scope;
+
+};
+
+
+
+
+
+/*****************************************************************************/
+// Destructor
+
+inline ErrlUH::~ErrlUH()
+{
+}
+
+
+/*****************************************************************************/
+// Export data size
+
+inline uint64_t ErrlUH::flatSize() const
+{
+ return ( iv_header.flatSize() + SLEN );
+}
+
+
+
+
+/*****************************************************************************/
+// For user headers, the comp ID represents the committing component.
+
+inline void ErrlUH::setComponentId( compId_t i_compId )
+{
+ iv_header.iv_compId = i_compId;
+}
+
+
+
+
+} // namespace
+
+
+#endif //ERRLUH_H
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H
index 94eb2f33d..8f1c6e382 100644
--- a/src/include/usr/hbotcompid.H
+++ b/src/include/usr/hbotcompid.H
@@ -53,10 +53,20 @@ const char MY_COMP_NAME[] = "myname";
//@}
/** @name ERRL
- * Error Logging component
+ * Error Logging component.
+ *
+ * Oct 2011: Temporarily set ERRL component ID to the
+ * same as FSP ERRL in order to make the FSP x86 errl tool
+ * format Hostboot error logs with traces. For user-defined
+ * trace sections, that tools expects component 0x3100,
+ * section ID 0x0C, and version 1.
+ *
+ * Requirement SW105241 is opened for fips8xx errl tool
+ * to start becoming Hostboot aware. TODO When errl becomes
+ * Hostboot aware, ERRL comp id can revert to 0x0100. Monte
*/
//@{
-const compId_t ERRL_COMP_ID = 0x0100;
+const compId_t ERRL_COMP_ID = 0x3100;
const char ERRL_COMP_NAME[] = "errl";
//@}
diff --git a/src/include/usr/trace/trace.H b/src/include/usr/trace/trace.H
index cb4277603..c5d0a0d2a 100644
--- a/src/include/usr/trace/trace.H
+++ b/src/include/usr/trace/trace.H
@@ -40,6 +40,7 @@
#include <sys/sync.h>
#include <stdarg.h>
+
/******************************************************************************/
// Globals/Constants
/******************************************************************************/
@@ -137,6 +138,9 @@ typedef Singleton<Trace> theTrace;
*/
class Trace
{
+ /* ErrlEntry will call getBuffer() */
+ friend class ErrlEntry;
+
public:
/**
@@ -200,6 +204,31 @@ public:
const uint32_t i_size,
const int32_t i_type);
+
+ /**
+ * @brief Retrieve full trace buffer for component i_comp.
+ *
+ * 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.
+ *
+ * @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
+ *
+ * @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.
+ */
+ uint64_t getBuffer( const char * i_pComp,
+ void * o_data,
+ uint64_t i_bufferSize );
+
+
+
+
protected:
/**
@@ -212,6 +241,10 @@ protected:
*/
~Trace();
+
+
+
+
private:
/**
@@ -248,21 +281,6 @@ private:
const uint32_t i_size);
- /**
- * @brief Retrieve full trace buffer for component i_comp
- *
- * This function assumes memory has already been allocated for
- * the full trace buffer in o_data.
- *
- * @param [in] i_td_ptr Trace descriptor of buffer to retrieve.
- * @param [out] o_data Pre-allocated pointer to where data will be stored.
- *
- * TODO - Not Supported Yet
- *
- * @return Non-zero return code on error
- */
- int32_t getBuffer(const trace_desc_t * i_td_ptr,
- void *o_data);
/**
* @brief Retrieve partial trace buffer for component i_comp
OpenPOWER on IntegriCloud