summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-07-11 15:43:13 -0500
committerMark W. Wenning <wenning@us.ibm.com>2011-07-25 16:50:09 -0500
commit9c0e69b8cdf3aabcd77c119c3b3425fda66706da (patch)
tree77a5b7f1c4f58da3a74048e54575a5b9a7785f34 /src/usr
parentb679a1729d7aea0870544e886ddb4b03e1ecf4c4 (diff)
downloadtalos-hostboot-9c0e69b8cdf3aabcd77c119c3b3425fda66706da.tar.gz
talos-hostboot-9c0e69b8cdf3aabcd77c119c3b3425fda66706da.zip
Cleanup from previous reviews, add barrier for CxxTest
- add IStep1 for demo - cleanup: remove inheritance, add errlog tags, etc. - inadvertently ran copyright script, this is OK. - more cleanup: indentation, etc. - add barrier for CxxTests - rename cxxtest_stub.C to cxxtest_data.C - merge problems on gerrit - fix review comments Change-Id: Iee988b8595d8c6dd521fd94d4d58cb403898d948 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/207 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/cxxtest/TestSuite.C43
-rw-r--r--src/usr/cxxtest/cxxtestexec.C125
-rwxr-xr-xsrc/usr/cxxtest/cxxtestgen.pl20
-rw-r--r--src/usr/initservice/baseinitsvc/initservice.C214
-rw-r--r--src/usr/initservice/baseinitsvc/initservice.H44
-rw-r--r--src/usr/initservice/baseinitsvc/initservicetaskentry.C5
-rw-r--r--src/usr/initservice/baseinitsvc/initsvctasks.H28
-rw-r--r--src/usr/initservice/common/initsvcstructs.H23
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvc.C120
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvc.H55
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H22
-rw-r--r--src/usr/initservice/initsvcunittesttask2/tasktest2.C21
-rw-r--r--src/usr/initservice/initsvcunittesttask2/tasktest2.H22
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C70
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.H52
-rw-r--r--src/usr/initservice/istepdispatcher/isteplist.H24
-rw-r--r--src/usr/initservice/taskargs/taskargs.C60
-rw-r--r--src/usr/initservice/test/initservicetest.H26
-rw-r--r--src/usr/isteps/istep1.C52
-rw-r--r--src/usr/isteps/makefile5
20 files changed, 781 insertions, 250 deletions
diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C
index 79677b83b..2af815346 100755
--- a/src/usr/cxxtest/TestSuite.C
+++ b/src/usr/cxxtest/TestSuite.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
// Imported from FSP tree - /src/test/cxxtest/cxxtest/
#ifndef __cxxtest__TestSuite_cpp__
@@ -15,26 +32,6 @@ namespace CxxTest
// Globals/Constants
/******************************************************************************/
-/**
- * @brief global vars to keep track of unit tests.
- *
- * totaltests - initialized to 0, updated by reporttotaltests() below.
- * each test suite will call reporttotaltests after all tests have
- * run with the total number of tests for that suite.
- * Once all the testsuites have run, the global totaltests will hold
- * the total of number of unit test for that run.
- *
- * Each unit test macro (TS_TRACE, TS_WARN, and TS_FAIL) will update
- * the proper variable. At the end the unit tester will print out
- * the totals.
- * // Global cxxtest values - Keep global so it can be found in syms file
- */
-uint64_t g_TotalTests = 0;
-uint64_t g_TraceCalls = 0;
-uint64_t g_Warnings = 0;
-uint64_t g_FailedTests = 0;
-
-
//
// TestSuite members
//
@@ -109,7 +106,11 @@ void reportTotalTests( const char *suitename, uint64_t numtests )
// $$TODO do nothing with the suite name for now, later it may be useful
__sync_add_and_fetch( &g_TotalTests, numtests );
- printk( "%s completed %ld tests\n", suitename, numtests);
+ TRACDBIN( g_trac_test,
+ "Suite Completed: ",
+ suitename,
+ strlen(suitename) );
+ // printk( "%s completed %ld tests\n", suitename, numtests);
return;
}
diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C
index d79188e9e..5470b718a 100644
--- a/src/usr/cxxtest/cxxtestexec.C
+++ b/src/usr/cxxtest/cxxtestexec.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#include <sys/vfs.h>
#include <sys/task.h>
#include <string.h>
@@ -5,27 +22,76 @@
#include <sys/time.h>
#include <sys/sync.h>
+#include <initservice/taskargs.H>
#include <cxxtest/TestSuite.H>
namespace CxxTest
{
- uint64_t g_ModulesStarted = 0;
- uint64_t g_ModulesCompleted = 0;
-}
+ uint64_t g_ModulesStarted = 0;
+ uint64_t g_ModulesCompleted = 0;
+
+ /**
+ * @var g_CxxTestBarrier - barrier for CxxTest modules.
+ * all test modules will wait on this barrier before returning to the caller
+ * in cxxtest/cxxtestexec.C .
+ */
+ barrier_t g_CxxTestBarrier;
+
+} // namespace
+
+using namespace INITSERVICE;
+
+trace_desc_t *g_trac_cxxtest = NULL;
+TRAC_INIT(&g_trac_cxxtest, "CXXTEST", 1024 );
+
/**
- * @brief _start()
- * Iterate through all modules in the VFS named "libtest*" and create children
- * tasks to execute them.
+ * @brief _start() 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
*
*/
extern "C"
-void _start(void*)
+void _start(void *io_pArgs)
{
- VfsSystemModule* vfsItr = &VFS_MODULES[0];
- tid_t tidrc = 0;
+ VfsSystemModule* vfsItr = &VFS_MODULES[0];
+ tid_t tidrc = 0;
+ uint64_t totalmodules = 0;
+ TaskArgs::TaskArgs *pTaskArgs =
+ reinterpret_cast<TaskArgs::TaskArgs *>(io_pArgs);
+
+
+ // count up the number of viable modules ahead of time
+ TRACDCOMP( g_trac_cxxtest, "Counting CxxTextExec modules:" );
+
+ while(vfsItr->module[0] != '\0')
+ {
+ if (0 == memcmp(vfsItr->module, "libtest", 7))
+ {
+ if (NULL != vfsItr->start)
+ {
+ TRACDBIN( g_trac_cxxtest,
+ "",
+ &(vfsItr->module[0]),
+ strlen( &(vfsItr->module[0]) )
+ );
+
+ totalmodules++;
+ }
+ }
+ vfsItr++;
+ }
+
+ // start executing the CxxTest modules
+ TRACDCOMP( g_trac_cxxtest, ENTER_MRK "Execute CxxTestExec, totalmodules=%d.",
+ totalmodules);
+ vfsItr = &VFS_MODULES[0]; // re-init
+
+ // set barrier for all the modules being started, plus this module
+ barrier_init( &CxxTest::g_CxxTestBarrier, totalmodules+1 );
- printk( "Executing CxxTestExec.\n");
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
while(vfsItr->module[0] != '\0')
@@ -36,28 +102,51 @@ void _start(void*)
{
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
- printk( "CxxTestExec %d : running %s, ModulesStarted=0x%ld\n",
+#if 0
+ // arrgh, no %s in trace
+ TRACDCOMP( g_trac_cxxtest,
+ "Running %s, ModulesStarted=%d",
__LINE__,
vfsItr->module,
CxxTest::g_ModulesStarted );
+#else
+ TRACDCOMP( g_trac_cxxtest,
+ "ModulesStarted=%d",
+ CxxTest::g_ModulesStarted );
+#endif
tidrc = task_exec( vfsItr->module, NULL );
- printk( "CxxTestExec %d : tidrc=%d\n",
- __LINE__, tidrc );
+ TRACDCOMP( g_trac_cxxtest, "Launched task: tidrc=%d",
+ tidrc );
}
}
vfsItr++;
}
+ TRACDCOMP( g_trac_cxxtest, "Waiting for all tasks to finish....");
+ // wait for all the launched tasks to finish
+ barrier_wait( &CxxTest::g_CxxTestBarrier );
+
__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);
- printk( " ModulesCompleted=0x%ld\n", CxxTest::g_ModulesCompleted );
+ TRACDCOMP( g_trac_cxxtest, " ModulesCompleted=%d",
+ CxxTest::g_ModulesCompleted );
+ TRACDCOMP( g_trac_cxxtest, EXIT_MRK "Finished CxxTestExec: ");
+ TRACDCOMP( g_trac_cxxtest, " total tests: %d",
+ CxxTest::g_TotalTests );
+ TRACDCOMP( g_trac_cxxtest, " failed tests: %d",
+ CxxTest::g_FailedTests );
+ TRACDCOMP( g_trac_cxxtest, " warnings: %d",
+ CxxTest::g_Warnings );
+ TRACDCOMP( g_trac_cxxtest, " trace calls: %d",
+ CxxTest::g_TraceCalls );
- printk( "total tests: %ld\n", CxxTest::g_TotalTests );
- printk( "failed tests: %ld\n", CxxTest::g_FailedTests );
- printk( "warnings: %ld\n", CxxTest::g_Warnings );
- printk( "trace calls: %ld\n", CxxTest::g_TraceCalls );
+ // wait for TaskArgs barrier
+ if ( pTaskArgs )
+ {
+ pTaskArgs->waitChildSync();
+ }
task_end();
}
diff --git a/src/usr/cxxtest/cxxtestgen.pl b/src/usr/cxxtest/cxxtestgen.pl
index d21305250..1bce4ae0d 100755
--- a/src/usr/cxxtest/cxxtestgen.pl
+++ b/src/usr/cxxtest/cxxtestgen.pl
@@ -1,4 +1,21 @@
#!/usr/bin/perl -w
+#############################################################################
+# $IBMCopyrightBlock:
+#
+# IBM Confidential
+#
+# Licensed Internal Code Source Materials
+#
+# IBM HostBoot Licensed Internal Code
+#
+# (C) Copyright IBM Corp. 2011
+#
+# 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.
+#$
+#############################################################################
+
#
# Change History:
# mww 2011-05-10 simplify for sprint1 - stuff for later is commented out with "##"
@@ -39,6 +56,7 @@ sub main {
parseCommandline();
scanInputFiles();
writeOutput();
+
}
#
@@ -718,6 +736,8 @@ sub write_start() {
print "\n";
print "\t__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);\n";
+ print "\n";
+ print "\tbarrier_wait( &CxxTest::g_CxxTestBarrier );\n";
print "\n";
print "\ttask_end();\n";
diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C
index de96ea922..dc8380f19 100644
--- a/src/usr/initservice/baseinitsvc/initservice.C
+++ b/src/usr/initservice/baseinitsvc/initservice.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file initservice.C
*
@@ -51,16 +68,12 @@ InitService::~InitService()
}
-/**
- * @todo mechanism to set taskcommand in TaskArgs struct
- * @todo check taskreturncode inside of TaskArgs
- * @todo test errorlog inside of Taskargs
- */
+
errlHndl_t InitService::startTask( const TaskInfo *i_ptask,
- TaskArgs::TaskArgs *io_pargs,
- errlHndl_t &io_rerrl ) const
+ TaskArgs::TaskArgs *io_pargs ) const
{
- tid_t tidrc = 0;
+ tid_t tidrc = 0;
+ errlHndl_t lo_errl = NULL;
assert(i_ptask->taskflags.task_type == START_TASK);
@@ -68,7 +81,18 @@ errlHndl_t InitService::startTask( const TaskInfo *i_ptask,
if ( static_cast<int16_t>(tidrc) < 0 )
{
// task failed to launch, post an errorlog and dump some trace
- io_rerrl = new ERRORLOG::ErrlEntry(
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid see task list
+ * @reasoncode START_TASK_FAILED
+ * @userdata1 task id or task return code
+ * @userdata2 0
+ *
+ * @devdesc Initialization Service failed to start a task.
+ * The module id will identify the task.
+ *
+ */
+ lo_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
i_ptask->taskflags.module_id, // moduleid
INITSERVICE::START_TASK_FAILED, // reason Code
@@ -81,37 +105,36 @@ errlHndl_t InitService::startTask( const TaskInfo *i_ptask,
strlen(i_ptask->taskname) );
TRACDCOMP( g_trac_initsvc,
"tidrc=%d, errlog p = %p" ,
- (int16_t)tidrc, io_rerrl );
+ (int16_t)tidrc, lo_errl );
} // endif tidrc
else
{
- // task launched OK.
+ // task launched OK.
TRACDBIN( g_trac_initsvc,
"Task finished OK :",
i_ptask->taskname,
strlen(i_ptask->taskname) );
TRACDCOMP( g_trac_initsvc,
"task number %d, errlog p = %p",
- tidrc, io_rerrl );
+ tidrc, lo_errl );
if ( io_pargs )
{
io_pargs->waitParentSync(); // sync up childtask
}
-
- }
- return io_rerrl;
+ }
+
+ return lo_errl;
}
errlHndl_t InitService::executeFn( const TaskInfo *i_ptask,
- TaskArgs *io_pargs
-) const
+ TaskArgs *io_pargs ) const
{
tid_t tidrc = 0;
- errlHndl_t errl = NULL;
+ errlHndl_t lo_errl = NULL;
if ( i_ptask->taskfn == NULL )
{
@@ -119,57 +142,82 @@ errlHndl_t InitService::executeFn( const TaskInfo *i_ptask,
"ERROR: NULL function pointer:",
i_ptask->taskname,
strlen(i_ptask->taskname) );
-
- errl = new ERRORLOG::ErrlEntry(
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid see task list
+ * @reasoncode NULL_FN_PTR
+ * @userdata1 0
+ * @userdata2 0
+ *
+ * @devdesc Initialization Service attempted to start a
+ * function within a module but found a NULL pointer
+ * instead of the function.
+ * The module id will identify the task.
+ */
+ lo_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
i_ptask->taskflags.module_id, // moduleid
INITSERVICE::NULL_FN_PTR, // reason Code
0,
0 );
- return errl;
+ // fall through to end and return bad error log
}
-
-
- // valid function, launch it
- tidrc = task_create( i_ptask->taskfn, io_pargs );
- if ( static_cast<int16_t>(tidrc) < 0 )
- {
- errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
- i_ptask->taskflags.module_id, // moduleid
- INITSERVICE::START_FN_FAILED, // reason Code
- tidrc, // user1 = tidrc
- 0 );
-
- TRACDBIN( g_trac_initsvc,
- ENTER_MRK "ERROR starting function:",
- i_ptask->taskname,
- strlen(i_ptask->taskname) );
- TRACDCOMP( g_trac_initsvc,
- EXIT_MRK "tidrc=%d, errlog p = %p" ,
- (int16_t)tidrc, errl );
-
- } // endif tidrc
else
{
- TRACDBIN( g_trac_initsvc,
- ENTER_MRK "function launched OK :",
- i_ptask->taskname,
- strlen(i_ptask->taskname) );
- TRACDCOMP( g_trac_initsvc,
- EXIT_MRK "task number %d, errlog p = %p",
- tidrc, errl );
+ // valid function, launch it
+ tidrc = task_create( i_ptask->taskfn, io_pargs );
+ if ( static_cast<int16_t>(tidrc) < 0 )
+ {
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid see task list
+ * @reasoncode NULL_FN_PTR
+ * @userdata1 0
+ * @userdata2 0
+ *
+ * @devdesc Initialization Service attempted to start a
+ * function within a module but the function
+ * failed to launch
+ * The module id will identify the task.
+ */
+ lo_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
+ i_ptask->taskflags.module_id, // moduleid
+ INITSERVICE::START_FN_FAILED, // reason Code
+ tidrc, // user1 = tidrc
+ 0 );
- // task launched OK.
- if ( io_pargs )
+ TRACDBIN( g_trac_initsvc,
+ ENTER_MRK "ERROR starting function:",
+ i_ptask->taskname,
+ strlen(i_ptask->taskname) );
+ TRACDCOMP( g_trac_initsvc,
+ EXIT_MRK "tidrc=%d, errlog p = %p" ,
+ (int16_t)tidrc, lo_errl );
+
+ } // endif tidrc
+ else
{
- io_pargs->waitParentSync(); // sync up parent task
+ TRACDBIN( g_trac_initsvc,
+ ENTER_MRK "function launched OK :",
+ i_ptask->taskname,
+ strlen(i_ptask->taskname) );
+ TRACDCOMP( g_trac_initsvc,
+ EXIT_MRK "task number %d, errlog p = %p",
+ tidrc, lo_errl );
+
+ // task launched OK.
+ if ( io_pargs )
+ {
+ io_pargs->waitParentSync(); // sync up parent task
+ }
}
- }
- return errl;
+ } // end else
+
+ return lo_errl;
}
@@ -185,21 +233,19 @@ void InitService::reportError(errlHndl_t &io_rerrl ) const
TRACDCOMP( g_trac_initsvc,
"Committing the error log %p.",
- io_rerrl
- );
+ io_rerrl );
errlCommit( io_rerrl );
}
- return;
}
/**
* @todo this will make a system call to post the error code.
*/
-void InitService::setProgressCode( uint64_t &i_progresscode ) const
+void InitService::setProgressCode( uint64_t i_progresscode ) const
{
// do nothing for now
@@ -212,10 +258,10 @@ void InitService::setProgressCode( uint64_t &i_progresscode ) const
*/
void InitService::init( void *i_ptr )
{
- errlHndl_t errl = NULL; // steps will return an error handle if failure
- uint64_t nextTask = 0;
- const TaskInfo *ptask = NULL;
- TaskArgs::TaskArgs args;
+ errlHndl_t errl = NULL; // steps will return an error handle if failure
+ uint64_t nextTask = 0;
+ const TaskInfo *ptask = NULL;
+ TaskArgs::TaskArgs args;
TRACFCOMP( g_trac_initsvc,
ENTER_MRK "Initialization Service is starting." );
@@ -229,7 +275,7 @@ void InitService::init( void *i_ptr )
nextTask++ )
{
// make a local copy of the base image task
- ptask = &(iv_taskinfolist[nextTask]);
+ ptask = &(g_taskinfolist[nextTask]);
if ( ptask->taskflags.task_type == END_TASK_LIST )
{
TRACDCOMP( g_trac_initsvc,
@@ -237,6 +283,8 @@ void InitService::init( void *i_ptr )
break;
}
+ args.clear(); // clear args struct for next task
+
// dispatch tasks...
switch ( ptask->taskflags.task_type)
{
@@ -253,30 +301,41 @@ void InitService::init( void *i_ptr )
ptask->taskname,
strlen( ptask->taskname) );
errl = startTask( ptask, // task struct
- &args, // args
- errl ); // errlog
+ &args ); // args
break;
case START_FN:
TRACDCOMP( g_trac_initsvc,
"task_type==START_FN : %p",
ptask->taskfn );
- // $$TODO
+ errl = executeFn( ptask,
+ &args );
break;
case BARRIER:
TRACDCOMP( g_trac_initsvc,
"task_type==BARRIER" );
// $$TODO
break;
-
default:
TRACDCOMP( g_trac_initsvc,
"Invalid task_type %d: ",
ptask->taskflags.task_type );
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid BASE_INITSVC_ERRL_ID
+ * @reasoncode INVALID_TASK_TYPE
+ * @userdata1 task_type value
+ * @userdata2 0
+ *
+ * @devdesc Initialization Service found an invalid
+ * Task Type in the task list.
+ * The module id will identify the task.
+ * task_type value will be the invalid type.
+ */
errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
BASE_INITSVC_ERRL_ID, // moduleid
INVALID_TASK_TYPE, // reason Code
- 0, // user1 = tidrc
+ ptask->taskflags.task_type,
0 );
break;
@@ -285,6 +344,20 @@ void InitService::init( void *i_ptr )
// report an error
reportError( errl );
+ if ( args.getReturnCode() != TASKARGS_UNDEFINED64 )
+ {
+ TRACFCOMP( g_trac_initsvc,
+ ERR_MRK "InitService TaskArgs returned 0x%llx, errlog=%p",
+ args.getReturnCode(),
+ args.getErrorLog()
+ );
+
+ errlHndl_t childerrl = args.getErrorLog(); // local copy
+ reportError( childerrl ); // report child error
+ }
+
+
+
} // endfor
// die if we drop out with an error
@@ -295,8 +368,7 @@ void InitService::init( void *i_ptr )
EXIT_MRK "Initilization Service finished.");
// return to _start(), which may end the task or die.
- return;
}
-} // namespace INITSERVICE
+} // namespace
diff --git a/src/usr/initservice/baseinitsvc/initservice.H b/src/usr/initservice/baseinitsvc/initservice.H
index db16ede89..443d85953 100644
--- a/src/usr/initservice/baseinitsvc/initservice.H
+++ b/src/usr/initservice/baseinitsvc/initservice.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __BASEINITSVC_INITSERVICE_H
#define __BASEINITSVC_INITSERVICE_H
/**
@@ -47,10 +64,6 @@ namespace INITSERVICE
// InitService Class
/******************************************************************************/
-// Singleton definition
-class InitService;
-typedef Singleton<InitService> theInitService;
-
/**
* @class InitService Singleton Class
*
@@ -59,7 +72,6 @@ typedef Singleton<InitService> theInitService;
*
* Once started, it handles the rest of HostBoot Initialization.
*
- * @returns none
*/
class InitService
{
@@ -102,18 +114,19 @@ public:
* See initsvctasks.H and the unit tests for some examples of
* how this is used.
*
+ *
* @param[in] i_ptask pointer to a TaskInfo struct
* @param[in] io_pargs pointer to a TaskArgs struct, or NULL
- * @param[inout] io_rerrl reference to an errorlog handle.
- * errorlog will be filled out if error,
- * otherwise untouched.
*
* @return NULL if success, 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 *i_pargs,
- errlHndl_t &io_rerrl ) const;
+ TaskArgs::TaskArgs *i_pargs ) const;
/**
* @brief executeFn
@@ -126,8 +139,7 @@ public:
* if failure
*/
errlHndl_t executeFn( const TaskInfo *i_ptask,
- TaskArgs *i_pargs
- ) const;
+ TaskArgs *i_pargs ) const;
@@ -152,7 +164,7 @@ public:
* @return nothing
*
*/
- void setProgressCode( uint64_t &i_progresscode ) const;
+ void setProgressCode( uint64_t i_progresscode ) const;
@@ -170,7 +182,11 @@ protected:
private:
-
+ /**
+ * @note Disable copy constructor and assignment operator
+ */
+ InitService(const InitService& i_right);
+ InitService& operator=(const InitService& i_right);
}; // class InitService
diff --git a/src/usr/initservice/baseinitsvc/initservicetaskentry.C b/src/usr/initservice/baseinitsvc/initservicetaskentry.C
index b27ca6a44..9215cdeb5 100644
--- a/src/usr/initservice/baseinitsvc/initservicetaskentry.C
+++ b/src/usr/initservice/baseinitsvc/initservicetaskentry.C
@@ -33,9 +33,6 @@ void _start(void *ptr)
TRACFCOMP( g_trac_initsvc,
ENTER_MRK "Executing Initialization Service module." );
- // create an instance of InitService
- //InitService::InitService& is = InitService::getTheInstance();
-
// initialize the base modules in Hostboot.
InitService::getTheInstance().init( ptr );
@@ -45,4 +42,4 @@ void _start(void *ptr)
task_end();
}
-} // INITSERVICE
+} // namespace
diff --git a/src/usr/initservice/baseinitsvc/initsvctasks.H b/src/usr/initservice/baseinitsvc/initsvctasks.H
index ae3362d31..e11e8aff3 100644
--- a/src/usr/initservice/baseinitsvc/initsvctasks.H
+++ b/src/usr/initservice/baseinitsvc/initsvctasks.H
@@ -1,12 +1,28 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+#ifndef __INIT_SVC_TASKS_H
+#define __INIT_SVC_TASKS_H
+
/**
* @file initsvctasks.H
*
* TaskInfo structs for each task that will run.
*/
-#ifndef __INIT_SVC_TASKS_H
-#define __INIT_SVC_TASKS_H
-
#include <initservice/initsvcreasoncodes.H>
#include "initservice.H"
@@ -15,7 +31,7 @@ namespace INITSERVICE
const uint64_t MAX_TASKS = 10;
-const TaskInfo iv_taskinfolist[] = {
+const TaskInfo g_taskinfolist[] = {
/**
* @brief Errorlog Task
@@ -81,5 +97,5 @@ const TaskInfo iv_taskinfolist[] = {
};
-}; // namespace INITSERVICE
-#endif // __INIT_SVC_TASKS_H
+}; // namespace
+#endif //
diff --git a/src/usr/initservice/common/initsvcstructs.H b/src/usr/initservice/common/initsvcstructs.H
index 38c02612f..f78c093b8 100644
--- a/src/usr/initservice/common/initsvcstructs.H
+++ b/src/usr/initservice/common/initsvcstructs.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __COMMON_INITSVCSTRUCTS_H
#define __COMMON_INITSVCSTRUCTS_H
/**
@@ -43,6 +60,8 @@ enum TaskType
STOP_TASK,
END_TASK_LIST,
};
+
+
/**
* @enum ModuleType
* - BASE_IMAGE == module in the base image
@@ -63,7 +82,6 @@ enum ModuleType
* - module type, BASE_MODULE or EXT_MODULE
* - module_id for errorlog if task fails
*
- * @todo revisit these flags in sprint3
*/
struct TaskFlags
{
@@ -72,8 +90,9 @@ struct TaskFlags
InitServiceModuleID module_id; // module id for errorlog
};
+
/**
- * @struct _TaskInfo
+ * @struct TaskInfo
*
* Holds information on each task in the system.
* - taskname
diff --git a/src/usr/initservice/extinitsvc/extinitsvc.C b/src/usr/initservice/extinitsvc/extinitsvc.C
index 916ea31ed..db1baef50 100644
--- a/src/usr/initservice/extinitsvc/extinitsvc.C
+++ b/src/usr/initservice/extinitsvc/extinitsvc.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file extinitsvc.C
*
@@ -22,7 +39,6 @@
#include "extinitsvctasks.H"
-
namespace INITSERVICE
{
@@ -31,6 +47,8 @@ extern trace_desc_t *g_trac_initsvc;
/**
* @brief _start() - task entry point for this module
*
+ * @parms[in,out] - pointer to TaskArgs struct
+ *
*/
extern "C"
void _start( void *io_pArgs )
@@ -76,21 +94,6 @@ ExtInitSvc::~ExtInitSvc()
}
-errlHndl_t ExtInitSvc::startTask( const TaskInfo *i_ptask,
- TaskArgs::TaskArgs *i_pargs,
- errlHndl_t &io_rerrl ) const
-{
- /**
- * @todo run constructor on task here.
- */
-
- InitService::startTask( i_ptask, i_pargs, io_rerrl );
-
- return io_rerrl;
-}
-
-
-
void ExtInitSvc::init( void *i_ptr )
{
errlHndl_t errl = NULL; // steps will return an error handle if failure
@@ -109,14 +112,16 @@ void ExtInitSvc::init( void *i_ptr )
nextTask++ )
{
// make a local copy of the extended image task
- ptask = &(iv_exttaskinfolist[nextTask]);
+ ptask = &(g_exttaskinfolist[nextTask]);
if ( ptask->taskflags.task_type == END_TASK_LIST )
{
TRACDCOMP( g_trac_initsvc,
- "End of ExtInitSvc task list.\n" );
+ "End of ExtInitSvc task list." );
break;
}
+ args.clear(); // clear args for next task
+
// dispatch tasks...
switch ( ptask->taskflags.task_type)
{
@@ -132,14 +137,15 @@ void ExtInitSvc::init( void *i_ptr )
"task_type=START_TASK : ",
ptask->taskname,
strlen(ptask->taskname) );
- errl = startTask( ptask,
- &args,
- errl );
+ errl = InitService::getTheInstance().startTask( ptask,
+ &args );
break;
case START_FN:
TRACDCOMP( g_trac_initsvc,
"task_type==START_FN : %p",
ptask->taskfn );
+ errl = InitService::getTheInstance().executeFn( ptask,
+ &args );
// $$TODO
break;
case BARRIER:
@@ -152,6 +158,18 @@ void ExtInitSvc::init( void *i_ptr )
TRACDCOMP( g_trac_initsvc,
"Invalid task_type: %d",
ptask->taskflags.task_type );
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid START_EXTINITSVC_ERRL_ID
+ * @reasoncode INVALID_TASK_TYPE
+ * @userdata1 task_type value
+ * @userdata2 0
+ *
+ * @devdesc Extended Initialization Service found an invalid
+ * Task Type in the task list.
+ * The module id will identify the task.
+ * task_type value will be the invalid type.
+ */
errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
START_EXTINITSVC_ERRL_ID, // moduleid
@@ -162,8 +180,16 @@ void ExtInitSvc::init( void *i_ptr )
} // endswitch
// report an error
- reportError( errl );
+ InitService::getTheInstance().reportError( errl );
+ if ( args.getReturnCode() != TASKARGS_UNDEFINED64 )
+ {
+ TRACFCOMP( g_trac_initsvc,
+ ERR_MRK "ExtInitSvc TaskArgs returned 0x%llx, errlog=%p",
+ args.getReturnCode(),
+ args.getErrorLog()
+ );
+ }
} // endfor
@@ -171,34 +197,58 @@ void ExtInitSvc::init( void *i_ptr )
TRACFCOMP( g_trac_initsvc,
EXIT_MRK "ExtInitSvc finished.");
-
-
// =====================================================================
// ----- Unit Tests -------------------------------------------------
// =====================================================================
/**
* @note run all 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 -1,
+ * no module present. This is OK.
+ *
*/
+
+ // Pass it a set of args so we can wait on the barrier
+ // This is a bit wasteful since it is always allocated; we need a
+ // system call to check if a module exists.
+ TaskArgs::TaskArgs cxxtestargs; // create a new one for cxxtest
+ cxxtestargs.clear(); // clear it
+
+ TRACFCOMP( g_trac_initsvc,
+ ENTER_MRK " "); // leave whitespace in trace
TRACDBIN( g_trac_initsvc,
- ENTER_MRK "Run Unit Tests: ",
+ ENTER_MRK "Run Unit Tests (if libcxxtests.so is present): ",
CXXTEST_TASK.taskname,
strlen(CXXTEST_TASK.taskname) );
- errl = startTask( &CXXTEST_TASK, // task struct
- NULL, // no args
- errl ); // pointer to errorlog
- // report an error
- reportError( errl );
+ errl = InitService::getTheInstance().startTask( &CXXTEST_TASK,
+ &cxxtestargs );
+
+ // check the returncode and errorlog in the returned args
+ if ( ( cxxtestargs.getReturnCode() != TASKARGS_UNDEFINED64 )
+ || ( cxxtestargs.getErrorLog() != NULL )
+ )
+ {
+ TRACFCOMP( g_trac_initsvc,
+ ERR_MRK "CxxTests returned an error 0x%lx and an errorlog %p",
+ cxxtestargs.getReturnCode(),
+ cxxtestargs.getErrorLog()
+ );
+ // report an error
+ errlHndl_t childerrl = cxxtestargs.getErrorLog();
+ InitService::getTheInstance().reportError( childerrl );
+ }
TRACDCOMP( g_trac_initsvc,
EXIT_MRK "Unit Tests finished.");
+ TRACFCOMP( g_trac_initsvc,
+ EXIT_MRK " "); // leave whitespace in trace
// Shutdown all CPUs
- // TODO. Current code does not wait for UTs to finish. Add a delay for now
- // This will be fixed soon.
- nanosleep(2, 0);
-
uint64_t l_shutdownStatus = SHUTDOWN_STATUS_GOOD;
if (CxxTest::g_FailedTests)
@@ -213,4 +263,4 @@ void ExtInitSvc::init( void *i_ptr )
}
-} // namespace EXTINITSVC
+} // namespace
diff --git a/src/usr/initservice/extinitsvc/extinitsvc.H b/src/usr/initservice/extinitsvc/extinitsvc.H
index a50b790ed..819022c9d 100644
--- a/src/usr/initservice/extinitsvc/extinitsvc.H
+++ b/src/usr/initservice/extinitsvc/extinitsvc.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __EXTINITSVC_EXTINITSVC_H
#define __EXTINITSVC_EXTINITSVC_H
/**
@@ -33,6 +50,7 @@ namespace INITSERVICE
/******************************************************************************/
// Typedef/Enumerations
/******************************************************************************/
+
/**
* @enum ShutdownStatus
*/
@@ -43,21 +61,18 @@ enum ShutdownStatus
SHUTDOWN_STATUS_ISTEP_FAILED = 0x01230002,
};
+
/******************************************************************************/
// ExtInitSvc Class
/******************************************************************************/
-// Singleton definition
-class ExtInitSvc;
-typedef Singleton<ExtInitSvc> theExtInitSvc;
-
/**
* @class ExtInitSvc Singleton Class
*
* This extended image module is launched by InitService
*
*/
-class ExtInitSvc : public InitService
+class ExtInitSvc
{
public:
@@ -82,28 +97,6 @@ public:
void init( void *i_args);
- /**
- * @todo ExtInitSvcTest should be able to find protected functions.
- */
- // $$protected:
-
- /**
- * @brief start a extended image task.
- *
- * @param[in] i_ptask pointer to a TaskInfo struct
- * @param[in] i_pargs pointer to args struct
- * @param[inout] i_rerrl reference to an errorlog handle.
- * errorlog will be filled out if error,
- * otherwise untouched.
- *
- * @return NULL if success, errorlog handle for failure
- *
- */
- errlHndl_t startTask( const TaskInfo *i_ptask,
- TaskArgs::TaskArgs *i_pargs,
- errlHndl_t &i_rerrl ) const;
-
-
protected:
/**
* @brief Constructor for the InitService object.
@@ -118,11 +111,15 @@ protected:
private:
-
+ /**
+ * @note Disable copy constructor and assignment operator
+ */
+ ExtInitSvc(const ExtInitSvc& i_right);
+ ExtInitSvc& operator=(const ExtInitSvc& i_right);
}; // class ExtInitSvc
-} // namespace EXTINITSVC
+} // namespace
#endif
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index 29a62e57d..9c31bc81d 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -1,5 +1,23 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __EXT_INIT_SVC_TASKS_H
#define __EXT_INIT_SVC_TASKS_H
+
/**
* @file extinitsvctasks.H
*
@@ -15,7 +33,7 @@ namespace INITSERVICE
const uint64_t MAX_EXT_TASKS = 25;
-const TaskInfo iv_exttaskinfolist[] = {
+const TaskInfo g_exttaskinfolist[] = {
// ----- Extended Image ------------------------------------------
@@ -77,6 +95,6 @@ const TaskInfo CXXTEST_TASK = {
};
-}; // namespace EXTINITSVC
+}; // namespace
#endif // __EXT_INIT_SVC_TASKS_H
diff --git a/src/usr/initservice/initsvcunittesttask2/tasktest2.C b/src/usr/initservice/initsvcunittesttask2/tasktest2.C
index 08d4c2d5d..844e69019 100644
--- a/src/usr/initservice/initsvcunittesttask2/tasktest2.C
+++ b/src/usr/initservice/initsvcunittesttask2/tasktest2.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file tasktest2.H
*
@@ -13,7 +30,7 @@
#include "tasktest2.H"
-namespace INITSVCTASKTEST2
+namespace INITSERVICE
{
@@ -37,7 +54,7 @@ InitSvcTaskTest2& InitSvcTaskTest2::getTheInstance()
extern "C"
void _start( void *io_pArgs )
{
- INITSERVICE::TaskArgs::TaskArgs *pTaskArgs = (INITSERVICE::TaskArgs::TaskArgs *)io_pArgs;
+ TaskArgs::TaskArgs *pTaskArgs = (TaskArgs::TaskArgs *)io_pArgs;
// create an instance of InitService
InitSvcTaskTest2::InitSvcTaskTest2& tt = InitSvcTaskTest2::getTheInstance();
diff --git a/src/usr/initservice/initsvcunittesttask2/tasktest2.H b/src/usr/initservice/initsvcunittesttask2/tasktest2.H
index 57f00db32..d798a1741 100644
--- a/src/usr/initservice/initsvcunittesttask2/tasktest2.H
+++ b/src/usr/initservice/initsvcunittesttask2/tasktest2.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __INITSVC_TASK_TEST_2_H
#define __INITSVC_TASK_TEST_2_H
@@ -13,7 +30,7 @@
#include <kernel/console.H> // printk
#include <util/singleton.H>
-namespace INITSVCTASKTEST2
+namespace INITSERVICE
{
/******************************************************************************/
@@ -27,9 +44,6 @@ namespace INITSVCTASKTEST2
/******************************************************************************/
// InitService Class
/******************************************************************************/
-// Singleton definition
-class InitSvcTaskTest2;
-typedef Singleton<InitSvcTaskTest2> theTask2;
/**
* @class InitSvcTestTask2 Class
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index cb3634c9b..057cde2f9 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file istepdispatcher.C
*
@@ -20,6 +37,7 @@
#include "istepdispatcher.H"
#include "isteplist.H"
+
namespace INITSERVICE
{
@@ -29,28 +47,26 @@ namespace INITSERVICE
extern trace_desc_t *g_trac_initsvc;
/**
- * @brief set up _start() task entry procedure
- *
+ * @brief set up _start() task entry procedure using the macro
*/
TASK_ENTRY_MACRO( IStepDispatcher::getTheInstance().init );
IStepDispatcher::IStepDispatcher()
-:
- iv_istepmodeflag(false),
- iv_nextistep( 0 ),
- iv_cancontinueflag(false)
+: iv_istepmodeflag(false),
+ iv_nextistep( 0 ),
+ iv_cancontinueflag(false)
{
}
+
IStepDispatcher::~IStepDispatcher()
{
}
-
IStepDispatcher& IStepDispatcher::getTheInstance()
{
return Singleton<IStepDispatcher>::instance();
@@ -72,7 +88,7 @@ void IStepDispatcher::init( void * ptr )
nextIStep<INITSERVICE::MAX_ISTEPS;
nextIStep++ )
{
- pistep = &(isteps[nextIStep]);
+ pistep = &(g_isteps[nextIStep]);
if ( pistep->taskflags.task_type == END_TASK_LIST )
{
TRACDCOMP( g_trac_initsvc,
@@ -81,16 +97,30 @@ void IStepDispatcher::init( void * ptr )
}
- errl = executeFn( pistep, &args );
+ args.clear(); // clear the args struct for the next istep
+ errl = InitService::getTheInstance().executeFn( pistep,
+ &args );
- // report an error
- reportError( errl );
+ // handle an errorlog from the parent, if it exists
+ InitService::getTheInstance().reportError( errl );
/**
* @todo call getCanContinueProcedure when we have some ISteps that
- * require them.
+ * require them.
*/
+ if ( args.getReturnCode() != TASKARGS_UNDEFINED64 )
+ {
+ TRACFCOMP( g_trac_initsvc,
+ ERR_MRK "IStep TaskArgs returned 0x%llx, errlog=%p",
+ args.getReturnCode(),
+ args.getErrorLog()
+ );
+ }
+
+ // report an error from the child, if it exists.
+ reportIStepErrorLog( pistep, args.getErrorLog() );
+
} // endfor
@@ -99,6 +129,8 @@ void IStepDispatcher::init( void * ptr )
}
+
+
/**
* @note IStep Mode is hardwired to false for now
*
@@ -112,12 +144,20 @@ bool IStepDispatcher::getIStepMode( ) const
-bool IStepDispatcher::getCanContinueProcedure( TaskInfo &i_failingIStep,
- errlHndl_t &i_failingError,
- TaskInfo &io_nextIstep ) const
+bool IStepDispatcher::getCanContinueProcedure( const TaskInfo &i_failingIStep,
+ errlHndl_t &i_failingError,
+ TaskInfo &io_nextIstep
+ ) const
{
return false;
}
+void IStepDispatcher::reportIStepErrorLog( const TaskInfo *i_failingIStep,
+ errlHndl_t io_errl )
+{
+
+ InitService::getTheInstance().reportError( io_errl );
+}
+
} // namespace
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H
index 34e2dccf5..551f8292c 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.H
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __ISTEP_DISPATCHER_H
#define __ISTEP_DISPATCHER_H
/**
@@ -30,7 +47,6 @@ namespace INITSERVICE
// Globals/Constants
/******************************************************************************/
-
/******************************************************************************/
// Typedef/Enumerations
/******************************************************************************/
@@ -39,16 +55,13 @@ namespace INITSERVICE
// Class
/******************************************************************************/
-// Singleton definition
-class IStepDispatcher;
-typedef Singleton<IStepDispatcher> theIStepDispatcher;
-
-
/**
- * @class IStepDispatcher Singleton Class
+ * @class IStepDispatcher
+ *
+ * Dispatch ISteps and handle return codes, errorlogs, etc.
*
*/
-class IStepDispatcher : public InitService
+class IStepDispatcher
{
public:
@@ -85,6 +98,12 @@ protected:
private:
/**
+ * @note Disable copy constructor and assignment operator
+ */
+ IStepDispatcher(const IStepDispatcher& i_right);
+ IStepDispatcher& operator=(const IStepDispatcher& i_right);
+
+ /**
* @brief getIStepMode
* call into PNOR and fetch the "IStepMode flag" .
* This will tell us if we are locked to the SP (IStepMode=ON) or
@@ -108,10 +127,19 @@ private:
* true otherwise
*
*/
- bool getCanContinueProcedure( 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;
+ /**
+ * @brief reportIStepErrorLog
+ * If an IStep returns an error log, commit it.
+ *
+ * @todo Later there may be some decision about whether to report it
+ * based on the IStep.
+ */
+ void reportIStepErrorLog( const TaskInfo *i_failingIStep,
+ errlHndl_t io_errl );
bool iv_istepmodeflag;
@@ -120,6 +148,6 @@ private:
}; // class IStepDispatcher
-} // namespace ISTEPDISP
+} // namespace
#endif
diff --git a/src/usr/initservice/istepdispatcher/isteplist.H b/src/usr/initservice/istepdispatcher/isteplist.H
index a72815a79..993c6684d 100644
--- a/src/usr/initservice/istepdispatcher/isteplist.H
+++ b/src/usr/initservice/istepdispatcher/isteplist.H
@@ -1,7 +1,25 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
#ifndef __ISTEPS_H
#define __ISTEPS_H
+
/**
- * @file extinitsvctasks.H
+ * @file isteplist.H
*
* TaskInfo structs for each task that will run in the extended image.
*/
@@ -15,7 +33,7 @@ namespace INITSERVICE
const uint64_t MAX_ISTEPS = 25;
-const TaskInfo isteps[] = {
+const TaskInfo g_isteps[] = {
// ----- ISteps Image ------------------------------------------
@@ -54,4 +72,4 @@ const TaskInfo isteps[] = {
}; // namespace
-#endif // __EXT_INIT_SVC_TASKS_H
+#endif
diff --git a/src/usr/initservice/taskargs/taskargs.C b/src/usr/initservice/taskargs/taskargs.C
index 26eb21804..9cf7c2cd2 100644
--- a/src/usr/initservice/taskargs/taskargs.C
+++ b/src/usr/initservice/taskargs/taskargs.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file taskargs.C
*
@@ -62,7 +79,7 @@ void TaskArgs::waitChildSync( )
}
-void TaskArgs::postReturnCode( const uint64_t &i_returncode )
+void TaskArgs::postReturnCode( const uint64_t i_returncode )
{
iv_taskreturncode = i_returncode;
@@ -77,7 +94,7 @@ uint64_t TaskArgs::getReturnCode( ) const
}
-void TaskArgs::setCommand( const uint64_t &i_command )
+void TaskArgs::setCommand( const uint64_t i_command )
{
iv_taskcommand = i_command;
@@ -93,9 +110,43 @@ uint64_t TaskArgs::getCommand( ) const
}
+void TaskArgs::postErrorLog( errlHndl_t i_errl )
+{
+
+ iv_errl = i_errl;
+}
+
+
+errlHndl_t TaskArgs::getErrorLog( )
+{
+
+ return iv_errl;
+}
+
+
+void TaskArgs::clear()
+{
+ iv_taskreturncode = TASKARGS_UNDEFINED64; // init iv_returncode to undefined
+ iv_taskcommand = TASKARGS_UNDEFINED64; // init iv_command to undefined
+
+ // 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);
+ }
+
+}
+
+
TaskArgs::TaskArgs()
-: iv_taskreturncode(TASKARGS_UNDEFINED64),
- iv_taskcommand(TASKARGS_UNDEFINED64)
+: iv_errl( NULL ), // init errorlog handle to NULL
+ iv_taskreturncode(TASKARGS_UNDEFINED64), // init iv_returncode to undefined
+ iv_taskcommand(TASKARGS_UNDEFINED64) // init iv_command to undefined
{
// set barrier to wait for 2 tasks before releasing,
// see notes above.
@@ -105,6 +156,7 @@ TaskArgs::TaskArgs()
TaskArgs::~TaskArgs()
{
+ clear();
barrier_destroy( &iv_sync_barrier );
}
diff --git a/src/usr/initservice/test/initservicetest.H b/src/usr/initservice/test/initservicetest.H
index 31fe457a2..1c2d9991a 100644
--- a/src/usr/initservice/test/initservicetest.H
+++ b/src/usr/initservice/test/initservicetest.H
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM Flexible Support Processor Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * 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.
+ * $
+****************************************************************************/
+
/**
* @file initservicetest.H
*
@@ -92,8 +109,7 @@ public:
TS_TRACE( "=====>Attempt to run a nonexistent task, expect an ERROR.");
errl = l_is.startTask( &TASK_TEST1, // task struct
- NULL, // args
- errl ); // errlog
+ NULL ); // args
if ( errl )
{
TS_TRACE( "SUCCESS: startTask returned an errorlog.\n");
@@ -122,8 +138,7 @@ public:
TS_TRACE( "=====>Attempt to run a task with a _start() function, expect SUCCESS.");
errl = l_is.startTask( &TASK_TEST2, // task struct
- NULL, // args
- errl ); // errlog
+ NULL ); // args
if ( errl )
{
TS_FAIL( "ERROR: StartTask returned an error log.\n");
@@ -153,8 +168,7 @@ public:
TS_TRACE( "====>Attempt to run a task with NO _start() function, expect an ERROR.");
errl = l_is.startTask( &TASK_TEST3, // task struct
- NULL, // args
- errl ); // errlog
+ NULL ); // args
if ( errl )
{
TS_TRACE( "SUCCESS: startTask returned an error log.\n");
diff --git a/src/usr/isteps/istep1.C b/src/usr/isteps/istep1.C
index 1a28f10e1..65147cc72 100644
--- a/src/usr/isteps/istep1.C
+++ b/src/usr/isteps/istep1.C
@@ -17,8 +17,23 @@
#include <trace/interface.H> // trace support
#include <errl/errlentry.H> // errlHndl_t
+#include <errl/errlmanager.H>
#include <initservice/taskargs.H> // task args
+// pull in stuff to run HW procedure - from Andrew's hwpf testcase 2
+// NOTE: there are extra include paths in isteps/makefile to find the fapi includes:
+// EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+// EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+// EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+
+#include <fapi.H>
+#include <fapiPlatHwpInvoker.H>
+#include <fapiPlatHwpInvoker.H>
+#include <targeting/targetservice.H>
+
+using namespace fapi;
+using namespace TARGETING;
+
namespace ISTEPS
{
@@ -32,12 +47,45 @@ extern "C"
void IStep1( void * io_pArgs )
{
INITSERVICE::TaskArgs::TaskArgs *pTaskArgs =
- reinterpret_cast<INITSERVICE::TaskArgs::TaskArgs *>(io_pArgs);
+ reinterpret_cast<INITSERVICE::TaskArgs::TaskArgs *>(io_pArgs);
+ errlHndl_t l_err = NULL;
+ uint64_t command = pTaskArgs->getCommand();
+ uint64_t returncode = pTaskArgs->getReturnCode();
+
+ // print out stuff from taskargs
TRACFCOMP( g_trac_istep1,
- ENTER_MRK "starting IStep 1");
+ "starting IStep 1, command=0x%llx, returncode=0x%llx",
+ command, returncode );
+ // ----- start ISTEP --------------------------------------------------
+
+
+ // Set processor chip to the master
+ TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+
+ l_err = invokeHwpInitialTest(l_testTarget);
+ if (l_err)
+ {
+ TRACFCOMP( g_trac_istep1,
+ "IStep1 failed, posting error code 1");
+ // Commit/delete error
+ errlCommit(l_err);
+ pTaskArgs->postReturnCode( 1 );
+ }
+ else
+ {
+ TRACFCOMP( g_trac_istep1,
+ "ISTep1 finished successfully.");
+
+ pTaskArgs->postReturnCode( 0 );
+ }
+
+
+// ----- end ISTEP ------------------------------------------------------
+ TRACFCOMP( g_trac_istep1,
+ EXIT_MRK "ending IStep 1");
if ( pTaskArgs )
{
diff --git a/src/usr/isteps/makefile b/src/usr/isteps/makefile
index 1e1580136..f2d7b1560 100644
--- a/src/usr/isteps/makefile
+++ b/src/usr/isteps/makefile
@@ -1,4 +1,9 @@
ROOTPATH = ../../..
+
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+
MODULE = isteps
OBJS = istep1.o
OpenPOWER on IntegriCloud