summaryrefslogtreecommitdiffstats
path: root/src/include
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/include
parent36123c3c9911bc6feefc27e17b4285f1079b569f (diff)
downloadtalos-hostboot-dd7a32e1a27ecac1c8decaa958cbca7ef139c6bc.tar.gz
talos-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/include')
-rw-r--r--src/include/usr/initservice/initsvcreasoncodes.H28
-rw-r--r--src/include/usr/initservice/taskargs.H246
-rw-r--r--src/include/usr/pnor/pnor_reasoncodes.H4
3 files changed, 47 insertions, 231 deletions
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
};
};
OpenPOWER on IntegriCloud