summaryrefslogtreecommitdiffstats
path: root/src/usr/htmgt/htmgt_poll.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/htmgt/htmgt_poll.C')
-rw-r--r--src/usr/htmgt/htmgt_poll.C170
1 files changed, 98 insertions, 72 deletions
diff --git a/src/usr/htmgt/htmgt_poll.C b/src/usr/htmgt/htmgt_poll.C
index 29ca416cc..6729b652c 100644
--- a/src/usr/htmgt/htmgt_poll.C
+++ b/src/usr/htmgt/htmgt_poll.C
@@ -42,100 +42,126 @@
namespace HTMGT
{
- // Send a poll command to all OCCs
- errlHndl_t sendOccPoll(const bool i_flushAllErrors)
+ errlHndl_t OccManager::_sendOccPoll(const bool i_flushAllErrors,
+ TARGETING::Target * i_occTarget)
{
- errlHndl_t l_err = NULL;
- uint8_t * l_poll_rsp = NULL;
+ errlHndl_t err = NULL;
TMGT_INF("sendOccPoll(flush=%c)", i_flushAllErrors?'y':'n');
- // Loop through all functional OCCs
- std::vector<Occ*> occList = occMgr::instance().getOccArray();
- for (std::vector<Occ*>::iterator itr = occList.begin();
- (itr < occList.end()) && (NULL == l_err);
- ++itr)
+ for(occList_t::const_iterator occ_itr = iv_occArray.begin();
+ (occ_itr != iv_occArray.end()) && (NULL == err);
+ ++occ_itr)
{
- Occ * occ = (*itr);
- const uint8_t occInstance = occ->getInstance();
+ Occ * occ = *occ_itr;
+ if(NULL == i_occTarget || occ->iv_target == i_occTarget)
+ {
+ err = occ->pollForErrors(i_flushAllErrors);
+ }
+ }
+
+ return err;
+ }
+
+
+ errlHndl_t OccManager::sendOccPoll(const bool i_flushAllErrors,
+ TARGETING::Target * i_occTarget)
+ {
+ return
+ Singleton<OccManager>::instance()._sendOccPoll(i_flushAllErrors,
+ i_occTarget);
+ }
+
+
+ errlHndl_t Occ::pollForErrors(const bool i_flushAllErrors)
+ {
+ errlHndl_t err = NULL;
+ uint8_t * poll_rsp = NULL;
- TMGT_INF("sendOccPoll: Polling OCC%d", occInstance);
- bool continuePolling = false;
- size_t elogCount = 10;
- do
+ TMGT_INF("sendOccPoll: Polling OCC%d", iv_instance);
+ bool continuePolling = false;
+ size_t elogCount = 10;
+
+ do
+ {
+ // create 1 byte buffer for poll command data
+ const uint8_t l_cmdData[1] = { 0x10 /*version*/ };
+
+ OccCmd cmd(this,
+ OCC_CMD_POLL,
+ sizeof(l_cmdData),
+ l_cmdData);
+
+ err = cmd.sendOccCmd();
+ if (err != NULL)
{
- // create 1 byte buffer for poll command data
- const uint8_t l_cmdData[1] = { 0x10 /*version*/ };
+ // Poll failed
+ TMGT_ERR("sendOccPoll: OCC%d poll failed with rc=0x%04X",
+ iv_instance,
+ err->reasonCode());
- OccCmd cmd(occ, OCC_CMD_POLL, sizeof(l_cmdData), l_cmdData);
- l_err = cmd.sendOccCmd();
- if (l_err != NULL)
- {
- // Poll failed
- TMGT_ERR("sendOccPoll: OCC%d poll failed with rc=0x%04X",
- occInstance, l_err->reasonCode());
- }
- else
+ continuePolling = false;
+ }
+ else
+ {
+ // Poll succeeded, check response
+ uint32_t poll_rsp_size = cmd.getResponseData(poll_rsp);
+ if (poll_rsp_size >= OCC_POLL_DATA_MIN_SIZE)
{
- // Poll succeeded, check response
- uint32_t l_poll_rsp_size = cmd.getResponseData(l_poll_rsp);
- if (l_poll_rsp_size >= OCC_POLL_DATA_MIN_SIZE)
+ if (i_flushAllErrors)
{
- if (i_flushAllErrors)
+ const occPollRspStruct_t *currentPollRsp =
+ (occPollRspStruct_t *) poll_rsp;
+ if (currentPollRsp->errorId != 0)
{
- const occPollRspStruct_t *currentPollRsp =
- (occPollRspStruct_t *) l_poll_rsp;
- if (currentPollRsp->errorId != 0)
+ if (--elogCount > 0)
{
- if (--elogCount > 0)
- {
- // An error was returned, keep polling OCC
- continuePolling = true;
- }
- else
- {
- // Limit number of elogs retrieved so
- // we do not get stuck in loop
- TMGT_INF("sendOccPoll: OCC%d still has"
- "more errors to report.",
- occInstance);
- continuePolling = false;
- }
+ // An error was returned, keep polling OCC
+ continuePolling = true;
}
else
{
+ // Limit number of elogs retrieved so
+ // we do not get stuck in loop
+ TMGT_INF("sendOccPoll: OCC%d still has"
+ "more errors to report.",
+ iv_instance);
continuePolling = false;
}
}
- occ->pollRspHandler(l_poll_rsp, l_poll_rsp_size);
- }
- else
- {
- TMGT_ERR("sendOccPoll: OCC%d poll command response "
- "failed with invalid data length %d",
- occInstance, l_poll_rsp_size);
- /*@
- * @errortype
- * @reasoncode HTMGT_RC_INVALID_LENGTH
- * @moduleid HTMGT_MOD_OCC_POLL
- * @userdata1 OCC instance
- * @devdesc Invalid POLL response length
- */
- bldErrLog(l_err, HTMGT_MOD_OCC_POLL,
- HTMGT_RC_INVALID_LENGTH,
- occInstance, 0, 0, 0,
- ERRORLOG::ERRL_SEV_INFORMATIONAL);
+ else
+ {
+ continuePolling = false;
+ }
}
+ pollRspHandler(poll_rsp, poll_rsp_size);
}
- }
- while (continuePolling);
-
- } // for each OCC
-
- return l_err;
+ else
+ {
+ TMGT_ERR("sendOccPoll: OCC%d poll command response "
+ "failed with invalid data length %d",
+ iv_instance, poll_rsp_size);
+ /*@
+ * @errortype
+ * @reasoncode HTMGT_RC_INVALID_LENGTH
+ * @moduleid HTMGT_MOD_OCC_POLL
+ * @userdata1 OCC instance
+ * @devdesc Invalid POLL response length
+ */
+ bldErrLog(err,
+ HTMGT_MOD_OCC_POLL,
+ HTMGT_RC_INVALID_LENGTH,
+ iv_instance, 0, 0, 0,
+ ERRORLOG::ERRL_SEV_INFORMATIONAL);
- } // end sendOccPoll()
+ continuePolling = false;
+ }
+ }
+ }
+ while (continuePolling);
+ return err;
+ }
// Handle OCC poll response
OpenPOWER on IntegriCloud