summaryrefslogtreecommitdiff
path: root/cpu/ixp/npe/include/IxNpeDlImageMgr_p.h
blob: 622f879a41de71c04640c4ed3a42d97b9acd8662 (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
/**
 * @file IxNpeDlImageMgr_p.h
 *
 * @author Intel Corporation
 * @date 14 December 2001

 * @brief This file contains the private API for the ImageMgr module
 *
 * 
 * @par
 * IXP400 SW Release version 2.0
 * 
 * -- Copyright Notice --
 * 
 * @par
 * Copyright 2001-2005, Intel Corporation.
 * All rights reserved.
 * 
 * @par
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 * 
 * @par
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * @par
 * -- End of Copyright Notice --
*/

/**
 * @defgroup IxNpeDlImageMgr_p IxNpeDlImageMgr_p
 *
 * @brief The private API for the IxNpeDl ImageMgr module
 * 
 * @{
 */

#ifndef IXNPEDLIMAGEMGR_P_H
#define IXNPEDLIMAGEMGR_P_H


/*
 * Put the user defined include files required.
 */
#include "IxNpeDl.h"
#include "IxOsalTypes.h"


/*
 * #defines and macros
 */

/**
 * @def IX_NPEDL_IMAGEMGR_SIGNATURE
 *
 * @brief Signature found as 1st word in a microcode image library
 */
#define IX_NPEDL_IMAGEMGR_SIGNATURE      0xDEADBEEF

/**
 * @def IX_NPEDL_IMAGEMGR_END_OF_HEADER
 *
 * @brief Marks end of header in a microcode image library
 */
#define IX_NPEDL_IMAGEMGR_END_OF_HEADER  0xFFFFFFFF

/**
 * @def IX_NPEDL_IMAGEID_NPEID_OFFSET
 *
 * @brief Offset from LSB of NPE ID field in Image ID
 */
#define IX_NPEDL_IMAGEID_NPEID_OFFSET      24

/**
 * @def IX_NPEDL_IMAGEID_DEVICEID_OFFSET
 *
 * @brief Offset from LSB of Device ID field in Image ID
 */
#define IX_NPEDL_IMAGEID_DEVICEID_OFFSET   28

/**
 * @def IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET
 *
 * @brief Offset from LSB of Functionality ID field in Image ID
 */
#define IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET 16

/**
 * @def IX_NPEDL_IMAGEID_MAJOR_OFFSET
 *
 * @brief Offset from LSB of Major revision field in Image ID
 */
#define IX_NPEDL_IMAGEID_MAJOR_OFFSET      8

/**
 * @def IX_NPEDL_IMAGEID_MINOR_OFFSET
 *
 * @brief Offset from LSB of Minor revision field in Image ID
 */
#define IX_NPEDL_IMAGEID_MINOR_OFFSET      0


/**
 * @def IX_NPEDL_NPEID_FROM_IMAGEID_GET
 *
 * @brief Macro to extract NPE ID field from Image ID
 */
#define IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId) \
    (((imageId) >> IX_NPEDL_IMAGEID_NPEID_OFFSET) & \
     IX_NPEDL_NPEIMAGE_NPEID_MASK)

/**
 * @def IX_NPEDL_DEVICEID_FROM_IMAGEID_GET
 *
 * @brief Macro to extract NPE ID field from Image ID
 */
#define IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId) \
    (((imageId) >> IX_NPEDL_IMAGEID_DEVICEID_OFFSET) & \
     IX_NPEDL_NPEIMAGE_DEVICEID_MASK)

/**
 * @def IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET
 *
 * @brief Macro to extract Functionality ID field from Image ID
 */
#define IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId) \
    (((imageId) >> IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET) & \
     IX_NPEDL_NPEIMAGE_FIELD_MASK)

/**
 * @def IX_NPEDL_MAJOR_FROM_IMAGEID_GET
 *
 * @brief Macro to extract Major revision field from Image ID
 */
#define IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId) \
    (((imageId) >> IX_NPEDL_IMAGEID_MAJOR_OFFSET) & \
     IX_NPEDL_NPEIMAGE_FIELD_MASK)

/**
 * @def IX_NPEDL_MINOR_FROM_IMAGEID_GET
 *
 * @brief Macro to extract Minor revision field from Image ID
 */
#define IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId) \
    (((imageId) >> IX_NPEDL_IMAGEID_MINOR_OFFSET) & \
     IX_NPEDL_NPEIMAGE_FIELD_MASK)


/*
 * Prototypes for interface functions
 */

/**
 * @fn IX_STATUS ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary)
 * 
 * @brief This instructs NPE Downloader to use client-supplied microcode image library.
 *
 * This function sets NPE Downloader to use a client-supplied microcode image library
 * instead of the standard image library which is included by the NPE Downloader.
 * 
 * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
 *       It will be removed in a future release.
 *       See API header file IxNpeDl.h for more information.             
 *
 * @pre
 *    - <i>clientImageLibrary</i> should point to a microcode image library valid for use
 *      by the NPE Downloader component.
 *
 * @post
 *    - the client-supplied image uibrary will be used for all subsequent operations
 *      performed by the NPE Downloader
 *
 * @return
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL if the client-supplied image library did not contain a valid signature
 */ 
IX_STATUS
ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary);


/**
 * @fn IX_STATUS ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr,
                                                    UINT32 *numImages)
 * 
 * @brief Extracts a list of images available in the NPE microcode image library.
 *
 * @param IxNpeDlImageId* [out] imageListPtr - pointer to array to contain
 *                                                 a list of images. If NULL,
 *                                                 only the number of images 
 *                                                 is returned (in
 *                                                 <i>numImages</i>)
 * @param UINT32* [inout] numImages - As input, it points to a variable
 *                                      containing the number of images which
 *                                      can be stored in the
 *                                      <i>imageListPtr</i> array. Its value
 *                                      is ignored as input if
 *                                      <i>imageListPtr</i> is NULL. As an
 *                                      output, it will contain number of
 *                                      images in the image library.
 * 
 * This function reads the header of the microcode image library and extracts a list of the
 * images available in the image library.  It can also be used to find the number of
 * images in the image library.
 * 
 * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
 *       It will be removed in a future release.
 *       See API header file IxNpeDl.h for more information.             
 *
 * @pre
 *    - if <i>imageListPtr</i> != NULL, <i>numImages</i> should reflect the
 *      number of image Id elements the <i>imageListPtr</i> can contain.
 *
 * @post
 *    - <i>numImages</i> will reflect the number of image Id's found in the
 *      microcode image library.
 *
 * @return
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr,
				   UINT32 *numImages);


/**
 * @fn IX_STATUS ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId,
                                               UINT32 **imagePtr,
                                               UINT32 *imageSize)
 * 
 * @brief Finds a image block in the NPE microcode image library. 
 *
 * @param IxNpeDlImageId* [in] imageId - the id of the image to locate
 * @param UINT32** [out] imagePtr        - pointer to the image in memory
 * @param UINT32* [out] imageSize        - size (in 32-bit words) of image
 * 
 * This function examines the header of the microcode image library for the location
 * and size of the specified image.
 * 
 * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
 *       It will be removed in a future release.
 *       See API header file IxNpeDl.h for more information.             
 *
 * @pre
 *
 * @post
 *
 * @return 
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId,
			      UINT32 **imagePtr,
			      UINT32 *imageSize);

/**
 * @fn IX_STATUS ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId)
 * 
 * @brief Finds the most recent version of an image in the NPE image library. 
 *
 * @param IxNpeDlImageId* [inout] imageId - the id of the image 
 * 
 * This function determines the most recent version of a specified image by its 
 * higest major release and minor revision numbers
 * 
 * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
 *       It will be removed in a future release.
 *       See API header file IxNpeDl.h for more information.             
 *
 * @pre
 *
 * @post
 *
 * @return 
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId);

/**
 * @fn void ixNpeDlImageMgrStatsShow (void)
 *
 * @brief This function will display the statistics of the IxNpeDl ImageMgr
 *        module
 *
 * @return none
 */
void
ixNpeDlImageMgrStatsShow (void);


/**
 * @fn void ixNpeDlImageMgrStatsReset (void)
 *
 * @brief This function will reset the statistics of the IxNpeDl ImageMgr
 *        module
 *
 * @return none
 */
void
ixNpeDlImageMgrStatsReset (void);


/**
 * @fn IX_STATUS ixNpeDlImageMgrImageGet (UINT32 *imageLibrary,
                                          UINT32 imageId,
                                          UINT32 **imagePtr,
                                          UINT32 *imageSize)
 * 
 * @brief Finds a image block in the NPE microcode image library. 
 *
 * @param UINT32*  [in]  imageLibrary - the image library to use
 * @param UINT32   [in]  imageId      - the id of the image to locate
 * @param UINT32** [out] imagePtr     - pointer to the image in memory
 * @param UINT32*  [out] imageSize    - size (in 32-bit words) of image
 * 
 * This function examines the header of the specified microcode image library
 * for the location and size of the specified image.  It returns a pointer to
 * the image in the <i>imagePtr</i> parameter.
 * If no image library is specified (imageLibrary == NULL), then the default
 * built-in image library will be used.
 * 
 * @pre
 *
 * @post
 *
 * @return 
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlImageMgrImageFind (UINT32 *imageLibrary,
                          UINT32 imageId,
			  UINT32 **imagePtr,
			  UINT32 *imageSize);


#endif /* IXNPEDLIMAGEMGR_P_H */

/**
 * @} defgroup IxNpeDlImageMgr_p
 */