summaryrefslogtreecommitdiffstats
path: root/src/include/usr/errl/hberrltypes.H
blob: be0201ead940d050e2fc6d77d4476059d4c3bfee (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/errl/hberrltypes.H $                          */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2014              */
/*                                                                        */
/* 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 otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef HBERRLTYPES_H
#define HBERRLTYPES_H
/**
 *  @file errltypes.H
 *
 *  @brief  Common ErrlEntry definitions.
 *
 *  This header file contains the definition of ErrlEntry related
 *  parameters.
 *
 *  This file will be included by error log parsers that run
 *  on pool machines, so the stuff in here needs to be generic.
 *
 */
#include <hbotcompid.H>             // compId_t
#include <stdint.h>

/**
 * @brief Pointer to an ErrlEntry object
 */
namespace ERRORLOG { class ErrlEntry; };

/**
 * @brief Macros to store different numbers into uint64_t
 */

// Convert any integer to uint16_t
#define TO_UINT16(x)    static_cast<uint16_t>(x)

// Convert any integer to uint32_t
#define TO_UINT32(x)    static_cast<uint32_t>(x)

// Convert any integer to uint64_t
#define TO_UINT64(x)    static_cast<uint64_t>(x)

// uint16_t val = 8bit:8bit
#define TWO_UINT8_TO_UINT16(left_8, right_8) \
            ( (TO_UINT16(left_8) << 8) | TO_UINT16(right_8) )

// uint32_t val = 16bit:16bit
#define TWO_UINT16_TO_UINT32(left_16, right_16) \
            ( (TO_UINT32(left_16) << 16) | TO_UINT32(right_16) )

// uint64_t val = 32bit:32bit
#define TWO_UINT32_TO_UINT64(left_32, right_32) \
            ( (TO_UINT64(left_32) << 32) | TO_UINT64(right_32) )

// uint64_t val = 16bit:16bit:32bit
#define TWO_UINT16_ONE_UINT32_TO_UINT64(left_16, mid_16, right_32) \
            ( (TO_UINT64(TWO_UINT16_TO_UINT32(left_16, mid_16)) << 32) | \
              TO_UINT64(right_32) )

// uint64_t val = 16bit:16bit:16bit:16bit
#define FOUR_UINT16_TO_UINT64(mostleft_16, left_16, right_16, mostright_16) \
        ( (TO_UINT64(TWO_UINT16_TO_UINT32(mostleft_16, left_16)) << 32) | \
          (TO_UINT64(TWO_UINT16_TO_UINT32(right_16, mostright_16))) )

namespace ERRORLOG
{



/**
 *    @brief Scope is found in user header section.

 */
enum errlScope_t
{
    ERRL_SCOPE_PLATFORM            = 0x03, ///< Entire Platform
};



/**
 *   @brief Domain as found in user header section.
 */
enum errlDomain_t
{
    ERRL_DOMAIN_DEFAULT     = 0xFF  // Field based on Subsystem ID
};


/**
 *   @brief Vector as found in user header section.
 */
enum errlVector_t
{
    ERRL_VECTOR_DEFAULT      = 0xFF  // Vector that triggered the base class
                                     // of problem in Problem Domain Field.
                                     // Unique field based on Subsystem ID
};



/**
 *  @brief Platform Event Log actions
 *
 *  Several action flags used to trigger various
 *  handling mechanisms for an event log such as
 *  calling home and sending to the hypervisor.
 */
enum errlActions_t
{
    ERRL_ACTION_NONE             = 0x0000, // No action required
};




/**
 *  @brief Creator types.
 */
enum errlCreator_t
{
    ERRL_CID_HOSTBOOT                       = 'B',
};




/**
 * @brief Enumeration of PEL section eyecatchers. These are
 * usually handled as a uint16_t.  See
 * "eCLipz and P7 Platform Event Log and SRC PLDD" documentation
 * https://mcdoc.boeblingen.de.ibm.com/out/out.ViewDocument.php?documentid=1675
 */
enum errlSectionId_t
{
    ERRL_SID_PRIVATE_HEADER                 = 0x5048, // PH private header
    ERRL_SID_USER_HEADER                    = 0x5548, // UH user header
    ERRL_SID_PRIMARY_SRC                    = 0x5053, // PS
    ERRL_SID_USER_DEFINED                   = 0x5544  // UD user defined
};


/**
 * @brief Enumeration of error log severity.
 * Needs to fit into 1 byte for flattening purposes.
 *
 * Severity resides in the user header of the PEL log.
 *
 * Refer to this ErrlEntry setter:
 * void ErrlEntry::setSev(const errlSeverity_t i_sev)
 */
enum errlSeverity_t
{
    ERRL_SEV_INFORMATIONAL     = 0x00,  //Information
    ERRL_SEV_RECOVERED         = 0x10,  //Recovered
    ERRL_SEV_PREDICTIVE        = 0x20,  //Predictive Error, general
    ERRL_SEV_UNRECOVERABLE     = 0x40,  //Unrecoverable, general
    ERRL_SEV_CRITICAL_SYS_TERM = 0x51,  //Critical, System Termination
    ERRL_SEV_UNKNOWN           = 0xFF   //Reserved
};




/**
 * @brief Event (error) type
 * Needs to fit into 1 byte for flattening purposes.
 *
 * Event type resides in user header of PEL log.
 *
 * Refer to this ErrlEntry setter:
 * void ErrlEntry::setEventType(const errlEventType_t i_eventType)
 */
enum errlEventType_t
{
    ERRL_ETYPE_NOT_APPLICABLE           = 0x00,
    ERRL_ETYPE_MISCELLANEOUS            = 0x01,
    ERRL_ETYPE_DUMP_NOTIFICATION        = 0x08,
    ERRL_ETYPE_USER_DECONFIG            = 0x20,
    ERRL_ETYPE_SYS_DECONFIG             = 0x21,
    ERRL_ETYPE_CONCURRENT_MAINTENANCE   = 0x40,
    ERRL_ETYPE_CAPACITY_UPGRADE         = 0x60,
};




/**
 * @brief SRC type definitions
 * Needs to fit into 1 byte for flattening purposes.
 *
 * This represents the byte in an SRC in position
 * XX......  such as BC in BC81F00B.
 *
 * Refer to errlentry.H and this setter:
 * void ErrlEntry::setSrcType(const srcType_t i_srcType)
 *
 */
enum srcType_t
{
    SRC_INTERVENTION_REQ   = 0xAC,
    SRC_ERR_INFO           = 0xBC,
    SRC_IPL_STATUS         = 0xCC,
    SRC_GENERAL_STATUS     = 0xDC,
};


/**
 * @brief Sub system definitions
 * Needs to fit into 1 byte for flattening purposes.
 * This represents the byte in an SRC in position
 * ..XX....  such as 81 in B181F00B.
 *
 * Refer to errentry.H and src/epub/fsp/epub_service_codes.H
 * in fips code.
 */
enum epubSubSystem_t
{
    EPUB_RESERVED_0                 = 0x00,

    // Processor subsystem
    EPUB_PROCESSOR_SUBSYS           = 0x10,
    EPUB_PROCESSOR_FRU              = 0x11,
    EPUB_PROCESSOR_CHIP_CACHE       = 0x12,
    EPUB_PROCESSOR_UNIT             = 0x13,
    EPUB_PROCESSOR_BUS_CTL          = 0x14,

    // Memory subsystem
    EPUB_MEMORY_SUBSYS              = 0x20,
    EPUB_MEMORY_CONTROLLER          = 0x21,
    EPUB_MEMORY_BUS                 = 0x22,
    EPUB_MEMORY_DIMM                = 0x23,
    EPUB_MEMORY_FRU                 = 0x24,
    EPUB_EXTERNAL_CACHE             = 0x25,

    // I/O Subsystem: hub
    EPUB_IO_HUB                     = 0x31,

    // CEC Hardware
    EPUB_CEC_HDW_SUBSYS             = 0x50,
    EPUB_CEC_HDW_VPD_INTF           = 0x55,
    EPUB_CEC_HDW_I2C_DEVS           = 0x56,
    EPUB_CEC_HDW_JTAG               = 0x57,
    EPUB_CEC_HDW_CHIP_INTF          = 0x57,  // includes JTAG, FSI, etc.
    EPUB_CEC_HDW_CLK_CTL            = 0x58,
    EPUB_CEC_HDW_OP_PANEL           = 0x59,
    EPUB_CEC_HDW_TOD_HDW            = 0x5A,
    EPUB_CEC_HDW_SP_PHYP_INTF       = 0x5C,

    // Power/Cooling subsystem
    EPUB_POWER_SUBSYS               = 0x60,

    // Others
    EPUB_MISC_SUBSYS                = 0x70,
    EPUB_MISC_TEST_TOOL             = 0x72,
    EPUB_MISC_MULTIPLE_SUBSYS       = 0x74,
    EPUB_MISC_UNKNOWN               = 0x75,
    EPUB_MISC_INFORMATIONAL         = 0x76,

    // Platform Firmware
    EPUB_FIRMWARE_SUBSYS            = 0x80,
    EPUB_FIRMWARE_SP                = 0x81,
    EPUB_FIRMWARE_PHYP              = 0x82,

    EPUB_FIRMWARE_HOSTBOOT          = 0x8A,
    EPUB_FIRMWARE_OCC               = 0x8B,
    EPUB_UNKNOWN                    = 0xFF,
};



/**
 * @brief Terminating flag definitions
 * Needs to fit into 1 word (32-bits) for flattening purposes.
 */
enum errlTermState_t
{
    TERM_STATE_NO_FLAGS        = 0x00000000,
    TERM_STATE_MNFG            = 0x10000000,
    TERM_STATE_SOFT            = 0x20000000,
    TERM_STATE_UNKNOWN         = 0xFFFFFFFF,
};




/** @enum  errlUserDataType_t
  *
  * These are section type identifiers for the ERRL component for
  * user-defined data sections. For example, if somebody calls
  *           errl->collectTrace("INITSVC")
  * then the resulting UD PEL section header will be tagged with
  *     component id:       ERRL_COMP_ID
  *     section type:       ERRL_UDT_TRACE
  *     version:            ERRL_UDV_DEFAULT_VER_1
  *
  * Other components will have to code a similar enum so that
  * the the errl parser/pretty printer can "dispatch" a user-defined
  * PEL section to them for printing based on the three values in
  * the UD PEL section: component id, section type, and version.
  *
  * The section type field in the PEL header is one byte long.
  */
enum errlUserDataType_t
{
    ERRL_UDT_TRACE          = 0x0C,   // A trace buffer
};


/** @enum  errlUserDataVersion
  *
  * Identifier for the version of user data in an error log.
  * This value is used in conjuction with the type field to format
  * of the additional data in an error log.  Versions and type should
  * be unique across subcomponents of the errl component.
*/
enum errlUserDataVersion
{
    ERRL_UDV_DEFAULT_VER_1      = 0x0001,   // Version 1, default info
};


/**
 * @brief  This is the size of the storage buffer, presently
 * in L3 RAM.  When this storage is filled, no more error logs
 * will be committed. The L3 RAM storage is g_ErrlStorage[]
 * declared in errlmanager.C in BSS data. This will change
 * when switching to PNOR.
 */
const uint32_t ERRL_STORAGE_SIZE = 65536;

/**
 *
 *  @typedef    version number
 *      version number of the user data
 */
typedef uint8_t errlver_t;

/**
 * @typedef errlsubsec_t
 *      errorlog subsection id of the user data
 */
typedef uint8_t errlsubsec_t;


/**

 * @brief The RAM storage for committed error logs starts with this
 * header.  This structure is org'ed at &g_ErrlStorage[0].  All
 * offsets are based from &g_achErrlStorage[0], so the first
 * marker will appear at offset sizeof( storage_header_t )
 */
typedef struct storage_header
{
    uint32_t    cbStorage;        // count of bytes in buffer
    uint32_t    cInserted;        // count of logs ever commited
    uint32_t    offsetStart;      // start-of-list marker
    uint32_t    offsetMarker;     // next-insertion marker
} __attribute__((packed)) storage_header_t;




/**
 * @brief The storage buffer is a series of flattened error logs
 * interspersed with markers.
 * A typical marker will give the offset to the next marker and also
 * the length of the flattened error log data.
 */
typedef struct marker
{
    uint32_t    offsetNext;
    uint32_t    length;
} __attribute__((packed)) marker_t;






/**
 * @brief pelSectionHeader_t
 *
 * A PEL structure used to flatten error logs to PEL format.
 *
 * This structure represents the first 8 bytes of any PEL section.
 * Populated by the flatten code of class ErrlSctnHdr for any PEL
 * section.  Classes ErrlUH, ErrlPrvt, and ErrlSctn each have a
 * ErrlSctnHdr.  User-defined sections derive from ErrlSctn, so
 * their section header works though ErrlSctn parent class.
 *
 * When parsing a PEL data set, start at offset 0 (the
 * first section).  Then add "len" to know the starting offset
 * of the second section, and so on.
 *
 * When pretty-printing a user-defined PEL section, the
 * controlling logic will "dispatch" a PEL section to a
 * user-supplied printing function based on the component ID,
 * section type, and version.
 */
typedef struct pelsectionheader
{
  uint16_t   sid;     // section identifier
  uint16_t   len;     // overall length of this section
  uint8_t    ver;     // section version
  uint8_t    sst;     // section type
  uint16_t   compId;  // component ID
} __attribute__((packed))  pelSectionHeader_t;



/**
 * @brief pelPrivateHeaderSection_t
 *
 * A PEL structure used to flatten error logs to PEL format.
 *
 * This structure represents an entire Private Header (PH)
 * PEL section. This section is a fixed overall
 * length of 48 bytes including the PEL section header.
 * This the first section found in a flat PEL dataset.
 * Populated by the flatten code of class ErrlPrvt.
 *
 * The component named in the section header is the
 * creating component of the error log.
 */
typedef struct pelprivateheadersection
{
  pelSectionHeader_t  sectionheader;
  uint64_t   creationTime;
  uint64_t   commitTime;
  uint8_t    creatorId;   // 'B' for Hostboot
  uint8_t    reserved0;
  uint8_t    reserved1;
  uint8_t    sectionCount;
  uint32_t   reserved2;
  uint64_t   creatorImplementation;
  uint32_t   plid;
  uint32_t   eid;
} __attribute__((packed)) pelPrivateHeaderSection_t;



/**
 * @brief pelUserHeaderSection_t
 *
 * A PEL structure used to flatten error logs to PEL format.
 *
 * This structure represents an entire User Header (UH)
 * PEL section. This section is a fixed overall
 * length of 0x18 bytes including the PEL section header.
 * This the second section found in a flat PEL dataset.
 * Populated by the flatten code of class ErrlUH.
 *
 * The component named in the section header is the
 * committing component of the error log.
 */
typedef struct peluserheadersection
{
  pelSectionHeader_t sectionheader;
  uint8_t    ssid;   // subsystem id
  uint8_t    scope;  // event scope
  uint8_t    sev;    // severity
  uint8_t    etype;  // event type
  uint32_t   reserved0;  // for error log return code
  uint8_t    domain;     // not used in Hostboot
  uint8_t    vector;     // not used in Hostboot
  uint16_t   actions;    // TODO RTC 93631
  uint32_t   reserved1;
} __attribute__((packed)) pelUserHeaderSection_t;




/**
 * @brief pelSRCSection_t
 *
 * A PEL structure used to flatten error logs to PEL format.
 *
 * This structure represents an entire Primary SRC (PS)
 * PEL section. This section is a fixed overall
 * length of 80 bytes including the PEL section header.
 * This the usually the third section found in a flat PEL dataset.
 * Populated by the flatten code of class ErrlSRC.
 *
 * Hostboot generates a minimal SRC as described under
 * "Common Usage of the SRC Structure" (p.69) in the PEL
 * reference (mcdoc 1675). The page numbers below refer
 * to version 0.8 of that document.
 */

typedef struct pelsrcsection
{
  pelSectionHeader_t sectionheader;
  uint8_t    ver;        // src version, usually a 2
  uint8_t    flags;      // src flags
  uint8_t    reserved0;
  uint8_t    wordcount;  // usually 9
  uint16_t   reserved1;  // usually 0, but I put reasonCode here
  uint16_t   srcLength;  // usually 72
  // "Hex word 2"
  // Low byte of this word is SRC format 0xE0.
  uint32_t   word2;
  // "Hex word 3"
  uint16_t   word3;
  uint8_t    moduleId;
  uint8_t    reserved2;
  // "Hex word 4" last progress code
  uint32_t   word4;
  // "Hex word 5" error status flags, etc.
  uint32_t   word5;
  // "Hex word 6-7" optional, iv_user1
  uint64_t   word6;
  // "Hex word 8-9" optional, iv_user2
  uint64_t   word8;
  char       srcString[32];
} __attribute__((packed)) pelSRCSection_t;







} // End namespace

#endif // HBERRLTYPES_H
OpenPOWER on IntegriCloud