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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] 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 <prdfMemEccAnalysis.H>
// Platform includes
#include <prdfMemAddress.H>
#include <prdfMemCaptureData.H>
#include <prdfP9McaDataBundle.H>
using namespace TARGETING;
namespace PRDF
{
using namespace PlatServices;
namespace MemEcc
{
//------------------------------------------------------------------------------
template<>
void calloutMemUe<TYPE_MCA>( ExtensibleChip * i_chip, const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[MemEcc::calloutMemUe] "
PRDF_ASSERT( TYPE_MCA == i_chip->getType() );
SCAN_COMM_REGISTER_CLASS * fir = i_chip->getRegister( "DDRPHYFIR" );
int32_t l_rc = fir->Read();
if ( SUCCESS != l_rc )
{
PRDF_ERR( PRDF_FUNC "Read() failed on DDRPHYFIR: i_chip=0x%08x",
i_chip->getHuid() );
}
// Check DDRPHYFIR[54:55,57:59] to determine if this UE is a side-effect.
if ( SUCCESS == l_rc && (0 != (fir->GetBitFieldJustified(54,6) & 0x37)) )
{
// Callout the MCA.
io_sc.service_data->SetCallout( i_chip->getTrgt() );
}
else
{
// Callout the rank anyway.
MemoryMru memmru ( i_chip->getTrgt(), i_rank,
MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
}
#undef PRDF_FUNC
}
template<>
void calloutMemUe<TYPE_MBA>( ExtensibleChip * i_chip, const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc )
{
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
MemoryMru memmru ( i_chip->getTrgt(), i_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
}
//------------------------------------------------------------------------------
#ifdef __HOSTBOOT_MODULE
template<>
uint32_t addVcmEvent<TYPE_MCA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
const MemMark & i_mark,
STEP_CODE_DATA_STRUCT & io_sc )
{
PRDF_ASSERT( TYPE_MCA == i_chip->getType() );
ExtensibleChip * mcbChip = getConnectedParent( i_chip, TYPE_MCBIST );
McbistDataBundle * mcbdb = getMcbistDataBundle( mcbChip );
TdEntry * entry = new VcmEvent<TYPE_MCA>( i_chip, i_rank, i_mark );
return mcbdb->getTdCtlr()->handleTdEvent( io_sc, entry );
}
/* TODO: RTC 144083
template<>
uint32_t addVcmEvent<TYPE_MBA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
const MemMark & i_mark,
STEP_CODE_DATA_STRUCT & io_sc )
{
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
CenMbaDataBundle * mbadb = getMbaDataBundle( i_chip );
TdEntry * entry = new VcmEvent<TYPE_MBA>( i_chip, i_rank, i_mark );
return mbadb->getTdCtlr()->handleTdEvent( io_sc, entry );
}
*/
#endif
//------------------------------------------------------------------------------
#ifdef __HOSTBOOT_MODULE
template<>
uint32_t addTpsEvent<TYPE_MCA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc, bool i_banTps )
{
PRDF_ASSERT( TYPE_MCA == i_chip->getType() );
ExtensibleChip * mcbChip = getConnectedParent( i_chip, TYPE_MCBIST );
PRDF_ASSERT( nullptr != mcbChip ); // definitely a bug
McbistDataBundle * mcbdb = getMcbistDataBundle( mcbChip );
TdEntry * entry = new TpsEvent<TYPE_MCA>( i_chip, i_rank, i_banTps );
return mcbdb->getTdCtlr()->handleTdEvent( io_sc, entry );
}
/* TODO: RTC 144083
template<>
uint32_t addTpsEvent<TYPE_MBA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc, bool i_banTps )
{
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
CenMbaDataBundle * mbadb = getMbaDataBundle( i_chip );
TdEntry * entry = new TpsEvent<TYPE_MBA>( i_chip, i_rank, i_banTps );
return mbadb->getTdCtlr()->handleTdEvent( io_sc, entry );
}
*/
#endif
//------------------------------------------------------------------------------
template<TARGETING::TYPE T, typename D>
uint32_t analyzeFetchMpe( ExtensibleChip * i_chip, const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[MemEcc::analyzeFetchMpe] "
PRDF_ASSERT( T == i_chip->getType() );
uint32_t o_rc = SUCCESS;
#ifndef __HOSTBOOT_RUNTIME // IPL
PRDF_ERR( PRDF_FUNC "Mainline MPE attns should be masked during IPL" );
PRDF_ASSERT(false); // HWP bug.
#else // runtime
do
{
// Get the address of the failure.
MemAddr addr;
o_rc = getMemReadAddr<T>( i_chip, MemAddr::READ_MPE_ADDR, addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemReadAddr(0x%08x, READ_MPE_ADDR) failed",
i_chip->getHuid() );
break;
}
// There is only one address register and it will contain the latest
// chip mark placed. So it is possible this address will be out of sync
// with the rank that reported the attention. In this case, we will
// simply fake an address with the correct rank and move on.
if ( i_rank != addr.getRank() )
{
addr = MemAddr ( i_rank, 0, 0, 0 );
}
// Add address to UE table.
D db = static_cast<D>(i_chip->getDataBundle());
db->iv_ueTable.addEntry( UE_TABLE::FETCH_MPE, addr );
// Read the chip mark from markstore.
MemMark chipMark;
o_rc = MarkStore::readChipMark<T>( i_chip, i_rank, chipMark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "readChipMark<T>(0x%08x,%d) failed",
i_chip->getHuid(), i_rank.getMaster() );
break;
}
// If the chip mark is not valid, then somehow the chip mark was placed
// on a rank other than the rank with the attention. This would most
// likely be a code bug.
PRDF_ASSERT( chipMark.isValid() );
// Add the mark to the callout list.
MemoryMru mm { i_chip->getTrgt(), i_rank, chipMark.getSymbol() };
io_sc.service_data->SetCallout( mm );
// Add a VCM request to the TD queue.
o_rc = addVcmEvent<T>( i_chip, i_rank, chipMark, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "addVcmEvent() failed: i_chip=0x%08x "
"i_rank=%d,%d", i_chip->getHuid(), i_rank.getMaster(),
i_rank.getSlave() );
break;
}
} while (0);
// Add ECC capture data for FFDC.
MemCaptureData::addEccData<T>( i_chip, io_sc );
#endif // __HOSTBOOT_RUNTIME
return o_rc;
#undef PRDF_FUNC
}
// To resolve template linker errors.
template
uint32_t analyzeFetchMpe<TYPE_MCA, McaDataBundle *>( ExtensibleChip * i_chip,
const MemRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc );
//------------------------------------------------------------------------------
template<TARGETING::TYPE T, typename D>
uint32_t analyzeFetchUe( ExtensibleChip * i_chip,
STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[MemEcc::analyzeFetchUe] "
PRDF_ASSERT( T == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// All memory UEs should be customer viewable. Normally, this would be done
// by setting the threshold to 1, but we do not want to mask UEs on the
// first occurrence.
io_sc.service_data->setServiceCall();
do
{
// Get the address of the failure.
MemAddr addr;
o_rc = getMemReadAddr<T>( i_chip, MemAddr::READ_UE_ADDR, addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemReadAddr(0x%08x, READ_UE_ADDR) failed",
i_chip->getHuid() );
break;
}
// Add address to UE table.
D db = static_cast<D>(i_chip->getDataBundle());
db->iv_ueTable.addEntry( UE_TABLE::FETCH_UE, addr );
// Make the hardware callout.
MemRank rank = addr.getRank();
calloutMemUe<T>( i_chip, rank, io_sc );
#ifdef __HOSTBOOT_RUNTIME
// Add a TPS request to the TD queue and ban any further TPS requests
// for this rank.
o_rc = addTpsEvent<T>( i_chip, rank, io_sc, true );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "addTpsEvent() failed: i_chip=0x%08x "
"rank=%d,%d", i_chip->getHuid(), rank.getMaster(),
rank.getSlave() );
// NOTE: We are not adding a break here because we still want to do
// dynamic memory deallocation of the rank. Any code added
// after this will need to handled return codes judiciously.
}
/* TODO RTC 136129
// Dynamically deallocation the rank.
uint32_t dealloc_rc = MemDealloc::rank<T>( i_chip, rank );
if ( SUCCESS != dealloc_rc )
{
PRDF_ERR( PRDF_FUNC "MemDealloc::rank() failed: i_chip=0x%08x "
"rank=m%ds%d", i_chip->getHuid(), rank.getMaster(),
rank.getSlave() );
o_rc = dealloc_rc; break;
}
*/
#endif // __HOSTBOOT_RUNTIME
} while (0);
// Add ECC capture data for FFDC.
MemCaptureData::addEccData<T>( i_chip, io_sc );
return o_rc;
#undef PRDF_FUNC
}
// To resolve template linker errors.
template
uint32_t analyzeFetchUe<TYPE_MCA, McaDataBundle *>( ExtensibleChip * i_chip,
STEP_CODE_DATA_STRUCT & io_sc );
//------------------------------------------------------------------------------
} // end namespace MemEcc
} // end namespace PRDF
|