[SWDEV-536417] AFID & addc decode fixes (#449)

* fix endian problem
* use hw_revision and flags_mask from cper section instead of hardcoded values

---------

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
Saeed, Oosman
2025-06-06 13:41:16 -05:00
committed by GitHub
parent 8bc37a19d2
commit 815e0252b1
7 changed files with 126 additions and 110 deletions
+23 -10
View File
@@ -1,4 +1,5 @@
#include "aca_decode.h"
#include <utils.h>
int decode_afid(const uint64_t *register_array, size_t array_len, uint32_t flag, uint16_t hw_revision)
{
@@ -23,7 +24,6 @@ int decode_afid(const uint64_t *register_array, size_t array_len, uint32_t flag,
raw_data.aca_ipid = register_array[5];
raw_data.aca_synd = register_array[6];
}
else
{
return -1; // Unsupported size
@@ -44,19 +44,32 @@ aca_error_info_t decode_error_info(const uint64_t *register_array, size_t array_
if (!register_array)
{
return error_info;
} if (array_len == 4) // 32 bytes
}
// Create a copy of the register array to avoid modifying the original
uint64_t converted_array[16];
if (array_len > 16) {
return error_info;
}
// Copy and convert the array
for (size_t i = 0; i < array_len; i++) {
converted_array[i] = le64_to_be64(register_array[i]);
}
if (array_len == 4) // 32 bytes
{
raw_data.aca_status = register_array[0];
raw_data.aca_addr = register_array[1];
raw_data.aca_ipid = register_array[2];
raw_data.aca_synd = register_array[3];
raw_data.aca_status = converted_array[0];
raw_data.aca_addr = converted_array[1];
raw_data.aca_ipid = converted_array[2];
raw_data.aca_synd = converted_array[3];
}
else if (array_len == 16) // 128 bytes
{
raw_data.aca_status = register_array[1];
raw_data.aca_addr = register_array[2];
raw_data.aca_ipid = register_array[5];
raw_data.aca_synd = register_array[6];
raw_data.aca_status = converted_array[1];
raw_data.aca_addr = converted_array[2];
raw_data.aca_ipid = converted_array[5];
raw_data.aca_synd = converted_array[6];
}
else
{