diff options
43 files changed, 844 insertions, 1768 deletions
diff --git a/src/build/tools/genIStep.pl b/src/build/tools/genIStep.pl index cb8f2255b..c20b4eec4 100755 --- a/src/build/tools/genIStep.pl +++ b/src/build/tools/genIStep.pl @@ -244,8 +244,7 @@ my $templateHFileSubStep = * * \@istepnum.\@substepnum : \@substepdesc * - * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, - * or NULL. + * param[in,out] io_pArgs - (normally) a pointer to any args, or NULL. * return none * */ @@ -345,9 +344,6 @@ my $templateCFileSubStep = // void call_\@substepname( void *io_pArgs ) { - // \@todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, \"call_\@substepname entry\" ); @@ -399,9 +395,7 @@ void call_\@substepname( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, \"call_\@substepname exit\" ); - // end the task. - pTaskArgs->waitChildSync(); // \@todo remove when join() merged - task_end(); + task_end2( NULL ); } "; ##### end templateCFileSubStep ################################# diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index f42f697d4..5de9a3b51 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -43,13 +43,13 @@ namespace INITSERVICE enum InitServiceModuleID { UNDEFINED_MODULE_ERRL_ID = 0x00, - INITSVC_START_TASK_MOD_ID = 0x01, - INITSVC_START_FN_MOD_ID = 0x02, - INITSVC_TASK_RETURNED_ERROR_ID = 0x03, - EXTINITSVC_TASK_RETURNED_ERROR_ID = 0x04, - CXXTEST_TASK_RETURNED_ERROR_ID = 0x05, - ISTEP_RETURNED_ERROR_ID = 0x06, - INITSVC_DO_SHUTDOWN_MOD_ID = 0x07, + + BASE_INITSVC_MOD_ID = 0x01, + EXT_INITSVC_MOD_ID = 0x02, + ISTEP_INITSVC_MOD_ID = 0x03, + CXXTEST_MOD_ID = 0x04, + INITSVC_DO_SHUTDOWN_MOD_ID = 0x05, + }; @@ -59,11 +59,15 @@ enum InitServiceReasonCode INVALID_TASK_TYPE = INITSVC_COMP_ID | 0x02, START_FN_FAILED = INITSVC_COMP_ID | 0x03, NULL_FN_PTR = INITSVC_COMP_ID | 0x04, - ISTEP_FAILED_NO_ERRLOG = INITSVC_COMP_ID | 0x05, - INITSVC_FAILED_NO_ERRLOG = INITSVC_COMP_ID | 0x06, - EXTINITSVC_FAILED_NO_ERRLOG = INITSVC_COMP_ID | 0x07, - CXXTEST_FAILED_NO_ERRLOG = INITSVC_COMP_ID | 0x08, - SHUTDOWN_FLUSH_FAILED = INITSVC_COMP_ID | 0x09, + FORCE_FAIL = INITSVC_COMP_ID | 0x05, + CXXTEST_FAILED_TEST = INITSVC_COMP_ID | 0x06, + SHUTDOWN_FLUSH_FAILED = INITSVC_COMP_ID | 0x07, + + WAIT_TASK_FAILED = INITSVC_COMP_ID | 0x08, + WAIT_FN_FAILED = INITSVC_COMP_ID | 0x09, + INITSVC_LOAD_MODULE_FAILED = INITSVC_COMP_ID | 0x0a, + ISTEP_SINGLESTEP_SHUTDOWN = INITSVC_COMP_ID | 0x0b, + }; enum InitServiceUserDetailDataSubSection diff --git a/src/include/usr/initservice/taskargs.H b/src/include/usr/initservice/taskargs.H index 39156626c..0108d8021 100644 --- a/src/include/usr/initservice/taskargs.H +++ b/src/include/usr/initservice/taskargs.H @@ -27,10 +27,8 @@ /** * @file taskargs.H * - * common file to hold arguments passed onto tasks. + * Common file to hold arguments passed to and from tasks. * - * will also hold macros, etc to manage arguments - */ #include <assert.h> @@ -42,231 +40,43 @@ #include <errl/errlmanager.H> /** - * @enum * - * Return codes that are passed from ISTEP dispatcher to extinitsvc to initsvc - * thru TASKARGS + * @def TASK_ENTRY_MACRO( MyInitFn ) + * + * set up a _start() task entry routine. + * + * MyInitFn should be declared in your task/namespace with one parameter, + * a reference to an errorlog. + * + * Example: + * + * static void init( errlHndl_t &io_rtaskRetErrl ); + * + * Then if you wish to terminate with an error, say + * + * io_rtaskRetErrl = my_errl; + * return; + * + * This is not as flexible as the old TaskArgs setup but much simpler. + * + * Alternatively you can call task_end2() directly from the MyInitFn: + * + * task_end2( l_errl ); * - * - TASKARGS_SHUTDOWN_RC - task or istep has returned an error, - * initsvc has initiated a shutdown - */ -enum -{ - TASKARGS_SHUTDOWN_RC = 0xf0000001, -}; - - -/** - * @note macro to setup the input void * pArgs pointer. - * Casts it to a pointer to the incoming TaskArgs struct - */ -#define TASKARGS_INIT_TASKARGS(P_ARGS) \ - INITSERVICE::TaskArgs *pTaskArgs = \ - static_cast<INITSERVICE::TaskArgs *>(P_ARGS) - - -/** - * @note macro to wait on the TaskArgs barrier and end the task */ -#define TASKARGS_WAIT_AND_ENDTASK() \ - if ( pTaskArgs ) \ - { \ - pTaskArgs->waitChildSync(); \ - } \ - task_end() - -/** - * @note macro to set up a _start() task entry routine. - */ #define TASK_ENTRY_MACRO( MyInitFn ) \ extern "C" \ void _start( void *io_pArgs ) \ { \ - TASKARGS_INIT_TASKARGS(io_pArgs); \ + errlHndl_t io_rtaskRetErrl = NULL; \ + void *ret = NULL; \ \ - MyInitFn( io_pArgs ); \ + MyInitFn( io_rtaskRetErrl ); \ \ - TASKARGS_WAIT_AND_ENDTASK(); \ + ret = reinterpret_cast<void *>(io_rtaskRetErrl); \ + \ + task_end2( ret ); \ } - -namespace INITSERVICE -{ - -/** - * @class TaskArgs - * - * passed into a task as a void* pointer - * contains: - * - barrier to wait on - * - data from parent (if used) - * - return code from child (if used) - * - pointer to errorlog handle - * - */ -class TaskArgs -{ - -public: - - - /** - * @brief TaskArgs constructor - * - */ - TaskArgs(); - - - /** - * @brief TaskArgs destructor - */ - ~TaskArgs(); - - - /** - * @brief waitParentSync() - * - * Wait for internal barrier associated with this args struct - * This should be called by the task that launches a child task. - * Currently there is no difference between parent and child - * but this may change. - * - * @return none - */ - void waitParentSync(); - - - /** - * @brief waitChildSync() - * - * Wait for internal barrier associated with this args struct - * This should be called by the child task. - * Currently there is no difference between parent and child - * but this may change. - * - * @return none - */ - void waitChildSync(); - - - /** - * @brief postReturnCode - * - * Child task can use this to post a return code to InitServices - * - * @param[in] i_returncode; - * - * @return none. - */ - void postReturnCode( const uint64_t i_returncode ); - - - /** - * @brief getReturnCode - * - * Parent task can use this to get a return code from the child - * - * @return value of iv_taskreturncode; - * - */ - uint64_t getReturnCode( ) const; - - - /** - * @brief setCommand - * - * Parent can pass commands and info to the child using this function - * - * @param[in] i_command; - * - * @return none - */ - void setCommand( const uint64_t i_command ); - - - /** - * @brief getCommand - * - * Child can get commands from the parent using this function - * - * @return value of iv_taskcommand; - * - * @todo might overload this later if we need to pass structs, - * buffers, etc. - */ - uint64_t getCommand( ) const; - - - /** - * @brief postErrorLog - * - * Child task can use this to post an errorlog to InitServices - * Caller is responsible for creating a new errorlog, etc. - * No checking is done. - * - * @param[in] i_errl; - * - * @return none - */ - void postErrorLog( errlHndl_t i_errl ); - - - /** - * @brief getErrorLog - * - * Parent task can use this to get an errorlog from the child - * - * @note This routine sets the iv_errl pointer to the errorlog to NULL - * after returning it, so we do not end up with 2 copies of the - * pointer. The caller must commit or otherwise handle the - * errorlog to avoid a memory leak. - * - * @return iv_errl - * - */ - errlHndl_t getErrorLog( ); - - - /** - * @brief queryErrorLog - * - * Tasks can use this to determine if an error log has been posted. - * - * @return bool - True if postErrorLog called with non-NULL value. - */ - bool queryErrorLog( ) { return (iv_errl != NULL); }; - - - /** - * @brief clear taskargs struct between uses - * - barrier is left alone, - * - if iv_errl is non zero, we commit it here just to avoid - * a memory leak. - * - * @return none - */ - void clear(); - - -private: - - /** - * @note Disable copy constructor and assignment operator - */ - TaskArgs(const TaskArgs& i_right); - TaskArgs& operator=(const TaskArgs& i_right); - - - errlHndl_t iv_errl; - uint64_t iv_taskreturncode; - uint64_t iv_taskcommand; - - barrier_t iv_sync_barrier; - -}; - -}; // namespace - - #endif diff --git a/src/include/usr/pnor/pnor_reasoncodes.H b/src/include/usr/pnor/pnor_reasoncodes.H index 0269f6cbc..8ff648646 100644 --- a/src/include/usr/pnor/pnor_reasoncodes.H +++ b/src/include/usr/pnor/pnor_reasoncodes.H @@ -37,6 +37,7 @@ namespace PNOR MOD_PNORRP_READTOC = 0x06, /**< pnorrp.C : PnorRP::readTOC */ MOD_PNORRP_READFROMDEVICE = 0x07, /**< pnorrp.C : PnorRP::readFromDevice */ MOD_PNORRP_WRITETODEVICE = 0x08, /**< pnorrp.C : PnorRP::writeToDevice */ + MOD_PNORRP_DIDSTARTUPFAIL = 0x1C, /** didStartupFail(rc) */ MOD_PNORDD_VERIFYADDRESSRANGE = 0x11, /**< pnordd.C : PnorDD::verifyAddressRange */ MOD_PNORDD_READFLASH = 0x12, /**< pnordd.C : PnorDD::readFlash */ @@ -53,7 +54,7 @@ namespace PNOR enum PNORReasonCode { - RC_INVALID_MESSAGE_TYPE = PNOR_COMP_ID | 0x01, + RC_INVALID_MESSAGE_TYPE = PNOR_COMP_ID | 0x01, RC_INVALID_ADDRESS = PNOR_COMP_ID | 0x02, RC_INVALID_SECTION = PNOR_COMP_ID | 0x03, RC_EXTERNAL_ERROR = PNOR_COMP_ID | 0x04, @@ -61,6 +62,7 @@ namespace PNOR RC_INVALID_ASYNC_MESSAGE = PNOR_COMP_ID | 0x06, RC_UNSUPPORTED_OPERATION = PNOR_COMP_ID | 0x07, RC_LPC_ERROR = PNOR_COMP_ID | 0x08, + RC_BAD_STARTUP_RC = PNOR_COMP_ID | 0x09 }; }; diff --git a/src/makefile b/src/makefile index bf642a119..10a7b45d3 100644 --- a/src/makefile +++ b/src/makefile @@ -48,21 +48,22 @@ DIRECT_BOOT_OBJECTS = start.o kernel.o taskmgr.o cpumgr.o syscall.o \ RUNTIME_OBJECTS = -BASE_MODULES = trace errl devicefw scom xscom initservice taskargs \ - pnor vfs + +BASE_MODULES = trace errl devicefw scom xscom initservice \ + pnor vfs 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 \ - mdia mbox + mdia mbox DIRECT_BOOT_MODULES = example RUNTIME_MODULES = TESTCASE_MODULES = cxxtest testerrl testdevicefw testsyslib \ testscom testxscom testtargeting testinitservice testkernel \ - testhwpf testecmddatabuffer initsvctasktest2 testcxxtest \ + testhwpf testecmddatabuffer initsvctesttask testcxxtest \ testpnor testi2c testfsi testvfs testhwas testintr testspd \ testpore testutil testmbox testmdia diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C index d78b99205..664d0ec0f 100644 --- a/src/usr/cxxtest/cxxtestexec.C +++ b/src/usr/cxxtest/cxxtestexec.C @@ -40,30 +40,35 @@ namespace CxxTest } // namespace -using namespace INITSERVICE; +// prototype +void cxxinit( errlHndl_t &io_taskRetErrl ); + trace_desc_t *g_trac_cxxtest = NULL; TRAC_INIT(&g_trac_cxxtest, CXXTEST_COMP_NAME, 1024 ); /** - * @brief _start() for CxxTest + * _start entry point for this task. + */ +TASK_ENTRY_MACRO( cxxinit ); + + +/** + * @brief init() for CxxTest * Iterate through all modules in the VFS named "libtest*" and create * children tasks to execute them. * - * * @parms[in,out] - pointer to TaskArgs struct + * * @parms[in,out] - pointer to any args * */ -extern "C" -void _start(void *io_pArgs) + +void cxxinit( errlHndl_t &io_taskRetErrl ) { errlHndl_t l_errl = NULL; std::vector<const char *> module_list; std::vector<tid_t> tasks; tid_t tidrc = 0; - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); - // output a blank line so that it's easier to find the beginning of // CxxTest @@ -142,10 +147,8 @@ void _start(void *io_pArgs) TRACFCOMP( g_trac_cxxtest, " trace calls: %d", CxxTest::g_TraceCalls ); - // dump out an informational errorlog - assert(l_errl == NULL); + // @todo dump out an informational errorlog?? - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + // should always return NULL + task_end2( l_errl ); } diff --git a/src/usr/cxxtest/cxxtestgen.pl b/src/usr/cxxtest/cxxtestgen.pl index 2ae66a7ba..48b89c0c6 100755 --- a/src/usr/cxxtest/cxxtestgen.pl +++ b/src/usr/cxxtest/cxxtestgen.pl @@ -744,7 +744,7 @@ sub write_start() { print "\n"; print "\t__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);\n"; print "\n"; - print "\ttask_end();\n"; + print "\ttask_end2( NULL );\n"; print "}\n"; } diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C index 2c73b0c21..172ec6315 100644 --- a/src/usr/hwas/hwas.C +++ b/src/usr/hwas/hwas.C @@ -92,11 +92,9 @@ void enableHwasState( TARGETING::HwasState &i_rhwasState ) } - void init_target_states( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TARGETING::HwasState l_hwasState; TRACDCOMP( g_trac_hwas, "init_target_states entry: set default HWAS state:" ); @@ -113,8 +111,6 @@ void init_target_states( void *io_pArgs ) l_TargetItr->setAttr<ATTR_HWAS_STATE>( l_hwasState ); } - - /** * @todo Enable cpu 0 and centaur 0 for now. */ @@ -236,17 +232,14 @@ void init_target_states( void *io_pArgs ) } // end else // $$$$$ TEMPORARY $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + TRACFCOMP( g_trac_hwas, "$$ init_target_states DEBUG: return %p", l_errl ); + task_end2( l_errl ); } void init_fsi( void *io_pArgs ) { errlHndl_t l_errl = NULL; - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); TRACDCOMP( g_trac_hwas, "init_fsi entry" ); @@ -254,79 +247,63 @@ void init_fsi( void *io_pArgs ) if ( l_errl ) { TRACFCOMP( g_trac_hwas, "ERROR: failed to init FSI hardware" ); - pTaskArgs->postErrorLog( l_errl ); - } + } - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } + void apply_fsi_info( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TRACDCOMP( g_trac_hwas, "apply_fsi_info entry" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } void apply_dd_presence( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TRACDCOMP( g_trac_hwas, "apply_dd_presence entry" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } void apply_pr_keyword_data( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TRACDCOMP( g_trac_hwas, "apply_pr_keyword_data" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } void apply_partial_bad( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TRACDCOMP( g_trac_hwas, "apply_partial_bad entry" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } void apply_gard( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + errlHndl_t l_errl = NULL; TRACDCOMP( g_trac_hwas, "apply_gard entry" ); - errlHndl_t l_errl = theDeconfigGard().clearGardRecordsForReplacedTargets(); + l_errl = theDeconfigGard().clearGardRecordsForReplacedTargets(); if (l_errl) { TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to clear GARD Records for replaced Targets"); - pTaskArgs->postErrorLog(l_errl); } else { @@ -335,7 +312,6 @@ void apply_gard( void *io_pArgs ) if (l_errl) { TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to deconfigure Targets from GARD Records for IPL"); - pTaskArgs->postErrorLog(l_errl); } else { @@ -343,9 +319,7 @@ void apply_gard( void *io_pArgs ) } } - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_errl ); } diff --git a/src/usr/hwas/testHWP.C b/src/usr/hwas/testHWP.C index febd985a4..9de820c13 100644 --- a/src/usr/hwas/testHWP.C +++ b/src/usr/hwas/testHWP.C @@ -69,8 +69,6 @@ extern trace_desc_t *g_trac_hwas; void testHWP( void * io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); errlHndl_t l_err = NULL; // Get the master processor chip @@ -85,14 +83,10 @@ void testHWP( void * io_pArgs ) if (l_err) { - TRACFCOMP( g_trac_hwas, "testHWP failed, committing errorlog"); - errlCommit(l_err,HWAS_COMP_ID); - pTaskArgs->postReturnCode( 0x1234 ); + TRACFCOMP( g_trac_hwas, "testHWP failed. "); } - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( l_err ); } diff --git a/src/usr/hwpf/hwp/dmi_training/dmi_training.C b/src/usr/hwpf/hwp/dmi_training/dmi_training.C index 3123abe7d..766232947 100644 --- a/src/usr/hwpf/hwp/dmi_training/dmi_training.C +++ b/src/usr/hwpf/hwp/dmi_training/dmi_training.C @@ -79,17 +79,13 @@ using namespace fapi; // void call_dmi_scominit( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_dmi_scominit entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "dmi_scominit exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -98,17 +94,13 @@ void call_dmi_scominit( void *io_pArgs ) // void call_dmi_erepair( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_dmi_erepair entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "dmi_erepair exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } // @@ -116,17 +108,13 @@ void call_dmi_erepair( void *io_pArgs ) // void call_dmi_io_dccal( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_dmi_io_dccal entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "dmi_io_dccal exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -135,8 +123,6 @@ void call_dmi_io_dccal( void *io_pArgs ) // void call_dmi_io_run_training( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); fapi::ReturnCode l_fapirc; TARGETING::TargetService& l_targetService = targetService(); uint8_t l_cpuNum = 0; @@ -276,9 +262,7 @@ void call_dmi_io_run_training( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_io_run_training exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -287,17 +271,13 @@ void call_dmi_io_run_training( void *io_pArgs ) // void call_host_startPRD_dmi( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_startPRD_dmi entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "host_startPRD_dmi exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -306,17 +286,14 @@ void call_host_startPRD_dmi( void *io_pArgs ) // void call_host_attnlisten_cen( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_attnlisten_cen entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "<host_attnlisten_cen exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } // @@ -324,8 +301,7 @@ void call_host_attnlisten_cen( void *io_pArgs ) // void call_proc_cen_framelock( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; proc_cen_framelock_args l_args; TARGETING::TargetService& l_targetService = targetService(); @@ -453,9 +429,7 @@ void call_proc_cen_framelock( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_proc_cen_framework exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -464,17 +438,14 @@ void call_proc_cen_framelock( void *io_pArgs ) // void call_cen_set_inband_addr( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_set_inband_addr entry" ); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "cen_set_inband_addr exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } diff --git a/src/usr/hwpf/hwp/dram_training/dram_training.C b/src/usr/hwpf/hwp/dram_training/dram_training.C index 046a0de54..d49d10ada 100644 --- a/src/usr/hwpf/hwp/dram_training/dram_training.C +++ b/src/usr/hwpf/hwp/dram_training/dram_training.C @@ -95,8 +95,7 @@ using namespace fapi; void call_host_disable_vddr( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr entry" ); @@ -148,9 +147,7 @@ void call_host_disable_vddr( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -161,8 +158,7 @@ void call_host_disable_vddr( void *io_pArgs ) void call_mc_pll_setup( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mc_pll_setup entry" ); @@ -214,9 +210,7 @@ void call_mc_pll_setup( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mc_pll_setup exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -227,8 +221,7 @@ void call_mc_pll_setup( void *io_pArgs ) void call_mba_startclocks( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mba_startclocks entry" ); @@ -280,9 +273,7 @@ void call_mba_startclocks( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mba_startclocks exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -293,8 +284,7 @@ void call_mba_startclocks( void *io_pArgs ) void call_host_enable_vddr( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_enable_vddr entry" ); @@ -346,9 +336,7 @@ void call_host_enable_vddr( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_enable_vddr exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -359,8 +347,7 @@ void call_host_enable_vddr( void *io_pArgs ) void call_mss_initf( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_initf entry" ); @@ -412,9 +399,7 @@ void call_mss_initf( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_initf exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } // @@ -422,10 +407,9 @@ void call_mss_initf( void *io_pArgs ) // void call_mss_ddr_phy_reset( void *io_pArgs ) { - // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); errlHndl_t l_err = NULL; + fapi::ReturnCode l_fapirc; + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_ddr_phy_reset entry" ); @@ -486,9 +470,7 @@ void call_mss_ddr_phy_reset( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_ddr_phy_reset exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -498,10 +480,8 @@ void call_mss_ddr_phy_reset( void *io_pArgs ) // void call_mss_draminit( void *io_pArgs ) { - - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); errlHndl_t l_err = NULL; + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit entry" ); @@ -563,9 +543,7 @@ void call_mss_draminit( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } // @@ -574,8 +552,7 @@ void call_mss_draminit( void *io_pArgs ) void call_mss_restore_dram_repair( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_restore_dram_repair entry" ); @@ -627,9 +604,7 @@ void call_mss_restore_dram_repair( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_restore_dram_repair exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -639,11 +614,8 @@ void call_mss_restore_dram_repair( void *io_pArgs ) // void call_mss_draminit_training( void *io_pArgs ) { - - // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); errlHndl_t l_err = NULL; + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_training entry" ); @@ -706,9 +678,7 @@ void call_mss_draminit_training( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_training exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } // @@ -717,8 +687,7 @@ void call_mss_draminit_training( void *io_pArgs ) void call_mss_draminit_trainadv( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_trainadv entry" ); @@ -770,9 +739,7 @@ void call_mss_draminit_trainadv( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_trainadv exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } // @@ -780,11 +747,8 @@ void call_mss_draminit_trainadv( void *io_pArgs ) // void call_mss_draminit_mc( void *io_pArgs ) { - - // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); errlHndl_t l_err = NULL; + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_mc entry" ); @@ -846,9 +810,7 @@ void call_mss_draminit_mc( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_mc exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } diff --git a/src/usr/hwpf/hwp/mc_init/mc_init.C b/src/usr/hwpf/hwp/mc_init/mc_init.C index d7f7dbd85..abfcf6200 100644 --- a/src/usr/hwpf/hwp/mc_init/mc_init.C +++ b/src/usr/hwpf/hwp/mc_init/mc_init.C @@ -84,8 +84,7 @@ using namespace fapi; void call_host_collect_dimm_spd( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_collect_dimm_spd entry" ); @@ -136,9 +135,7 @@ void call_host_collect_dimm_spd( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_collect_dimm_spd exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -149,8 +146,7 @@ void call_host_collect_dimm_spd( void *io_pArgs ) void call_mss_volt( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_volt entry" ); @@ -218,9 +214,7 @@ void call_mss_volt( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_volt exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } // @@ -229,8 +223,7 @@ void call_mss_volt( void *io_pArgs ) void call_mss_freq( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_freq entry" ); @@ -295,9 +288,7 @@ void call_mss_freq( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_freq exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } @@ -308,8 +299,7 @@ void call_mss_freq( void *io_pArgs ) void call_mss_eff_config( void *io_pArgs ) { // @todo remove when join() merged - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_eff_config entry" ); @@ -378,9 +368,7 @@ void call_mss_eff_config( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_eff_config exit" ); - // end the task. - pTaskArgs->waitChildSync(); // @todo remove when join() merged - task_end(); + task_end2( NULL ); } 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 10e6dbdbe..5ac08041c 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 @@ -82,8 +82,7 @@ using namespace fapi; // 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; @@ -285,9 +284,7 @@ void call_cen_sbe_tp_chiplet_init1( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "cen_sbe_tp_chiplet_init1 exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -296,8 +293,7 @@ void call_cen_sbe_tp_chiplet_init1( void *io_pArgs ) // void call_cen_sbe_tp_arrayinit( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_arrayinit entry" ); @@ -330,9 +326,7 @@ void call_cen_sbe_tp_arrayinit( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_arrayinit exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } // @@ -340,8 +334,7 @@ void call_cen_sbe_tp_arrayinit( void *io_pArgs ) // void call_cen_sbe_tp_chiplet_init2( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init2 entry" ); @@ -374,9 +367,7 @@ void call_cen_sbe_tp_chiplet_init2( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init2 exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -385,8 +376,7 @@ void call_cen_sbe_tp_chiplet_init2( void *io_pArgs ) // void call_cen_sbe_tp_chiplet_init3( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init3 entry" ); @@ -419,9 +409,7 @@ void call_cen_sbe_tp_chiplet_init3( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_tp_chiplet_init3 exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -430,8 +418,7 @@ void call_cen_sbe_tp_chiplet_init3( void *io_pArgs ) // void call_cen_sbe_chiplet_init( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_chiplet_init entry" ); @@ -464,9 +451,7 @@ void call_cen_sbe_chiplet_init( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_chiplet_init exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -475,8 +460,7 @@ void call_cen_sbe_chiplet_init( void *io_pArgs ) // void call_cen_sbe_arrayinit( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_arrayinit entry" ); @@ -509,9 +493,7 @@ void call_cen_sbe_arrayinit( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_arrayinit exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -520,8 +502,7 @@ void call_cen_sbe_arrayinit( void *io_pArgs ) // void call_cen_sbe_pll_initf( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_pll_initf entry" ); @@ -555,9 +536,7 @@ void call_cen_sbe_pll_initf( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_pll_initf exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -566,8 +545,7 @@ void call_cen_sbe_pll_initf( void *io_pArgs ) // void call_cen_sbe_dts_init( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_dts_init entry" ); @@ -600,9 +578,7 @@ void call_cen_sbe_dts_init( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_dts_init exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -611,8 +587,7 @@ void call_cen_sbe_dts_init( void *io_pArgs ) // void call_cen_sbe_initf( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_initf entry" ); @@ -645,9 +620,7 @@ void call_cen_sbe_initf( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_initf exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -656,8 +629,7 @@ void call_cen_sbe_initf( void *io_pArgs ) // void call_cen_sbe_do_manual_inits( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_do_manual_inits entry" ); @@ -690,9 +662,7 @@ void call_cen_sbe_do_manual_inits( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_do_manual_inits exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -701,8 +671,7 @@ void call_cen_sbe_do_manual_inits( void *io_pArgs ) // void call_cen_sbe_startclocks( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_startclocks entry" ); @@ -735,9 +704,7 @@ void call_cen_sbe_startclocks( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_startclocks exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } @@ -746,8 +713,7 @@ void call_cen_sbe_startclocks( void *io_pArgs ) // void call_cen_sbe_scominits( void *io_pArgs ) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_pArgs ); + fapi::ReturnCode l_fapirc; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_scominits entry" ); @@ -780,9 +746,7 @@ void call_cen_sbe_scominits( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_cen_sbe_scominits exit" ); - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); + task_end2( NULL ); } }; // end namespace diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C index 532d899d6..2187b8cb0 100644 --- a/src/usr/initservice/baseinitsvc/initservice.C +++ b/src/usr/initservice/baseinitsvc/initservice.C @@ -45,6 +45,8 @@ #include <errl/errludstring.H> +#include <initservice/taskargs.H> // TASK_ENTRY_MACRO + #include "initservice.H" #include "initsvctasks.H" @@ -52,131 +54,369 @@ // ----- namespace SPLESS ----------------------------------------------- namespace SPLESS { - // allocate space for SPLess Command regs + // allocate space for SPLess Command regs in the base image. uint64_t g_SPLess_Command_Reg = 0; uint64_t g_SPLess_Status_Reg = 0; uint64_t g_SPLess_IStepMode_Reg = 0x123456789abcdef0; -} // ----- end namespace SPLESS --------------------------------------- +} +// ----- end namespace SPLESS --------------------------------------- + namespace INITSERVICE { trace_desc_t *g_trac_initsvc = NULL; -TRAC_INIT(&g_trac_initsvc, "INITSVC", 4096 ); +TRAC_INIT(&g_trac_initsvc, "INITSVC", 2048 ); + +/** + * @brief start() task entry procedure + * This one is "special" since we do not return anything to the kernel/vfs + */ +extern "C" +void _start(void *ptr) +{ + TRACFCOMP( g_trac_initsvc, + "Executing Initialization Service module." ); + + // initialize the base modules in Hostboot. + InitService::getTheInstance().init( ptr ); + + TRACFCOMP( g_trac_initsvc, + "return from Initialization Service module." ); + + task_end(); +} + -errlHndl_t InitService::startTask( const TaskInfo *i_ptask, - TaskArgs::TaskArgs *io_pargs ) const +errlHndl_t InitService::checkNLoadModule( const TaskInfo *i_ptask ) const { - tid_t l_tidrc = 0; - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = NULL; + const char *l_modulename = NULL; + + assert(i_ptask->taskflags.task_type == START_FN ); + + do { + + // i_ptask->taskflags.task_type == STARTFN + l_modulename = VFS::module_find_name( + reinterpret_cast<void*>(i_ptask->taskfn) ); + if ( l_modulename == NULL ) + { + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid BASE_INITSVC_MOD_ID + * @reasoncode INITSVC_LOAD_MODULE_FAILED + * @userdata1 0 + * @userdata2 0 + * + * @devdesc Initialization Service failed to load a + * module needed to load a function or task. + * UserDetails will contain the name of the + * function or task. + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::BASE_INITSVC_MOD_ID, + INITSERVICE::INITSVC_LOAD_MODULE_FAILED, + 0, + 0 ); + + // error, break out of do block + break; + } + + TRACDCOMP( g_trac_initsvc, + "checkNLoadModule: found %s in module %s", + i_ptask->taskname, + ((l_modulename!=NULL)?l_modulename:"NULL???") ); + + if ( !VFS::module_is_loaded( l_modulename ) + ) + { + TRACDCOMP( g_trac_initsvc, + "loading module %s", + l_modulename ); + l_errl = VFS::module_load( l_modulename ); + if ( l_errl ) + { + // load module returned with errl set + TRACFCOMP( g_trac_initsvc, + "module_load( %s ) returned with an error.", + l_modulename ); + + // break out of do block + break; + } + } + + } while( 0 ); // end do() block + + + return l_errl; +} + + +errlHndl_t InitService::startTask( + const TaskInfo *i_ptask, + void *io_pargs ) const +{ + tid_t l_tidlnchrc = 0; + tid_t l_tidretrc = 0; + errlHndl_t l_errl = NULL; + int l_childsts = 0; + void *l_childerrl = NULL; + assert( i_ptask != NULL ); - assert( i_ptask->taskflags.task_type == START_TASK ); + // assert( i_ptask->taskflags.task_type == START_TASK ); - // Base modules have already been loaded and initialized, - // extended modules have not. - if ( i_ptask->taskflags.module_type == EXT_IMAGE ) - { - // load module and call _init() - l_errl = VFS::module_load( i_ptask->taskname ); - } + do { + // Base modules have already been loaded and initialized, + // extended modules have not. + if ( i_ptask->taskflags.module_type == EXT_IMAGE ) + { + // load module if necessary + l_errl = VFS::module_load( i_ptask->taskname ); + } + if ( l_errl ) + { + TRACFCOMP(g_trac_initsvc, + "ERROR: failed to load module for task '%s'", + i_ptask->taskname); + + // drop out of do block with errl set + break; + } - if ( ! l_errl ) - { // launch a task and wait for it. - l_tidrc = task_exec( i_ptask->taskname, io_pargs ); + l_tidlnchrc = task_exec( i_ptask->taskname, io_pargs ); + TRACDCOMP( g_trac_initsvc, + "launch task %s returned %d", + i_ptask->taskname, + l_tidlnchrc ); // process the return - kernel returns a 16-bit signed # as a // threadid/error - if ( static_cast<int16_t> (l_tidrc) < 0 ) + if ( static_cast<int16_t> (l_tidlnchrc) < 0 ) { // task failed to launch, post an errorlog and dump some trace - TRACFCOMP(g_trac_initsvc, "ERROR: starting task '%s'", - i_ptask->taskname); + TRACFCOMP(g_trac_initsvc, + "ERROR 0x%x: starting task '%s'", + l_tidlnchrc, + i_ptask->taskname); /*@ errorlog tag * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid INITSVC_START_TASK_MOD_ID + * @moduleid BASE_INITSVC_MOD_ID * @reasoncode START_TASK_FAILED - * @userdata1 task return code + * @userdata1 0 + * @userdata2 task id or task return code * * @devdesc Initialization Service failed to start a task. * */ l_errl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - INITSERVICE::INITSVC_START_TASK_MOD_ID, + INITSERVICE::BASE_INITSVC_MOD_ID, INITSERVICE::START_TASK_FAILED, - l_tidrc ); + 0, + l_tidlnchrc ); - // Add the task name as user detail data - ERRORLOG::ErrlUserDetailsString(i_ptask->taskname).addToLog(l_errl); - } // endif tidrc - else + // break out of do block + break; + } // endif tidlnchrc + + TRACDCOMP(g_trac_initsvc, + "Wait for tid %d '%s'", + l_tidlnchrc, + i_ptask->taskname); + + // wait here for the task to end. + // status of the task ( OK or Crashed ) is returned in l_childsts + // if the task returns an errorlog, it will be returned + // (via task_end2) in l_childerrl + l_tidretrc = task_wait_tid( + l_tidlnchrc, + &l_childsts, + &l_childerrl ); + if ( ( static_cast<int16_t>(l_tidretrc) < 0 ) + || ( l_childsts != TASK_STATUS_EXITED_CLEAN ) + ) { - // if InitService passed in a taskargs, wait for barrier. - if ( io_pargs ) - { - io_pargs->waitParentSync(); - } - } // endelse - } // endif ! l_errl + // the launched task failed or crashed, + // post an errorlog and dump some trace + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid BASE_INITSVC_MOD_ID + * @reasoncode WAIT_TASK_FAILED + * @userdata1 task id or task return code + * @userdata2 returned status from task + * + * @devdesc Initialization Service launched a task and + * the task returned an error. + * + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::BASE_INITSVC_MOD_ID, + INITSERVICE::WAIT_TASK_FAILED, + l_tidretrc, + l_childsts ); + + // break out of do block + break; + } // endif tidretrc + // check for returned errorlog + if ( l_childerrl != NULL ) + { + // cast to the correct type and return + l_errl = reinterpret_cast<errlHndl_t>(l_childerrl); + + // break out of do block + break; + } + + } while(0); // end do block + + if ( l_errl ) + { + // Add the task name as user detail data to any errorlog + ERRORLOG::ErrlUserDetailsString(i_ptask->taskname).addToLog(l_errl); + } // return any errorlog to the caller return l_errl; -} +} // startTask() + -errlHndl_t InitService::executeFn( const TaskInfo *i_ptask, - TaskArgs *io_pargs ) const +errlHndl_t InitService::executeFn( + const TaskInfo *i_ptask, + void *io_pargs ) const { - tid_t l_tidrc = 0; - errlHndl_t l_errl = NULL; + tid_t l_tidlnchrc = 0; + tid_t l_tidretrc = 0; + errlHndl_t l_errl = NULL; + int l_childsts = 0; + void *l_childerrl = NULL; assert( i_ptask != NULL ); assert( i_ptask->taskfn != NULL ) ; - /** - * @todo: add Doug Gilbert's code here to look up the module based on - * the function pointer and then load the module. - * For now we just blindly load the module in istepdispatcher - */ - // valid function, launch it - l_tidrc = task_create( i_ptask->taskfn, io_pargs); - if (static_cast<int16_t> (l_tidrc) < 0) - { - TRACFCOMP(g_trac_initsvc, "ERROR: starting function in task'%s'", - i_ptask->taskname); - - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid INITSVC_START_FN_MOD_ID - * @reasoncode START_FN_FAILED - * @userdata1 task return code - * - * @devdesc Initialization Service attempted to start a - * function within a module but the function - * failed to launch - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - INITSERVICE::INITSVC_START_FN_MOD_ID, - INITSERVICE::START_FN_FAILED, - l_tidrc ); + do { - // Add the task name as user detail data - ERRORLOG::ErrlUserDetailsString(i_ptask->taskname).addToLog(l_errl); - } // endif tidrc - else - { - // task launched OK. - if ( io_pargs ) + // + l_errl = checkNLoadModule( i_ptask ); + if ( l_errl ) { - io_pargs->waitParentSync(); // sync up parent task + TRACFCOMP(g_trac_initsvc, + "ERROR: failed to load module for task '%s'", + i_ptask->taskname); + + // break out with errorlog set + break; } + + // valid function, launch it + l_tidlnchrc = task_create( i_ptask->taskfn, io_pargs); + if (static_cast<int16_t> (l_tidlnchrc) < 0) + { + TRACFCOMP(g_trac_initsvc, + "ERROR %d: starting function in task'%s'", + l_tidlnchrc, + i_ptask->taskname); + + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid BASE_INITSVC_MOD_ID + * @reasoncode START_FN_FAILED + * @userdata1 task return code + * @userdata2 0 + * + * @devdesc Initialization Service attempted to start a + * function within a module but the function + * failed to launch + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::BASE_INITSVC_MOD_ID, + INITSERVICE::START_FN_FAILED, + l_tidlnchrc, + 0 ); + + // break out with errorlog set + break; + } // endif tidlnchrc + + // wait here for the task to end. + // status of the task ( OK or Crashed ) is returned in l_childsts + // if the task returns an errorlog, it will be returned + // (via task_end2) in l_childerrl + l_tidretrc = task_wait_tid( + l_tidlnchrc, + &l_childsts, + &l_childerrl ); + if ( ( static_cast<int16_t>(l_tidretrc) < 0 ) + || ( l_childsts != TASK_STATUS_EXITED_CLEAN ) + ) + { + // the launched task failed or crashed + // post an errorlog and dump some trace + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid BASE_INITSVC_MOD_ID + * @reasoncode WAIT_TASK_FAILED + * @userdata1 task id or task return code + * @userdata2 returned status from task + * + * @devdesc Initialization Service launched a task and the task returned an error. + * + * + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::BASE_INITSVC_MOD_ID, + INITSERVICE::WAIT_TASK_FAILED, + l_tidretrc, + l_childsts ); + + TRACFCOMP(g_trac_initsvc, + "ERROR : task_wait_tid(0x%x). '%s', l_tidretrc=0x%x, l_childsts=0x%x", + l_tidlnchrc, + i_ptask->taskname, + l_tidretrc, + l_childsts ); + + // break out of do block + break; + } // endif tidretrc + + // check for returned errorlog + if ( l_childerrl != NULL ) + { + TRACFCOMP(g_trac_initsvc, + "ERROR : task_wait_tid(0x%x). '%s', l_childerrl=%p", + l_tidlnchrc, + i_ptask->taskname, + l_childerrl ); + + // cast to the correct type and return + l_errl = reinterpret_cast<errlHndl_t>(l_childerrl); + + // break out of do block + break; + } + + } while( 0 ); // end do block + + if ( l_errl ) + { + // Add the task name as user detail data to any errorlog that was + // posted. + ERRORLOG::ErrlUserDetailsString(i_ptask->taskname).addToLog(l_errl); } return l_errl; @@ -195,7 +435,7 @@ void InitService::setProgressCode( uint64_t i_progresscode ) const errlHndl_t InitService::dispatchTask( const TaskInfo *i_ptask, - TaskArgs *io_pargs ) const + void *io_pargs ) const { errlHndl_t l_errl = NULL; @@ -255,20 +495,23 @@ errlHndl_t InitService::dispatchTask( const TaskInfo *i_ptask, void InitService::init( void *io_ptr ) { - errlHndl_t l_errl = NULL; - uint64_t l_task = 0; - const TaskInfo *l_ptask = NULL; - TaskArgs::TaskArgs l_args; - uint64_t l_childrc = 0; + errlHndl_t l_errl = NULL; + uint64_t l_task = 0; + const TaskInfo *l_ptask = NULL; + // init shutdown status to good. + uint64_t l_shutdownStatus = SHUTDOWN_STATUS_GOOD; + + // @todo detach from parent. + // $$ task_detach(); printk( "InitService entry.\n" ); TRACFCOMP( g_trac_initsvc, - ENTER_MRK "Initialization Service is starting %p.", io_ptr ); + "Initialization Service is starting, io_ptr=%p.", io_ptr ); // loop through the task list and start up any tasks necessary for ( l_task=0; - l_task < INITSERVICE::MAX_TASKS; + l_task < ( sizeof(g_taskinfolist)/sizeof(TaskInfo) ) ; l_task++ ) { // make a local copy of the base image task @@ -280,11 +523,9 @@ void InitService::init( void *io_ptr ) break; } - l_args.clear(); // clear args struct for next task - // dispatch the task and return good or errorlog - l_errl = dispatchTask( l_ptask, - &l_args ); + l_errl = dispatchTask( l_ptask , + NULL ); // process errorlogs returned from the task that was launched if ( l_errl ) @@ -296,77 +537,35 @@ void InitService::init( void *io_ptr ) break; } - - // make local copies of the values in TaskArgs that are returned from - // the child. - // this also clears the errorlog from the TaskArgs struct, so - // use it or lose it ( see taskargs.H for details ). - l_childrc = l_args.getReturnCode(); - l_errl = l_args.getErrorLog(); - - if ( l_errl ) - { - TRACFCOMP( g_trac_initsvc, - " ERROR: Child task returned 0x%llx, errlog=0x%p", - l_childrc, - l_errl ); - // drop out with the error - break; - } - else - { - // Check child results for a valid nonzero return code. - // If we have one, and no errorlog, then we create and - // post our own errorlog here. - if ( l_childrc != 0 ) - { - TRACFCOMP( g_trac_initsvc, - "ERROR: Child task '%s' returned 0x%llx, no errlog", - l_ptask->taskname, - l_childrc ); - - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid INITSVC_TASK_RETURNED_ERROR_ID - * @reasoncode INITSVC_FAILED_NO_ERRLOG - * @userdata1 returncode from task - * @userdata2 0 - * - * @devdesc The task returned with an error, - * but there was no errorlog returned. - * See userdata1 for the return code. - * - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - INITSVC_TASK_RETURNED_ERROR_ID, - INITSERVICE::INITSVC_FAILED_NO_ERRLOG, - l_childrc, - 0 ); - // drop out with the error - break; - } // end if - } // end else } // endfor // die if we drop out with an error if ( l_errl ) { + // commit the log first, then shutdown. - TRACFCOMP( g_trac_initsvc, "InitService: Committing errorlog." ); + TRACFCOMP( g_trac_initsvc, + "InitService: Committing errorlog %p", + l_errl ); errlCommit( l_errl, INITSVC_COMP_ID ); - //Tell initservice to perform shutdown sequence - doShutdown( SHUTDOWN_STATUS_INITSVC_FAILED ); - + // post bad shutdown status + l_shutdownStatus = SHUTDOWN_STATUS_INITSVC_FAILED; } + // ===================================================================== + // ----- Shutdown all CPUs ----------------------------------------- + // ===================================================================== + TRACFCOMP( g_trac_initsvc, - EXIT_MRK "Initilization Service finished."); + "InitService finished, shutdown = 0x%x.", + l_shutdownStatus ); - printk( "InitService exit.\n" ); + // Tell kernel to perform shutdown sequence + InitService::getTheInstance().doShutdown( l_shutdownStatus ); - // return to _start() + printk( "InitService exit.\n" ); + // return to _start() to exit the task. } @@ -426,7 +625,7 @@ void InitService::doShutdown(uint64_t i_status) /* * @errorlog tag * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid INITSVC_DO_SHUTDOWN_MOD_ID + * @moduleid BASE_INITSVC_MOD_ID * @reasoncode SHUTDOWN_FLUSH_FAILED * @userdata1 returncode from mm_remove_pages() * @userdata2 0 @@ -436,7 +635,7 @@ void InitService::doShutdown(uint64_t i_status) */ l_err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - INITSERVICE::INITSVC_DO_SHUTDOWN_MOD_ID, + INITSERVICE::BASE_INITSVC_MOD_ID, INITSERVICE::SHUTDOWN_FLUSH_FAILED,l_rc,0); //Commit and attempt flushing other registered blocks errlCommit( l_err, INITSVC_COMP_ID ); diff --git a/src/usr/initservice/baseinitsvc/initservice.H b/src/usr/initservice/baseinitsvc/initservice.H index 4d15ffeec..d80c5d2ef 100644 --- a/src/usr/initservice/baseinitsvc/initservice.H +++ b/src/usr/initservice/baseinitsvc/initservice.H @@ -42,9 +42,9 @@ #include <sys/vfs.h> // VFS_MODULE_NAME_MAX #include <trace/interface.H> -#include <errl/errlentry.H> +#include <errl/errlentry.H> // errlHndl_t +#include <errl/errlmanager.H> // errlCommit() #include <initservice/initsvcreasoncodes.H> -#include <initservice/taskargs.H> #include <initservice/initsvcstructs.H> #include <vmmconst.h> @@ -108,47 +108,28 @@ public: * is the name of the compiled and linked targetting module. * The module is expected to have implemented a extern "C" * function called "void _start(void *args)" which is considered - * to be the "task entry point". When _start is called, its - * parameter will be set to point to a TaskArgs struct which - * can be used to pass information back and forth. See the - * comments in TaskArgs.H for more info. - * See initsvctasks.H and the unit tests for some examples of - * how this is used. - * + * to be the "task entry point". * * * @param[in] i_ptask pointer to a TaskInfo struct - * @param[in,out] io_pargs pointer to a TaskArgs struct, or NULL - * On input, TaskArgs struct will have - * command, returncode, and errlog fields - * cleared. task can fill in these values - * on return. + * @param[in,out] io_pargs pointer to any args. This is usually NULL. * * @return pointer to errorlog * @retval NULL if success, filled in errorlog handle for failure - * - * @note startTask() can also be used to launch an asynchronous task - * by calling it with i_pargs set to NULL. This will disable - * the barrier check. - * */ errlHndl_t startTask( const TaskInfo *i_ptask, - TaskArgs::TaskArgs *io_pargs ) const; + void *io_pargs ) const; /** * @brief Execute an function * * @param[in] i_ptask - pointer to an TaskInfo struct - * @param[in,out] i_pargs - pointer to a TaskArgs struct - * On input, TaskArgs struct will have - * command, returncode, and errlog fields - * cleared. Task can fill in these values - * on return. + * @param[in,out] i_pargs - pointer to any args. This is usually NULL. * * @return pointer to errorlog * @retval NULL if success, filled out errorlog if failure */ errlHndl_t executeFn( const TaskInfo *i_ptask, - TaskArgs *i_pargs ) const; + void *i_pargs ) const; /** @@ -172,14 +153,13 @@ public: * * @param[in] i_ptask - pointer to a TaskInfo struct, which should * contain all the info to run the task. - * @param[in,out] io_pargs - pointer to a TaskArgs struct. It is - * possible that this will not be used at all. + * @param[in,out] io_pargs - pointer to any args. This is usually NULL. * * @return pointer to errlog * @retval returns NULL, or a pointer to a filled out errorlog */ errlHndl_t dispatchTask( const TaskInfo *i_ptask, - TaskArgs *io_pargs ) const; + void *io_pargs ) const; /** * @brief Registry a block/range of vitual memory to be handled during a @@ -218,11 +198,24 @@ protected: private: /** - * @note Disable copy constructor and assignment operator + * Disable copy constructor and assignment operator */ InitService(const InitService& i_right); InitService& operator=(const InitService& i_right); + + /** + * Check and load module associated with this task or function + * if necessary. + * + * @param[in] i_ptask - pointer to a TaskInfo struct, which should + * contain all the info to run the task. + * @return pointer to errorlog + * @retval NULL if success, filled out errorlog if failure + */ + errlHndl_t checkNLoadModule( const TaskInfo *i_ptask ) const; + + /** * @struct regBlock_t * @brief Attributes stored for virtual memory ranges that must be handled diff --git a/src/usr/initservice/baseinitsvc/initservicetaskentry.C b/src/usr/initservice/baseinitsvc/initservicetaskentry.C deleted file mode 100644 index eec6eef96..000000000 --- a/src/usr/initservice/baseinitsvc/initservicetaskentry.C +++ /dev/null @@ -1,67 +0,0 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/baseinitsvc/initservicetaskentry.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// 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 initservicetaskentry.C - * task entry point for Initialization Service. - * init_main.C will call this by executing - * task_exec( "libinitservice.so", NULL ); - * From there we can execute the classes that will run in the task. - * - * At the end, we must run task_end(). - */ -#include <kernel/console.H> -#include <sys/vfs.h> -#include <sys/task.h> -#include <trace/interface.H> -#include <errl/errlentry.H> - -#include "initservice.H" - - - -namespace INITSERVICE -{ - -extern trace_desc_t *g_trac_initsvc; - -/** - * @brief task entry routine, called by init_main.C - * - */ - -extern "C" -void _start(void *ptr) -{ - TRACFCOMP( g_trac_initsvc, - ENTER_MRK "Executing Initialization Service module." ); - - // initialize the base modules in Hostboot. - InitService::getTheInstance().init( ptr ); - - TRACFCOMP( g_trac_initsvc, - EXIT_MRK "return from Initialization Service module." ); - - task_end(); -} - -} // namespace diff --git a/src/usr/initservice/baseinitsvc/initsvctasks.H b/src/usr/initservice/baseinitsvc/initsvctasks.H index 69b146c92..eed58f592 100644 --- a/src/usr/initservice/baseinitsvc/initsvctasks.H +++ b/src/usr/initservice/baseinitsvc/initsvctasks.H @@ -33,27 +33,14 @@ #include <initservice/initsvcreasoncodes.H> #include "initservice.H" + namespace INITSERVICE { -const uint64_t MAX_TASKS = 10; const TaskInfo g_taskinfolist[] = { /** - * @brief Errorlog Task - */ - { - "liberrl.so" , // taskname - NULL, // no ptr to fn - { - NONE, // don't start - BASE_IMAGE, // Base Module - } - }, - - - /** * @brief PNOR Driver Task */ { @@ -86,7 +73,7 @@ const TaskInfo g_taskinfolist[] = { "libextinitsvc.so" , // taskname NULL, // no pointer to fn { - START_TASK, // call start() + START_TASK, EXT_IMAGE, // EXT_IMAGE } }, diff --git a/src/usr/initservice/baseinitsvc/makefile b/src/usr/initservice/baseinitsvc/makefile index 097dc3f98..0bbe15d22 100644 --- a/src/usr/initservice/baseinitsvc/makefile +++ b/src/usr/initservice/baseinitsvc/makefile @@ -23,7 +23,6 @@ ROOTPATH = ../../../.. MODULE = initservice -OBJS = initservice.o \ - initservicetaskentry.o +OBJS = initservice.o include ${ROOTPATH}/config.mk diff --git a/src/usr/initservice/extinitsvc/extinitsvc.C b/src/usr/initservice/extinitsvc/extinitsvc.C index 2db1c44b6..0c42e9678 100644 --- a/src/usr/initservice/extinitsvc/extinitsvc.C +++ b/src/usr/initservice/extinitsvc/extinitsvc.C @@ -40,7 +40,7 @@ #include <trace/interface.H> #include <errl/errlentry.H> -#include <initservice/taskargs.H> // task entry routine +#include <initservice/taskargs.H> // task entry macro #include "extinitsvc.H" #include "extinitsvctasks.H" @@ -51,36 +51,31 @@ namespace INITSERVICE extern trace_desc_t *g_trac_initsvc; - /** - * @brief set up _start() task entry procedure using the macro in taskargs.H + * _start() task entry procedure using the macro in taskargs.H */ TASK_ENTRY_MACRO( ExtInitSvc::getTheInstance().init ); -void ExtInitSvc::init( void *io_ptr ) +void ExtInitSvc::init( errlHndl_t &io_rtaskRetErrl ) { errlHndl_t l_errl = NULL; uint64_t l_task = 0; const TaskInfo *l_ptask = NULL; - TaskArgs::TaskArgs l_args; - uint64_t l_childrc = 0; - // set up pointer to our taskargs - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_ptr ); printk( "ExtInitSvc entry.\n" ); - TRACFCOMP( g_trac_initsvc, - "Extended Initialization Service is starting %p.", io_ptr ); - + // @todo detach from initservice + // task_detach(); + TRACFCOMP( g_trac_initsvc, + "Extended Initialization Service is starting." ); // ---------------------------------------------------------------- // loop through the task list and start up any tasks necessary // ---------------------------------------------------------------- for ( l_task=0; - l_task<INITSERVICE::MAX_EXT_TASKS; + l_task < ( sizeof(g_exttaskinfolist)/sizeof(TaskInfo) ) ; l_task++ ) { // make a local copy of the extended image task @@ -92,226 +87,155 @@ void ExtInitSvc::init( void *io_ptr ) break; } - l_args.clear(); - // dispatch the task l_errl = InitService::getTheInstance().dispatchTask( l_ptask, - &l_args ); + NULL ); // process errorlogs returned from the task that was launched if ( l_errl ) { TRACFCOMP( g_trac_initsvc, - "ERROR: dispatching task, errlog=0x%p", - l_errl ); - // break out of loop with error. - break; - } - - // make local copies of the values in TaskArgs that are returned from - // the child. - // this also clears the errorlog from the TaskArgs struct, so - // use it or lose it ( see taskargs.H for details ). - l_childrc = l_args.getReturnCode(); - l_errl = l_args.getErrorLog(); - - if ( l_errl ) - { - TRACFCOMP( g_trac_initsvc, - " Child task %s returned 0x%llx, errlog=0x%p", + "ERROR: task %s returned errlog=0x%p", l_ptask->taskname, - l_childrc, l_errl ); - // break out of loop with error + // break out of loop with error. break; } - else - { - // Check child results for a valid nonzero return code. - // If we have one, and no errorlog, then we create and - // post our own errorlog here. - if ( l_childrc != 0 ) - { - TRACFCOMP( g_trac_initsvc, - "EIS: Child task %s returned 0x%llx, no errlog", - l_ptask->taskname, - l_childrc ); - - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid EXTINITSVC_TASK_RETURNED_ERROR_ID - * @reasoncode EXTINITSVC_FAILED_NO_ERRLOG - * @userdata1 returncode from task - * @userdata2 0 - * - * @devdesc The task returned with an error, - * but there was no errorlog returned. - * - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - EXTINITSVC_TASK_RETURNED_ERROR_ID, - INITSERVICE::EXTINITSVC_FAILED_NO_ERRLOG, - l_childrc, - 0 ); - - // break out of loop with error - break; - } // end if - } // end else } // endfor // die if we drop out with an error if ( l_errl ) { - // dropped out of loop with error. - // Commit the log first, then stop right here. + +#if 0 + // @todo detach this task and just do task_end() + // Commit the errorlog here. TRACFCOMP( g_trac_initsvc, - "ExtInitSvc: Committing errorlog..." ); + "ExtInitSvc ERROR: Committing errorlog %p & shutdown", + l_errl ); errlCommit( l_errl, INITSVC_COMP_ID ); - // pass an error code to initsvc that we are shutting down. - pTaskArgs->postReturnCode( TASKARGS_SHUTDOWN_RC ); - //Tell initservice to perform shutdown sequence + // Tell the kernel to shut down. This will not actually + // happen until the last thread has ended. InitService::getTheInstance().doShutdown( SHUTDOWN_STATUS_EXTINITSVC_FAILED); + + // end the task. + end_task(); +#endif + + // end the task and pass the errorlog to initservice to be committed. + // initservice should do the shutdown. + TRACFCOMP( g_trac_initsvc, + "ExtInitSvc: ERROR: return to initsvc with errlog %p", + l_errl ); + + task_end2( l_errl ); } TRACFCOMP( g_trac_initsvc, - EXIT_MRK "ExtInitSvc finished."); + "ExtInitSvc finished OK."); + - // Test if the child posted an errorcode. If so, don't - // bother to run the unit tests. - if ( pTaskArgs->getReturnCode() == 0 ) + // ===================================================================== + // ----- Unit Tests ------------------------------------------------- + // ===================================================================== + /** + * @note run all of the unit tests after we finish the rest + * There are 2 images generated in the build: + * hbicore.bin (HostBoot shippable image) + * hbicore_test.bin (runs all unit tests) + * Only hbicore_test.bin has the libcxxtest.so module, so that's + * how we test whether to run this. + */ + + // If the test task does not exist then don't run it. + if ( VFS::module_exists( cxxTestTask.taskname ) ) { - // ===================================================================== - // ----- Unit Tests ------------------------------------------------- - // ===================================================================== - /** - * @note run all of the unit tests after we finish the rest - * There are 2 images generated in the build: - * hbicore.bin (HostBoot shippable image) - * hbicore_test.bin (runs all unit tests) - * Only hbicore_test.bin has the libcxxtest.so module, so when - * we execute startTask() below on hbicore.bin, it will return -ENOENT, - * no module present. This is OK. - * - * @todo can we call call module_load() to see if libcxxtest.so exists? - * ask Doug or Patrick - * - */ - - printk( "start CxxTest.\n" ); - - // add a do-while loop so there is only one return at the bottom.... - do + printk( "CxxTest entry.\n" ); + + // Pass it a set of args so we can wait on the barrier + errlHndl_t l_cxxerrl = NULL; + const TaskInfo *l_pcxxtask = &cxxTestTask; + + TRACDCOMP( g_trac_initsvc, + "Run CxxTest Unit Tests: %s", + l_pcxxtask->taskname ); + + l_cxxerrl = InitService::getTheInstance().startTask( l_pcxxtask, + NULL ); + // process any errorlogs from cxxtestexec (not sure there are any...) + if ( l_cxxerrl ) { - // Pass it a set of args so we can wait on the barrier - errlHndl_t l_cxxerrl = NULL; - TaskArgs::TaskArgs l_cxxtestargs; - const TaskInfo *l_pcxxtask = &CXXTEST_TASK; - uint64_t l_cxxchildrc = 0; - errlHndl_t l_cxxchilderrl = NULL; +#if 0 + // @todo detach this task and just do task_end() + // First commit the errorlog... + TRACFCOMP( g_trac_initsvc, + "Committing errorlog %p from cxxtask", + l_cxxerrl ); + errlCommit( l_cxxerrl, INITSVC_COMP_ID ); - l_cxxtestargs.clear(); + // Tell the kernel to shut down. This will not actually + // happen until the last thread has ended. + InitService::getTheInstance().doShutdown( SHUTDOWN_STATUS_UT_FAILED); - TRACDCOMP( g_trac_initsvc, - ENTER_MRK "Run Unit Tests (if libcxxtests.so is present): %s", - l_pcxxtask->taskname ); - - // If the test task does not exist then don't run it. - if(!VFS::module_exists(l_pcxxtask->taskname)) break; - - l_cxxerrl = InitService::getTheInstance().startTask( l_pcxxtask, - &l_cxxtestargs ); - - // process errorlogs returned from the task that was launched - // @TODO if we are running the non-test version of HostBoot, this - // will always post an extra errorlog. We need a way to know - // if we are running the _test version or not. - if ( l_cxxerrl ) - { - TRACFCOMP( g_trac_initsvc, - "Committing error from cxxtask launch" ); - errlCommit( l_cxxerrl, INITSVC_COMP_ID ); - break; // ERROR, break out of do-while. - } - - // make local copies of the values in TaskArgs that are returned from - // the child. - // this also clears the errorlog from the TaskArgs struct, so - // use it or lose it ( see taskargs.H for details ). - l_cxxchildrc = l_cxxtestargs.getReturnCode(); - l_cxxchilderrl = l_cxxtestargs.getErrorLog(); - - if ( l_cxxchilderrl ) - { - TRACFCOMP( g_trac_initsvc, - " Child task returned 0x%llx, errlog=0x%p", - l_cxxchildrc, - l_cxxchilderrl ); - errlCommit( l_cxxchilderrl, INITSVC_COMP_ID ); - } - else - { - // Check child results for a valid nonzero return code. - // If we have one, and no errorlog, then we create and - // post our own errorlog here. - if ( l_cxxchildrc != 0 ) - { - TRACFCOMP( g_trac_initsvc, - "Child task returned 0x%llx, no errlog", - l_cxxchildrc ); - - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid CXXTEST_TASK_RETURNED_ERROR_ID - * @reasoncode CXXTEST_FAILED_NO_ERRLOG - * @userdata1 returncode from istep - * @userdata2 0 - * - * @devdesc The unit test dispatcher returned with an - * error, but there was no errorlog returned. - */ - l_cxxerrl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - CXXTEST_TASK_RETURNED_ERROR_ID, - INITSERVICE::CXXTEST_FAILED_NO_ERRLOG, - l_cxxchildrc, - 0 ); - errlCommit( l_cxxerrl, INITSVC_COMP_ID ); - - } // end if - } // end else - - } while(0); // end do-while - - printk( "finish CxxTest.\n" ); + // end the task. + end_task(); +#endif - } + // end the task and pass the errorlog to initservice to be committed. + // initservice should do the shutdown. + TRACFCOMP( g_trac_initsvc, + "CxxTest: ERROR: return to initsvc with errlog %p", + l_cxxerrl ); + task_end2( l_cxxerrl ); + } // endif l_cxxerrl - // ===================================================================== - // ----- Shutdown all CPUs ----------------------------------------- - // ===================================================================== - TRACFCOMP( g_trac_initsvc, - EXIT_MRK "CxxTests finished."); + // make up and post an errorlog if any tests failed. + if ( CxxTest::g_FailedTests ) + { + // some unit tests failed, post an errorlog + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid CXXTEST_MOD_ID + * @reasoncode CXXTEST_FAILED_TEST + * @userdata1 number of failed tests + * @userdata2 0 + * + * @devdesc One or more CxxTest Unit Tests failed. + * + */ + l_cxxerrl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::CXXTEST_MOD_ID, + INITSERVICE::CXXTEST_FAILED_TEST, + CxxTest::g_FailedTests, + 0 ); + TRACFCOMP( g_trac_initsvc, + "CxxTest ERROR: %d failed tests, build errlog %p.", + CxxTest::g_FailedTests, + l_cxxerrl ); - uint64_t l_shutdownStatus = SHUTDOWN_STATUS_GOOD; + // end the task and pass the errorlog to initservice to be committed. + // initservice should do the shutdown. + TRACFCOMP( g_trac_initsvc, "CxxTest: return to initsvc with errlog" ); - if (CxxTest::g_FailedTests) - { - l_shutdownStatus = SHUTDOWN_STATUS_UT_FAILED; - } + task_end2( l_cxxerrl ); + } // endif g_FailedTest - //Tell initservice to perform shutdown sequence - InitService::getTheInstance().doShutdown(l_shutdownStatus); + printk( "CxxTest exit.\n" ); - printk( "ExtInitSvc exit.\n" ); + } // endif cxxtest module exists. + // finish things up, return to initservice with goodness. + TRACFCOMP( g_trac_initsvc, + "ExtInitSvc finished OK, return to initsvc with NULL."); + + printk( "ExtInitSvc exit.\n" ); - // return to _start() + task_end2( NULL ); } diff --git a/src/usr/initservice/extinitsvc/extinitsvc.H b/src/usr/initservice/extinitsvc/extinitsvc.H index eb56dd98c..7c6acec1b 100644 --- a/src/usr/initservice/extinitsvc/extinitsvc.H +++ b/src/usr/initservice/extinitsvc/extinitsvc.H @@ -82,14 +82,13 @@ public: */ static ExtInitSvc& getTheInstance(); + /** * @brief Provide an entry function into the class, called from _start() * - * @param[in] i_args pointer to any arguments passed in from - * _start() and by extension the kernel, - * currently this is NULL . + * @param[in] io_rtaskRetErrl ref to an errlHndl_t passed back to _start() */ - void init( void *i_args); + void init( errlHndl_t &io_rtaskRetErrl ); protected: diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index e02954319..7d40421e4 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -36,7 +36,6 @@ namespace INITSERVICE { -const uint64_t MAX_EXT_TASKS = 25; const TaskInfo g_exttaskinfolist[] = { @@ -284,7 +283,7 @@ const TaskInfo g_exttaskinfolist[] = { // ------------------------------------------------------------------------- // ----- UNIT TESTS ------------------------------------------------- // ------------------------------------------------------------------------- -const TaskInfo CXXTEST_TASK = { +const TaskInfo cxxTestTask = { "libcxxtest.so" , // taskname NULL, // no pointer to fn { diff --git a/src/usr/initservice/initsvctasktest2/makefile b/src/usr/initservice/initsvctesttask/makefile index 40d0d6c38..8bdd7cf28 100644 --- a/src/usr/initservice/initsvctasktest2/makefile +++ b/src/usr/initservice/initsvctesttask/makefile @@ -21,8 +21,8 @@ # # IBM_PROLOG_END ROOTPATH = ../../../.. -MODULE = initsvctasktest2 +MODULE = initsvctesttask -OBJS = tasktest2.o +OBJS = tasktest2.o include ${ROOTPATH}/config.mk diff --git a/src/usr/initservice/initsvctasktest2/tasktest2.C b/src/usr/initservice/initsvctesttask/tasktest2.C index fdf830518..c8c52a386 100644 --- a/src/usr/initservice/initsvctasktest2/tasktest2.C +++ b/src/usr/initservice/initsvctesttask/tasktest2.C @@ -33,12 +33,14 @@ #include <sys/task.h> #include <trace/interface.H> #include <initservice/taskargs.H> +#include <initservice/initsvcreasoncodes.H> #include "tasktest2.H" namespace INITSERVICE { +TASK_ENTRY_MACRO( InitSvcTaskTest2::getTheInstance().init ); /******************************************************************************/ // Globals/Constants @@ -53,33 +55,12 @@ InitSvcTaskTest2& InitSvcTaskTest2::getTheInstance() } -/** - * @brief _start() - task entry point for this module - * - */ -extern "C" -void _start( void *io_pArgs ) +void InitSvcTaskTest2::init( errlHndl_t &io_taskRetErrl ) { - TaskArgs::TaskArgs *pTaskArgs = (TaskArgs::TaskArgs *)io_pArgs; - - // create an instance of InitService - InitSvcTaskTest2::InitSvcTaskTest2& tt = InitSvcTaskTest2::getTheInstance(); - - // initialize the base modules in Hostboot. - tt.init( io_pArgs ); + errlHndl_t l_errl = NULL; - if ( pTaskArgs ) - { - pTaskArgs->waitChildSync(); - } - - task_end(); -} - -void InitSvcTaskTest2::init( void *i_args ) -{ - return; + task_end2( l_errl ); }; } // namespace diff --git a/src/usr/initservice/initsvctasktest2/tasktest2.H b/src/usr/initservice/initsvctesttask/tasktest2.H index 227013990..ec2b20db5 100644 --- a/src/usr/initservice/initsvctasktest2/tasktest2.H +++ b/src/usr/initservice/initsvctesttask/tasktest2.H @@ -34,8 +34,9 @@ /******************************************************************************/ // Includes /******************************************************************************/ -#include <stdint.h> -#include <util/singleton.H> +#include <stdint.h> +#include <util/singleton.H> + namespace INITSERVICE { @@ -63,13 +64,13 @@ class InitSvcTaskTest2 public: /** - * @brief Constructor for the InitService object. + * @brief Constructor */ InitSvcTaskTest2() { } /** - * @brief Destructor for the InitService object. + * @brief Destructor */ ~InitSvcTaskTest2() { } @@ -77,20 +78,17 @@ public: /** * @brief Get singleton instance of this class. * - * @return the (one and only) instance of InitService + * @return the (one and only) instance */ static InitSvcTaskTest2& getTheInstance(); /** * @brief Provide an entry function into the class, called from _start() * - * @param[in] i_args pointer to any arguments passed in from - * _start() and by extension the kernel, - * currently this is NULL . + * @param[in,out] - reference to an errlHndl_t * - * @todo document any changes for args */ - void init( void *i_args); + void init( errlHndl_t &io_taskRetErrl ); private: diff --git a/src/usr/initservice/initsvcunittesttask2/makefile b/src/usr/initservice/initsvcunittesttask2/makefile deleted file mode 100644 index dfb0339ee..000000000 --- a/src/usr/initservice/initsvcunittesttask2/makefile +++ /dev/null @@ -1,28 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/initservice/initsvcunittesttask2/makefile $ -# -# IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2011 -# -# 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 = ../../../.. -MODULE = tasktest2 - -OBJS = tasktest2.o - -include ${ROOTPATH}/config.mk diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index 6c36fa1ec..519369f64 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -55,7 +55,7 @@ #include <initservice/isteps_trace.H> // ISTEPS_TRACE buffer #include <initservice/initsvcudistep.H> // InitSvcUserDetailsIstep -#include <initservice/taskargs.H> // TaskArgs structs +#include <initservice/taskargs.H> // TASK_ENTRY_MACRO #include <targeting/attributes.H> // ISTEP_MODE attribute @@ -93,39 +93,37 @@ using namespace SPLESS; // SingleStepMode extern trace_desc_t *g_trac_initsvc; /** - * @note SPLess PAUSE - These two constants are used in a nanosleep() call * below to sleep between polls of the StatusReg. Typically this will * be about 10 ms - the actual value will be determined empirically. - * */ const uint64_t SINGLESTEP_PAUSE_S = 0; const uint64_t SINGLESTEP_PAUSE_NS = 10000000; /** - * @brief set up _start() task entry procedure using the macro in taskargs.H + * _start() task entry procedure using the macro in taskargs.H */ TASK_ENTRY_MACRO( IStepDispatcher::getTheInstance().init ); const TaskInfo *IStepDispatcher::findTaskInfo( const uint16_t i_IStep, - const uint16_t i_SubStep, - const char *&io_rmodulename ) const + const uint16_t i_SubStep ) const { + // default return is NULL const TaskInfo *l_pistep = NULL; /** * @todo * everything calling this should feed into the "real" istep/substep - * numbers ( starting at 1 ) - this routine will translate to index into + * numbers ( starting at 1 ) - this routine should translate to index into * the isteplists ( starting at 0 ) * + * int16_t l_istepIndex = i_IStep-1; + * int16_t l_substepIndex = i_SubStep-1; + * + * assert( l_istepIndex >= 0 ); + * assert( l_substepIndex >= 0 ); */ - //int16_t l_istepIndex = i_IStep-1; - //int16_t l_substepIndex = i_SubStep-1; - - //assert( l_istepIndex >= 0 ); - //assert( l_substepIndex >= 0 ); // apply filters do @@ -134,7 +132,7 @@ const TaskInfo *IStepDispatcher::findTaskInfo( if ( g_isteps[i_IStep].pti == NULL) { TRACDCOMP( g_trac_initsvc, - "g_isteps[0x%x].pti == NULL (substep=0x%x)", + "g_isteps[%d].pti == NULL (substep=%d)", i_IStep, i_SubStep ); break; @@ -144,7 +142,7 @@ const TaskInfo *IStepDispatcher::findTaskInfo( if ( i_IStep >= MAX_ISTEPS ) { TRACDCOMP( g_trac_initsvc, - "IStep 0x%x out of range. (substep=0x%x) ", + "IStep %d out of range. (substep=%d) ", i_IStep, i_SubStep ); break; // break out with l_pistep set to NULL @@ -154,7 +152,7 @@ const TaskInfo *IStepDispatcher::findTaskInfo( if ( i_SubStep >= g_isteps[i_IStep].numitems ) { TRACDCOMP( g_trac_initsvc, - "IStep 0x%x Substep 0x%x out of range.", + "IStep %d Substep %d out of range.", i_IStep, i_SubStep ); break; // break out with l_pistep set to NULL @@ -165,7 +163,7 @@ const TaskInfo *IStepDispatcher::findTaskInfo( == END_TASK_LIST ) { TRACDCOMP( g_trac_initsvc, - "IStep 0x%x SubSStep 0x%x task_type==END_TASK_LIST.", + "IStep %d SubStep %d task_type==END_TASK_LIST.", i_IStep, i_SubStep ); break; @@ -177,25 +175,15 @@ const TaskInfo *IStepDispatcher::findTaskInfo( if ( g_isteps[i_IStep].pti[i_SubStep].taskfn == NULL ) { TRACDCOMP( g_trac_initsvc, - "IStep 0x%x SubSStep 0x%x fn ptr is NULL.", + "IStep %d SubStep %d fn ptr is NULL.", i_IStep, i_SubStep ); break; } + // we're good, set the istep & return it to caller l_pistep = &( g_isteps[i_IStep].pti[i_SubStep] ); - // find the name of the module that contains this function, - io_rmodulename = VFS::module_find_name( - reinterpret_cast<void*>(l_pistep->taskfn) ); - // looks good, send it back to the caller - TRACDCOMP( g_trac_initsvc, - "Found TaskInfo 0x%p %d.%d in module %s", - l_pistep, - i_IStep, - i_SubStep, - ((io_rmodulename!=NULL)?io_rmodulename:"NULL???") ); - } while ( 0 ); @@ -203,9 +191,8 @@ const TaskInfo *IStepDispatcher::findTaskInfo( } -void IStepDispatcher::init( void * io_ptr ) +void IStepDispatcher::init( errlHndl_t &io_rtaskRetErrl ) { - // note, io_ptr will pass the TaskArgs struct through to runAllSteps, etc. // initialize (and declare) ISTEPS_TRACE here, the rest of the isteps will use it. ISTEPS_TRACE::g_trac_isteps_trace = NULL; @@ -215,8 +202,7 @@ void IStepDispatcher::init( void * io_ptr ) TRAC_INIT(&ISTEPS_TRACE::g_trac_isteps_trace, "ISTEPS_TRACE", 2048 ); TRACFCOMP( g_trac_initsvc, - "IStep Dispatcher is starting %p.", io_ptr ); - + "IStep Dispatcher is starting." ); if ( getIStepMode() ) { @@ -226,7 +212,7 @@ void IStepDispatcher::init( void * io_ptr ) "IStep single-step enable" ); // IStep single-step - singleStepISteps( io_ptr ); + singleStepISteps( io_rtaskRetErrl ); } else { @@ -236,7 +222,7 @@ void IStepDispatcher::init( void * io_ptr ) "IStep run all" ); // Run all the ISteps sequentially - runAllISteps( io_ptr ); + runAllISteps( io_rtaskRetErrl ); } // endelse @@ -245,7 +231,8 @@ void IStepDispatcher::init( void * io_ptr ) printk( "IStepDispatcher exit.\n" ); - // return to _start() + + task_end2( io_rtaskRetErrl ); } @@ -273,35 +260,20 @@ bool IStepDispatcher::getIStepMode( ) const } -/** - * @brief Command 0: Run the requested IStep/SubStep - * - * param[in] i_rcmd - ref to a filled in SPLessCmd struct - * @post iv_sts set to current istep status - * - * @return none - */ void IStepDispatcher::processSingleIStepCmd( SPLessCmd &i_rrawcmd ) { errlHndl_t l_errl = NULL; - uint64_t l_isteprc = NULL; - TaskArgs::TaskArgs l_taskargs; const TaskInfo *l_pistep = NULL; // init the command 0x00 struct to the incoming command reg values SPLessSingleIStepCmd l_cmd( i_rrawcmd ); // create a cleared status 0x00 reg SPLessSingleIStepSts l_sts; - const char *l_modulename = NULL; - - // look up istep+substep l_pistep = IStepDispatcher::getTheInstance().findTaskInfo( l_cmd.istep, - l_cmd.substep, - l_modulename); - + l_cmd.substep ); do { if ( l_pistep == NULL ) @@ -349,46 +321,6 @@ void IStepDispatcher::processSingleIStepCmd( // handleBreakPoint will need sequence number iv_sts.hdr.seqnum = l_cmd.hdr.seqnum; - - /** - * @todo temporary - executeFn will eventually figure out and - * load the correct module - */ - if ( ( l_modulename != NULL ) - && ( !VFS::module_is_loaded( l_modulename ) ) - ) - { - TRACDCOMP( g_trac_initsvc, - "loading module %s", - l_modulename ); - l_errl = VFS::module_load( l_modulename ); - if ( l_errl ) - { - // can't load module for istep, break out of inner loop - // with errl set - TRACFCOMP( g_trac_initsvc, - "Could not load module %s", - l_modulename ); - - l_sts.hdr.status = SPLESS_TASKRC_RETURNED_ERRLOG; - // go ahead and commit the errorlog - errlCommit( l_errl, INITSVC_COMP_ID ); - - // failed to load module, return error - l_sts.hdr.runningbit = false; - l_sts.hdr.readybit = true; - l_sts.hdr.status = SPLESS_TASKRC_FAIL_LOADMODULE; - l_sts.istep = l_cmd.istep; - l_sts.substep = l_cmd.substep; - l_sts.istepStatus = 0; - - // return to caller to write back to user console - iv_sts = l_sts; - - break; - } - } - /** * @todo placeholder - set progress code before starting * This will not be finalized until the progress code driver @@ -403,56 +335,28 @@ void IStepDispatcher::processSingleIStepCmd( l_cmd.substep, l_pistep->taskname ); - // clear the TaskArgs struct - l_taskargs.clear(); - // clear the status struct for the next step l_sts.val64 = 0; // launch the istep l_errl = InitService::getTheInstance().executeFn( l_pistep, - &l_taskargs ); - // filter errors returning from executeFn + NULL ); + // check for child errorlog if ( l_errl ) { - // handle an errorlog from the parent. This means the - // launch failed, set the task Status to Bad. - // no need to process child info, thus the else. - // set the taskStatus to LAUNCH_FAIL; this will fall - // out the bottom and be written to SPLESS Status - l_sts.hdr.status = SPLESS_TASKRC_LAUNCH_FAIL; + // tell the user that the IStep returned an errorlog + l_sts.hdr.status = SPLESS_TASKRC_RETURNED_ERRLOG; + l_sts.istepStatus = SPLESS_TASKRC_RETURNED_ERRLOG; + // go ahead and commit the child errorlog errlCommit( l_errl, INITSVC_COMP_ID ); } - else - { - // process information returned from the IStep. - // make local copies of the info; this has a secondary - // effect of clearing the errorlog pointer inside - // the TaskArgs struct. - l_isteprc = l_taskargs.getReturnCode(); // local copy - l_errl = l_taskargs.getErrorLog(); // local copy - - // check for child errorlog - if ( l_errl ) - { - // tell the user that the IStep returned an errorlog - l_sts.hdr.status = SPLESS_TASKRC_RETURNED_ERRLOG; - // go ahead and commit the child errorlog - errlCommit( l_errl, INITSVC_COMP_ID ); - } - - // truncate IStep return status to 32 bits. - l_isteprc &= SPLESS_SINGLE_STEP_STS_MASK; - l_sts.istepStatus = static_cast<uint32_t>(l_isteprc); - } // end else parent errlog - // task status and istepStatus should be set correctly now, - // send it to the user console. + // send status to the user console. // clear runningbit, report status // set running bit, fill in istep and substep l_sts.hdr.runningbit = false; l_sts.hdr.readybit = true; - // l_sts.hdr.seqnum = i_seqnum; + // l_sts.hdr.seqnum set by caller // task status set above l_sts.istep = l_cmd.istep; l_sts.substep = l_cmd.substep; @@ -473,25 +377,15 @@ void IStepDispatcher::processSingleIStepCmd( } -/** - * @brief singleStepISteps - * - * Stop and wait for SP to send the next IStep to run. Run that, then - * wait for the next one. - * This is not expected to return - errors etc are sent to the user to - * handle. - * - * @param[in,out] io_ptr - pointer to any args passed in from - * ExtInitSvc. This may be a pointer to an - * TaskArgs struct (or something else) which - * can be filled out on return - * - * @return none - */ -void IStepDispatcher::singleStepISteps( void * io_ptr ) +void IStepDispatcher::singleStepISteps( errlHndl_t &io_rtaskRetErrl ) { SPLessCmd l_cmd; uint8_t l_seqnum = 0; + bool quitflag = false; + errlHndl_t l_errl = NULL; + + // init to no errorlog + io_rtaskRetErrl = NULL; mutex_lock(&iv_poll_mutex); // make sure this is only poller @@ -524,11 +418,7 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) { switch( l_cmd.hdr.cmdnum ) { - case SPLESS_CLEAR_TRACE_CMD: - TRAC_CLEAR_BUFFERS(); - TRACFCOMP( g_trac_initsvc, - "Cleared all trace buffers." ); - break; + case SPLESS_SINGLE_ISTEP_CMD: mutex_unlock(&iv_poll_mutex); // command 0: run istep/substep @@ -540,6 +430,17 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) iv_sts.hdr.status = SPLESS_NOT_AT_BREAK_POINT; break; + case SPLESS_CLEAR_TRACE_CMD: + TRAC_CLEAR_BUFFERS(); + TRACFCOMP( g_trac_initsvc, + "Cleared all trace buffers." ); + break; + + case SPLESS_SHUTDOWN_CMD: + iv_sts.hdr.status = SPLESS_SHUTTING_DOWN; + quitflag = true; + break; + default: iv_sts.hdr.status = SPLESS_INVALID_COMMAND; } // endif switch @@ -554,6 +455,30 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) } // endif gobit + if ( quitflag == true ) + { + // shutdown command issued, break out of loop + + /*@ errorlog tag + * @errortype ERRL_SEV_INFORMATIONAL + * @moduleid BASE_INITSVC_MOD_ID + * @reasoncode ISTEP_SINGLESTEP_SHUTDOWN + * @userdata1 0 + * @userdata2 0 + * + * @devdesc hb-istep terminated + * + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + INITSERVICE::BASE_INITSVC_MOD_ID, + INITSERVICE::ISTEP_SINGLESTEP_SHUTDOWN, + 0, + 0 ); + + break; + } + // sleep, and wait for user to give us something else to do. /** * @todo Need a common method of doing delays in HostBoot @@ -575,8 +500,6 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) // @note // Fell out of loop, clear sts reg and turn off readybit - // Currently this will never be reached. Later there may be - // a reason to break out of the loop, if this happens we want to // disable the ready bit so the user knows. iv_sts.val64 = 0; iv_sts.hdr.status = SPLESS_TASKRC_TERMINATED; @@ -584,25 +507,21 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) writeSts( iv_sts ); mutex_unlock(&iv_poll_mutex); + // return with io_rtaskRetErrl set + io_rtaskRetErrl = l_errl; } -void IStepDispatcher::runAllISteps( void * io_ptr ) const +void IStepDispatcher::runAllISteps( errlHndl_t &io_rtaskRetErrl ) const { errlHndl_t l_errl = NULL; uint16_t l_IStep = 0; uint16_t l_SubStep = 0; const TaskInfo *l_pistep = NULL; uint64_t l_progresscode = 0; - uint64_t l_isteprc = 0; - const char *l_modulename = NULL; - - // taskargs struct for children - TaskArgs::TaskArgs l_args; - // set up pointer to our taskargs, passed in from caller - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>( io_ptr ); + // init, just to be sure. + io_rtaskRetErrl = NULL; for ( l_IStep=0; l_IStep<INITSERVICE::MAX_ISTEPS; @@ -613,123 +532,38 @@ void IStepDispatcher::runAllISteps( void * io_ptr ) const l_SubStep++) { l_pistep = findTaskInfo( l_IStep, - l_SubStep, - l_modulename ); + l_SubStep ); if ( l_pistep == NULL ) { break; // break out of inner for loop } - - /** - * @todo temporary - executeFn will eventually figure out and - * load the correct module - */ - if ( ( l_modulename != NULL ) - && ( !VFS::module_is_loaded( l_modulename ) ) - ) - { - TRACDCOMP( g_trac_initsvc, - "loading module %s", - l_modulename ); - l_errl = VFS::module_load( l_modulename ); - if ( l_errl ) - { - // can't load module for istep, break out of inner loop - // with errl set - TRACFCOMP( g_trac_initsvc, - "Could not load module %s", - l_modulename ); - - break; - } - } - // @todo placeholder until progress codes are defined and // progress code driver is implemented. l_progresscode = ( (l_IStep<<16) | l_SubStep ); InitService::getTheInstance().setProgressCode( l_progresscode ); + // print out what we are running TRACFCOMP( g_trac_initsvc, - "Run IStep %d.%d %s", + "IStepDisp: Run IStep %d.%d %s", l_IStep, l_SubStep, l_pistep->taskname ); - - l_args.clear(); l_errl = InitService::getTheInstance().executeFn( l_pistep, - &l_args ); - if ( l_errl ) - { - // Handle an errorlog from the parent, if it exists - // an error here is probably fatal, it means we can't - // launch the task or it doesn't exist. In either - // case we should exit the loop. - // Can't commit the errorlog here because we are using it - // as a flag to exit the loop. - break; - } - - // make local copies of the status returned from the istep. - // note that this also removes the errorlog from the TaskArgs - // struct - it is read-once. See taskargs.H for details - l_isteprc = l_args.getReturnCode(); - l_errl = l_args.getErrorLog(); - - + NULL ); if ( l_errl ) { TRACFCOMP( g_trac_initsvc, - "ISD: istep %s returned 0x%llx, errlog=%p", + "IStepDisp: istep %s returned errlog=%p", l_pistep->taskname, - l_isteprc, l_errl ); // if we have an errorlog, break out of the inner loop // and handle it. break; } - else - { - // Check child results for a valid nonzero return code. - // If we have one, and no errorlog, then we create an - // errorlog here. - if ( l_isteprc != 0 ) - { - TRACFCOMP( g_trac_initsvc, - "ISD: istep %s returned 0x%llx, no errlog", - l_pistep->taskname, - l_isteprc ); - - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid ISTEP_RETURNED_ERROR_ID - * @reasoncode ISTEP_FAILED_NO_ERRLOG - * @userdata1 istep / substep - * @userdata2 returncode from istep - * - * @devdesc The Istep returned with an error, - * but there was no errorlog posted - * from the IStep. Look at user1 data - * for the istep / substep, and - * user2 data for the returned errorcode. - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - ISTEP_RETURNED_ERROR_ID, - INITSERVICE::ISTEP_FAILED_NO_ERRLOG, - ( l_IStep << 8 | l_SubStep ), - l_isteprc ); - - // Add IStep user detail data to the error log - InitSvcUserDetailsIstep(l_pistep->taskname, l_IStep, - l_SubStep).addToLog( l_errl ); - - // drop out of inner loop with errlog set. - break; - } // end if ( ) - } + } // endfor l_SubStep if ( l_errl ) @@ -746,22 +580,14 @@ void IStepDispatcher::runAllISteps( void * io_ptr ) const */ - // Post any errorlogs. If one exists, stop here. Otherwise, return - // to caller. if ( l_errl ) { TRACFCOMP( g_trac_initsvc, - "ERROR: istep=0x%x, substep=0x%x, isteprc=0x%x, committing errorlog and shutting down.", - l_IStep, - l_SubStep, - l_isteprc ); - errlCommit( l_errl, INITSVC_COMP_ID ); - - // pass an error code on to extinitsvc that we are shutting down. - pTaskArgs->postReturnCode( TASKARGS_SHUTDOWN_RC ); - //Tell initservice to perform shutdown sequence - InitService::getTheInstance().doShutdown( SHUTDOWN_STATUS_ISTEP_FAILED ); + "IStepDisp ERROR: errorlog %p", + l_errl ); + // return to _start() with the errorlog set, parent should do shutdown + io_rtaskRetErrl = l_errl; } } @@ -797,6 +623,7 @@ IStepDispatcher::IStepDispatcher() IStepDispatcher::~IStepDispatcher() { } + void IStepDispatcher::handleBreakPoint( uint32_t i_info ) { SPLessCmd l_cmd; diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H index 6679f30d5..b4842f5e9 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.H +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H @@ -92,19 +92,19 @@ public: /** * @brief Provide an entry function into the class, called from _start() * - * @param[in] i_pargs pointer to any arguments passed in from - * _start(). + * @param[in] io_rtaskRetErrl - ref to errlHndl_t passed back to _start(). * * @return nothing */ - void init( void *i_pargs); + void init( errlHndl_t &io_rtaskRetErrl ); + /** * @brief Handle an istep break point * @param[in] i_info, @TODO - location/info - * @pre iv_sts contains current istep status + seqnum or + * @pre iv_sts contains current istep status + seqnum or * 0 if not in step mode - * @note blocks until an outside istep cmd to resume is recieved. + * @note blocks until an outside istep cmd to resume is recieved. */ void handleBreakPoint( uint32_t info); @@ -146,7 +146,6 @@ private: * * @param[in] i_IStep - IStepNumber * @param[in] i_SubStep - SubStepNumber - * @param[in,out] io_rmodulename - return name of module to load * * @return pointer to a TaskInfo struct * @retval pointer to a TaskInfo struct, or NULL @@ -154,8 +153,7 @@ private: */ const TaskInfo *findTaskInfo( const uint16_t i_IStep, - const uint16_t i_SubStep, - const char *&io_rmodulename ) const; + const uint16_t i_SubStep ) const; /** * @brief Command 0: Run the requested IStep/SubStep @@ -165,8 +163,7 @@ private: * * @return none */ - void processSingleIStepCmd( - SPLESS::SPLessCmd &i_rcmd); + void processSingleIStepCmd( SPLESS::SPLessCmd &i_rcmd); /** @@ -174,17 +171,12 @@ private: * * Stop and wait for SP to send the next IStep to run. Run that, then * wait for the next one. - * This is not expected to return - errors etc are sent to the user to - * handle. - * - * @param[in,out] io_ptr - pointer to any args passed in from - * ExtInitSvc. This may be a pointer to an - * TaskArgs struct (or something else) which - * can be filled out on return + * @param[in,out] - ref to an errlHndl_t that can be passed back to + * ExtInitSvc . * * @return none */ - void singleStepISteps( void * io_ptr ); + void singleStepISteps( errlHndl_t &io_rtaskRetErrl ) ; /** @@ -194,14 +186,12 @@ private: * If an IStep gets an error, report it and stop. * Otherwise, return. * - * @param[in,out] io_ptr - pointer to a TaskArgs struct on input - * command, returncode and errorlog will be - * clear on input - * one or more may be filled in on return + * @param[in,out] - ref to an errlHndl_t that can be passed back to + * ExtInitSvc . * * @return none */ - void runAllISteps( void * io_ptr ) const; + void runAllISteps( errlHndl_t &io_rtaskRetErrl ) const; /** @@ -226,9 +216,10 @@ private: * vague - requirements for Can-Continue behaviour have not been * defined yet. */ - bool getCanContinueProcedure( const TaskInfo &i_failingIStep, - errlHndl_t &i_failingError, - TaskInfo &io_nextIStep ) const; + bool getCanContinueProcedure( + const TaskInfo &i_failingIStep, + errlHndl_t &i_failingError, + TaskInfo &io_nextIStep ) const; // ----- internal vars ----------------------------- diff --git a/src/usr/initservice/istepdispatcher/splesscommand.C b/src/usr/initservice/istepdispatcher/splesscommand.C deleted file mode 100644 index 563a4be3a..000000000 --- a/src/usr/initservice/istepdispatcher/splesscommand.C +++ /dev/null @@ -1,113 +0,0 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/istepdispatcher/splesscommand.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// 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 splesscommand.C - * - * Collection of routines to read/write the spless command reg - * - */ - - -/******************************************************************************/ -// Includes -/******************************************************************************/ -#include <stdint.h> -#include <stdio.h> -#include <string.h> - -#include <errl/errlentry.H> // errlHndl_t -#include <sys/mmio.h> // mmio_scratch_read/write - -#include "splesscommon.H" - - -/******************************************************************************/ -// Globals/Constants -/******************************************************************************/ - -/******************************************************************************/ -// Typedef/Enumerations -/******************************************************************************/ - -namespace SPLESSCMD -{ - - -void read( bool &io_rgobit, - uint16_t &io_ristep, - uint16_t &io_rsubstep ) -{ - InternalCommand l_cmd; - - l_cmd.val64 = mmio_scratch_read(MMIO_SCRATCH_IPLSTEP_COMMAND); - - io_rgobit = l_cmd.f.gobit; - io_ristep = l_cmd.f.istep; - io_rsubstep = l_cmd.f.substep; - -} - - -void write( const bool i_gobit, - const uint16_t i_istep, - const uint16_t i_substep ) -{ - InternalCommand l_cmd; - - // copy into union - l_cmd.f.gobit = i_gobit; - l_cmd.f.istep = i_istep; - l_cmd.f.substep = i_substep; - - mmio_scratch_write( MMIO_SCRATCH_IPLSTEP_COMMAND, l_cmd.val64 ); - -} - - -void getgobit( bool &o_rgobit ) -{ - uint16_t l_istep = 0; - uint16_t l_substep = 0; - - // re-use above call... - read( o_rgobit, - l_istep, - l_substep ); - -} - - -void setgobit( const bool i_gobit ) -{ - InternalCommand l_cmd; - - l_cmd.val64 = mmio_scratch_read( MMIO_SCRATCH_IPLSTEP_COMMAND); - - l_cmd.f.gobit = i_gobit; - - mmio_scratch_write( MMIO_SCRATCH_IPLSTEP_COMMAND, l_cmd.val64 ); - -} - -} // namespace diff --git a/src/usr/initservice/istepdispatcher/splesscommon.H b/src/usr/initservice/istepdispatcher/splesscommon.H index 2cb273f0e..e912b7a85 100644 --- a/src/usr/initservice/istepdispatcher/splesscommon.H +++ b/src/usr/initservice/istepdispatcher/splesscommon.H @@ -95,9 +95,10 @@ enum { SPLESS_TASKRC_TERMINATED = -6, // terminated the polling loop SPLESS_TASKRC_FAIL_LOADMODULE = -7, // failed to load module - SPLESS_INVALID_COMMAND = 10, // invalid command from user console - SPLESS_AT_BREAK_POINT = 11, // at breakpoint - SPLESS_NOT_AT_BREAK_POINT = 12, // resume command w/o breakpoint + SPLESS_INVALID_COMMAND = 10, // invalid command from user console + SPLESS_AT_BREAK_POINT = 11, // at breakpoint + SPLESS_NOT_AT_BREAK_POINT = 12, // resume command w/o breakpoint + SPLESS_SHUTTING_DOWN = 13, // shutdown command issued }; /** @@ -139,6 +140,8 @@ extern uint64_t g_SPLess_IStepMode_Reg; const uint8_t SPLESS_SINGLE_ISTEP_CMD = 0x00; const uint8_t SPLESS_RESUME_ISTEP_CMD = 0x01; const uint8_t SPLESS_CLEAR_TRACE_CMD = 0x02; +const uint8_t SPLESS_SHUTDOWN_CMD = 0x03; + const uint64_t SPLESS_SINGLE_STEP_STS_MASK = 0x00000000ffffffff; /** diff --git a/src/usr/initservice/istepdispatcher/splessstatus.C b/src/usr/initservice/istepdispatcher/splessstatus.C deleted file mode 100644 index 30818778c..000000000 --- a/src/usr/initservice/istepdispatcher/splessstatus.C +++ /dev/null @@ -1,93 +0,0 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/istepdispatcher/splessstatus.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// 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 splessstatus.C - * - * Routines to read and write spless status reg - * - */ - -/******************************************************************************/ -// Includes -/******************************************************************************/ -#include <stdint.h> -#include <stdio.h> -#include <string.h> - -#include <errl/errlentry.H> // errlHndl_t -#include <sys/mmio.h> // mmio_scratch_read/write - -#include "splesscommon.H" - -/******************************************************************************/ -// Globals/Constants -/******************************************************************************/ - -/******************************************************************************/ -// Typedef/Enumerations -/******************************************************************************/ - - -void SPLESSSTS::read( bool &io_rrunningbit, - bool &io_rreadybit, - uint16_t &io_ristep, - uint16_t &io_rsubstep, - uint16_t &io_rtaskStatus, - uint16_t &io_ristepStatus ) -{ - InternalStatus l_sts; - - l_sts.val64 = mmio_scratch_read(MMIO_SCRATCH_IPLSTEP_STATUS); - - // read was good - io_rrunningbit = l_sts.f.runningbit; - io_rreadybit = l_sts.f.readybit; - io_ristep = l_sts.f.istep; - io_rsubstep = l_sts.f.substep; - io_rtaskStatus = l_sts.f.taskStatus; - io_ristepStatus = l_sts.f.istepStatus; - -} - - -void SPLESSSTS::write( const bool i_runningbit, - const bool i_readybit, - const uint16_t i_istep, - const uint16_t i_substep, - const uint16_t i_taskStatus, - const uint16_t i_istepStatus ) -{ - InternalStatus l_sts; - - // copy in all the values - l_sts.f.runningbit = i_runningbit; - l_sts.f.readybit = i_readybit; - l_sts.f.istep = i_istep; - l_sts.f.substep = i_substep; - l_sts.f.taskStatus = i_taskStatus; - l_sts.f.istepStatus = i_istepStatus; - - mmio_scratch_write( MMIO_SCRATCH_IPLSTEP_STATUS, l_sts.val64 ); - -} - diff --git a/src/usr/initservice/makefile b/src/usr/initservice/makefile index 5bdac5fde..c87b7187a 100644 --- a/src/usr/initservice/makefile +++ b/src/usr/initservice/makefile @@ -26,9 +26,9 @@ ROOTPATH = ../../.. # OBJS = -# NOTE: initsvctasktest2 is a dummy module that is executed by +# NOTE: initsvctest is a dummy module that is executed by # unit test 2 in the test directory. Please do not rename. -SUBDIRS = baseinitsvc.d extinitsvc.d taskargs.d istepdispatcher.d \ - test.d initsvctasktest2.d build.d +SUBDIRS = baseinitsvc.d extinitsvc.d istepdispatcher.d \ + test.d initsvctesttask.d build.d include ${ROOTPATH}/config.mk diff --git a/src/usr/initservice/taskargs/makefile b/src/usr/initservice/taskargs/makefile deleted file mode 100644 index 7d3c28fd8..000000000 --- a/src/usr/initservice/taskargs/makefile +++ /dev/null @@ -1,28 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/initservice/taskargs/makefile $ -# -# IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2011 -# -# 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 = ../../../.. -MODULE = taskargs - -OBJS = taskargs.o - -include ${ROOTPATH}/config.mk diff --git a/src/usr/initservice/taskargs/taskargs.C b/src/usr/initservice/taskargs/taskargs.C deleted file mode 100644 index 75cd7f828..000000000 --- a/src/usr/initservice/taskargs/taskargs.C +++ /dev/null @@ -1,162 +0,0 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/taskargs/taskargs.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// 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 taskargs.C - * - * common file to hold arguments passed onto tasks. - * will also hold macros, etc to manage arguments - * - * @note Notes on barrier: - * barrier_init() will initialize the barrier to the number of threads to - * wait on. - * "barrier_wait() function shall synchronize participating threads at - * the barrier referenced by barrier. - * The calling thread shall block until the required number of threads - * have called pthread_barrier_wait specifying the barrier." - * - * So in this case, the barrier is initialized to 2 (through barrier_init() - * in the constructor). - * When InitSvc launches the child, it calls barrier wait() (through - * waitChildSync() ) which adds 1 task to the "waitlist", blocks, and - * returns to InitSvc. InitSvc then calls waitParentSync() which adds - * its' task to the "waitlist". When the second task is added, both task - * are unblocked. - * - * The barrier is destroyed when TaskArgs goes out of scope by calling - * barrier_destroy() in the destructor. - * - */ - -#include <initservice/taskargs.H> - - -namespace INITSERVICE -{ - -extern trace_desc_t *g_trac_initsvc; - - -void TaskArgs::waitParentSync( ) -{ - - barrier_wait( &iv_sync_barrier); - -} - - -void TaskArgs::waitChildSync( ) -{ - - barrier_wait( &iv_sync_barrier); - -} - - -void TaskArgs::postReturnCode( const uint64_t i_returncode ) -{ - iv_taskreturncode = i_returncode; - - return; -} - - -uint64_t TaskArgs::getReturnCode( ) const -{ - - return iv_taskreturncode; -} - - -void TaskArgs::setCommand( const uint64_t i_command ) -{ - - iv_taskcommand = i_command; - - return; -} - - -uint64_t TaskArgs::getCommand( ) const -{ - - return iv_taskcommand; -} - - -void TaskArgs::postErrorLog( errlHndl_t i_errl ) -{ - - iv_errl = i_errl; -} - - -errlHndl_t TaskArgs::getErrorLog( ) -{ - errlHndl_t l_errl = iv_errl; - - // null out iv_errl after returning it to someone. - iv_errl = NULL; - - return l_errl; -} - - -void TaskArgs::clear() -{ - iv_taskreturncode = 0; // init iv_returncode - iv_taskcommand = 0; // init iv_command - - // this should not happen, should have been handled by the caller(s) - // commit the errorlog here just to get rid of it - if ( iv_errl ) - { - TRACFCOMP( g_trac_initsvc, - ERR_MRK "ERROR: errorlog %p was left in TaskArgs", - iv_errl ); - - errlCommit(iv_errl,INITSVC_COMP_ID); - } - -} - - -TaskArgs::TaskArgs() -: iv_errl( NULL ), // init errorlog handle to NULL - iv_taskreturncode(0), // init iv_returncode to undefined - iv_taskcommand(0) // init iv_command to undefined -{ - // set barrier to wait for 2 tasks before releasing, - // see notes above. - barrier_init( &iv_sync_barrier, 2 ); -} - - -TaskArgs::~TaskArgs() -{ - clear(); - barrier_destroy( &iv_sync_barrier ); - // add an assert here to check if there is still an errorlog pending? -} - -}; // namespace diff --git a/src/usr/initservice/test/initservicetest.H b/src/usr/initservice/test/initservicetest.H index d912a6e88..5cbd77111 100644 --- a/src/usr/initservice/test/initservicetest.H +++ b/src/usr/initservice/test/initservicetest.H @@ -32,6 +32,8 @@ #define __TEST_INIT_SERVICETEST_H +#include <errl/errlentry.H> // errlHndl_t +#include <errl/errlmanager.H> // errlCommit() #include <cxxtest/TestSuite.H> @@ -58,7 +60,7 @@ const INITSERVICE::TaskInfo TASK_TEST1 = { * */ const INITSERVICE::TaskInfo TASK_TEST2 = { - "libinitsvctasktest2.so" , // taskname + "libinitsvctesttask.so" , // taskname NULL, // ptr to fn { INITSERVICE::START_TASK, // startflag=true, try to start @@ -110,7 +112,7 @@ public: TS_TRACE( "=====>Run a nonexistent task, expect an ERROR."); l_errl = l_is.startTask( &TASK_TEST1, - NULL ); + NULL ); if ( l_errl ) { TS_TRACE( "SUCCESS: startTask returned an errorlog.\n"); diff --git a/src/usr/intr/intrrp.C b/src/usr/intr/intrrp.C index c2531a3ea..224826fc1 100644 --- a/src/usr/intr/intrrp.C +++ b/src/usr/intr/intrrp.C @@ -51,16 +51,14 @@ TRAC_INIT(&g_trac_intr, INTR_COMP_NAME, 2 * 1024); TASK_ENTRY_MACRO( IntrRp::init ); -void IntrRp::init( void * i_taskArgs ) +void IntrRp::init( errlHndl_t &io_errlHndl_t ) { errlHndl_t err = NULL; + err = Singleton<IntrRp>::instance()._init(); - INITSERVICE::TaskArgs* args = - static_cast<INITSERVICE::TaskArgs*>(i_taskArgs); - if(err) - { - args->postErrorLog(err); - } + + // pass task error back to parent + task_end2( err ); } diff --git a/src/usr/intr/intrrp.H b/src/usr/intr/intrrp.H index 3e8c06659..7078f823f 100644 --- a/src/usr/intr/intrrp.H +++ b/src/usr/intr/intrrp.H @@ -42,9 +42,9 @@ namespace INTR /** * Prepare HW and system to recieve external interrupts - * @param[in] task args + * @param[in] ref to errlHndl_t */ - static void init(void * i_taskArgs); + static void init( errlHndl_t &io_rtaskRetErrl ); protected: diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C index 40ea0e453..a2175d06b 100644 --- a/src/usr/pnor/pnorrp.C +++ b/src/usr/pnor/pnorrp.C @@ -89,16 +89,32 @@ errlHndl_t PNOR::getSectionInfo( PNOR::SectionId i_section, * STATIC * @brief Static Initializer */ -void PnorRP::init( void* i_taskArgs ) +void PnorRP::init( errlHndl_t &io_rtaskRetErrl ) { TRACUCOMP(g_trac_pnor, "PnorRP::init> " ); - INITSERVICE::TaskArgs* args = - static_cast<INITSERVICE::TaskArgs*>(i_taskArgs); uint64_t rc = 0; + errlHndl_t l_errl = NULL; + if( Singleton<PnorRP>::instance().didStartupFail(rc) ) { - args->postReturnCode(rc); + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid MOD_PNORRP_DIDSTARTUPFAIL + * @reasoncode RC_BAD_STARTUP_RC + * @userdata1 return code + * @userdata2 0 + * + * @devdesc PNOR startup task returned an error. + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + PNOR::MOD_PNORRP_DIDSTARTUPFAIL, + PNOR::RC_BAD_STARTUP_RC, + rc, + 0 ); } + + task_end2( l_errl ); } @@ -325,7 +341,7 @@ errlHndl_t PnorRP::readTOC() // Will update under Story 3871 // assume 1 chip with only 1 side for now, no sideless - // TOC starts at offset zero + // TOC starts at offset zero // put some random sizes in here iv_TOC[PNOR::SIDE_A][PNOR::TOC].size = 8 + 8 + PNOR::NUM_SECTIONS*sizeof(TOCEntry_t); @@ -339,7 +355,7 @@ errlHndl_t PnorRP::readTOC() iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::TOC].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::TOC].size; iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size; iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].size; - // flash + // flash iv_TOC[PNOR::SIDE_A][PNOR::TOC].flashAddr = 0; iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr = iv_TOC[PNOR::SIDE_A][PNOR::TOC].flashAddr + iv_TOC[PNOR::SIDE_A][PNOR::TOC].size; iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].flashAddr = iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr + iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size; @@ -354,7 +370,7 @@ errlHndl_t PnorRP::readTOC() TRACFCOMP(g_trac_pnor, "DATA: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].size, iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].virtAddr ); //@todo - load flash layout (how many chips) - //@todo - read TOC on each chip/bank/whatever + //@todo - read TOC on each chip/bank/whatever TRACUCOMP(g_trac_pnor, "< PnorRP::readTOC" ); return l_errhdl; @@ -392,7 +408,7 @@ void PnorRP::waitForMessage() eff_addr = (uint8_t*)message->data[0]; user_addr = (uint8_t*)message->data[1]; - //figure out the real pnor offset + //figure out the real pnor offset l_errhdl = computeDeviceAddr( eff_addr, dev_offset, chip_select, needs_ecc ); if( l_errhdl ) { diff --git a/src/usr/pnor/pnorrp.H b/src/usr/pnor/pnorrp.H index 6d387c203..97a7fa80c 100644 --- a/src/usr/pnor/pnorrp.H +++ b/src/usr/pnor/pnorrp.H @@ -38,9 +38,9 @@ class PnorRP public: /** * @brief Static Initializer - * @param[in] Task Args pointer passed by init service + * @param[in] ref to errlHndl_t */ - static void init( void* i_taskArgs ); + static void init( errlHndl_t &io_rtaskRetErrl ); /** * @brief Return the size and address of a given section of PNOR data @@ -89,7 +89,7 @@ class PnorRP LAST_VADDR = BASE_VADDR + TOTAL_SIZE, /**< End of our VA range */ /** Real number of bytes required to read 1 logical page */ - PAGESIZE_PLUS_ECC = PAGESIZE * (9/8), // 8 bytes of data + 1 byte of ECC + PAGESIZE_PLUS_ECC = PAGESIZE * (9/8), // 8 bytes of data + 1 byte of ECC }; /** @@ -205,7 +205,7 @@ class PnorRP * @brief Figure out which section a VA belongs to * * @param[in] i_vaddr Virtual address of page - * @param[out] o_side Which side of the flash + * @param[out] o_side Which side of the flash * @param[out] o_id Which section of PNOR * * @return Error if VA is bad @@ -264,4 +264,4 @@ class PnorRP }; -#endif +#endif diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index 5bdf42c41..324911778 100644 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -54,10 +54,10 @@ namespace TARGETING uint64_t size; }; - void AttrRP::init(TaskArgs* i_taskArgs) + void AttrRP::init( errlHndl_t &io_taskRetErrl ) { // Call startup on singleton instance. - Singleton<AttrRP>::instance().startup(i_taskArgs); + Singleton<AttrRP>::instance().startup( io_taskRetErrl ); } void AttrRP::startMsgServiceTask(void* i_instance) @@ -78,7 +78,7 @@ namespace TARGETING assert(false); } - void AttrRP::startup(TaskArgs* i_taskArgs) + void AttrRP::startup( errlHndl_t &io_taskRetErrl ) { errlHndl_t l_errl = NULL; @@ -101,18 +101,10 @@ namespace TARGETING if (l_errl) { l_errl->setSev(ERRORLOG::ERRL_SEV_UNRECOVERABLE); - if (i_taskArgs) - { - i_taskArgs->postErrorLog(l_errl); - } - else - { - TRACFCOMP(g_trac_targeting, - ERR_MRK "AttrRP: Critical error in startup and no " - "TaskArgs given by init-service."); - errlCommit(l_errl,TARG_COMP_ID); - } } + + // return any errlogs to _start() + io_taskRetErrl = l_errl; } void AttrRP::msgServiceTask() const diff --git a/src/usr/targeting/attrrp.H b/src/usr/targeting/attrrp.H index 9c338114f..3fc2f6a02 100644 --- a/src/usr/targeting/attrrp.H +++ b/src/usr/targeting/attrrp.H @@ -44,13 +44,13 @@ namespace TARGETING { public: /** @brief Initializes and starts the AttrRP daemon. - * @param[in] i_taskArgs - Pointer to init service arguments. + * @param[in,out] - ref to an errHndl_t * * @note If any error occurs during initialization, it will be * reported back through the TaskArgs structure to the init * service. */ - static void init(INITSERVICE::TaskArgs* i_taskArgs); + static void init( errlHndl_t &io_taskRetErrl ); protected: /** @brief Default constructor. @@ -75,7 +75,7 @@ namespace TARGETING * init() is a static function that just calls * Singleton<AttrRP>::instance().startup(). See init for behavior. */ - void startup(INITSERVICE::TaskArgs* i_taskArgs); + void startup( errlHndl_t &io_taskRetErrl ); /** @brief Daemon thread processing function. * diff --git a/src/usr/targeting/targetservice.C b/src/usr/targeting/targetservice.C index 27b208a47..63c76012b 100644 --- a/src/usr/targeting/targetservice.C +++ b/src/usr/targeting/targetservice.C @@ -78,28 +78,23 @@ namespace TARGETING extern "C" void _start(void* io_pArgs) { - INITSERVICE::TaskArgs *pTaskArgs = - static_cast<INITSERVICE::TaskArgs *>(io_pArgs); + errlHndl_t io_taskRetErrl = NULL; #define TARG_FN "_start(...)" TARG_ENTER(); - AttrRP::init(pTaskArgs); - if (( pTaskArgs ) && (!pTaskArgs->queryErrorLog())) + AttrRP::init( io_taskRetErrl ); + + if ( io_taskRetErrl == NULL ) { TargetService& l_targetService = targetService(); (void)l_targetService.init(); } - TARG_EXIT(); - - if ( pTaskArgs ) - { - pTaskArgs->waitChildSync(); - } + task_end2( io_taskRetErrl ); - task_end(); + TARG_EXIT(); #undef TARG_FN } diff --git a/src/usr/vfs/vfsrp.C b/src/usr/vfs/vfsrp.C index be9364965..42a63ea86 100644 --- a/src/usr/vfs/vfsrp.C +++ b/src/usr/vfs/vfsrp.C @@ -64,18 +64,15 @@ VfsRp::~VfsRp() /** * STATIC initializer of vfs resource provider entry point */ -void VfsRp::init( void * i_taskArgs ) +void VfsRp::init( errlHndl_t &io_taskRetErrl ) { errlHndl_t err = NULL; + err = Singleton<VfsRp>::instance()._init(); - INITSERVICE::TaskArgs* args = - static_cast<INITSERVICE::TaskArgs*>(i_taskArgs); - if(err) - { - args->postErrorLog(err); - } -} + + task_end2( err ); +} // ---------------------------------------------------------------------------- /** @@ -434,7 +431,7 @@ const char * VfsRp::get_name_from_address(const void * i_vaddr) const { module = vfs_find_address(VFS_MODULES,i_vaddr); } - if(module) + if(module) { result = module->module; } diff --git a/src/usr/vfs/vfsrp.H b/src/usr/vfs/vfsrp.H index c57603907..36e9ed1c8 100644 --- a/src/usr/vfs/vfsrp.H +++ b/src/usr/vfs/vfsrp.H @@ -47,7 +47,7 @@ namespace VFS * static init * @param[in] task args */ - static void init(void * i_taskArgs); + static void init( errlHndl_t &io_taskRetErrl ); /** * Get the list of test modules @@ -126,7 +126,7 @@ namespace VFS errlHndl_t _init(); /** - * Message handler + * Message handler */ void msgHandler(); |