summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/usr/hwas/common/deconfigGard.H12
-rw-r--r--src/usr/hwas/common/deconfigGard.C58
-rw-r--r--src/usr/hwas/hwasPlat.C52
3 files changed, 53 insertions, 69 deletions
diff --git a/src/include/usr/hwas/common/deconfigGard.H b/src/include/usr/hwas/common/deconfigGard.H
index e359f1c06..7e2716308 100644
--- a/src/include/usr/hwas/common/deconfigGard.H
+++ b/src/include/usr/hwas/common/deconfigGard.H
@@ -487,11 +487,9 @@ public:
* @brief Constructor.
* PLATFORM must implement this function
*
- * @param[in] o_gardEnabled boolean returned:
- * true - reading/writing of gard records is enabled;
- * false - not enabled
+ * @param[in] o_errl errlHndl_t set if there was an error
*/
- GardAddress(bool &o_gardEnabled);
+ GardAddress(errlHndl_t &o_errl);
/**
* @brief Destructor.
@@ -500,6 +498,12 @@ public:
~GardAddress();
/**
+ * @brief flush. flush all of the waiting addresses out
+ *
+ */
+ void flush();
+
+ /**
* @brief writeRecord. Add the indicated address to a vector, so
* that the destructor knows which GARD records were updated.
*
diff --git a/src/usr/hwas/common/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C
index 539fc1e61..01e736129 100644
--- a/src/usr/hwas/common/deconfigGard.C
+++ b/src/usr/hwas/common/deconfigGard.C
@@ -125,6 +125,13 @@ errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
HWAS_MUTEX_LOCK(iv_mutex);
do
{
+ GardAddress l_GardAddress(l_pErr);
+ if (l_pErr)
+ {
+ HWAS_ERR("Error from l_GardAddress");
+ break;
+ }
+
// For each GARD Record
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
@@ -155,27 +162,13 @@ errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
continue;
}
-{
- // TODO: RTC: 70468 add flush method to GardAddress; move this to outside
- // for loop scope, and add flush after the writeRecord below.
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (!l_gardEnabled)
- {
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
- HWAS_ERR("Error from l_GardAddress");
- break;
- }
-
// Clear the gard record
HWAS_INF("clearing GARD for %.8X, recordId %d",
TARGETING::get_huid(l_pTarget),
iv_pGardRecords[i].iv_recordId);
iv_pGardRecords[i].iv_recordId = EMPTY_GARD_RECORDID;
l_GardAddress.writeRecord(&iv_pGardRecords[i]);
- // for now, this will force a flush to PNOR
-}
+ l_GardAddress.flush();
// now clear our 'changed' bit
TARGETING::clear_hwas_changed_bit(
@@ -686,12 +679,9 @@ errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target,
break;
}
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (!l_gardEnabled)
+ GardAddress l_GardAddress(l_pErr);
+ if (l_pErr)
{
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
HWAS_ERR("Error from l_GardAddress");
break;
}
@@ -752,10 +742,8 @@ errlHndl_t DeconfigGard::_clearGardRecords(const uint32_t i_recordId)
{
errlHndl_t l_pErr = NULL;
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (l_gardEnabled)
+ GardAddress l_GardAddress(l_pErr);
+ if (!l_pErr)
{
if (i_recordId == CLEAR_ALL_GARD_RECORDS)
{
@@ -795,7 +783,6 @@ errlHndl_t DeconfigGard::_clearGardRecords(const uint32_t i_recordId)
}
else
{
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
HWAS_ERR("Error from l_GardAddress");
}
@@ -808,10 +795,8 @@ errlHndl_t DeconfigGard::_clearGardRecords(
{
errlHndl_t l_pErr = NULL;
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (l_gardEnabled)
+ GardAddress l_GardAddress(l_pErr);
+ if (!l_pErr)
{
bool l_gardRecordsCleared = false;
@@ -836,7 +821,6 @@ errlHndl_t DeconfigGard::_clearGardRecords(
}
else
{
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
HWAS_ERR("Error from l_GardAddress");
}
@@ -850,10 +834,8 @@ errlHndl_t DeconfigGard::_getGardRecords(const uint32_t i_recordId,
errlHndl_t l_pErr = NULL;
o_records.clear();
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (l_gardEnabled)
+ GardAddress l_GardAddress(l_pErr);
+ if (!l_pErr)
{
if (i_recordId == GET_ALL_GARD_RECORDS)
{
@@ -884,7 +866,6 @@ errlHndl_t DeconfigGard::_getGardRecords(const uint32_t i_recordId,
}
else
{
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
HWAS_ERR("Error from l_GardAddress");
}
@@ -899,10 +880,8 @@ errlHndl_t DeconfigGard::_getGardRecords(
errlHndl_t l_pErr = NULL;
o_records.clear();
- bool l_gardEnabled = false;
- GardAddress l_GardAddress(l_gardEnabled);
-
- if (l_gardEnabled)
+ GardAddress l_GardAddress(l_pErr);
+ if (!l_pErr)
{
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
@@ -922,7 +901,6 @@ errlHndl_t DeconfigGard::_getGardRecords(
}
else
{
- // TODO: RTC: 70468 return errlHndl_t returned from GardAdress
HWAS_ERR("Error from l_GardAddress");
}
diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C
index 8ffa7ada2..2371fca68 100644
--- a/src/usr/hwas/hwasPlat.C
+++ b/src/usr/hwas/hwasPlat.C
@@ -355,54 +355,50 @@ errlHndl_t hwasChangeDetection()
} // hwasChangeDetection
-GardAddress::GardAddress(bool &o_gardEnabled)
+GardAddress::GardAddress(errlHndl_t &o_errl)
{
DeconfigGard::GardRecord *l_addr = HWAS::theDeconfigGard().iv_pGardRecords;
HWAS_INF("GardAddress ctor: iv_pGardRecords %p", l_addr);
- o_gardEnabled = true;
- // if this is the first time thru here, get the PNOR address.
- if (l_addr == NULL)
+ do
{
- PNOR::SectionInfo_t l_section;
- errlHndl_t errl;
- errl = PNOR::getSectionInfo(PNOR::GUARD_DATA, PNOR::CURRENT_SIDE,
- l_section);
- if (errl)
+ // if this is the first time thru here, get the PNOR address.
+ if (l_addr == NULL)
{
- HWAS_ERR("PNOR::getSectionInfo failed!!!");
- // no support for GARD in this configuration.
- // Commit the log as unrecoverable and keep going.
- errlCommit(errl, HWAS_COMP_ID);
- // errl is now NULL
+ PNOR::SectionInfo_t l_section;
+ o_errl = PNOR::getSectionInfo(PNOR::GUARD_DATA, PNOR::CURRENT_SIDE,
+ l_section);
+ if (o_errl)
+ {
+ HWAS_ERR("PNOR::getSectionInfo failed!!!");
+ // no support for GARD in this configuration.
+ break;
+ }
- // set flag so that we don't continue to try to write GARD records
- o_gardEnabled = false;
- }
- else
- {
l_addr = reinterpret_cast<DeconfigGard::GardRecord *>
(l_section.vaddr);
- HWAS_DBG("PNOR vaddr=%p size=%d", l_section.vaddr, l_section.size);
+ HWAS_DBG("PNOR vaddr=%p size=%d",
+ l_section.vaddr, l_section.size);
// tell the DeconfigGard what the address
HWAS::theDeconfigGard().iv_pGardRecords = l_addr;
// and let him compute and save maxRecords and nextRecordId
HWAS::theDeconfigGard()._GardRecordIdSetup(l_section.size);
- }
- HWAS_INF("GardAddress iv_pGardRecords=%p", l_addr);
+ HWAS_INF("GardAddress iv_pGardRecords=%p", l_addr);
+ }
}
+ while (0);
}
-GardAddress::~GardAddress()
+void GardAddress::flush()
{
// flush PNOR iff we wrote
- if (iv_addr.size() > 0)
+ if (!iv_addr.empty())
{
- for (std::vector<void *>::iterator iter = iv_addr.begin();
+ for (std::vector<void *>::const_iterator iter = iv_addr.begin();
iter != iv_addr.end();
++iter)
{
@@ -421,4 +417,10 @@ GardAddress::~GardAddress()
}
}
+
+GardAddress::~GardAddress()
+{
+ flush();
+}
+
} // namespace HWAS
OpenPOWER on IntegriCloud