diff options
author | Brad Bishop <bradleyb@us.ibm.com> | 2012-03-13 13:53:53 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-03-19 10:57:31 -0500 |
commit | 4bd432b988c1fe06c835bc6a4e4f901e136c30e7 (patch) | |
tree | 7ce43242b1691151c334891358da7f0a6fb835ba /src/usr/diag/mdia | |
parent | f1760e04ceab564f8cef0c8d267bece75cce116c (diff) | |
download | talos-hostboot-4bd432b988c1fe06c835bc6a4e4f901e136c30e7.tar.gz talos-hostboot-4bd432b988c1fe06c835bc6a4e4f901e136c30e7.zip |
initial mdia commit. directories, makefiles, workitem
Change-Id: Ic48a13935bfea72def5cdc63db3a93bb659ded30
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/751
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/diag/mdia')
-rw-r--r-- | src/usr/diag/mdia/makefile | 33 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiafwd.H | 102 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiasm.H | 74 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiatrace.C | 37 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiatrace.H | 46 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiaworkitem.C | 77 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiaworkitem.H | 116 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/makefile | 31 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/mdiatestworkitem.H | 66 |
9 files changed, 582 insertions, 0 deletions
diff --git a/src/usr/diag/mdia/makefile b/src/usr/diag/mdia/makefile new file mode 100644 index 000000000..23600acf1 --- /dev/null +++ b/src/usr/diag/mdia/makefile @@ -0,0 +1,33 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/mdia/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 +ROOTPATH = ../../../.. + +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag + +MODULE = mdia + +OBJS = mdiatrace.o mdiaworkitem.o + +SUBDIRS = test.d + +include ${ROOTPATH}/config.mk diff --git a/src/usr/diag/mdia/mdiafwd.H b/src/usr/diag/mdia/mdiafwd.H new file mode 100644 index 000000000..bb7efb98a --- /dev/null +++ b/src/usr/diag/mdia/mdiafwd.H @@ -0,0 +1,102 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiafwd.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_MDIAFWD_H +#define __MDIA_MDIAFWD_H + +/** + * @file mdiafwd.H + * @brief internal mdia declarations + */ + +#include <mdia/mdia.H> +#include <targeting/target.H> + +/** + * @brief forwards + */ + +namespace MDIA +{ + +class StateMachine; +class WorkItem; + +/** + * @brief work flow phases + */ +enum WorkFlowPhase +{ + POPULATE_MBA_PROPERTIES, + RESTORE_DRAM_REPAIRS, + START_PATTERN_0, + START_PATTERN_1, + START_PATTERN_2, + START_PATTERN_3, + START_PATTERN_4, + START_PATTERN_5, + START_PATTERN_6, + START_PATTERN_7, + START_PATTERN_8, + START_SCRUB, + PROCESS_ATTENTION, +}; + +/** + * @brief per mba diagnostic mode + */ +enum DiagMode +{ + INIT_ONLY, + SCRUB_ONLY, + ONE_PATTERN, + FOUR_PATTERNS, + NINE_PATTERNS, +}; + +/** + * @brief workflow status + */ +enum WorkFlowStatus +{ + /** + * @brief workflow in progress or hasn't started yet + */ + IN_PROGRESS, + + /** + * @brief indicates workflow stopped because a maint command timed out + */ + COMMAND_TIMED_OUT, + + /** + * @brief indicates workflow stopped because of a failure + */ + FAILED, + + /** + * @brief workflow finished + */ + COMPLETE, +}; +} +#endif diff --git a/src/usr/diag/mdia/mdiasm.H b/src/usr/diag/mdia/mdiasm.H new file mode 100644 index 000000000..b320f72f6 --- /dev/null +++ b/src/usr/diag/mdia/mdiasm.H @@ -0,0 +1,74 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiasm.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_MDIASM_H +#define __MDIA_MDIASM_H + +/** + * @file mdiasm.H + * @brief mdia state machine definition + */ + +#include "mdiafwd.H" + +namespace MDIA +{ + +/** + * @brief memory diagnostics step state machine + */ +class StateMachine +{ + public: + + /** + * @brief work item entry point for threadpool + * + * @param[in] i_target work item target + * @param[in] i_phase work item phase + */ + void executeWorkItem(TARGETING::TargetHandle_t i_target, WorkFlowPhase i_phase) {} + + /** + * @brief ctor + */ + StateMachine() {} + + /** + * @brief dtor + */ + ~StateMachine() {} + + private: + + /** + * @brief copy disabled + */ + StateMachine(const StateMachine &); + + /** + * @brief assignment disabled + */ + StateMachine & operator=(const StateMachine &); +}; +} +#endif diff --git a/src/usr/diag/mdia/mdiatrace.C b/src/usr/diag/mdia/mdiatrace.C new file mode 100644 index 000000000..474b33e6d --- /dev/null +++ b/src/usr/diag/mdia/mdiatrace.C @@ -0,0 +1,37 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiatrace.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 mdiatrace.C + * @brief mdia trace descriptors + */ + +#include "mdiatrace.H" + +namespace MDIA +{ + +trace_desc_t * fastTd = 0, * slowTd = 0; + +TRAC_INIT(&fastTd, "MDIA_FAST", 4096); +TRAC_INIT(&slowTd, "MDIA_SLOW", 4096); +} diff --git a/src/usr/diag/mdia/mdiatrace.H b/src/usr/diag/mdia/mdiatrace.H new file mode 100644 index 000000000..a31ecaace --- /dev/null +++ b/src/usr/diag/mdia/mdiatrace.H @@ -0,0 +1,46 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiatrace.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_MDIATRACE_H +#define __MDIA_MDIATRACE_H + +/** + * @file mdiatrace.H + * @brief mdia trace macros + */ + +#include <trace/interface.H> + +namespace MDIA +{ + +extern trace_desc_t * fastTd; +extern trace_desc_t * slowTd; + +} + +#define MDIA_DBG( _fmt_, _args_...) TRACDCOMP( MDIA::fastTd, INFO_MRK" %s: "_fmt_, ##_args_) +#define MDIA_FAST( _fmt_, _args_...) TRACFCOMP( MDIA::fastTd, INFO_MRK" %s: "_fmt_, ##_args_) +#define MDIA_SLOW( _fmt_, _args_...) TRACFCOMP( MDIA::slowTd, INFO_MRK" %s: "_fmt_, ##_args_) +#define MDIA_ERR( _fmt_, _args_...) TRACFCOMP( MDIA::slowTd, ERR_MRK" %s: "_fmt_, ##_args_) + +#endif diff --git a/src/usr/diag/mdia/mdiaworkitem.C b/src/usr/diag/mdia/mdiaworkitem.C new file mode 100644 index 000000000..d2b59e641 --- /dev/null +++ b/src/usr/diag/mdia/mdiaworkitem.C @@ -0,0 +1,77 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiaworkitem.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 mdiaworkitem.C + * @brief threadpool workitem implementation + */ + +#include "mdiaworkitem.H" +#include "mdiasm.H" +#include "mdiatrace.H" + +using namespace TARGETING; + +namespace MDIA +{ + +void WorkItem::operator()() +{ + MDIA_FAST("executing workitem: %d", iv_workFlowPhase); + + iv_sm.executeWorkItem(iv_target, iv_workFlowPhase); +} + +int32_t WorkItem::compare(const WorkItem & i_r) const +{ + // schedule based on state machine computed priority + + if(i_r.iv_priority < iv_priority) + { + return -1; + } + + if(iv_priority < i_r.iv_priority) + { + return 1; + } + + // if the state machine computed priority is the same, + // give higher priority to mbas on different dmi busses + + // TODO + + return 0; +} + +WorkItem::WorkItem(StateMachine & i_sm, + WorkFlowPhase i_workFlowPhase, + TargetHandle_t i_target, + uint32_t i_priority) : + iv_sm(i_sm), + iv_workFlowPhase(i_workFlowPhase), + iv_target(i_target), + iv_priority(i_priority) +{ + +} +} diff --git a/src/usr/diag/mdia/mdiaworkitem.H b/src/usr/diag/mdia/mdiaworkitem.H new file mode 100644 index 000000000..7332ccaf7 --- /dev/null +++ b/src/usr/diag/mdia/mdiaworkitem.H @@ -0,0 +1,116 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/mdiaworkitem.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_MDIAWORKITEM_H +#define __MDIA_MDIAWORKITEM_H + +/** + * @file mdiaworkitem.H + * @brief threadpool workitem definition + */ + +#include <stdint.h> +#include "mdiafwd.H" + +namespace MDIA +{ + +/** + * @brief mdia work item + */ +class WorkItem +{ + public: + + /** + * @brief task function, called by threadpool + */ + void operator()(); + + /** + * @brief work item comparison + * @param[in] i_rhs external work item to compare to + * + * @retval -1 this < i_rhs + * @retval 1 i_rhs < this + * @retval 0 i_rhs !< this && this !< i_rhs + */ + int32_t compare(const WorkItem & i_rhs) const; + + /** + * @brief ctor + * + * work items with higher i_priority are executed before + * work items with lower i_priority + * + * @param[in] i_sm state machine to forward call to + * @param[in] i_phase work item phase + * @param[in] i_target work item target + * @param[in] i_priority work item priority + */ + WorkItem(StateMachine & i_sm, WorkFlowPhase i_phase, + TARGETING::TargetHandle_t i_target, uint32_t i_priority); + + private: + + /** + * @brief state machine reference + */ + StateMachine & iv_sm; + + /** + * @brief where the work item is in the state machine + */ + WorkFlowPhase iv_workFlowPhase; + + /** + * @brief the scope of the work item + */ + TARGETING::TargetHandle_t iv_target; + + /** + * @brief the scheduling priority for the work item + */ + uint32_t iv_priority; + + /** + * @brief copy disabled + */ + WorkItem(const WorkItem &); + + /** + * @brief assignment disabled + */ + WorkItem & operator=(const WorkItem &); +}; + +/** + * @brief comparison operator + * @param[in] i_l left hand side + * @param[in] i_r right hand side + */ +inline bool operator<(const WorkItem & i_l, const WorkItem & i_r) +{ + return i_l.compare(i_r) < 0; +} +} +#endif diff --git a/src/usr/diag/mdia/test/makefile b/src/usr/diag/mdia/test/makefile new file mode 100644 index 000000000..75b6f0a64 --- /dev/null +++ b/src/usr/diag/mdia/test/makefile @@ -0,0 +1,31 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/mdia/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 +ROOTPATH = ../../../../.. + +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag + +MODULE = testmdia + +TESTS = *.H + +include ${ROOTPATH}/config.mk diff --git a/src/usr/diag/mdia/test/mdiatestworkitem.H b/src/usr/diag/mdia/test/mdiatestworkitem.H new file mode 100644 index 000000000..6b86dcd67 --- /dev/null +++ b/src/usr/diag/mdia/test/mdiatestworkitem.H @@ -0,0 +1,66 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/diag/mdia/test/mdiatestworkitem.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_MDIATESTWORKITEM_H +#define __TEST_MDIATESTWORKITEM_H + +/** + * @file mdiatestworkitem.H + * @brief work item unit test + */ + +#include <builtins.h> +#include <cxxtest/TestSuite.H> +#include <targeting/target.H> +#include "../mdiaworkitem.H" +#include "../mdiasm.H" + +class MdiaWorkItemTest : public CxxTest::TestSuite +{ + public: + + void testWorkItem(void) + { + using namespace MDIA; + using namespace TARGETING; + + TS_TRACE(ENTER_MRK __FUNCTION__); + + StateMachine s; + + TargetHandle_t target = 0; + + WorkItem wi1(s, START_SCRUB, target, 2222), + wi2(s, START_SCRUB, target, 1111); + + if(wi2 < wi1) { + TS_FAIL("wi2 < wi1"); + } + + if(!(wi1 < wi2)) { + TS_FAIL("wi1 !< wi2"); + } + + TS_TRACE(EXIT_MRK __FUNCTION__); + } +}; +#endif |