summaryrefslogtreecommitdiffstats
path: root/src/usr/htmgt/occError.H
blob: ac98bf8bbf33b6dfcf2c1f0b768a2d7e1a64914c (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/htmgt/occError.H $                                    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2014,2018                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef OCCERROR_H
#define OCCERROR_H

#include <stdint.h>
#include "htmgt_occ.H"

namespace HTMGT
{
    // Error Severity
    enum occSeverityType
    {
        OCC_SEV_INFORMATIONAL   = 0x00,
        OCC_SEV_RECOVERABLE     = 0x01,
        OCC_SEV_UNRECOVERABLE   = 0x02
    };

    // Error Actions
    enum tmgtErrlActionsType
    {
        TMGT_ERRL_ACTIONS_FORCE_ERROR_POSTED       = 0x10,
        TMGT_ERRL_ACTIONS_WOF_RESET_REQUIRED       = 0x20,
        TMGT_ERRL_ACTIONS_SAFE_MODE_REQUIRED       = 0x40,
        TMGT_ERRL_ACTIONS_RESET_REQUIRED           = 0x80,
    };

    // Type of Callout
    enum occCalloutType
    {
        OCC_CALLOUT_TYPE_SENSOR        = 0x01,
        OCC_CALLOUT_TYPE_COMPONENT_ID  = 0x02,
        OCC_CALLOUT_TYPE_GPU_SENSOR    = 0x03,
    };

    // TMGT-OCC Component Ids
    enum occCompIdType
    {
        OCC_COMPONENT_ID_FIRMWARE         = 0x01,
        OCC_COMPONENT_ID_OVER_TEMPERATURE = 0x04,
        OCC_COMPONENT_ID_OVERSUBSCRIPTION = 0x05,
        OCC_COMPONENT_ID_NONE             = 0xFF,
    };

    // Callout Data Type, this was ported forward from P7
    enum tmgtCompxlateType
    {
        TMGT_COMP_DATA_RID                 = 0x00,
        TMGT_COMP_DATA_PROC_RID            = 0x01,
        TMGT_COMP_DATA_PROCEDURE           = 0x02,
        TMGT_COMP_DATA_POWR_VRM_NUM        = 0x03,
        TMGT_COMP_DATA_MEMORY_TABLE_NUM    = 0x04,
        TMGT_COMP_DATA_POWR_DCA_NUM        = 0x05,
        TMGT_COMP_DATA_IOHUB_TABLE_NUM     = 0x06,
        TMGT_COMP_DATA_SYMBOLIC_FRU        = 0x07,
        TMGT_COMP_DATA_SN_TABLE_NUM        = 0x08,
        TMGT_COMP_DATA_VDD_PROC_RID        = 0x0A,
        TMGT_COMP_DATA_END_OF_TABLE        = 0xFF
    };

    // Callout Priority Translation
    struct occSrciPriorityXlate
    {
        uint8_t      occPriority;
        HWAS::callOutPriority errlPriority;
    } __attribute__ ((__packed__));
    typedef struct occSrciPriorityXlate occSrciPriorityXlate_t;

    const occSrciPriorityXlate_t occPriorityXlateTbl[] =
    {
        {0x01, HWAS::SRCI_PRIORITY_LOW},
        {0x02, HWAS::SRCI_PRIORITY_MED},
        {0x03, HWAS::SRCI_PRIORITY_HIGH},
    };
    const uint8_t OCC_SRCI_PRIORITY_XLATE_SIZE =
        (sizeof(occPriorityXlateTbl) / sizeof(occSrciPriorityXlate_t));

    // OCC Usr Dtls Structure
    struct occErrlUsrDtls
    {
        uint8_t     version;             // User Details Version
        uint8_t     reserved;            // Reserved
        uint16_t    modId;               // Module Id
        uint32_t    fwLevel;             // Firmware Level
        uint64_t    timeStamp;           // Time Stamp
        uint8_t     occId;               // OCC ID
        uint8_t     occRole;             // OCC Role
        uint8_t     operatingState;      // OCC State
        uint8_t     committed;           // Log Committed?
        uint32_t    userData1;           // User Data Word 1
        uint32_t    userData2;           // User Data Word 2
        uint32_t    userData3;           // User Data Word 3
        uint16_t    entrySize;           // Log Size
        uint16_t    userDetailEntrySize; // User Details Size
    } __attribute__ ((__packed__));
    typedef struct occErrlUsrDtls occErrlUsrDtls_t;

    // User Detail Entry Structure
    struct occUserDetailsEntry
    {
        uint8_t     version; // User Details Entry Version
        uint8_t     type;    // User Details Entry Type
        // Note: Users must use ERRL_USR_DETAIL_TYPE enum
        uint16_t    size;    // User Details Entry Size
    } __attribute__ ((__packed__));
    typedef struct occUserDetailsEntry occUserDetailsEntry_t;

#define ERRL_MAX_CALLOUTS 6

    // OCC Error Log Structure
    struct occErrlEntry
    {
        // Log CheckSum
        uint16_t            checkSum;
        // Log Version
        uint8_t             version;
        // Log Entry ID
        uint8_t             entryId;
        // Log Reason Code
        uint8_t             reasonCode;
        // Log Severity
        uint8_t             severity;
        // Actions to process the errors
        uint8_t             actions;
        // Reserved
        uint16_t            reserved;
        // Extended Reason Code
        uint16_t            extendedRC;
        // Log Callout Number
        uint8_t             maxCallouts;
        // Callouts
        occErrlCallout      callout[ERRL_MAX_CALLOUTS];
    } __attribute__ ((__packed__));
    typedef struct occErrlEntry occErrlEntry_t;


    // OCC Severity and Action
    struct occSeverityActionXlate
    {
        occSeverityType             occSeverity;
        ERRORLOG::errlSeverity_t    occErrlSeverity;
    };
    typedef struct occSeverityActionXlate occSeverityActionXlate_t;

    // Translate Severity and Actions
    const occSeverityActionXlate_t occSeverityErrorActionXlate[] =
    {
        {OCC_SEV_INFORMATIONAL, ERRORLOG::ERRL_SEV_INFORMATIONAL},
        {OCC_SEV_RECOVERABLE,   ERRORLOG::ERRL_SEV_PREDICTIVE},
        {OCC_SEV_UNRECOVERABLE, ERRORLOG::ERRL_SEV_UNRECOVERABLE},
    };
    const uint8_t OCC_SEV_ACTION_XLATE_SIZE =
        (sizeof(occSeverityErrorActionXlate)/sizeof(occSeverityActionXlate_t));




    struct tmgtCompXlate
    {
        uint8_t               compId;
        tmgtCompxlateType     dataType;
        uint32_t              data;
    };
    typedef struct tmgtCompXlate tmgtCompXlate_t;

    const uint16_t TMGT_MAX_COMP_IDS = 4;

    const uint32_t OVERTMP = 0x05;
    const uint32_t TPMD_OV = 0x06;

    const tmgtCompXlate_t tmgt_compXlateTable[TMGT_MAX_COMP_IDS] =
    {
        { 0x01, TMGT_COMP_DATA_PROCEDURE,    HWAS::EPUB_PRC_HB_CODE}, // FW
        { 0x04, TMGT_COMP_DATA_SYMBOLIC_FRU, OVERTMP}, // over temperature
        { 0x05, TMGT_COMP_DATA_SYMBOLIC_FRU, TPMD_OV}, // oversub throttling
        { 0xFF, TMGT_COMP_DATA_END_OF_TABLE, 0},       // none
    };


    struct tmgtSafeModeReasonCode_t
    {
        uint32_t    returnCode;
        uint32_t    huid;
        bool        infoOnly;
    };


    // OCC Error Source
    enum occErrorSource_e
    {
        OCC_ERRSRC_405  = 0x00,
        OCC_ERRSRC_PGPE = 0x10,
        OCC_ERRSRC_XGPE = 0x20
    };


} // end namespace
#endif
OpenPOWER on IntegriCloud