diff options
author | Thi Tran <thi@us.ibm.com> | 2011-05-12 12:51:31 -0500 |
---|---|---|
committer | Andrew J. Geissler <andrewg@us.ibm.com> | 2011-05-24 10:08:00 -0500 |
commit | ed023e4eb60989a43b1e1e672dd77d84d3a543b3 (patch) | |
tree | 9e109d40d46fdc7f67e62817e851bee678e64b5e /src/usr/errl/errlmanager.C | |
parent | 50e70ce9facb233be4158569c11dc8b64d4297b2 (diff) | |
download | talos-hostboot-ed023e4eb60989a43b1e1e672dd77d84d3a543b3.tar.gz talos-hostboot-ed023e4eb60989a43b1e1e672dd77d84d3a543b3.zip |
Initial Error Log code delivery
Merge src/usr/makefile conflict
Update after first review
Update after 2nd review. Add error creation example
Update example with review comments
Re-arrange parameters' order of error log constructor
Update with additional comments from Patrick
Change-Id: I18001f6232492a3acfd8819b34ef670a785ac483
Reviewed-on: http://gfwr801.rchland.ibm.com:8080/gerrit/72
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'src/usr/errl/errlmanager.C')
-rw-r--r-- | src/usr/errl/errlmanager.C | 74 |
1 files changed, 74 insertions, 0 deletions
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 |