| 1 |
/* |
| 2 |
* SPDX-License-Identifier: Apache-2.0 |
| 3 |
* Copyright (C) 2019-2024 Intel Corporation |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* @file igsc_lib.h |
| 8 |
* @brief Intel Graphics System Controller Library API |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef __IGSC_LIB_H__ |
| 12 |
#define __IGSC_LIB_H__ |
| 13 |
|
| 14 |
#ifdef __cplusplus |
| 15 |
extern "C" { |
| 16 |
#endif |
| 17 |
|
| 18 |
/** @cond INTERNAL_HIDDEN */ |
| 19 |
#ifndef IN |
| 20 |
#define IN |
| 21 |
#endif /* IN */ |
| 22 |
#ifndef OUT |
| 23 |
#define OUT |
| 24 |
#endif /* OUT */ |
| 25 |
|
| 26 |
#if defined(_WIN32) || defined(_WIN64) |
| 27 |
#ifndef IGSC_DLL |
| 28 |
#define IGSC_EXPORT |
| 29 |
#else /* IGSC_DLL */ |
| 30 |
#ifdef IGSC_DLL_EXPORTS |
| 31 |
#define IGSC_EXPORT __declspec(dllexport) |
| 32 |
#else |
| 33 |
#define IGSC_EXPORT __declspec(dllimport) |
| 34 |
#endif |
| 35 |
#endif /* IGSC_DLL */ |
| 36 |
#else |
| 37 |
#ifndef IGSC_DLL |
| 38 |
#define IGSC_EXPORT |
| 39 |
#else /* IGSC_DLL */ |
| 40 |
#ifdef IGSC_DLL_EXPORTS |
| 41 |
#define IGSC_EXPORT __attribute__((__visibility__("default"))) |
| 42 |
#else |
| 43 |
#define IGSC_EXPORT |
| 44 |
#endif |
| 45 |
#endif /* IGSC_DLL */ |
| 46 |
#endif |
| 47 |
/** @endcond */ |
| 48 |
|
| 49 |
#include <stdbool.h> |
| 50 |
#include <stddef.h> |
| 51 |
#include <stdint.h> |
| 52 |
|
| 53 |
#ifndef BIT |
| 54 |
#define BIT(x) (1U << (x)) |
| 55 |
#endif /* BIT */ |
| 56 |
|
| 57 |
#ifndef UNUSED_VAR |
| 58 |
#define UNUSED_VAR(_v) (void)_v |
| 59 |
#endif |
| 60 |
|
| 61 |
/** |
| 62 |
* A file descriptor |
| 63 |
* @typedef igsc_handle_t |
| 64 |
* @n |
| 65 |
* Under Linux: file descriptor int fd = open(2) |
| 66 |
* @n |
| 67 |
* Under Windows: HANDLE handle = CreateFile() |
| 68 |
*/ |
| 69 |
#ifdef __linux__ |
| 70 |
typedef int igsc_handle_t; |
| 71 |
#define IGSC_INVALID_DEVICE_HANDLE (-1) |
| 72 |
#else /* __linux__ */ |
| 73 |
typedef void *igsc_handle_t; |
| 74 |
#define IGSC_INVALID_DEVICE_HANDLE ((void *)0) |
| 75 |
#endif /* __linux__ */ |
| 76 |
|
| 77 |
/** |
| 78 |
* types of supported log levels |
| 79 |
*/ |
| 80 |
enum igsc_log_level_type { |
| 81 |
IGSC_LOG_LEVEL_ERROR = 0, /**< Errors only */ |
| 82 |
IGSC_LOG_LEVEL_DEBUG = 1, /**< Debug messages and errors */ |
| 83 |
IGSC_LOG_LEVEL_TRACE = 2, /**< Trace, debug messages and errors */ |
| 84 |
IGSC_LOG_LEVEL_MAX = 3, /**< Upper boundary */ |
| 85 |
}; |
| 86 |
|
| 87 |
/** |
| 88 |
* @brief Sets log level |
| 89 |
* |
| 90 |
* @param log_level log level to set |
| 91 |
* |
| 92 |
* @return void |
| 93 |
*/ |
| 94 |
IGSC_EXPORT |
| 95 |
void igsc_set_log_level(unsigned int log_level); |
| 96 |
|
| 97 |
/** |
| 98 |
* @brief Retrieves current log level |
| 99 |
* |
| 100 |
* @return current log level |
| 101 |
*/ |
| 102 |
IGSC_EXPORT |
| 103 |
unsigned int igsc_get_log_level(void); |
| 104 |
|
| 105 |
/** |
| 106 |
* types of supported update images |
| 107 |
*/ |
| 108 |
enum igsc_image_type { |
| 109 |
IGSC_IMAGE_TYPE_UNKNOWN = 0, /**< Unknown image type */ |
| 110 |
IGSC_IMAGE_TYPE_GFX_FW, /**< GSC Firmware image */ |
| 111 |
IGSC_IMAGE_TYPE_OPROM, /**< OPROM CODA an DATA combined image */ |
| 112 |
IGSC_IMAGE_TYPE_OPROM_CODE, /**< OPROM code image */ |
| 113 |
IGSC_IMAGE_TYPE_OPROM_DATA, /**< OPROM data image */ |
| 114 |
IGSC_IMAGE_TYPE_FW_DATA, /**< firmware data image */ |
| 115 |
}; |
| 116 |
|
| 117 |
/** |
| 118 |
* Structure to store fw version data |
| 119 |
*/ |
| 120 |
struct igsc_fw_version { |
| 121 |
char project[4]; /**< Project code name */ |
| 122 |
uint16_t hotfix; /**< FW Hotfix Number */ |
| 123 |
uint16_t build; /**< FW Build Number */ |
| 124 |
}; |
| 125 |
|
| 126 |
/** |
| 127 |
* Structure to store ifr binary version data |
| 128 |
*/ |
| 129 |
struct igsc_ifr_bin_version { |
| 130 |
uint16_t major; /**< IFR Binary Major Number */ |
| 131 |
uint16_t minor; /**< IFR Binary Minor Number */ |
| 132 |
uint16_t hotfix; /**< IFR Binary Hotfix Number */ |
| 133 |
uint16_t build; /**< IFR Binary Build Number */ |
| 134 |
}; |
| 135 |
|
| 136 |
/** |
| 137 |
* Structure to store psc version data |
| 138 |
*/ |
| 139 |
struct igsc_psc_version { |
| 140 |
uint32_t date; /**< PSC date */ |
| 141 |
uint32_t cfg_version; /**< PSC configuration version */ |
| 142 |
}; |
| 143 |
|
| 144 |
#define IGSC_MAX_OEM_VERSION_LENGTH 256 |
| 145 |
|
| 146 |
/** |
| 147 |
* Structure to store oem version data |
| 148 |
*/ |
| 149 |
struct igsc_oem_version { |
| 150 |
uint16_t length; /**< actual OEM version length */ |
| 151 |
uint8_t version[IGSC_MAX_OEM_VERSION_LENGTH]; /**< buffer to store oem version */ |
| 152 |
}; |
| 153 |
|
| 154 |
/** |
| 155 |
* versions comparison results |
| 156 |
*/ |
| 157 |
enum igsc_version_compare_result { |
| 158 |
IGSC_VERSION_ERROR = 0, /**< An internal error during comparison */ |
| 159 |
IGSC_VERSION_NOT_COMPATIBLE = 1, /**< cannot compare, the update image is for a different platform */ |
| 160 |
IGSC_VERSION_NEWER = 2, /**< update image version is newer than the one on the device */ |
| 161 |
IGSC_VERSION_EQUAL = 3, /**< update image version is equal to the one on the device */ |
| 162 |
IGSC_VERSION_OLDER = 4, /**< update image version is older than the one on the device */ |
| 163 |
}; |
| 164 |
|
| 165 |
/** |
| 166 |
* fwdata versions comparison results |
| 167 |
*/ |
| 168 |
enum igsc_fwdata_version_compare_result { |
| 169 |
IGSC_FWDATA_VERSION_REJECT_VCN = 0, /**< VCN version is bigger than device VCN */ |
| 170 |
IGSC_FWDATA_VERSION_REJECT_OEM_MANUF_DATA_VERSION = 1, /**< OEM manufacturing data version is not bigger than device OEM version or equal in ver2 comparison */ |
| 171 |
IGSC_FWDATA_VERSION_REJECT_DIFFERENT_PROJECT = 2, /**< major version is different from device major version */ |
| 172 |
IGSC_FWDATA_VERSION_ACCEPT = 3, /**< update image VCN version is equal than the one on the device, and OEM is bigger */ |
| 173 |
IGSC_FWDATA_VERSION_OLDER_VCN = 4, /**< update image VCN version is smaller than the one on the device */ |
| 174 |
IGSC_FWDATA_VERSION_REJECT_WRONG_FORMAT = 5, /**< the version format is the wrong one or incompatible */ |
| 175 |
IGSC_FWDATA_VERSION_REJECT_ARB_SVN = 6, /**< update image SVN version is smaller than the one on the device */ |
| 176 |
}; |
| 177 |
|
| 178 |
/** |
| 179 |
* Structure to store OEM manufacturing data version and data major VCN |
| 180 |
* for GSC in-field data firmware update image |
| 181 |
*/ |
| 182 |
struct igsc_fwdata_version { |
| 183 |
uint32_t oem_manuf_data_version; /**< GSC in-field data firmware OEM manufacturing data version */ |
| 184 |
uint16_t major_version; /**< GSC in-field data firmware major version */ |
| 185 |
uint16_t major_vcn; /**< GSC in-field data firmware major VCN */ |
| 186 |
}; |
| 187 |
|
| 188 |
#define IGSC_FWDATA_FORMAT_VERSION_1 0x1 |
| 189 |
#define IGSC_FWDATA_FORMAT_VERSION_2 0x2 |
| 190 |
|
| 191 |
#define IGSC_FWDATA_FITB_VALID_MASK 0x1 |
| 192 |
|
| 193 |
/** |
| 194 |
* Structure to store versions |
| 195 |
* for GSC in-field data firmware update image (version 2) |
| 196 |
*/ |
| 197 |
struct igsc_fwdata_version2 { |
| 198 |
uint32_t format_version; /**< GSC in-field data firmware version format */ |
| 199 |
uint32_t oem_manuf_data_version; /**< GSC in-field data firmware OEM manufacturing data version */ |
| 200 |
uint32_t oem_manuf_data_version_fitb; /**< GSC in-field data firmware OEM manufacturing data version from FITB */ |
| 201 |
uint16_t major_version; /**< GSC in-field data firmware major version */ |
| 202 |
uint16_t major_vcn; /**< GSC in-field data firmware major VCN */ |
| 203 |
uint32_t flags; /**< GSC in-field data firmware flags */ |
| 204 |
uint32_t data_arb_svn; /**< GSC in-field data firmware SVN */ |
| 205 |
uint32_t data_arb_svn_fitb; /**< GSC in-field data firmware SVN from FITB */ |
| 206 |
}; |
| 207 |
|
| 208 |
/** |
| 209 |
* OPROM partition version size in bytes |
| 210 |
*/ |
| 211 |
#define IGSC_OPROM_VER_SIZE 8 |
| 212 |
/** |
| 213 |
* Structure to store OPROM version data |
| 214 |
*/ |
| 215 |
struct igsc_oprom_version { |
| 216 |
uint8_t version[IGSC_OPROM_VER_SIZE]; /**< OPROM Version string */ |
| 217 |
}; |
| 218 |
|
| 219 |
/** |
| 220 |
* OPROM partition type |
| 221 |
*/ |
| 222 |
enum igsc_oprom_type { |
| 223 |
IGSC_OPROM_NONE = 0, /**< OPROM INVALID PARTITION */ |
| 224 |
IGSC_OPROM_DATA = 0x01, /**< OPROM data (VBT) */ |
| 225 |
IGSC_OPROM_CODE = 0x02, /**< OPROM code (VBIOS and GOP) */ |
| 226 |
}; |
| 227 |
|
| 228 |
/** |
| 229 |
* subsystem vendor and device id support by the OPROM image |
| 230 |
* as defined by PCI. |
| 231 |
*/ |
| 232 |
struct igsc_oprom_device_info { |
| 233 |
uint16_t subsys_vendor_id; /**< subsystem vendor id */ |
| 234 |
uint16_t subsys_device_id; /**< subsystem device id */ |
| 235 |
}; |
| 236 |
|
| 237 |
/** |
| 238 |
* vendor and device id, subsystem vendor and device id support by |
| 239 |
* the GSC in-field data firmware update image as defined by PCI. |
| 240 |
*/ |
| 241 |
struct igsc_oprom_device_info_4ids { |
| 242 |
uint16_t vendor_id; /**< vendor id */ |
| 243 |
uint16_t device_id; /**< device id */ |
| 244 |
uint16_t subsys_vendor_id; /**< subsystem vendor id */ |
| 245 |
uint16_t subsys_device_id; /**< subsystem device id */ |
| 246 |
}; |
| 247 |
|
| 248 |
/** |
| 249 |
* vendor and device id, subsystem vendor and device id support by |
| 250 |
* the GSC in-field data firmware update image as defined by PCI. |
| 251 |
*/ |
| 252 |
struct igsc_fwdata_device_info { |
| 253 |
uint16_t vendor_id; /**< vendor id */ |
| 254 |
uint16_t device_id; /**< device id */ |
| 255 |
uint16_t subsys_vendor_id; /**< subsystem vendor id */ |
| 256 |
uint16_t subsys_device_id; /**< subsystem device id */ |
| 257 |
}; |
| 258 |
|
| 259 |
/** |
| 260 |
* @struct igsc_oprom_image |
| 261 |
* opaque struct for oprom image handle |
| 262 |
*/ |
| 263 |
struct igsc_oprom_image; |
| 264 |
|
| 265 |
/** |
| 266 |
* @struct igsc_fwdata_image |
| 267 |
* opaque struct for fw data image handle |
| 268 |
*/ |
| 269 |
struct igsc_fwdata_image; |
| 270 |
|
| 271 |
/** |
| 272 |
* opaque structure representing device lookup context |
| 273 |
*/ |
| 274 |
struct igsc_device_iterator; |
| 275 |
|
| 276 |
/** |
| 277 |
* A device node path (Linux) or device instance path (Windows) Length |
| 278 |
*/ |
| 279 |
#define IGSC_INFO_NAME_SIZE 256 |
| 280 |
|
| 281 |
/** |
| 282 |
* Structure to store GSC device info |
| 283 |
*/ |
| 284 |
struct igsc_device_info { |
| 285 |
char name[IGSC_INFO_NAME_SIZE]; /**< the device node path */ |
| 286 |
|
| 287 |
uint16_t domain; /**< pci domain for GFX device */ |
| 288 |
uint8_t bus; /**< pci bus number for GFX device */ |
| 289 |
uint8_t dev; /**< device number on pci bus */ |
| 290 |
uint8_t func; /**< device function number */ |
| 291 |
|
| 292 |
uint16_t device_id; /**< gfx device id */ |
| 293 |
uint16_t vendor_id; /**< gfx device vendor id */ |
| 294 |
uint16_t subsys_device_id; /**< gfx device subsystem device id */ |
| 295 |
uint16_t subsys_vendor_id; /**< gfx device subsystem vendor id */ |
| 296 |
}; |
| 297 |
|
| 298 |
/** |
| 299 |
* @name IGSC_ERRORS |
| 300 |
* The Library return codes |
| 301 |
* @addtogroup IGSC_ERRORS |
| 302 |
* @{ |
| 303 |
*/ |
| 304 |
#define IGSC_ERROR_BASE 0x0000U /**< Error Base */ |
| 305 |
#define IGSC_SUCCESS (IGSC_ERROR_BASE + 0) /**< Success */ |
| 306 |
#define IGSC_ERROR_INTERNAL (IGSC_ERROR_BASE + 1) /**< Internal Error */ |
| 307 |
#define IGSC_ERROR_NOMEM (IGSC_ERROR_BASE + 2) /**< Memory Allocation Failed */ |
| 308 |
#define IGSC_ERROR_INVALID_PARAMETER (IGSC_ERROR_BASE + 3) /**< Invalid parameter was provided */ |
| 309 |
#define IGSC_ERROR_DEVICE_NOT_FOUND (IGSC_ERROR_BASE + 4) /**< Requested device was not found */ |
| 310 |
#define IGSC_ERROR_BAD_IMAGE (IGSC_ERROR_BASE + 5) /**< Provided image has wrong format */ |
| 311 |
#define IGSC_ERROR_PROTOCOL (IGSC_ERROR_BASE + 6) /**< Error in the update protocol */ |
| 312 |
#define IGSC_ERROR_BUFFER_TOO_SMALL (IGSC_ERROR_BASE + 7) /**< Provided buffer is too small */ |
| 313 |
#define IGSC_ERROR_INVALID_STATE (IGSC_ERROR_BASE + 8) /**< Invalid library internal state */ |
| 314 |
#define IGSC_ERROR_NOT_SUPPORTED (IGSC_ERROR_BASE + 9) /**< Unsupported request */ |
| 315 |
#define IGSC_ERROR_INCOMPATIBLE (IGSC_ERROR_BASE + 10) /**< Incompatible request */ |
| 316 |
#define IGSC_ERROR_TIMEOUT (IGSC_ERROR_BASE + 11) /**< The operation has timed out */ |
| 317 |
#define IGSC_ERROR_PERMISSION_DENIED (IGSC_ERROR_BASE + 12) /**< The process doesn't have access rights */ |
| 318 |
#define IGSC_ERROR_BUSY (IGSC_ERROR_BASE + 13) /**< Device is currently busy, try again later */ |
| 319 |
/** |
| 320 |
* @} |
| 321 |
*/ |
| 322 |
|
| 323 |
/** |
| 324 |
* Hardware configuration blob size |
| 325 |
*/ |
| 326 |
#define IGSC_HW_CONFIG_BLOB_SIZE 48 |
| 327 |
|
| 328 |
/** |
| 329 |
* @brief structure to store hw configuration |
| 330 |
* @param format_version version of the hw config |
| 331 |
* @param blob hardware configuration data |
| 332 |
*/ |
| 333 |
struct igsc_hw_config { |
| 334 |
uint32_t format_version; |
| 335 |
uint8_t blob[IGSC_HW_CONFIG_BLOB_SIZE]; |
| 336 |
}; |
| 337 |
|
| 338 |
/** |
| 339 |
* @brief structure to store device subsystem ids |
| 340 |
* @param ssvid subsystem vendor id |
| 341 |
* @param ssdid subsystem device id |
| 342 |
*/ |
| 343 |
struct igsc_subsystem_ids { |
| 344 |
uint16_t ssvid; |
| 345 |
uint16_t ssdid; |
| 346 |
}; |
| 347 |
|
| 348 |
/** |
| 349 |
* @def IGSC_MAX_IMAGE_SIZE |
| 350 |
* @brief Maximum firmware image size |
| 351 |
*/ |
| 352 |
#define IGSC_MAX_IMAGE_SIZE (8 * 1024 * 1024) /* 8M */ |
| 353 |
|
| 354 |
struct igsc_lib_ctx; |
| 355 |
|
| 356 |
/** |
| 357 |
* Structure to store GSC FU device data |
| 358 |
*/ |
| 359 |
struct igsc_device_handle { |
| 360 |
struct igsc_lib_ctx *ctx; /**< Internal library context */ |
| 361 |
}; |
| 362 |
|
| 363 |
/** |
| 364 |
* @addtogroup firmware_status |
| 365 |
* @{ |
| 366 |
*/ |
| 367 |
|
| 368 |
/** |
| 369 |
* @brief Return the last firmware status code. |
| 370 |
* |
| 371 |
* @param handle A handle to the device. |
| 372 |
* |
| 373 |
* @return last firmware status code. |
| 374 |
*/ |
| 375 |
IGSC_EXPORT |
| 376 |
uint32_t igsc_get_last_firmware_status(IN struct igsc_device_handle *handle); |
| 377 |
|
| 378 |
/** |
| 379 |
* @brief Return the firmware status message corresponding to the code. |
| 380 |
* |
| 381 |
* @param firmware_status code of firmware status |
| 382 |
* |
| 383 |
* @return firmware status message corresponding to the code. |
| 384 |
*/ |
| 385 |
IGSC_EXPORT |
| 386 |
const char *igsc_translate_firmware_status(IN uint32_t firmware_status); |
| 387 |
|
| 388 |
#define IGSC_MAX_FW_STATUS_INDEX 5 |
| 389 |
|
| 390 |
/** |
| 391 |
* @brief Read firmware status register |
| 392 |
* |
| 393 |
* @param handle A handle to the device. |
| 394 |
* @param fwsts_index index of the firmware status register (0..IGSC_MAX_FW_STATUS_INDEX) |
| 395 |
* @param fwsts_value returned firmware status values |
| 396 |
* |
| 397 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 398 |
*/ |
| 399 |
IGSC_EXPORT |
| 400 |
int igsc_read_fw_status_reg(IN struct igsc_device_handle *handle, |
| 401 |
IN uint32_t fwsts_index, |
| 402 |
OUT uint32_t *fwsts_value); |
| 403 |
|
| 404 |
/** |
| 405 |
* @brief Callback function template for printing igsc log messages. |
| 406 |
* |
| 407 |
* @param log_level log level of the error message. |
| 408 |
* @param fmt log message format |
| 409 |
* @param ... variadic parameters |
| 410 |
*/ |
| 411 |
typedef void (*igsc_log_func_t)(enum igsc_log_level_type log_level, const char *fmt, ...); |
| 412 |
|
| 413 |
/** |
| 414 |
* @brief Sets log callback function. |
| 415 |
* This interface is not thread-aware, |
| 416 |
* Changes here may lead to crashes in multi-thread app |
| 417 |
* when the thread setting callback exists without setting this |
| 418 |
* call-back function to NULL while other thread from same app continues to run. |
| 419 |
* |
| 420 |
* @param log_callback_f pointer to the callback function for igsc library log messages. |
| 421 |
* passing NULL to this will disable logging callback function. |
| 422 |
* @return void. |
| 423 |
*/ |
| 424 |
IGSC_EXPORT |
| 425 |
void igsc_set_log_callback_func(IN igsc_log_func_t log_callback_f); |
| 426 |
|
| 427 |
/** |
| 428 |
* @brief Retrieves log callback function pointer |
| 429 |
* |
| 430 |
* @return log callback function pointer |
| 431 |
*/ |
| 432 |
IGSC_EXPORT |
| 433 |
igsc_log_func_t igsc_get_log_callback_func(void); |
| 434 |
|
| 435 |
/** |
| 436 |
* @brief Initializes a GSC Firmware Update device. |
| 437 |
* |
| 438 |
* @param handle A handle to the device. All subsequent calls to the lib's |
| 439 |
* functions must be with this handle. |
| 440 |
* @param device_path A path to the device |
| 441 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 442 |
*/ |
| 443 |
IGSC_EXPORT |
| 444 |
int igsc_device_init_by_device(IN OUT struct igsc_device_handle *handle, |
| 445 |
IN const char *device_path); |
| 446 |
|
| 447 |
/** |
| 448 |
* @brief Initializes a GSC Firmware Update device. |
| 449 |
* |
| 450 |
* @param handle A handle to the device. All subsequent calls to the lib's |
| 451 |
* functions must be with this handle. |
| 452 |
* @param dev_handle An open device handle |
| 453 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 454 |
*/ |
| 455 |
int igsc_device_init_by_handle(IN OUT struct igsc_device_handle *handle, |
| 456 |
IN igsc_handle_t dev_handle); |
| 457 |
|
| 458 |
/** |
| 459 |
* @brief Initializes a GSC Firmware Update device. |
| 460 |
* |
| 461 |
* @param handle A handle to the device. All subsequent calls to the lib's |
| 462 |
* functions must be with this handle. |
| 463 |
* @param dev_info A device info structure |
| 464 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 465 |
*/ |
| 466 |
IGSC_EXPORT |
| 467 |
int igsc_device_init_by_device_info(IN OUT struct igsc_device_handle *handle, |
| 468 |
IN const struct igsc_device_info *dev_info); |
| 469 |
|
| 470 |
/** |
| 471 |
* @brief Retrieve device information from the system |
| 472 |
* |
| 473 |
* @param handle An initialized handle to the device. |
| 474 |
* @param dev_info A device info structure |
| 475 |
* |
| 476 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 477 |
*/ |
| 478 |
IGSC_EXPORT |
| 479 |
int igsc_device_get_device_info(IN struct igsc_device_handle *handle, |
| 480 |
OUT struct igsc_device_info *dev_info); |
| 481 |
|
| 482 |
/** |
| 483 |
* @brief Update device information from the firmware |
| 484 |
* The subsystem device id and the subsystem vendor id, |
| 485 |
* reported by the PCI system, may be different from the ones |
| 486 |
* reported by the firmware and so the device information |
| 487 |
* should be updated by with the values received from the firmware. |
| 488 |
* |
| 489 |
* @param handle An initialized handle to the device. |
| 490 |
* @param dev_info A device info structure |
| 491 |
* |
| 492 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 493 |
*/ |
| 494 |
IGSC_EXPORT |
| 495 |
int igsc_device_update_device_info(IN struct igsc_device_handle *handle, |
| 496 |
OUT struct igsc_device_info *dev_info); |
| 497 |
|
| 498 |
/** |
| 499 |
* @brief Closes a GSC Firmware Update device. |
| 500 |
* |
| 501 |
* @param handle A handle to the device. |
| 502 |
* |
| 503 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 504 |
*/ |
| 505 |
IGSC_EXPORT |
| 506 |
int igsc_device_close(IN OUT struct igsc_device_handle *handle); |
| 507 |
|
| 508 |
/** |
| 509 |
* @brief Retrieves the GSC Firmware Version from the device. |
| 510 |
* |
| 511 |
* @param handle A handle to the device. |
| 512 |
* @param version The memory to store obtained firmware version. |
| 513 |
* |
| 514 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 515 |
*/ |
| 516 |
IGSC_EXPORT |
| 517 |
int igsc_device_fw_version(IN struct igsc_device_handle *handle, |
| 518 |
OUT struct igsc_fw_version *version); |
| 519 |
|
| 520 |
/** |
| 521 |
* @brief Retrieves the Firmware Version from the provided |
| 522 |
* firmware update image. |
| 523 |
* |
| 524 |
* @param buffer A pointer to the buffer with the firmware update image. |
| 525 |
* @param buffer_len Length of the buffer with the firmware update image. |
| 526 |
* @param version The memory to store the obtained firmware version. |
| 527 |
* |
| 528 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 529 |
*/ |
| 530 |
IGSC_EXPORT |
| 531 |
int igsc_image_fw_version(IN const uint8_t *buffer, |
| 532 |
IN uint32_t buffer_len, |
| 533 |
OUT struct igsc_fw_version *version); |
| 534 |
|
| 535 |
/** |
| 536 |
* @brief Retrieves the hw configuration from the device |
| 537 |
* |
| 538 |
* @param handle A handle to the device. |
| 539 |
* @param hw_config The memory to store obtained the hardware configuration |
| 540 |
* |
| 541 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 542 |
* @return IGSC_ERROR_NOT_SUPPORTED if feature is not supported |
| 543 |
*/ |
| 544 |
IGSC_EXPORT |
| 545 |
int igsc_device_hw_config(IN struct igsc_device_handle *handle, |
| 546 |
OUT struct igsc_hw_config *hw_config); |
| 547 |
|
| 548 |
/** |
| 549 |
* @brief Retrieves the subsystem ids (vid/did) from the device |
| 550 |
* |
| 551 |
* @param handle A handle to the device. |
| 552 |
* @param ssids The memory to store obtained subsystem ids |
| 553 |
* |
| 554 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 555 |
* @return IGSC_ERROR_NOT_SUPPORTED if feature is not supported |
| 556 |
*/ |
| 557 |
IGSC_EXPORT |
| 558 |
int igsc_device_subsystem_ids(IN struct igsc_device_handle *handle, |
| 559 |
OUT struct igsc_subsystem_ids *ssids); |
| 560 |
|
| 561 |
/** |
| 562 |
* @brief Retrieves the hw configurations from the provided |
| 563 |
* firmware update image. |
| 564 |
* |
| 565 |
* @param buffer A pointer to the buffer with the firmware update image. |
| 566 |
* @param buffer_len Length of the buffer with the firmware update image. |
| 567 |
* @param hw_config The memory to store obtained the hardware configuration |
| 568 |
* |
| 569 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 570 |
*/ |
| 571 |
IGSC_EXPORT |
| 572 |
int igsc_image_hw_config(IN const uint8_t *buffer, |
| 573 |
IN uint32_t buffer_len, |
| 574 |
OUT struct igsc_hw_config *hw_config); |
| 575 |
|
| 576 |
/** |
| 577 |
* @brief Check whether image hardware configuration compatible with |
| 578 |
* device hardware configuration. |
| 579 |
* |
| 580 |
* @param image_hw_config Stores the image hardware configuration. |
| 581 |
* @param device_hw_config Stores the device hardware configuration. |
| 582 |
* |
| 583 |
* @return IGSC_SUCCESS if image hardware configuration compatible with device. |
| 584 |
*/ |
| 585 |
IGSC_EXPORT |
| 586 |
int igsc_hw_config_compatible(IN const struct igsc_hw_config *image_hw_config, |
| 587 |
IN const struct igsc_hw_config *device_hw_config); |
| 588 |
/** |
| 589 |
* @brief express hw configuration in a string |
| 590 |
* |
| 591 |
* @param hw_config Stores the hardware configuration. |
| 592 |
* @param buf to store the hw configuration in a printable null terminated string |
| 593 |
* @param length length of supplied buffer |
| 594 |
* |
| 595 |
* @return number of bytes in buffer excluding null terminator or < 0 on error |
| 596 |
*/ |
| 597 |
IGSC_EXPORT |
| 598 |
int igsc_hw_config_to_string(IN const struct igsc_hw_config *hw_config, |
| 599 |
IN char *buf, IN size_t length); |
| 600 |
|
| 601 |
/** |
| 602 |
* @brief Callback function template for monitor firmware update progress. |
| 603 |
* |
| 604 |
* @param sent Number of bytes sent to the firmware. |
| 605 |
* @param total Total number of bytes in firmware update image. |
| 606 |
* @param ctx Context provided by caller. |
| 607 |
*/ |
| 608 |
typedef void (*igsc_progress_func_t)(uint32_t sent, uint32_t total, void *ctx); |
| 609 |
|
| 610 |
/** |
| 611 |
* @brief Perform the firmware update from the provided firmware update image. |
| 612 |
* |
| 613 |
* @param handle A handle to the device. |
| 614 |
* @param buffer A pointer to the buffer with the firmware update image. |
| 615 |
* @param buffer_len Length of the buffer with the firmware update image. |
| 616 |
* @param progress_f Pointer to the callback function for firmware update |
| 617 |
* progress monitor. |
| 618 |
* @param ctx Context passed to progress_f function. |
| 619 |
* |
| 620 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 621 |
*/ |
| 622 |
IGSC_EXPORT int |
| 623 |
igsc_device_fw_update(IN struct igsc_device_handle *handle, |
| 624 |
IN const uint8_t *buffer, |
| 625 |
IN const uint32_t buffer_len, |
| 626 |
IN igsc_progress_func_t progress_f, |
| 627 |
IN void *ctx); |
| 628 |
|
| 629 |
/* flags with which the update should be performed */ |
| 630 |
struct igsc_fw_update_flags { |
| 631 |
uint32_t force_update : 1; |
| 632 |
uint32_t reserved : 31; |
| 633 |
}; |
| 634 |
|
| 635 |
/** |
| 636 |
* @brief Perform the firmware update with flags from the provided firmware update image. |
| 637 |
* |
| 638 |
* @param handle A handle to the device. |
| 639 |
* @param buffer A pointer to the buffer with the firmware update image. |
| 640 |
* @param buffer_len Length of the buffer with the firmware update image. |
| 641 |
* @param progress_f Pointer to the callback function for firmware update |
| 642 |
* progress monitor. |
| 643 |
* @param ctx Context passed to progress_f function. |
| 644 |
* @param flags flags with which the update should be performed |
| 645 |
* |
| 646 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 647 |
*/ |
| 648 |
IGSC_EXPORT int |
| 649 |
igsc_device_fw_update_ex(IN struct igsc_device_handle *handle, |
| 650 |
IN const uint8_t *buffer, |
| 651 |
IN const uint32_t buffer_len, |
| 652 |
IN igsc_progress_func_t progress_f, |
| 653 |
IN void *ctx, |
| 654 |
IN struct igsc_fw_update_flags flags); |
| 655 |
|
| 656 |
/** |
| 657 |
* @brief Perform Intel Accelerator Fabric Platform Specific |
| 658 |
* Configuration (PSC) update from the provided update data |
| 659 |
* image. |
| 660 |
* |
| 661 |
* @param handle A handle to the device. |
| 662 |
* @param buffer A pointer to the buffer with the PSC data update image. |
| 663 |
* @param buffer_len Length of the buffer with the PSC data update image. |
| 664 |
* @param progress_f Pointer to the callback function for data update |
| 665 |
* progress monitor. |
| 666 |
* @param ctx Context passed to progress_f function. |
| 667 |
* |
| 668 |
* @return |
| 669 |
* * IGSC_SUCCESS if successful |
| 670 |
* * otherwise error code. |
| 671 |
*/ |
| 672 |
IGSC_EXPORT int |
| 673 |
igsc_iaf_psc_update(IN struct igsc_device_handle *handle, |
| 674 |
IN const uint8_t *buffer, |
| 675 |
IN const uint32_t buffer_len, |
| 676 |
IN igsc_progress_func_t progress_f, |
| 677 |
IN void *ctx); |
| 678 |
|
| 679 |
/** |
| 680 |
* @brief Perform the GSC firmware in-field data update from the provided firmware update image. |
| 681 |
* |
| 682 |
* @param handle A handle to the device. |
| 683 |
* @param buffer A pointer to the buffer with the firmware in-field data update image. |
| 684 |
* @param buffer_len Length of the buffer with the firmware in-field data update image. |
| 685 |
* @param progress_f Pointer to the callback function for firmware update |
| 686 |
* progress monitor. |
| 687 |
* @param ctx Context passed to progress_f function. |
| 688 |
* |
| 689 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 690 |
*/ |
| 691 |
IGSC_EXPORT int |
| 692 |
igsc_device_fwdata_update(IN struct igsc_device_handle *handle, |
| 693 |
IN const uint8_t *buffer, |
| 694 |
IN const uint32_t buffer_len, |
| 695 |
IN igsc_progress_func_t progress_f, |
| 696 |
IN void *ctx); |
| 697 |
|
| 698 |
/** |
| 699 |
* @brief Perform the GSC firmware in-field data update from the provided firmware update image. |
| 700 |
* |
| 701 |
* @param handle A handle to the device. |
| 702 |
* @param img A pointer to the parsed firmware data image structure. |
| 703 |
* @param progress_f Pointer to the callback function for firmware update |
| 704 |
* progress monitor. |
| 705 |
* @param ctx Context passed to progress_f function. |
| 706 |
* |
| 707 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 708 |
*/ |
| 709 |
IGSC_EXPORT int |
| 710 |
igsc_device_fwdata_image_update(IN struct igsc_device_handle *handle, |
| 711 |
IN struct igsc_fwdata_image *img, |
| 712 |
IN igsc_progress_func_t progress_f, |
| 713 |
IN void *ctx); |
| 714 |
|
| 715 |
/** |
| 716 |
* @brief initializes firmware data image handle from the supplied firmware data update image. |
| 717 |
* |
| 718 |
* @param img firmware data image handle allocated by the function. |
| 719 |
* @param buffer A pointer to the buffer with the firmware data update image. |
| 720 |
* @param buffer_len Length of the buffer with the firmware data update image. |
| 721 |
* |
| 722 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 723 |
*/ |
| 724 |
IGSC_EXPORT |
| 725 |
int igsc_image_fwdata_init(IN OUT struct igsc_fwdata_image **img, |
| 726 |
IN const uint8_t *buffer, |
| 727 |
IN uint32_t buffer_len); |
| 728 |
|
| 729 |
/** |
| 730 |
* @brief Retrieves the GSC in-field data Firmware Version from the device. |
| 731 |
* |
| 732 |
* @param handle A handle to the device. |
| 733 |
* @param version The memory to store obtained firmware version. |
| 734 |
* |
| 735 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 736 |
*/ |
| 737 |
IGSC_EXPORT |
| 738 |
int igsc_device_fwdata_version(IN struct igsc_device_handle *handle, |
| 739 |
OUT struct igsc_fwdata_version *version); |
| 740 |
|
| 741 |
/** |
| 742 |
* @brief Retrieves the GSC in-field data Firmware Version from the device |
| 743 |
* With ability to return FW Data version in second version format. |
| 744 |
* |
| 745 |
* @param handle A handle to the device. |
| 746 |
* @param version The memory to store obtained firmware version. |
| 747 |
* |
| 748 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 749 |
*/ |
| 750 |
IGSC_EXPORT |
| 751 |
int igsc_device_fwdata_version2(IN struct igsc_device_handle *handle, |
| 752 |
OUT struct igsc_fwdata_version2 *version); |
| 753 |
|
| 754 |
/** |
| 755 |
* @brief Retrieves the GSC in-field data Firmware version from the supplied GSC in-field data Firmware update image. |
| 756 |
* |
| 757 |
* @param img GSC in-field data Firmware image handle |
| 758 |
* @param version The memory to store the obtained GSC in-field data Firmware version. |
| 759 |
* |
| 760 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 761 |
*/ |
| 762 |
IGSC_EXPORT |
| 763 |
int igsc_image_fwdata_version(IN struct igsc_fwdata_image *img, |
| 764 |
OUT struct igsc_fwdata_version *version); |
| 765 |
|
| 766 |
/** |
| 767 |
* @brief Retrieves the GSC in-field data Firmware version from the supplied GSC in-field data Firmware update image. |
| 768 |
* With ability to return FW Data version in second version format. |
| 769 |
* |
| 770 |
* @param img GSC in-field data Firmware image handle |
| 771 |
* @param version The memory to store the obtained GSC in-field data Firmware version. |
| 772 |
* |
| 773 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 774 |
*/ |
| 775 |
IGSC_EXPORT |
| 776 |
int igsc_image_fwdata_version2(IN struct igsc_fwdata_image *img, |
| 777 |
OUT struct igsc_fwdata_version2 *version); |
| 778 |
|
| 779 |
/** |
| 780 |
* @brief Compares input GSC in-field data firmware update version to the flash one |
| 781 |
* With ability to compare FW Data version in second version format. |
| 782 |
* |
| 783 |
* @param image_ver pointer to the GSC in-field data firmware update image version |
| 784 |
* @param device_ver pointer to the device GSC data firmware version |
| 785 |
* |
| 786 |
* @return |
| 787 |
* * IGSC_FWDATA_VERSION_REJECT_VCN if image VCN version is bigger than device VCN |
| 788 |
* * IGSC_FWDATA_VERSION_REJECT_OEM_MANUF_DATA_VERSION if OEM manufacturing data version is not bigger than device OEM version |
| 789 |
* * IGSC_FWDATA_VERSION_REJECT_DIFFERENT_PROJECT if major version is different from device major version |
| 790 |
* * IGSC_FWDATA_VERSION_ACCEPT if VCN version is equal to the device's one, and OEM is bigger |
| 791 |
* * IGSC_FWDATA_VERSION_OLDER_VCN if VCN version is smaller than the one on the device |
| 792 |
*/ |
| 793 |
IGSC_EXPORT |
| 794 |
uint8_t igsc_fwdata_version_compare(IN struct igsc_fwdata_version *image_ver, |
| 795 |
IN struct igsc_fwdata_version *device_ver); |
| 796 |
|
| 797 |
/** |
| 798 |
* @brief Compares input GSC in-field data firmware update version to the flash one |
| 799 |
* |
| 800 |
* @param image_ver pointer to the GSC in-field data firmware update image version |
| 801 |
* @param device_ver pointer to the device GSC data firmware version |
| 802 |
* |
| 803 |
* @return |
| 804 |
* * IGSC_FWDATA_VERSION_REJECT_VCN if image VCN version is bigger than device VCN |
| 805 |
* * IGSC_FWDATA_VERSION_REJECT_OEM_MANUF_DATA_VERSION if OEM manufacturing data version is not bigger than device OEM version or equal in ver2 comparison |
| 806 |
* * IGSC_FWDATA_VERSION_REJECT_DIFFERENT_PROJECT if major version is different from device major version |
| 807 |
* * IGSC_FWDATA_VERSION_ACCEPT if VCN version is equal to the device's one, and OEM is bigger |
| 808 |
* * IGSC_FWDATA_VERSION_OLDER_VCN if VCN version is smaller than the one on the device |
| 809 |
* * IGSC_FWDATA_VERSION_REJECT_WRONG_FORMAT if version format is the wrong one or incompatible |
| 810 |
* * IGSC_FWDATA_VERSION_REJECT_ARB_SVN if update image SVN version is smaller than the one on the device |
| 811 |
*/ |
| 812 |
IGSC_EXPORT |
| 813 |
uint8_t igsc_fwdata_version_compare2(IN struct igsc_fwdata_version2 *image_ver, |
| 814 |
IN struct igsc_fwdata_version2 *device_ver); |
| 815 |
|
| 816 |
/** |
| 817 |
* @brief Retrieves a count of of different devices supported |
| 818 |
* by the GSC in-field data firmware update image associated with the handle. |
| 819 |
* |
| 820 |
* @param img GSC in-field data firmware image handle |
| 821 |
* @param count the number of devices |
| 822 |
* |
| 823 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 824 |
*/ |
| 825 |
IGSC_EXPORT |
| 826 |
int igsc_image_fwdata_count_devices(IN struct igsc_fwdata_image *img, |
| 827 |
OUT uint32_t *count); |
| 828 |
|
| 829 |
/** |
| 830 |
* @brief Retrieves a list of supported devices |
| 831 |
* by the GSC in-field data firmware update image associated with the handle. |
| 832 |
* The caller supplies allocated buffer `devices` of |
| 833 |
* `count` size. The function returns `count` filled |
| 834 |
* with actually returned devices. |
| 835 |
* |
| 836 |
* @param img GSC in-field data firmware image handle |
| 837 |
* @param devices list of devices supported by the GSC in-field data firmware image |
| 838 |
* @param count in the number of devices allocated |
| 839 |
* |
| 840 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 841 |
*/ |
| 842 |
IGSC_EXPORT |
| 843 |
int igsc_image_fwdata_supported_devices(IN struct igsc_fwdata_image *img, |
| 844 |
OUT struct igsc_fwdata_device_info *devices, |
| 845 |
IN OUT uint32_t *count); |
| 846 |
/** |
| 847 |
* @brief check if GSC in-field data firmware image can be applied on the device. |
| 848 |
* |
| 849 |
* @param img GSC in-field data firmware image handle |
| 850 |
* @param device physical device info |
| 851 |
* |
| 852 |
* @return |
| 853 |
* * IGSC_SUCCESS if device is on the list of supported devices. |
| 854 |
* * IGSC_ERROR_DEVICE_NOT_FOUND otherwise. |
| 855 |
*/ |
| 856 |
IGSC_EXPORT |
| 857 |
int igsc_image_fwdata_match_device(IN struct igsc_fwdata_image *img, |
| 858 |
IN struct igsc_device_info *device); |
| 859 |
/** |
| 860 |
* @brief reset the iterator over supported devices |
| 861 |
* |
| 862 |
* @param img GSC in-field data firmware image handle |
| 863 |
* |
| 864 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 865 |
*/ |
| 866 |
IGSC_EXPORT |
| 867 |
int igsc_image_fwdata_iterator_reset(IN struct igsc_fwdata_image *img); |
| 868 |
|
| 869 |
/** |
| 870 |
* @brief progress the supported device iterator |
| 871 |
* and return the GSC in-field data firmware device info |
| 872 |
* |
| 873 |
* @param img GSC in-field data firmware image handle |
| 874 |
* @param device GSC in-field data firmware device information. |
| 875 |
* |
| 876 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 877 |
*/ |
| 878 |
IGSC_EXPORT |
| 879 |
int igsc_image_fwdata_iterator_next(IN struct igsc_fwdata_image *img, |
| 880 |
OUT struct igsc_fwdata_device_info *device); |
| 881 |
|
| 882 |
/** |
| 883 |
* @brief release the fwdata image handle |
| 884 |
* |
| 885 |
* @param img fwdata image handle |
| 886 |
* |
| 887 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 888 |
*/ |
| 889 |
IGSC_EXPORT |
| 890 |
int igsc_image_fwdata_release(IN struct igsc_fwdata_image *img); |
| 891 |
|
| 892 |
/** |
| 893 |
* @brief Compares input fw version to the flash one |
| 894 |
* |
| 895 |
* @param image_ver pointer to the update image version |
| 896 |
* @param device_ver pointer to the device version |
| 897 |
* |
| 898 |
* @return |
| 899 |
* * IGSC_VERSION_NOT_COMPATIBLE if update image is for a different platform |
| 900 |
* * IGSC_VERSION_NEWER if update image version is newer than the one on the device |
| 901 |
* * IGSC_VERSION_EQUAL if update image version is equal to the one on the device |
| 902 |
* * IGSC_VERSION_OLDER if update image version is older than the one on the device |
| 903 |
* * IGSC_VERSION_ERROR if NULL parameters were provided |
| 904 |
*/ |
| 905 |
IGSC_EXPORT |
| 906 |
uint8_t igsc_fw_version_compare(IN struct igsc_fw_version *image_ver, |
| 907 |
IN struct igsc_fw_version *device_ver); |
| 908 |
|
| 909 |
/** |
| 910 |
* @brief Retrieves the GSC OPROM version from the device. |
| 911 |
* |
| 912 |
* @param handle A handle to the device. |
| 913 |
* @param oprom_type An OPROM type requested @see enum igsc_oprom_type |
| 914 |
* @param version The memory to store obtained OPROM version. |
| 915 |
* |
| 916 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 917 |
*/ |
| 918 |
IGSC_EXPORT |
| 919 |
int igsc_device_oprom_version(IN struct igsc_device_handle *handle, |
| 920 |
IN uint32_t oprom_type, |
| 921 |
OUT struct igsc_oprom_version *version); |
| 922 |
|
| 923 |
/** |
| 924 |
* @brief Perform the OPROM update from the provided image. |
| 925 |
* |
| 926 |
* @param handle A handle to the device. |
| 927 |
* @param oprom_type OPROM part to update @see igsc_oprom_type |
| 928 |
* @param img A pointer to the parsed oprom image structure. |
| 929 |
* @param progress_f Pointer to the callback function for OPROM update |
| 930 |
* progress monitor. |
| 931 |
* @param ctx Context passed to progress_f function. |
| 932 |
* |
| 933 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 934 |
*/ |
| 935 |
IGSC_EXPORT |
| 936 |
int igsc_device_oprom_update(IN struct igsc_device_handle *handle, |
| 937 |
IN uint32_t oprom_type, |
| 938 |
IN struct igsc_oprom_image *img, |
| 939 |
IN igsc_progress_func_t progress_f, |
| 940 |
IN void *ctx); |
| 941 |
/** |
| 942 |
* @addtogroup oprom |
| 943 |
* @{ |
| 944 |
*/ |
| 945 |
|
| 946 |
/** |
| 947 |
* @brief initializes OPROM image handle from the supplied OPROM update image. |
| 948 |
* |
| 949 |
* @param img OPROM image handle allocated by the function. |
| 950 |
* @param buffer A pointer to the buffer with the OPROM update image. |
| 951 |
* @param buffer_len Length of the buffer with the OPROM update image. |
| 952 |
* |
| 953 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 954 |
*/ |
| 955 |
IGSC_EXPORT |
| 956 |
int igsc_image_oprom_init(IN OUT struct igsc_oprom_image **img, |
| 957 |
IN const uint8_t *buffer, |
| 958 |
IN uint32_t buffer_len); |
| 959 |
|
| 960 |
/** |
| 961 |
* @brief Retrieves the OPROM version from the supplied OPROM update image. |
| 962 |
* |
| 963 |
* @param img OPROM image handle |
| 964 |
* @param type OPROM image type @see enum igsc_oprom_type |
| 965 |
* @param version The memory to store the obtained OPROM version. |
| 966 |
* |
| 967 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 968 |
*/ |
| 969 |
IGSC_EXPORT |
| 970 |
int igsc_image_oprom_version(IN struct igsc_oprom_image *img, |
| 971 |
IN enum igsc_oprom_type type, |
| 972 |
OUT struct igsc_oprom_version *version); |
| 973 |
|
| 974 |
/** |
| 975 |
* @brief Retrieves the OPROM type from the provided OPROM update image. |
| 976 |
* |
| 977 |
* @param img OPROM image handle |
| 978 |
* @param oprom_type The variable to store obtained OPROM image type |
| 979 |
* @see enum igsc_oprom_type |
| 980 |
* |
| 981 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 982 |
*/ |
| 983 |
IGSC_EXPORT |
| 984 |
int igsc_image_oprom_type(IN struct igsc_oprom_image *img, |
| 985 |
IN uint32_t *oprom_type); |
| 986 |
|
| 987 |
/** |
| 988 |
* @brief Retrieves a count of of different devices supported |
| 989 |
* by the OPROM update image associated with the handle. |
| 990 |
* |
| 991 |
* @param img OPROM image handle |
| 992 |
* @param count the number of devices |
| 993 |
* |
| 994 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 995 |
*/ |
| 996 |
IGSC_EXPORT |
| 997 |
int igsc_image_oprom_count_devices(IN struct igsc_oprom_image *img, |
| 998 |
OUT uint32_t *count); |
| 999 |
|
| 1000 |
/** |
| 1001 |
* @brief Retrieves a list of supported devices |
| 1002 |
* by the OPROM update image associated with the handle. |
| 1003 |
* The caller supplies allocated buffer `devices` of |
| 1004 |
* `count` size. The function returns `count` filled |
| 1005 |
* with actually returned devices. |
| 1006 |
* |
| 1007 |
* @param img OPROM image handle |
| 1008 |
* @param devices list of devices supported by the OPROM image |
| 1009 |
* @param count in the number of devices allocated |
| 1010 |
* |
| 1011 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1012 |
*/ |
| 1013 |
IGSC_EXPORT |
| 1014 |
int igsc_image_oprom_supported_devices(IN struct igsc_oprom_image *img, |
| 1015 |
OUT struct igsc_oprom_device_info *devices, |
| 1016 |
IN OUT uint32_t *count); |
| 1017 |
/** |
| 1018 |
* @brief check if oprom image can be applied on the device. |
| 1019 |
* |
| 1020 |
* @param img OPROM image handle |
| 1021 |
* @param request_type type of oprom device to match |
| 1022 |
* @param device physical device info |
| 1023 |
* |
| 1024 |
* @return |
| 1025 |
* * IGSC_SUCCESS if device is on the list of supported devices. |
| 1026 |
* * IGSC_ERROR_DEVICE_NOT_FOUND otherwise. |
| 1027 |
*/ |
| 1028 |
IGSC_EXPORT |
| 1029 |
int igsc_image_oprom_match_device(IN struct igsc_oprom_image *img, |
| 1030 |
IN enum igsc_oprom_type request_type, |
| 1031 |
IN struct igsc_device_info *device); |
| 1032 |
/** |
| 1033 |
* @brief reset the iterator over supported devices |
| 1034 |
* |
| 1035 |
* @param img OPROM image handle |
| 1036 |
* |
| 1037 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1038 |
*/ |
| 1039 |
IGSC_EXPORT |
| 1040 |
int igsc_image_oprom_iterator_reset(IN struct igsc_oprom_image *img); |
| 1041 |
|
| 1042 |
/** |
| 1043 |
* @brief progress the supported device iterator |
| 1044 |
* and return the oprom device info |
| 1045 |
* |
| 1046 |
* @param img OPROM image handle |
| 1047 |
* @param device OPROM device information. |
| 1048 |
* |
| 1049 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1050 |
*/ |
| 1051 |
IGSC_EXPORT |
| 1052 |
int igsc_image_oprom_iterator_next(IN struct igsc_oprom_image *img, |
| 1053 |
OUT struct igsc_oprom_device_info *device); |
| 1054 |
|
| 1055 |
/** |
| 1056 |
* @brief Retrieves a count of of different devices supported |
| 1057 |
* by the OPROM update image associated with the handle, |
| 1058 |
* based on image type. |
| 1059 |
* |
| 1060 |
* @param img OPROM image handle |
| 1061 |
* @param request_type type of oprom device, enum igsc_oprom_type |
| 1062 |
* @param count the number of devices |
| 1063 |
* |
| 1064 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1065 |
*/ |
| 1066 |
IGSC_EXPORT |
| 1067 |
int igsc_image_oprom_count_devices_typed(IN struct igsc_oprom_image *img, |
| 1068 |
IN uint32_t request_type, |
| 1069 |
OUT uint32_t *count); |
| 1070 |
|
| 1071 |
/** |
| 1072 |
* @brief Retrieves a list of supported devices based on image type |
| 1073 |
* by the OPROM update image associated with the handle. |
| 1074 |
* The caller supplies allocated buffer `devices` of |
| 1075 |
* `count` size. The function returns `count` filled |
| 1076 |
* with actually returned devices. |
| 1077 |
* |
| 1078 |
* @param img OPROM image handle |
| 1079 |
* @param request_type type of oprom device, enum igsc_oprom_type |
| 1080 |
* @param devices list of devices supported by the OPROM image |
| 1081 |
* @param count in the number of devices allocated |
| 1082 |
* |
| 1083 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1084 |
*/ |
| 1085 |
IGSC_EXPORT |
| 1086 |
int igsc_image_oprom_supported_devices_typed(IN struct igsc_oprom_image *img, |
| 1087 |
IN uint32_t request_type, |
| 1088 |
OUT struct igsc_oprom_device_info_4ids *devices, |
| 1089 |
IN OUT uint32_t *count); |
| 1090 |
/** |
| 1091 |
* @brief reset the iterator over supported devices based on image type |
| 1092 |
* |
| 1093 |
* @param img OPROM image handle |
| 1094 |
* @param request_type type of oprom device, enum igsc_oprom_type |
| 1095 |
* |
| 1096 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1097 |
*/ |
| 1098 |
IGSC_EXPORT |
| 1099 |
int igsc_image_oprom_iterator_reset_typed(IN struct igsc_oprom_image *img, |
| 1100 |
IN uint32_t request_type); |
| 1101 |
|
| 1102 |
/** |
| 1103 |
* @brief progress the supported device iterator |
| 1104 |
* and return the oprom device info, based on image type |
| 1105 |
* |
| 1106 |
* @param img OPROM image handle |
| 1107 |
* @param request_type type of oprom device, enum igsc_oprom_type |
| 1108 |
* @param device OPROM device information. |
| 1109 |
* |
| 1110 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1111 |
*/ |
| 1112 |
IGSC_EXPORT |
| 1113 |
int igsc_image_oprom_iterator_next_typed(IN struct igsc_oprom_image *img, |
| 1114 |
IN uint32_t request_type, |
| 1115 |
OUT struct igsc_oprom_device_info_4ids *device); |
| 1116 |
|
| 1117 |
/** |
| 1118 |
* @brief returns whether the oprom image has 4ids device extension |
| 1119 |
* |
| 1120 |
* @param img OPROM image handle |
| 1121 |
* @param request_type type of oprom device |
| 1122 |
* @param has_4ids_extension whether the oprom image has 4ids device extension |
| 1123 |
* |
| 1124 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1125 |
*/ |
| 1126 |
IGSC_EXPORT |
| 1127 |
int igsc_image_oprom_has_4ids_extension(IN struct igsc_oprom_image *img, |
| 1128 |
IN uint32_t request_type, |
| 1129 |
OUT bool *has_4ids_extension); |
| 1130 |
|
| 1131 |
/** |
| 1132 |
* @brief returns whether the oprom image has 2ids device extension |
| 1133 |
* |
| 1134 |
* @param img OPROM image handle |
| 1135 |
* @param has_2ids_extension whether the oprom image has 2ids device extension |
| 1136 |
* |
| 1137 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1138 |
*/ |
| 1139 |
IGSC_EXPORT |
| 1140 |
int igsc_image_oprom_has_2ids_extension(IN struct igsc_oprom_image *img, |
| 1141 |
OUT bool *has_2ids_extension); |
| 1142 |
|
| 1143 |
/** |
| 1144 |
* @brief returns whether the oprom code config has devId enforcement bit set |
| 1145 |
* |
| 1146 |
* @param hw_config device hardware configuration. |
| 1147 |
* @param devid_enforced true when devId is enforced, false otherwise |
| 1148 |
* |
| 1149 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1150 |
*/ |
| 1151 |
IGSC_EXPORT |
| 1152 |
int igsc_image_oprom_code_devid_enforced(IN struct igsc_hw_config *hw_config, |
| 1153 |
OUT bool *devid_enforced); |
| 1154 |
|
| 1155 |
/** |
| 1156 |
* @brief release the OPROM image handle |
| 1157 |
* |
| 1158 |
* @param img OPROM image handle |
| 1159 |
* |
| 1160 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1161 |
*/ |
| 1162 |
IGSC_EXPORT |
| 1163 |
int igsc_image_oprom_release(IN struct igsc_oprom_image *img); |
| 1164 |
|
| 1165 |
/** |
| 1166 |
* @brief Compares input oprom version to the flash one |
| 1167 |
* |
| 1168 |
* @param image_ver pointer to the update image OPROM version |
| 1169 |
* @param device_ver pointer to the device OPROM version |
| 1170 |
* |
| 1171 |
* @return |
| 1172 |
* * IGSC_VERSION_NOT_COMPATIBLE if update image is for a different platform |
| 1173 |
* * IGSC_VERSION_NEWER if update image version is newer than the one on the device |
| 1174 |
* * IGSC_VERSION_EQUAL if update image version is equal to the one on the device |
| 1175 |
* * IGSC_VERSION_OLDER if update image version is older than the one on the device |
| 1176 |
* * IGSC_VERSION_ERROR if NULL parameters were provided |
| 1177 |
*/ |
| 1178 |
IGSC_EXPORT |
| 1179 |
uint8_t igsc_oprom_version_compare(const struct igsc_oprom_version *image_ver, |
| 1180 |
const struct igsc_oprom_version *device_ver); |
| 1181 |
/** |
| 1182 |
* @brief Determine the type of the provided image. |
| 1183 |
* |
| 1184 |
* @param buffer A pointer to the buffer with the image. |
| 1185 |
* @param buffer_len Length of the buffer with the image. |
| 1186 |
* @param type Type of the image (enum igsc_image_type). |
| 1187 |
* |
| 1188 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1189 |
*/ |
| 1190 |
IGSC_EXPORT |
| 1191 |
int igsc_image_get_type(IN const uint8_t *buffer, |
| 1192 |
IN const uint32_t buffer_len, |
| 1193 |
OUT uint8_t *type); |
| 1194 |
/** |
| 1195 |
* @} |
| 1196 |
*/ |
| 1197 |
|
| 1198 |
/** |
| 1199 |
* @addtogroup enumeration |
| 1200 |
* @{ |
| 1201 |
*/ |
| 1202 |
|
| 1203 |
/** |
| 1204 |
* @brief Create iterator for devices capable of FW update. |
| 1205 |
* |
| 1206 |
* @param iter pointer to return the iterator pointer |
| 1207 |
* |
| 1208 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1209 |
*/ |
| 1210 |
IGSC_EXPORT |
| 1211 |
int igsc_device_iterator_create(struct igsc_device_iterator **iter); |
| 1212 |
|
| 1213 |
/** |
| 1214 |
* @brief Obtain next devices capable of FW update. |
| 1215 |
* |
| 1216 |
* @param iter pointer to iterator. |
| 1217 |
* @param info pointer for device information. |
| 1218 |
* |
| 1219 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1220 |
*/ |
| 1221 |
IGSC_EXPORT |
| 1222 |
int igsc_device_iterator_next(struct igsc_device_iterator *iter, |
| 1223 |
struct igsc_device_info *info); |
| 1224 |
|
| 1225 |
/** |
| 1226 |
* @brief Free iterator for devices capable of FW update. |
| 1227 |
* |
| 1228 |
* @param iter pointer to iterator |
| 1229 |
* |
| 1230 |
* @return void |
| 1231 |
*/ |
| 1232 |
IGSC_EXPORT |
| 1233 |
void igsc_device_iterator_destroy(struct igsc_device_iterator *iter); |
| 1234 |
/** |
| 1235 |
* @} |
| 1236 |
*/ |
| 1237 |
|
| 1238 |
/** |
| 1239 |
* @addtogroup ifr |
| 1240 |
* @{ |
| 1241 |
*/ |
| 1242 |
|
| 1243 |
/** |
| 1244 |
* ifr tiles masks |
| 1245 |
*/ |
| 1246 |
enum igsc_ifr_tiles { |
| 1247 |
IGSC_IFR_TILE_0 = 0x0001, |
| 1248 |
IGSC_IFR_TILE_1 = 0x0002, |
| 1249 |
}; |
| 1250 |
|
| 1251 |
/** |
| 1252 |
* ifr supported test masks |
| 1253 |
*/ |
| 1254 |
enum igsc_supported_ifr_tests { |
| 1255 |
IGSC_IFR_SUPPORTED_TEST_SCAN = 0x00000001, |
| 1256 |
IGSC_IFR_SUPPORTED_TEST_ARRAY = 0x00000002, |
| 1257 |
}; |
| 1258 |
|
| 1259 |
/** |
| 1260 |
* ifr repairs masks |
| 1261 |
*/ |
| 1262 |
enum igsc_ifr_repairs { |
| 1263 |
IGSC_IFR_REPAIR_DSS_EN = 0x00000001, |
| 1264 |
IGSC_IFR_REPAIR_ARRAY = 0x00000002, |
| 1265 |
}; |
| 1266 |
|
| 1267 |
/** |
| 1268 |
* @name IGSC_IFR_RUN_TEST_STATUSES |
| 1269 |
* The IFR Run Test Command Statuses |
| 1270 |
* @addtogroup IGSC_IFR_RUN_TEST_STATUSES |
| 1271 |
* @{ |
| 1272 |
*/ |
| 1273 |
enum ifr_test_run_status { |
| 1274 |
IFR_TEST_STATUS_SUCCESS = 0, /**< Test passed successfully */ |
| 1275 |
IFR_TEST_STATUS_PASSED_WITH_REPAIR, /**< Test passed, recoverable error found and repaired. No subslice swap needed */ |
| 1276 |
IFR_TEST_STATUS_PASSED_WITH_RECOVERY, /**< Test passed, recoverable error found and repaired. Subslice swap needed. */ |
| 1277 |
IFR_TEST_STATUS_SUBSLICE_FAILURE, /**< Test completed, unrecoverable error found (Subslice failure and no spare Subslice available). */ |
| 1278 |
IFR_TEST_STATUS_NON_SUBSLICE_FAILURE, /**< Test completed, unrecoverable error found (non-Subslice failure). */ |
| 1279 |
IFR_TEST_STATUS_ERROR, /**< Test error */ |
| 1280 |
}; |
| 1281 |
|
| 1282 |
/** |
| 1283 |
* @brief Retrieves the status of GSC IFR device. |
| 1284 |
* |
| 1285 |
* @param handle A handle to the device. |
| 1286 |
* @param result Test result code |
| 1287 |
* @param supported_tests Bitmask holding the tests supported on the platform. |
| 1288 |
* @param ifr_applied Bitmask holding the in field repairs was applied during boot. |
| 1289 |
* @param tiles_num Number of tiles on the specific SOC. |
| 1290 |
* |
| 1291 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1292 |
*/ |
| 1293 |
IGSC_EXPORT |
| 1294 |
int igsc_ifr_get_status(IN struct igsc_device_handle *handle, |
| 1295 |
OUT uint8_t *result, |
| 1296 |
OUT uint32_t *supported_tests, |
| 1297 |
OUT uint32_t *ifr_applied, |
| 1298 |
OUT uint8_t *tiles_num); |
| 1299 |
|
| 1300 |
/** |
| 1301 |
* @brief Runs IFR test on GSC IFR device. |
| 1302 |
* |
| 1303 |
* @param handle A handle to the device. |
| 1304 |
* @param test_type Requested test to run |
| 1305 |
* @param result Test result code |
| 1306 |
* @param tiles Tiles on which to run the test |
| 1307 |
* @param run_status Test run status |
| 1308 |
* @param error_code The error code of the test that was run (0 - no error) |
| 1309 |
* |
| 1310 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1311 |
*/ |
| 1312 |
IGSC_EXPORT |
| 1313 |
int igsc_ifr_run_test(IN struct igsc_device_handle *handle, |
| 1314 |
IN uint8_t test_type, |
| 1315 |
IN uint8_t tiles, |
| 1316 |
OUT uint8_t *result, |
| 1317 |
OUT uint8_t *run_status, |
| 1318 |
OUT uint32_t *error_code); |
| 1319 |
/** |
| 1320 |
* @} |
| 1321 |
*/ |
| 1322 |
|
| 1323 |
/** |
| 1324 |
* @addtogroup gsfp |
| 1325 |
* @{ |
| 1326 |
*/ |
| 1327 |
|
| 1328 |
/** |
| 1329 |
* gfsp number of memory errors per tile |
| 1330 |
*/ |
| 1331 |
struct igsc_gfsp_tile_mem_err { |
| 1332 |
uint32_t corr_err; /**< Correctable memory errors on this boot and tile */ |
| 1333 |
uint32_t uncorr_err; /**< Uncorrectable memory errors on this boot and tile */ |
| 1334 |
}; |
| 1335 |
|
| 1336 |
/** |
| 1337 |
* gfsp number of memory errors on the card |
| 1338 |
*/ |
| 1339 |
struct igsc_gfsp_mem_err { |
| 1340 |
uint32_t num_of_tiles; /**< Number of entries in errors array (number of available entries |
| 1341 |
when passed to the function and number of filled entries when returned) */ |
| 1342 |
struct igsc_gfsp_tile_mem_err errors[]; /**< array of memory errors structs for each tile */ |
| 1343 |
}; |
| 1344 |
|
| 1345 |
/** |
| 1346 |
* @brief Gets number of tiles |
| 1347 |
* |
| 1348 |
* @param handle A handle to the device. |
| 1349 |
* @param max_num_of_tiles maximum number of tiles |
| 1350 |
* |
| 1351 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1352 |
*/ |
| 1353 |
IGSC_EXPORT |
| 1354 |
int igsc_gfsp_count_tiles(IN struct igsc_device_handle *handle, |
| 1355 |
OUT uint32_t *max_num_of_tiles); |
| 1356 |
|
| 1357 |
/** |
| 1358 |
* @brief Gets GFSP number of memory errors |
| 1359 |
* |
| 1360 |
* @param handle A handle to the device. |
| 1361 |
* @param tiles structure to store errors |
| 1362 |
* |
| 1363 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1364 |
*/ |
| 1365 |
IGSC_EXPORT |
| 1366 |
int igsc_gfsp_memory_errors(IN struct igsc_device_handle *handle, |
| 1367 |
IN OUT struct igsc_gfsp_mem_err *tiles); |
| 1368 |
|
| 1369 |
/** |
| 1370 |
* IFR pending reset values definition |
| 1371 |
*/ |
| 1372 |
enum igsc_ifr_pending_reset { |
| 1373 |
IGSC_IFR_PENDING_RESET_NONE = 0, /**< 0 - No reset needed */ |
| 1374 |
IGSC_IFR_PENDING_RESET_SHALLOW = 1, /**< 1 - Need to perform a shallow reset */ |
| 1375 |
IGSC_IFR_PENDING_RESET_DEEP = 2, /**< 2 - Need to perform a deep reset */ |
| 1376 |
}; |
| 1377 |
|
| 1378 |
/** |
| 1379 |
* IFR array and scan test status bit masks |
| 1380 |
*/ |
| 1381 |
enum igsc_ifr_array_scan_test_status_mask { |
| 1382 |
IGSC_ARRAY_SCAN_STATUS_TEST_EXECUTION_MASK = BIT(0), /**< 0 - Test executed, 1 - Test not executed */ |
| 1383 |
IGSC_ARRAY_SCAN_STATUS_TEST_RESULT_MASK = BIT(1), /**< 0 - Test finished successfully, 1 - Error occurred during test execution */ |
| 1384 |
IGSC_ARRAY_SCAN_STATUS_FOUND_HW_ERROR_MASK = BIT(2), /**< 0 - HW error not found, 1 - HW error found*/ |
| 1385 |
IGSC_ARRAY_SCAN_STATUS_HW_REPAIR_MASK = BIT(3), /**< 0 - HW error will be fully repaired or no HW error found, 1 - HW error will not be fully repaired */ |
| 1386 |
}; |
| 1387 |
|
| 1388 |
enum igsc_ifr_array_scan_extended_status { |
| 1389 |
IGSC_IFR_EXT_STS_PASSED = 0, /**< Test passed successfully, no repairs needed */ |
| 1390 |
IGSC_IFR_EXT_STS_SHALLOW_RST_PENDING = 1, /**< Shallow reset already pending from previous test, aborting test */ |
| 1391 |
IGSC_IFR_EXT_STS_DEEP_RST_PENDING = 2, /**< Deep reset already pending from previous test, aborting test */ |
| 1392 |
IGSC_IFR_EXT_STS_NO_REPAIR_NEEDED = 3, /**< Test passed, recoverable error found, no repair needed */ |
| 1393 |
IGSC_IFR_EXT_STS_REPAIRED_ARRAY = 4, /**< Test passed, recoverable error found and repaired using array repairs */ |
| 1394 |
IGSC_IFR_EXT_STS_REPAIRED_SUBSLICE = 5, /**< Test passed, recoverable error found and repaired using Subslice swaps */ |
| 1395 |
IGSC_IFR_EXT_STS_REPAIRED_ARRAY_SUBSLICE = 6, /**< Test passed, recoverable error found and repaired using array repairs and Subslice swaps */ |
| 1396 |
IGSC_IFR_EXT_STS_REPAIRED_ARRAY_FAULTY_SUBSLICE = 7, /**< Test passed, recoverable error found and repaired using array repairs and faulty spare Subslice */ |
| 1397 |
IGSC_IFR_EXT_STS_REPAIR_NOT_SUPPORTED = 8, /**< Test completed, unrecoverable error found, part doesn't support in field repair */ |
| 1398 |
IGSC_IFR_EXT_STS_NO_RESORCES = 9, /**< Test completed, unrecoverable error found, not enough repair resources available */ |
| 1399 |
IGSC_IFR_EXT_STS_NON_SUBSLICE_IN_ARRAY = 10, /**< Test completed, unrecoverable error found, non-Subslice failure in Array test */ |
| 1400 |
IGSC_IFR_EXT_STS_NON_SUBSLICE_IN_SCAN = 11, /**< Test completed, unrecoverable error found, non-Subslice failure in Scan test */ |
| 1401 |
IGSC_IFR_EXT_STS_TEST_ERROR = 12, /**< Test error */ |
| 1402 |
}; |
| 1403 |
|
| 1404 |
/** |
| 1405 |
* @brief Runs IFR Array and Scan tests on GSC IFR device. |
| 1406 |
* |
| 1407 |
* @param handle A handle to the device. |
| 1408 |
* @param status Test run status, @see enum igsc_ifr_array_scan_test_status_mask |
| 1409 |
* @param extended_status Test run extended status, @see enum igsc_ifr_array_scan_extended_status |
| 1410 |
* @param pending_reset Whether a reset is pending, @see enum igsc_ifr_pending_reset |
| 1411 |
* @param error_code The error code of the test (0 - no error) |
| 1412 |
* |
| 1413 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1414 |
*/ |
| 1415 |
IGSC_EXPORT |
| 1416 |
int igsc_ifr_run_array_scan_test(IN struct igsc_device_handle *handle, |
| 1417 |
OUT uint32_t *status, |
| 1418 |
OUT uint32_t *extended_status, |
| 1419 |
OUT uint32_t *pending_reset, |
| 1420 |
OUT uint32_t *error_code); |
| 1421 |
|
| 1422 |
/** |
| 1423 |
* @brief Runs IFR memory Post Package Repair (PPR) test on GSC IFR device. |
| 1424 |
* |
| 1425 |
* @param handle A handle to the device. |
| 1426 |
* @param status Test run status,0 - Test is available and will be run after a reset |
| 1427 |
* Other values - error |
| 1428 |
* @param pending_reset Whether a reset is pending, @see enum igsc_ifr_pending_reset |
| 1429 |
* @param error_code The error code of the test (0 - no error) |
| 1430 |
* |
| 1431 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1432 |
*/ |
| 1433 |
IGSC_EXPORT |
| 1434 |
int igsc_ifr_run_mem_ppr_test(IN struct igsc_device_handle *handle, |
| 1435 |
OUT uint32_t *status, |
| 1436 |
OUT uint32_t *pending_reset, |
| 1437 |
OUT uint32_t *error_code); |
| 1438 |
|
| 1439 |
/** |
| 1440 |
* IFR supported tests masks |
| 1441 |
*/ |
| 1442 |
enum igsc_ifr_supported_tests_masks { |
| 1443 |
IGSC_IFR_SUPPORTED_TESTS_ARRAY_AND_SCAN = BIT(0), /**< 1 - Array and Scan test */ |
| 1444 |
IGSC_IFR_SUPPORTED_TESTS_MEMORY_PPR = BIT(1), /**< 2 - Memory PPR */ |
| 1445 |
}; |
| 1446 |
|
| 1447 |
/** |
| 1448 |
* IFR hw capabilities masks |
| 1449 |
*/ |
| 1450 |
enum igsc_ifr_hw_capabilities_masks { |
| 1451 |
IGSC_IRF_HW_CAPABILITY_IN_FIELD_REPAIR = BIT(0), /**< 1: both in field tests and in field repairs are supported. */ |
| 1452 |
/**< 0: only in field tests are supported */ |
| 1453 |
IGSC_IRF_HW_CAPABILITY_FULL_EU_MODE_SWITCH = BIT(1), /**< 1: Full EU mode switch is supported */ |
| 1454 |
}; |
| 1455 |
|
| 1456 |
/** |
| 1457 |
* IFR previous errors masks |
| 1458 |
*/ |
| 1459 |
enum igsc_ifr_previous_errors_masks { |
| 1460 |
IGSC_IFR_PREV_ERROR_DSS_ERR_ARR_STS_PKT = BIT(0), /**< DSS Engine error in an array test status packet */ |
| 1461 |
IGSC_IFR_PREV_ERROR_NON_DSS_ERR_ARR_STS_PKT = BIT(1), /**< Non DSS Engine error in an array test status packet */ |
| 1462 |
IGSC_IFR_PREV_ERROR_DSS_REPAIRABLE_PKT = BIT(2), /**< DSS Repairable repair packet in an array test */ |
| 1463 |
IGSC_IFR_PREV_ERROR_DSS_UNREPAIRABLE_PKT = BIT(3), /**< DSS Unrepairable repair packet in an array test */ |
| 1464 |
IGSC_IFR_PREV_ERROR_NON_DSS_REPAIRABLE_PKT = BIT(4), /**< Non DSS Repairable repair packet in an array test */ |
| 1465 |
IGSC_IFR_PREV_ERROR_NON_DSS_UNREPAIRABLE_PKT = BIT(5), /**< Non DSS Unrepairable repair packet in an array test */ |
| 1466 |
IGSC_IFR_PREV_ERROR_DSS_ERR_SCAN_STS_PKT = BIT(6), /**< DSS failure in a scan test packet */ |
| 1467 |
IGSC_IFR_PREV_ERROR_NON_DSS_ERR_SCAN_STS_PKT = BIT(7), /**< Non DSS failure in a scan test packet */ |
| 1468 |
IGSC_IFR_PREV_ERROR_NOT_ENOUGH_SPARE_DSS = BIT(8), /**< Not enough spare DSS available */ |
| 1469 |
IGSC_IFR_PREV_ERROR_MIS_DSS_STS_PKT_ON_ARR = BIT(9), /**< Missing DSS status packet on array test */ |
| 1470 |
IGSC_IFR_PREV_ERROR_MIS_NON_DSS_STS_PKT_ON_ARR = BIT(10), /**< Missing non DSS status packet on array test */ |
| 1471 |
IGSC_IFR_PREV_ERROR_MIS_DSS_STS_PKT_ON_SCAN = BIT(11), /**< Missing DSS status packet on scan test */ |
| 1472 |
IGSC_IFR_PREV_ERROR_MIS_NON_DSS_STS_PKT_ON_SCAN = BIT(12), /**< Missing non DSS status packet on scan test */ |
| 1473 |
IGSC_IFR_PREV_ERROR_DSS_ENG_DONE_CLR_IN_ARR = BIT(13), /**< DSS Engine Done clear bit in array test status packet */ |
| 1474 |
IGSC_IFR_PREV_ERROR_NON_DSS_ENG_DONE_CLR_IN_ARR = BIT(14), /**< Non DSS Engine Done clear bit in array test status packet */ |
| 1475 |
IGSC_IFR_PREV_ERROR_UNEXPECTED = BIT(31), /**< Unexpected test failure */ |
| 1476 |
}; |
| 1477 |
|
| 1478 |
/** |
| 1479 |
* IFR repairs masks |
| 1480 |
*/ |
| 1481 |
enum igsc_ifr_repairs_mask { |
| 1482 |
IGSC_IFR_REPAIRS_MASK_DSS_EN_REPAIR = BIT(0), /**< DSS enable repair applied */ |
| 1483 |
IGSC_IFR_REPAIRS_MASK_ARRAY_REPAIR = BIT(1), /**< Array repair applied */ |
| 1484 |
IGSC_IFR_REPAIRS_MASK_FAILURE = BIT(2), /**< Repair failure occurred */ |
| 1485 |
}; |
| 1486 |
|
| 1487 |
/** |
| 1488 |
* @brief Retrieves the status of GSC IFR device. |
| 1489 |
* |
| 1490 |
* @param handle A handle to the device. |
| 1491 |
* @param supported_tests Bitmap holding the tests supported on the platform, |
| 1492 |
@see enum igsc_ifr_supported_tests_masks |
| 1493 |
* @param hw_capabilities Bitmap holdinf hw capabilities on the platform, |
| 1494 |
@see enum igsc_ifr_hw_capabilities_masks |
| 1495 |
* @param ifr_applied Bitmap holding the in-field-repairs applied during boot, |
| 1496 |
@see enum igsc_ifr_repairs_mask |
| 1497 |
* @param prev_errors Bitmap holding which errors were seen on this SOC in previous tests, |
| 1498 |
@see enum igsc_ifr_previous_errors_masks |
| 1499 |
* @param pending_reset Whether a reset is pending after running the test, |
| 1500 |
@see enum igsc_ifr_pending_reset |
| 1501 |
* |
| 1502 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1503 |
*/ |
| 1504 |
IGSC_EXPORT |
| 1505 |
int igsc_ifr_get_status_ext(IN struct igsc_device_handle *handle, |
| 1506 |
OUT uint32_t *supported_tests, |
| 1507 |
OUT uint32_t *hw_capabilities, |
| 1508 |
OUT uint32_t *ifr_applied, |
| 1509 |
OUT uint32_t *prev_errors, |
| 1510 |
OUT uint32_t *pending_reset); |
| 1511 |
|
| 1512 |
/** |
| 1513 |
* @brief Counts the IFR supported tiles. |
| 1514 |
* |
| 1515 |
* @param handle A handle to the device. |
| 1516 |
* @param supported_tiles Number of supported tiles |
| 1517 |
* |
| 1518 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1519 |
*/ |
| 1520 |
IGSC_EXPORT |
| 1521 |
int igsc_ifr_count_tiles(IN struct igsc_device_handle *handle, |
| 1522 |
OUT uint16_t *supported_tiles); |
| 1523 |
|
| 1524 |
/** |
| 1525 |
* @brief Retrieves the IFR repair info. |
| 1526 |
* |
| 1527 |
* @param handle A handle to the device. |
| 1528 |
* @param tile_idx The index of the tile the info is requested from |
| 1529 |
* @param used_array_repair_entries Number of array repair entries used by FW |
| 1530 |
* @param available_array_repair_entries Number of available array repair entries |
| 1531 |
* @param failed_dss Number of failed DSS |
| 1532 |
* |
| 1533 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1534 |
*/ |
| 1535 |
IGSC_EXPORT |
| 1536 |
int igsc_ifr_get_tile_repair_info(IN struct igsc_device_handle *handle, |
| 1537 |
IN uint16_t tile_idx, |
| 1538 |
OUT uint16_t *used_array_repair_entries, |
| 1539 |
OUT uint16_t *available_array_repair_entries, |
| 1540 |
OUT uint16_t *failed_dss); |
| 1541 |
/** |
| 1542 |
* @brief Set ECC Configuration |
| 1543 |
* |
| 1544 |
* @param handle A handle to the device. |
| 1545 |
* @param req_ecc_state Requested ECC State |
| 1546 |
* @param cur_ecc_state Current ECC State after command execution |
| 1547 |
* @param pen_ecc_state Pending ECC State after command execution |
| 1548 |
* |
| 1549 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1550 |
*/ |
| 1551 |
IGSC_EXPORT |
| 1552 |
int igsc_ecc_config_set(IN struct igsc_device_handle *handle, |
| 1553 |
IN uint8_t req_ecc_state, |
| 1554 |
OUT uint8_t *cur_ecc_state, |
| 1555 |
OUT uint8_t *pen_ecc_state); |
| 1556 |
|
| 1557 |
/** |
| 1558 |
* @brief Get ECC Configuration |
| 1559 |
* |
| 1560 |
* @param handle A handle to the device. |
| 1561 |
* @param cur_ecc_state Current ECC State |
| 1562 |
* @param pen_ecc_state Pending ECC State |
| 1563 |
* |
| 1564 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1565 |
*/ |
| 1566 |
IGSC_EXPORT |
| 1567 |
int igsc_ecc_config_get(IN struct igsc_device_handle *handle, |
| 1568 |
OUT uint8_t *cur_ecc_state, |
| 1569 |
OUT uint8_t *pen_ecc_state); |
| 1570 |
|
| 1571 |
/** |
| 1572 |
* @brief Retrieves the OEM Version from the device. |
| 1573 |
* |
| 1574 |
* @param handle A handle to the device. |
| 1575 |
* @param version The memory to store obtained OEM version. |
| 1576 |
* |
| 1577 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1578 |
*/ |
| 1579 |
IGSC_EXPORT |
| 1580 |
int igsc_device_oem_version(IN struct igsc_device_handle *handle, |
| 1581 |
OUT struct igsc_oem_version *version); |
| 1582 |
|
| 1583 |
/** |
| 1584 |
* @brief Retrieves the IFR Binary Version from the device. |
| 1585 |
* |
| 1586 |
* @param handle A handle to the device. |
| 1587 |
* @param version The memory to store obtained IFR binary version. |
| 1588 |
* |
| 1589 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1590 |
*/ |
| 1591 |
IGSC_EXPORT |
| 1592 |
int igsc_device_ifr_bin_version(IN struct igsc_device_handle *handle, |
| 1593 |
OUT struct igsc_ifr_bin_version *version); |
| 1594 |
|
| 1595 |
/** |
| 1596 |
* @brief Retrieves the PSC Version from the device. |
| 1597 |
* |
| 1598 |
* @param handle A handle to the device. |
| 1599 |
* @param version The memory to store obtained PSC version. |
| 1600 |
* |
| 1601 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1602 |
*/ |
| 1603 |
IGSC_EXPORT |
| 1604 |
int igsc_device_psc_version(IN struct igsc_device_handle *handle, |
| 1605 |
OUT struct igsc_psc_version *version); |
| 1606 |
|
| 1607 |
enum igsc_gfsp_health_indicators { |
| 1608 |
IGSC_HEALTH_INDICATOR_HEALTHY = 0, |
| 1609 |
IGSC_HEALTH_INDICATOR_DEGRADED = 1, |
| 1610 |
IGSC_HEALTH_INDICATOR_CRITICAL = 2, |
| 1611 |
IGSC_HEALTH_INDICATOR_REPLACE = 3 |
| 1612 |
}; |
| 1613 |
|
| 1614 |
/** |
| 1615 |
* @brief Gets memory health indicator |
| 1616 |
* |
| 1617 |
* @param handle A handle to the device. |
| 1618 |
* @param health_indicator contains pointer to @enum igsc_gfsp_health_indicators |
| 1619 |
* |
| 1620 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1621 |
*/ |
| 1622 |
IGSC_EXPORT |
| 1623 |
int igsc_gfsp_get_health_indicator(IN struct igsc_device_handle *handle, |
| 1624 |
OUT uint8_t *health_indicator); |
| 1625 |
|
| 1626 |
/** |
| 1627 |
* @brief Send generic GFSP command and receive response |
| 1628 |
* |
| 1629 |
* @param handle A handle to the device. |
| 1630 |
* @param gfsp_cmd command id |
| 1631 |
* @param in_buffer pointer to the input buffer |
| 1632 |
* @param in_buffer_size input buffer size |
| 1633 |
* @param out_buffer pointer to the output buffer |
| 1634 |
* @param out_buffer_size output buffer size |
| 1635 |
* @param actual_out_buffer_size pointer to the actual data size returned in the output buffer |
| 1636 |
* |
| 1637 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1638 |
*/ |
| 1639 |
IGSC_EXPORT |
| 1640 |
int igsc_gfsp_heci_cmd(struct igsc_device_handle *handle, uint32_t gfsp_cmd, |
| 1641 |
uint8_t *in_buffer, size_t in_buffer_size, |
| 1642 |
uint8_t *out_buffer, size_t out_buffer_size, |
| 1643 |
size_t *actual_out_buffer_size); |
| 1644 |
|
| 1645 |
/** |
| 1646 |
* Late Binding flags |
| 1647 |
*/ |
| 1648 |
enum csc_late_binding_flags { |
| 1649 |
CSC_LATE_BINDING_FLAGS_IS_PERSISTENT_MASK = 0x1, |
| 1650 |
}; |
| 1651 |
|
| 1652 |
/** |
| 1653 |
* Late Binding payload type |
| 1654 |
*/ |
| 1655 |
enum csc_late_binding_type { |
| 1656 |
CSC_LATE_BINDING_TYPE_INVALID = 0, |
| 1657 |
CSC_LATE_BINDING_TYPE_FAN_TABLE, |
| 1658 |
CSC_LATE_BINDING_TYPE_VR_CONFIG |
| 1659 |
}; |
| 1660 |
|
| 1661 |
/** |
| 1662 |
* Late Binding payload status |
| 1663 |
*/ |
| 1664 |
enum csc_late_binding_status { |
| 1665 |
CSC_LATE_BINDING_STATUS_SUCCESS = 0, |
| 1666 |
CSC_LATE_BINDING_STATUS_4ID_MISMATCH = 1, |
| 1667 |
CSC_LATE_BINDING_STATUS_ARB_FAILURE = 2, |
| 1668 |
CSC_LATE_BINDING_STATUS_GENERAL_ERROR = 3, |
| 1669 |
CSC_LATE_BINDING_STATUS_INVALID_PARAMS = 4, |
| 1670 |
CSC_LATE_BINDING_STATUS_INVALID_SIGNATURE = 5, |
| 1671 |
CSC_LATE_BINDING_STATUS_INVALID_PAYLOAD = 6, |
| 1672 |
CSC_LATE_BINDING_STATUS_TIMEOUT = 7, |
| 1673 |
}; |
| 1674 |
|
| 1675 |
/** |
| 1676 |
* @brief Sends Late Binding HECI command |
| 1677 |
* |
| 1678 |
* @param handle A handle to the device. |
| 1679 |
* @param type Late Binding payload type @enum csc_late_binding_type |
| 1680 |
* @param flags Late Binding flags to be sent to the firmware enum csc_late_binding_flags |
| 1681 |
* @param payload Late Binding data to be sent to the firmware |
| 1682 |
* @param payload_size Size of the payload data |
| 1683 |
* @param status Late Binding payload status @enum csc_late_binding_status |
| 1684 |
* |
| 1685 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1686 |
*/ |
| 1687 |
IGSC_EXPORT |
| 1688 |
int igsc_device_update_late_binding_config(IN struct igsc_device_handle *handle, |
| 1689 |
IN uint32_t type, /* enum csc_late_binding_type */ |
| 1690 |
IN uint32_t flags, /* enum csc_late_binding_flags */ |
| 1691 |
IN uint8_t *payload, IN size_t payload_size, |
| 1692 |
OUT uint32_t *status); /* enum csc_late_binding_status */ |
| 1693 |
/** |
| 1694 |
* @brief Sends ARB SVN Commit HECI command |
| 1695 |
* |
| 1696 |
* @param handle A handle to the device. |
| 1697 |
* @param fw_error An error returned by firmware in case of failure, can be NULL if not needed |
| 1698 |
* |
| 1699 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1700 |
*/ |
| 1701 |
IGSC_EXPORT |
| 1702 |
int igsc_device_commit_arb_svn(IN struct igsc_device_handle *handle, uint8_t *fw_error); |
| 1703 |
|
| 1704 |
/** |
| 1705 |
* @brief Retrieves Minimal allowed ARB SVN |
| 1706 |
* |
| 1707 |
* @param handle A handle to the device. |
| 1708 |
* @param min_allowed_svn buffer for minimal allowed ARB SVN value |
| 1709 |
* |
| 1710 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1711 |
*/ |
| 1712 |
IGSC_EXPORT |
| 1713 |
int igsc_device_get_min_allowed_arb_svn(IN struct igsc_device_handle *handle, |
| 1714 |
OUT uint8_t *min_allowed_svn); |
| 1715 |
|
| 1716 |
/** |
| 1717 |
* @} |
| 1718 |
*/ |
| 1719 |
|
| 1720 |
/** |
| 1721 |
* memory PPR status structures |
| 1722 |
*/ |
| 1723 |
|
| 1724 |
/** |
| 1725 |
* PPR test status bit masks |
| 1726 |
*/ |
| 1727 |
enum igsc_ppr_test_status_mask { |
| 1728 |
IGSC_PPR_STATUS_TEST_EXECUTED_MASK = 0x1, |
| 1729 |
IGSC_PPR_STATUS_TEST_SUCCESS_MASK = 0x2, |
| 1730 |
IGSC_PPR_STATUS_FOUND_HW_ERROR_MASK = 0x4, |
| 1731 |
IGSC_PPR_STATUS_HW_ERROR_REPAIRED_MASK = 0x8, |
| 1732 |
}; |
| 1733 |
|
| 1734 |
/** |
| 1735 |
* Device PPR status structure |
| 1736 |
*/ |
| 1737 |
struct igsc_device_mbist_ppr_status { |
| 1738 |
uint32_t mbist_test_status; /**< 0 – Pass, Any set bit represents that MBIST on the matching channel has failed */ |
| 1739 |
uint32_t num_of_ppr_fuses_used_by_fw; /**< Number of PPR fuses used by the firmware */ |
| 1740 |
uint32_t num_of_remaining_ppr_fuses; /**< Number of remaining PPR fuses */ |
| 1741 |
}; |
| 1742 |
|
| 1743 |
/** |
| 1744 |
* PPR status structure |
| 1745 |
*/ |
| 1746 |
struct igsc_ppr_status { |
| 1747 |
uint8_t boot_time_memory_correction_pending; /**< 0 - No pending boot time memory correction, */ |
| 1748 |
/**< 1 - Pending boot time memory correction */ |
| 1749 |
uint8_t ppr_mode; /**< 0 – PPR enabled, 1 – PPR disabled, 2 – PPR test mode, */ |
| 1750 |
/**< 3 – PPR auto run on next boot */ |
| 1751 |
uint8_t test_run_status; /**< test status @see enum igsc_ppr_test_status_mask */ |
| 1752 |
uint8_t reserved; |
| 1753 |
uint32_t ras_ppr_applied; /**< 0 - ppr not applied, 1 - ppr applied, 2 - ppr exhausted */ |
| 1754 |
uint32_t mbist_completed; /**< 0 - Not Applied, Any set bit represents mbist completed */ |
| 1755 |
uint32_t num_devices; /**< real number of devices in the array (on Xe_HP SDV, PVC <= 8) */ |
| 1756 |
struct igsc_device_mbist_ppr_status device_mbist_ppr_status[]; /**< Array of PPR statuses per device */ |
| 1757 |
}; |
| 1758 |
|
| 1759 |
/** |
| 1760 |
* @brief Retrieves GFSP number of memory PPR devices |
| 1761 |
* |
| 1762 |
* @param handle A handle to the device. |
| 1763 |
* @param device_count pointer to number of memory PPR devices, the number is returned by the FW |
| 1764 |
* |
| 1765 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1766 |
*/ |
| 1767 |
IGSC_EXPORT |
| 1768 |
int igsc_memory_ppr_devices(IN struct igsc_device_handle *handle, |
| 1769 |
OUT uint32_t *device_count); |
| 1770 |
|
| 1771 |
/** |
| 1772 |
* @brief Retrieves GFSP memory PPR status structure data |
| 1773 |
* |
| 1774 |
* @param handle A handle to the device. |
| 1775 |
* @param ppr_status pointer to PPR status structure, which contains num_devices field |
| 1776 |
* representing the number of allocated items in the device_mbist_ppr_status[] array. |
| 1777 |
* |
| 1778 |
* @return IGSC_SUCCESS if successful, otherwise error code. |
| 1779 |
*/ |
| 1780 |
IGSC_EXPORT |
| 1781 |
int igsc_memory_ppr_status(IN struct igsc_device_handle *handle, |
| 1782 |
OUT struct igsc_ppr_status *ppr_status); |
| 1783 |
|
| 1784 |
/** |
| 1785 |
* @} |
| 1786 |
*/ |
| 1787 |
#ifdef __cplusplus |
| 1788 |
} |
| 1789 |
#endif |
| 1790 |
#endif /* __IGSC_LIB_H__ */ |