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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/plat/prdfPlatServices_common.H $ */
/* */
/* 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 */
#ifndef PRDFPLATSERVICES_COMMON_H
#define PRDFPLATSERVICES_COMMON_H
/**
* @file prdfPlatServices_common.H
* @brief Wrapper code for external interfaces used by PRD.
*
* This file contains code that is strictly common between FSP and Hostboot. All
* platform specific code should be in the respective FSP only or Hostboot only
* files.
*
* Note that only the respective platform specific header files should include
* this header file.
*/
#include <prdfTargetServices.H> // must include all common targeting code
#include <prdfMemConst.H>
#include <prdfTimer.H>
#include <prdfParserEnums.H>
#include <prdfMemSymbol.H>
#include <prdfMemDqBitmap.H>
#include <plat_hwp_invoker.H>
#include <errlentry.H>
//------------------------------------------------------------------------------
namespace PRDF
{
class CenAddr;
enum DIMMS_PER_RANK : uint8_t;
template <DIMMS_PER_RANK T>
class MemDqBitmap;
class CenMark;
class CenRank;
class CenSymbol;
class ExtensibleChip;
struct STEP_CODE_DATA_STRUCT;
namespace PlatServices
{
//##############################################################################
//## System Level Utility functions
//##############################################################################
/**
* @brief Get a PRD timer value based on the current time.
* @param o_timer The returned Timer
*/
void getCurrentTime( Timer & o_timer );
/**
* @brief Sleep for given time (seconds plus milliseconds).
* @param i_seconds Sleep time in seconds.
* @param i_milliseconds Sleep time in milliseconds.
*/
void milliSleep( uint32_t i_seconds, uint32_t i_milliseconds );
/**
* @brief Check SMGR runtime state
* @return true if SMGR state is runtime, false in hostboot without checking
*/
bool atRuntime();
/**
* @brief Check if SMP is cohenerent ( Node stitching complete).
* @return true if SMP is coherent, false otherwise.
*/
bool isSmpCoherent();
/**
* @brief Initiate hwudump.
* @param i_target target handle.
* @param i_errl error handle
* @param i_errlActions error action flags
*/
/* TODO RTC 144705
void initiateUnitDump( TARGETING::TargetHandle_t i_target,
errlHndl_t i_errl,
uint32_t i_errlActions);
*/
/**
* @return True, if this system is using an FSP. False, otherwise (i.e. BMC
* based system or SP-less machine).
*/
bool isSpConfigFsp();
//##############################################################################
//## Processor specific functions
//##############################################################################
/**
* @brief capture SBE image failure Registers for FFDC
* @param i_procTarget Processor target
*/
/* TODO RTC 136050
void collectSBE_FFDC(TARGETING::TargetHandle_t i_procTarget);
*/
//##############################################################################
//## Lane Repair functions
//##############################################################################
/**
* @brief Calls HWP to read newly failed bus lanes
* @param i_rxBusTgt Target of the receiving end of the bus
* @param o_rxFailLanes Vector of failed lanes
* @param i_clkGrp Clock group
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t readErepairXbus(TARGETING::TargetHandle_t i_rxBusTgt,
std::vector<uint8_t> &o_rxFailLanes,
uint8_t i_clkGrp);
/**
* @brief Calls HWP to clear FIRs after a lane repair event
* @param i_rxBusTgt Target of the receiving end of the bus
* @param i_clkGrp Clock group
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t clearIOFirsXbus(TARGETING::TargetHandle_t i_rxBusTgt);
/**
* @brief Calls HWP to power down failed lanes
* @param i_rxBusTgt Target of the receiving end of the bus
* @param i_rxFailLanes Vector of rx failed lanes
* @param i_txFailLanes Vector of tx failed lanes
* @param i_clkGrp Clock group
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t powerDownLanesXbus(TARGETING::TargetHandle_t i_rxBusTgt,
const std::vector<uint8_t> &i_rxFailLanes,
const std::vector<uint8_t> &i_txFailLanes,
uint8_t i_clkGrp);
/**
* @brief Calls erepair accessor procedure get failed lanes from VPD
* @param i_rxBusTgt Target of the receiving end of the bus
* @param o_rxFailLanes Vector of rx failed lanes
* @param o_txFailLanes Vector of tx failed lanes
* @param i_clkGrp Clock group
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t getVpdFailedLanesXbus(TARGETING::TargetHandle_t i_rxBusTgt,
std::vector<uint8_t> &o_rxFailLanes,
std::vector<uint8_t> &o_txFailLanes,
uint8_t i_clkGrp);
/**
* @brief Calls erepair prcd to set failed lanes in vpd and check threshold
* @param i_rxBusTgt Target of the receiving end of the bus
* @param i_txBusTgt Target of the tranmitting end of the bus
* @param i_rxFailLanes Vector of rx failed lanes
* @param o_thrExceeded True if these failed lanes exceeded erepair threshold
* @param i_clkGrp Clock group
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t setVpdFailedLanesXbus(TARGETING::TargetHandle_t i_rxBusTgt,
TARGETING::TargetHandle_t i_txBusTgt,
std::vector<uint8_t> &i_rxFailLanes,
bool & o_thrExceeded,
uint8_t i_clkGrp);
//##############################################################################
//## Memory specific functions
//##############################################################################
/**
* @brief Reads the bad DQ bitmap attribute for both ports of the target rank.
* @param i_trgt A MCA/MBA target.
* @param i_rank Target rank.
* @param o_bitmap DQ bitmap container.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
template <DIMMS_PER_RANK T>
int32_t getBadDqBitmap( TARGETING::TargetHandle_t i_trgt,
const MemRank & i_rank, MemDqBitmap<T> & o_bitmap );
/**
* @brief Writes the bad DQ bitmap attribute for both ports of the target rank.
* @param i_trgt A MCA/MBA target.
* @param i_rank Target rank.
* @param i_bitmap DQ bitmap container.
* @note This is a no-op if DRAM Repairs are disabled in manufacturing.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
template <DIMMS_PER_RANK T>
int32_t setBadDqBitmap( TARGETING::TargetHandle_t i_trgt,
const MemRank & i_rank,
const MemDqBitmap<T> & i_bitmap );
/**
* @brief Invokes the get mark store hardware procedure.
* @param i_mba Target MBA.
* @param i_rank Target rank.
* @param o_mark The returned mark.
* @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 157888
int32_t mssGetMarkStore( TARGETING::TargetHandle_t i_mba,
const CenRank & i_rank, CenMark & o_mark );
*/
/**
* @brief Invokes the set mark store hardware procedure.
* @param i_mba Target MBA.
* @param i_rank Target rank.
* @param io_mark The mark to write. If hardware blocks the write
* to markstore and the block is allowed, io_mark
* will be updated with the new chip mark set by
* hardware.
* @param o_writeBlocked TRUE if a blocke write is allowed and hardware
* blocked the write to markstore.
* @param i_allowWriteBlocked TRUE if a blocked write is allowed. This means
* the user will need to read what hardware just
* placed in the markstore and retry. If FALSE and
* the write was blocked, this function will commit
* the FAPI error log and return a non-SUCCESS. The
* default value is FALSE.
* @note Both the chip mark and the symbol mark will be written at the same
* time, so do a RMW operation to avoid overwritting a previous mark.
* @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 157888
int32_t mssSetMarkStore( TARGETING::TargetHandle_t i_mba,
const CenRank & i_rank, CenMark & io_mark,
bool & o_writeBlocked,
bool i_allowWriteBlocked = false );
*/
/**
* @brief Invokes the get steer mux hardware procedure.
* @param i_mba Target MBA.
* @param i_rank Target rank.
* @param o_port0Spare A symbol associated with the spare on port 0.
* @param o_port1Spare A symbol associated with the spare on port 1.
* @param o_eccSpare A symbol associated with the ECC spare (x4 mode only).
* @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 157888
int32_t mssGetSteerMux( TARGETING::TargetHandle_t i_mba, const CenRank & i_rank,
CenSymbol & o_port0Spare, CenSymbol & o_port1Spare,
CenSymbol & o_eccSpare );
*/
/**
* @brief Invokes the set steer mux hardware procedure.
* @param i_mba Target MBA.
* @param i_rank Target rank.
* @param i_symbol A symbol associated with the DRAM to be spared.
* @param i_x4EccSpare If true, will set ECC spare instead (x4 mode only).
* @note The procedure will be able to derive the port from the given symbol.
* @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 157888
int32_t mssSetSteerMux( TARGETING::TargetHandle_t i_mba, const CenRank & i_rank,
const CenSymbol & i_symbol, bool i_x4EccSpare );
*/
/**
* @brief Returns the start and end maintenance address of the given MBA.
* @param i_mba Target MBA.
* @param o_startAddr The return start address.
* @param o_endAddr The return end address.
* @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 157888
int32_t getMemAddrRange( TARGETING::TargetHandle_t i_mba, CenAddr & o_startAddr,
CenAddr & o_endAddr );
*/
/**
* @brief Get spare DRAM information on a DIMM.
* @param i_mba MBA target.
* @param i_rank Rank.
* @param i_ps MBA port select.
* @param o_spareConfig Spare DRAM config information.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
* @note On a DIMM its possible that spare is not present. Also on X4 DRAM
* spare can be on High nibble or low nibble. This function will
* populate spare config information in o_spareConfig.
*/
/* TODO RTC 157888
int32_t getDimmSpareConfig( TARGETING::TargetHandle_t i_mba, CenRank i_rank,
uint8_t i_ps, uint8_t & o_spareConfig );
*/
/**
* @brief Returns the raw card type of a buffered DIMM.
* @param i_mbaTarget An MBA target. This MBA must be on a buffered DIMM.
* @param o_wiringType The DIMM's raw card type. Will return WIRING_INVALID if
* the raw card type currently is not supported.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
/* TODO RTC 169956
int32_t getMemBufRawCardType( TARGETING::TargetHandle_t i_mbaTarget,
CEN_SYMBOL::WiringType & o_wiringType );
*/
/**
* @brief get DIMM DQ map from FAPI routines
* @param i_target DIMM target
* @param io_dqMapPtr Pointer to area to receive DIMM DQ map (80 bytes)
* @return Non-Null if error log occurs
*/
void getDimmDqAttr( TARGETING::TargetHandle_t i_target,
uint8_t (&io_dqMapPtr)[DQS_PER_DIMM] );
//##############################################################################
//## Maintenance Command class wrapper
//##############################################################################
// TODO: RTC 157888
///**
// * @brief This is a wrapper class for underlying maintenance class object
// *
// * By this class, we will hide underlying maintenance class dependency
// * from rest of code. All public function mss_MaintCmd used by prd should
// * be defined here also.
// */
//class mss_MaintCmdWrapper
//{
// public: // data types
//
// /** Represents underlying maintenance command object type **/
// enum CmdType
// {
// TIMEBASE_SCRUB,
// TIMEBASE_STEER_CLEANUP,
// SUPERFAST_READ,
// };
//
// /** Input flags to control how, and on what, the command runs. **/
// enum CtrlFlags
// {
// /** Run all defaults. See each individual flag of default behavior */
// NO_FLAGS = 0x00,
//
// /** When set, the command will run from the beginning of the given rank
// * to the end of memory. Default is to run to the end of the rank. */
// END_OF_MEMORY = 0x01,
//
// /** When set, the command will run on the slave rank only. Default is to
// * run on the entire master rank. */
// SLAVE_RANK_ONLY = 0x04,
// };
//
// public: // functions
//
// /**
// * @brief Constructor
// *
// * @param i_maintCmd Underlying maintenance command object
// */
// mss_MaintCmdWrapper( mss_MaintCmd * i_maintCmd );
//
// /**
// * @brief Destructor
// */
// virtual ~mss_MaintCmdWrapper();
//
// /**
// * @brief Stops running maint cmd, and saves the address it stopped at.
// * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
// */
// int32_t stopCmd();
//
// /**
// * @brief Saves any settings that need to be restored when command is done.
// * Loads the setup parameters into the hardware. Starts the command,
// * then either polls for complete or exits with command running.
// * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
// */
// int32_t setupAndExecuteCmd();
//
// /**
// * @brief Called once a command is done if we need to restore settings that
// * had to be modified to run a specific command type, or clear error
// * data in the hw that is no longer relevant.
// * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
// */
// int32_t cleanupCmd();
//
// private: // instance variables
//
// // Underlying maintenance command object pointer
// mss_MaintCmd * iv_cmd;
//
//}; // class mss_MaintCmdWrapper
/**
* @brief Create a maintenance command object.
* @param i_cmdType Maintenance command type which we want to create.
* @param i_mba An MBA target.
* @param i_rank The first rank to start with (see enum CtrlFlags for
* more details).
* @param i_stopCond Bit mask for conditions in which to stop command.
* @param i_cmdSpeed See enum mss_MaintCmd::TimeBaseSpeed for details.
* @param i_flags See enum CtrlFlags for details.
* @param i_sAddrOverride A non-NULL value indicates to use this start address
* and not the start address of i_rank.
* @return A mss_MaintCmdWrapper object, NULL if an internal function failed.
* @note This function allocates memory on heap for mss_MaintCmdWrapper
* object. It is the caller's responsibilty to delete this object.
* @note By default this maintenance command will operate on the address range
* that contains i_rank, but the target address range can be modified
* with i_flags and/or i_sAddrOverride.
*/
/* TODO RTC 157888
mss_MaintCmdWrapper * createMssCmd( mss_MaintCmdWrapper::CmdType i_cmdType,
TARGETING::TargetHandle_t i_mba,
const CenRank & i_rank, uint32_t i_stopCond,
mss_MaintCmd::TimeBaseSpeed i_cmdSpeed
= mss_MaintCmd::FAST_MAX_BW_IMPACT,
uint32_t i_flags = mss_MaintCmdWrapper::NO_FLAGS,
const CenAddr * i_sAddrOverride = NULL );
*/
/**
* @brief Create an IncrementAddress maintenance command object.
* @param i_mba An MBA target.
* @return A mss_MaintCmdWrapper object, NULL if an internal function failed.
* @note This function allocates memory on heap for mss_MaintCmdWrapper
* object. It is the caller's responsibilty to delete this object.
*/
/* TODO RTC 157888
mss_MaintCmdWrapper * createIncAddrMssCmd( TARGETING::TargetHandle_t i_mba );
*/
//##############################################################################
//## util functions
//##############################################################################
/**
* @brief get cfam data
* @param i_chip Extensible chip
* @param i_addr address
* @param o_data returned data
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
int32_t getCfam( ExtensibleChip * i_chip,
const uint32_t i_addr,
uint32_t & o_data);
/**
* @brief get sysref clk target for the given proc target.
* @param i_procTarget proc target.
* @param i_peerType Type of peer clock source
* @param i_oscPos OSC position (0 or 1)
* @return Handle_t of systemref clock target.
*/
TARGETING::TargetHandle_t getActiveRefClk(
TARGETING::TargetHandle_t i_procTarget,
TARGETING::TYPE i_connType,
uint32_t i_oscPos);
/**
* @brief Add callouts and FFDC for Deadman timer
* @param i_target target for processor chip
* @param io_sc service data structure
* @return Nothing.
*/
void deadmanTimerFFDC( TARGETING::TargetHandle_t i_target,
STEP_CODE_DATA_STRUCT & io_sc );
} // end namespace PlatServices
} // end namespace PRDF
#endif // PRDFPLATSERVICES_COMMON_H
|