Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file IxNpeDlImageMgr_p.h |
| 3 | * |
| 4 | * @author Intel Corporation |
| 5 | * @date 14 December 2001 |
| 6 | |
| 7 | * @brief This file contains the private API for the ImageMgr module |
| 8 | * |
| 9 | * |
| 10 | * @par |
| 11 | * IXP400 SW Release version 2.0 |
| 12 | * |
| 13 | * -- Copyright Notice -- |
| 14 | * |
| 15 | * @par |
| 16 | * Copyright 2001-2005, Intel Corporation. |
| 17 | * All rights reserved. |
| 18 | * |
| 19 | * @par |
| 20 | * Redistribution and use in source and binary forms, with or without |
| 21 | * modification, are permitted provided that the following conditions |
| 22 | * are met: |
| 23 | * 1. Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * 2. Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
| 28 | * 3. Neither the name of the Intel Corporation nor the names of its contributors |
| 29 | * may be used to endorse or promote products derived from this software |
| 30 | * without specific prior written permission. |
| 31 | * |
| 32 | * @par |
| 33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' |
| 34 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 35 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 36 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 37 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 41 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 42 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 43 | * SUCH DAMAGE. |
| 44 | * |
| 45 | * @par |
| 46 | * -- End of Copyright Notice -- |
| 47 | */ |
| 48 | |
| 49 | /** |
| 50 | * @defgroup IxNpeDlImageMgr_p IxNpeDlImageMgr_p |
| 51 | * |
| 52 | * @brief The private API for the IxNpeDl ImageMgr module |
| 53 | * |
| 54 | * @{ |
| 55 | */ |
| 56 | |
| 57 | #ifndef IXNPEDLIMAGEMGR_P_H |
| 58 | #define IXNPEDLIMAGEMGR_P_H |
| 59 | |
| 60 | |
| 61 | /* |
| 62 | * Put the user defined include files required. |
| 63 | */ |
| 64 | #include "IxNpeDl.h" |
| 65 | #include "IxOsalTypes.h" |
| 66 | |
| 67 | |
| 68 | /* |
| 69 | * #defines and macros |
| 70 | */ |
| 71 | |
| 72 | /** |
| 73 | * @def IX_NPEDL_IMAGEMGR_SIGNATURE |
| 74 | * |
| 75 | * @brief Signature found as 1st word in a microcode image library |
| 76 | */ |
| 77 | #define IX_NPEDL_IMAGEMGR_SIGNATURE 0xDEADBEEF |
| 78 | |
| 79 | /** |
| 80 | * @def IX_NPEDL_IMAGEMGR_END_OF_HEADER |
| 81 | * |
| 82 | * @brief Marks end of header in a microcode image library |
| 83 | */ |
| 84 | #define IX_NPEDL_IMAGEMGR_END_OF_HEADER 0xFFFFFFFF |
| 85 | |
| 86 | /** |
| 87 | * @def IX_NPEDL_IMAGEID_NPEID_OFFSET |
| 88 | * |
| 89 | * @brief Offset from LSB of NPE ID field in Image ID |
| 90 | */ |
| 91 | #define IX_NPEDL_IMAGEID_NPEID_OFFSET 24 |
| 92 | |
| 93 | /** |
| 94 | * @def IX_NPEDL_IMAGEID_DEVICEID_OFFSET |
| 95 | * |
| 96 | * @brief Offset from LSB of Device ID field in Image ID |
| 97 | */ |
| 98 | #define IX_NPEDL_IMAGEID_DEVICEID_OFFSET 28 |
| 99 | |
| 100 | /** |
| 101 | * @def IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET |
| 102 | * |
| 103 | * @brief Offset from LSB of Functionality ID field in Image ID |
| 104 | */ |
| 105 | #define IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET 16 |
| 106 | |
| 107 | /** |
| 108 | * @def IX_NPEDL_IMAGEID_MAJOR_OFFSET |
| 109 | * |
| 110 | * @brief Offset from LSB of Major revision field in Image ID |
| 111 | */ |
| 112 | #define IX_NPEDL_IMAGEID_MAJOR_OFFSET 8 |
| 113 | |
| 114 | /** |
| 115 | * @def IX_NPEDL_IMAGEID_MINOR_OFFSET |
| 116 | * |
| 117 | * @brief Offset from LSB of Minor revision field in Image ID |
| 118 | */ |
| 119 | #define IX_NPEDL_IMAGEID_MINOR_OFFSET 0 |
| 120 | |
| 121 | |
| 122 | /** |
| 123 | * @def IX_NPEDL_NPEID_FROM_IMAGEID_GET |
| 124 | * |
| 125 | * @brief Macro to extract NPE ID field from Image ID |
| 126 | */ |
| 127 | #define IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId) \ |
| 128 | (((imageId) >> IX_NPEDL_IMAGEID_NPEID_OFFSET) & \ |
| 129 | IX_NPEDL_NPEIMAGE_NPEID_MASK) |
| 130 | |
| 131 | /** |
| 132 | * @def IX_NPEDL_DEVICEID_FROM_IMAGEID_GET |
| 133 | * |
| 134 | * @brief Macro to extract NPE ID field from Image ID |
| 135 | */ |
| 136 | #define IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId) \ |
| 137 | (((imageId) >> IX_NPEDL_IMAGEID_DEVICEID_OFFSET) & \ |
| 138 | IX_NPEDL_NPEIMAGE_DEVICEID_MASK) |
| 139 | |
| 140 | /** |
| 141 | * @def IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET |
| 142 | * |
| 143 | * @brief Macro to extract Functionality ID field from Image ID |
| 144 | */ |
| 145 | #define IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId) \ |
| 146 | (((imageId) >> IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET) & \ |
| 147 | IX_NPEDL_NPEIMAGE_FIELD_MASK) |
| 148 | |
| 149 | /** |
| 150 | * @def IX_NPEDL_MAJOR_FROM_IMAGEID_GET |
| 151 | * |
| 152 | * @brief Macro to extract Major revision field from Image ID |
| 153 | */ |
| 154 | #define IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId) \ |
| 155 | (((imageId) >> IX_NPEDL_IMAGEID_MAJOR_OFFSET) & \ |
| 156 | IX_NPEDL_NPEIMAGE_FIELD_MASK) |
| 157 | |
| 158 | /** |
| 159 | * @def IX_NPEDL_MINOR_FROM_IMAGEID_GET |
| 160 | * |
| 161 | * @brief Macro to extract Minor revision field from Image ID |
| 162 | */ |
| 163 | #define IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId) \ |
| 164 | (((imageId) >> IX_NPEDL_IMAGEID_MINOR_OFFSET) & \ |
| 165 | IX_NPEDL_NPEIMAGE_FIELD_MASK) |
| 166 | |
| 167 | |
| 168 | /* |
| 169 | * Prototypes for interface functions |
| 170 | */ |
| 171 | |
| 172 | /** |
| 173 | * @fn IX_STATUS ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary) |
| 174 | * |
| 175 | * @brief This instructs NPE Downloader to use client-supplied microcode image library. |
| 176 | * |
| 177 | * This function sets NPE Downloader to use a client-supplied microcode image library |
| 178 | * instead of the standard image library which is included by the NPE Downloader. |
| 179 | * |
| 180 | * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED. |
| 181 | * It will be removed in a future release. |
| 182 | * See API header file IxNpeDl.h for more information. |
| 183 | * |
| 184 | * @pre |
| 185 | * - <i>clientImageLibrary</i> should point to a microcode image library valid for use |
| 186 | * by the NPE Downloader component. |
| 187 | * |
| 188 | * @post |
| 189 | * - the client-supplied image uibrary will be used for all subsequent operations |
| 190 | * performed by the NPE Downloader |
| 191 | * |
| 192 | * @return |
| 193 | * - IX_SUCCESS if the operation was successful |
| 194 | * - IX_FAIL if the client-supplied image library did not contain a valid signature |
| 195 | */ |
| 196 | IX_STATUS |
| 197 | ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary); |
| 198 | |
| 199 | |
| 200 | /** |
| 201 | * @fn IX_STATUS ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr, |
| 202 | UINT32 *numImages) |
| 203 | * |
| 204 | * @brief Extracts a list of images available in the NPE microcode image library. |
| 205 | * |
| 206 | * @param IxNpeDlImageId* [out] imageListPtr - pointer to array to contain |
| 207 | * a list of images. If NULL, |
| 208 | * only the number of images |
| 209 | * is returned (in |
| 210 | * <i>numImages</i>) |
| 211 | * @param UINT32* [inout] numImages - As input, it points to a variable |
| 212 | * containing the number of images which |
| 213 | * can be stored in the |
| 214 | * <i>imageListPtr</i> array. Its value |
| 215 | * is ignored as input if |
| 216 | * <i>imageListPtr</i> is NULL. As an |
| 217 | * output, it will contain number of |
| 218 | * images in the image library. |
| 219 | * |
| 220 | * This function reads the header of the microcode image library and extracts a list of the |
| 221 | * images available in the image library. It can also be used to find the number of |
| 222 | * images in the image library. |
| 223 | * |
| 224 | * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED. |
| 225 | * It will be removed in a future release. |
| 226 | * See API header file IxNpeDl.h for more information. |
| 227 | * |
| 228 | * @pre |
| 229 | * - if <i>imageListPtr</i> != NULL, <i>numImages</i> should reflect the |
| 230 | * number of image Id elements the <i>imageListPtr</i> can contain. |
| 231 | * |
| 232 | * @post |
| 233 | * - <i>numImages</i> will reflect the number of image Id's found in the |
| 234 | * microcode image library. |
| 235 | * |
| 236 | * @return |
| 237 | * - IX_SUCCESS if the operation was successful |
| 238 | * - IX_FAIL otherwise |
| 239 | */ |
| 240 | IX_STATUS |
| 241 | ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr, |
| 242 | UINT32 *numImages); |
| 243 | |
| 244 | |
| 245 | /** |
| 246 | * @fn IX_STATUS ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId, |
| 247 | UINT32 **imagePtr, |
| 248 | UINT32 *imageSize) |
| 249 | * |
| 250 | * @brief Finds a image block in the NPE microcode image library. |
| 251 | * |
| 252 | * @param IxNpeDlImageId* [in] imageId - the id of the image to locate |
| 253 | * @param UINT32** [out] imagePtr - pointer to the image in memory |
| 254 | * @param UINT32* [out] imageSize - size (in 32-bit words) of image |
| 255 | * |
| 256 | * This function examines the header of the microcode image library for the location |
| 257 | * and size of the specified image. |
| 258 | * |
| 259 | * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED. |
| 260 | * It will be removed in a future release. |
| 261 | * See API header file IxNpeDl.h for more information. |
| 262 | * |
| 263 | * @pre |
| 264 | * |
| 265 | * @post |
| 266 | * |
| 267 | * @return |
| 268 | * - IX_SUCCESS if the operation was successful |
| 269 | * - IX_FAIL otherwise |
| 270 | */ |
| 271 | IX_STATUS |
| 272 | ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId, |
| 273 | UINT32 **imagePtr, |
| 274 | UINT32 *imageSize); |
| 275 | |
| 276 | /** |
| 277 | * @fn IX_STATUS ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId) |
| 278 | * |
| 279 | * @brief Finds the most recent version of an image in the NPE image library. |
| 280 | * |
| 281 | * @param IxNpeDlImageId* [inout] imageId - the id of the image |
| 282 | * |
| 283 | * This function determines the most recent version of a specified image by its |
| 284 | * higest major release and minor revision numbers |
| 285 | * |
| 286 | * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED. |
| 287 | * It will be removed in a future release. |
| 288 | * See API header file IxNpeDl.h for more information. |
| 289 | * |
| 290 | * @pre |
| 291 | * |
| 292 | * @post |
| 293 | * |
| 294 | * @return |
| 295 | * - IX_SUCCESS if the operation was successful |
| 296 | * - IX_FAIL otherwise |
| 297 | */ |
| 298 | IX_STATUS |
| 299 | ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId); |
| 300 | |
| 301 | /** |
| 302 | * @fn void ixNpeDlImageMgrStatsShow (void) |
| 303 | * |
| 304 | * @brief This function will display the statistics of the IxNpeDl ImageMgr |
| 305 | * module |
| 306 | * |
| 307 | * @return none |
| 308 | */ |
| 309 | void |
| 310 | ixNpeDlImageMgrStatsShow (void); |
| 311 | |
| 312 | |
| 313 | /** |
| 314 | * @fn void ixNpeDlImageMgrStatsReset (void) |
| 315 | * |
| 316 | * @brief This function will reset the statistics of the IxNpeDl ImageMgr |
| 317 | * module |
| 318 | * |
| 319 | * @return none |
| 320 | */ |
| 321 | void |
| 322 | ixNpeDlImageMgrStatsReset (void); |
| 323 | |
| 324 | |
| 325 | /** |
| 326 | * @fn IX_STATUS ixNpeDlImageMgrImageGet (UINT32 *imageLibrary, |
| 327 | UINT32 imageId, |
| 328 | UINT32 **imagePtr, |
| 329 | UINT32 *imageSize) |
| 330 | * |
| 331 | * @brief Finds a image block in the NPE microcode image library. |
| 332 | * |
| 333 | * @param UINT32* [in] imageLibrary - the image library to use |
| 334 | * @param UINT32 [in] imageId - the id of the image to locate |
| 335 | * @param UINT32** [out] imagePtr - pointer to the image in memory |
| 336 | * @param UINT32* [out] imageSize - size (in 32-bit words) of image |
| 337 | * |
| 338 | * This function examines the header of the specified microcode image library |
| 339 | * for the location and size of the specified image. It returns a pointer to |
| 340 | * the image in the <i>imagePtr</i> parameter. |
| 341 | * If no image library is specified (imageLibrary == NULL), then the default |
| 342 | * built-in image library will be used. |
| 343 | * |
| 344 | * @pre |
| 345 | * |
| 346 | * @post |
| 347 | * |
| 348 | * @return |
| 349 | * - IX_SUCCESS if the operation was successful |
| 350 | * - IX_FAIL otherwise |
| 351 | */ |
| 352 | IX_STATUS |
| 353 | ixNpeDlImageMgrImageFind (UINT32 *imageLibrary, |
| 354 | UINT32 imageId, |
| 355 | UINT32 **imagePtr, |
| 356 | UINT32 *imageSize); |
| 357 | |
| 358 | |
| 359 | #endif /* IXNPEDLIMAGEMGR_P_H */ |
| 360 | |
| 361 | /** |
| 362 | * @} defgroup IxNpeDlImageMgr_p |
| 363 | */ |