summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/service/prdfPlatServices.H
blob: ee650f7e24fcc278ff02af5692e6afdda490c4b5 (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
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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/service/prdfPlatServices.H $ */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2013              */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef PRDFPLATSERVICES_H
#define PRDFPLATSERVICES_H

/**
 * @file  prdfPlatServices.H
 * @brief Wrapper code for things PRD needs from external components ( other then targetting ).
 */

//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------

#include <algorithm>

#include <iipconst.h>
#include <prdfTargetServices.H>
#include <prdfTimer.H>

#include <errlentry.H>
#include <dimmConsts.H>

#ifdef __HOSTBOOT_MODULE
  #include <dram_initialization/mss_memdiag/mss_maint_cmds.H>
#else
  #include <hdctContent.H>
#endif

//------------------------------------------------------------------------------

namespace PRDF
{

namespace PlatServices
{

//##############################################################################
//##
//##                        Hostboot and FSP functions
//##
//##############################################################################

//##############################################################################
//##                     System Level Utility Functions
//##############################################################################

//FIXME functions defintion not found.Should we remove it?
//void enterCCMMode();
//bool inCMMode();
//bool isCM_FUNCTIONAL(TARGETING::TargetHandle_t);

/**
 * @brief   Returns if role is mater fsp.
 * @param   None.
 * @return  TRUE if master fsp. FALSE if not master fsp.
 * @pre     None.
 * @post    None.
 */
bool isMasterFSP();

/**
 * @brief   Checks if we are currently doing a memory preserving IPL.
 * @param   None.
 * @return  TRUE if this is a memory preserving IPL, FALSE otherwise.
 * @pre     None.
 * @post    None.
 */
bool isMemoryPreservingIpl();

/**
 * @brief   Return ecidString for a given target
 * @param   i_pGivenTarget  handle to target
 * @param   o_ecidStr       buffer for ecidstring
 * @return  Returns ecidString for given target Handle
 * @pre     none
 * @post    none
 */
void getECIDString( TARGETING::TargetHandle_t i_pGivenHandle, const char *o_ecidStr );

/**
 * @brief Get a PRD timer value based on the current time.
 * @param o_timer The returned Timer
 */
void getCurrentTime( Timer & o_timer );

/**
 * @brief   synch the file with rmgr
 * @param   i_fileName file name
 * @return  NULL if synch is unsuccessfull, error handle otherwise
 */
errlHndl_t syncFile( const char* i_fileName );

//##############################################################################
//##                        Memory specific functions
//##############################################################################

/**
 * @brief   Returns the memory buffer raw card type (i.e. R/C A).
 * @param   i_memTarget A memory buffer, MBA, or DIMM.
 * @return
 */
/* TODO - See .C
getMembufRawCardType( TARGETING::TargetHandle_t i_memTarget );
*/

/**
 * @brief   Returns the type of the card the DIMM is plugged into.
 * @param   i_dimmTarget A DIMM target.
 * @return
 */

/* TODO - See .C
getDimmPlugCardType( TARGETING::TargetHandle_t i_dimmTarget );
*/

/**
 * @brief   Writes the bad DQ bitmap attribute.
 * @param   i_mbaTarget A MBA target.
 * @param   i_portSlct  Port select (0-1).
 * @param   i_dimmSlct  DIMM select (0-1).
 * @param   i_rankSlct  Rank select (0-3).
 * @param   i_data      The input data array.
 * @return  Non-SUCCESS if an internal function fails, SUCCESS otherwise.
 */
/* TODO - See .C
int32_t setBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget
                        const uint8_t i_portSlct,
                        const uint8_t i_dimmSlct,
                        const uint8_t i_rankSlct,
                        const uint8_t (&i_data)[DIMM_DQ_RANK_BITMAP_SIZE] );
*/

//##############################################################################
//##
//##                        Hostboot only functions
//##
//##############################################################################

#ifdef __HOSTBOOT_MODULE

/**
 * @brief  Checks if we are running in MDIA mode.
 * @return TRUE if in MDIA mode, FALSE otherwise.
 */
bool isInMdiaMode();

/**
 * @brief  Sends a command complete message to MDIA.
 * @param  i_mbaTarget An MBA target.
 * @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
 */
int32_t mdiaSendCmdComplete( TARGETING::TargetHandle_t i_mbaTarget );

/**
 * @brief  Invokes the get mark store hardware procedure.
 * @param  i_mbaTarget
 * @param  i_rank
 * @param  o_chipMark
 * @param  o_symbolMark
 * @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
 */
int32_t mssGetMarkStore(
        TARGETING::TargetHandle_t i_mbaTarget,
        uint8_t i_rank,
        uint8_t & o_chipMark,
        uint8_t & o_symbolMark);

/**
 * @brief  Invokes the get steer mux hardware procedure.
 * @param  i_mbaTarget
 * @param  i_rank
 * @param  i_muxType Read/Write Mux select
 * @param  o_portZeroSpare
 * @param  o_portOneSpare
 * @param  o_eccSpare
 * @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
 */
int32_t mssGetSteerMux(
        TARGETING::TargetHandle_t i_mbaTarget,
        uint8_t i_rank,
        mss_SteerMux::muxType i_muxType,
        uint8_t & o_portZeroSpare,
        uint8_t & o_portOneSpare,
        uint8_t & o_eccSpare);

/**
 * @brief  Invokes the restore DRAM repairs hardware procedure.
 * @param  i_mbaTarget
 * @param  o_repairedRankMask An encoded bitmask of repaired ranks.
 * @param  o_badDimm An encoded bitmask of bad DIMMs.
 * @return Non-SUCCESS in internal function fails, SUCCESS otherwise.
 */
int32_t mssRestoreDramRepairs(
        TARGETING::TargetHandle_t i_mbaTarget,
        uint8_t & o_repairedRankMask,
        uint8_t & o_badDimmMask);

/**
 * @brief   Reads the bad DQ bitmap attribute.
 * @param   i_mbaTarget A MBA target.
 * @param   i_portSlct  Port select (0-1).
 * @param   i_dimmSlct  DIMM select (0-1).
 * @param   i_rankSlct  Rank select (0-3).
 * @param   o_data      The return data array.
 * @return  Non-SUCCESS if an internal function fails, SUCCESS otherwise.
 */
// FIXME: Eventually needs to be supported in FSP code as well.
int32_t getBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget,
                        const uint8_t i_portSlct,
                        const uint8_t i_dimmSlct,
                        const uint8_t i_rankSlct,
                        uint8_t (&o_data)[DIMM_DQ_RANK_BITMAP_SIZE] );

#endif // __HOSTBOOT_MODULE

//##############################################################################
//##
//##                           FSP only functions
//##
//##############################################################################

#ifndef __HOSTBOOT_MODULE

/**
 * @brief  Do a runtime deconfiguration of the given target.
 * @param  i_target The target to deconfigure.
 * @return NULL if deconfig is successful, non-NULL otherwise.
 */
errlHndl_t runtimeDeconfig( TARGETING::TargetHandle_t i_target );


/**
 * @brief  Interface for HWSV (PRD) to request a local dump of a hardware target.
 * @param[in] i_Content Content to collect
 * @param[in] i_ClientId Component ID requesting the hardware unit dump
 * @param[in] i_ErrorLogId Platform Log ID, PLID, received from the failure
 * @param[in] i_Src Primary SRC of reason error log
 * @param[in] i_FailingHomUnitId Failing target to dump
*/
errlHndl_t dumpHWURequest( hwTableContent i_Content,
                           comp_id_t i_ClientId,
                           uint32_t i_ErrorLogId,
                           SrciSrc &i_Src,
                           TARGETING::HUID_ATTR i_FailingHomUnitId );

/**
 * @brief determine whether a checkstop is eligible for
 *        Memory Preserving IPL
 *
 * @param i_procTarget A PROC target
 * @param o_mpiplMode true for MPIPL and false for no MPIPL
 *
 * @return non-SUCCESS for failure, SUCCESS otherwise
*/

int32_t checkMpiplEligibility(TARGETING::TargetHandle_t i_procTarget,
                              bool & o_mpiplEligible);

#endif // not __HOSTBOOT_MODULE

} // end namespace PlatServices

} // end namespace PRDF

#endif // PRDFPLATSERVICES_H

OpenPOWER on IntegriCloud