diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/initservice/initsvcreasoncodes.H | 6 | ||||
-rw-r--r-- | src/include/usr/initservice/initsvcstructs.H | 122 | ||||
-rw-r--r-- | src/include/usr/initservice/taskargs.H | 17 | ||||
-rw-r--r-- | src/include/usr/isteps/isteplist.H | 155 | ||||
-rw-r--r-- | src/include/usr/isteps/isteps.H | 50 |
5 files changed, 347 insertions, 3 deletions
diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 4ff3fb076..bc4eb3c44 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -20,6 +20,7 @@ // Origin: 30 // // IBM_PROLOG_END + /** * @file initsvcreasoncodes.H * @@ -92,7 +93,10 @@ 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, }; diff --git a/src/include/usr/initservice/initsvcstructs.H b/src/include/usr/initservice/initsvcstructs.H new file mode 100644 index 000000000..bc459da4b --- /dev/null +++ b/src/include/usr/initservice/initsvcstructs.H @@ -0,0 +1,122 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/initservice/common/initsvcstructs.H $ +// +// 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 +#ifndef __COMMON_INITSVCSTRUCTS_H +#define __COMMON_INITSVCSTRUCTS_H +/** + * @file initsvcstructs.H + * + * common structs for initservice, extinitsvc, istepdispatcher + * + */ + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> +#include <sys/vfs.h> // VFS_MODULE_MAX + +namespace INITSERVICE +{ + +/******************************************************************************/ +// Globals/Constants +/******************************************************************************/ + + +/******************************************************************************/ +// Typedef/Enumerations +/******************************************************************************/ + +/** + * @enum TaskType + * - NONE == placeholder, no task + * - INIT_TASK == load and initialize task, but task has no _start() + * (extended image only) + * - START_TASK == BASE_IMAGE: call _start() function entry point + * EXT_IMAGE: call _init(), then _start() + * - START_FN == task with function pointer entry point + * - UNINIT_TASK == call _fini() to call static destructor(s) on the task. + * (extended image only) + * - END_TASK_LIST == last entry in the task list. + */ + +enum TaskType +{ + UNDEFINED_TT = 0, + NONE, + INIT_TASK, + START_TASK, + START_FN, + UNINIT_TASK, + END_TASK_LIST, +}; + + +/** + * @enum ModuleType + * - BASE_IMAGE == module in the base image + * - EXT_IMAGE == module in the extended image + */ +enum ModuleType +{ + UNDEFINED_MT = 0, + BASE_IMAGE, + EXT_IMAGE, +}; + + +/** + * @struct TaskFlags + * + * - run _start() function on start + * - module type, BASE_MODULE or EXT_MODULE + * - module_id for errorlog if task fails + * + */ +struct TaskFlags +{ + TaskType task_type; // task execution flags + ModuleType module_type; // BASE_IMAGE or EXT_IMAGE + InitServiceModuleID module_id; // module id for errorlog +}; + + +/** + * @struct TaskInfo + * + * Holds information on each task in the system. + * - taskname + * - execution flags, see TaskFlags above + * + */ +struct TaskInfo +{ + const char taskname[VFS_MODULE_NAME_MAX]; + void (*taskfn)(void *ptr); + const TaskFlags taskflags; + +}; + +} // namespace + +#endif diff --git a/src/include/usr/initservice/taskargs.H b/src/include/usr/initservice/taskargs.H index c4d81e1a5..fdc24e291 100644 --- a/src/include/usr/initservice/taskargs.H +++ b/src/include/usr/initservice/taskargs.H @@ -66,7 +66,7 @@ namespace INITSERVICE { /** - * @const TASKARGS_UNDEFINED64 + * @def TASKARGS_UNDEFINED64 * iv_taskreturncode and iv_taskcommand are initialized to this value - * if parent or child change them, it can be easily recognized * @@ -112,6 +112,7 @@ public: * Currently there is no difference between parent and child * but this may change. * + * @return none */ void waitParentSync(); @@ -124,6 +125,7 @@ public: * Currently there is no difference between parent and child * but this may change. * + * @return none */ void waitChildSync(); @@ -135,6 +137,7 @@ public: * * @param[in] i_returncode; * + * @return none. */ void postReturnCode( const uint64_t i_returncode ); @@ -156,6 +159,8 @@ public: * 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 ); @@ -165,7 +170,7 @@ public: * * Child can get commands from the parent using this function * - *@return value of iv_taskcommand; + * @return value of iv_taskcommand; * * @todo might overload this later if we need to pass structs, * buffers, etc. @@ -182,6 +187,7 @@ public: * * @param[in] i_errl; * + * @return none */ void postErrorLog( errlHndl_t i_errl ); @@ -191,6 +197,11 @@ public: * * 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 * */ @@ -202,6 +213,8 @@ public: * - barrier is left alone, * - if iv_errl is non zero, we commit it here just to avoid * a memory leak. + * + * @return none */ void clear(); diff --git a/src/include/usr/isteps/isteplist.H b/src/include/usr/isteps/isteplist.H new file mode 100644 index 000000000..730310b87 --- /dev/null +++ b/src/include/usr/isteps/isteplist.H @@ -0,0 +1,155 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/isteps/isteplist.H $ +// +// 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 +#ifndef __ISTEPS_H +#define __ISTEPS_H + +/** + * @file isteplist.H + * + * TaskInfo structs for each task that will run in the extended image. + */ + +#include <vector> + +#include <initservice/initsvcreasoncodes.H> +#include <initservice/initsvcstructs.H> + +#include "isteps.H" + + +namespace INITSERVICE +{ + +const uint64_t MAX_SUBSTEPS = 25; + +/** + * @struct ExtTaskInfo + * + * struct to store the TaskInfo for this IStep, plus the number of items in + * the istep (calculated at compiletime). + */ +struct ExtTaskInfo +{ + const TaskInfo *const pti; + const uint64_t numitems; +}; + +const TaskInfo istep0[] = { + + { + "istep0_substep0" , // istep name + ISTEPS::IStep0sub0, // pointer to fn + { + NONE, // task type + EXT_IMAGE, // Extended Module + ISTEP_1_ERRL_ID, // module id + } + }, + + { + "istep0_substep1" , // istep name + ISTEPS::IStep0sub1, // pointer to fn + { + NONE, // task type + EXT_IMAGE, // Extended Module + ISTEP_1_ERRL_ID, // module id + } + }, + + // --------------------------------------------------------------- + // ----- END OF LIST!!! --------------------------------------- + // --------------------------------------------------------------- + /** + * @brief last task in the list + */ + { + "end_istep0" , // dummy string + NULL, // pointer to fn + { + END_TASK_LIST, // end of list + UNDEFINED_MT, // dummy module type + UNDEFINED_MODULE_ERRL_ID, // dummy errorlog + } + }, +}; + +// make a struct from the above with the number of items included +const ExtTaskInfo g_istep0 = { + &(istep0[0]), + ( sizeof(istep0)/sizeof(TaskInfo) ) // numitems +}; + + +const TaskInfo istep1[] = { + + /** + * @brief targeting task, initializes extended module area + */ + { + "istep1_sub0" , // istep name + ISTEPS::IStep1sub0, // pointer to fn + { + NONE, // task type + EXT_IMAGE, // Extended Module + ISTEP_1_ERRL_ID, // module id + } + }, + + // --------------------------------------------------------------- + // ----- END OF LIST!!! --------------------------------------- + // --------------------------------------------------------------- + + /** + * @brief last task in the list + */ + { + "end" , // dummy string + NULL, // pointer to fn + { + END_TASK_LIST, // end of list + UNDEFINED_MT, // dummy module type + UNDEFINED_MODULE_ERRL_ID, // dummy errorlog + } + }, +}; + +// make a struct from the above with the number of items included +ExtTaskInfo g_istep1 = { + istep1, + ( sizeof(istep1)/sizeof(TaskInfo) ) +}; + + +// initialize an array of ExtTaskInfo +const ExtTaskInfo g_isteps[] = { + g_istep0, + g_istep1, +}; + +// publish the size of the g_isteps array +const uint64_t MAX_ISTEPS = sizeof(g_isteps)/sizeof(TaskInfo *) ; + + +}; // namespace + +#endif diff --git a/src/include/usr/isteps/isteps.H b/src/include/usr/isteps/isteps.H new file mode 100644 index 000000000..b8dac9132 --- /dev/null +++ b/src/include/usr/isteps/isteps.H @@ -0,0 +1,50 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/isteps/isteps.H $ +// +// 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 isteps.H + * + * Prototypes of ISteps launched by IStepDispatcher + * used by isteplist.H + * + */ + + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> + +namespace ISTEPS +{ + +extern "C" +void IStep0sub0( void * io_pArgs ); + +extern "C" +void IStep0sub1( void * io_pArgs ); + +extern "C" +void IStep1sub0( void * io_pArgs ); + + +} // namespace |