summaryrefslogtreecommitdiffstats
path: root/src/usr/initservice/baseinitsvc
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2012-03-20 11:37:13 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-04 13:23:18 -0500
commitdd7a32e1a27ecac1c8decaa958cbca7ef139c6bc (patch)
tree65706898117498bf0c280e772c3e850386b0c378 /src/usr/initservice/baseinitsvc
parent36123c3c9911bc6feefc27e17b4285f1079b569f (diff)
downloadblackbird-hostboot-dd7a32e1a27ecac1c8decaa958cbca7ef139c6bc.tar.gz
blackbird-hostboot-dd7a32e1a27ecac1c8decaa958cbca7ef139c6bc.zip
Refactor InitService
Finish join() conversion, remove TaskArgs Cleanup Initservice Cleanup ExtInitService Cleanup IStepDisp Add SPLess Halt & Shutdown command. Implements code for Tasks 35508, 3855, 36929 and 38870 . RTC: 38196 Change-Id: I554655412b529ef6cd143fea361a39bd584d18b5 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/794 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/initservice/baseinitsvc')
-rw-r--r--src/usr/initservice/baseinitsvc/initservice.C495
-rw-r--r--src/usr/initservice/baseinitsvc/initservice.H53
-rw-r--r--src/usr/initservice/baseinitsvc/initservicetaskentry.C67
-rw-r--r--src/usr/initservice/baseinitsvc/initsvctasks.H17
-rw-r--r--src/usr/initservice/baseinitsvc/makefile3
5 files changed, 373 insertions, 262 deletions
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
OpenPOWER on IntegriCloud