Sync with latest ras-decode @bc6b43c (#770)

Signed-off-by: Oosman Saeed <oossaeed@amd.com>
Este commit está contenido en:
Saeed, Oosman
2025-10-27 14:10:00 -05:00
cometido por GitHub
padre 4bcc2ca598
commit 90f4b8c43d
Se han modificado 19 ficheros con 1871 adiciones y 2106 borrados
+50 -51
Ver fichero
@@ -23,9 +23,10 @@
#ifndef BOOT_DECODE_H
#define BOOT_DECODE_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "json_util.h"
#ifdef __cplusplus
@@ -36,7 +37,7 @@ extern "C" {
* @brief Boot message structure representing OAM boot message
*/
typedef struct {
uint64_t value; ///< 64-bit boot message value
uint64_t value; ///< 64-bit boot message value
} OamBootMsg;
/**
@@ -44,44 +45,44 @@ typedef struct {
* @param msg Boot message to decode
* @return JsonValue containing decoded information or NULL on failure
*/
typedef JsonValue* (*boot_decoder_func_t)(OamBootMsg *msg);
typedef JsonValue *(*boot_decoder_func_t)(OamBootMsg *msg);
/**
* @brief Decoder mapping entry
*/
typedef struct {
uint8_t encoding; ///< Error encoding value
boot_decoder_func_t decoder; ///< Decoder function
uint8_t encoding; ///< Error encoding value
boot_decoder_func_t decoder; ///< Decoder function
} boot_decoder_entry_t;
/**
* @brief Boot message constants
*/
#define BOOT_ERROR_PRESENT_MARKER 0xA4
#define BOOT_IN_BOOT_MARKER 0xBA
#define BOOT_SUCCESS_ENCODING 0xBA
#define BOOT_ERROR_PRESENT_MARKER 0xA4
#define BOOT_IN_BOOT_MARKER 0xBA
#define BOOT_SUCCESS_ENCODING 0xBA
/**
* @brief Error encoding constants
*/
#define BOOT_ENCODING_HBM_TRAINING 0x01
#define BOOT_ENCODING_FW_LOAD 0x04
#define BOOT_ENCODING_WAFL_LINK 0x05
#define BOOT_ENCODING_XGMI_LINK 0x06
#define BOOT_ENCODING_USR_CP_LINK 0x07
#define BOOT_ENCODING_USR_DP_LINK 0x08
#define BOOT_ENCODING_HBM_MEM_TEST 0x09
#define BOOT_ENCODING_HBM_BIST_TEST 0x0A
#define BOOT_ENCODING_BOOT_CTRL_GEN_V0 0x0B
#define BOOT_ENCODING_BOOT_CTRL_GEN_V1 0x0C
#define BOOT_ENCODING_DATA_ABORT 0x0D
#define BOOT_ENCODING_HBM_TRAINING 0x01
#define BOOT_ENCODING_FW_LOAD 0x04
#define BOOT_ENCODING_WAFL_LINK 0x05
#define BOOT_ENCODING_XGMI_LINK 0x06
#define BOOT_ENCODING_USR_CP_LINK 0x07
#define BOOT_ENCODING_USR_DP_LINK 0x08
#define BOOT_ENCODING_HBM_MEM_TEST 0x09
#define BOOT_ENCODING_HBM_BIST_TEST 0x0A
#define BOOT_ENCODING_BOOT_CTRL_GEN_V0 0x0B
#define BOOT_ENCODING_BOOT_CTRL_GEN_V1 0x0C
#define BOOT_ENCODING_DATA_ABORT 0x0D
/**
* @brief HBM stack decoder constants
*/
#define HBM_STACK_0 0x01
#define HBM_STACK_1 0x02
#define HBM_STACK_UNKNOWN -1
#define HBM_STACK_0 0x01
#define HBM_STACK_1 0x02
#define HBM_STACK_UNKNOWN -1
/**
* @brief Extract specific byte from 64-bit value
@@ -90,7 +91,7 @@ typedef struct {
* @return Extracted byte value
*/
static inline uint8_t extract_byte(uint64_t value, int byte_index) {
return (uint8_t)((value >> (byte_index * 8)) & 0xFF);
return (uint8_t)((value >> (byte_index * 8)) & 0xFF);
}
/**
@@ -98,9 +99,7 @@ static inline uint8_t extract_byte(uint64_t value, int byte_index) {
* @param num_bits Number of bits to extract
* @return Bit mask
*/
static inline uint32_t extract_bits(int num_bits) {
return (1U << num_bits) - 1;
}
static inline uint32_t extract_bits(int num_bits) { return (1U << num_bits) - 1; }
/**
* @brief Get boot version from boot message
@@ -159,7 +158,7 @@ int decode_hbm_stack(uint8_t stack);
* @param max_links Maximum number of links to check
* @return JsonValue array or NULL on failure
*/
JsonValue* create_failed_links_array(uint8_t byte_value, int max_links);
JsonValue *create_failed_links_array(uint8_t byte_value, int max_links);
/**
* @brief Create hex string representation
@@ -167,35 +166,35 @@ JsonValue* create_failed_links_array(uint8_t byte_value, int max_links);
* @param width Width of hex string (with padding)
* @return Dynamically allocated hex string or NULL on failure
*/
char* create_hex_string(uint64_t value, int width);
char *create_hex_string(uint64_t value, int width);
// Decoder functions for Version 0
JsonValue* decode_hbm_training_v0(OamBootMsg *msg);
JsonValue* decode_fw_load_v0(OamBootMsg *msg);
JsonValue* decode_wafl_link_training_v0(OamBootMsg *msg);
JsonValue* decode_xgmi_link_training_v0(OamBootMsg *msg);
JsonValue* decode_usr_cp_link_training_v0(OamBootMsg *msg);
JsonValue* decode_usr_dp_link_training_v0(OamBootMsg *msg);
JsonValue* decode_hbm_mem_test_v0(OamBootMsg *msg);
JsonValue* decode_hbm_bist_test_v0(OamBootMsg *msg);
JsonValue* decode_boot_controller_generic_v0(OamBootMsg *msg);
JsonValue *decode_hbm_training_v0(OamBootMsg *msg);
JsonValue *decode_fw_load_v0(OamBootMsg *msg);
JsonValue *decode_wafl_link_training_v0(OamBootMsg *msg);
JsonValue *decode_xgmi_link_training_v0(OamBootMsg *msg);
JsonValue *decode_usr_cp_link_training_v0(OamBootMsg *msg);
JsonValue *decode_usr_dp_link_training_v0(OamBootMsg *msg);
JsonValue *decode_hbm_mem_test_v0(OamBootMsg *msg);
JsonValue *decode_hbm_bist_test_v0(OamBootMsg *msg);
JsonValue *decode_boot_controller_generic_v0(OamBootMsg *msg);
// Decoder functions for Version 1
JsonValue* decode_hbm_training_v1(OamBootMsg *msg);
JsonValue* decode_fw_load_v1(OamBootMsg *msg);
JsonValue* decode_wafl_link_training_v1(OamBootMsg *msg);
JsonValue* decode_xgmi_link_training_v1(OamBootMsg *msg);
JsonValue* decode_usr_cp_link_training_v1(OamBootMsg *msg);
JsonValue* decode_usr_dp_link_training_v1(OamBootMsg *msg);
JsonValue* decode_hbm_mem_test_v1(OamBootMsg *msg);
JsonValue* decode_hbm_bist_test_v1(OamBootMsg *msg);
JsonValue* decode_boot_controller_generic_v1(OamBootMsg *msg);
JsonValue* decode_data_abort_v1(OamBootMsg *msg);
JsonValue* decode_boot_success_v1(OamBootMsg *msg);
JsonValue *decode_hbm_training_v1(OamBootMsg *msg);
JsonValue *decode_fw_load_v1(OamBootMsg *msg);
JsonValue *decode_wafl_link_training_v1(OamBootMsg *msg);
JsonValue *decode_xgmi_link_training_v1(OamBootMsg *msg);
JsonValue *decode_usr_cp_link_training_v1(OamBootMsg *msg);
JsonValue *decode_usr_dp_link_training_v1(OamBootMsg *msg);
JsonValue *decode_hbm_mem_test_v1(OamBootMsg *msg);
JsonValue *decode_hbm_bist_test_v1(OamBootMsg *msg);
JsonValue *decode_boot_controller_generic_v1(OamBootMsg *msg);
JsonValue *decode_data_abort_v1(OamBootMsg *msg);
JsonValue *decode_boot_success_v1(OamBootMsg *msg);
// Unhandled error decoders
JsonValue* decode_unhandled_error_v0(OamBootMsg *msg);
JsonValue* decode_unhandled_error_v1(OamBootMsg *msg);
JsonValue *decode_unhandled_error_v0(OamBootMsg *msg);
JsonValue *decode_unhandled_error_v1(OamBootMsg *msg);
/**
* @brief Get appropriate decoder function for boot message
@@ -210,7 +209,7 @@ boot_decoder_func_t get_decoder_function(OamBootMsg *msg);
* @param count Number of boot messages
* @return JsonValue object containing decoded results or NULL on failure
*/
JsonValue* boot_decode_orchestrator(uint64_t *oam_boot_msgs, size_t count);
JsonValue *boot_decode_orchestrator(const uint64_t *oam_boot_msgs, size_t count);
#ifdef __cplusplus
}