summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/diag/prdf/test')
-rwxr-xr-x[-rw-r--r--]src/usr/diag/prdf/test/makefile77
-rwxr-xr-x[-rw-r--r--]src/usr/diag/prdf/test/prdfTest.H223
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimHomRegisterAccess.C71
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimHomRegisterAccess.H93
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimMacros.H52
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimScrDB.C224
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimScrDB.H117
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimScrDataSet.C67
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimScrDataSet.H82
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimServices.C255
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimServices.H111
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimUtil.C178
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsimUtil.H38
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsim_ras_services.C57
-rwxr-xr-xsrc/usr/diag/prdf/test/prdfsim_ras_services.H80
-rwxr-xr-xsrc/usr/diag/prdf/test/prdsimSignatureParser.C217
-rwxr-xr-xsrc/usr/diag/prdf/test/prdsimSignatureParser.H85
17 files changed, 1943 insertions, 84 deletions
diff --git a/src/usr/diag/prdf/test/makefile b/src/usr/diag/prdf/test/makefile
index 9c25808e3..bdabc6d28 100644..100755
--- a/src/usr/diag/prdf/test/makefile
+++ b/src/usr/diag/prdf/test/makefile
@@ -1,36 +1,61 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/diag/prdf/test/makefile $
-#
-# 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
-
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/diag/prdf/test/makefile $
+#
+# 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
ROOTPATH = ../../../../..
+MODULE = testprdf
+
+#------------------------------------------------------------------------------
+# paths
+#------------------------------------------------------------------------------
+PRD_USR_PATH = ${ROOTPATH}/src/usr/diag/prdf
+
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag/prdf
-EXTRAINCDIR += ${ROOTPATH}/src/usr/diag/prdf
+EXTRAINCDIR += ${PRD_USR_PATH}
+EXTRAINCDIR += ${PRD_USR_PATH}/util
+EXTRAINCDIR += ${PRD_USR_PATH}/framework/service
+EXTRAINCDIR += ${PRD_USR_PATH}/framework/register
+EXTRAINCDIR += ${PRD_USR_PATH}/framework/resolution
+EXTRAINCDIR += ${PRD_USR_PATH}/framework/config
+EXTRAINCDIR += ${PRD_USR_PATH}/framework/rule
+EXTRAINCDIR += ${PRD_USR_PATH}/plat
+EXTRAINCDIR += ${PRD_USR_PATH}/plat/pegasus
+EXTRAINCDIR += ${PRD_USR_PATH}/mnfgtools
+EXTRAINCDIR += ${PRD_USR_PATH}/test
+
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/errl
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/targeting
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+
+#------------------------------------------------------------------------------
+# objects
+#------------------------------------------------------------------------------
+
+OBJS = prdfsimHomRegisterAccess.o prdfsim_ras_services.o prdfsimScrDataSet.o prdfsimScrDB.o prdfsimServices.o prdsimSignatureParser.o prdfsimUtil.o
+
-MODULE = testprdf
TESTS = *.H
diff --git a/src/usr/diag/prdf/test/prdfTest.H b/src/usr/diag/prdf/test/prdfTest.H
index 8d8166ff2..27ac20d7b 100644..100755
--- a/src/usr/diag/prdf/test/prdfTest.H
+++ b/src/usr/diag/prdf/test/prdfTest.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/diag/prdf/test/prdfTest.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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfTest.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 __TEST_PRDFTEST_H
#define __TEST_PRDFTEST_H
@@ -30,12 +30,21 @@
* @brief prdf unit test
*/
-#include <cxxtest/TestSuite.H>
-#include <prdfTrace.H>
-#include <prdf_proto.H>
-#include <errl/errlentry.H>
-#include <errl/errlmanager.H>
+#ifdef __HOSTBOOT_MODULE
+ #include <cxxtest/TestSuite.H>
+ #include <errl/errlentry.H>
+ #include <errl/errlmanager.H>
+#else
+ #include <cxxtest/TestSuite.h>
+ #include <fsp/FipsGlobalFixture.H>
+ #include <errlentry.H>
+#endif
+#include <prdfTrace.H>
+#include <prdfMain.H>
+#include "prdfsimMacros.H"
+#include <targeting/common/targetservice.H>
+#include <prdfPlatServices.H>
class prdfTest: public CxxTest::TestSuite
{
@@ -43,51 +52,80 @@ class prdfTest: public CxxTest::TestSuite
void testTrace(void)
{
+ /*
TS_TRACE(ENTER_MRK "testTrace()");
-
PRDF_ENTER( "testTrace()" );
const char * l_testStr = "running testTrace";
uint64_t l_testHex = 0xDEADBEEF;
uint64_t l_testDec = 99;
PRDF_INF( "testTrace() %s - testHex=0x%08X, testDec=%d", l_testStr, l_testHex, l_testDec );
-
- uint64_t l_chip = 0xFFFFFFFF;
- uint64_t l_sig = 0x12345678;
- PRDF_SIG( "%08X %08X", l_chip, l_sig);
-
PRDF_ERR( "testTrace() Please ignore this error trace 0x%08X", l_testHex );
-
PRDF_DENTER( "testTrace()" );
-
- PRDF_DINF( "testTrace() running testTrace" );
-
PRDF_DEXIT( "testTrace()" );
PRDF_EXIT( "testTrace()" );
-
TS_TRACE(EXIT_MRK "testTrace()");
+ */
}
void testPrdInitialize(void)
{
using namespace PRDF;
+ using namespace TARGETING;
+
TS_TRACE(ENTER_MRK "testPrdInitialize()");
PRDF_ENTER( "testPrdInitialize()" );
+ //FIXME: this is a hack in case some other test code
+ //deconfigs all PROC and MEMBUF chip targets
+
+ TargetHandle_t l_pMasterProcChip = NULL;
+ targetService().masterProcChipTargetHandle(l_pMasterProcChip);
+
+ // first check for any functional PROC targets
+ TargetHandleList list = PlatServices::getFunctionalTargetList( TYPE_PROC );
+ if(0 == list.size())
+ {
+ PRDF_TRAC( "testPrdInitialize(): no functional PROC target found" );
+ // set master proc state to functional
+ getSimServices().setHwasState(l_pMasterProcChip, true);
+ }
+
+ // next check for any functional MEMBUF targets
+ list = PlatServices::getFunctionalTargetList( TYPE_MEMBUF );
+ if(0 == list.size())
+ {
+ PRDF_TRAC( "testPrdInitialize(): no functional MEMBUF target found" );
+ TARGETING::PredicateCTM classTypeMatch(CLASS_CHIP, TYPE_MEMBUF);
+ TargetHandle_t l_pMembuf = NULL;
+ targetService().getAssociated(list,
+ l_pMasterProcChip,
+ TargetService::CHILD_BY_AFFINITY,
+ TargetService::ALL,
+ &classTypeMatch);
+ if(list.size() > 0)
+ {
+ l_pMembuf = list[0];
+ // set first membuf state to functional
+ getSimServices().setHwasState(l_pMembuf, true);
+ }
+ }
+ //end FIXME hack
+
errlHndl_t l_pErr = NULL;
- l_pErr = PrdInitialize();
+ l_pErr = PRDF::initialize();
if (l_pErr)
{
- PRDF_ERR( "testPrdInitialize(): PrdInitialize returned error" );
- TS_FAIL("testPrdInitialize(): PrdInitialize returned error");
- errlCommit(l_pErr,PRDF_COMP_ID);
+ PRDF_ERR( "testPrdInitialize(): PRDF::initialize() returned error" );
+ TS_FAIL("testPrdInitialize(): PRDF::initialize returned error");
+ PRDF_COMMIT_ERRL(l_pErr, ERRL_ACTION_REPORT);
}
else
{
- PRDF_INF( "testPrdInitialize(): PrdInitialize completed with no error" );
- TS_TRACE(INFO_MRK "testPrdInitialize(): PrdInitialize completed with no error");
+ PRDF_INF( "testPrdInitialize(): PRDF::initialize completed with no error" );
+ TS_TRACE(INFO_MRK "testPrdInitialize(): PRDF::initialize completed with no error");
}
PRDF_EXIT( "testPrdInitialize()" );
@@ -96,24 +134,93 @@ class prdfTest: public CxxTest::TestSuite
void testPrdMain(void)
{
+
using namespace PRDF;
TS_TRACE(ENTER_MRK "testPrdMain()");
PRDF_ENTER( "testPrdMain()" );
- errlHndl_t l_pErr = NULL;
- //l_pErr = PrdMain();
+ // ---------------------------------
+ // ---------------------------------
+/*
+ PRDS_BEGIN("PB Centaur Overflow Special attention");
+
+ PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", SPECIAL);
+
+ // ( 0x42410001, "PBCENTFIR[1]", "PB_CENT_OVERFLOW_ERROR" )
+ PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}", 0x42410001);
+// PRDS_EXPECTED_CALLOUT(NONE);
+
+ // GLOBAL_SPA
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001A, 0x2000000000000000);
+
+ // PB_CHIPLET_SPA
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02040004, 0x8000000000000000);
+
+ // PBCENTFIR
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02010c40, 0x4000000000000000);
+
+ // PBCENTFIR_ACT0
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x02010c46, 0xFFFFFFFFFFFFFFFF);
+
+ PRDS_START_SIM();
+
+ PRDS_END();
+*/
+
+ // ---------------------------------
+
+ PRDS_BEGIN("OCC FW2 recoverable attention");
+
+ PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", RECOVERABLE);
+
+ // ( 0x6c290002, "OCCFIR[2]", "OCC_SCOM_OCCFIR_OCC_FW2" )
+ PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}", 0x6c290002);
+// PRDS_EXPECTED_CALLOUT(NONE);
+
+ // GLOBAL_RE_FIR
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001B, 0x4000000000000000);
+
+ // TP_CHIPLET_RE_FIR
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01040001, 0x2000000000000000);
+
+ // OCCFIR
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01010800, 0x2000000000000000);
+
+ // OCCFIR_ACT1
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01010807, 0xFFFFFFFFFFFFFFFF);
+
+ PRDS_START_SIM();
+
+ PRDS_END();
+
+ // ---------------------------------
+/*
+ PRDS_BEGIN("MCSI recoverable attention");
+
+ PRDS_ERROR_ENTRY("NODE{0}:PROC{0}", RECOVERABLE);
+
+ //( 0xde310007, "MCIFIR[7]", "MCIFIRQ_MCI_CHINIT_STATE_MACHINE_TIMEOUT" )
+ PRDS_EXPECTED_SIGNATURE("NODE{0}:PROC{0}:MCS{4}", 0xde310007);
+// PRDS_EXPECTED_CALLOUT(NONE);
+
+ // GLOBAL_RE_FIR
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x570F001B, 0x4000000000000000);
+
+ // TP_CHIPLET_RE_FIR[5] Attention from MCIFIR (MCS 4)
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}", 0x01040001, 0x0100000000000000);
+
+ // MCIFIR[7]: MCIFIRQ_MCI_CHINIT_STATE_MACHINE_TIMEOUT
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}:MCS{4}", 0x02011840, 0x0100000000000000);
+
+ // MCIFIR_ACT1
+ PRDS_SCR_WRITE("NODE{0}:PROC{0}:MCS{4}", 0x02011847, 0xFFFFFFFFFFFFFFFF);
+
+ PRDS_START_SIM();
+
+ PRDS_END();
+*/
+ // ---------------------------------
- if (l_pErr)
- {
- PRDF_ERR( "testPrdMain(): PrdMain returned error" );
- TS_FAIL("testPrdMain(): PrdMain returned error");
- errlCommit(l_pErr,PRDF_COMP_ID);
- }
- else
- {
- PRDF_INF( "testPrdMain(): PrdMain completed with no error" );
- TS_TRACE(INFO_MRK "testPrdMain(): PrdMain completed with no error");
- }
PRDF_EXIT( "testPrdMain()" );
TS_TRACE(EXIT_MRK "testPrdMain()");
@@ -125,7 +232,7 @@ class prdfTest: public CxxTest::TestSuite
TS_TRACE(ENTER_MRK "testPrdIplCleanup()");
PRDF_ENTER( "testPrdIplCleanup()" );
- PrdIplCleanup();
+ PRDF::iplCleanup();
PRDF_EXIT( "testPrdIplCleanup()" );
TS_TRACE(EXIT_MRK "testPrdIplCleanup()");
diff --git a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C
new file mode 100755
index 000000000..cd398887a
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C
@@ -0,0 +1,71 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimHomRegisterAccess.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 */
+
+#include "prdfsimHomRegisterAccess.H"
+#include "prdfsimServices.H"
+#include "prdfsimScrDB.H"
+
+
+namespace PRDF
+{
+
+SimScomAccessor::SimScomAccessor()
+: ScomAccessor()
+{}
+
+SimScomAccessor::~SimScomAccessor()
+{
+
+}
+
+uint32_t SimScomAccessor::Access(TARGETING::TargetHandle_t i_target,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ MopRegisterAccess::Operation operation) const
+{
+ PRDF_DENTER("SimScomAccessor::Access()");
+ uint32_t rc = SUCCESS;
+ ScrDB::SimOp l_op = ScrDB::MAX_OP;
+
+ do
+ {
+// Don't want to issue actual scom op to HW
+// rc = HomRegisterAccessScom::Access( bs, registerId, operation);
+ switch (operation)
+ {
+ case MopRegisterAccess::WRITE: l_op = ScrDB::WRITE; break;
+ case MopRegisterAccess::READ: l_op = ScrDB::READ; break;
+ default:
+ PRDF_ERR( "SimScomAccessor::Access() unsupported operation: 0x%X", operation );
+ break;
+ }
+ getSimServices().processCmd(i_target, bs, registerId, l_op);
+
+ } while(0);
+
+ PRDF_DEXIT("SimScomAccessor::Access()");
+
+ return rc;
+}
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H
new file mode 100755
index 000000000..48114a996
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H
@@ -0,0 +1,93 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimHomRegisterAccess.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 PRDFSIMHOMREGISTERACCESS_H
+#define PRDFSIMHOMREGISTERACCESS_H
+/**
+ @file prdfHomRegisterAccess.H
+ @brief Provide access to scan & scan com registers via the HOM
+*/
+
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+
+#include <prdfHomRegisterAccess.H>
+
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+
+namespace PRDF
+{
+
+class SimScomAccessor : public ScomAccessor
+{
+ public:
+
+ /**
+ * @brief ctor
+ */
+ SimScomAccessor();
+
+ /**
+ * @brief dtor
+ */
+ virtual ~SimScomAccessor();
+
+ /**
+ Access the scan com register
+ @param i_target Target to access the register
+ @param BIT_STRING_CLASS - holds data read or to write
+ @param register address
+ @param [READ|WRITE]
+ @returns [SUCCESS|FAIL]
+ @pre bs.Length() must be size of register data to read/write
+ @post For read operation, bs is modified to reflect hardware register state
+ @note
+ */
+ virtual uint32_t Access(TARGETING::TargetHandle_t i_target,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ MopRegisterAccess::Operation operation) const;
+
+
+ private:
+
+ /**
+ * @brief disable copy
+ */
+ SimScomAccessor(const SimScomAccessor &);
+
+ /**
+ * @brief disable assignment
+ */
+ SimScomAccessor & operator=(const SimScomAccessor &);
+
+};
+
+} // End namespace PRDF
+
+#endif /* PRDFSIMHOMREGISTERACCESS_H */
diff --git a/src/usr/diag/prdf/test/prdfsimMacros.H b/src/usr/diag/prdf/test/prdfsimMacros.H
new file mode 100755
index 000000000..9f342cb20
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimMacros.H
@@ -0,0 +1,52 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimMacros.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 _PRDFSIMMACROS_H
+#define _PRDFSIMMACROS_H
+
+#include "prdfsimServices.H"
+
+
+
+#define PRDS_BEGIN(__NAME__) \
+ PRDF::getSimServices().setTestName(__NAME__)
+
+#define PRDS_START_SIM() \
+ PRDF::getSimServices().startSim()
+
+#define PRDS_END() \
+ PRDF::getSimServices().endSim()
+
+#define PRDS_ERROR_ENTRY(__EPATH__, __ATTNTYPE__) \
+ PRDF::getSimServices().addAttnEntry(__EPATH__, __ATTNTYPE__)
+
+#define PRDS_EXPECTED_SIGNATURE(__EPATH__, __SIGNATURE__) \
+ PRDF::getSimServices().addSig(__EPATH__, __SIGNATURE__)
+
+#define PRDS_SCR_WRITE(__EPATH__, __ADDRESS__, __DATA__) \
+ PRDF::getSimServices().writeScr(__EPATH__, __ADDRESS__, __DATA__)
+
+#define PRDS_SCR_EXPECT(__EPATH__, __ADDRESS__, __DATA__) \
+ PRDF::getSimServices().expectScr(__EPATH__, __ADDRESS__, __DATA__)
+
+#endif /* _PRDFSIMMACROS_H */
diff --git a/src/usr/diag/prdf/test/prdfsimScrDB.C b/src/usr/diag/prdf/test/prdfsimScrDB.C
new file mode 100755
index 000000000..2b5692fc7
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimScrDB.C
@@ -0,0 +1,224 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimScrDB.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 */
+
+#include "prdfsimScrDB.H"
+#include <iipMopRegisterAccess.h>
+#include <prdfTrace.H>
+#include <prdfPlatServices.H>
+
+namespace PRDF
+{
+
+ using namespace TARGETING;
+ using namespace PlatServices;
+
+ /**
+ * @brief Returns a reference to the ScrDB singleton
+ *
+ * @return Reference to the ScrDB
+ */
+ /*
+ ScrDB& GetScrDB()
+ {
+ return PRDF_GET_SINGLETON(theScrDB);
+ }
+ */
+
+ ScrDB::ScrDB()
+ {
+ PRDF_TRAC( "ScrDB::ScrDB()" );
+ }
+
+ void ScrDB::processCmd(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ SimOp i_op)
+ {
+ //PRDF_DENTER( "ScrDB::processCmd()" );
+ switch (i_op)
+ {
+ case WRITE:
+ Write(i_ptargetHandle, bs, registerId);
+ break;
+ case READ:
+ Read(i_ptargetHandle, bs, registerId);
+ break;
+ case EXPECT:
+ Expect(i_ptargetHandle, bs, registerId);
+ break;
+ default:
+ PRDF_ERR( "ScrDB::processCmd() unsupported operation: 0x%X", i_op );
+ break;
+ }
+ //PRDF_DEXIT( "ScrDB::processCmd()" );
+ return;
+ }
+
+ void ScrDB::Read(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId)
+ {
+ //PRDF_DENTER( "ScrDB::Read() huid: 0x%X, addr: 0x%016X",
+ // getHuid(i_ptargetHandle), registerId );
+ DataList data;
+ unsigned int dataWordSize = bs.GetLength()/32;
+ dataWordSize += (bs.GetLength() % 32) ? 1 : 0;
+
+ // if the register has a predetermined value than get it
+ if(pChipset.find(i_ptargetHandle) != pChipset.end())
+ {
+ PreScrMap pscrmap = pChipset[i_ptargetHandle];
+ if(pscrmap.find(registerId) != pscrmap.end()) // we must have a predetermined value
+ {
+ SimScrDataSet pValues = pscrmap[registerId];
+ data = pValues.GetData(); // get next set of values
+ // pValues has changed - copy it back
+ pscrmap[registerId] = pValues;
+ pChipset[i_ptargetHandle] = pscrmap;
+ }
+ }
+ if(data.size() == 0) // use the last value written to this reg
+ {
+ // get a copy of the scrMap for this chip - if one does not exist it will be created
+ ScrMap scrMap = chipset[i_ptargetHandle];
+ // get a copy of the data for this address from the scrMap for this chip
+ // if data structure does not exist, it will be created, but will be empty
+ data = scrMap[registerId];
+ if(data.size() == 0) // This is the first time this register has been accessed
+ {
+ while(data.size() < dataWordSize) data.push_back(0); // zero fill
+ scrMap[registerId] = data;
+ chipset[i_ptargetHandle] = scrMap; // update the persistant copy of the scrMap
+ }
+ }
+
+ if(0 != data.size())
+ {
+ for(unsigned int i = 0; i < data.size(); ++i)
+ {
+ bs.SetFieldJustify((i*32), 32, data[i]);
+ }
+ PRDF_TRAC( "ScrDB::Read() huid: %X, addr: %016X, data: %08X %08X",
+ getHuid(i_ptargetHandle), registerId, data[0],
+ 2 == data.size() ? data[1] : 0 );
+ }
+ //PRDF_DEXIT( "ScrDB::Read()" );
+
+ }
+
+ void ScrDB::Write(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId)
+ {
+ PRDF_TRAC( "ScrDB::Write() huid: %X, addr: %016X, data: %08X %08X",
+ getHuid(i_ptargetHandle), registerId,
+ bs.GetFieldJustify(0,32), bs.GetFieldJustify(32,32) );
+
+ unsigned int dataWordSize = bs.GetLength()/32;
+ // PRDF_TRAC("dataWordSize1: %d", dataWordSize);
+ dataWordSize += (bs.GetLength() % 32) ? 1 : 0;
+ // PRDF_TRAC("dataWordSize2: %d", dataWordSize);
+ DataList data;
+
+ // parse all data given
+ data.push_back(bs.GetFieldJustify(0,32));
+ data.push_back(bs.GetFieldJustify(32,32));
+ // PRDF_TRAC("parse all data given");
+ // look for expected data
+ DataList expectedData;
+ if(eChipset.find(i_ptargetHandle) != eChipset.end())
+ {
+ PRDF_TRAC("found target");
+ PreScrMap escrmap = eChipset[i_ptargetHandle];
+ if(escrmap.find(registerId) != escrmap.end()) // we have expected data value
+ {
+ PRDF_TRAC("found scom reg");
+ SimScrDataSet eValues = escrmap[registerId];
+ expectedData = eValues.GetData(); // get next set of values
+ escrmap[registerId] = eValues;
+ eChipset[i_ptargetHandle] = escrmap;
+ }
+ }
+ if(expectedData.size() > 0)
+ {
+ if((expectedData[0] != data[0]) || (expectedData[1] != data[1]))
+ {
+ PRDF_ERR("Verify SC register: %p", i_ptargetHandle);
+ PRDF_ERR(" Address: 0x%016X", registerId);
+ PRDF_ERR("SCR write Actual : %08X %08X", data[0], data[1]);
+ PRDF_ERR("SCR write Expected: %08X %08X", expectedData[0], expectedData[1]);
+ }
+ else
+ {
+ PRDF_TRAC("Verify SC register: %p", i_ptargetHandle);
+ PRDF_TRAC(" Address: 0x%016X", registerId);
+ PRDF_TRAC("SCR write Actual: %08X %08X", data[0], data[1]);
+ }
+ }
+
+ // PRDF_TRAC("get a copy");
+ // get a copy of the scrMap for this chip - if one does not exist it will be created
+ ScrMap scrMap = chipset[i_ptargetHandle];
+
+ // PRDF_TRAC("update register value");
+ // update register value
+ scrMap[registerId] = data; // copy the supplied value to the register
+
+ // PRDF_TRAC("update the master");
+ chipset[i_ptargetHandle] = scrMap; // scrMap is only a copy so must update the master
+
+ //PRDF_EXIT( "ScrDB::Write()" );
+
+ }
+
+
+ void ScrDB::Expect(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId)
+ {
+ PRDF_TRAC( "ScrDB::Expect() huid: %X, addr: %016X, data: %08X %08X",
+ getHuid(i_ptargetHandle), registerId,
+ bs.GetFieldJustify(0,32), bs.GetFieldJustify(32,32) );
+
+ SimScrDataSet eValues;
+ DataList data;
+ // parse all data given
+ data.push_back(bs.GetFieldJustify(0,32));
+ data.push_back(bs.GetFieldJustify(32,32));
+
+ eValues.AddData(data);
+
+ // PRDF_TRAC("get a copy");
+ PreScrMap scrMap = eChipset[i_ptargetHandle]; // create/get copy of map
+
+ // PRDF_TRAC("update register value");
+ scrMap[registerId] = eValues; // Add entree
+
+ // PRDF_TRAC("update the master");
+ eChipset[i_ptargetHandle] = scrMap; // copy it back
+
+ //PRDF_EXIT( "ScrDB::Expect()" );
+
+ }
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimScrDB.H b/src/usr/diag/prdf/test/prdfsimScrDB.H
new file mode 100755
index 000000000..f977c89af
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimScrDB.H
@@ -0,0 +1,117 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimScrDB.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 PRDFSIMSCRDB_H
+#define PRDFSIMSCRDB_H
+/**
+ @file prdfsimScrDB.H
+ @brief Scr states for a simulation run
+*/
+
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+
+#include "prdfsimScrDataSet.H" // data structure typedefs & classes
+#include <prdfBitString.H>
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+
+namespace PRDF
+{
+
+ /**
+ * @brief Singleton to access the only prdfScomService
+ */
+ //class ScrDB;
+ //PRDF_DECLARE_SINGLETON(ScrDB, theScrDB);
+
+
+ /**
+ Scr DB Scan comm register simulator
+ @author Douglas Gilbert
+ */
+ class ScrDB
+ {
+ public:
+
+ enum SimOp
+ {
+ READ,
+ WRITE,
+ EXPECT,
+ MAX_OP
+ };
+
+ /**
+ Constructor
+ @param
+ @returns
+ @pre
+ @post
+ @see
+ @note
+ */
+ ScrDB();
+
+ /*
+ Destructor
+ */
+ // ~ScrDB();
+
+ // void processCmd(const std::string & cmd, std::string & response);
+ void processCmd(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ SimOp i_op);
+
+
+ private:
+
+ void Read(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId);
+ void Write(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId);
+ void Expect(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId);
+ // void Setup(std::istringstream & iss, std::string & response);
+ // void Expect(std::istringstream & iss, std::string & response);
+
+ private: // Data
+
+ ChipMap chipset;
+ PreChipMap pChipset; // of predetermined value registers
+ PreChipMap eChipset; // map of expected values
+ //std::string history;
+
+ };
+
+} // End namespace PRDF
+
+#endif /* PRDFSIMSCRDB_H */
diff --git a/src/usr/diag/prdf/test/prdfsimScrDataSet.C b/src/usr/diag/prdf/test/prdfsimScrDataSet.C
new file mode 100755
index 000000000..e5d072f1b
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimScrDataSet.C
@@ -0,0 +1,67 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimScrDataSet.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 */
+
+#include "prdfsimScrDataSet.H"
+#include <prdfTrace.H>
+
+namespace PRDF
+{
+
+SimScrDataSet::SimScrDataSet(void)
+: xIteration(0) {}
+
+DataList SimScrDataSet::GetData(void)
+{
+ DataList dl = xPile[xIteration];
+ xAccessCount[xIteration] = xAccessCount[xIteration]++;
+ ++xIteration;
+ if(xIteration == xPile.size()) xIteration = 0; // loop back when at end
+ PRDF_DTRAC( "SimScrDataSet::GetData() xIteration: %d, xPile.size(): %d, xAccessCount.size(): %d",
+ xIteration, xPile.size(), xAccessCount.size() );
+ return dl;
+}
+
+void SimScrDataSet::AddData(const DataList & dl)
+{
+ xPile.push_back(dl);
+ xAccessCount.push_back(0);
+ PRDF_DTRAC( "SimScrDataSet::AddData() xIteration: %d, xPile.size(): %d, xAccessCount.size(): %d",
+ xIteration, xPile.size(), xAccessCount.size() );
+}
+
+bool SimScrDataSet::HasNoHits()
+{
+ bool rc = false;
+ for(DataList::const_iterator hc = xAccessCount.begin();
+ hc != xAccessCount.end(); ++hc)
+ {
+ if(*hc == 0)
+ {
+ rc = true;
+ hc = xAccessCount.end()-1; // terminate loop
+ }
+ }
+ return rc;
+}
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimScrDataSet.H b/src/usr/diag/prdf/test/prdfsimScrDataSet.H
new file mode 100755
index 000000000..c80ad886b
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimScrDataSet.H
@@ -0,0 +1,82 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimScrDataSet.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 SimScrDataSet_h
+#define SimScrDataSet_h
+
+
+#include <vector>
+#include <map>
+#include <targeting/common/target.H>
+
+namespace PRDF
+{
+
+typedef TARGETING::TargetHandle_t ChipId;
+typedef uint64_t ScrAddress;
+
+typedef std::vector< unsigned int > DataList;
+typedef std::map< ScrAddress, DataList > ScrMap;
+typedef std::map< ChipId, ScrMap > ChipMap;
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+/**
+ Keeps tract of a list of vectors containing srcdata
+ @author Doug Gilbert
+*/
+class SimScrDataSet
+{
+public:
+
+ SimScrDataSet();
+ void AddData(const DataList & dl);
+
+ // GetData requires that AddData() has been called at least once
+ // (ie xPile.size() cannot be zero)
+ // Promises to return a DataList
+ // if more requests for data are made than data Given then the list will rollover
+ DataList GetData();
+
+ // query if any data in xPile has never been requested
+ bool HasNoHits();
+
+
+
+private: // functions
+private: // Data
+
+ typedef std::vector< DataList > DataPile;
+
+ unsigned int xIteration; // current iteration
+ DataPile xPile;
+ DataList xAccessCount; // number of times data has been accessed dg01
+};
+
+typedef std::map<ScrAddress, SimScrDataSet > PreScrMap;
+typedef std::map<ChipId, PreScrMap > PreChipMap;
+
+} // End namespace PRDF
+
+#endif /* SimScrDataSet_h */
diff --git a/src/usr/diag/prdf/test/prdfsimServices.C b/src/usr/diag/prdf/test/prdfsimServices.C
new file mode 100755
index 000000000..a4dd4e7e5
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimServices.C
@@ -0,0 +1,255 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimServices.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 */
+
+#include "prdfsimServices.H"
+#include <prdfPlatServices.H>
+#include <prdfMain.H>
+#include <prdfTrace.H>
+#include <iipglobl.h>
+
+#include "prdfsimUtil.H"
+#include "prdsimSignatureParser.H"
+#include "prdfsimScrDB.H"
+#include "prdfsimHomRegisterAccess.H"
+#include "prdfsim_ras_services.H"
+
+#include <targeting/common/targetservice.H>
+
+namespace PRDF
+{
+
+ using namespace TARGETING;
+ using namespace PlatServices;
+
+ /**
+ * @brief Returns a reference to the SimServices singleton
+ *
+ * @return Reference to the SimServices
+ */
+ SimServices& getSimServices()
+ {
+ return PRDF_GET_SINGLETON(theSimServices);
+ }
+
+ SimServices::SimServices()
+ {
+ reset();
+
+ ServiceGeneratorClass & serviceGenerator =
+ ServiceGeneratorClass::ThisServiceGenerator();
+ serviceGenerator.Initialize();
+
+ // overloading default prdfErrDataService
+ // will be deleted in RasServices dtor
+ SimErrDataService* l_SimErrDataService = new SimErrDataService();
+ serviceGenerator.setErrDataService(*l_SimErrDataService);
+
+ // overloading default Scom Accessor
+ // will be deleted in prdfScomService dtor
+ SimScomAccessor* l_SimScomAccessor = new SimScomAccessor();
+ getScomService().setScomAccessor(*l_SimScomAccessor);
+
+ PRDF_TRAC( "SimServices::SimServices()" );
+ }
+
+ SimServices::~SimServices()
+ {
+ //initTargeting();
+ if(true == iv_reinitTarget)
+ {
+ iv_reinitTarget = false;
+ setHwasState(iv_attnList[0].targetHndl, false);
+ errlHndl_t l_pErr = NULL;
+ //l_pErr = PRDF::initialize();
+ if (l_pErr)
+ {
+ PRDF_ERR( "prdfsimServices::~prdfsimServices(): PRDF::initialize returned error" );
+ PRDF_COMMIT_ERRL(l_pErr, ERRL_ACTION_REPORT);
+ }
+ }
+
+ iv_attnList.clear();
+
+ if(NULL != iv_ScrDB)
+ {
+ delete iv_ScrDB; iv_ScrDB = NULL;
+ }
+
+ if(NULL != iv_SimSignatureParser)
+ {
+ delete iv_SimSignatureParser; iv_SimSignatureParser = NULL;
+ }
+
+ PRDF_TRAC( "SimServices::~SimServices()" );
+ }
+
+ void SimServices::reset()
+ {
+ iv_attnList.clear();
+
+ if(NULL != iv_ScrDB) delete iv_ScrDB;
+ iv_ScrDB = new ScrDB();
+
+ if(NULL != iv_SimSignatureParser) delete iv_SimSignatureParser;
+ iv_SimSignatureParser = new SimSignatureParser();
+
+ //initTargeting();
+
+ PRDF_TRAC( "SimServices::reset()" );
+ }
+
+ void SimServices::startSim()
+ {
+ PRDF_TRAC( "SimServices::startSim() Test: %s",
+ (iv_testName ? iv_testName : "No Test Name specified"));
+
+ errlHndl_t l_pErr = NULL;
+ l_pErr = PRDF::main(iv_attnList[0].attnType, iv_attnList);
+
+ if (l_pErr)
+ {
+ PRDF_ERR( "SimServices::startSim(): PRDF::main returned error" );
+ PRDF_COMMIT_ERRL(l_pErr, ERRL_ACTION_REPORT);
+ }
+ else
+ {
+ PRDF_INF( "SimServices::startSim(): PRDF::main completed with no error" );
+ }
+ }
+
+ void SimServices::endSim()
+ {
+ summarySig();
+ PRDF_TRAC( "SimServices::endSim() Test: %s",
+ (iv_testName ? iv_testName : "No Test Name specified"));
+ }
+
+ void SimServices::addAttnEntry(const char * i_epath,
+ ATTENTION_VALUE_TYPE i_attnType)
+ {
+ AttnData l_attnEntry;
+ l_attnEntry.targetHndl = string2Target(i_epath);
+ l_attnEntry.attnType = i_attnType;
+ iv_attnList.push_back(l_attnEntry);
+
+ // If the target in sim is not functional,
+ // set to functional and destroy the PRD config
+ // so new one can be built
+ if(false == isFunctional(l_attnEntry.targetHndl))
+ {
+ iv_reinitTarget = true;
+ setHwasState(l_attnEntry.targetHndl, true);
+ errlHndl_t l_pErr = NULL;
+ //l_pErr = PRDF::initialize();
+ if (l_pErr)
+ {
+ PRDF_ERR( "prdfsimServices::addAttnEntry(): PRDF::initialize returned error" );
+ PRDF_COMMIT_ERRL(l_pErr, ERRL_ACTION_REPORT);
+ }
+ }
+ }
+
+ void SimServices::writeScr(const char * i_epath,
+ uint64_t i_address,
+ uint64_t i_data)
+ {
+ TARGETING::Target* l_ptargetHandle = string2Target(i_epath);
+ CPU_WORD l_cpuWord[(64)/(sizeof(CPU_WORD)*8)] = {0};
+ BIT_STRING_CLASS l_bs(64, l_cpuWord);
+ l_bs.SetFieldJustify(0, 32, (i_data >> 32) & 0xFFFFFFFF);
+ l_bs.SetFieldJustify(32, 32, (i_data & 0xFFFFFFFF));
+
+ iv_ScrDB->processCmd(l_ptargetHandle,
+ l_bs,
+ i_address,
+ ScrDB::WRITE);
+ }
+
+ void SimServices::expectScr(const char * i_epath,
+ uint64_t i_address,
+ uint64_t i_data)
+ {
+ TARGETING::Target* l_ptargetHandle = string2Target(i_epath);
+ CPU_WORD l_cpuWord[(64)/(sizeof(CPU_WORD)*8)] = {0};
+ BIT_STRING_CLASS l_bs(64, l_cpuWord);
+ l_bs.SetFieldJustify(0, 32, (i_data >> 32) & 0xFFFFFFFF);
+ l_bs.SetFieldJustify(32, 32, (i_data & 0xFFFFFFFF));
+
+ iv_ScrDB->processCmd(l_ptargetHandle,
+ l_bs,
+ i_address,
+ ScrDB::EXPECT);
+ }
+
+ void SimServices::processCmd(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ ScrDB::SimOp i_op)
+ {
+ iv_ScrDB->processCmd(i_ptargetHandle,
+ bs,
+ registerId,
+ i_op);
+ }
+
+ void SimServices::addSig(const char * i_epath, uint32_t i_sig)
+ {
+ TARGETING::Target* l_ptargetHandle = string2Target(i_epath);
+ uint32_t i_chip = getHuid(l_ptargetHandle);
+ iv_SimSignatureParser->Add(i_chip, i_sig);
+ }
+
+ void SimServices::reportSig(uint32_t i_chip, uint32_t i_sig)
+ {
+ iv_SimSignatureParser->Report(i_chip, i_sig);
+ }
+
+ void SimServices::summarySig()
+ {
+ iv_SimSignatureParser->Summary();
+ }
+
+ void SimServices::initTargeting()
+ {
+ //targetService().init();
+ TargetService& l_targetService = targetService();
+ TargetIterator l_pIt;
+ for( l_pIt = l_targetService.begin(); l_pIt != l_targetService.end(); l_pIt++)
+ {
+ setHwasState(*l_pIt, true);
+ }
+ }
+
+ void SimServices::setHwasState(TARGETING::TargetHandle_t i_target, bool i_functional)
+ {
+ HwasState hwasState = i_target->getAttr<ATTR_HWAS_STATE>();
+ PRDF_TRAC("[setHwasState] i_target=0x%08x, func: %d, new func: %d",
+ getHuid(i_target), hwasState.functional, i_functional);
+
+ //hwasState.poweredOn = true;
+ //hwasState.present = true;
+ hwasState.functional = i_functional;
+ i_target->setAttr<ATTR_HWAS_STATE>( hwasState );
+ }
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimServices.H b/src/usr/diag/prdf/test/prdfsimServices.H
new file mode 100755
index 000000000..6bf4f1ebb
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimServices.H
@@ -0,0 +1,111 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimServices.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 _SimServices_H
+#define _SimServices_H
+
+#include <prdfMain.H>
+#include <iipglobl.h>
+#include "prdfsimScrDB.H"
+
+namespace PRDF
+{
+
+class ScrDB;
+class SimSignatureParser;
+
+class SimServices;
+SimServices& getSimServices();
+
+class SimServices
+{
+
+ public:
+
+ SimServices();
+ ~SimServices();
+
+ void reset();
+
+ void setTestName(const char * i_testName) { iv_testName = i_testName; }
+
+ void startSim();
+
+ void endSim();
+
+ void addAttnEntry(const char * i_epath, PRDF::ATTENTION_VALUE_TYPE i_attnType);
+
+ // ScrDB functions begin ---------------------------
+ void writeScr(const char * i_epath,
+ uint64_t i_address,
+ uint64_t i_data);
+ void expectScr(const char * i_epath,
+ uint64_t i_address,
+ uint64_t i_data);
+ void processCmd(TARGETING::TargetHandle_t i_ptargetHandle,
+ BIT_STRING_CLASS & bs,
+ uint64_t registerId,
+ ScrDB::SimOp i_op);
+ // ScrDB functions end ------------------------------
+
+ // SimSignatureParser functions begin ------------
+ //void AddSig(TARGETING::EntityPath & i_path, uint32_t i_sig);
+ void addSig(const char * i_epath, uint32_t i_sig);
+ void reportSig(uint32_t i_chip, uint32_t i_sig);
+ void summarySig();
+ // SimSignatureParser functions end --------------
+
+ /**
+ * @brief Inialize and restore Targeting model functional states
+ */
+ void initTargeting();
+
+ /**
+ * @brief set i_target functional state
+ * @param[in,out] i_target - target handle to set functional state
+ * @param[in] i_functional - functional state
+ */
+ void setHwasState(TARGETING::TargetHandle_t i_target, bool i_functional);
+
+ protected:
+
+
+ private:
+
+ const char * iv_testName;
+ PRDF::AttnList iv_attnList;
+ ScrDB * iv_ScrDB;
+ SimSignatureParser * iv_SimSignatureParser;
+ bool iv_reinitTarget;
+
+};
+
+/**
+ * @brief Singleton to access the only SimServices
+ */
+class SimServices;
+PRDF_DECLARE_SINGLETON(SimServices, theSimServices);
+
+} // End namespace PRDF
+
+#endif /* _SimServices_H */
diff --git a/src/usr/diag/prdf/test/prdfsimUtil.C b/src/usr/diag/prdf/test/prdfsimUtil.C
new file mode 100755
index 000000000..2452a9cfb
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimUtil.C
@@ -0,0 +1,178 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimUtil.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 */
+
+#include <prdfsimUtil.H>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifdef __HOSTBOOT_MODULE
+ #include <string_ext.h>
+#endif
+
+namespace PRDF
+{
+
+using namespace TARGETING;
+using namespace PlatServices;
+
+struct epath_array
+{
+ const char * str;
+ EntityPath::PathElement pathE;
+};
+
+const epath_array EPATH_ARRAY_MAP[] =
+{
+ {"NODE{0}", {TYPE_NODE, 0}},
+ {"NODE{1}", {TYPE_NODE, 1}},
+ {"PROC{0}", {TYPE_PROC, 0}},
+ {"PROC{1}", {TYPE_PROC, 1}},
+ {"PROC{2}", {TYPE_PROC, 2}},
+ {"PROC{3}", {TYPE_PROC, 3}},
+ {"PROC{4}", {TYPE_PROC, 4}},
+ {"PROC{5}", {TYPE_PROC, 5}},
+ {"PROC{6}", {TYPE_PROC, 6}},
+ {"PROC{7}", {TYPE_PROC, 7}},
+ {"EX{0}", {TYPE_EX, 0}},
+ {"EX{1}", {TYPE_EX, 1}},
+ {"EX{2}", {TYPE_EX, 2}},
+ {"EX{3}", {TYPE_EX, 3}},
+ {"EX{4}", {TYPE_EX, 4}},
+ {"EX{5}", {TYPE_EX, 5}},
+ {"EX{6}", {TYPE_EX, 6}},
+ {"EX{7}", {TYPE_EX, 7}},
+ {"EX{8}", {TYPE_EX, 8}},
+ {"EX{9}", {TYPE_EX, 9}},
+ {"EX{10}", {TYPE_EX, 10}},
+ {"EX{11}", {TYPE_EX, 11}},
+ {"EX{12}", {TYPE_EX, 12}},
+ {"EX{13}", {TYPE_EX, 13}},
+ {"EX{14}", {TYPE_EX, 14}},
+ {"EX{15}", {TYPE_EX, 15}},
+ {"ABUS{0}", {TYPE_ABUS, 0}},
+ {"ABUS{1}", {TYPE_ABUS, 1}},
+ {"ABUS{2}", {TYPE_ABUS, 2}},
+ {"XBUS{0}", {TYPE_XBUS, 0}},
+ {"XBUS{1}", {TYPE_XBUS, 1}},
+ {"XBUS{2}", {TYPE_XBUS, 2}},
+ {"XBUS{3}", {TYPE_XBUS, 3}},
+ {"MCS{0}", {TYPE_MCS, 0}},
+ {"MCS{1}", {TYPE_MCS, 1}},
+ {"MCS{2}", {TYPE_MCS, 2}},
+ {"MCS{3}", {TYPE_MCS, 3}},
+ {"MCS{4}", {TYPE_MCS, 4}},
+ {"MCS{5}", {TYPE_MCS, 5}},
+ {"MCS{6}", {TYPE_MCS, 6}},
+ {"MCS{7}", {TYPE_MCS, 7}},
+ {"MEMBUF{0}", {TYPE_MEMBUF, 0}},
+ {"MEMBUF{1}", {TYPE_MEMBUF, 1}},
+ {"MEMBUF{2}", {TYPE_MEMBUF, 2}},
+ {"MEMBUF{3}", {TYPE_MEMBUF, 3}},
+ {"MEMBUF{4}", {TYPE_MEMBUF, 4}},
+ {"MEMBUF{5}", {TYPE_MEMBUF, 5}},
+ {"MEMBUF{6}", {TYPE_MEMBUF, 6}},
+ {"MEMBUF{7}", {TYPE_MEMBUF, 7}},
+ {"MBS{0}", {TYPE_MBS, 0}},
+ {"MBS{1}", {TYPE_MBS, 1}},
+ {"MBA{0}", {TYPE_MBA, 0}},
+ {"MBA{1}", {TYPE_MBA, 1}},
+};
+
+const uint64_t NUM_EPATH_ARRAY = sizeof(EPATH_ARRAY_MAP)/sizeof(EPATH_ARRAY_MAP[0]);
+
+#ifdef __HOSTBOOT_MODULE
+
+//my local version of strncmp - hostboot doesn't have this yet
+ int (strncmp)(const char *s1, const char *s2, size_t n)
+ {
+ unsigned char uc1, uc2;
+ /* Nothing to compare? Return zero. */
+ if (n == 0)
+ return 0;
+ /* Loop, comparing bytes. */
+ while (n-- > 0 && *s1 == *s2) {
+ /* If we've run out of bytes or hit a null, return zero
+ since we already know *s1 == *s2. */
+ if (n == 0 || *s1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ }
+ uc1 = (*(unsigned char *) s1);
+ uc2 = (*(unsigned char *) s2);
+ return ((uc1 < uc2) ? -1 : (uc1 > uc2));
+ }
+
+
+//my local version of strstr - hostboot doesn't have this yet
+ char *(strstr)(const char *haystack, const char *needle)
+ {
+ size_t needlelen;
+ /* Check for the null needle case. */
+ if (*needle == '\0')
+ return (char *) haystack;
+ needlelen = strlen(needle);
+ for (; (haystack = strchr(haystack, *needle)) != NULL; haystack++)
+ if (strncmp(haystack, needle, needlelen) == 0)
+ return (char *) haystack;
+ return NULL;
+ }
+
+#endif // end ifdef __HOSTBOOT_MODULE
+
+TARGETING::Target* string2Target(const char * i_str)
+{
+ TARGETING::Target* l_retTarget = NULL;
+ TARGETING::EntityPath epath(TARGETING::EntityPath::PATH_PHYSICAL);
+ epath.addLast(TARGETING::TYPE_SYS,0);
+
+ PRDF_DTRAC("prdfString2Target() i_str=%s", i_str);
+
+ for( uint64_t x = 0; x < NUM_EPATH_ARRAY; ++x )
+ {
+ const char * pch = NULL;
+ pch = strstr(i_str, EPATH_ARRAY_MAP[x].str);
+ if(NULL != pch)
+ {
+ PRDF_DTRAC("string2Target() pathE.type=0x%08x, pathE.instance=%d",
+ EPATH_ARRAY_MAP[x].pathE.type, EPATH_ARRAY_MAP[x].pathE.instance);
+ epath.addLast(EPATH_ARRAY_MAP[x].pathE.type,
+ EPATH_ARRAY_MAP[x].pathE.instance);
+ }
+ }
+
+ l_retTarget = getTarget(epath);
+
+ if ( NULL != l_retTarget )
+ {
+ PRDF_TRAC("string2Target() l_retTarget=0x%08x, epath=", getHuid(l_retTarget));
+ epath.dump();
+ }
+
+ return l_retTarget;
+}
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsimUtil.H b/src/usr/diag/prdf/test/prdfsimUtil.H
new file mode 100755
index 000000000..769728f86
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsimUtil.H
@@ -0,0 +1,38 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsimUtil.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 _PRDFSIMUTIL_H
+#define _PRDFSIMUTIL_H
+
+
+#include <prdfPlatServices.H>
+#include <prdfTrace.H>
+
+namespace PRDF
+{
+
+TARGETING::Target* string2Target(const char * i_str);
+
+} // End namespace PRDF
+
+#endif /* _PRDFSIMUTIL_H */
diff --git a/src/usr/diag/prdf/test/prdfsim_ras_services.C b/src/usr/diag/prdf/test/prdfsim_ras_services.C
new file mode 100755
index 000000000..8c1be6912
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsim_ras_services.C
@@ -0,0 +1,57 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsim_ras_services.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 */
+
+#include "prdfsim_ras_services.H"
+#include "prdfsimServices.H"
+#include "stdio.h"
+#include <targeting/common/targetservice.H>
+
+
+namespace PRDF
+{
+
+errlHndl_t SimErrDataService::GenerateSrcPfa(ATTENTION_TYPE attn_type,
+ ServiceDataCollector & i_sdc)
+
+{
+ using namespace TARGETING;
+ using namespace PlatServices;
+
+ PRDF_ENTER("SimErrDataService::GenerateSrcPfa()");
+ errlHndl_t errLog = NULL;
+
+ // call the actual ras services function
+ errLog = ErrDataService::GenerateSrcPfa(attn_type, i_sdc);
+
+ ErrorSignature * esig = i_sdc.GetErrorSignature();
+
+ // report the actual signature
+ getSimServices().reportSig(esig->getChipId(), esig->getSigId());
+
+ PRDF_EXIT("SimErrDataService::GenerateSrcPfa()");
+
+ return errLog;
+
+}
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdfsim_ras_services.H b/src/usr/diag/prdf/test/prdfsim_ras_services.H
new file mode 100755
index 000000000..bf268fba5
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdfsim_ras_services.H
@@ -0,0 +1,80 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdfsim_ras_services.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 PRDFSIM_RAS_SERVICES_H
+#define PRDFSIM_RAS_SERVICES_H
+/**
+ @file prdf_ras_services.H
+ @brief Description
+*/
+
+#include <prdf_ras_services.H>
+
+namespace PRDF
+{
+
+/**
+ Interface to RAS services provided to PRD
+*/
+class SimErrDataService: public ErrDataService
+{
+public:
+
+
+ /**
+ Default ctor
+ */
+ inline SimErrDataService() {}
+
+ /**
+ Default dtor
+ */
+ inline virtual ~SimErrDataService() {}
+
+ /**
+ Create an SRC, PFA data, and Error log for the ServiceData provided
+ <ul>
+ <br><b>Parameter: </b> attn_type (see iipsdbug.h)
+ <br><b>Parameter: </b> sdc (see iipServiceData.h)
+ <br><b>Returns: </b> Error Log - Null if successfully committed
+ <br><b>Requirements:</b> SetErrorTod()?
+ <br><b>Promises: </b> Error log(s) build and logged, SRC built, etc.
+ <br><b>Exceptions: </b> None.
+ <br><b>Notes: </b>
+ </ul><br>
+ */
+ virtual errlHndl_t GenerateSrcPfa(ATTENTION_TYPE attn_type, ServiceDataCollector & sdc);
+
+
+private: // functions
+
+
+private: // Data
+
+
+
+};
+
+} // End namespace PRDF
+
+#endif
diff --git a/src/usr/diag/prdf/test/prdsimSignatureParser.C b/src/usr/diag/prdf/test/prdsimSignatureParser.C
new file mode 100755
index 000000000..ac576daaa
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdsimSignatureParser.C
@@ -0,0 +1,217 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdsimSignatureParser.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 */
+
+#include "prdsimSignatureParser.H"
+#include <prdfTrace.H>
+
+namespace PRDF
+{
+
+static const char * STATUS_BAR = "=================================================";
+static const char * SIG_ADD = "========== PRD Signature Add ==========";
+static const char * SIG_REPORT = "========== PRD Signature Report ==========";
+static const char * SIG_SUM = "========== PRD Signature Summary ==========";
+
+/**
+ * @brief Returns a reference to the SimSignatureParser singleton
+ *
+ * @return Reference to the SimSignatureParser
+ */
+/*
+SimSignatureParser& getSimSignatureParser()
+{
+ return PRDF_GET_SINGLETON(theSimSignatureParser);
+}
+*/
+void SimSignatureParser::Add(uint32_t i_chip, uint32_t i_sig)
+//:iv_EnumMap(converter)
+{
+ PRDF_TRAC("%s", STATUS_BAR);
+ PRDF_TRAC("%s", SIG_ADD);
+ Signature signature(i_chip, i_sig);
+ expectedSigList.push_back(signature);
+ PRDF_TRAC("Error Signature : 0x%08X 0x%08X", signature.chip, signature.code);
+ PRDF_TRAC("%s", STATUS_BAR);
+}
+
+// --------------------------------------------------------------------
+
+void SimSignatureParser::Report(uint32_t i_chip, uint32_t i_sig)
+{
+ PRDF_TRAC("%s", STATUS_BAR);
+ PRDF_TRAC("%s", SIG_REPORT);
+
+ // looking for the following in errlText
+ //| PRD Signature : 0x00811DE0 0x01010004 |
+ Signature signature(i_chip,i_sig);
+ actualSigList.push_back(signature);
+ const char * passOrFail = " Failed";
+
+ if(expectedSigList.size() == 0)
+ {
+ PRDF_TRAC(" (W) No expected signature specified");
+ }
+ else
+ {
+ int thisIdx = actualSigList.size() - 1;
+ int expectedIdx = thisIdx % expectedSigList.size();
+ if(expectedSigList[expectedIdx] != actualSigList[thisIdx])
+ {
+ PRDF_ERR(" (S)FAIL! Expected 0x%08X 0x%08X", expectedSigList[expectedIdx].chip, expectedSigList[expectedIdx].code);
+ }
+ else
+ {
+ passOrFail = " Passed";
+ }
+ }
+
+ PRDF_TRAC("Error Signature : 0x%08X 0x%08X %s", signature.chip, signature.code, passOrFail);
+
+ PRDF_TRAC("Description : %s", Description(signature));
+ PRDF_TRAC("%s", STATUS_BAR);
+}
+
+const char * SimSignatureParser::Description(const Signature & signature)
+{
+ // this is already in prdfLogParse.C - Need to make it comon TODO
+ struct prdfErrorCodeDescription
+ {
+ uint32_t signature;
+ const char * description;
+ };
+
+ static prdfErrorCodeDescription l_defaultErrorCodes[] =
+ {
+ {0xFFFFFFFF, "Undefined error code" }, //this must be first
+ {0x0000DD00, "Assert failed in PRD"},
+ {0x0000DD01, "Invalid attention type passed to PRD"},
+ {0x0000DD02, "No active error bits found"},
+ {0x0000DD03, "Chip connection lookup failure"},
+ {0x0000DD05, "Internal PRD code"},
+ {0x0000DD09, "Fail to access attention data from registry"},
+ {0x0000DD11, "SRC Access failure"},
+ {0x0000DD12, "HWSV Access failure"},
+ {0x0000DD20, "Config error - no domains in system"},
+ {0x0000DD21, "No active attentions found"},
+ {0x0000DD23, "Unknown chip raised attention"},
+ {0x0000DD24, "PRD Model is not built"},
+ {0x0000DD27, "PrdRbsCallback failure"},
+ {0x0000DD28, "PrdStartScrub failure"},
+ {0x0000DD29, "PrdResoreRbs failure"},
+ {0x0000DD81, "Multiple bits on in Error Register"},
+ {0x0000DD90, "Scan comm access from Error Register failed"},
+ {0x0000DD91, "Scan comm access from Error Register failed due to Power Fault"},
+ {0x0000DDFF, "Special return code indicating Not to reset or mask FIR bits"},
+ {0x00ED0000, "PLL error"},
+ {0,NULL} // this must exist and must be last
+ };
+
+ const char * result = NULL;
+// PrdrErrSigTable & est = prdfGetErrorSigTable();
+// result = est[l_homt][signature.code];
+
+
+ if(NULL == result)
+ {
+ for(uint32_t i = 1; l_defaultErrorCodes[i].description != NULL; ++i)
+ {
+ if(0x0000DD00 == (signature.code & 0x0000FF00))
+ {
+ if(l_defaultErrorCodes[i].signature ==
+ (signature.code & 0x0000FFFF))
+ {
+ result = l_defaultErrorCodes[i].description;
+ break;
+ }
+ }
+ else
+ {
+ if(l_defaultErrorCodes[i].signature == signature.code)
+ {
+ result = l_defaultErrorCodes[i].description;
+ break;
+ }
+ }
+ }
+ }
+ if(NULL == result)
+ {
+ result = "(W) No description found";
+ }
+ return result;
+}
+
+// --------------------------------------------------------------------
+
+void SimSignatureParser::Summary(void)
+{
+ PRDF_TRAC("%s", STATUS_BAR);
+ PRDF_TRAC("%s", SIG_SUM);
+ // expected list rolls
+ bool passed = true;
+ if(expectedSigList.size() == 0)
+ {
+ PRDF_TRAC("(W) There were no expected signatures specified in the testcase");
+ }
+ else
+ {
+ passed = false;
+ int iterations = actualSigList.size();
+ for(int i = 0; i < iterations; ++i)
+ {
+ int expectedIdx = i % expectedSigList.size();
+ if(expectedSigList[expectedIdx] != actualSigList[i])
+ {
+ PRDF_ERR("(S)Iteration %d signature: 0x%08X 0x%08X",
+ i, actualSigList[i].chip, actualSigList[i].code);
+
+ PRDF_ERR(" Expected 0x%08X 0x%08X",
+ expectedSigList[expectedIdx].chip, expectedSigList[expectedIdx].code);
+
+ passed = false;
+ }
+ }
+ }
+ if(passed)
+ {
+ PRDF_TRAC("All error signatures passed (E: %d, A: %d)", expectedSigList.size(), actualSigList.size());
+ }
+ else
+ {
+ if((actualSigList.size() == 0) && expectedSigList.size() > 0)
+ {
+ PRDF_ERR("There were no actual signatures reported");
+ int iterations = expectedSigList.size();
+ for(int i = 0; i < iterations; ++i)
+ {
+ PRDF_ERR(" Expected 0x%08X 0x%08X",
+ expectedSigList[i].chip, expectedSigList[i].code);
+ }
+ }
+
+ }
+
+ PRDF_TRAC("%s", STATUS_BAR);
+}
+
+} // End namespace PRDF
diff --git a/src/usr/diag/prdf/test/prdsimSignatureParser.H b/src/usr/diag/prdf/test/prdsimSignatureParser.H
new file mode 100755
index 000000000..8360e7b88
--- /dev/null
+++ b/src/usr/diag/prdf/test/prdsimSignatureParser.H
@@ -0,0 +1,85 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/test/prdsimSignatureParser.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 SimSignatureParser_H
+#define SimSignatureParser_H
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+
+#include <vector>
+using std::vector;
+#include <stdint.h>
+
+#include <iipconst.h>
+
+namespace PRDF
+{
+
+/**
+ * @brief Singleton to access the only prdfScomService
+ */
+//class SimSignatureParser;
+//PRDF_DECLARE_SINGLETON(SimSignatureParser, theSimSignatureParser);
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+class SimSignatureParser
+{
+public:
+ SimSignatureParser() {};
+ // default dtor is ok
+ void Add(uint32_t i_chip, uint32_t i_sig);
+ void Report(uint32_t i_chip, uint32_t i_sig);
+ void Summary();
+
+
+ class Signature
+ {
+ public:
+ Signature(uint32_t ichip = 0, uint32_t icode = 0) : chip(ichip), code(icode) {}
+ PRDF::HUID chip;
+ uint32_t code;
+ bool operator!=(const Signature & rsig)
+ { return (chip != rsig.chip)||(code != rsig.code); }
+
+ };
+
+private: // functions
+
+ const char * Description(const Signature & signature);
+
+private: // Data
+
+ typedef vector<Signature> SignatureList;
+
+ SignatureList expectedSigList;
+ SignatureList actualSigList;
+// EnumMap & iv_EnumMap;
+};
+
+} // End namespace PRDF
+
+#endif /* SimSignatureParser_H */
OpenPOWER on IntegriCloud