summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/plat/prdfPlatServices_rt.H
blob: 49d4c0a7342cd2c3a5f9ed2ba3fd20217ce13d1f (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/plat/prdfPlatServices_rt.H $                */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2019                        */
/* [+] 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_rt_H
#define __prdfPlatServices_rt_H

#include <p9_l3err_extract.H>
#include <p9_l2err_extract.H>
#include <p9_pm_callout.H>
#include <prdfMemAddress.H>

namespace PRDF
{

namespace PlatServices
{

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

/**
 * @brief Sends a page gard request to the hypervisor.
 * @param i_addr Any address in the target page.
 */
void sendPageGardRequest( uint64_t i_addr );

/**
 * @brief Sends a dynamic memory deallocation message to the hypervisor. This
 *        message is intended for memory UEs, channel/port failures, etc.
 * @param i_saddr The first address in the range.
 * @param i_eaddr The last address in the range.
 */
void sendDynMemDeallocRequest( uint64_t i_saddr, uint64_t i_eaddr );

/**
 * @brief Sends a predictive dynamic memory deallocation message to the
 *        hypervisor. This message is intended to be send whenever there is a
 *        predictive callout of any part in the memory subsystem.
 * @param i_saddr The first address in the range.
 * @param i_eaddr The last address in the range.
 */
void sendPredDeallocRequest( uint64_t i_saddr, uint64_t i_eaddr );

//##############################################################################
//##                  Nimbus/Centaur Maintenance Command wrappers
//##############################################################################

/**
 * @brief  Stops Background Scrubbing.
 * @param  i_chip MCBIST, MCA, MBA, or OCMB chip.
 * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
 */
template<TARGETING::TYPE T>
uint32_t stopBgScrub( ExtensibleChip * i_chip );

/**
 * @brief  Resumes background scrubbing after it has paused on error.
 *
 * There are use cases where we want background scrubbing to pause on error in
 * order to collect FFDC (specifically address information), in which case we
 * will not start a Targeted Diagnostics procedure. Instead, this command will
 * resume the background scrubbing procedure already set up in hardware,
 * starting on the next configured address.
 *
 * @note This function should only be called after pausing background scrubbing
 *       due to an error. It should not be called after executing a Targeted
 *       Diagnotics procedure.
 *
 * @param  i_chip MCBIST, MCA, MBA, or OCMB chip.
 * @param  io_sc  The step code data struct.
 * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
 */
template<TARGETING::TYPE T>
uint32_t resumeBgScrub( ExtensibleChip * i_chip,
                        STEP_CODE_DATA_STRUCT & io_sc );

/**
 * @brief  Resumes TD scrubbing after it has paused on error.
 * @param  i_chip      MBA chip.
 * @param  i_rangeType See enum AddrRangeType.
 * @param  i_stopCond  The stop conditions for the targeted scrub.
 * @param  i_incRow    True if we need to increment to the next row instead of
 *                     the next address.
 * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
 */
template<TARGETING::TYPE T, typename SCT>
uint32_t resumeTdScrub( ExtensibleChip * i_chip, AddrRangeType i_rangeType,
                        SCT i_stopCond, bool i_incRow = false );

//##############################################################################
//##                       Line delete functions
//##############################################################################

/**
 * @brief Extracts address of an error from L3 Trace arrays
 * @param i_exTgt EX target
 * @param o_errorAddr struct containing address of the CE
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t extractL3Err( TARGETING::TargetHandle_t i_exTgt,
                      p9_l3err_extract_err_data &o_errorAddr);

/**
 * @brief Calls HWP to execute a line delete. Saves Line delete command in
          HCODE image.
 * @param i_exTgt EX target
 * @param i_errorAddr struct containing address of the CE
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t l3LineDelete(TARGETING::TargetHandle_t i_exTgt,
                     const p9_l3err_extract_err_data& i_l3_err_data);

/**
 * @brief Extracts address of an error from L2 Trace arrays
 * @param i_exTgt EX target
 * @param i_ce Type of error we're looking for: CE or UE
 * @param o_errorAddr struct containing address of the CE
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t extractL2Err( TARGETING::TargetHandle_t i_exTgt, bool i_ce,
                      p9_l2err_extract_err_data &o_errorAddr);

/**
 * @brief Calls HWP to execute a line delete. Saves Line delete command in
          HCODE image.
 * @param i_exTgt EX target
 * @param i_errorAddr struct containing address of the CE
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t l2LineDelete(TARGETING::TargetHandle_t i_exTgt,
                     const p9_l2err_extract_err_data& i_l2_err_data);


/**
 * @brief Calls p9_pm_callout HWP to collect FFDC and determine appropriate
 *        callouts for a STOP recovery malfunction alert.
 * @param i_tgt P9 chip target
 * @param o_ra enum indicating which type of callout should be made
 * @param o_deadCores bit vector of dead cores
 * @param o_ffdcList points to a list of STOP FFDC summary sub-sections
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t pmCallout( TARGETING::TargetHandle_t i_tgt,
                   RasAction& o_ra,
                   uint32_t &o_deadCores,
                   std::vector < StopErrLogSectn >& o_ffdcList );


/**
 * @brief   Requests HWSV to create a new back up topology due to TOD errors
 * @param   i_oscPos        Position of failing OSC. 0xFFFFFFFF if not used.
 * @param   i_procOscTgt    Proc chip target associated with failing OSC
 * @param   i_badChipList   list of bad chips to be avoided for MDMT
 * @param   i_informPhyp    Inform PHYP to disable back up topology.
 */
void requestNewTODTopology( uint32_t i_oscPos,
                            const TARGETING::TargetHandle_t& i_procOscTgt,
                            const TARGETING::TargetHandleList& i_badChipList,
                            bool i_informPhyp);

/**
 * @brief   Retrieves a saved version of a TOD config register from HWSV.
 *          We use the saved value rather than the live version because this
 *          could have changed in response to the TOD fault we're currently
 *          analyzing.
 * @param   i_procTgt  Proc chip target
 * @param   i_slvPath0 Whether we need the register for slave path 0 or 1
 * @param   o_regValue Returns contents of the register
 * @return non-SUCCESS for failure, SUCCESS otherwise
 */
int32_t getTodPortControlReg ( const TARGETING::TargetHandle_t& i_procTgt,
                               bool i_slvPath0,  uint32_t &o_regValue );
} // end namespace PlatServices

} // end namespace PRDF

#endif // __prdfPlatServices_rt_H

OpenPOWER on IntegriCloud