diff options
-rw-r--r-- | src/include/usr/diag/mdia/mdia.H | 68 | ||||
-rw-r--r-- | src/include/usr/initservice/initsvcreasoncodes.H | 1 | ||||
-rw-r--r-- | src/makefile | 5 | ||||
-rw-r--r-- | src/usr/diag/makefile | 27 | ||||
-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 | ||||
-rw-r--r-- | src/usr/initservice/extinitsvc/extinitsvctasks.H | 14 | ||||
-rw-r--r-- | src/usr/makefile | 2 |
15 files changed, 696 insertions, 3 deletions
diff --git a/src/include/usr/diag/mdia/mdia.H b/src/include/usr/diag/mdia/mdia.H new file mode 100644 index 000000000..2cc587604 --- /dev/null +++ b/src/include/usr/diag/mdia/mdia.H @@ -0,0 +1,68 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/diag/mdia/mdia.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_MDIA_H +#define __MDIA_MDIA_H + +#include <errl/errlentry.H> + +/** + * @file mdia.H + * @brief mdia component interface + */ + +class PrdfMdiaMessage; + +namespace MDIA +{ +/** + * @brief runStep istep dispatcher entry point. + * + * execute the memory diagnostics ipl step + * + * @return errlHndl_t. Error log handle. + * @retval 0 no errors + * @retval !0 error occurred + * + * @pre memory ready to hold data, node free of attentions + * @post memory tested and initialized, ready to hold data + */ +errlHndl_t runStep(); + +/** + * @brief processEvent prd callback + * + * called by prd to inform memory diagnostics of attention + * related events like maint command complete or hw error. + * + * @param[in] i_event prd attention event to be processed + * + * @return errlHndl_t. Error log handle. + * @retval 0 no errors + * @retval !0 error occurred + * + * @pre memory diagnostics ipl step in progress + * @post message processed + */ +errlHndl_t processEvent(PrdfMdiaMessage & i_event); +} +#endif diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 9d15c5ef3..6529e276b 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -68,6 +68,7 @@ enum InitServiceModuleID START_FAPIPOREVE_ERRL_ID = 0x1C, START_POREVE_ERRL_ID = 0x1D, START_UTIL_ERRL_ID = 0x1E, + START_MDIA_ERRL_ID = 0x1F, // Internal InitService codes INITSVC_START_TASK_MOD_ID = 0x20, diff --git a/src/makefile b/src/makefile index f6738efad..df1747fbc 100644 --- a/src/makefile +++ b/src/makefile @@ -54,7 +54,8 @@ BASE_MODULES = trace errl devicefw scom xscom initservice taskargs \ EXTENDED_MODULES = targeting ecmddatabuffer fapi hwp plat \ extinitsvc istepdisp hwas fsi fsiscom i2c intr \ spd dmi_training fapiporeve poreve util \ - sbe_centaur_init mc_init dram_training + sbe_centaur_init mc_init dram_training \ + mdia DIRECT_BOOT_MODULES = example RUNTIME_MODULES = @@ -63,7 +64,7 @@ TESTCASE_MODULES = cxxtest testerrl testdevicefw testsyslib \ testscom testxscom testtargeting testinitservice testkernel \ testhwpf testecmddatabuffer initsvctasktest2 testcxxtest \ testpnor testi2c testfsi testvfs testhwas testintr testspd \ - testpore testutil testmbox + testpore testutil testmbox testmdia RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic diff --git a/src/usr/diag/makefile b/src/usr/diag/makefile new file mode 100644 index 000000000..118391c9e --- /dev/null +++ b/src/usr/diag/makefile @@ -0,0 +1,27 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/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 = ../../.. + +SUBDIRS = mdia.d + +include ${ROOTPATH}/config.mk 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 diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index c84627cdb..1360c9d5d 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -232,6 +232,20 @@ const TaskInfo g_exttaskinfolist[] = { START_POREVE_ERRL_ID // module id } }, + + /** + * @brief MDIA code library + */ + { + "libmdia.so" , // taskname + NULL, // no pointer to fn + { + INIT_TASK, // task type + EXT_IMAGE, // Extended Module + START_MDIA_ERRL_ID // module id + } + }, + // end TODO. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/usr/makefile b/src/usr/makefile index 4737ffd6e..02f209082 100644 --- a/src/usr/makefile +++ b/src/usr/makefile @@ -27,6 +27,6 @@ OBJS = module_init.o SUBDIRS = example.d trace.d cxxtest.d testcore.d errl.d devicefw.d \ scom.d xscom.d targeting.d initservice.d hwpf.d \ ecmddatabuffer.d pnor.d i2c.d vfs.d fsi.d hwas.d fsiscom.d \ - intr.d spd.d pore.d util.d mbox.d + intr.d spd.d pore.d util.d mbox.d diag.d include ${ROOTPATH}/config.mk |