summaryrefslogtreecommitdiffstats
path: root/src/include/usr/errl
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-10-25 14:52:43 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-11-14 17:10:27 -0600
commit931ed57963b8f63c67dc45144c2bb65b3f014a56 (patch)
treead8cb470618236b50a201cb1995ec66d9a2a2d9c /src/include/usr/errl
parent7c353ef9c158531352888b47264ace19675b95f8 (diff)
downloadblackbird-hostboot-931ed57963b8f63c67dc45144c2bb65b3f014a56.tar.gz
blackbird-hostboot-931ed57963b8f63c67dc45144c2bb65b3f014a56.zip
store error logs in PNOR
. store error logs in PNOR, truncating to 4K . set and clear ACKnowledge bit as appropriate . move PNOR and MBOX init code in errlmanager until after PNOR and MBOX services are actually up and running Change-Id: I57c5bacae8ffd283577164a0706c081a8ef5af30 RTC: 47517 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6884 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr/errl')
-rw-r--r--src/include/usr/errl/errlentry.H22
-rw-r--r--src/include/usr/errl/errlmanager.H169
-rw-r--r--src/include/usr/errl/errlprvt.H5
-rw-r--r--src/include/usr/errl/errlsrc.H11
4 files changed, 176 insertions, 31 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H
index 6e67bf55c..d00c9c54a 100644
--- a/src/include/usr/errl/errlentry.H
+++ b/src/include/usr/errl/errlentry.H
@@ -604,18 +604,32 @@ private:
/**
+ * @brief sort compare function, to be used when flattening an
+ * error log
+ *
+ * @param[in] i_ud1 - first user-defined section to compare
+ * @param[in] i_ud2 - second user-defined section to compare
+ *
+ * @return true if i_ud1 should be first, false otherwise
+ */
+ static bool udSort(ErrlUD *i_ud1, ErrlUD *i_ud2);
+
+ /**
* @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,out] o_buffer Points to data block to be filled
- * @param[in] i_cbBuffer Count of bytes in buffer supplied
+ * @param[in] i_cbBuffer Count of bytes in buffer supplied
+ * @param[in] i_truncate true: truncate the data
+ * false: error if buffer too small
+ * NOTE: PH, UH and PS MUST fit
*
* @return Count of bytes copied to caller's
- * buffer or else zero if it does not fit.
+ * buffer or else zero if it does not fit and i_truncate==false.
*/
- uint64_t flatten( void * o_buffer, const uint64_t i_cbBuffer );
-
+ uint64_t flatten( void * o_buffer, const uint64_t i_cbBuffer,
+ const bool i_truncate = false);
/**
* @brief Called by commit(), this fucntion creates a
diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H
index ef51fc659..2d3a21edd 100644
--- a/src/include/usr/errl/errlmanager.H
+++ b/src/include/usr/errl/errlmanager.H
@@ -66,6 +66,16 @@ namespace ERRORLOG
*/
void errlCommit(errlHndl_t& io_err, compId_t i_committerComp );
+/**
+ * @brief Global enums used by static errlResourceReady function
+ */
+enum errlManagerNeeds
+{
+ PNOR,
+ TARG,
+ MBOX,
+} ;
+
/*****************************************************************************/
// Forward class declarations
@@ -125,6 +135,25 @@ public:
*/
static void setHwasProcessCalloutFn(HWAS::processCalloutFn i_fn);
+ /**
+ * @brief Sends msg to errlmanager telling what resources are ready
+ *
+ * This is called by resources that the ErrlManager needs, which start up
+ * AFTER ErrlManager starts. Currently, that's PNOR MBOX and TARGeting.
+ *
+ * It is a static function because a module cannot call an interface on a
+ * singleton in another module
+ */
+ static void errlResourceReady(errlManagerNeeds i_needs);
+
+ /**
+ * @brief Sends msg to errlmanager telling what resources are ready
+ *
+ * This is called by resources that the ErrlManager needs, which start up
+ * AFTER ErrlManager starts. Currently, that's PNOR MBOX and TARGeting.
+ *
+ */
+ void sendResourcesMsg(errlManagerNeeds i_needs);
/**
* @brief Returns the HWAS ProcessCallout function pointer
@@ -169,10 +198,13 @@ private:
*/
enum ERRLOG_MSG_TYPE
{
- ERRLOG_NEEDS_TO_BE_COMMITTED_TYPE = 0x00000030 | MBOX::FIRST_SECURE_MSG,
- ERRLOG_SEND_TO_FSP_TYPE = 0x00000031 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_NEEDS_TO_BE_COMMITTED_TYPE = 0x00000030 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_SEND_TO_FSP_TYPE = 0x00000031 | MBOX::FIRST_SECURE_MSG,
ERRLOG_COMMITTED_ACK_RESPONSE_TYPE = 0x00000032 | MBOX::FIRST_UNSECURE_MSG,
- ERRLOG_SHUTDOWN = 0x00000033 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_SHUTDOWN_TYPE = 0x00000033 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_ACCESS_PNOR_TYPE = 0x00000034 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_ACCESS_MBOX_TYPE = 0x00000035 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_ACCESS_TARG_TYPE = 0x00000036 | MBOX::FIRST_SECURE_MSG,
};
/**
@@ -187,8 +219,10 @@ private:
enum ERRORLOG_PLID_OFFSET
{
ERRLOG_PLID_BASE = 0x90000000,// Hostboot Base PLID Offset
+ ERRLOG_PLID_BASE_MASK = 0x9F000000,// mask of just the id
ERRLOG_PLID_NODE_SHIFT = 24, // shift to put node number 0x9#
ERRLOG_PLID_MASK = 0x00FFFFFF,// mask to find log number
+ ERRLOG_PLID_INITIAL = 0x00FF0000,// initial big id number
};
/**
@@ -198,19 +232,28 @@ private:
ErrlManager& operator=(const ErrlManager& i_right);
/**
- * @brief Create and register the error log message queue
+ * @brief Access PNOR and get the address and size of the HBEL section in
+ * PNOR; sets the iv_pnorAddr, iv_maxErrlInPnor, iv_pnorOpenSlot variables;
+ * parsers the error logs in PNOR and determines the new iv_currLogId.
*
* @param[in/out] NONE
* @return NONE.
*/
- void msgQueueInit ( void );
+ void setupPnorInfo();
+ /**
+ * @brief Create and register the error log message queue
+ *
+ * @param[in/out] NONE
+ * @return NONE.
+ */
+ void msgQueueInit ();
/**
* @brief Performs startup of the error log processing thread.
*
- * @param[in/out]
- * @return NONE
+ * @param[in/out]
+ * @return NONE
*/
static void * startup ( void* i_self );
@@ -219,19 +262,19 @@ private:
* and send it to FSP.
*
* @param[in/out] NONE
- * @return NONE
+ * @return NONE
*
*/
- void errlogMsgHndlr ( void );
+ void errlogMsgHndlr ();
/**
- * @brief Send Host boot error log to error message queue for committing.
+ * @brief Send Host boot error log to error message queue for committing.
*
* @param[in,out] io_err Error log handle to be committed
* @param[in] i_committerComp Component id that committed the error
*
- * @return NONE
- *
+ * @return NONE
+ *
*/
void sendErrlogToMessageQueue ( errlHndl_t& io_err, compId_t i_committerComp );
@@ -239,6 +282,16 @@ private:
* @brief Create a mailbox message with the error log and send it to Fsp.
*
* @param[in,out] io_err Error log handle to be committed
+ * @return msg_t pointer - NULL if msg sent, allocated msg if
+ * couldn't send
+ *
+ */
+ msg_t *sendErrLogToMbox ( errlHndl_t& io_err );
+
+ /**
+ * @brief Create a mailbox message with the error log and send it to Fsp.
+ *
+ * @param[in,out] io_err Error log handle to be committed
* @return NONE
*
*/
@@ -247,20 +300,20 @@ private:
/**
* @brief Save errlog entry in the memory
*
- * @param[in,out] io_err Error log handle to be committed
- * @return NULL
+ * @param[in,out] io_err Error log handle to be committed
+ * @return NULL
*
*/
void saveErrLogEntry( errlHndl_t& io_err );
/**
- * @brief Shutdown error log manager
+ * @brief Shutdown error log manager
*
- * @param[in,out] None
+ * @param[in,out] None
* @return NULL
*
*/
- void errlogShutdown( void );
+ void errlogShutdown();
/**
* @brief Current log ID. As new error logs are created,
@@ -287,6 +340,88 @@ private:
*/
msg_q_t iv_msgQ;
+ // functions relating to writing the errorlogs to PNOR
+
+ /**
+ * @brief flatten and save the error log into PNOR
+ *
+ * @param[in] error log handle
+ * @return true if saved in PNOR, false if not
+ *
+ */
+ bool saveErrLogToPnor( errlHndl_t& io_err);
+
+ /**
+ * @brief find the flattened error log in PNOR and set it's ACK bit
+ *
+ * @param[in] i_errEid EID of the error log to look for
+ * @return NONE
+ *
+ */
+ void ackErrLogInPnor( uint32_t i_errEid );
+
+ /**
+ * @brief check the state of the PNOR 'slot'
+ *
+ * @param[in] i_position - index into PNOR to check
+ * @return true if slot is empty
+ * (first 32bits == EMPTY_ERRLOG_IN_PNOR)
+ *
+ */
+ bool isSlotEmpty(uint32_t i_position);
+
+ /**
+ * @brief check the state of the PNOR 'slot'
+ * ONLY to be called on a slot that is NOT empty
+ *
+ * @param[in] i_position - index into PNOR to check
+ * @return true if errlog in this slot has been ACKed
+ * (ACK bit in word5 is 0x0)
+ *
+ */
+ bool isSlotACKed(uint32_t i_position);
+
+ /**
+ * @brief increment the iv_PnorOpenSlot variable to the next
+ * available slot, handling wrap and checking that the
+ * slot is either EMPTY or has an ACKed error log.
+ *
+ * @return true if there was an open slot, false if PNOR is full
+ *
+ */
+ bool incrementPnorOpenSlot();
+
+ /**
+ * @brief read the Eid from the flattened error log in PNOR;
+ * MUST point to a non-empty slot
+ *
+ * @param[in] i_position - index into PNOR to check
+ * @return eid for that error log
+ *
+ */
+ uint32_t readEidFromFlattened(uint32_t i_position);
+
+ /**
+ * @brief set the ACK bit in the flattened error log in PNOR;
+ * MUST point to a non-empty slot
+ *
+ * @param[in] i_position - index into PNOR to check
+ * @return NONE
+ *
+ */
+ void setACKInFlattened(uint32_t i_position);
+
+ /**
+ * @brief errorlog-into-PNOR variables
+ */
+ char *iv_pnorAddr; // HBEL section in PNOR
+ uint32_t iv_maxErrlInPnor; // max number of errorlogs that will fit
+ uint32_t iv_pnorOpenSlot; // current open slot available for an errorlog
+ std::list<errlHndl_t> iv_errlToSave; // errlogs still to be saved to PNOR
+
+ bool iv_isSpBaseServices; // do we need to send to FSP
+ bool iv_isMboxEnabled; // are we able to send to FSP
+ std::list<msg_t *> iv_errlToSend; // msgs still to be sent to FSP
};
} // End namespace
diff --git a/src/include/usr/errl/errlprvt.H b/src/include/usr/errl/errlprvt.H
index fbdf82588..1f4e1e401 100644
--- a/src/include/usr/errl/errlprvt.H
+++ b/src/include/usr/errl/errlprvt.H
@@ -53,7 +53,6 @@ private:
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[]
};
/**
@@ -119,10 +118,6 @@ private:
uint8_t iv_sctns; // count of sections
uint32_t iv_plid; // platform log id
uint32_t iv_eid; // Error Log ID
-
- // uint8_t iv_cssver[CSS_VER]; // TODO unused now, do we need this?
-
-
};
diff --git a/src/include/usr/errl/errlsrc.H b/src/include/usr/errl/errlsrc.H
index 89fa9cbef..b6a98b519 100644
--- a/src/include/usr/errl/errlsrc.H
+++ b/src/include/usr/errl/errlsrc.H
@@ -46,6 +46,7 @@ class ErrlSrc : public ErrlSctn
// you would expect to be part of ErrlEntry are actually instance data
// in this class.
friend class ErrlEntry;
+ friend class ErrlManager;
private:
@@ -57,8 +58,10 @@ private:
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[]
+ WORDCOUNT = 9, // SRC word count
+ DECONFIG_BIT = 0x02000000, // deconfig bit (6) in word 5
+ GARD_BIT = 0x01000000, // gard bit (7) in word 5
+ ACK_BIT = 0x00200000, // ack bit (10) in word 5
};
@@ -145,7 +148,7 @@ private:
* @note return value is only valid if input is valid hex digit
* '0'-'9', 'A'-'F', 'a'='f'
*/
- uint64_t aschex2bin(char c);
+ uint64_t aschex2bin(char c) const;
// Instance data
srcType_t iv_srcType : 8; // SRC type, the ?? in SRC ??xxxxxx
@@ -156,8 +159,6 @@ private:
uint64_t iv_user2; // user data 2
bool iv_deconfig; // true if there is a deconfigure callout
bool iv_gard; // true if there is a gard callout
-
-
};
OpenPOWER on IntegriCloud