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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/htmgt/htmgt.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2015 */
/* [+] 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 */
#include <htmgt/htmgt.H>
#include <htmgt/htmgt_reasoncodes.H>
#include "htmgt_activate.H"
#include "htmgt_cfgdata.H"
#include "htmgt_utility.H"
#ifndef __HOSTBOOT_RUNTIME
#include "genPstate.H"
#endif
#include "htmgt_memthrottles.H"
#include "htmgt_poll.H"
#include <devicefw/userif.H>
#include <config.h>
#include <console/consoleif.H>
// Targeting support
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
#include <targeting/common/attributes.H>
#include <targeting/common/targetservice.H>
// HBOCC support
#include <hwpf/hwp/occ/occ_common.H>
#include <sys/time.h>
namespace HTMGT
{
// Move the OCCs to active state or log unrecoverable error and
// stay in safe mode
void processOccStartStatus(const bool i_startCompleted,
TARGETING::Target * i_failedOccTarget)
{
errlHndl_t l_err = NULL;
uint32_t l_huid = 0;
if (i_failedOccTarget)
{
l_huid = TARGETING::get_huid(i_failedOccTarget);
}
TMGT_INF("processOccStartStatus(Start Success=%c, failedOcc=0x%08X)",
i_startCompleted?'y':'n', l_huid);
if (i_startCompleted)
{
// Query functional OCCs
const uint8_t numOccs = OccManager::buildOccs();
if (numOccs > 0)
{
if (NULL != OccManager::getMasterOcc())
{
do
{
#ifndef __HOSTBOOT_RUNTIME
// Build pstate tables (once per IPL)
l_err = genPstateTables();
if(l_err)
{
break;
}
// Calc memory throttles (once per IPL)
calcMemThrottles();
#endif
// Make sure OCCs are ready for communication
OccManager::waitForOccCheckpoint();
#ifdef __HOSTBOOT_RUNTIME
// TODO RTC 124738 Final solution TBD
// Perhapse POLL scom 0x6a214 until bit 31 is set?
nanosleep(1,0);
#endif
// Send poll to establish comm
TMGT_INF("Send initial poll to all OCCs to"
" establish comm");
l_err = OccManager::sendOccPoll();
if (l_err)
{
// Continue even if failed (poll will be retried)
ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
}
// Send ALL config data
sendOccConfigData();
// Set the User PCAP
l_err = sendOccUserPowerCap();
if (l_err)
{
break;
}
// Wait for all OCCs to go to the target state
l_err = waitForOccState();
if ( l_err )
{
break;
}
// Set active sensors for all OCCs,
// so BMC can start communication with OCCs
l_err = setOccActiveSensors(true);
if (l_err)
{
// Continue even if failed to update sensor
ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
}
} while(0);
}
else
{
TMGT_ERR("Unable to find any Master capable OCCs");
/*@
* @errortype
* @reasoncode HTMGT_RC_OCC_MASTER_NOT_FOUND
* @moduleid HTMGT_MOD_LOAD_START_STATUS
* @userdata1[0:7] number of OCCs
* @devdesc No OCC master was found
*/
bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
HTMGT_RC_OCC_MASTER_NOT_FOUND,
numOccs, 0, 0, 0,
ERRORLOG::ERRL_SEV_INFORMATIONAL);
}
}
else
{
TMGT_ERR("Unable to find any functional OCCs");
/*@
* @errortype
* @reasoncode HTMGT_RC_OCC_UNAVAILABLE
* @moduleid HTMGT_MOD_LOAD_START_STATUS
* @userdata1[0:7] load/start completed
* @devdesc No functional OCCs were found
*/
bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
HTMGT_RC_OCC_UNAVAILABLE,
i_startCompleted, 0, 0, 0,
ERRORLOG::ERRL_SEV_INFORMATIONAL);
}
}
else
{
TMGT_ERR("All OCCs were not loaded/started successfully");
/*@
* @errortype
* @reasoncode HTMGT_RC_OCC_START_FAIL
* @moduleid HTMGT_MOD_LOAD_START_STATUS
* @userdata1 Failing OCC HUID
* @devdesc OCCs were not loaded/started successfully
*/
bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
HTMGT_RC_OCC_START_FAIL,
l_huid, 0, 0, 0,
ERRORLOG::ERRL_SEV_INFORMATIONAL);
}
if (NULL != l_err)
{
TMGT_ERR("OCCs not all active. System will stay in safe mode");
TMGT_CONSOLE("OCCs are not active (rc=0x%04X). "
"System will remain in safe mode",
l_err->reasonCode());
TMGT_INF("Calling HBOCC::stopAllOCCs");
errlHndl_t err2 = HBOCC::stopAllOCCs();
if(err2)
{
TMGT_ERR("stopAllOCCs() failed with 0x%04X",
err2->reasonCode());
ERRORLOG::errlCommit(err2, HTMGT_COMP_ID);
}
// Update error log to unrecoverable and set SRC
// to indicate the system will remain in safe mode
/*@
* @errortype
* @reasoncode HTMGT_RC_OCC_CRIT_FAILURE
* @moduleid HTMGT_MOD_LOAD_START_STATUS
* @userdata1[0:7] load/start completed
* @devdesc OCCs did not all reach active state,
* system will be in Safe Mode
*/
bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
HTMGT_RC_OCC_CRIT_FAILURE,
i_startCompleted, 0, 0, 1,
ERRORLOG::ERRL_SEV_UNRECOVERABLE);
// Add level 2 support callout
l_err->addProcedureCallout(HWAS::EPUB_PRC_LVL_SUPP,
HWAS::SRCI_PRIORITY_MED);
// Add HB firmware callout
l_err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
HWAS::SRCI_PRIORITY_MED);
ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
}
} // end processOccStartStatus()
// Notify HTMGT that an OCC has an error to report
void processOccError(TARGETING::Target * i_procTarget)
{
bool polledOneOcc = false;
OccManager::buildOccs();
if (i_procTarget != NULL)
{
const uint32_t l_huid =
i_procTarget->getAttr<TARGETING::ATTR_HUID>();
TMGT_INF("processOccError(HUID=0x%08X) called", l_huid);
TARGETING::TargetHandleList pOccs;
getChildChiplets(pOccs, i_procTarget, TARGETING::TYPE_OCC);
if (pOccs.size() > 0)
{
// Poll specified OCC flushing any errors
errlHndl_t err = OccManager::sendOccPoll(true, pOccs[0]);
if (err)
{
ERRORLOG::errlCommit(err, HTMGT_COMP_ID);
}
polledOneOcc = true;
}
}
if ((OccManager::getNumOccs() > 1) || (false == polledOneOcc))
{
// Send POLL command to all OCCs to flush any other errors
errlHndl_t err = OccManager::sendOccPoll(true);
if (err)
{
ERRORLOG::errlCommit(err, HTMGT_COMP_ID);
}
}
if (OccManager::occNeedsReset())
{
TMGT_ERR("processOccError(): OCCs need to be reset");
// Don't pass failed target as OCC should have already
// been marked as failed during the poll.
errlHndl_t err = OccManager::resetOccs(NULL);
if(err)
{
ERRORLOG::errlCommit(err, HTMGT_COMP_ID);
}
}
} // end processOccError()
// Notify HTMGT that an OCC has failed and needs to be reset
void processOccReset(TARGETING::Target * i_proc)
{
errlHndl_t errl = NULL;
TARGETING::Target * failedOccTarget = NULL;
TARGETING::Target* sys = NULL;
TARGETING::targetService().getTopLevelTarget(sys);
uint8_t safeMode = 0;
// If the system is in safemode then ignore request to reset OCCs
if(sys &&
sys->tryGetAttr<TARGETING::ATTR_HTMGT_SAFEMODE>(safeMode) &&
safeMode)
{
return;
}
// Get functional OCC (one per proc)
TARGETING::TargetHandleList pOccs;
getChildChiplets(pOccs, i_proc, TARGETING::TYPE_OCC);
if (pOccs.size() > 0)
{
failedOccTarget = pOccs[0];
}
if(NULL != failedOccTarget)
{
uint32_t huid = failedOccTarget->getAttr<TARGETING::ATTR_HUID>();
TMGT_INF("processOccReset(HUID=0x%08X) called", huid);
}
else
{
uint32_t huid = i_proc->getAttr<TARGETING::ATTR_HUID>();
TMGT_INF("processOccReset: Invalid OCC target (proc huid=0x08X)"
"resetting OCCs anyway",
huid);
/*@
* @errortype
* @reasoncode HTMGT_RC_INVALID_PARAMETER
* @moduleid HTMGT_MOD_PROCESS_OCC_RESET
* @userdata1[0:7] Processor HUID
* @devdesc No OCC target found for proc Target,
*/
bldErrLog(errl,
HTMGT_MOD_PROCESS_OCC_RESET,
HTMGT_RC_INVALID_PARAMETER,
huid, 0, 0, 1,
ERRORLOG::ERRL_SEV_INFORMATIONAL);
// Add HB firmware callout
errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
HWAS::SRCI_PRIORITY_MED);
ERRORLOG::errlCommit(errl, HTMGT_COMP_ID); // sets errl to NULL
}
errl = OccManager::resetOccs(failedOccTarget);
if(errl)
{
ERRORLOG::errlCommit(errl, HTMGT_COMP_ID); // sets errl to NULL
}
} // end processOccReset()
// Set the OCC state
errlHndl_t enableOccActuation(bool i_occActivation)
{
occStateId targetState = OCC_STATE_ACTIVE;
if (false == i_occActivation)
{
targetState = OCC_STATE_OBSERVATION;
}
// Set state for all OCCs
errlHndl_t l_err = OccManager::setOccState(targetState);
if (NULL == l_err)
{
TMGT_INF("enableOccActuation: OCC states updated to 0x%02X",
targetState);
}
if (OccManager::occNeedsReset())
{
TMGT_ERR("enableOccActuation(): OCCs need to be reset");
// Don't pass failed target as OCC should have already
// been marked as failed during the poll.
errlHndl_t err2 = OccManager::resetOccs(NULL);
if(err2)
{
ERRORLOG::errlCommit(err2, HTMGT_COMP_ID);
}
}
return l_err;
} // end enableOccActuation()
}
|