summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/usr/hwas/common/deconfigGard.H (renamed from src/include/usr/hwas/deconfigGard.H)57
-rw-r--r--src/include/usr/hwas/common/hwasCallout.H1
-rw-r--r--src/include/usr/hwas/common/hwasCommon.H26
-rw-r--r--src/include/usr/hwas/common/hwas_reasoncodes.H60
-rw-r--r--src/include/usr/hwas/hwasPlatDeconfigGard.H89
-rw-r--r--src/include/usr/hwas/hwasPlatError.H6
-rw-r--r--src/include/usr/hwas/hwasPlatThread.H51
-rw-r--r--src/usr/errl/test/errltest.H2
-rw-r--r--src/usr/errl/test/errluserdetailtest.H2
-rw-r--r--src/usr/hwas/common/common.mk41
-rw-r--r--src/usr/hwas/common/deconfigGard.C (renamed from src/usr/hwas/deconfigGard.C)514
-rw-r--r--src/usr/hwas/common/hwasCallout.C9
-rw-r--r--src/usr/hwas/hostbootIstep.C2
-rw-r--r--src/usr/hwas/hwasPlat.C43
-rw-r--r--src/usr/hwas/hwasPlatError.C51
-rw-r--r--src/usr/hwas/makefile32
-rw-r--r--src/usr/hwas/test/hwasGardTest.H2
17 files changed, 615 insertions, 373 deletions
diff --git a/src/include/usr/hwas/deconfigGard.H b/src/include/usr/hwas/common/deconfigGard.H
index 8d34070b7..77c2f21bd 100644
--- a/src/include/usr/hwas/deconfigGard.H
+++ b/src/include/usr/hwas/common/deconfigGard.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/usr/hwas/deconfigGard.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/hwas/common/deconfigGard.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
/**
* @file deconfigGard.H
*
@@ -32,12 +31,11 @@
#define DECONFIGGARD_H_
#include <vector>
-#include <stdint.h>
-#include <sys/sync.h>
-#include <util/singleton.H>
-#include <errl/errlentry.H>
#include <hwas/common/hwasCommon.H>
+#include <hwas/common/hwasCallout.H>
#include <targeting/common/attributes.H>
+#include <hwas/hwasPlatDeconfigGard.H>
+#include <hwas/hwasPlatThread.H>
namespace HWAS
{
@@ -213,7 +211,7 @@ public:
* @return errlHndl_t. Error log handle.
*/
errlHndl_t getDeconfigureRecords(const TARGETING::EntityPath * i_pTargetId,
- DeconfigureRecords_t & o_records) const;
+ DeconfigureRecords_t & o_records);
/**
* @brief Clears the specified GARD Records.
@@ -432,7 +430,7 @@ private:
errlHndl_t _ensureGardRecordDataSetup();
// Mutex for thread safety
- mutable mutex_t iv_mutex;
+ HWAS_MUTEX_TYPE iv_mutex;
// GARD Record Data
uint32_t iv_nextGardRecordId; // Next GARD Record ID to use
@@ -443,6 +441,7 @@ private:
DeconfigureRecords_t iv_deconfigureRecords;
};
+HWAS_DECLARE_SINGLETON(HWAS::DeconfigGard,theDeconfigGardSingleton);
}
#endif
diff --git a/src/include/usr/hwas/common/hwasCallout.H b/src/include/usr/hwas/common/hwasCallout.H
index e1078081b..2b7302146 100644
--- a/src/include/usr/hwas/common/hwasCallout.H
+++ b/src/include/usr/hwas/common/hwasCallout.H
@@ -34,7 +34,6 @@
// Includes
/******************************************************************************/
#include <targeting/common/target.H>
-#include <errl/errlud.H>
namespace HWAS
{
diff --git a/src/include/usr/hwas/common/hwasCommon.H b/src/include/usr/hwas/common/hwasCommon.H
index 547531ca8..bf27af8ab 100644
--- a/src/include/usr/hwas/common/hwasCommon.H
+++ b/src/include/usr/hwas/common/hwasCommon.H
@@ -35,6 +35,7 @@
#include <stdint.h>
#include <targeting/common/target.H>
#include <targeting/common/targetservice.H>
+#include <hwas/common/hwasError.H>
// platform specific headers
@@ -116,6 +117,31 @@ const uint32_t VPD_CP00_PG_PCIE_GOOD = 0xF700;
const uint32_t VPD_CP00_PG_EX0_INDEX = 16;
const uint32_t VPD_CP00_PG_EX0_GOOD = 0xF300;
+/**
+ * @brief platform specific code to get the address in PNOR to read
+ * and write GARD data
+ *
+ * @param[out] o_addr pointer to where GARD data is in PNOR
+ * @param[out] o_size size (in bytes) of GARD data section in PNOR
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t platGetGardPnorAddr(void *& o_addr,
+ uint64_t &o_size);
+
+const uint32_t EMPTY_GARD_RECORDID=0xFFFFFFFF;
+const uint32_t EMPTY_GARD_VALUE=0xFF;
+
+/**
+ * @brief wrapper function to create new errlog in platform-specific manner.
+ */
+errlHndl_t hwasError(const uint8_t i_sev,
+ const uint8_t i_modId,
+ const uint16_t i_reasonCode,
+ const uint64_t i_user1 = 0,
+ const uint64_t i_user2 = 0);
+
} // namespace HWAS
diff --git a/src/include/usr/hwas/common/hwas_reasoncodes.H b/src/include/usr/hwas/common/hwas_reasoncodes.H
index 384bfba70..774708cde 100644
--- a/src/include/usr/hwas/common/hwas_reasoncodes.H
+++ b/src/include/usr/hwas/common/hwas_reasoncodes.H
@@ -1,31 +1,28 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/usr/hwas/common/hwas_reasoncodes.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/hwas/common/hwas_reasoncodes.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef HWAS_REASONCODES_H
#define HWAS_REASONCODES_H
-#include <hbotcompid.H>
-
namespace HWAS
{
enum HwasModuleID
@@ -36,11 +33,14 @@ namespace HWAS
enum HwasReasonCode
{
- RC_TARGET_NOT_DECONFIGURABLE = HWAS_COMP_ID | 0x01,
- RC_TARGET_NOT_GARDABLE = HWAS_COMP_ID | 0x02,
- RC_GARD_REPOSITORY_FULL = HWAS_COMP_ID | 0x03,
- RC_TARGET_NOT_FOUND_FOR_GARD_RECORD = HWAS_COMP_ID | 0x04,
- RC_INVALID_TARGET = HWAS_COMP_ID | 0x05,
+ // these are HWAS Common specific, and will get mapped into 'correct'
+ // codes by the appropriate platform-specific function
+ RC_TARGET_NOT_DECONFIGURABLE = 0x01,
+ RC_TARGET_NOT_GARDABLE = 0x02,
+ RC_GARD_REPOSITORY_FULL = 0x03,
+ RC_TARGET_NOT_FOUND_FOR_GARD_RECORD = 0x04,
+ RC_INVALID_TARGET = 0x05,
+ // if more are added, modify each hwasPlatError.C file as appropriate.
};
};
diff --git a/src/include/usr/hwas/hwasPlatDeconfigGard.H b/src/include/usr/hwas/hwasPlatDeconfigGard.H
new file mode 100644
index 000000000..3cddf8dd5
--- /dev/null
+++ b/src/include/usr/hwas/hwasPlatDeconfigGard.H
@@ -0,0 +1,89 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/hwas/hwasPlatDeconfigGard.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file hwas/hwasPlatDeconfigGard.H
+ *
+ * @brief Defines platform interfaces and whatnot needed for DeconfigGard in the
+ * HWAS common and platform specific functions
+ */
+
+#ifndef HWASPLATDECONFIGGARD_H_
+#define HWASPLATDECONFIGGARD_H_
+
+#include <sys/mm.h>
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+#include <hwas/hwasPlatError.H>
+
+//******************************************************************************
+// Trace descriptors that are defined in a C file
+//******************************************************************************
+namespace HWAS
+{
+
+#if 0
+//TODO: RTC 37739: flush PNOR
+// questions -- what address and what size do it need to use? the section
+// starting address and section size? or the address and size of the
+// gard record that is being flushed?
+
+/**
+ * @brief function to push GARD records 'out' to PNOR
+ */
+inline void pushGardRecords(void *i_pAddr, uint64_t i_size)
+{
+ int l_rc = mm_remove_pages(FLUSH, i_pAddr, i_size);
+ if (l_rc )
+ { // mm_remove_pages returns none zero for error
+ HWAS_ERR("Fail to flush the page");
+ }
+}
+#endif
+
+}
+
+/**
+ * @brief Adapt common singleton declaration to specific platform
+ *
+ * @param[in] __T__
+ * Type of singleton, fully namespaced
+ *
+ * @param[in] __NAME__
+ * Symbol name for singleton
+ */
+#define HWAS_DECLARE_SINGLETON(__T__,__NAME__) \
+ typedef Singleton<__T__> __NAME__;
+
+/**
+ * @brief Adapt common singleton "getter" to the specific platform
+ *
+ * @param[in] __TYPE__
+ * Typedef for singleton, as created above
+ *
+ * @return Singleton reference for the given singleton
+ */
+#define HWAS_GET_SINGLETON(__TYPE__) \
+ __TYPE__::instance()
+
+
+#endif // HWASPLATDECONFIGGARD_H_
diff --git a/src/include/usr/hwas/hwasPlatError.H b/src/include/usr/hwas/hwasPlatError.H
index be382e290..34f75425d 100644
--- a/src/include/usr/hwas/hwasPlatError.H
+++ b/src/include/usr/hwas/hwasPlatError.H
@@ -39,10 +39,14 @@
// errlHndl_t pointers around and check for NULL
#include <errl/errlmanager.H>
+#include <hbotcompid.H>
+#include <errl/errlentry.H>
+
namespace HWAS
{
namespace COMMON
+
{
/**
* @brief Import the ::ERRORLOG namespace into the ::HWAS:COMMON
@@ -52,7 +56,7 @@ namespace COMMON
* no danger of a namespace collision.
*/
using namespace ::ERRORLOG;
-
+
} // End namespace COMMON
} // End namespace HWAS
diff --git a/src/include/usr/hwas/hwasPlatThread.H b/src/include/usr/hwas/hwasPlatThread.H
new file mode 100644
index 000000000..b68b9e1a3
--- /dev/null
+++ b/src/include/usr/hwas/hwasPlatThread.H
@@ -0,0 +1,51 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/hwas/hwasPlatThread.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __HWAS_PLAT_THREAD_H
+#define __HWAS_PLAT_THREAD_H
+
+/**
+* @file hwas/hwasPlatThread.H
+*
+* @brief Adapts platform neutral thread functions.
+*/
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#define HWAS_MUTEX_TYPE \
+mutable mutex_t
+
+#define HWAS_MUTEX_INIT(_t) \
+ mutex_init(_t)
+
+#define HWAS_MUTEX_DESTROY(_t) \
+ mutex_destroy(_t)
+
+#define HWAS_MUTEX_LOCK(_t) \
+ mutex_lock(_t)
+
+#define HWAS_MUTEX_UNLOCK(_t) \
+ mutex_unlock(_t)
+
+#endif // __HWAS_PLAT_THREAD_H
diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H
index d1b7c2398..2383d45f7 100644
--- a/src/usr/errl/test/errltest.H
+++ b/src/usr/errl/test/errltest.H
@@ -41,7 +41,7 @@
#include <targeting/common/iterators/rangefilter.H>
#include <targeting/common/predicates/predicates.H>
#include <hwas/common/hwasCallout.H>
-#include <hwas/deconfigGard.H>
+#include <hwas/common/deconfigGard.H>
#define TEST_SEVERITY ERRORLOG::ERRL_SEV_INFORMATIONAL
diff --git a/src/usr/errl/test/errluserdetailtest.H b/src/usr/errl/test/errluserdetailtest.H
index 1883ef34b..2899bb0cd 100644
--- a/src/usr/errl/test/errluserdetailtest.H
+++ b/src/usr/errl/test/errluserdetailtest.H
@@ -44,7 +44,7 @@
#include <targeting/common/iterators/rangefilter.H>
#include <targeting/common/predicates/predicates.H>
#include <targeting/common/util.H>
-#include <hwas/deconfigGard.H>
+#include <hwas/common/deconfigGard.H>
#include <devicefw/driverif.H>
diff --git a/src/usr/hwas/common/common.mk b/src/usr/hwas/common/common.mk
deleted file mode 100644
index bbe51e885..000000000
--- a/src/usr/hwas/common/common.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/hwas/common/common.mk $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2012
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
-# IBM_PROLOG_END
-################################################################################
-#
-# @file hwas/common.mk
-#
-# @brief Common hwas makefile to be included in
-# hwas/makefile
-#
-################################################################################
-
-HWAS_OBJS = \
- hwas.o
-
-OTHER_OBJS =
-
-# Common
-COMMON_HWAS_OBJS = \
- ${HWAS_OBJS} \
- ${OTHER_OBJS}
-
diff --git a/src/usr/hwas/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C
index 6bb65cf39..61fdc42cb 100644
--- a/src/usr/hwas/deconfigGard.C
+++ b/src/usr/hwas/common/deconfigGard.C
@@ -1,39 +1,35 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwas/deconfigGard.C $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwas/common/deconfigGard.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
/**
* @file deconfigGard.C
*
* @brief Implements the DeconfigGard class
*/
+#include <stdint.h>
-#include <string.h>
-#include <targeting/common/targetservice.H>
-#include <errl/errlmanager.H>
-#include <errl/errludtarget.H>
-#include <hwas/deconfigGard.H>
+#include <hwas/common/hwasCommon.H>
+#include <hwas/common/deconfigGard.H>
#include <hwas/common/hwas_reasoncodes.H>
-#include <pnor/pnorif.H>
// Trace definition
#define __COMP_TD__ g_trac_deconf
@@ -45,7 +41,7 @@
// 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)
+ HWAS_DBG_BIN(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
@@ -54,17 +50,18 @@
namespace HWAS
{
-HWAS_TD_t g_trac_deconf = NULL;
+
+using namespace HWAS::COMMON;
errlHndl_t collectGard()
{
- TRAC_INF("collectGard entry" );
+ HWAS_INF("collectGard entry" );
errlHndl_t errl = theDeconfigGard().clearGardRecordsForReplacedTargets();
if (errl)
{
- TRAC_ERR("ERROR: collectGard failed to clear GARD Records for "
+ HWAS_ERR("ERROR: collectGard failed to clear GARD Records for "
"replaced Targets");
}
else
@@ -73,12 +70,12 @@ errlHndl_t collectGard()
if (errl)
{
- TRAC_ERR("ERROR: collectGard failed to deconfigure Targets "
+ HWAS_ERR("ERROR: collectGard failed to deconfigure Targets "
"from GARD Records for IPL");
}
else
{
- TRAC_INF("collectGard completed successfully");
+ HWAS_INF("collectGard completed successfully");
}
}
return errl;
@@ -87,7 +84,7 @@ errlHndl_t collectGard()
//******************************************************************************
DeconfigGard & theDeconfigGard()
{
- return Singleton<DeconfigGard>::instance();
+ return HWAS_GET_SINGLETON(theDeconfigGardSingleton);
}
//******************************************************************************
@@ -96,39 +93,38 @@ DeconfigGard::DeconfigGard()
iv_maxGardRecords(0),
iv_pGardRecords(NULL)
{
- TRAC_INIT_BUFFER(&g_trac_deconf, "DECONF", 4096);
- TRAC_INF("DeconfigGard Constructor");
- mutex_init(&iv_mutex);
+ HWAS_INF("DeconfigGard Constructor");
+ HWAS_MUTEX_INIT(&iv_mutex);
}
//******************************************************************************
DeconfigGard::~DeconfigGard()
{
- TRAC_INF("DeconfigGard Destructor");
- mutex_destroy(&iv_mutex);
+ HWAS_INF("DeconfigGard Destructor");
+ HWAS_MUTEX_DESTROY(&iv_mutex);
}
//******************************************************************************
errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
{
- TRAC_INF("****TBD****Usr Request: Clear GARD Records for replaced Targets");
- mutex_lock(&iv_mutex);
+ HWAS_INF("****TBD****Usr Request: Clear GARD Records for replaced Targets");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = NULL;
-
+
// TODO
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
//******************************************************************************
errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
{
- TRAC_INF("Usr Request: Deconfigure Targets from GARD Records for IPL");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Deconfigure Targets from GARD Records for IPL");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = NULL;
GardRecords_t l_gardRecords;
-
+
// 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
@@ -139,13 +135,13 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
if (l_pErr)
{
- TRAC_ERR("Error from _getGardRecords");
+ HWAS_ERR("Error from _getGardRecords");
}
else
{
- TRAC_INF("%d GARD Records found", l_gardRecords.size());
-
- // For each GARD Record
+ HWAS_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)
{
@@ -160,14 +156,14 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
/*@
* @errortype
- * @moduleid MOD_DECONFIG_GARD
- * @reasoncode RC_TARGET_NOT_FOUND_FOR_GARD_RECORD
+ * @moduleid HWAS::MOD_DECONFIG_GARD
+ * @reasoncode HWAS::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);
+ l_pErr = hwasError(
+ ERRL_SEV_INFORMATIONAL,
+ HWAS::MOD_DECONFIG_GARD,
+ HWAS::RC_TARGET_NOT_FOUND_FOR_GARD_RECORD);
errlCommit(l_pErr, HWAS_COMP_ID);
}
else
@@ -182,7 +178,7 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
}
}
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
@@ -190,16 +186,16 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl()
errlHndl_t DeconfigGard::deconfigureTarget(TARGETING::Target & i_target,
const uint32_t i_errlPlid)
{
- TRAC_ERR("Usr Request: Deconfigure Target");
- mutex_lock(&iv_mutex);
-
+ HWAS_ERR("Usr Request: Deconfigure Target");
+ HWAS_MUTEX_LOCK(&iv_mutex);
+
// Deconfigure the Target
_deconfigureTarget(i_target, i_errlPlid, DECONFIG_CAUSE_FIRMWARE_REQ);
-
+
// Deconfigure other Targets by association
_deconfigureByAssoc(i_target, i_errlPlid);
-
- mutex_unlock(&iv_mutex);
+
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return NULL;
}
@@ -208,22 +204,22 @@ errlHndl_t DeconfigGard::createGardRecord(const TARGETING::Target & i_target,
const uint32_t i_errlPlid,
const GARD_ErrorType i_errorType)
{
- TRAC_ERR("Usr Request: Create GARD Record");
- mutex_lock(&iv_mutex);
+ HWAS_ERR("Usr Request: Create GARD Record");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = _createGardRecord(i_target, i_errlPlid, i_errorType);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
//******************************************************************************
errlHndl_t DeconfigGard::getDeconfigureRecords(
const TARGETING::EntityPath * i_pTargetId,
- DeconfigureRecords_t & o_records) const
+ DeconfigureRecords_t & o_records)
{
- TRAC_INF("Usr Request: Get Deconfigure Record(s)");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Get Deconfigure Record(s)");
+ HWAS_MUTEX_LOCK(&iv_mutex);
_getDeconfigureRecords(i_pTargetId, o_records);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return NULL;
}
@@ -231,10 +227,10 @@ errlHndl_t DeconfigGard::getDeconfigureRecords(
//******************************************************************************
errlHndl_t DeconfigGard::clearGardRecords(const uint32_t i_recordId)
{
- TRAC_INF("Usr Request: Clear GARD Record(s) by Record ID");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Clear GARD Record(s) by Record ID");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = _clearGardRecords(i_recordId);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
@@ -242,10 +238,10 @@ errlHndl_t DeconfigGard::clearGardRecords(const uint32_t i_recordId)
errlHndl_t DeconfigGard::clearGardRecords(
const TARGETING::EntityPath & i_targetId)
{
- TRAC_INF("Usr Request: Clear GARD Record(s) by Target ID");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Clear GARD Record(s) by Target ID");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = _clearGardRecords(i_targetId);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
@@ -254,10 +250,10 @@ errlHndl_t DeconfigGard::getGardRecords(
const uint32_t i_recordId,
GardRecords_t & o_records)
{
- TRAC_INF("Usr Request: Get GARD Record(s) by Record ID");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Get GARD Record(s) by Record ID");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = _getGardRecords(i_recordId, o_records);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
@@ -266,10 +262,10 @@ errlHndl_t DeconfigGard::getGardRecords(
const TARGETING::EntityPath & i_targetId,
GardRecords_t & o_records)
{
- TRAC_INF("Usr Request: Get GARD Record(s) by Target ID");
- mutex_lock(&iv_mutex);
+ HWAS_INF("Usr Request: Get GARD Record(s) by Target ID");
+ HWAS_MUTEX_LOCK(&iv_mutex);
errlHndl_t l_pErr = _getGardRecords(i_targetId, o_records);
- mutex_unlock(&iv_mutex);
+ HWAS_MUTEX_UNLOCK(&iv_mutex);
return l_pErr;
}
@@ -277,10 +273,9 @@ errlHndl_t DeconfigGard::getGardRecords(
void DeconfigGard::_deconfigureByAssoc(TARGETING::Target & i_target,
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: ",
- &l_id);
-
+ HWAS_ERR("****TBD****: Deconfiguring by Association for: %.8X",
+ i_target.getAttr<TARGETING::ATTR_HUID>());
+
// TODO
}
@@ -289,48 +284,50 @@ void DeconfigGard::_deconfigureTarget(TARGETING::Target & i_target,
const uint32_t i_errlPlid,
const DeconfigCause i_cause)
{
- TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>();
- DG_TRAC_TARGET(ERR_MRK "Deconfiguring Target: ", &l_id);
-
- errlHndl_t l_pErr = NULL;
-
+ HWAS_INF("Deconfiguring Target %.8X",
+ i_target.getAttr<TARGETING::ATTR_HUID>());
+
if (!i_target.getAttr<TARGETING::ATTR_DECONFIG_GARDABLE>())
{
// Target is not Deconfigurable. Commit an error
- TRAC_ERR("Target not Deconfigurable");
+ HWAS_ERR("Target not Deconfigurable");
/*@
* @errortype
- * @moduleid MOD_DECONFIG_GARD
- * @reasoncode RC_TARGET_NOT_DECONFIGURABLE
+ * @moduleid HWAS::MOD_DECONFIG_GARD
+ * @reasoncode HWAS::RC_TARGET_NOT_DECONFIGURABLE
* @devdesc Attempt to deconfigure a target that is not
* deconfigurable
+ * @userdata1 HUID of input target
*/
- l_pErr = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
- MOD_DECONFIG_GARD,
- RC_TARGET_NOT_DECONFIGURABLE);
-
- ERRORLOG::ErrlUserDetailsTarget(&i_target).addToLog(l_pErr);
+ const uint64_t userdata1 =
+ (uint64_t)i_target.getAttr<TARGETING::ATTR_HUID>() << 32;
+ errlHndl_t l_pErr = NULL;
+ l_pErr = hwasError(
+ ERRL_SEV_INFORMATIONAL,
+ HWAS::MOD_DECONFIG_GARD,
+ HWAS::RC_TARGET_NOT_DECONFIGURABLE,
+ userdata1);
errlCommit(l_pErr,HWAS_COMP_ID);
}
else
{
// Set the Target state to non-functional. The assumption is that it is
// not possible for another thread (other than deconfigGard) to be
- // updating HWAS_STATE concurrently.
+ // updating HWAS_STATE concurrently.
TARGETING::HwasState l_state =
i_target.getAttr<TARGETING::ATTR_HWAS_STATE>();
-
+
if (!l_state.functional)
{
- TRAC_ERR("Target HWAS_STATE already non-functional");
+ HWAS_ERR("Target HWAS_STATE already non-functional");
}
else
{
- TRAC_ERR("Setting Target HWAS_STATE to non-functional");
+ HWAS_ERR("Setting Target HWAS_STATE to non-functional");
l_state.functional = 0;
i_target.setAttr<TARGETING::ATTR_HWAS_STATE>(l_state);
}
-
+
// Do any necessary Deconfigure Actions
_doDeconfigureActions(i_target);
@@ -356,7 +353,7 @@ void DeconfigGard::_createDeconfigureRecord(
// Look for an existing Deconfigure Record for the Target
DeconfigureRecordsCItr_t l_itr = iv_deconfigureRecords.begin();
-
+
for (; l_itr != iv_deconfigureRecords.end(); ++l_itr)
{
if ((*l_itr).iv_targetId == l_id)
@@ -364,16 +361,16 @@ void DeconfigGard::_createDeconfigureRecord(
break;
}
}
-
+
if (l_itr != iv_deconfigureRecords.end())
{
- TRAC_ERR("Not creating a Deconfigure Record, one already exists");
+ HWAS_ERR("Not creating a Deconfigure Record, one already exists");
}
else
{
// Create a DeconfigureRecord
- TRAC_ERR("Creating a Deconfigure Record");
-
+ HWAS_ERR("Creating a Deconfigure Record");
+
DeconfigureRecord l_record;
l_record.iv_targetId = l_id;
l_record.iv_errlogPlid = i_errlPlid;
@@ -382,7 +379,7 @@ void DeconfigGard::_createDeconfigureRecord(
l_record.iv_padding[1] = 0;
l_record.iv_padding[2] = 0;
l_record.iv_deconfigureTime = 0; // TODO Get epoch time
-
+
iv_deconfigureRecords.push_back(l_record);
}
}
@@ -393,7 +390,7 @@ void DeconfigGard::_clearDeconfigureRecords(
{
if (i_pTargetId == NULL)
{
- TRAC_INF("Clearing all %d Deconfigure Records",
+ HWAS_INF("Clearing all %d Deconfigure Records",
iv_deconfigureRecords.size());
iv_deconfigureRecords.clear();
}
@@ -402,7 +399,7 @@ void DeconfigGard::_clearDeconfigureRecords(
// Look for a Deconfigure Record for the specified Target (there can
// only be one record)
bool l_foundRecord = false;
-
+
for (DeconfigureRecordsItr_t l_itr = iv_deconfigureRecords.begin();
l_itr != iv_deconfigureRecords.end(); ++l_itr)
{
@@ -415,12 +412,16 @@ void DeconfigGard::_clearDeconfigureRecords(
break;
}
}
-
+
if (!l_foundRecord)
{
DG_TRAC_TARGET(INFO_MRK "Did not find a Deconfigure Record to clear for: ",
i_pTargetId);
}
+ else
+ {
+ //TODO: RTC 37739: flush PNOR as well
+ }
}
}
@@ -431,12 +432,12 @@ void DeconfigGard::_getDeconfigureRecords(
{
DeconfigureRecordsCItr_t l_itr = iv_deconfigureRecords.begin();
o_records.clear();
-
+
if (i_pTargetId == NULL)
{
- TRAC_INF("Getting all %d Deconfigure Records",
+ HWAS_INF("Getting all %d Deconfigure Records",
iv_deconfigureRecords.size());
-
+
for (; l_itr != iv_deconfigureRecords.end(); ++l_itr)
{
o_records.push_back(*l_itr);
@@ -456,7 +457,7 @@ void DeconfigGard::_getDeconfigureRecords(
break;
}
}
-
+
if (l_itr == iv_deconfigureRecords.end())
{
DG_TRAC_TARGET(INFO_MRK "Did not find a Deconfigure Record to get for: ",
@@ -473,80 +474,89 @@ errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target,
errlHndl_t l_pErr = NULL;
TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>();
- DG_TRAC_TARGET(ERR_MRK "Creating GARD Record for: ", &l_id);
-
- if (!i_target.getAttr<TARGETING::ATTR_DECONFIG_GARDABLE>())
- {
- // Target is not GARDable. Commit an error
- TRAC_ERR("Target not GARDable");
- /*@
- * @errortype
- * @moduleid MOD_DECONFIG_GARD
- * @reasoncode RC_TARGET_NOT_GARDABLE
- * @devdesc Attempt to create a GARD Record for a target that is
- * not GARDable
- */
- l_pErr = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MOD_DECONFIG_GARD,
- RC_TARGET_NOT_GARDABLE);
-
- ERRORLOG::ErrlUserDetailsTarget(&i_target).addToLog(l_pErr);
- errlCommit(l_pErr,HWAS_COMP_ID);
- }
- else
+ HWAS_INF("Creating GARD Record for %.8X",
+ i_target.getAttr<TARGETING::ATTR_HUID>());
+
+ do
{
+
+ if (!i_target.getAttr<TARGETING::ATTR_DECONFIG_GARDABLE>())
+ {
+ // Target is not GARDable. Commit an error
+ HWAS_ERR("Target not GARDable");
+ /*@
+ * @errortype
+ * @moduleid HWAS::MOD_DECONFIG_GARD
+ * @reasoncode HWAS::RC_TARGET_NOT_GARDABLE
+ * @devdesc Attempt to create a GARD Record for a target that is
+ * not GARDable
+ * @userdata1 HUID of input target
+ */
+ const uint64_t userdata1 =
+ (uint64_t)i_target.getAttr<TARGETING::ATTR_HUID>() << 32;
+ l_pErr = hwasError(
+ ERRL_SEV_UNRECOVERABLE,
+ HWAS::MOD_DECONFIG_GARD,
+ HWAS::RC_TARGET_NOT_GARDABLE,
+ userdata1);
+ errlCommit(l_pErr,HWAS_COMP_ID);
+ break;
+ }
+
l_pErr = _ensureGardRecordDataSetup();
-
+
if (l_pErr)
{
- TRAC_ERR("Error from _ensureGardRecordDataSetup");
+ HWAS_ERR("Error from _ensureGardRecordDataSetup");
+ break;
}
- else
- {
- GardRecord * l_pRecord = NULL;
- // Find an empty GARD Record slot
- for (uint32_t i = 0; i < iv_maxGardRecords; i++)
- {
- if (iv_pGardRecords[i].iv_recordId == 0)
- {
- l_pRecord = &(iv_pGardRecords[i]);
- break;
- }
- }
-
- if (!l_pRecord)
- {
- TRAC_ERR("GARD Record Repository full");
- /*@
- * @errortype
- * @moduleid MOD_DECONFIG_GARD
- * @reasoncode RC_GARD_REPOSITORY_FULL
- * @devdesc Attempt to create a GARD Record and the GARD
- * Repository is full
- * @userdata1 Number of GARD Records in repository
- */
- l_pErr = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MOD_DECONFIG_GARD,
- RC_GARD_REPOSITORY_FULL,
- iv_maxGardRecords);
+ GardRecord * l_pRecord = NULL;
- ERRORLOG::ErrlUserDetailsTarget(&i_target).addToLog(l_pErr);
- }
- else
+ // Find an empty GARD Record slot
+ for (uint32_t i = 0; i < iv_maxGardRecords; i++)
+ {
+ if (iv_pGardRecords[i].iv_recordId == EMPTY_GARD_RECORDID)
{
- l_pRecord->iv_recordId = iv_nextGardRecordId++;
- l_pRecord->iv_targetId = l_id;
- // TODO Setup iv_cardMruSn or iv_chipMruEcid
- l_pRecord->iv_errlogPlid = i_errlPlid;
- l_pRecord->iv_errorType = i_errorType;
- l_pRecord->iv_padding[0] = 0;
- l_pRecord->iv_padding[1] = 0;
- l_pRecord->iv_padding[2] = 0;
- l_pRecord->iv_gardTime = 0; // TODO Get epoch time
+ l_pRecord = &(iv_pGardRecords[i]);
+ break;
}
}
+
+ if (!l_pRecord)
+ {
+ HWAS_ERR("GARD Record Repository full");
+ /*@
+ * @errortype
+ * @moduleid HWAS::MOD_DECONFIG_GARD
+ * @reasoncode HWAS::RC_GARD_REPOSITORY_FULL
+ * @devdesc Attempt to create a GARD Record and the GARD
+ * Repository is full
+ * @userdata1 HUID of input target
+ */
+ const uint64_t userdata1 =
+ (uint64_t)i_target.getAttr<TARGETING::ATTR_HUID>() << 32;
+ l_pErr = hwasError(
+ ERRL_SEV_UNRECOVERABLE,
+ HWAS::MOD_DECONFIG_GARD,
+ HWAS::RC_GARD_REPOSITORY_FULL,
+ userdata1);
+ break;
+ }
+
+ l_pRecord->iv_recordId = iv_nextGardRecordId++;
+ l_pRecord->iv_targetId = l_id;
+ // TODO Setup iv_cardMruSn or iv_chipMruEcid
+ l_pRecord->iv_errlogPlid = i_errlPlid;
+ l_pRecord->iv_errorType = i_errorType;
+ l_pRecord->iv_padding[0] = 0;
+ l_pRecord->iv_padding[1] = 0;
+ l_pRecord->iv_padding[2] = 0;
+ l_pRecord->iv_gardTime = 0; // TODO Get epoch time
+
+ //TODO: RTC 37739: flush PNOR as well
}
+ while (0);
return l_pErr;
}
@@ -557,23 +567,25 @@ errlHndl_t DeconfigGard::_clearGardRecords(const uint32_t i_recordId)
errlHndl_t l_pErr = NULL;
l_pErr = _ensureGardRecordDataSetup();
-
+
if (l_pErr)
{
- TRAC_ERR("Error from _ensureGardRecordDataSetup");
+ HWAS_ERR("Error from _ensureGardRecordDataSetup");
}
else
{
if (i_recordId == 0)
{
- TRAC_INF("Clearing all GARD Records");
-
+ HWAS_INF("Clearing all GARD Records");
+
// Only clear valid GARD Records to avoid excessive PNOR access
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
- if (iv_pGardRecords[i].iv_recordId != 0)
+ if (iv_pGardRecords[i].iv_recordId != EMPTY_GARD_RECORDID)
{
- memset(&(iv_pGardRecords[i]), 0, sizeof(GardRecord));
+ // clear iv_recordId
+ iv_pGardRecords[i].iv_recordId = EMPTY_GARD_RECORDID;
+ //TODO: RTC 37739: flush PNOR as well
}
}
}
@@ -584,15 +596,17 @@ errlHndl_t DeconfigGard::_clearGardRecords(const uint32_t i_recordId)
{
if (iv_pGardRecords[i].iv_recordId == i_recordId)
{
- TRAC_INF("Clearing GARD Record ID 0x%x", i_recordId);
- memset(&(iv_pGardRecords[i]), 0, sizeof(GardRecord));
+ HWAS_INF("Clearing GARD Record ID 0x%x", i_recordId);
+ // clear iv_recordId
+ iv_pGardRecords[i].iv_recordId = EMPTY_GARD_RECORDID;
+ //TODO: RTC 37739: flush PNOR as well
break;
}
}
-
+
if (i == iv_maxGardRecords)
{
- TRAC_INF("No GARD Record ID 0x%x to clear", i_recordId);
+ HWAS_INF("No GARD Record ID 0x%x to clear", i_recordId);
}
}
}
@@ -607,22 +621,25 @@ errlHndl_t DeconfigGard::_clearGardRecords(
errlHndl_t l_pErr = NULL;
l_pErr = _ensureGardRecordDataSetup();
-
+
if (l_pErr)
{
- TRAC_ERR("Error from _ensureGardRecordDataSetup");
+ HWAS_ERR("Error from _ensureGardRecordDataSetup");
}
else
{
bool l_gardRecordsCleared = false;
-
+
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
- if (iv_pGardRecords[i].iv_targetId == i_targetId)
+ if ((iv_pGardRecords[i].iv_recordId != EMPTY_GARD_RECORDID) &&
+ (iv_pGardRecords[i].iv_targetId == i_targetId)
+ )
{
DG_TRAC_TARGET(INFO_MRK "Clearing GARD Record for: ",
&i_targetId);
- memset(&(iv_pGardRecords[i]), 0, sizeof(GardRecord));
+ // clear iv_recordId
+ iv_pGardRecords[i].iv_recordId = EMPTY_GARD_RECORDID;
l_gardRecordsCleared = true;
}
}
@@ -632,6 +649,7 @@ errlHndl_t DeconfigGard::_clearGardRecords(
DG_TRAC_TARGET(INFO_MRK "No GARD Records to clear for: ",
&i_targetId);
}
+ //TODO: RTC 37739: flush PNOR as well
}
return l_pErr;
@@ -643,23 +661,23 @@ errlHndl_t DeconfigGard::_getGardRecords(const uint32_t i_recordId,
{
errlHndl_t l_pErr = NULL;
o_records.clear();
-
+
l_pErr = _ensureGardRecordDataSetup();
-
+
if (l_pErr)
{
- TRAC_ERR("Error from _ensureGardRecordDataSetup");
+ HWAS_ERR("Error from _ensureGardRecordDataSetup");
}
else
{
if (i_recordId == 0)
{
- TRAC_INF("Getting all GARD Records");
+ HWAS_INF("Getting all GARD Records");
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
- if (iv_pGardRecords[i].iv_recordId != 0)
+ if (iv_pGardRecords[i].iv_recordId != EMPTY_GARD_RECORDID)
{
- TRAC_INF("Getting GARD Record ID 0x%x",
+ HWAS_INF("Getting GARD Record ID 0x%x",
iv_pGardRecords[i].iv_recordId);
o_records.push_back(iv_pGardRecords[i]);
}
@@ -672,15 +690,15 @@ errlHndl_t DeconfigGard::_getGardRecords(const uint32_t i_recordId,
{
if (iv_pGardRecords[i].iv_recordId == i_recordId)
{
- TRAC_INF("Getting GARD Record ID 0x%x", i_recordId);
+ HWAS_INF("Getting GARD Record ID 0x%x", i_recordId);
o_records.push_back(iv_pGardRecords[i]);
break;
}
}
-
+
if (i == iv_maxGardRecords)
{
- TRAC_INF("No GARD Record ID 0x%x to get", i_recordId);
+ HWAS_INF("No GARD Record ID 0x%x to get", i_recordId);
}
}
}
@@ -697,18 +715,20 @@ errlHndl_t DeconfigGard::_getGardRecords(
o_records.clear();
l_pErr = _ensureGardRecordDataSetup();
-
+
if (l_pErr)
{
- TRAC_ERR("Error from _ensureGardRecordDataSetup");
+ HWAS_ERR("Error from _ensureGardRecordDataSetup");
}
else
{
bool l_gardRecordsGot = false;
-
+
for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
- if (iv_pGardRecords[i].iv_targetId == i_targetId)
+ if ((iv_pGardRecords[i].iv_recordId != EMPTY_GARD_RECORDID) &&
+ (iv_pGardRecords[i].iv_targetId == i_targetId)
+ )
{
DG_TRAC_TARGET(INFO_MRK "Getting GARD Record for: ",
&i_targetId);
@@ -731,53 +751,57 @@ errlHndl_t DeconfigGard::_getGardRecords(
errlHndl_t DeconfigGard::_ensureGardRecordDataSetup()
{
errlHndl_t l_pErr = NULL;
-
- if (iv_pGardRecords == NULL)
+
+ do
{
- PNOR::SectionInfo_t l_section;
+ if (iv_pGardRecords != NULL)
+ {
+ // already set, just get out of here.
+ break;
+ }
- // TODO Update when PNOR for GARD Records available (change HB_DATA)
- l_pErr = PNOR::getSectionInfo(PNOR::HB_DATA, PNOR::CURRENT_SIDE, l_section);
-
- if(l_pErr)
+ uint64_t gardSectionSize = 0;
+ void *l_addr = NULL;
+ l_pErr = platGetGardPnorAddr(l_addr, gardSectionSize);
+ if (l_pErr)
{
- TRAC_ERR("Error getting GARD Record PNOR section info");
+ HWAS_ERR("Error getting GARD Record PNOR section info");
+ break;
}
- else
+ iv_pGardRecords = (GardRecord *)l_addr;
+ HWAS_INF("GARD in PNOR: addr=%p, size=%lld",
+ iv_pGardRecords, gardSectionSize);
+
+ iv_maxGardRecords = gardSectionSize / sizeof(GardRecord);
+
+ // Figure out the next GARD Record ID to use
+ uint32_t l_numGardRecords = 0;
+ for (uint32_t i = 0; i < iv_maxGardRecords; i++)
{
- uint32_t l_numGardRecords = 0;
- iv_pGardRecords = reinterpret_cast<GardRecord *>(l_section.vaddr);
- iv_maxGardRecords = l_section.size / sizeof(GardRecord);
-
- // TODO Remove this section when PNOR for GARD Records available
- // For now, just use a buffer
- iv_pGardRecords = new GardRecord[20];
- memset(iv_pGardRecords, 0, sizeof(GardRecord) * 20);
- iv_maxGardRecords = 20;
- // TODO Remove this section when PNOR for GARD Records available
-
- // Figure out the next GARD Record ID to use
- for (uint32_t i = 0; i < iv_maxGardRecords; i++)
+ // if this gard record is already fill out:
+ if (iv_pGardRecords[i].iv_recordId != EMPTY_GARD_RECORDID)
{
+ // count how many gard records are already defined
+ l_numGardRecords++;
+
+ // find the 'last' recordId, so that we can start after it
if (iv_pGardRecords[i].iv_recordId > iv_nextGardRecordId)
{
iv_nextGardRecordId = iv_pGardRecords[i].iv_recordId;
}
-
- if (iv_pGardRecords[i].iv_recordId != 0)
- {
- l_numGardRecords++;
- }
}
-
- iv_nextGardRecordId++;
-
- TRAC_INF("GARD Record data setup. MaxRecords: %d. NextID: %d. NumRecords: %d",
- iv_maxGardRecords, iv_nextGardRecordId, l_numGardRecords);
- }
+ } // for
+
+ // next record will start after the highest Id we found
+ iv_nextGardRecordId++;
+
+ HWAS_INF("GARD setup. MaxRecords %d NextID %d NumRecords %d",
+ iv_maxGardRecords, iv_nextGardRecordId, l_numGardRecords);
+
}
-
+ while (0);
+
return l_pErr;
}
-}
+} // namespce HWAS
diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C
index 833981c5d..36f0b6229 100644
--- a/src/usr/hwas/common/hwasCallout.C
+++ b/src/usr/hwas/common/hwasCallout.C
@@ -34,12 +34,11 @@
/******************************************************************************/
#include <stdint.h>
-#include <hwas/common/hwasCallout.H>
#include <hwas/common/hwasCommon.H>
+#include <hwas/common/deconfigGard.H>
+#include <hwas/common/hwasCallout.H>
#include <hwas/common/hwas_reasoncodes.H>
-#include <hwas/deconfigGard.H>
#include <targeting/common/attributes.H>
-#include <errl/errlmanager.H>
namespace HWAS
{
@@ -99,9 +98,9 @@ void processCallout(const uint32_t i_errlPlid,
* @reasoncode HWAS::RC_INVALID_TARGET
* @devdesc Invalid Target encountered into processCallout
*/
- errl = new ERRORLOG::ErrlEntry(
+ errl = hwasError(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
- MOD_PROCESS_CALLOUT,
+ HWAS::MOD_PROCESS_CALLOUT,
HWAS::RC_INVALID_TARGET);
errlCommit(errl, HWAS_COMP_ID);
break;
diff --git a/src/usr/hwas/hostbootIstep.C b/src/usr/hwas/hostbootIstep.C
index c0e5d9d7b..b7b8d09ba 100644
--- a/src/usr/hwas/hostbootIstep.C
+++ b/src/usr/hwas/hostbootIstep.C
@@ -31,7 +31,7 @@
#include <hwas/common/hwasCommon.H>
#include <hwas/hostbootIstep.H>
-#include <hwas/deconfigGard.H>
+#include <hwas/common/deconfigGard.H>
#include <fsi/fsiif.H>
#include <initservice/taskargs.H>
diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C
index 0f1377ede..898d82a45 100644
--- a/src/usr/hwas/hwasPlat.C
+++ b/src/usr/hwas/hwasPlat.C
@@ -29,13 +29,15 @@
#include <hwas/common/hwas.H>
#include <hwas/common/hwasCommon.H>
-#include <hwas/common/hwasError.H>
+#include <hwas/common/deconfigGard.H>
#include <devicefw/driverif.H>
#include <initservice/taskargs.H>
#include <mvpd/mvpdenums.H>
#include <stdio.h>
+#include <pnor/pnorif.H>
+
namespace HWAS
{
@@ -218,4 +220,43 @@ errlHndl_t platPresenceDetect(TargetHandleList &io_targets)
return errl;
} // platPresenceDetect
+
+
+
+//******************************************************************************
+// platGetGardPnorAddr function
+//******************************************************************************
+errlHndl_t platGetGardPnorAddr(void *& o_addr,uint64_t &o_size)
+{
+ errlHndl_t errl = NULL;
+
+ do
+ {
+#if 0
+ //TODO: RTC 37739
+ PNOR::SectionInfo_t l_section;
+ errl = PNOR::getSectionInfo(PNOR::GUARD_DATA, PNOR::CURRENT_SIDE,
+ l_section);
+ if (errl)
+ {
+ // TODO: do the malloc and store it locally?
+ break;
+ }
+
+ o_addr = reinterpret_cast<void *>(l_section.vaddr);
+ o_size = l_section.size;
+#else
+ // just use a buffer instead of PNOR
+ o_size = 20 * sizeof(DeconfigGard::GardRecord);
+ o_addr = malloc(o_size);
+ memset(o_addr, EMPTY_GARD_VALUE, o_size);
+#endif
+
+ HWAS_INF("GARD in PNOR: addr=%p, size=%d", o_addr, o_size);
+ }
+ while (0);
+
+ return errl;
+} // platGetGardPnorAddr
+
} // namespace HWAS
diff --git a/src/usr/hwas/hwasPlatError.C b/src/usr/hwas/hwasPlatError.C
new file mode 100644
index 000000000..20ad47ff1
--- /dev/null
+++ b/src/usr/hwas/hwasPlatError.C
@@ -0,0 +1,51 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwas/hwasPlatError.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file hwasPlatError.C
+ *
+ * @brief Platform specific error functions
+ */
+
+#include <hwas/common/hwas.H>
+#include <hwas/common/hwasCommon.H>
+#include <hwas/hwasPlatError.H>
+
+namespace HWAS
+{
+
+errlHndl_t hwasError(const uint8_t i_sev,
+ const uint8_t i_modId,
+ const uint16_t i_reasonCode,
+ const uint64_t i_user1,
+ const uint64_t i_user2)
+{
+ errlHndl_t l_pErr;
+
+ l_pErr = new ERRORLOG::ErrlEntry(
+ (ERRORLOG::errlSeverity_t)i_sev, i_modId,
+ HWAS_COMP_ID | i_reasonCode,
+ i_user1, i_user2);
+ return l_pErr;
+}
+
+} // namespace HWAS
diff --git a/src/usr/hwas/makefile b/src/usr/hwas/makefile
index e17115296..bcddfb822 100644
--- a/src/usr/hwas/makefile
+++ b/src/usr/hwas/makefile
@@ -1,25 +1,25 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwas/makefile $
+# $Source: src/usr/hwas/makefile $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
ROOTPATH = ../../..
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwas
@@ -31,10 +31,10 @@ VPATH += ${ROOTPATH}/src/usr/hwas/common
MODULE = hwas
# files in hwas/common directory
-OBJS = hwas.o hwasCallout.o
+OBJS = hwas.o hwasCallout.o deconfigGard.o
# files in this directory
-OBJS += hwasPlat.o hostbootIstep.o deconfigGard.o
+OBJS += hwasPlat.o hostbootIstep.o hwasPlatError.o
SUBDIRS = test.d
diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H
index 32376bbf3..d195899a1 100644
--- a/src/usr/hwas/test/hwasGardTest.H
+++ b/src/usr/hwas/test/hwasGardTest.H
@@ -37,7 +37,7 @@
#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <targeting/common/targetservice.H>
-#include <hwas/deconfigGard.H>
+#include <hwas/common/deconfigGard.H>
#include <hwas/common/hwas_reasoncodes.H>
class HwasGardTest: public CxxTest::TestSuite
OpenPOWER on IntegriCloud