summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@us.ibm.com>2012-03-21 15:56:09 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-24 09:44:54 -0500
commitf4e49418fd0743ab0d143f0ab3c505baefe58bfa (patch)
tree9301803411743f6e31bd4617e76ea54376c58f54
parent5ac7921a5f77d7d33e7cc86f91522de4751f98b0 (diff)
downloadtalos-hostboot-f4e49418fd0743ab0d143f0ab3c505baefe58bfa.tar.gz
talos-hostboot-f4e49418fd0743ab0d143f0ab3c505baefe58bfa.zip
Initial memory diagnostics entry point support.
This is a first take at the memory diagnostics entry point function; the function called by the istep dispatcher. Change-Id: Id99b05e13dd723cea574e993a3cfc6e298f475b8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/784 Tested-by: Jenkins Server Reviewed-by: LARINA M. DSOUZA <larsouza@in.ibm.com> Reviewed-by: Zane Shelley <zshelle@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/diag/mdia/mdia.H8
-rw-r--r--src/usr/diag/mdia/makefile2
-rw-r--r--src/usr/diag/mdia/mdia.C89
-rw-r--r--src/usr/diag/mdia/mdiafwd.H58
-rw-r--r--src/usr/diag/mdia/mdiaglobals.H53
-rw-r--r--src/usr/diag/mdia/mdiamba.C115
-rw-r--r--src/usr/diag/mdia/test/mdiatest.H71
-rw-r--r--src/usr/diag/mdia/test/mdiatestmba.H123
8 files changed, 515 insertions, 4 deletions
diff --git a/src/include/usr/diag/mdia/mdia.H b/src/include/usr/diag/mdia/mdia.H
index 2cc587604..45543d524 100644
--- a/src/include/usr/diag/mdia/mdia.H
+++ b/src/include/usr/diag/mdia/mdia.H
@@ -24,6 +24,7 @@
#define __MDIA_MDIA_H
#include <errl/errlentry.H>
+#include <targeting/target.H>
/**
* @file mdia.H
@@ -37,7 +38,10 @@ namespace MDIA
/**
* @brief runStep istep dispatcher entry point.
*
- * execute the memory diagnostics ipl step
+ * execute the memory diagnostics ipl step on a single mba
+ * or a list of mbas
+ *
+ * @param[in] i_targetList the targets on which to run diagnostics
*
* @return errlHndl_t. Error log handle.
* @retval 0 no errors
@@ -46,7 +50,7 @@ namespace MDIA
* @pre memory ready to hold data, node free of attentions
* @post memory tested and initialized, ready to hold data
*/
-errlHndl_t runStep();
+errlHndl_t runStep(const TARGETING::TargetHandleList & i_targetList);
/**
* @brief processEvent prd callback
diff --git a/src/usr/diag/mdia/makefile b/src/usr/diag/mdia/makefile
index 1cd9e0dc2..23e4e95a6 100644
--- a/src/usr/diag/mdia/makefile
+++ b/src/usr/diag/mdia/makefile
@@ -26,7 +26,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag
MODULE = mdia
-OBJS = mdiamonitor.o mdiatrace.o mdiaworkitem.o
+OBJS = mdiamonitor.o mdiatrace.o mdiaworkitem.o mdiamba.o mdia.o
SUBDIRS = test.d
diff --git a/src/usr/diag/mdia/mdia.C b/src/usr/diag/mdia/mdia.C
new file mode 100644
index 000000000..93fc2bcbd
--- /dev/null
+++ b/src/usr/diag/mdia/mdia.C
@@ -0,0 +1,89 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/diag/mdia/mdia.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 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 mdia.C
+ * @brief mdia entry points, utility function implementations
+ */
+
+#include "mdiafwd.H"
+#include "mdiaglobals.H"
+#include "mdiatrace.H"
+
+using namespace TARGETING;
+
+namespace MDIA
+{
+
+errlHndl_t runStep(const TargetHandleList & i_targetList)
+{
+ MDIA_FAST("memory diagnostics entry (runStep)");
+
+ // memory diagnostics ipl step entry point
+
+ errlHndl_t err = 0;
+
+ Globals globals;
+
+ // get the workflow for each target mba passed in.
+ // associate each workflow with the target handle.
+
+ WorkFlowAssocList list;
+
+ TargetHandleList::const_iterator tit;
+ DiagMode mode;
+
+ for(tit = i_targetList.begin(); tit != i_targetList.end(); ++tit)
+ {
+ err = getMbaDiagnosticMode(globals, *tit, mode);
+
+ if(err)
+ {
+ break;
+ }
+
+ err = getMbaWorkFlow(mode, list[*tit]);
+
+ if(err)
+ {
+ break;
+ }
+ }
+
+ if(!err)
+ {
+ // TODO...run the workflow through the state machine
+ }
+
+ // ensure threads and pools are shutdown when finished
+
+ doStepCleanup(globals);
+
+ return err;
+}
+
+void doStepCleanup(const Globals & i_globals)
+{
+ // TODO ... stop the state machine
+ // TODO ... stop the command monitor
+}
+}
diff --git a/src/usr/diag/mdia/mdiafwd.H b/src/usr/diag/mdia/mdiafwd.H
index 8763dbcd2..ad4126bb9 100644
--- a/src/usr/diag/mdia/mdiafwd.H
+++ b/src/usr/diag/mdia/mdiafwd.H
@@ -30,7 +30,8 @@
#include <mdia/mdia.H>
#include <targeting/target.H>
-
+#include <vector>
+#include <map>
/**
* @brief forwards
*/
@@ -39,8 +40,12 @@ class MdiaCommandMonitorTest;
namespace MDIA
{
+/**
+ * forwards
+ */
class StateMachine;
class WorkItem;
+struct Globals;
/**
* @brief work flow phases
@@ -99,5 +104,56 @@ enum WorkFlowStatus
*/
COMPLETE,
};
+
+/**
+* @brief Workflow container of workflow phases
+*/
+typedef std::vector<WorkFlowPhase> WorkFlow;
+
+/**
+* @brief WorkflowAssocList target / workflow association list
+*/
+typedef std::map<TARGETING::TargetHandle_t, WorkFlow> WorkFlowAssocList;
+
+/**
+* @brief WorkflowAssoc target / workflow association list element
+*/
+typedef std::map<TARGETING::TargetHandle_t, WorkFlow>::const_iterator WorkFlowAssoc;
+
+/**
+ * @brief getMbaDiagnosticMode get the mode (scrub, init, one, four, nine)
+ *
+ * @param[in] i_globals policy flags needed to determine the mode
+ * @param[in] i_target the mba target for which the mode is determined
+ * @param[out] o_mode the mode for the target mba
+ *
+ * @retval 0 no error
+ * @retval !0 unexpected error occurred
+ */
+errlHndl_t getMbaDiagnosticMode(
+ const Globals & i_globals,
+ TARGETING::TargetHandle_t i_mba,
+ DiagMode & o_mode);
+
+/**
+ * @brief getMbaWorkFlow get the workflow for an mba target
+ *
+ * @param[in] i_mode the diagnostic mode for the target
+ * @param[out] o_wf the workflow for the mba target
+ *
+ * @retval 0 no error
+ * @retval !0 unexpected error occurred
+ */
+errlHndl_t getMbaWorkFlow(
+ DiagMode i_mode,
+ WorkFlow & o_wf);
+
+/**
+ * @brief doStepCleanup shut down threads and pools on step exit
+ *
+ * @param[in] i_globals contains objects to be cleaned up
+ */
+void doStepCleanup(const Globals & i_globals);
+
}
#endif
diff --git a/src/usr/diag/mdia/mdiaglobals.H b/src/usr/diag/mdia/mdiaglobals.H
new file mode 100644
index 000000000..84fc39035
--- /dev/null
+++ b/src/usr/diag/mdia/mdiaglobals.H
@@ -0,0 +1,53 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/diag/mdia/mdiaglobals.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
+#ifndef __MDIA__MDIAGLOBALS_H
+#define __MDIA__MDIAGLOBALS_H
+
+/**
+ * @file mdiaglobals.H
+ * @brief memory diagnostics global variables
+ */
+
+#include "mdiafwd.H"
+#include <stdint.h>
+
+namespace MDIA
+{
+
+/**
+ * @brief memory diagnostics step global variables
+ */
+struct Globals
+{
+ /**
+ * @brief policy flags
+ */
+ uint64_t mfgPolicy;
+
+ /**
+ * @brief user interface policy
+ */
+ uint64_t userPolicy;
+};
+}
+#endif
diff --git a/src/usr/diag/mdia/mdiamba.C b/src/usr/diag/mdia/mdiamba.C
new file mode 100644
index 000000000..02533761c
--- /dev/null
+++ b/src/usr/diag/mdia/mdiamba.C
@@ -0,0 +1,115 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/diag/mdia/mdiamba.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 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 mdiamba.C
+ * @brief mdia mba specific functions
+ */
+
+#include "mdiafwd.H"
+#include "mdiaglobals.H"
+
+using namespace TARGETING;
+
+namespace MDIA
+{
+
+errlHndl_t getMbaDiagnosticMode(
+ const Globals & i_globals,
+ TargetHandle_t i_mba,
+ DiagMode & o_mode)
+{
+ // TODO ... stubbed
+
+ // make hardware changed service queries here...
+
+ // check mfg / user / system policy here...
+
+ o_mode = INIT_ONLY;
+
+ return 0;
+}
+
+errlHndl_t getMbaWorkFlow(DiagMode i_mode, WorkFlow & o_wf)
+{
+ // add the correct sequences for the mba based
+ // on the mode
+
+ // poplulate mba properties first
+
+ o_wf.push_back(POPULATE_MBA_PROPERTIES);
+
+ // every mba does restore dram repairs
+
+ o_wf.push_back(RESTORE_DRAM_REPAIRS);
+
+ switch (i_mode) {
+
+ case NINE_PATTERNS:
+
+ o_wf.push_back(START_PATTERN_8);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_7);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_6);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_5);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_4);
+ o_wf.push_back(START_SCRUB);
+
+ // fall through
+
+ case FOUR_PATTERNS:
+
+ o_wf.push_back(START_PATTERN_3);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_2);
+ o_wf.push_back(START_SCRUB);
+ o_wf.push_back(START_PATTERN_1);
+ o_wf.push_back(START_SCRUB);
+
+ // fall through
+
+ case ONE_PATTERN:
+
+ o_wf.push_back(START_PATTERN_0);
+
+ // fall through
+
+ case SCRUB_ONLY:
+
+ o_wf.push_back(START_SCRUB);
+ break;
+
+ case INIT_ONLY:
+
+ o_wf.push_back(START_PATTERN_0);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+}
diff --git a/src/usr/diag/mdia/test/mdiatest.H b/src/usr/diag/mdia/test/mdiatest.H
new file mode 100644
index 000000000..8fa3f5d37
--- /dev/null
+++ b/src/usr/diag/mdia/test/mdiatest.H
@@ -0,0 +1,71 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/diag/mdia/test/mdiatest.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
+#ifndef __TEST_MDIATESTMDIA_H
+#define __TEST_MDIATESTMDIA_H
+
+/**
+ * @file mdiatestmdia.H
+ * @brief mdia.C unit tests
+ */
+
+#include <builtins.h>
+#include <cxxtest/TestSuite.H>
+#include <targeting/target.H>
+#include "../mdiafwd.H"
+
+class MdiaTest : public CxxTest::TestSuite
+{
+ public:
+
+ void testRunStep(void)
+ {
+ using namespace MDIA;
+ using namespace TARGETING;
+
+ TS_TRACE(ENTER_MRK "testRunStep");
+
+ TargetHandleList list;
+
+ TS_TRACE(ENTER_MRK "checkpoint");
+ errlHndl_t err = runStep(list);
+
+ if(err)
+ {
+ TS_FAIL("getMbaDiagnosticMode failed unexpectedly");
+ }
+
+ TargetHandle_t target = 0;
+
+ list.push_back(target);
+
+ err = runStep(list);
+
+ if(err)
+ {
+ TS_FAIL("getMbaDiagnosticMode failed unexpectedly");
+ }
+
+ TS_TRACE(EXIT_MRK "testRunStep");
+ }
+};
+#endif
diff --git a/src/usr/diag/mdia/test/mdiatestmba.H b/src/usr/diag/mdia/test/mdiatestmba.H
new file mode 100644
index 000000000..c8b5a80ff
--- /dev/null
+++ b/src/usr/diag/mdia/test/mdiatestmba.H
@@ -0,0 +1,123 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/diag/mdia/test/mdiatestmba.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
+#ifndef __TEST_MDIATESTMBA_H
+#define __TEST_MDIATESTMBA_H
+
+/**
+ * @file mdiatestmba.H
+ * @brief mdiamba unit tests
+ */
+
+#include <builtins.h>
+#include <cxxtest/TestSuite.H>
+#include <targeting/target.H>
+#include "../mdiafwd.H"
+#include "../mdiaglobals.H"
+
+class MdiaMbaTest : public CxxTest::TestSuite
+{
+ public:
+
+ void testGetMbaDiagnosticMode(void)
+ {
+ using namespace MDIA;
+ using namespace TARGETING;
+
+ TS_TRACE(ENTER_MRK "testGetMbaDiagnosticMode");
+
+ DiagMode mode;
+ Globals globals;
+ TargetHandle_t mba = 0;
+
+ errlHndl_t err = getMbaDiagnosticMode(
+ globals, mba, mode);
+
+ if(err)
+ {
+ TS_FAIL("getMbaDiagnosticMode failed unexpectedly");
+ }
+
+ if(mode != INIT_ONLY)
+ {
+ TS_FAIL("mode != INIT_ONLY");
+ }
+
+ TS_TRACE(EXIT_MRK "testGetMbaDiagnosticMode");
+ }
+
+ void testGetMbaWorkFlow(void)
+ {
+ using namespace MDIA;
+ using namespace TARGETING;
+
+ TS_TRACE(ENTER_MRK "testGetMbaWorkFlow");
+
+ Globals globals;
+ TargetHandle_t mba = 0;
+ DiagMode mode;
+
+ errlHndl_t err = getMbaDiagnosticMode(
+ globals, mba, mode);
+
+ if(err)
+ {
+ TS_FAIL("getMbaDiagnosticMode failed unexpectedly");
+ }
+
+ if(mode != INIT_ONLY)
+ {
+ TS_FAIL("mode != INIT_ONLY");
+ }
+
+ WorkFlow wf, expected;
+
+ expected.push_back(POPULATE_MBA_PROPERTIES);
+ expected.push_back(RESTORE_DRAM_REPAIRS);
+ expected.push_back(START_PATTERN_0);
+
+ err = getMbaWorkFlow(mode, wf);
+
+ if(err)
+ {
+ TS_FAIL("getMbaWorkFlow failed unexpectedly");
+ }
+
+ if(wf.size() != expected.size())
+ {
+ TS_FAIL("incorrect workflow size for init only mode");
+ }
+
+ int64_t index = wf.size();
+
+ while(index-- != 0)
+ {
+ if(wf[index] != expected[index])
+ {
+ TS_FAIL("workflow entry incorrect or out of order");
+ }
+ }
+
+ TS_TRACE(EXIT_MRK "testGetMbaWorkFlow");
+ }
+};
+#endif
OpenPOWER on IntegriCloud