summaryrefslogtreecommitdiffstats
path: root/src/usr/mvpd/mvpd.H
blob: 195016c1c9b1c33a0dc26221e4b0d4c213236737 (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
//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/mvpd/mvpd.H $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2012
//
//  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 other-
//  wise divested of its trade secrets, irrespective of what has
//  been deposited with the U.S. Copyright Office.
//
//  Origin: 30
//
//  IBM_PROLOG_END
#ifndef __MVPD_H
#define __MVPD_H

/**
 * @file mvpd.H
 *
 * @brief Provides the interfaces for the MVPD device driver
 *
 */

// ----------------------------------------------
// Includes
// ----------------------------------------------
#include <errl/errlentry.H>

namespace MVPD
{

/**
* @brief Miscelaneous MVPD definitions
*/
enum
{
    RECORD_BYTE_SIZE        = 4,
    RECORD_ADDR_BYTE_SIZE   = 2,
    KEYWORD_BYTE_SIZE       = 2,
    KEYWORD_SIZE_BYTE_SIZE  = 1,
    RECORD_TOC_UNUSED       = 2,
    RT_SKIP_BYTES           = 3,

};

/**
* @brief Structure for all MVPD dd input parameter arguments
*/
typedef struct
{
    mvpdRecord record;
    mvpdKeyword keyword;
} input_args_t;

/**
 * @brief Structure of information needed to access requested
 *      record/keyword combinations.
 */
typedef struct
{
    mvpdRecord record;
    char recordName[MVPD_LAST_RECORD];
} mvpdRecordInfo;

/**
 */
typedef struct
{
    mvpdKeyword keyword;
    char keywordName[MVPD_LAST_KEYWORD];
} mvpdKeywordInfo;


/**
 * @brief Conversion of MVPD Records to corresponding character representation.
 */
const mvpdRecordInfo mvpdRecords[] =
{
    // -------------------------------------------------------------------
    // NOTE: This list must remain an ordered list!  There will be a
    //      testcase that checks this.  When adding new entries to the
    //      list, be sure that the keyword in each entry (value 0)
    //      are in ascending order.
    // -------------------------------------------------------------------
    { CRP0, "CRP0" },
    { CP00, "CP00" },
    { VINI, "VINI" },
    { LRP0, "LRP0" },
    { LRP1, "LRP1" },
    { LRP2, "LRP2" },
    { LRP3, "LRP3" },
    { LRP4, "LRP4" },
    { LRP5, "LRP5" },
    { LRP6, "LRP6" },
    { LRP7, "LRP7" },
    { LRP8, "LRP8" },
    { LRP9, "LRP9" },
    { LRPA, "LRPA" },
    { LRPB, "LRPB" },
    { LWP0, "LWP0" },
    { LWP1, "LWP1" },
    { LWP2, "LWP2" },
    { LWP3, "LWP3" },
    { LWP4, "LWP4" },
    { LWP5, "LWP5" },
    { LWP6, "LWP6" },
    { LWP7, "LWP7" },
    { LWP8, "LWP8" },
    { LWP9, "LWP9" },
    { LWPA, "LWPA" },
    { LWPB, "LWPB" },
    { VWML, "VWML" },
    // -------------------------------------------------------------------
    // DO NOT USE!!  This is for test purposes ONLY!
    { MVPD_TEST_RECORD, "TEST" },
    // -------------------------------------------------------------------
};

/**
 * @brief Conversion of MVPD Keywords to corresponding character representation.
 */
const mvpdKeywordInfo mvpdKeywords[] =
{
    // -------------------------------------------------------------------
    // NOTE: This list must remain an ordered list!  There will be a
    //      testcase that checks this.  When adding new entries to
    //      the list, be sure that the keyword in each entry (value 0)
    //      are in ascending order.
    // -------------------------------------------------------------------
    { VD,  "VD" },
    { ED,  "ED" },
    { TE,  "TE" },
    { DD,  "DD" },
    { pdP, "#P" },
    { ST,  "ST" },
    { DN,  "DN" },
    { PG,  "PG" },
    { PK,  "PK" },
    { pdR, "#R" },
    { pdV, "#V" },
    { pdH, "#H" },
    { SB,  "SB" },
    { DR,  "DR" },
    { VZ,  "VZ" },
    { CC,  "CC" },
    { CE,  "CE" },
    { FN,  "FN" },
    { PN,  "PN" },
    { SN,  "SN" },
    { PR,  "PR" },
    { HE,  "HE" },
    { CT,  "CT" },
    { HW,  "HW" },
    { pdM, "#M" },
    { IN,  "IN" },
    { pd2, "#2" },
    { pd3, "#3" },
    { OC,  "OC" },
    { FO,  "FO" },
    { pdI, "#I" },
    // -------------------------------------------------------------------
    // DO NOT USE!!  This is for test purposes ONLY!
    { MVPD_TEST_KEYWORD, "TEST" },
    // -------------------------------------------------------------------
};


/**
 * @brief This function will perform the steps required to do a read from
 *      the Hostboot MVPD data.
 *
 * @param[in] i_opType - Operation Type - See DeviceFW::OperationType in
 *       driververif.H
 *
 * @param[in] i_target - Processor Target device
 *
 * @param [in/out] io_buffer - Pointer to the data that was read from
 *       the target device.  It will also be used to contain data to
 *       be written to the device.
 *
 * @param [in/out] io_buflen - Length of the buffer to be read or written
 *       to/from the target.  This value should indicate the size of the
 *       io_buffer parameter that has been allocated.  Being returned it will
 *       indicate the number of valid bytes in the buffer being returned.
 *
 * @param [in] i_accessType - Access Type - See DeviceFW::AccessType in
 *       usrif.H
 *
 * @param [in] i_args - This is an argument list for the device driver
 *       framework.
 *
 * @return errlHndl_t - NULL if successful, otherwise a pointer to the
 *       error log.
*/
errlHndl_t mvpdRead ( DeviceFW::OperationType i_opType,
                      TARGETING::Target * i_target,
                      void * io_buffer,
                      size_t & io_buflen,
                      int64_t i_accessType,
                      va_list i_args );

/**
 * @brief This function will perform the steps required to do a write to
 *      the Hostboot MVPD data.
 *
 * @param[in] i_opType - Operation Type - See DeviceFW::OperationType in
 *       driververif.H
 *
 * @param[in] i_target - Processor Target device
 *
 * @param [in/out] io_buffer - Pointer to the data that was read from
 *       the target device.  It will also be used to contain data to
 *       be written to the device.
 *
 * @param [in/out] io_buflen - Length of the buffer to be read or written
 *       to/from the target.  This value should indicate the size of the
 *       io_buffer parameter that has been allocated.  Being returned it will
 *       indicate the number of valid bytes in the buffer being returned.
 *
 * @param [in] i_accessType - Access Type - See DeviceFW::AccessType in
 *       usrif.H
 *
 * @param [in] i_args - This is an argument list for the device driver
 *       framework.
 *
 * @return errlHndl_t - NULL if successful, otherwise a pointer to the
 *       error log.
*/
errlHndl_t mvpdWrite ( DeviceFW::OperationType i_opType,
                       TARGETING::Target * i_target,
                       void * io_buffer,
                       size_t & io_buflen,
                       int64_t i_accessType,
                       va_list i_args );

/**
 * @brief This function actually reads the data from the source of the MVPD
 *      data.
 *
 * @param[in] i_byteAddr - The offset to be read.
 *
 * @param[in] i_numBytes - The number of bytes to read.
 *
 * @param[out] o_data - The data buffer where the data will be placed.
 *
 * @param[in] i_target - Processor Target device.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
*/
errlHndl_t mvpdFetchData ( uint64_t i_byteAddr,
                           size_t i_numBytes,
                           void * o_data,
                           TARGETING::Target * i_target );

/**
 * @brief This function reads a binary file that contains the MVPD data for
 *      all targets.
 *
 * @param[in] i_offset - The offset to read.
 *
 * @param[in] i_numBytes - The number of bytes to read.
 *
 * @param[out] o_data - The Data buffer where the data will be placed.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
*/
errlHndl_t mvpdReadBinaryFile ( uint64_t i_offset,
                                size_t i_numBytes,
                                void * o_data );

/**
 * @brief This function will translate the enumeration for the MVPD record
 *      into a char * variable to be used for comparing what was read from
 *      the MVPD data.
 *
 * @param[in] i_record - The record enumeration.
 *
 * @param[out] o_record - The char representation of the record.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
 */
errlHndl_t mvpdTranslateRecord ( mvpdRecord i_record,
                                 const char *& o_record );

/**
 * @brief This function will translate the enumeration for the MVPD keyword
 *      into a char * variable to be used for comparing what was read from
 *      the MVPD data.
 *
 * @param[in] i_keyword - The keyword enumeration.
 *
 * @param[out] o_keyword - The char representation of the record.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
 */
errlHndl_t mvpdTranslateKeyword ( mvpdKeyword i_keyword,
                                  const char *& o_keyword );

/**
 * @brief This function will read the MVPD TOC to find the offset where the
 *      given record is located within the chunk of data.
 *
 * @param[in] i_record - String value for the record to look for.
 *
 * @param[out] o_offset - The offset where the record is located.
 *
 * @param[in] i_target - The target to retrieve the data for.
 *
 * @param[in] i_args - The input arguments.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
 */
errlHndl_t mvpdFindRecordOffset ( const char * i_record,
                                  uint16_t & o_offset,
                                  TARGETING::Target * i_target,
                                  input_args_t i_args );

/**
 * @brief This function will read the required keyword from the MVPD data.
 *
 * @param[in] i_keywordName - String representation of the keyword.
 *
 * @param[in] i_recordName - String representation of the record.
 *
 * @param[in] i_offset - The offset to start reading.
 *
 * @param[in] i_target - The target to retrieve data for.
 *
 * @param[out] io_buffer - The buffer to place the data in.
 *
 * @param[in/out] io_buflen - Length of the buffer to be read or written
 *       to/from the target.  This value should indicate the size of the
 *       io_buffer parameter that has been allocated.  Being returned it will
 *       indicate the number of valid bytes in the buffer being returned.
 *
 * @param[in] i_args - The input arguments.
 *
 * @return errHndl_t - NULL if successful, otherwise a pointer to the
 *      error log.
 */
errlHndl_t mvpdRetrieveKeyword ( const char * i_keywordName,
                                 const char * i_recordName,
                                 uint16_t i_offset,
                                 TARGETING::Target * i_target,
                                 void * io_buffer,
                                 size_t & io_buflen,
                                 input_args_t i_args );


}; // end MVPD namespace

#endif  // __MVPD_H
OpenPOWER on IntegriCloud