summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-11-17 12:40:13 -0600
committerMIKE J. JONES <mjjones@us.ibm.com>2011-11-22 13:06:40 -0600
commitd4c1403e772f0f8364d34bca3da8dbca5e9b7f08 (patch)
tree0f396ec22cb4e5381093ad8168ec313fcb11eb9c /src/usr
parentec713997f4b43ebfbea50c37330198208cf5a471 (diff)
downloadtalos-hostboot-d4c1403e772f0f8364d34bca3da8dbca5e9b7f08.tar.gz
talos-hostboot-d4c1403e772f0f8364d34bca3da8dbca5e9b7f08.zip
HWAS: Deconfigure Targets with GARD Records
Change-Id: I4131019c1f14d5038ace45c7e692994f135348ac Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/501 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/hwas/deconfigGard.C99
-rw-r--r--src/usr/hwas/hwas.C23
-rw-r--r--src/usr/hwas/test/hwasGardTest.H99
3 files changed, 119 insertions, 102 deletions
diff --git a/src/usr/hwas/deconfigGard.C b/src/usr/hwas/deconfigGard.C
index 84f6fc5a2..0e2390051 100644
--- a/src/usr/hwas/deconfigGard.C
+++ b/src/usr/hwas/deconfigGard.C
@@ -37,14 +37,20 @@
trace_desc_t* g_trac_deconf = NULL;
#define __COMP_TD__ g_trac_deconf
-// The DeconfigGard code needs to trace a target. The current recommended way is
-// to get the Target's PHYS_PATH attribute and do a binary trace. However, the
-// size of a TARGETING::EntityPath is 17 bytes. This code will trace only the
-// first 16 bytes to avoid a multi-line binary trace. This all seems a little
-// convoluted. Is there a better way to trace a Target
+// TODO The DeconfigGard code needs to trace a target. The current recommended
+// way is to get the Target's PHYS_PATH attribute and do a binary trace.
+// However, the size of a TARGETING::EntityPath is more than 16 bytes. This code
+// will trace only the first 16 bytes (which in most cases is enough) to avoid a
+// multi-line binary trace. This all seems a little convoluted. Is there a
+// better way to trace a Target
#define DG_TRAC_TARGET(string, pPath) \
TRACFBIN(g_trac_deconf, string, pPath, sizeof(TARGETING::EntityPath) - 1)
+// TODO There are a number of error logs created in this file. Most of them
+// should include the target identifier (PHYS_PATH). There is a plan in RTC
+// story 4110 to provide a way to easily add a target to an error log. When that
+// is done need to update the error logs
+
namespace HWAS
{
@@ -88,11 +94,63 @@ errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
//******************************************************************************
errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
{
- TRAC_INF("****TBD****Usr Request: Deconfigure Targets from GARD Records for IPL");
+ TRAC_INF("Usr Request: Deconfigure Targets from GARD Records for IPL");
mutex_lock(&iv_mutex);
errlHndl_t l_pErr = NULL;
+ GardRecords_t l_gardRecords;
- // TODO
+ // TODO If deconfiguring all Targets with a GARD Record will result in a
+ // configuration that cannot IPL then need to figure out which
+ // subset of Targets to deconfigure to give the best chance of IPL
+ // This is known as Resource Recovery
+
+ // Get all GARD Records
+ l_pErr = _getGardRecords(0, l_gardRecords);
+
+ if (l_pErr)
+ {
+ TRAC_ERR("Error from _getGardRecords");
+ }
+ else
+ {
+ TRAC_INF("%d GARD Records found", l_gardRecords.size());
+
+ // For each GARD Record
+ for (GardRecordsCItr_t l_itr = l_gardRecords.begin();
+ l_itr != l_gardRecords.end(); ++l_itr)
+ {
+ // Find the associated Target
+ TARGETING::Target * l_pTarget =
+ TARGETING::targetService().toTarget((*l_itr).iv_targetId);
+
+ if (l_pTarget == NULL)
+ {
+ DG_TRAC_TARGET(ERR_MRK "Could not find Target for",
+ &((*l_itr).iv_targetId));
+
+ /*@
+ * @errortype
+ * @moduleid MOD_DECONFIG_GARD
+ * @reasoncode RC_TARGET_NOT_FOUND_FOR_GARD_RECORD
+ * @devdesc GARD Record could not be mapped to a Target
+ */
+ l_pErr = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ MOD_DECONFIG_GARD,
+ RC_TARGET_NOT_FOUND_FOR_GARD_RECORD);
+ errlCommit(l_pErr, HWAS_COMP_ID);
+ }
+ else
+ {
+ // Deconfigure the Target
+ _deconfigureTarget(*l_pTarget, (*l_itr).iv_errlogPlid,
+ DECONFIG_CAUSE_GARD_RECORD);
+
+ // Deconfigure other Targets by association
+ _deconfigureByAssoc(*l_pTarget, (*l_itr).iv_errlogPlid);
+ }
+ }
+ }
mutex_unlock(&iv_mutex);
return l_pErr;
@@ -100,19 +158,16 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
//******************************************************************************
errlHndl_t DeconfigGard::deconfigureTarget(TARGETING::Target & i_target,
- errlHndl_t i_pErr)
+ const uint32_t i_errlPlid)
{
TRAC_ERR("Usr Request: Deconfigure Target");
mutex_lock(&iv_mutex);
-
- // Caller must pass a valid errlHndl_t
- assert(i_pErr != NULL);
// Deconfigure the Target
- _deconfigureTarget(i_target, i_pErr, DECONFIG_CAUSE_FIRMWARE_REQ);
+ _deconfigureTarget(i_target, i_errlPlid, DECONFIG_CAUSE_FIRMWARE_REQ);
// Deconfigure other Targets by association
- _deconfigureByAssoc(i_target, i_pErr);
+ _deconfigureByAssoc(i_target, i_errlPlid);
mutex_unlock(&iv_mutex);
return NULL;
@@ -120,12 +175,12 @@ errlHndl_t DeconfigGard::deconfigureTarget(TARGETING::Target & i_target,
//******************************************************************************
errlHndl_t DeconfigGard::createGardRecord(const TARGETING::Target & i_target,
- errlHndl_t i_pErr,
+ const uint32_t i_errlPlid,
const GardSeverity i_severity)
{
TRAC_ERR("Usr Request: Create GARD Record");
mutex_lock(&iv_mutex);
- errlHndl_t l_pErr = _createGardRecord(i_target, i_pErr, i_severity);
+ errlHndl_t l_pErr = _createGardRecord(i_target, i_errlPlid, i_severity);
mutex_unlock(&iv_mutex);
return l_pErr;
}
@@ -190,7 +245,7 @@ errlHndl_t DeconfigGard::getGardRecords(
//******************************************************************************
void DeconfigGard::_deconfigureByAssoc(TARGETING::Target & i_target,
- errlHndl_t i_pErr)
+ const uint32_t i_errlPlid)
{
TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>();
DG_TRAC_TARGET(ERR_MRK "****TBD****: Deconfiguring by Association for: ",
@@ -201,7 +256,7 @@ void DeconfigGard::_deconfigureByAssoc(TARGETING::Target & i_target,
//******************************************************************************
void DeconfigGard::_deconfigureTarget(TARGETING::Target & i_target,
- errlHndl_t i_pErr,
+ const uint32_t i_errlPlid,
const DeconfigCause i_cause)
{
TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>();
@@ -248,7 +303,7 @@ void DeconfigGard::_deconfigureTarget(TARGETING::Target & i_target,
_doDeconfigureActions(i_target);
// Create a Deconfigure Record
- _createDeconfigureRecord(i_target, i_pErr, i_cause);
+ _createDeconfigureRecord(i_target, i_errlPlid, i_cause);
}
}
@@ -261,7 +316,7 @@ void DeconfigGard::_doDeconfigureActions(TARGETING::Target & i_target)
//******************************************************************************
void DeconfigGard::_createDeconfigureRecord(
const TARGETING::Target & i_target,
- errlHndl_t i_pErr,
+ const uint32_t i_errlPlid,
const DeconfigCause i_cause)
{
// Get the Target's ID
@@ -289,7 +344,7 @@ void DeconfigGard::_createDeconfigureRecord(
DeconfigureRecord l_record;
l_record.iv_targetId = l_id;
- l_record.iv_errlogPlid = 0; // TODO Get PLID from ErrorLog
+ l_record.iv_errlogPlid = i_errlPlid;
l_record.iv_cause = i_cause;
l_record.iv_padding[0] = 0;
l_record.iv_padding[1] = 0;
@@ -380,7 +435,7 @@ void DeconfigGard::_getDeconfigureRecords(
//******************************************************************************
errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target,
- errlHndl_t i_pErr,
+ const uint32_t i_errlPlid,
const GardSeverity i_severity)
{
errlHndl_t l_pErr = NULL;
@@ -447,7 +502,7 @@ errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target,
l_pRecord->iv_recordId = iv_nextGardRecordId++;
l_pRecord->iv_targetId = l_id;
// TODO Setup iv_cardMruSn or iv_chipMruEcid
- l_pRecord->iv_errlogPlid = 0; // TODO Get PLID from ErrorLog
+ l_pRecord->iv_errlogPlid = i_errlPlid;
l_pRecord->iv_severity = i_severity;
l_pRecord->iv_padding[0] = 0;
l_pRecord->iv_padding[1] = 0;
diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C
index 0d0883ed7..b9e816d92 100644
--- a/src/usr/hwas/hwas.C
+++ b/src/usr/hwas/hwas.C
@@ -42,7 +42,7 @@
#include <targeting/targetservice.H>
#include <fsi/fsiif.H>
#include <hwas/hwas.H>
-
+#include <hwas/deconfigGard.H>
namespace HWAS
{
@@ -162,6 +162,27 @@ void apply_gard( void *io_pArgs )
TRACDCOMP( g_trac_hwas, "apply_gard entry" );
+ errlHndl_t l_errl = theDeconfigGard().clearGardRecordsForReplacedTargets();
+
+ if (l_errl)
+ {
+ TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to clear GARD Records for replaced Targets");
+ pTaskArgs->postErrorLog(l_errl);
+ }
+ else
+ {
+ l_errl = theDeconfigGard().deconfigureTargetsFromGardRecordsForIpl();
+
+ if (l_errl)
+ {
+ TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to deconfigure Targets from GARD Records for IPL");
+ pTaskArgs->postErrorLog(l_errl);
+ }
+ else
+ {
+ TRACFCOMP(g_trac_hwas, "apply_gard completed successfully");
+ }
+ }
// wait here on the barrier, then end the task.
pTaskArgs->waitChildSync();
diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H
index d863072b3..4a73dc7ec 100644
--- a/src/usr/hwas/test/hwasGardTest.H
+++ b/src/usr/hwas/test/hwasGardTest.H
@@ -126,13 +126,6 @@ public:
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // Create an error log to pass to the deconfigureTarget function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
-
do
{
// Get any existing Deconfigure Record for the chip
@@ -155,9 +148,8 @@ public:
TARGETING::HwasState l_origState =
l_pTarget->getAttr<TARGETING::ATTR_HWAS_STATE>();
- // Deconfigure the chip
- l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget,
- l_pNewErr);
+ // Deconfigure the chip. Production code will pass a valid PLID
+ l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0);
if (l_pErr)
{
@@ -221,9 +213,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
@@ -246,13 +235,6 @@ public:
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // Create an error log to pass to the deconfigureTarget function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
-
do
{
// Get any existing Deconfigure Record for the chip
@@ -275,9 +257,8 @@ public:
TARGETING::HwasState l_origState =
l_pTarget->getAttr<TARGETING::ATTR_HWAS_STATE>();
- // Deconfigure the chip
- l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget,
- l_pNewErr);
+ // Deconfigure the chip. Production code will pass a valid PLID
+ l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0);
if (l_pErr)
{
@@ -286,8 +267,7 @@ public:
}
// Deconfigure the chip again
- l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget,
- l_pNewErr);
+ l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0);
if (l_pErr)
{
@@ -333,9 +313,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
@@ -446,13 +423,6 @@ public:
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // Create an error log to pass to the createGardRecord function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
-
do
{
// Get any existing GARD Records for the chip
@@ -471,9 +441,10 @@ public:
break;
}
- // Create a GARD Record for the chip
+ // Create a GARD Record for the chip. Production code will pass a
+ // valid PLID
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE);
if (l_pErr)
@@ -537,9 +508,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
@@ -562,13 +530,6 @@ public:
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // Create an error log to pass to the createGardRecord function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
-
do
{
// Get any existing GARD Records for the chip
@@ -587,9 +548,10 @@ public:
break;
}
- // Create a GARD Record for the chip
+ // Create a GARD Record for the chip. Production code will pass a
+ // valid PLID
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE);
if (l_pErr)
@@ -600,7 +562,7 @@ public:
// Create another GARD Record for the chip
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_FATAL);
if (l_pErr)
@@ -656,9 +618,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
@@ -680,13 +639,6 @@ public:
TARGETING::targetService().masterProcChipTargetHandle(l_pTarget);
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
-
- // Create an error log to pass to the createGardRecord function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
do
{
@@ -706,9 +658,10 @@ public:
break;
}
- // Create a GARD Record for the chip
+ // Create a GARD Record for the chip. Production code will pass a
+ // valid PLID
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE);
if (l_pErr)
@@ -719,7 +672,7 @@ public:
// Create another GARD Record for the chip
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_FATAL);
if (l_pErr)
@@ -804,9 +757,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
@@ -829,13 +779,6 @@ public:
TARGETING::EntityPath l_id =
l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // Create an error log to pass to the createGardRecord function, this
- // will never be committed.
- errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- HWAS::MOD_DECONFIG_GARD,
- HWAS::RC_TARGET_NOT_DECONFIGURABLE);
-
do
{
// Get all existing GARD Records
@@ -854,9 +797,10 @@ public:
break;
}
- // Create a GARD Record for the chip
+ // Create a GARD Record for the chip. Production code will pass a
+ // valid PLID
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE);
if (l_pErr)
@@ -867,7 +811,7 @@ public:
// Create another GARD Record for the chip
l_pErr = HWAS::theDeconfigGard().
- createGardRecord(*l_pTarget, l_pNewErr,
+ createGardRecord(*l_pTarget, 0,
HWAS::DeconfigGard::GARD_SEVERITY_FATAL);
if (l_pErr)
@@ -907,9 +851,6 @@ public:
}
while (0);
- delete l_pNewErr;
- l_pNewErr = NULL;
-
if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
OpenPOWER on IntegriCloud