summaryrefslogtreecommitdiffstats
path: root/src/include/usr/hwpf/fapi/fapiPlatHwAccess.H
blob: d7bf534b90e03e3ed505e03c2bcd5ce3f44bf8af (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
368
369
370
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/hwpf/fapi/fapiPlatHwAccess.H $                */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2014              */
/*                                                                        */
/* 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                                                     */
// $Id: fapiPlatHwAccess.H,v 1.10 2014/01/20 20:58:47 mjjones Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiPlatHwAccess.H,v $

/**
 *  @file fapiPlatHwAccess.H
 *
 *  @brief Defines hardware-access functions for the platform layer.  
 *         Hardware procedure writers will not call these functions. 
 *       
 *         Implementors of platform code will provide worker routines
 *         for these functions in file hwpf/plat/fapiPlatHwAccess.C.
 *         fapi.H will not include this file, so platform implementors
 *         will have to include this file explicitly. 
 * 
 *         These platform entry points are called by fapi functions from 
 *         hwpf/fapi/fapiHwAccess.C which are wrapper functions that 
 *         output scand traces common to all platforms.  
 * 
 *         These functions have the same argument signatures as the
 *         fapi-level functions, but the function names her start with 
 *         "plat."
 *     
 */

/*
 * Change Log ******************************************************************
 * Flag     Defect/Feature  User        Date        Description
 * ------   --------------  ----------  ----------- ----------------------------
 *                          monte       8sep2011    new
 *                          mjjones     11/10/2011  Use ecmdDataBufferBase
 *          836579          thi         May 22,2012 Spy/Ring supports
 *                          mjjones     07/12/2012  Add Pulse mode option to
 *                                                  Ring funcs
 *          F876964         jknight     Apr, 02,2013  fapi get/setSpyImage
 *          F873646         srimeesa    Mar 10,2013 64Bit SPYID and 
 *                                                  ClockDomain ID support  
 *          F883863         atendolk    May 16,2013 fapi MultiScom support
 */

#ifndef FAPIPLATHWACCESS_H_
#define FAPIPLATHWACCESS_H_

#include <stdint.h>
#include <ecmdDataBufferBase.H>
#include <fapiReturnCode.H>
#include <fapiTarget.H>
#ifdef FAPI_SUPPORT_MULTI_SCOM
#include <fapiMultiScom.H>
#endif

extern "C"
{

//------------------------------------------------------------------------------
// HW Communication Functions to be implemented at the platform layer.
//------------------------------------------------------------------------------


/**
 * @brief Platform-level implementation called by GetScom()
 * Hardware procedures writers will not call this function.
 * 
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address Scom address to read from
 * @param[out] o_data ecmdDataBufferBase object that holds data read from
 *                    address
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platGetScom(const fapi::Target& i_target,
                             const uint64_t i_address,
                             ecmdDataBufferBase & o_data);


/**
 * @brief Platform-level implementation called by PutScom().
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address Scom address to write to
 * @param[in] i_data ecmdDataBufferBase object that holds data to write into
 *                   address
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutScom(const fapi::Target& i_target,
                             const uint64_t i_address,
                             ecmdDataBufferBase & i_data);


/**
 * @brief Platform-level implementation called by PutScomUnderMask()
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address Scom address to write to
 * @param[in] i_data ecmdDataBufferBase object that holds the data
 * @param[in] i_mask ecmdDataBufferBase object that holds the mask (i_data to
 *                   write)
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target,
                                      const uint64_t i_address,
                                      ecmdDataBufferBase & i_data,
                                      ecmdDataBufferBase & i_mask);

#ifdef FAPI_SUPPORT_MULTI_SCOM
/**
 * @brief Platform-level implementation called by fapiMultiScom()
 * Hardware procedures writers will not call this function.
 *
 * @param[in]    i_target         Target to operate on
 * @param[inout] io_multiScomList MultiScom object pre-populated with SCOMs to
 *                                be performed on i_target
 * @return       ReturnCode       Zero on success, else platform specified error
 */
fapi::ReturnCode platMultiScom (const fapi::Target&    i_target,
                                      fapi::MultiScom& io_multiScomList);
#endif

/**
 * @brief Platorm-level implementation called by GetCfamRegister()
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address CFAM address to read from
 * @param[out] o_data ecmdDataBufferBase object that holds data read from
 *                    address
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
                                     const uint32_t i_address,
                                     ecmdDataBufferBase & o_data);


/**
 * @brief Platform-level implementation called by PutCfamRegister()
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address CFAM address to write to
 * @param[in] i_data ecmdDataBufferBase object that holds data to write into
 *                   address
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
                                     const uint32_t i_address,
                                     ecmdDataBufferBase & i_data);


/**
 * @brief Platform-level implementation of ModifyCfamRegister()
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target Target to operate on
 * @param[in] i_address CFAM address to write to
 * @param[in] i_data ecmdDataBufferBase object that holds the modifying data
 * @param[in] i_modifyMode The modify mode (or/and/xor)
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
                                  const uint32_t i_address,
                                  ecmdDataBufferBase & i_data,
                                  const fapi::ChipOpModifyMode i_modifyMode);


/**
 * @brief Platform-level implementation called by fapiGetRing()
 * Hardware procedures writers will not call this function.
 * 
 * @param[in] i_target  Target to operate on
 * @param[in] i_address Ring address to read from
 * @param[out] o_data   ecmdDataBufferBase object that holds data read from
 *                      address
 * @param[in] i_ringMode Any number of mode options from fapi::RingMode ORed
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platGetRing(const fapi::Target& i_target,
                             const scanRingId_t i_address,
                             ecmdDataBufferBase & o_data,
                             const uint32_t i_ringMode);


/**
 * @brief Platform-level implementation called by fapiPutRing()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target  Target to operate on
 * @param[in] i_address Ring address to write to
 * @param[in] i_data    ecmdDataBufferBase object that holds data to write into
 *                      address
 * @param[in] i_ringMode Any number of mode options from fapi::RingMode ORed
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutRing(const fapi::Target& i_target,
                             const scanRingId_t i_address,
                             ecmdDataBufferBase & i_data,
                             const uint32_t i_ringMode);


/**
 * @brief Platform-level implementation called by fapiModifyRing()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target  Target to operate on
 * @param[in] i_address Ring address to modify
 * @param[in] i_data    ecmdDataBufferBase object that holds data to write into
 *                      address
 * @param[in] i_ringMode Any number of mode options from fapi::RingMode ORed
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platModifyRing(const fapi::Target& i_target,
                                const scanRingId_t i_address,
                                ecmdDataBufferBase & i_data,
                                const fapi::ChipOpModifyMode i_modifyMode,
                                const uint32_t i_ringMode);

// --------------------------------------------------------------------------
// NOTE:
// These spy access interfaces are only used in FSP.
// HB does not allow spy access

/**
 * @brief Platform-level implementation called by fapiGetSpy()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target              Target to read spy from
 * @param[in] i_spyId               The spy's id
 * @param[out] o_data               Storage for output data
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
#ifdef FAPI_SUPPORT_SPY_AS_ENUM
fapi::ReturnCode platGetSpy(const fapi::Target& i_target,
                            const spyId_t i_spyId,
                            ecmdDataBufferBase & o_data);
#endif

#ifdef FAPI_SUPPORT_SPY_AS_STRING
/**
 * @brief Reads a Spy from a target
 * @param[in] i_target              Target to read spy from
 * @param[in] i_spyId               The spy's id
 * @param[out] o_data               Storage for output data
 *
 * @return ReturnCode. Zero on success, else platform specified error
 *
 * @note:  This is only supported in the cronus environment
 *         it will not compile in FSP code 
 */
fapi::ReturnCode platGetSpy(const fapi::Target& i_target,
                             const char * const i_spyId,
                             ecmdDataBufferBase & o_data);
#endif

#ifdef FAPI_SUPPORT_SPY_AS_ENUM
/**
 * @brief Platform-level implementation called by fapiPutSpy()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target  Target to operate on
 * @param[in] i_spyId   The spy's id
 * @param[in] i_data    ecmdDataBufferBase object that holds data to write into
 *                      address
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutSpy(const fapi::Target& i_target,
                            const spyId_t i_spyId,
                            ecmdDataBufferBase & i_data);
#endif

#ifdef FAPI_SUPPORT_SPY_AS_STRING
fapi::ReturnCode platPutSpy(const fapi::Target& i_target,
                             const char * const i_spyId,
                             ecmdDataBufferBase & i_data);
#endif
#ifdef FAPI_SUPPORT_SPY_AS_ENUM
/**
 * @brief Platform-level implementation called by fapiGetSpyImage()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target              Target to read spy from
 * @param[in] i_spyId               The spy's id
 * @param[out] o_data               Storage for output data
 * @param[in] i_imageData           Input ring data
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platGetSpyImage(const fapi::Target& i_target,
                                 const spyId_t i_spyId,
                                 ecmdDataBufferBase & o_data,
                                 const ecmdDataBufferBase & i_imageData);
#endif
#ifdef FAPI_SUPPORT_SPY_AS_STRING
/**
 * @brief Platform-level implementation called by fapiGetSpyImage()
 * Hardware procedures writers will not call this function.
 *
 * @param[in] i_target              Target to read spy from
 * @param[in] i_spyId               The spy's id
 * @param[out] o_data               Storage for output data
 * @param[in] i_imageData           Input ring data
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platGetSpyImage(const fapi::Target& i_target,
                                 const char * const i_spyId,
                                 ecmdDataBufferBase & o_data,
                                 const ecmdDataBufferBase & i_imageData);
#endif
#ifdef FAPI_SUPPORT_SPY_AS_ENUM
/**
 * @brief Platform-level implementation called by fapiPutSpyImage()
 * Hardware procedures writers will not call this function.
 *
 * @param[in]  i_target             Target to read spy from
 * @param[in]  i_spyId              The spy's id
 * @param[in]  i_data               Data to be written into the image
 * @param[out] io_imageData         Holds ring image to write data into
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutSpyImage(const fapi::Target& i_target,
                                 const spyId_t i_spyId,
                                 const ecmdDataBufferBase & i_data,
                                 ecmdDataBufferBase & io_imageData);
#endif
#ifdef FAPI_SUPPORT_SPY_AS_STRING
/**
 * @brief Platform-level implementation called by fapiPutSpyImage()
 * Hardware procedures writers will not call this function.
 *
 * @param[in]  i_target             Target to read spy from
 * @param[in]  i_spyId              The spy's id
 * @param[in]  i_data               Data to be written into the image
 * @param[out] io_imageData         Holds ring image to write data into
 *
 * @return ReturnCode. Zero on success, else platform specified error
 */
fapi::ReturnCode platPutSpyImage(const fapi::Target& i_target,
                                 const char* const i_spyId,
                                 const ecmdDataBufferBase & i_data,
                                 ecmdDataBufferBase & io_imageData);

#endif
} // extern "C"

#endif // FAPIPLATHWACCESS_H_
OpenPOWER on IntegriCloud