summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2012-10-22 15:19:21 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-11-14 15:16:17 -0600
commit5bf227e40990fa777f108e9bf882649b1a829667 (patch)
tree079a7609e46c4c95a45370d3ab24f986930d3cb0 /src/include
parente01ae7fdbc2549015f603fed9e44062067c81e90 (diff)
downloadblackbird-hostboot-5bf227e40990fa777f108e9bf882649b1a829667.tar.gz
blackbird-hostboot-5bf227e40990fa777f108e9bf882649b1a829667.zip
make deconfig/GARD functions hwas common for sharing with FSP
split current deconfigGard function into hwas common and platform specific functions so that FSP will have access to these as well. Change-Id: Iebacffb10f85af29e245ce41040d6f9ebc774830 RTC: 33551 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2188 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-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
7 files changed, 229 insertions, 61 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
OpenPOWER on IntegriCloud