summaryrefslogtreecommitdiffstats
path: root/src/usr/hwas
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-06-03 11:21:14 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-06-14 12:25:56 -0500
commit33b1a33cc09e61d8c3cb74d7d18bcb228104478c (patch)
tree12be099c2f79f0549f291df58278dc29e2c3e0a2 /src/usr/hwas
parentf81f1657baae2f31045aa75cfb8917908d0f89cf (diff)
downloadtalos-hostboot-33b1a33cc09e61d8c3cb74d7d18bcb228104478c.tar.gz
talos-hostboot-33b1a33cc09e61d8c3cb74d7d18bcb228104478c.zip
re-work interface on gardAddress object to better handle errors.
. pass error handle in and out instead of extra boolean flag; . add flush() method to handle intermediate flush operations; Change-Id: I9622ce5504eeb63b21531ccb9ec08291ca091b5a RTC: 70468 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4847 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwas')
-rw-r--r--src/usr/hwas/common/deconfigGard.C58
-rw-r--r--src/usr/hwas/hwasPlat.C52
2 files changed, 45 insertions, 65 deletions
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