summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/sbe_centaur_init
diff options
context:
space:
mode:
authorThi Tran <thi@us.ibm.com>2012-03-01 08:36:31 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-08 13:47:27 -0600
commita3b4a0ff044b60b2af8082fd5256b1926e8b35b5 (patch)
treef91c2829cb6e9071ae948d9f845bd3d752fd4bf4 /src/usr/hwpf/hwp/sbe_centaur_init
parent7838a7409307f1106aaa6df42f1909e6824de197 (diff)
downloadtalos-hostboot-a3b4a0ff044b60b2af8082fd5256b1926e8b35b5.tar.gz
talos-hostboot-a3b4a0ff044b60b2af8082fd5256b1926e8b35b5.zip
VSBE code change to run SBE cen_sbe_tp_chiplet_init1
Updated with Review comments Change-Id: I745f0cd19b5e3159bba590f4efa9eab6fec71779 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/710 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/sbe_centaur_init')
-rw-r--r--src/usr/hwpf/hwp/sbe_centaur_init/makefile5
-rw-r--r--src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C228
2 files changed, 199 insertions, 34 deletions
diff --git a/src/usr/hwpf/hwp/sbe_centaur_init/makefile b/src/usr/hwpf/hwp/sbe_centaur_init/makefile
index 457783336..b1d97c2c9 100644
--- a/src/usr/hwpf/hwp/sbe_centaur_init/makefile
+++ b/src/usr/hwpf/hwp/sbe_centaur_init/makefile
@@ -34,6 +34,11 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
## pointer to common HWP files
EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include
+## pointer to fapiporeve files
+EXTRAINCDIR += ${ROOTPATH}/src/usr/pore/fapiporeve
+EXTRAINCDIR += ${ROOTPATH}/src/usr/pore/poreve/model
+EXTRAINCDIR += ${ROOTPATH}/src/usr/pore/poreve/porevesrc
+
## Include sub dirs
## NOTE: add a new EXTRAINCDIR when you add a new HWP
## EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/sbe_centaur_init/????
diff --git a/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C b/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
index 1dc9ad501..10e6dbdbe 100644
--- a/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
+++ b/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
@@ -40,19 +40,36 @@
#include <trace/interface.H>
#include <initservice/taskargs.H>
#include <errl/errlentry.H>
-
#include <initservice/isteps_trace.H>
-
#include <targeting/targetservice.H>
#include <targeting/iterators/rangefilter.H>
#include <targeting/predicates/predicatectm.H>
#include <targeting/predicates/predicatepostfixexpr.H>
#include <targeting/predicates/predicateisfunctional.H>
#include <fapi.H>
-
-// -- prototype includes --
-#include "sbe_centaur_init.H"
-// #include "<cen_sbe_arrayinit>/<cen_sbe_arrayinit>.H"
+#include <targeting/target.H>
+#include <fapiPoreVeArg.H>
+#include <fapiTarget.H>
+#include <fapi.H>
+#include <vfs/vfs.H>
+#include <list>
+#include "sbe_centaur_init.H"
+
+//@todo - These two include files are to workaround
+//1. Avoid running test case in VBU
+//2. To call isSlavePresent(). Need to be removed when PD works.
+#include <targeting/util.H>
+#include <fsi/fsiif.H>
+
+// Extern function declaration
+extern fapi::ReturnCode fapiPoreVe(const fapi::Target i_target,
+ std::list<uint64_t> & io_sharedObjectArgs);
+// Constants
+#define CENTAUR_SBE_PNOR_MRR 0 // Memory Relocation Register for Centaur SBE image
+
+// Name spaces
+using namespace TARGETING;
+using namespace vsbe;
namespace SBE_CENTAUR_INIT
{
@@ -68,12 +85,11 @@ void call_cen_sbe_tp_chiplet_init1( void *io_pArgs )
INITSERVICE::TaskArgs *pTaskArgs =
static_cast<INITSERVICE::TaskArgs *>( io_pArgs );
fapi::ReturnCode l_fapirc;
+ fapi::ReturnCode l_fapirc2;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 entry" );
-
- // figure out what targets we need
- // ADD TARGET GENERATION STUFF HERE
+ // Get target list to pass in procedure
// Use PredicateIsFunctional to filter only functional chips
TARGETING::PredicateIsFunctional l_isFunctional;
@@ -89,39 +105,183 @@ void call_cen_sbe_tp_chiplet_init1( void *io_pArgs )
TARGETING::targetService().end(),
&l_functionalAndMembufChipFilter );
- for ( ; l_pMemBufs; ++l_pMemBufs )
- {
- // make a local copy of the target for ease of use
- const TARGETING::Target* l_membuf_target = *l_pMemBufs;
+ bool l_unloadSbePnorImg = false;
+ size_t l_sbePnorSize = 0;
+ const char * l_sbePnorAddr = NULL;
+ errlHndl_t l_errl = NULL;
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "===== cen_sbe_tp_chiplet_init1 HWP(? ? ? )" );
- EntityPath l_path;
- l_path = l_membuf_target->getAttr<ATTR_PHYS_PATH>();
- l_path.dump();
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "===== " );
-#if 0
- // $$$$ Thi add your code here, pass it l_membuf_target
- // call the HWP with each target ( if parallel, spin off a task )
- l_fapirc = cen_sbe_tp_chiplet_init1( ? , ?, ? );
-#endif
+ do
+ {
+ // ----------------------- Setup sbe_pnor stuff --------------------
- // process return code.
- if ( l_fapirc == fapi::FAPI_RC_SUCCESS )
+ // Loading sbe_pnor img
+ l_errl = VFS::module_load("sbe_pnor.bin");
+ if (l_errl)
{
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "SUCCESS : cen_sbe_tp_chiplet_init1 HWP(? ? ? )" );
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - VFS::module_load(sbe_pnor.bin) returns error");
+ //@todo - Commit error and generate error FapiReturn code here
+ delete l_errl;
+ break;
}
else
{
- /**
- * @todo fapi error - just print out for now...
- */
+ // Set flag to unload
+ l_unloadSbePnorImg = true;
+ l_errl = VFS::module_address("sbe_pnor.bin", l_sbePnorAddr, l_sbePnorSize);
+ if(l_errl)
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - VFS::module_address(sbe_pnor.bin) return error");
+ //@todo- Commit error and generate error FapiReturn code
+ delete l_errl;
+ break;
+ }
+ else
+ {
+ char l_header[10];
+ memcpy (l_header, l_sbePnorAddr, 9);
+ l_header[9] = '\0';
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 -Loading sbe_pnor.bin, Addr 0x%llX, Size %d, Header %s",
+ l_sbePnorAddr, l_sbePnorSize, l_header);
+ }
+ }
+
+ // Setup args
+ std::list<uint64_t> myArgs;
+
+ // Set FapiPoreVeOtherArg: run unlimited instructions
+ FapiPoreVeOtherArg *l_otherArg =
+ new FapiPoreVeOtherArg(vsbe::RUN_UNLIMITED,
+ vsbe::PORE_SBE);
+ // Entry point
+ l_otherArg->iv_entryPoint = const_cast<char*>("pnor::_sbe_pnor_start");
+ l_otherArg->iv_mrr = CENTAUR_SBE_PNOR_MRR;
+ uint64_t fapiArg = reinterpret_cast<uint64_t> (l_otherArg);
+ myArgs.push_back(fapiArg);
+
+ // Set FapiPoreVeMemArg for pnor option, base address = 0
+ uint32_t base_addr = 0;
+ char* l_dataPnor = const_cast<char*>(l_sbePnorAddr);
+ FapiPoreVeMemArg* l_memArg = new FapiPoreVeMemArg(ARG_PNOR,
+ base_addr, l_sbePnorSize,
+ static_cast<void*>(l_dataPnor));
+ fapiArg = reinterpret_cast<uint64_t> (l_memArg);
+ myArgs.push_back(fapiArg);
+
+ // Create state argument to dump out state for debugging purpose
+ FapiPoreVeStateArg *l_stateArg = new FapiPoreVeStateArg(NULL);
+ l_stateArg->iv_installState = false;
+ l_stateArg->iv_extractState = true;
+ fapiArg = reinterpret_cast<uint64_t> (l_stateArg);
+ myArgs.push_back(fapiArg);
+
+ // Loop thru all Centaurs in list
+ for ( ; l_pMemBufs; ++l_pMemBufs )
+ {
+ // Create a FAPI Target
+ const TARGETING::Target* l_membuf_target = *l_pMemBufs;
+ const fapi::Target l_fapiTarget(
+ fapi::TARGET_TYPE_MEMBUF_CHIP,
+ reinterpret_cast<void *>
+ (const_cast<TARGETING::Target*>(l_membuf_target)));
+
+ // Put out info on target
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "ERROR %d: cen_sbe_tp_chiplet_init1 HWP(?,?,? ) ",
- static_cast<uint32_t>(l_fapirc) );
+ "Running cen_sbe_tp_chiplet_init1 on Centaur entity path...");
+
+ EntityPath l_path;
+ l_path = l_membuf_target->getAttr<ATTR_PHYS_PATH>();
+ l_path.dump();
+
+ //@todo - This is a temporary hack to skip if Target is not present.
+ // This should be removed when PD works.
+ if ( !FSI::isSlavePresent(l_membuf_target) )
+ {
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - Skip this Centaur because it's not present");
+ continue;
+ }
+
+ // Run the engine
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - Start VSBE engine...");
+
+ //@todo
+ //@VBU workaround - Do not run in VPO since it takes too long
+ //Temporarily disable this test case in VBU because it takes too long to run.
+ //Also, the image used for Centaur is only a temporary image provided by Todd to try out.
+ if ( !TARGETING::is_vpo() )
+ {
+ //@todo - Do not run poreve with temp image for now
+ l_fapirc = fapiPoreVe(l_fapiTarget, myArgs);
+ }
+
+ if (l_fapirc != fapi::FAPI_RC_SUCCESS)
+ {
+ uint32_t val = l_fapirc;
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - Error returned from VSBE engine on this Centaur, l_rc 0x%llX",
+ val);
+ //@todo - We want to commit the error here and should probably trigger a can continue loop (per Dean).
+ // For now, just move onto the next Centaur
+ continue;
+ }
+ else
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init1 - VSBE engine runs successfully on this Centaur");
+ }
+
+ } // end for l_pMemBufs
+
+ // Freeing memory
+ if (l_otherArg)
+ {
+ delete l_otherArg;
+ l_otherArg = NULL;
+ }
+
+ if (l_memArg)
+ {
+ delete l_memArg;
+ l_memArg = NULL;
+ }
+
+ if (l_stateArg)
+ {
+ delete l_stateArg;
+ l_stateArg = NULL;
}
- } // end for l_pMemBufs
+
+
+ } while(0);
+
+ // Unload sbe_pnor
+ if (l_unloadSbePnorImg == true)
+ {
+ l_fapirc2 = fapiUnloadInitFile("sbe_pnor.bin",
+ l_sbePnorAddr,
+ l_sbePnorSize);
+ if (l_fapirc2 != fapi::FAPI_RC_SUCCESS)
+ {
+ FAPI_ERR("call_cen_sbe_tp_chiplet_init1 - Error unloading sbe_pnor.bin");
+ if (l_fapirc == fapi::FAPI_RC_SUCCESS)
+ {
+ l_fapirc = l_fapirc2;
+ }
+ }
+ }
+
+ // process return code.
+ if ( l_fapirc == fapi::FAPI_RC_SUCCESS )
+ {
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ "SUCCESS : cen_sbe_tp_chiplet_init1 HWP(? ? ? )" );
+ }
+ else
+ {
+ /**
+ * @todo fapi error - just print out for now...
+ */
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ "ERROR %d: cen_sbe_tp_chiplet_init1 HWP(?,?,? ) ",
+ static_cast<uint32_t>(l_fapirc) );
+ }
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "cen_sbe_tp_chiplet_init1 exit" );
OpenPOWER on IntegriCloud