summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/prdfErrlUtil.H
blob: 60705268f7290f3c3e528ced0908cacacba2c500 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/prdfErrlUtil.H $                            */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2002,2014              */
/*                                                                        */
/* 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 __prdfErrlUtil_H
#define __prdfErrlUtil_H

/**
 * @file  prdfErrlUtil.H
 * @brief PRD error logging code specific to hostboot.
 *
 * This file contains the Processor Runtime Diagnostics error logging
 * related declarations specific to hostboot.
 */

#include <prdfEnums.H>

/**
 * @brief create ErrlEntry in Hostboot
 */
/* This macro does not use the below FSP input parms:

   - i_etype    : errlEventType
   - i_type     : srciType
   - i_srcAttr  : srcAttr
   - i_refCode  : serviceCodes
*/
#define  PRDF_CREATE_ERRL(io_errl, i_sev, i_etype, i_type,            \
                          i_srcAttr, i_mid, i_refCode, i_reasonCode,  \
                          i_user1 ,  i_user2,  i_user3 ,  i_user4)    \
    io_errl = new ERRORLOG::ErrlEntry(ERRORLOG::i_sev,             \
                                      i_mid,                       \
                                      i_reasonCode,                \
                                      PRDF_GET_UINT64_FROM_UINT32( \
                                      i_user1,                     \
                                      i_user2),                    \
                                      PRDF_GET_UINT64_FROM_UINT32( \
                                      i_user3,                     \
                                      i_user4))

/**
 * @brief Add user data to the log
 */
#define PRDF_ADD_FFDC(io_errl, i_buf, i_size, i_ver, i_subsec) \
    io_errl->addFFDC(PRDF_COMP_ID, i_buf, i_size, i_ver, i_subsec)

/**
 * @brief Commit the log
 */
// NOTE: Hostboot error log commit function does not need the action flag
#define PRDF_COMMIT_ERRL(io_errl, i_actions) \
    if(i_actions) {} \
    errlCommit(io_errl, PRDF_COMP_ID)

/**
 * @brief Collect component trace
 */
#define PRDF_COLLECT_TRACE(io_errl, i_max) \
    io_errl->collectTrace(PRDF_COMP_NAME, i_max)

/**
 * @brief Add a procedure ( software ) callout
 */
#define PRDF_ADD_PROCEDURE_CALLOUT(io_errl, i_priority, i_procedure) \
    io_errl->addProcedureCallout((const HWAS::epubProcedureID)i_procedure, \
                                 (const HWAS::callOutPriority)i_priority)

/**
 * @brief Adds a software section to the log
 * mostly used as a stack call indicator
 */
// NOTE: hberrl doesn't support this so make it a no-op.
#define PRDF_ADD_SW_ERR(io_errl, i_rc, i_fileId, i_codeloc)

/**
 * @brief Get the platform Log Id
 */
#define PRDF_GET_PLID(io_errl, o_plid) \
    o_plid = io_errl->plid()

/**
 * @brief Set 32 bit user defined return code
 */
// NOTE: hberrl doesn't support this so make it a no-op.
#define PRDF_SET_RC(io_errl, i_rc)

/**
 * @brief Get 32 bit user defined return code
 */
// NOTE: hberrl doesn't support this so make it a no-op.
#define PRDF_GET_RC(io_errl, i_rc)

/**
 * @brief Get reason code
 */
#define PRDF_GET_REASONCODE(io_errl, o_reasonCode) \
    o_reasonCode = io_errl->reasonCode()

/**
 * @brief Determine if the src is terminating
 */
// NOTE: hberrl doesn't support this so make it a no-op.
#define PRDF_GET_TERM_SRC(io_errl, o_termSRC)

/**
 * @brief write SRC termination flag
 */
// NOTE: hberrl doesn't support this so make it a no-op.
#define PRDF_SRC_WRITE_TERM_STATE_ON(io_errl, i_flags)

// end Singleton macros

/*--------------------------------------------------------------------*/
/*  HW Deconfig Errl macros for Hostboot                              */
/*--------------------------------------------------------------------*/

/**
 * @brief function to create an error log.
 */
#define  PRDF_HW_CREATE_ERRL(io_errl,      \
                             i_sev,        \
                             i_etype,      \
                             i_type,       \
                             i_srcAttr,    \
                             i_mid,        \
                             i_refCode,    \
                             i_reasonCode, \
                             i_userData1,  \
                             i_userData2,  \
                             i_userData3,  \
                             i_userData4,  \
                             i_termFlag,   \
                             i_pldCheck)   \
  PRDF_CREATE_ERRL(io_errl, i_sev, i_etype, i_type,            \
                   i_srcAttr, i_mid, i_refCode, i_reasonCode,  \
                   i_userData1, i_userData2, i_userData3, i_userData4)

/**
 * @brief Add a procedure callout to an existing error log
 */
#define PRDF_HW_ADD_PROC_CALLOUT(i_procedure,   \
                                 i_priority,    \
                                 io_errl,       \
                                 i_severity)    \
  PRDF_ADD_PROCEDURE_CALLOUT(io_errl, i_priority, i_procedure)

/**
 * @brief Error log interface to add a HW callout to an existing error log.
 * @note  convert immediate deconfig to delayed deconfig in HB.
 */
#define PRDF_HW_ADD_CALLOUT(i_target, i_priority,         \
                            i_deconfigState,              \
                            io_errl, i_gardErrType,       \
                            i_severity, i_diag_need)      \
  io_errl->addHwCallout(i_target,                                    \
                        (const HWAS::callOutPriority)i_priority,     \
                        (i_deconfigState == HWAS::DECONFIG ?         \
                        HWAS::DELAYED_DECONFIG : i_deconfigState),   \
                        (const HWAS::GARD_ErrorType)i_gardErrType);  \
  (void)(i_diag_need)

/**
 * @brief Add clock callout
 */
#define PRDF_ADD_CLOCK_CALLOUT(io_errl, i_target, i_clockType, i_priority, \
                               i_deconfigState, i_gardErrType)             \
    io_errl->addClockCallout(i_target,                          \
                (PRDcalloutData::TYPE_PROCCLK == i_clockType) ? \
                 HWAS::OSCREFCLK_TYPE : HWAS::OSCPCICLK_TYPE,   \
                (const HWAS::callOutPriority)i_priority,        \
                (i_deconfigState == HWAS::DECONFIG ?            \
                   HWAS::DELAYED_DECONFIG : i_deconfigState),   \
                i_gardErrType);

/**
 * @brief Process's pending deconfig and GARD service actions
 *        and thencommits and deletes the error log.
 */
#define PRDF_HW_COMMIT_ERRL(io_errl, i_deferDeconfig, i_action) \
  PRDF_COMMIT_ERRL(io_errl, i_action);

/**
 * @brief  indicate whether an abort is active or not
 */
// no-op in Hostboot
#define PRDF_ABORTING(o_abort) \
  o_abort = false;

/**
 * @brief  set deconfigEnum based on reconfig loop
 */
#define PRDF_RECONFIG_LOOP(o_deconfigEnum) \
  o_deconfigEnum = HWAS::DELAYED_DECONFIG;

/**
 * @brief Interface to request a Hardware Unit dump collection
 */
// FIXME:RTC: 65609 will address this issue.
// need to implement in Hostboot
#define PRDF_HWUDUMP( i_errl, i_content, i_huid ) \
  SUCCESS

/**
 * @brief Interface to indicate errlog that hostboot need to do a
 *        soft terminate.
 */
#define PRDF_SET_TERM_STATE( i_errl ) \
  i_errl->setTermState( ERRORLOG::TERM_STATE_SOFT )

#endif // __prdfErrlUtil_H
OpenPOWER on IntegriCloud