summaryrefslogtreecommitdiffstats
path: root/src/usr/initservice/istepdispatcher/istepdispatcher.C
blob: 6ee6c18f565916dabc02942a2b5615554b8fbadf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/initservice/istepdispatcher/istepdispatcher.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 istepdispatcher.C
 *
 *  IStep Dispatcher code.  Launched from Extended Initialization Service
 *
 *  PNOR Driver and Trace should be available by the time this is launched.
 *
 */


/******************************************************************************/
// Includes
/******************************************************************************/
#include    <stdint.h>
#include    <stdio.h>
#include    <string.h>

#include    <sys/task.h>                    //  tid_t, task_create, etc
#include    <sys/time.h>                    //  nanosleep
#include    <sys/misc.h>                    //  shutdown
#include    <trace/interface.H>             //  trace support
#include    <errl/errlentry.H>              //  errlHndl_t
#include    <devicefw/userif.H>             //  targeting
#include    <sys/mmio.h>                    //  mmio_scratch_read()
#include    <initservice/taskargs.H>        //  TaskArgs    structs

#include    <errl/errluserdetails.H>        //  ErrlUserDetails base class

#include    <targeting/attributes.H>        //  ISTEP_MODE attribute
#include    <targeting/entitypath.H>
#include    <targeting/target.H>
#include    <targeting/targetservice.H>

#include    "istepdispatcher.H"

#include    "splesscommon.H"

#include    <isteps/istepmasterlist.H>


namespace   ERRORLOG
{
/**
 * @class IStepNameUserDetail
 *
 * report the failing IStepName.
 *
 * @todo:   get rid of magic numbers in version and subsection.
 *          set up tags, plugins, include files, etc.
 *          For now we just want to report the failing istep string for debug.
 * @todo:   Expand this to report the istep / substep, error returned, etc.
 */

class   IStepNameUserDetail : public ErrlUserDetails
{

public:

    IStepNameUserDetail(
            const char *i_istepname,
            const uint16_t  i_istep     =   0,
            const uint16_t  i_substep   =   0,
            const uint64_t  i_isteprc   =   0   )
    {

    iv_CompId     = INITSVC_COMP_ID;
    iv_Version    = 1;
    iv_SubSection = 1;

    // Store the string in the internal buffer
    char * l_pString = (char *)allocUsrBuf( strlen(i_istepname)+1 );
    strcpy(l_pString, i_istepname );
    }

/**
 *  @brief Destructor
 *
 */
virtual ~IStepNameUserDetail() {}

private:

// Disabled
IStepNameUserDetail(const IStepNameUserDetail &);
IStepNameUserDetail & operator=(const IStepNameUserDetail &);
};

}   //  end namespace   ERRORLOG



namespace   INITSERVICE
{

using   namespace   ERRORLOG;           // IStepNameUserDetails
using   namespace   SPLESS;

/******************************************************************************/
// Globals/Constants
/******************************************************************************/
extern trace_desc_t *g_trac_initsvc;

/**
 * @note    Since ISTEP_MODE attribute is nonvolatile (persists across boots),
 *          we must have a way to turn the attribute both ON and OFF - we
 *          cannot depend on the FSP to do it since we may not have a FSP.
 */
const   uint64_t    ISTEP_MODE_ON_SIGNATURE     =   0x4057b0074057b007;
const   uint64_t    ISTEP_MODE_OFF_SIGNATURE    =   0x700b7504700b7504;

/**
 * @enum
 *  SPLess Task return codes
 *
 * task return codes for SPless single step
 * @note    future errors will be passed from task_create() and task_exec()
 *          and should be documented in errno.h
 *
 */
enum    {
    SPLESS_TASKRC_INVALID_ISTEP     =   -3,     // invalid istep or substep
    SPLESS_TASKRC_LAUNCH_FAIL       =   -4,     // failed to launch the task
    SPLESS_TASKRC_RETURNED_ERRLOG   =   -5,     // istep returned an errorlog
    SPLESS_TASKRC_TERMINATED        =   -6,     // terminated the polling loop

    SPLESS_INVALID_COMMAND          =   10,    // invalid command from user console
};

/**
 * @note    SPLess PAUSE - These two constants are used in a nanosleep() call
 *          below to sleep between polls of the StatusReg.  Typically this will
 *          be about 100 ms - the actual value will be determined empirically.
 *
 * @debug  simics "feature" - set polling time to 1 sec for demo
 *
 */
const   uint64_t    SINGLESTEP_PAUSE_S     =   1;
const   uint64_t    SINGLESTEP_PAUSE_NS    =   100000000;

/**
 * @brief   set up _start() task entry procedure using the macro in taskargs.H
 */
TASK_ENTRY_MACRO( IStepDispatcher::getTheInstance().init );


const TaskInfo *IStepDispatcher::findTaskInfo( const uint16_t i_IStep,
                                               const uint16_t i_SubStep ) const
{
    const TaskInfo      *l_pistep       =   NULL;


    //  apply filters
    do
    {

        //  Sanity check / dummy IStep
        if ( g_isteps[i_IStep].pti == NULL)
        {
            TRACDCOMP( g_trac_initsvc,
                       "g_isteps[%d].pti == NULL",
                       i_IStep );
            break;
        }

        TRACDCOMP( g_trac_initsvc,
                   "g_isteps[%d].numitems = 0x%x",
                   i_IStep,
                   g_isteps[i_IStep].numitems );


        // check input range - IStep
        if  (   i_IStep >= MAX_ISTEPS   )
        {
            TRACDCOMP( g_trac_initsvc,
                       "IStep 0x%x out of range.",
                       i_IStep );
            break;      // break out with l_pistep set to NULL
        }

        //  check input range - ISubStep
        if  (   i_SubStep >= g_isteps[i_IStep].numitems )
        {
            TRACDCOMP( g_trac_initsvc,
                       "IStep 0x%x Substep 0x%x out of range.",
                       i_IStep,
                       i_SubStep );
            break;      // break out with l_pistep set to NULL
        }

        //   check for end of list.
        if ( g_isteps[i_IStep].pti[i_SubStep].taskflags.task_type
                == END_TASK_LIST )
        {
            TRACDCOMP( g_trac_initsvc,
                       "IStep 0x%x SubSStep 0x%x task_type==END_TASK_LIST.",
                       i_IStep,
                       i_SubStep );
            break;
        }

        // looks good, send it back to the caller
        TRACDCOMP( g_trac_initsvc,
                   "Found TaskInfo 0x%x 0x%x",
                   i_IStep,
                   i_SubStep );
        l_pistep    =   &( g_isteps[i_IStep].pti[i_SubStep] );

    }   while ( 0 );

    return  l_pistep;
}


void IStepDispatcher::init( void * io_ptr )
{
    // note, io_ptr will pass the TaskArgs struct through to runAllSteps, etc.

    if ( getIStepMode() )
    {
        TRACFCOMP( g_trac_initsvc,
                   "IStep single-step" );
        // IStep single-step
        singleStepISteps( io_ptr );
    }
    else
    {
        TRACFCOMP( g_trac_initsvc,
                   "IStep run all" );
        //  Run all the ISteps sequentially
        runAllISteps( io_ptr );
    }   // endelse


    TRACFCOMP( g_trac_initsvc,
               EXIT_MRK "IStepDispatcher finished.");
}


bool IStepDispatcher::getIStepMode( )   const
{
    using namespace TARGETING;
    Target* l_pTopLevel     =   NULL;
    bool    l_istepmodeflag =   false;
    TargetService& l_targetService = targetService();

    (void) l_targetService.getTopLevelTarget(l_pTopLevel);
    if (l_pTopLevel == NULL)
    {
        TRACFCOMP( g_trac_initsvc, "Top level handle was NULL" );
        l_istepmodeflag =   false;
    }
    else
    {
        l_istepmodeflag = l_pTopLevel->getAttr<ATTR_ISTEP_MODE> ();
    }


    return  l_istepmodeflag;
}


void IStepDispatcher::initIStepMode( )
{
    using namespace TARGETING;
    uint64_t    l_readData      =   0;
    Target      *l_pTopLevel    =   NULL;
    TargetService& l_targetService = targetService();

    (void) l_targetService.getTopLevelTarget(l_pTopLevel);
    if (l_pTopLevel == NULL)
    {
        TRACFCOMP( g_trac_initsvc, "Top level handle was NULL" );
        // drop through, default of attribute is is false
    }
    else
    {
        // got a pointer to Targeting, complete setting the flag
        l_readData  =   mmio_scratch_read( MMIO_SCRATCH_IPLSTEP_CONFIG );

        TRACDCOMP( g_trac_initsvc,
                "SCOM ScratchPad read, Offset 0x%x, Data 0x%llx",
                MMIO_SCRATCH_IPLSTEP_CONFIG,
                l_readData );

        // check for IStep Mode signature(s)
        if ( l_readData == ISTEP_MODE_ON_SIGNATURE )
        {
            l_pTopLevel->setAttr<ATTR_ISTEP_MODE> (true );
            TRACDCOMP( g_trac_initsvc,
                    "ISTEP_MODE attribute set to TRUE." );
        }

        if ( l_readData == ISTEP_MODE_OFF_SIGNATURE )
        {
            l_pTopLevel->setAttr<ATTR_ISTEP_MODE> ( false );
            TRACDCOMP( g_trac_initsvc,
                    "ISTEP_MODE attribute set to FALSE." );
        }
    }

}




/**
 * @brief   Command 0: Run the requested IStep/SubStep
 *
 * param[in]    i_rcmd  -   ref to a filled in SPLessCmd struct
 * param[out]   o_sts   -   ref to a SPLessSts struct to be filled in
 *
 * @return  none
 */
void    IStepDispatcher::processSingleIStepCmd(
                                    SPLessCmd &i_rrawcmd,
                                    SPLessSts &o_rrawsts ) const
{
    errlHndl_t              l_errl          =   NULL;
    uint64_t                l_isteprc       =   NULL;
    TaskArgs::TaskArgs      l_taskargs;
    const TaskInfo          *l_pistep       =   NULL;
    //  init the command 0x00 struct to the incoming command reg values
    SPLessSingleIStepCmd    l_cmd( i_rrawcmd );
    //  create a cleared status 0x00 reg
    SPLessSingleIStepSts    l_sts;

    //  look up istep+substep
    l_pistep  =   IStepDispatcher::getTheInstance().findTaskInfo(
                                                        l_cmd.istep,
                                                        l_cmd.substep );

    do
    {
        if ( l_pistep == NULL )
        {
            // invalid istep, return error
            l_sts.hdr.runningbit    =   false;
            l_sts.hdr.readybit      =   true;
            l_sts.hdr.status        =   SPLESS_TASKRC_INVALID_ISTEP;
            l_sts.istep             =   l_cmd.istep;
            l_sts.substep           =   l_cmd.substep;
            l_sts.istepStatus       =   0;

            //  return to caller to write back to user console
            o_rrawsts.val64 =   l_sts.val64;
            break;
        }


        //  set running bit, fill in istep and substep
        l_sts.hdr.runningbit    =   true;
        l_sts.hdr.readybit      =   true;
        l_sts.hdr.status        =   0;
        l_sts.istep             =   l_cmd.istep;
        l_sts.substep           =   l_cmd.substep;
        l_sts.istepStatus       =   0;

        //  write intermediate value back to user console
        o_rrawsts.val64 =   l_sts.val64;
        writeSts( o_rrawsts );

        /**
         * @todo   placeholder - set progress code before starting
         * This will not be finalized until the progress code driver
         * is designed and implemented.
         */
        uint64_t l_progresscode  =  ( (l_cmd.istep<<16) | l_cmd.substep );
        InitService::getTheInstance().setProgressCode( l_progresscode );


        // clear the TaskArgs struct
        l_taskargs.clear();

        // clear the status struct for the next step
        l_sts.val64 =   0;

        //  launch the istep
        l_errl = InitService::getTheInstance().executeFn( l_pistep,
                &l_taskargs );
        //  filter errors returning from executeFn
        if ( l_errl )
        {
            //  handle an errorlog from the parent.  This means the
            //  launch failed, set the task Status to Bad.
            //  no need to process child info, thus the else.
            //  set the taskStatus to LAUNCH_FAIL; this will fall
            //  out the bottom and be written to SPLESS Status
            l_sts.hdr.status  =   SPLESS_TASKRC_LAUNCH_FAIL;
            errlCommit( l_errl, INITSVC_COMP_ID );
        }
        else
        {
            //  process information returned from the IStep.
            //  make local copies of the info; this has a secondary
            //  effect of clearing the errorlog pointer inside
            //  the TaskArgs  struct.
            l_isteprc   =   l_taskargs.getReturnCode();     // local copy
            l_errl      =   l_taskargs.getErrorLog();       // local copy

            //  check for child errorlog
            if ( l_errl )
            {
                //  tell the user that the IStep returned an errorlog
                l_sts.hdr.status    =   SPLESS_TASKRC_RETURNED_ERRLOG;
                // go ahead and commit the child errorlog
                errlCommit( l_errl, INITSVC_COMP_ID );
            }

            //  truncate IStep return status to 32 bits.
            l_isteprc   &= SPLESS_SINGLE_STEP_STS_MASK;
            l_sts.istepStatus =   static_cast<uint32_t>(l_isteprc);
        }   // end else parent errlog

        //  task status and  istepStatus should be set correctly now,
        //  send it to the user console.
        //  clear runningbit, report status
        //  set running bit, fill in istep and substep
        l_sts.hdr.runningbit    =   false;
        l_sts.hdr.readybit      =   true;
        // l_sts.hdr.seqnum        =   i_seqnum;
        // task status set above
        l_sts.istep             =   l_cmd.istep;
        l_sts.substep           =   l_cmd.substep;
        // istepStatus set above

        //  write to status reg, return to caller to write to user console
        o_rrawsts.val64 =   l_sts.val64;

        break;

    } while(0);

}


/**
 * @brief  singleStepISteps
 *
 * Stop and wait for SP to send the next IStep to run.  Run that, then
 * wait for the next one.
 * This is not expected to return - errors etc are sent to the user to
 * handle.
 *
 * @param[in,out] io_ptr   -   pointer to any args passed in from
 *                             ExtInitSvc.  This may be a pointer to an
 *                             TaskArgs struct (or something else) which
 *                             can be filled out on return
 *
 * @return none
 */
void    IStepDispatcher::singleStepISteps( void *  io_ptr )   const
{
    SPLessCmd           l_cmd;
    SPLessSts           l_sts;
    uint8_t             l_seqnum        =   0;

    // initialize command reg
    l_cmd.val64 =   0;
    writeCmd( l_cmd );

    //  init status reg, enable ready bit
    l_sts.val64 =   0;
    l_sts.hdr.readybit  =   true;
    writeSts( l_sts );

    //
    //  @note Start the polling loop.
    //  Currently this has no exit, user should reset the machine and/or
    //  load the payload, which will wipe HostBoot from memory.
    //  Loop forever, unless something Very Bad happens.
    //
    while( 1 )
    {

        //  read command register from user console
        readCmd( l_cmd );

        // get the sequence number
        l_seqnum    =   l_cmd.hdr.seqnum;

        //  process any pending commands
        if ( l_cmd.hdr.gobit )
        {
            switch( l_cmd.hdr.cmdnum )
            {
            case SPLESS_SINGLE_ISTEP_CMD:
                // command 0:  run istep/substep
                processSingleIStepCmd( l_cmd, l_sts  );
                break;

            default:
                l_sts.hdr.status    =   SPLESS_INVALID_COMMAND;
            }   // endif switch

            l_sts.hdr.seqnum    =   l_seqnum;
            //  status should be set now, write to Status Reg.
            writeSts( l_sts );

            // clear command reg, including go bit (i.e. set to false)
            l_cmd.val64 =   0;
            writeCmd( l_cmd );
        }   //  endif   gobit


        // sleep, and wait for user to give us something else to do.
        /**
         * @todo Need a common method of doing delays in HostBoot
         * @VBU workaround
         */
        // Don't delay as long in VBU because it will take VERY long to
        // run the simulator
        TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL);
        syspath.addLast(TARGETING::TYPE_SYS,0);
        TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath);
        uint8_t vpo_mode = 0;
        if( sys
                && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode)
                && (vpo_mode == 1) )
        {
            // VBU delay per Patrick
            nanosleep(0,TEN_CTX_SWITCHES_NS);
        }
        else
        {
            nanosleep( SINGLESTEP_PAUSE_S, SINGLESTEP_PAUSE_NS );
        }
    }   //  endwhile


    //  @note
    //  Fell out of loop, clear sts reg and turn off readybit
    //  Currently this will never be reached.  Later there may be
    //  a reason to break out of the loop, if this happens we want to
    //  disable the ready bit so the user knows.
    l_sts.val64 =   0;
    l_sts.hdr.status    =   SPLESS_TASKRC_TERMINATED;
    l_sts.hdr.seqnum    =   l_seqnum;
    writeSts( l_sts );

}


void    IStepDispatcher::runAllISteps( void * io_ptr )   const
{
    errlHndl_t          l_errl          =   NULL;
    uint16_t            l_IStep         =   0;
    uint16_t            l_SubStep       =   0;
    const TaskInfo      *l_pistep       =   NULL;
    uint64_t            l_progresscode  =   0;
    uint64_t            l_isteprc       =   0;

    // taskargs struct for children
    TaskArgs::TaskArgs  l_args;

    // set up pointer to our taskargs, passed in from caller
    INITSERVICE::TaskArgs *pTaskArgs =
            static_cast<INITSERVICE::TaskArgs *>( io_ptr );

    for (   l_IStep=0;
            l_IStep<INITSERVICE::MAX_ISTEPS;
            l_IStep++ )
    {
        for (   l_SubStep=0;
                l_SubStep < INITSERVICE::MAX_SUBSTEPS;
                l_SubStep++)
        {
            TRACDCOMP( g_trac_initsvc,
                       "Find IStep=%d, SubStep=%d",
                       l_IStep,
                       l_SubStep );

            l_pistep    =   findTaskInfo( l_IStep,
                                          l_SubStep );
            if ( l_pistep == NULL )
            {

                TRACDCOMP( g_trac_initsvc,
                           "End of ISubStep 0x%x list.", l_SubStep );
                break;  // break out of inner for loop
            }

            //  @todo   placeholder until progress codes are defined and
            //          progress code driver is implemented.
            l_progresscode  =  ( (l_IStep<<16) | l_SubStep );
            InitService::getTheInstance().setProgressCode( l_progresscode );

            l_args.clear();

            l_errl = InitService::getTheInstance().executeFn( l_pistep,
                                                              &l_args );
            if ( l_errl )
            {
                //  Handle an errorlog from the parent, if it exists
                //  an error here is probably fatal, it means we can't
                //  launch the task or it doesn't exist.  In either
                //  case we should exit the loop.
                //  Can't commit the errorlog here because we are using it
                //  as a flag to exit the loop.
                break;
            }

            //  make local copies of the status returned from the istep.
            //  note that this also removes the errorlog from the TaskArgs
            //  struct - it is read-once.  See taskargs.H for details
            l_isteprc   =   l_args.getReturnCode();
            l_errl      =   l_args.getErrorLog();


             if ( l_errl )
             {
                 TRACFCOMP( g_trac_initsvc,
                     "ISD: istep %s returned 0x%llx, errlog=%p",
                     l_pistep->taskname,
                     l_isteprc,
                     l_errl  );
                 // if we have an errorlog, break out of the inner loop
                 // and handle it.
                 break;
             }
             else
             {
                 //  Check child results for a valid nonzero return code.
                 //  If we have one, and no errorlog, then we create an
                 //  errorlog here.
                 if ( l_isteprc != 0 )
                 {
                     TRACFCOMP( g_trac_initsvc,
                                "ISD:  istep %s returned 0x%llx, no errlog",
                                l_pistep->taskname,
                                l_isteprc );

                     /*@     errorlog tag
                      *  @errortype      ERRL_SEV_CRITICAL_SYS_TERM
                      *  @moduleid       ISTEP_RETURNED_ERROR_ID
                      *  @reasoncode     ISTEP_FAILED_NO_ERRLOG
                      *  @userdata1      istep / substep
                      *  @userdata2      returncode from istep
                      *
                      *  @devdesc        The Istep returned with an error,
                      *                  but there was no errorlog posted
                      *                  from the IStep. Look at user1 data
                      *                  for the istep / substep, and
                      *                  user2 data for the returned errorcode.
                      */
                     l_errl = new ERRORLOG::ErrlEntry(
                             ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM,
                             ISTEP_RETURNED_ERROR_ID,
                             INITSERVICE::ISTEP_FAILED_NO_ERRLOG,
                             ( l_IStep << 8 | l_SubStep ),
                             l_isteprc );
                     // attach the istep name to the error log
                     // @todo
                     IStepNameUserDetail   l_istepud( l_pistep->taskname );
                     l_istepud.addToLog( l_errl );
                     // drop out of inner loop with errlog set.
                     break;
                 }   // end if ( )
             }
        }   // endfor l_SubStep

        if ( l_errl )
        {
            // something left an error log in the inner loop, breakout
            break;
        }
    }   // endfor l_IStep


    /**
     * @todo detect Can-Continue condition here and reset/rerun ISteps.
     *      For now this is pushed to a later sprint.
     */


    //  Post any errorlogs.  If one exists, stop here.   Otherwise, return
    //  to caller.
    if  ( l_errl )
    {
        TRACFCOMP( g_trac_initsvc,
                   "ERROR:  istep=0x%x, substep=0x%x, isteprc=0x%x, committing errorlog and shutting down.",
                   l_IStep,
                   l_SubStep,
                   l_isteprc );
        errlCommit( l_errl, INITSVC_COMP_ID );

        // pass an error code on to extinitsvc that we are shutting down.
        pTaskArgs->postReturnCode( TASKARGS_SHUTDOWN_RC );
        //Tell initservice to perform shutdown sequence
        InitService::getTheInstance().doShutdown( SHUTDOWN_STATUS_ISTEP_FAILED );

    }

}




bool IStepDispatcher::getCanContinueProcedure(  const  TaskInfo &i_failingIStep,
                                                errlHndl_t      &i_failingError,
                                                TaskInfo        &io_nextIstep
                                                ) const
{

    return  false;
}


IStepDispatcher& IStepDispatcher::getTheInstance()
{
    return Singleton<IStepDispatcher>::instance();
}


IStepDispatcher::IStepDispatcher()
{
    initIStepMode();            // set up internal flag

}


IStepDispatcher::~IStepDispatcher()
{ }

} // namespace
OpenPOWER on IntegriCloud