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
|
/**
* @file initservice.H
*
* - Manage high-level host boot IPL flow
* - Perform can-continue processing
* - Perform automatic and manual Istep execution
* - Handle flow errors as appropriate.
*
*/
/**
* High-level todo list
*
* @todo SP3: move startTask() and reportError() to private
* @todo SP3: remove ADUDD, not used
* @todo SP3: add (NULL) detection to printk
* @todo SP3: reevaluate all trace calls - TRACF are field traces, - ERR_MRK etc macros
* @todo SP3: change InitService::start() to init(), document this as a standard.
* @todo SP3: initservice/makefile remove trailing tabs
* @todo SP3: Disable copy CTOR/assignment operator; this would have caught an illegal copy by assignment elsewhere
* @@todo Add more macros to trace, discuss with Andrew and Nick
*
*
*/
#ifndef __INIT_SERVICE_H
#define __INIT_SERVICE_H
/******************************************************************************/
// Includes
/******************************************************************************/
#include <stdint.h>
#include <util/singleton.H>
#include <sys/vfs.h> // VFS_MODULE_NAME_MAX
#include <errl/errlentry.H>
#include <initservice/initsvcreasoncodes.H>
namespace INITSERVICE
{
/******************************************************************************/
// Globals/Constants
/******************************************************************************/
/******************************************************************************/
// Typedef/Enumerations
/******************************************************************************/
/**
* @enum ModuleType
* - BASE_MODULE == module in the base image
* - EXT_MODULE == module in the extended image
*/
enum ModuleType
{
BASE_MODULE = 0,
EXT_MODULE,
};
/**
* @struct TaskFlags
*
* - run _start() function on start
* - module type, BASE_MODULE or EXT_MODULE
* - module_id for errorlog if task fails
*
* @todo revisit these flags in sprint3
*/
struct TaskFlags
{
bool startflag; // this is a task, run _start() function
ModuleType module_type; // BASE_MODULE_TYPE or EXT_MODULE_TYPE
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];
TaskFlags taskflags;
} PACKED;
/******************************************************************************/
// InitService Class
/******************************************************************************/
// Singleton definition
class InitService;
typedef Singleton<InitService> theInitService;
/**
* @class InitService Singleton Class
*
* This class is launched by _start() (see initservicetaskentry.C),
* which is launched by the kernel (init_main.C).
*
* Once started, it handles the rest of HostBoot Initialization.
*
* @returns none
*/
class InitService
{
public:
friend class InitServiceTest;
/**
* @brief Get singleton instance of this class.
*
* @return the (one and only) instance of InitService
*/
static InitService& getTheInstance();
/**
* @brief Provide an entry function into the class, called from _start()
*
* @param[in] i_args pointer to any arguments passed in from
* _start() and by extension the kernel,
* currently this is NULL .
*
* @todo Sprint 3: pass in ptr to errorlog struct?
* @todo document any changes for args
*/
void start( void *i_args);
/**
* @brief Constructor for the InitService object.
*/
InitService();
/**
* @brief Destructor for the InitService object.
*/
~InitService();
/**
* @brief start a task
*
* @param[in] i_rtask reference to a TaskInfo struct
* @param[inout] i_rerrl reference to an errorlog struct.
* struct will be filled out if error,
* otherwise untouched.
*
* @return child id if success, < 0 for failure
*
* @todo return errorlog handle in sprint3
*/
tid_t startTask( const TaskInfo &i_rtask, errlHndl_t &i_rerrl ) const;
/**
* @brief report Error to the system.
*
* @param[in] io_errl - errlHndl_t pointer to a filled-out error entry
* errorlog will be committed, errorlog
* will be deleted, and pointer will be
* set to NULL on exit
*
* @return nothing
*/
void reportError( errlHndl_t &io_rerrl) const;
private:
/**
* @brief Initialize the Trace module
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startTrace( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the ErrorLog module
*
* *
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startErrLog( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the XSCOM Device Driver module
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startXSCOMDD( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the PNOR Device Driver module
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startPNORDD( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the second stage of VFS module
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startVFS_2( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the Targetting DD module
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startTargetting( errlHndl_t &i_rerrl ) const;
/**
* @brief get the Master Chip Target
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void getMasterChipTarget( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the Mailbox Device Driver
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startMailboxDD( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize SP Communications
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startSPComm( errlHndl_t &i_rerrl ) const;
/**
* @brief Turn on Streaming Trace, if the PNOR flag is set
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void enableStreamingTrace( errlHndl_t &i_rerrl ) const;
/**
* @brief Start reporting progress codes.
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startProgressCodes( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize the FSI Device Driver module
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startFSIDD( errlHndl_t &i_rerrl ) const;
/**
* @brief Set up links to the slaves
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void setupSlaveLinks( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize FSI SCOM
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startFSISCOM( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize FSI I2C
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startFSII2C( errlHndl_t &i_rerrl ) const;
/**
* @brief Initialize HWP
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void startHWPF( errlHndl_t &i_rerrl ) const;
/**
* @brief Read Configuration from PNOR
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void readMaxConfigfromPNOR( errlHndl_t &i_rerrl ) const;
/**
* @brief apply Presence Detect
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void applyPresenceDetect( errlHndl_t &i_rerrl ) const;
/**
* @brief apply Partial Bad
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void applyPartialBad( errlHndl_t &i_rerrl ) const;
/**
* @brief apply Gard
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void applyGard( errlHndl_t &i_rerrl ) const;
/**
* @brief Collect HW IDEC info
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void collectHWIDEC( errlHndl_t &i_rerrl ) const;
/**
* @brief verify the IDEC info
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void verifyIDEC( errlHndl_t &i_rerrl ) const;
/**
* @brief Disable the HW watchdog
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void disableWatchDog( errlHndl_t &i_rerrl ) const;
/**
* @brief Execute the IStep module to communicate with SP and run
* the isteps.
*
* @param[in,out] i_rerrl - errorlog handle.
* Success: handle is untouched
* Failure: will point to a filled-out errorlog
*
* @return none
*/
void executeISteps( errlHndl_t &i_rerrl ) const;
}; // class InitService
} // namespace INITSERVICE
#endif
|