diff options
author | Brad Bishop <bradleyb@us.ibm.com> | 2012-09-11 18:06:06 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-09-25 15:22:24 -0500 |
commit | caa52e035ffdba58b466936529909bad95daa30f (patch) | |
tree | 924e4c9995b19af3565762c8c2d6c6a446d6d670 /src/usr/diag/mdia | |
parent | b774951391c00a3590a8e93c2b8a612b78dd94aa (diff) | |
download | talos-hostboot-caa52e035ffdba58b466936529909bad95daa30f.tar.gz talos-hostboot-caa52e035ffdba58b466936529909bad95daa30f.zip |
Make use of random init and scrub support.
Call increment address, random init and scrub hwp.
Removed a couple TODOs.
Use FAPI macros for invoking hwp.
Change-Id: I2a6c88c24d626d5fdc5e85eaa18d60b9d1c24f87
RTC: 46187
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1722
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/mdiafwd.H | 66 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiamba.C | 47 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiasm.C | 217 | ||||
-rw-r--r-- | src/usr/diag/mdia/mdiasm.H | 21 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/makefile | 12 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/mdiafakesm.C | 3 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/mdiatestmba.H | 45 | ||||
-rw-r--r-- | src/usr/diag/mdia/test/mdiatestsm.H | 1 |
8 files changed, 219 insertions, 193 deletions
diff --git a/src/usr/diag/mdia/mdiafwd.H b/src/usr/diag/mdia/mdiafwd.H index 4c090a3bb..8631b252b 100644 --- a/src/usr/diag/mdia/mdiafwd.H +++ b/src/usr/diag/mdia/mdiafwd.H @@ -1,25 +1,25 @@ -// 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 +/* 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 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 __MDIA_MDIAFWD_H #define __MDIA_MDIAFWD_H @@ -56,26 +56,6 @@ struct Globals; struct WorkFlowProperties; /** - * @brief work flow phases - */ -enum WorkFlowPhase -{ - 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, - DUMMY_SYNC_PHASE, - DUMMY_ASYNC_PHASE, -}; - -/** * @brief per mba diagnostic mode */ enum DiagMode @@ -116,7 +96,7 @@ enum WorkFlowStatus /** * @brief Workflow container of workflow phases */ -typedef std::vector<WorkFlowPhase> WorkFlow; +typedef std::vector<uint64_t> WorkFlow; /** * @brief WorkflowAssocMap target / workflow association map diff --git a/src/usr/diag/mdia/mdiamba.C b/src/usr/diag/mdia/mdiamba.C index e4f1e471e..0b41ec7cf 100644 --- a/src/usr/diag/mdia/mdiamba.C +++ b/src/usr/diag/mdia/mdiamba.C @@ -1,25 +1,25 @@ -// 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 +/* 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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** * @file mdiamba.C * @brief mdia mba specific functions @@ -27,6 +27,7 @@ #include "mdiafwd.H" #include "mdiaglobals.H" +#include "mdiasm.H" using namespace TARGETING; @@ -62,7 +63,7 @@ errlHndl_t getMbaWorkFlow(DiagMode i_mode, WorkFlow & o_wf) case NINE_PATTERNS: - o_wf.push_back(START_PATTERN_8); + o_wf.push_back(START_RANDOM_PATTERN); o_wf.push_back(START_SCRUB); o_wf.push_back(START_PATTERN_7); o_wf.push_back(START_SCRUB); diff --git a/src/usr/diag/mdia/mdiasm.C b/src/usr/diag/mdia/mdiasm.C index be5e4a973..a1835d525 100644 --- a/src/usr/diag/mdia/mdiasm.C +++ b/src/usr/diag/mdia/mdiasm.C @@ -31,12 +31,12 @@ #include "mdiatrace.H" #include "mdiaworkitem.H" #include "mdiamonitor.H" -#include <dram_initialization/mss_memdiag/mss_maint_cmds.H> #include <errl/errlmanager.H> #include <stdio.h> #include <mdia/mdiamevent.H> #include <hbotcompid.H> #include <fapi.H> +#include <fapiPlatHwpInvoker.H> using namespace TARGETING; using namespace std; @@ -298,7 +298,7 @@ bool StateMachine::executeWorkItem(WorkFlowProperties * i_wfp) bool async = workItemIsAsync(*i_wfp); - WorkFlowPhase workItem = *i_wfp->workItem; + uint64_t workItem = *i_wfp->workItem; MDIA_FAST("sm: executing work item %d for: %p", workItem, getTarget(*i_wfp)); @@ -309,7 +309,6 @@ bool StateMachine::executeWorkItem(WorkFlowProperties * i_wfp) switch(workItem) { - // TODO... // do the appropriate thing based on the phase for this target case START_PATTERN_0: @@ -320,7 +319,7 @@ bool StateMachine::executeWorkItem(WorkFlowProperties * i_wfp) case START_PATTERN_5: case START_PATTERN_6: case START_PATTERN_7: - case START_PATTERN_8: + case START_RANDOM_PATTERN: case START_SCRUB: err = doMaintCommand(*i_wfp); @@ -363,124 +362,139 @@ bool StateMachine::executeWorkItem(WorkFlowProperties * i_wfp) errlHndl_t StateMachine::doMaintCommand(WorkFlowProperties & i_wfp) { + static const uint64_t timeout = 100; errlHndl_t err = NULL; - mutex_lock(&iv_mutex); + uint64_t stopCondition = mss_MaintCmd::STOP_ON_END_ADDRESS + | mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION; + + uint64_t workItem; + bool restart; + TargetHandle_t targetMba; + ecmdDataBufferBase startAddr(64), endAddr(64); + mss_MaintCmd * cmd = NULL; // starting a maint cmd ... register a timeout monitor + uint64_t monitorId = getMonitor().addMonitor(timeout); - // select a timeout based on the size of the address range - // the command is being run against + mutex_lock(&iv_mutex); - // uint32_t timeout = i_wfp.memSize / 1024; // TODO - uint32_t timeout = 100; - i_wfp.timer = getMonitor().addMonitor(timeout); + i_wfp.timer = monitorId; + workItem = *i_wfp.workItem; + restart = i_wfp.restartCommand; + targetMba = getTarget(i_wfp); - WorkFlowPhase workItem = *i_wfp.workItem; - bool restart = i_wfp.restartCommand; + fapi::Target fapiMba(TARGET_TYPE_MBA_CHIPLET, targetMba); - TargetHandle_t targetMba = getTarget(i_wfp); + do { - mutex_unlock(&iv_mutex); + FAPI_INVOKE_HWP( + err, + mss_get_address_range, + fapiMba, + MSS_ALL_RANKS, + startAddr, + endAddr); - switch (workItem) - { - case START_PATTERN_0: - case START_PATTERN_1: - case START_PATTERN_2: - case START_PATTERN_3: - case START_PATTERN_4: - case START_PATTERN_5: - case START_PATTERN_6: - case START_PATTERN_7: - case START_PATTERN_8: - case START_SCRUB: + if(err) { - mutex_lock(&iv_mutex); + MDIA_FAST("sm: get_address_range failed"); + break; + } - // Get the fapi target from the TargetHandle required for HWP - ReturnCode fapirc; - fapi::Target fapiMba(TARGET_TYPE_MBA_CHIPLET, targetMba); + if(restart) + { + cmd = new mss_IncrementAddress(fapiMba); - if(restart) + MDIA_FAST("sm: increment address on: %p", targetMba); + } + else + { + switch(workItem) { - MDIA_FAST("sm: issuing increment address on: %p", - targetMba); - // TODO...RTC 46418 - // restart the command (increment address) + case START_RANDOM_PATTERN: + cmd = new mss_SuperFastRandomInit( + fapiMba, + startAddr, + endAddr, + mss_MaintCmd::PATTERN_RANDOM, + stopCondition, + false); + + MDIA_FAST("sm: random init on: %p", targetMba); + break; + + case START_SCRUB: + cmd = new mss_SuperFastRead( + fapiMba, + startAddr, + endAddr, + stopCondition, + false); + + MDIA_FAST("sm: scrub on: %p", targetMba); + break; + + case START_PATTERN_0: + case START_PATTERN_1: + case START_PATTERN_2: + case START_PATTERN_3: + case START_PATTERN_4: + case START_PATTERN_5: + case START_PATTERN_6: + case START_PATTERN_7: + + cmd = new mss_SuperFastInit( + fapiMba, + startAddr, + endAddr, + static_cast<mss_MaintCmd::PatternIndex>(workItem), + stopCondition, + false); + + MDIA_FAST("sm: init on: %p", targetMba); + break; + + default: + break; } - else + + if(!cmd) { - MDIA_FAST("sm: issuing maint command on: %p", - targetMba); - - do - { - //TODO...RTC 46187 - //add method to set patternIndex based on workItem - ecmdDataBufferBase startAddr(64); - ecmdDataBufferBase endAddr(64); - - // Get the address range for maint cmd - fapirc = mss_get_address_range( fapiMba, - MSS_ALL_RANKS, - startAddr, - endAddr); - if(!fapirc.ok()) - { - MDIA_FAST("sm: get_address_range failed"); - break; - } - - const mss_MaintCmd::StopCondition stopCondition = - static_cast<mss_MaintCmd::StopCondition> - (mss_MaintCmd::STOP_ON_END_ADDRESS | - mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION); - - // Create the maintenance command - mss_SuperFastInit sfinit( fapiMba, - startAddr, - endAddr, - mss_MaintCmd::PATTERN_0, - stopCondition, - false); - - //Setup the maint cmd and execute it - fapirc = sfinit.setupAndExecuteCmd(); - - if(!fapirc.ok()) - { - MDIA_FAST("sm: setupAndExecuteCmd failed"); - break; - } - - }while(0); - - if(!fapirc.ok()) - { - MDIA_FAST("sm: Running Maint Cmd failed"); - - //TODO...RTC 46419 - //obtain errorlog from fapirc - - // Unregister the maint cmd monitor - getMonitor().removeMonitor(i_wfp.timer); - } + MDIA_ERR("unrecognized maint command type %d on: %p", + workItem, targetMba); + break; } + } -#ifdef MDIA_DO_POLLING - - MDIA_FAST("sm: polling on: %p", getTarget(i_wfp)); - - getMonitor().startPolling(getTarget(i_wfp)); -#endif - mutex_unlock(&iv_mutex); + ReturnCode fapirc = cmd->setupAndExecuteCmd(); + err = fapiRcToErrl(fapirc); + if(err || !cmd) + { + MDIA_FAST("sm: setupAndExecuteCmd failed"); break; } - default: - break; + + } while(0); + + if(err) + { + MDIA_FAST("sm: Running Maint Cmd failed"); + + getMonitor().removeMonitor(monitorId); + } + +#ifdef MDIA_DO_POLLING + else + { + MDIA_FAST("sm: polling on: %p", targetMba); + + getMonitor().startPolling(targetMba); } +#endif + + mutex_unlock(&iv_mutex); return err; } @@ -514,9 +528,8 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) if(wit == iv_workFlowProperties.end()) { - // TODO ... target not found...commit a log + MDIA_ERR("sm: did not find target"); - MDIA_FAST("sm: did not find target"); return false; } diff --git a/src/usr/diag/mdia/mdiasm.H b/src/usr/diag/mdia/mdiasm.H index 146bb1ce9..7ac8e22a5 100644 --- a/src/usr/diag/mdia/mdiasm.H +++ b/src/usr/diag/mdia/mdiasm.H @@ -30,6 +30,7 @@ #include <vector> #include <util/threadpool.H> +#include <dram_initialization/mss_memdiag/mss_maint_cmds.H> #include "sys/sync.h" #include "mdiafwd.H" @@ -37,6 +38,26 @@ namespace MDIA { /** + * @brief work flow phases + */ +enum WorkFlowPhase +{ + START_PATTERN_0 = mss_MaintCmd::PATTERN_0, + START_PATTERN_1 = mss_MaintCmd::PATTERN_1, + START_PATTERN_2 = mss_MaintCmd::PATTERN_2, + START_PATTERN_3 = mss_MaintCmd::PATTERN_3, + START_PATTERN_4 = mss_MaintCmd::PATTERN_4, + START_PATTERN_5 = mss_MaintCmd::PATTERN_5, + START_PATTERN_6 = mss_MaintCmd::PATTERN_6, + START_PATTERN_7 = mss_MaintCmd::PATTERN_7, + START_RANDOM_PATTERN, + DUMMY_SYNC_PHASE, + DUMMY_ASYNC_PHASE, + RESTORE_DRAM_REPAIRS, + START_SCRUB, +}; + +/** * @brief memory diagnostics step state machine */ class StateMachine diff --git a/src/usr/diag/mdia/test/makefile b/src/usr/diag/mdia/test/makefile index c24764212..573666556 100644 --- a/src/usr/diag/mdia/test/makefile +++ b/src/usr/diag/mdia/test/makefile @@ -24,6 +24,18 @@ ROOTPATH = ../../../../.. EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag +########################################################## +# Following are needed to include hwpf/hwp/fapi.H +########################################################## +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +########################################################## +# Following is needed to include mss_maint_cmds.H +########################################################## +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp + OBJS = mdiafakesm.o mdiafakecm.o MODULE = testmdia diff --git a/src/usr/diag/mdia/test/mdiafakesm.C b/src/usr/diag/mdia/test/mdiafakesm.C index 2186caa86..6b1372b15 100644 --- a/src/usr/diag/mdia/test/mdiafakesm.C +++ b/src/usr/diag/mdia/test/mdiafakesm.C @@ -160,7 +160,7 @@ errlHndl_t FakeStateMachine2::doMaintCommand(WorkFlowProperties & i_wfp) uint32_t timeout = 100; i_wfp.timer = getMonitor().addMonitor(timeout); - WorkFlowPhase workItem = *i_wfp.workItem; + uint64_t workItem = *i_wfp.workItem; bool restart = i_wfp.restartCommand; mutex_unlock(&iv_mutex); @@ -175,7 +175,6 @@ errlHndl_t FakeStateMachine2::doMaintCommand(WorkFlowProperties & i_wfp) case START_PATTERN_5: case START_PATTERN_6: case START_PATTERN_7: - case START_PATTERN_8: case START_SCRUB: mutex_lock(&iv_mutex); diff --git a/src/usr/diag/mdia/test/mdiatestmba.H b/src/usr/diag/mdia/test/mdiatestmba.H index d9b376162..da7298a34 100644 --- a/src/usr/diag/mdia/test/mdiatestmba.H +++ b/src/usr/diag/mdia/test/mdiatestmba.H @@ -1,25 +1,25 @@ -// 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 +/* 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 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_MDIATESTMBA_H #define __TEST_MDIATESTMBA_H @@ -33,6 +33,7 @@ #include <targeting/common/target.H> #include "../mdiafwd.H" #include "../mdiaglobals.H" +#include "../mdiasm.H" class MdiaMbaTest : public CxxTest::TestSuite { diff --git a/src/usr/diag/mdia/test/mdiatestsm.H b/src/usr/diag/mdia/test/mdiatestsm.H index 725b8a941..a11da7501 100644 --- a/src/usr/diag/mdia/test/mdiatestsm.H +++ b/src/usr/diag/mdia/test/mdiatestsm.H @@ -308,7 +308,6 @@ class MdiaSmTest : public CxxTest::TestSuite Checks(START_PATTERN_5, true), Checks(START_PATTERN_6, true), Checks(START_PATTERN_7, true), - Checks(START_PATTERN_8, true), Checks(START_SCRUB, true) }; |