[SWDEV-553168] Add support for decoding out of band boot time CPER files.
Change-Id: Ic4278698f9c5b5ae56bd56fd43150c0653c1ef05
This commit is contained in:
1 bovenliggende
c4cad504be
commit
c6698c9100
28 files changed
+2438
-649
No files matched your search
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aca_decode.h
|
||||
* @brief Internal decoder interface and data structures
|
||||
*/
|
||||
#ifndef RAS_DECODE_DECODE_H
|
||||
#define RAS_DECODE_DECODE_H
|
||||
|
||||
#include "ras_decode_api.h"
|
||||
#include "aca_fields.h"
|
||||
#include "json_util.h"
|
||||
|
||||
/**
|
||||
* @brief Internal decoder structure with parsed register fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t aca_status; /**< Raw status register value */
|
||||
uint64_t aca_addr; /**< Raw address register value */
|
||||
uint64_t aca_ipid; /**< Raw IPID register value */
|
||||
uint64_t aca_synd; /**< Raw syndrome register value */
|
||||
uint32_t flags; /**< Decoder flags */
|
||||
uint16_t hw_revision; /**< Hardware hw_revision */
|
||||
|
||||
aca_status_fields_t status; /**< Parsed status fields */
|
||||
aca_ipid_fields_t ipid; /**< Parsed IPID fields */
|
||||
aca_synd_fields_t synd; /**< Parsed syndrome fields */
|
||||
} aca_decoder_t;
|
||||
|
||||
/**
|
||||
* @brief Structure containing raw ACA error data from hardware
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t aca_status; /**< Raw status register value */
|
||||
uint64_t aca_addr; /**< Raw address register value */
|
||||
uint64_t aca_ipid; /**< Raw IPID register value */
|
||||
uint64_t aca_synd; /**< Raw syndrome register value */
|
||||
uint32_t flags; /**< Flags from descriptor */
|
||||
uint16_t hw_revision; /**< Hardware hw_revision number */
|
||||
} aca_raw_data_t;
|
||||
|
||||
/**
|
||||
* @brief Main decode function that processes raw ACA error data and returns JSON
|
||||
* @param[in] raw_data Pointer to structure containing raw ACA error data
|
||||
* @return JsonValue* containing the decoded error information, or NULL on failure
|
||||
*/
|
||||
JsonValue* aca_decode(const aca_raw_data_t *raw_data);
|
||||
|
||||
#endif /* RAS_DECODE_DECODE_H */
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aca_fields.h
|
||||
* @brief ACA register field definitions and manipulation functions
|
||||
*
|
||||
* Contains structures and functions for decoding and handling
|
||||
* ACA register fields. It provides field
|
||||
* definitions for status, IPID, and syndrome registers, along with
|
||||
* functions to initialize and access these fields.
|
||||
*/
|
||||
#ifndef RAS_DECODE_FIELDS_H
|
||||
#define RAS_DECODE_FIELDS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Base structure for ACA fields containing raw register value
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t raw_value; /**< Raw 64-bit register value */
|
||||
} aca_fields_t;
|
||||
|
||||
/**
|
||||
* @brief Structure containing decoded ACA status register fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
aca_fields_t base;
|
||||
uint16_t error_code;
|
||||
uint8_t error_code_ext;
|
||||
uint8_t reserv22;
|
||||
uint8_t addr_lsb;
|
||||
uint8_t reserv30;
|
||||
uint8_t err_core_id;
|
||||
uint8_t reserv38;
|
||||
uint8_t scrub;
|
||||
uint8_t reserv41;
|
||||
uint8_t poison;
|
||||
uint8_t deferred;
|
||||
uint8_t uecc;
|
||||
uint8_t cecc;
|
||||
uint8_t reserv47;
|
||||
uint8_t synd_v;
|
||||
uint8_t reserv54;
|
||||
uint8_t tcc;
|
||||
uint8_t err_core_id_val;
|
||||
uint8_t pcc;
|
||||
uint8_t addr_v;
|
||||
uint8_t misc_v;
|
||||
uint8_t en;
|
||||
uint8_t uc;
|
||||
uint8_t overflow;
|
||||
uint8_t val;
|
||||
} aca_status_fields_t;
|
||||
|
||||
/**
|
||||
* @brief Structure containing decoded ACA IPID register fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
aca_fields_t base;
|
||||
uint32_t instance_id_lo;
|
||||
uint16_t hardware_id;
|
||||
uint16_t aca_type;
|
||||
uint8_t instance_id_hi;
|
||||
} aca_ipid_fields_t;
|
||||
|
||||
/**
|
||||
* @brief Structure containing decoded ACA syndrome register fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
aca_fields_t base;
|
||||
uint32_t error_information;
|
||||
uint8_t length;
|
||||
uint8_t error_priority;
|
||||
uint8_t reserved27;
|
||||
uint16_t syndrome;
|
||||
uint32_t reserved39;
|
||||
} aca_synd_fields_t;
|
||||
|
||||
/**
|
||||
* @brief Structure containing decoded ACA address register fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
aca_fields_t base;
|
||||
uint64_t error_addr;
|
||||
uint64_t reserved;
|
||||
} aca_addr_fields_t;
|
||||
|
||||
/**
|
||||
* @brief Reads the raw value from an ACA field structure
|
||||
* @param[in] fields Pointer to the ACA fields structure
|
||||
* @return The raw 64-bit value stored in the structure
|
||||
*/
|
||||
uint64_t aca_fields_read(const aca_fields_t *fields);
|
||||
|
||||
/**
|
||||
* @brief Initializes ACA status fields from a raw status register value
|
||||
* @param[out] fields Pointer to the status fields structure to initialize
|
||||
* @param[in] status_reg Raw 64-bit status register value
|
||||
*/
|
||||
void aca_status_init(aca_status_fields_t *fields, uint64_t status_reg);
|
||||
|
||||
/**
|
||||
* @brief Initializes ACA IPID fields from a raw IPID register value
|
||||
* @param[out] fields Pointer to the IPID fields structure to initialize
|
||||
* @param[in] ipid_reg Raw 64-bit IPID register value
|
||||
*/
|
||||
void aca_ipid_init(aca_ipid_fields_t *fields, uint64_t ipid_reg);
|
||||
|
||||
/**
|
||||
* @brief Initializes ACA syndrome fields from a raw syndrome register value
|
||||
* @param[out] fields Pointer to the syndrome fields structure to initialize
|
||||
* @param[in] synd_reg Raw 64-bit syndrome register value
|
||||
*/
|
||||
void aca_synd_init(aca_synd_fields_t *fields, uint64_t synd_reg);
|
||||
|
||||
/**
|
||||
* @brief Initializes ACA address fields from a raw address register value
|
||||
* @param[out] fields Pointer to the address fields structure to initialize
|
||||
* @param[in] addr_reg Raw 64-bit address register value
|
||||
*/
|
||||
void aca_addr_init(aca_addr_fields_t *fields, uint64_t addr_reg);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aca_tables.h
|
||||
* @brief ACA lookup table definitions and helper functions
|
||||
* @details Contains data structures and functions definitions for mapping ACA Registers
|
||||
* into their corresponding names and types.
|
||||
*/
|
||||
|
||||
#ifndef RAS_DECODE_TABLES_H
|
||||
#define RAS_DECODE_TABLES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @brief Structure mapping hardware ID and ACA type to bank names
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t hw_id; /**< Hardware ID value */
|
||||
uint16_t aca_type; /**< ACA type identifier */
|
||||
const char *name; /**< Bank name string */
|
||||
} aca_bank_entry_t;
|
||||
|
||||
/**
|
||||
* @brief Structure mapping bank-specific error codes to error types
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *bank; /**< Bank name string */
|
||||
uint32_t error_code; /**< Error code value */
|
||||
const char *type; /**< Error type string */
|
||||
} aca_error_type_t;
|
||||
|
||||
/**
|
||||
* @brief Structure for generic error code to error type mapping
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t error_code; /**< Error code value */
|
||||
const char *type; /**< Error type string */
|
||||
} aca_error_entry_t;
|
||||
|
||||
/**
|
||||
* @brief Structure mapping instance_id_hi to OAM and AID values
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t oam; /**< OAM value */
|
||||
uint8_t aid; /**< AID value */
|
||||
} oam_aid_map_t;
|
||||
|
||||
/**
|
||||
* @brief Structure for mapping bank and instance ID LO to instance name
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *bank; /**< Bank name */
|
||||
uint32_t instance_id_lo; /**< Instance ID Lo (masked with 0xFFFFFFFC) */
|
||||
const char *name; /**< Instance name */
|
||||
} aca_instance_entry_t;
|
||||
|
||||
// External table declarations
|
||||
extern const aca_bank_entry_t bank_table[];
|
||||
extern const aca_error_type_t error_table[];
|
||||
extern const aca_error_entry_t xcd_error_table[];
|
||||
extern const aca_error_entry_t aid_error_table[];
|
||||
|
||||
// Table size constants
|
||||
extern const size_t NUM_BANKS;
|
||||
extern const size_t NUM_ERRORS;
|
||||
extern const size_t NUM_XCD_ERRORS;
|
||||
extern const size_t NUM_AID_ERRORS;
|
||||
|
||||
/**
|
||||
* @brief Find bank name based on hardware ID and ACA type
|
||||
* @param[in] hw_id Hardware ID value
|
||||
* @param[in] aca_type ACA type value
|
||||
* @param[out] bank_name Pointer to store result string
|
||||
* @return 0 on success, 1 if not found, -1 on parameter error
|
||||
*/
|
||||
int find_bank_name(uint16_t hw_id, uint16_t aca_type, const char **bank_name);
|
||||
|
||||
/**
|
||||
* @brief Find error type for a specific bank and error code
|
||||
* @param[in] bank Bank name string
|
||||
* @param[in] error_code Error code value
|
||||
* @param[out] error_type Pointer to store result string
|
||||
* @return 0 on success, 1 if not found, -1 on parameter error
|
||||
*/
|
||||
int find_error_type_by_bank(const char *bank, uint32_t error_code, const char **error_type);
|
||||
|
||||
/**
|
||||
* @brief Generic lookup for error codes in an error table
|
||||
* @param[in] table Pointer to error table
|
||||
* @param[in] table_size Number of table entries
|
||||
* @param[in] error_code Error code to look up
|
||||
* @param[out] error_type Pointer to store result string
|
||||
* @return 0 on success, 1 if not found, -1 on parameter error
|
||||
*/
|
||||
int find_error_in_table(const aca_error_entry_t *table, size_t table_size,
|
||||
uint32_t error_code, const char **error_type);
|
||||
|
||||
/**
|
||||
* @brief Find OAM and AID values based on instance_id_hi
|
||||
* @param[in] instance_id_hi Instance ID low value (0x00-0x0F)
|
||||
* @param[out] oam_aid Pointer to store OAM and AID values
|
||||
* @return 0 on success, 1 if not found, -1 on parameter error
|
||||
*/
|
||||
int find_oam_aid(uint8_t instance_id_hi, oam_aid_map_t *oam_aid);
|
||||
|
||||
/**
|
||||
* @brief Find instance name based on bank and instance ID
|
||||
* @param[in] bank Bank name string
|
||||
* @param[in] instance_id_lo Instance ID (will be masked with 0xFFFFFFFC)
|
||||
* @param[out] instance_name Pointer to store result string
|
||||
* @return 0 on success, 1 if not found, -1 on parameter error
|
||||
*/
|
||||
int find_instance_name(const char *bank, uint32_t instance_id_lo, const char **instance_name);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef RAS_DECODE_VERSION_H
|
||||
#define RAS_DECODE_VERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief ACA Decoder Library Version Information
|
||||
*
|
||||
* This header defines version constants and functions for the ACA Decoder library.
|
||||
* Version follows Semantic Versioning (SemVer) specification: MAJOR.MINOR.PATCH
|
||||
*
|
||||
* - MAJOR: Incremented for incompatible API changes
|
||||
* - MINOR: Incremented for backward-compatible functionality additions
|
||||
* - PATCH: Incremented for backward-compatible bug fixes
|
||||
*/
|
||||
|
||||
/* Version Components */
|
||||
#define RAS_DECODE_VERSION_MAJOR 2 /**< Major version number */
|
||||
#define RAS_DECODE_VERSION_MINOR 0 /**< Minor version number */
|
||||
#define RAS_DECODE_VERSION_PATCH 0 /**< Patch version number */
|
||||
|
||||
/* Helper macros for string concatenation */
|
||||
#define RAS_DECODE_STRINGIFY(x) #x
|
||||
#define RAS_DECODE_TOSTRING(x) RAS_DECODE_STRINGIFY(x)
|
||||
|
||||
/* Version String - dynamically constructed from components */
|
||||
#define RAS_DECODE_VERSION_STRING \
|
||||
RAS_DECODE_TOSTRING(RAS_DECODE_VERSION_MAJOR) "." \
|
||||
RAS_DECODE_TOSTRING(RAS_DECODE_VERSION_MINOR) "." \
|
||||
RAS_DECODE_TOSTRING(RAS_DECODE_VERSION_PATCH)
|
||||
|
||||
/**
|
||||
* @brief Structure containing version information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int major; /**< Major version number */
|
||||
int minor; /**< Minor version number */
|
||||
int patch; /**< Patch version number */
|
||||
const char *string; /**< Version string (e.g., "1.0.0") */
|
||||
} aca_version_info_t;
|
||||
|
||||
/**
|
||||
* @brief Get the major version number
|
||||
* @return Major version number
|
||||
*/
|
||||
int aca_get_version_major(void);
|
||||
|
||||
/**
|
||||
* @brief Get the minor version number
|
||||
* @return Minor version number
|
||||
*/
|
||||
int aca_get_version_minor(void);
|
||||
|
||||
/**
|
||||
* @brief Get the patch version number
|
||||
* @return Patch version number
|
||||
*/
|
||||
int aca_get_version_patch(void);
|
||||
|
||||
/**
|
||||
* @brief Get the version string
|
||||
* @return Pointer to version string (e.g., "1.0.0")
|
||||
*/
|
||||
const char *aca_get_version_string(void);
|
||||
|
||||
/**
|
||||
* @brief Get complete version information
|
||||
* @return Structure containing all version information
|
||||
*/
|
||||
aca_version_info_t aca_get_version_info(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RAS_DECODE_VERSION_H */
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef BOOT_DECODE_H
|
||||
#define BOOT_DECODE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include "json_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Boot message structure representing OAM boot message
|
||||
*/
|
||||
typedef struct {
|
||||
uint64_t value; ///< 64-bit boot message value
|
||||
} OamBootMsg;
|
||||
|
||||
/**
|
||||
* @brief Decoder function pointer type
|
||||
* @param msg Boot message to decode
|
||||
* @return JsonValue containing decoded information or NULL on failure
|
||||
*/
|
||||
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
|
||||
} 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
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
/**
|
||||
* @brief HBM stack decoder constants
|
||||
*/
|
||||
#define HBM_STACK_0 0x01
|
||||
#define HBM_STACK_1 0x02
|
||||
#define HBM_STACK_UNKNOWN -1
|
||||
|
||||
/**
|
||||
* @brief Extract specific byte from 64-bit value
|
||||
* @param value 64-bit value
|
||||
* @param byte_index Byte index (0-7)
|
||||
* @return Extracted byte value
|
||||
*/
|
||||
static inline uint8_t extract_byte(uint64_t value, int byte_index) {
|
||||
return (uint8_t)((value >> (byte_index * 8)) & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Extract specific bits mask
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get boot version from boot message
|
||||
* @param msg Boot message
|
||||
* @return Boot version (0 or 1)
|
||||
*/
|
||||
int get_boot_version(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Get error encoding from boot message
|
||||
* @param msg Boot message
|
||||
* @return Error encoding value
|
||||
*/
|
||||
int get_error_encoding(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Check if error is present in boot message
|
||||
* @param msg Boot message
|
||||
* @return true if error present, false otherwise
|
||||
*/
|
||||
bool error_present(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Check if in boot mode
|
||||
* @param msg Boot message
|
||||
* @return true if in boot mode, false otherwise
|
||||
*/
|
||||
bool in_boot(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Get socket number from boot message
|
||||
* @param msg Boot message
|
||||
* @param version Boot version
|
||||
* @return Socket number
|
||||
*/
|
||||
int get_socket(OamBootMsg *msg, int version);
|
||||
|
||||
/**
|
||||
* @brief Get AID number from boot message
|
||||
* @param msg Boot message
|
||||
* @param version Boot version
|
||||
* @return AID number
|
||||
*/
|
||||
int get_aid(OamBootMsg *msg, int version);
|
||||
|
||||
/**
|
||||
* @brief Decode HBM stack value
|
||||
* @param stack Stack value
|
||||
* @return Decoded stack number or HBM_STACK_UNKNOWN
|
||||
*/
|
||||
int decode_hbm_stack(uint8_t stack);
|
||||
|
||||
/**
|
||||
* @brief Create JSON array of failed links
|
||||
* @param byte_value Byte containing link status bits
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @brief Create hex string representation
|
||||
* @param value Value to convert
|
||||
* @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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// Unhandled error decoders
|
||||
JsonValue* decode_unhandled_error_v0(OamBootMsg *msg);
|
||||
JsonValue* decode_unhandled_error_v1(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Get appropriate decoder function for boot message
|
||||
* @param msg Boot message
|
||||
* @return Decoder function pointer or NULL if no decoder found
|
||||
*/
|
||||
boot_decoder_func_t get_decoder_function(OamBootMsg *msg);
|
||||
|
||||
/**
|
||||
* @brief Orchestrate decoding of multiple boot messages
|
||||
* @param oam_boot_msgs Array of boot message values
|
||||
* @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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOOT_DECODE_H */
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ERROR_MAP_H
|
||||
#define ERROR_MAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Structure representing an error mapping entry
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t id;
|
||||
const char *error_category;
|
||||
const char *error_type;
|
||||
const char *method;
|
||||
const char *error_severity;
|
||||
} error_map_entry_t;
|
||||
|
||||
/**
|
||||
* @brief Get error ID based on category, type and severity
|
||||
* @param[in] error_category Error category string
|
||||
* @param[in] error_type Error type string
|
||||
* @param[in] error_severity Error severity string
|
||||
* @return Error ID if found, -1 if not found
|
||||
*/
|
||||
int get_error_id(const char *error_category, const char *error_type, const char *error_severity);
|
||||
|
||||
#endif /* ERROR_MAP_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef JSON_PRINTER_H
|
||||
#define JSON_PRINTER_H
|
||||
|
||||
#include "json_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Print a JSON value to stdout in formatted form
|
||||
* @param value JSON value to print
|
||||
*/
|
||||
void print_json_value(JsonValue *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* JSON_PRINTER_H */
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef JSON_UTIL_H
|
||||
#define JSON_UTIL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief JSON value types enumeration
|
||||
*/
|
||||
typedef enum {
|
||||
JSON_NULL,
|
||||
JSON_BOOL,
|
||||
JSON_NUMBER,
|
||||
JSON_STRING,
|
||||
JSON_OBJECT,
|
||||
JSON_ARRAY
|
||||
} JsonType;
|
||||
|
||||
typedef struct JsonValue JsonValue;
|
||||
typedef struct JsonPair JsonPair;
|
||||
|
||||
/**
|
||||
* @brief JSON key-value pair structure for objects
|
||||
*/
|
||||
struct JsonPair {
|
||||
char *key;
|
||||
JsonValue *value;
|
||||
JsonPair *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief JSON value structure
|
||||
*/
|
||||
struct JsonValue {
|
||||
JsonType type;
|
||||
union {
|
||||
bool boolean;
|
||||
double number;
|
||||
char *string;
|
||||
JsonPair *object; // Linked list of key-value pairs
|
||||
struct {
|
||||
JsonValue **items;
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
} array;
|
||||
} data;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create a null JSON value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_null(void);
|
||||
|
||||
/**
|
||||
* @brief Create a boolean JSON value
|
||||
* @param b Boolean value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_bool(bool b);
|
||||
|
||||
/**
|
||||
* @brief Create a number JSON value
|
||||
* @param num Numeric value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_number(double num);
|
||||
|
||||
/**
|
||||
* @brief Create a string JSON value
|
||||
* @param str String value (will be copied)
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_string(const char *str);
|
||||
|
||||
/**
|
||||
* @brief Create an empty JSON object
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_object(void);
|
||||
|
||||
/**
|
||||
* @brief Create an empty JSON array
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_array(void);
|
||||
|
||||
/**
|
||||
* @brief Add a key-value pair to a JSON object
|
||||
* @param obj JSON object to modify
|
||||
* @param key Key string (will be copied)
|
||||
* @param value Value to add
|
||||
*/
|
||||
void json_object_set(JsonValue *obj, const char *key, JsonValue *value);
|
||||
|
||||
/**
|
||||
* @brief Get a value by key from a JSON object
|
||||
* @param obj JSON object to search
|
||||
* @param key Key to search for
|
||||
* @return Pointer to JsonValue or NULL if not found
|
||||
*/
|
||||
JsonValue* json_object_get(JsonValue *obj, const char *key);
|
||||
|
||||
/**
|
||||
* @brief Check if a key exists in a JSON object
|
||||
* @param obj JSON object to check
|
||||
* @param key Key to check for
|
||||
* @return true if key exists, false otherwise
|
||||
*/
|
||||
bool json_object_has_key(JsonValue *obj, const char *key);
|
||||
|
||||
/**
|
||||
* @brief Add a value to a JSON array
|
||||
* @param arr JSON array to modify
|
||||
* @param value Value to add
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
bool json_array_push(JsonValue *arr, JsonValue *value);
|
||||
|
||||
/**
|
||||
* @brief Get a value by index from a JSON array
|
||||
* @param arr JSON array to access
|
||||
* @param index Array index
|
||||
* @return Pointer to JsonValue or NULL if index out of bounds
|
||||
*/
|
||||
JsonValue* json_array_get(JsonValue *arr, size_t index);
|
||||
|
||||
/**
|
||||
* @brief Get the size of a JSON array
|
||||
* @param arr JSON array
|
||||
* @return Number of elements in array, or 0 if not an array
|
||||
*/
|
||||
size_t json_array_size(JsonValue *arr);
|
||||
|
||||
/**
|
||||
* @brief Free a JSON value and all its contents
|
||||
* @param val JSON value to free
|
||||
*/
|
||||
void json_free(JsonValue *val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* JSON_UTIL_H */
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef RAS_DECODE_API_H
|
||||
#define RAS_DECODE_API_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "aca_version.h"
|
||||
#include "json_util.h"
|
||||
|
||||
/**
|
||||
* @brief Structure containing decoded error information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *bank_ref; /**< Reference to bank name string */
|
||||
const char *error_type_ref; /**< Reference to error type string */
|
||||
const char *severity_ref; /**< Reference to error severity string */
|
||||
const char *category_ref; /**< Reference to error category string */
|
||||
const char *instance_ref; /**< Reference to instance name string */
|
||||
int oam; /**< OAM value */
|
||||
int aid; /**< AID value */
|
||||
uint64_t raw_status; /**< Raw status register value */
|
||||
uint64_t raw_addr; /**< Raw address register value */
|
||||
uint64_t raw_ipid; /**< Raw IPID register value */
|
||||
uint64_t raw_synd; /**< Raw syndrome register value */
|
||||
uint8_t scrub; /**< Scrub bit from status */
|
||||
uint8_t poison; /**< Poison bit from status */
|
||||
uint8_t deferred; /**< Deferred bit from status */
|
||||
uint8_t error_code_ext; /**< Extended error code from status */
|
||||
} aca_error_info_t;
|
||||
|
||||
/**
|
||||
* @brief Decodes the AFID from a register array
|
||||
* @param[in] register_array Pointer to an array of 64-bit register values
|
||||
* @param[in] array_len Size of register array in elements
|
||||
* @param[in] flag Decoder flags
|
||||
* @param[in] hw_revision Hardware revision number
|
||||
* @param[in] register_context_type Register context type (16-bit): 1 for ACA decode, 9 for boot decode
|
||||
* @return AFID value or -1 if decoding fails
|
||||
*/
|
||||
int decode_afid(const uint64_t *register_array, size_t array_len, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type);
|
||||
|
||||
/**
|
||||
* @brief Decodes and returns complete error information from a register array as JSON
|
||||
* @param[in] register_array Pointer to an array of 64-bit register values
|
||||
* @param[in] array_len Size of register array in elements
|
||||
* @param[in] flag Decoder flags
|
||||
* @param[in] hw_revision Hardware revision number
|
||||
* @param[in] register_context_type Register context type (16-bit): 1 for ACA decode, 9 for boot decode
|
||||
* @return JsonValue* containing complete error information, or NULL on failure
|
||||
*/
|
||||
JsonValue* decode_error_info(const uint64_t *register_array, size_t array_len, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type);
|
||||
|
||||
/**
|
||||
* @brief Decodes the AFID from a JSON error object based on error category, type, and severity
|
||||
* @param[in] error_json Pointer to JSON object containing error information
|
||||
* @return AFID value or -1 if decoding fails or JSON is NULL
|
||||
*/
|
||||
int decode_error_info_afid(JsonValue *error_json);
|
||||
|
||||
#endif // RAS_DECODE_API_H
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ras_decode_constants.h
|
||||
* @brief Shared constants for ACA error decoding
|
||||
*
|
||||
* This file contains string constants and numerical constants that are used
|
||||
* across multiple source files to improve maintainability and prevent typos.
|
||||
*/
|
||||
|
||||
#ifndef RAS_DECODE_CONSTANTS_H
|
||||
#define RAS_DECODE_CONSTANTS_H
|
||||
|
||||
/* Error severity constants */
|
||||
#define RAS_DECODE_SEVERITY_UNKNOWN "UNKNOWN"
|
||||
#define RAS_DECODE_SEVERITY_FATAL "Fatal"
|
||||
#define RAS_DECODE_SEVERITY_CORRECTED "Corrected"
|
||||
#define RAS_DECODE_SEVERITY_UNCORRECTED_NON_FATAL "Uncorrected, Non-fatal"
|
||||
#define RAS_DECODE_SEVERITY_FAIL_TO_INIT "Fail-to-init"
|
||||
#define RAS_DECODE_SEVERITY_ALL_CAPS "ALL"
|
||||
|
||||
/* Error category constants */
|
||||
#define RAS_DECODE_CATEGORY_HBM_ERRORS "HBM Errors"
|
||||
#define RAS_DECODE_CATEGORY_DEVICE_INTERNAL_ERRORS "Device Internal Errors"
|
||||
#define RAS_DECODE_CATEGORY_OFF_PACKAGE_LINK_ERRORS "Off-Package Link Errors"
|
||||
#define RAS_DECODE_CATEGORY_BOOT_TIME_ERRORS "Boot-Time Errors"
|
||||
#define RAS_DECODE_CATEGORY_CPER_FORMAT "CPER Format"
|
||||
#define RAS_DECODE_CATEGORY_UNIDENTIFIED_ERRORS "Unidentified Errors"
|
||||
|
||||
/* Common error type constants */
|
||||
#define RAS_DECODE_ERROR_TYPE_ALL_OTHERS "All Others"
|
||||
#define RAS_DECODE_ERROR_TYPE_ALL "All"
|
||||
#define RAS_DECODE_ERROR_TYPE_DECODE_INAPPLICABLE "Decode Inapplicable"
|
||||
#define RAS_DECODE_ERROR_TYPE_BAD_PAGE_RETIREMENT_THRESHOLD "Bad Page Retirement Threshold"
|
||||
#define RAS_DECODE_ERROR_TYPE_HARDWARE_ASSERTION "Hardware Assertion (HWA)"
|
||||
#define RAS_DECODE_ERROR_TYPE_WATCHDOG_TIMEOUT "Watchdog Timeout (WDT)"
|
||||
#define RAS_DECODE_ERROR_TYPE_ON_DIE_ECC "On-die ECC"
|
||||
#define RAS_DECODE_ERROR_TYPE_END_TO_END_CRC "End-to-end CRC"
|
||||
#define RAS_DECODE_ERROR_TYPE_WAFL "WAFL"
|
||||
#define RAS_DECODE_ERROR_TYPE_XGMI "XGMI"
|
||||
|
||||
/* Boot-time error type constants */
|
||||
#define RAS_DECODE_ERROR_TYPE_FW_LOAD "FW Load"
|
||||
#define RAS_DECODE_ERROR_TYPE_HBM_BIST_TEST "HBM BIST Test"
|
||||
#define RAS_DECODE_ERROR_TYPE_HBM_MEMORY_TEST "HBM Memory Test"
|
||||
#define RAS_DECODE_ERROR_TYPE_HBM_TRAINING "HBM Training"
|
||||
#define RAS_DECODE_ERROR_TYPE_UNHANDLED "Unhandled"
|
||||
#define RAS_DECODE_ERROR_TYPE_UNKNOWN_ERROR "Unknown"
|
||||
#define RAS_DECODE_ERROR_TYPE_USR_CP_LINK_TRAINING "USR CP Link Training"
|
||||
#define RAS_DECODE_ERROR_TYPE_USR_DP_LINK_TRAINING "USR DP Link Training"
|
||||
#define RAS_DECODE_ERROR_TYPE_WAFL_LINK_TRAINING "WAFL Link Training"
|
||||
#define RAS_DECODE_ERROR_TYPE_XGMI_LINK_TRAINING "XGMI Link Training"
|
||||
#define RAS_DECODE_ERROR_TYPE_BOOT_CONTROLLER_DATA_ABORT "Boot Controller Data Abort"
|
||||
#define RAS_DECODE_ERROR_TYPE_BOOT_CONTROLLER_GENERIC "Boot Controller Generic"
|
||||
#define RAS_DECODE_ERROR_TYPE_BOOT_SUCCESS "Boot Success"
|
||||
|
||||
/* Link error type constants */
|
||||
#define RAS_DECODE_ERROR_TYPE_PCIE_AER "PCIe AER"
|
||||
|
||||
/* CPER format error type constants */
|
||||
#define RAS_DECODE_ERROR_TYPE_MALFORMED_CPER "Malformed CPER"
|
||||
#define RAS_DECODE_ERROR_TYPE_INCOMPLETE_RAS_DECODE_DATA "Incomplete ACA Data"
|
||||
#define RAS_DECODE_ERROR_TYPE_INVALID_RAS_DECODE_DATA "Invalid ACA Data"
|
||||
#define RAS_DECODE_ERROR_TYPE_UNIDENTIFIED_ERROR "Unidentified Error"
|
||||
|
||||
/* Protocol constants */
|
||||
#define RAS_DECODE_PROTOCOL_CPER "CPER"
|
||||
#define RAS_DECODE_PROTOCOL_CPER_WITH_SPACE "CPER "
|
||||
|
||||
/* Bank name strings */
|
||||
#define RAS_DECODE_BANK_UMC "umc"
|
||||
#define RAS_DECODE_BANK_PSP "psp"
|
||||
#define RAS_DECODE_BANK_CS "cs"
|
||||
#define RAS_DECODE_BANK_PIE "pie"
|
||||
#define RAS_DECODE_BANK_PCS_XGMI "pcs_xgmi"
|
||||
#define RAS_DECODE_BANK_KPX_SERDES "kpx_serdes"
|
||||
#define RAS_DECODE_BANK_KPX_WAFL "kpx_wafl"
|
||||
|
||||
/* Numerical constants */
|
||||
#define RAS_DECODE_FLAG_THRESHOLD_EXCEEDED 0x8
|
||||
#define RAS_DECODE_REGISTER_ARRAY_SIZE_32_BYTES 4
|
||||
#define RAS_DECODE_REGISTER_ARRAY_SIZE_128_BYTES 16
|
||||
#define BOOT_REGISTER_ARRAY_SIZE_64_BYTES 8
|
||||
|
||||
/* Error code ranges */
|
||||
#define RAS_DECODE_ERROR_CODE_EXT_MIN 0x3A
|
||||
#define RAS_DECODE_ERROR_CODE_EXT_MAX 0x3E
|
||||
|
||||
/* Instance ID values for XCD and AID error decoding */
|
||||
#define RAS_DECODE_INSTANCE_ID_XCD0_400 0x36430400
|
||||
#define RAS_DECODE_INSTANCE_ID_XCD1_400 0x38430400
|
||||
#define RAS_DECODE_INSTANCE_ID_XCD0_401 0x36430401
|
||||
#define RAS_DECODE_INSTANCE_ID_XCD1_401 0x38430401
|
||||
#define RAS_DECODE_INSTANCE_ID_AID_400 0x3B30400
|
||||
#define RAS_DECODE_INSTANCE_ID_AID_401 0x3B30401
|
||||
|
||||
/* Error return codes */
|
||||
#define RAS_DECODE_ERROR_INVALID_RAS_DECODE_DATA_ID 33
|
||||
#define RAS_DECODE_ERROR_UNIDENTIFIED_ERROR_ID 34
|
||||
|
||||
#endif /* RAS_DECODE_CONSTANTS_H */
|
||||
Reference in new issue
Block a user