summaryrefslogtreecommitdiffstats
path: root/src/include/usr/sbeio/sbeioif.H
blob: 33b0edac8de8e1d49a698cd0d813b2ac11227c6a (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
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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/sbeio/sbeioif.H $                             */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2013,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 _SBEIOIF_H
#define _SBEIOIF_H

#include <errl/errlentry.H>


/* Associated defines for sendPsuReadSeeprom() function below */
#define CHIPOP_READ_SEEPROM_SIZE_ALIGNMENT_BYTES 128
#define CHIPOP_READ_SEEPROM_DEST_ADDR_ALIGNMENT_BYTES 8


namespace SBEIO
{
    enum KeyAddrStashKeys
    {
        RSV_MEM_ATTR_ADDR  = 0x01,  // Start at non-zero
        DEPRECATED_1       = 0x02,  // 0x2 was previously planned to be
                                    // used to pass HRMOR but SBE did not
                                    // implement it. There is old version
                                    // of hostboot that look at this so
                                    // reusing this could break backwards
                                    // compatibility
        RELOC_PAYLOAD_ADDR = 0x03,
        ARCH_REG_DATA_ADDR = 0x04,
        //On SBE side struct is defaulted so that
        //Keys are 0xFF and Vals are 0xFFFFFFFFFFFFFFFF
        //So a key w/ FF means its empty or at its default val
        SBE_DEFAULT       = 0xFF
    };

    /**
     * @brief Start Deadman loop
     *
     * @param[in] i_waitTime Time to wait in milliseconds
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t startDeadmanLoop(const uint64_t i_waitTime );

    /**
     * @brief Stop Deadman loop
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t stopDeadmanLoop( );

    /**
    * @brief Semd System Configuration
    *
    * @param[in] i_systemConfig Fabric grouping map bitstring
    *                           Examples:
    *                           bit 0  = proc 0 group 0
    *                           bit 8  = proc 0 group 1
    *                           bit 12 = proc 4 group 1
    * @param[in] i_procChip     Proc you would like to send the config to
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendSystemConfig(const uint64_t i_systemConfig,
                                TARGETING::Target * i_procChip);


    /**
    * @brief Send the signal to the sbe that we are performing a MPIPL
    *
    * @param[in] i_procChip The proc you would like to request continueMPIPL to
    *                       NOTE: HB should only be sending this to slave procs
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendContinueMpiplRequest(TARGETING::Target * i_procChip);

    /**
     * @brief Sends a PSU chipOp to quiesce the SBE
     *
     * @param[in]  i_pProc  Processor target with SBE to quiesce.
     *     Throws error if requested target is nullptr or does not
     *     refer to a processor.
     *
     * @note Sets the requested processor's ASSUME_SBE_QUIESCED attribute
     *   to true to inhibit future quiesce sensitive operations.
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t sendPsuQuiesceSbe(TARGETING::Target* i_pProc);

     /**
     * @brief Get the capabilities of the SBE via PSU
     *
     * @param[in]  i_target Target with SBE to get capabilities from
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t getPsuSbeCapabilities(TARGETING::TargetHandle_t i_target);

     /**
     * @brief Get the capabilities of the SBE via FIFO
     *
     * @param[in]  i_target Target with SBE to get capabilities from
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t getFifoSbeCapabilities(TARGETING::TargetHandle_t i_target);

    /**
    * @brief Sends a PSU chipOp to stash away a key,addr pair on the SBE
    *
    * @param[in]  i_key      The key used to identify what the value is
    * @param[in]  i_value    Value that will be passed (likely an address)
    * @param[in]  i_procChip The proc we wish to send the op to
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendPsuStashKeyAddrRequest(const uint8_t i_key,
                                          const uint64_t i_value,
                                          TARGETING::Target * i_procChip);

    /**
     * @brief Get SCOM via SBE FIFO
     *
     * @param[in]  i_target  Processor Target to access
     * @param[in]  i_addr    Requested register address
     * @param[out] o_data    Returned data
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t getFifoScom(TARGETING::Target * i_target,
                           uint64_t            i_addr,
                           uint64_t          & o_data);
    /**
     * @brief Put SCOM via SBE FIFO
     *
     * @param[in]  i_target  Processor Target to access
     * @param[in]  i_addr    Requested register address
     * @param[in]  i_data    Data to write
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t putFifoScom(TARGETING::Target * i_target,
                           uint64_t            i_addr,
                           uint64_t            i_data);

    /**
     * @brief Put SCOM under mask via SBE FIFO
     *
     * @param[in]  i_target  Processor Target to access
     * @param[in]  i_addr    Requested register address
     * @param[in]  i_data    Data to write
     * @param[in]  i_mask    SCOM mask
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t putFifoScomUnderMask(TARGETING::Target * i_target,
                                    uint64_t            i_addr,
                                    uint64_t            i_data,
                                    uint64_t            i_mask);

    /**
     * @brief Issue Reset to SBE FIFO.  Note this can ONLY be
     *        done on slave processors on FSI SBE FIFO path
     *        never on the master chip.  This function is
     *        only intended to be used to cleanup the FIFO
     *        on IPLs -- as it doesn't follow the protocol
     *        with a running SBE
     *
     *
     * @param[in]  i_target  Processor Target to access
     *
     * @return errlHndl_t Error log handle on failure.
     *
     */
    errlHndl_t sendFifoReset(TARGETING::Target * i_target);

    /**
    * @brief Get the SBE FFDC.  Request that SBE retrieve the SBE FFDC
    *
    * @param[in]     i_procChip      The proc from which to get the SBE FFDC
    * @param[out]    o_pFifoResponse Pointer to response
    * @param[in]     i_responseSize  Size of response in bytes
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t getFifoSBEFFDC(TARGETING::Target *i_procChip,
                              uint32_t *o_pFifoResponse,
                              uint32_t &i_responseSize);
    /**
    * @brief Set the FFDC address for the SBE so it is aware of the FFDC buffer
    *        and its size and it is aware of the SBE Communication buffer and
    *        its size
    *
    * @param[in] i_sbeffdcSize uint32 Size of SBE FFDC buffer
    * @param[in] i_sbeCommSize uint32 Size of SBE Communication buffer
    * @param[in] i_sbeffdcAddr uint64 Physical mainstore address of FFDC buffer
    * @param[in] i_sbeCommAddr uint64 Physical mainstore address of Comm buffer
    * @param[in] i_procChip The proc to which you would like to send the info
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendSetFFDCAddr(const uint32_t i_sbeffdcSize,
                               const uint32_t i_sbeCommSize,
                               const uint64_t i_sbeffdcAddr,
                               const uint64_t i_sbeCommAddr,
                               TARGETING::Target * i_procChip);

    /**
     * @brief Open Unsecure Memory Region via the SBE
     *
     * @param[in] i_start_addr  Starting Physical Memory Address of the
     *                          Unsecure Memory Region to Open
     *
     * @param[in] i_size        Size in bytes of the Unsecure Memory Region
     *                          Assert if size = 0
     *
     * @param[in] i_isWritable  Specifies if the Unsecure Memory is Read-Only
     *                          or Read-Write: If false then Read-Only Region
     *                                         If true then Read-Write Region
     *
     * @param[in] i_target      Processor Target associated with SBE command
     *                          If nullptr, default to Master Processor
     *
     * @return errlHndl_t Error log handle on failure.
     *
     * @note  Function is not thread-safe.
     * @note  Read-Only/Read-Write settings and Target associated with the
     *        region are not considered when closing any existing regions
     *        that overlap with the requested region to open.
     */
    errlHndl_t openUnsecureMemRegion(const uint64_t i_start_addr,
                                     const uint32_t i_size,
                                     const bool     i_isWritable,
                                     TARGETING::Target*  i_target=nullptr);

    /**
     * @brief Close Unsecure Memory Region
     *
     * @param[in] i_start_addr  Starting Physical Memory Address of the
     *                          Unsecure Memory Region to Close
     *
     * @param[in] i_target      Processor Target associated with SBE command
     *                          If nullptr, default to Master Processor
     *
     * @return errlHndl_t Error log handle on failure.
     *
     * @note  Function is not thread-safe.
     */
    errlHndl_t closeUnsecureMemRegion(const uint64_t i_start_addr,
                                      TARGETING::Target*  i_target=nullptr);

    /**
     * @brief Close All Unsecure Memory Regions
     *
     * @return errlHndl_t Error log handle on failure.
     *
     * @note  Function is not thread-safe.
     */
    errlHndl_t closeAllUnsecureMemRegions();

    /**
     * @brief Gathers FFDC and recovers from SBE errors
     *
     * @return errlHndl_t Error log handle on failure.
     *
     * @param[in] i_target  Processor Target associated with SBE attention
     */
    errlHndl_t handleVitalAttn( TARGETING::Target* i_procTarg );

    /**
    * @brief Request the SBE to do a specific chip op
    *
    * @param[in] i_target       The target of which the HWP is intended to be called on,
    *                           this must be the first param of the request HWP
    *
    * @param[in] i_dataPointer  Pointer to a blob of data that contains additional parameters
    *                           for the requests HWP
    *
    * @param[in] i_dataSize     Size of blob of data that contains additional parameters
    *                           for the requests HWP
    *
    * @param[in] i_hwpName      Pointer to string of chars representing hwp name
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendSecureHwpRequest(TARGETING::Target * i_target,
                                    uint8_t * i_dataPointer,
                                    uint64_t i_dataSize,
                                    const char * i_hwpName);

    /**
    * @brief Sends a PSU chipOp to request Seeprom read from SBE
    *
    * @param[in]  i_target         Target with SBE to send read request to
    *                              Assert if i_target == nullptr
    * @param[in]  i_seepromOffset  Offset in the seeprom image where we want
    *                              to start copying from (ignores ECC)
    * @param[in]  i_readSize       Amount of bytes we want to copy (ignores ECC)
    *                              Assert if i_readSize is not 128-byte-aligned
    * @param[in]  i_destAddr       Address that hostboot has prepared which the
    *                              sbe will write too
    *                              Assert if i_destAddr is not 8-byte aligned
    * @param[out] o_opSupported    Bool which tells us if the sbe supports the
    *                              chipOp or not
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendPsuReadSeeprom(TARGETING::Target * i_target,
                                  uint32_t i_seepromOffset,
                                  uint32_t i_readSize,
                                  uint64_t i_destAddr,
                                  bool   & o_opSupported);

    /**
    * @brief Sends a PSU chipOp to fetch security list binary dump in the SBE
    *
    * @param[in]  i_addr         Address that hostboot has prepared which the
    *                            securityList Bin Dump addr sbe will write too
    *
    * @param[in]  i_procChip     Target with SBE to send read request to
    *                            Assert if i_procChip == nullptr
    *
    * @return errlHndl_t Error log handle on failure.
    *
    */
    errlHndl_t sendPsuSecurityListBinDumpRequest(const uint64_t i_addr,
                                         TARGETING::Target *i_procChip);

} //end namespace SBEIO

#endif /* _SBEIOIF_H */
OpenPOWER on IntegriCloud