summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFu Wei <wefu@redhat.com>2016-08-19 19:31:21 +0800
committerFu Wei <wefu@redhat.com>2016-08-19 19:41:53 +0800
commit12cb2a88815e41cf8492f6f4c8ebd75f91c662f6 (patch)
tree8d599aa475871e9144187505738c911cab0248b9
parenta7e06aac81f84f0643e826a10ef990f43d1b1dbd (diff)
downloadacpi-asl-apei_error_status_blob.tar.gz
-rw-r--r--tools/bfapei/bfapei.c34
-rw-r--r--tools/bfapei/bfapei.h23
-rw-r--r--tools/common/include/acpi.h1
3 files changed, 50 insertions, 8 deletions
diff --git a/tools/bfapei/bfapei.c b/tools/bfapei/bfapei.c
index 344b130..3f18c51 100644
--- a/tools/bfapei/bfapei.c
+++ b/tools/bfapei/bfapei.c
@@ -160,7 +160,7 @@ static int bfapei_expand_buf(char **buf, int *size, int reqr_size)
return BFAPEI_OK;
*buf = realloc(*buf, reqr_size);
- if (!(*buf)) {
+ if (!*buf) {
printf("Error during memory allocation!\n");
return BFAPEI_FAIL;
}
@@ -170,7 +170,7 @@ static int bfapei_expand_buf(char **buf, int *size, int reqr_size)
return BFAPEI_OK;
}
-static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status)
+static int bfapei_hest(char **buf, int *size, uint64_t paddr)
{
struct acpi_hest_generic_status *block_ptr;
struct acpi_hest_generic_data *gdata;
@@ -179,7 +179,7 @@ static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status)
int reqr_size = sizeof(uint64_t) +
sizeof(struct acpi_hest_generic_status) +
sizeof(struct acpi_hest_generic_data) +
- sizeof (struct cper_sec_mem_err);
+ sizeof(struct cper_sec_mem_err);
if (bfapei_expand_buf(buf, size, reqr_size))
return BFAPEI_FAIL;
@@ -194,7 +194,8 @@ static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status)
/* Fill in generic error status block */
block_ptr = (struct acpi_hest_generic_status *) (++add_ptr);
- block_ptr->block_status = status;
+ block_ptr->block_status = (1 << GHES_ERR_TYPE_CORRECTABLE) |
+ (1 << GHES_ERR_ENTRY_COUNT);
block_ptr->data_length = sizeof(struct acpi_hest_generic_data);
block_ptr->error_severity = CPER_SEV_CORRECTED;
@@ -208,6 +209,23 @@ static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status)
mem_err = (struct cper_sec_mem_err *) (gdata + 1);
/* Place for more specific err info */
mem_err->validation_bits |= CPER_MEM_VALID_ERROR_TYPE;
+ /* 0 – Unknown
+ * 1 – No error
+ * 2 – Single-bit ECC
+ * 3 – Multi-bit ECC
+ * 4 – Single-symbol ChipKill ECC
+ * 5 – Multi-symbol ChipKill ECC
+ * 6 – Master abort
+ * 7 – Target abort
+ * 8 – Parity Error
+ * 9 – Watchdog timeout
+ * 10 – Invalid address
+ * 11 – Mirror Broken
+ * 12 – Memory Sparing
+ * 13 - Scrub corrected error
+ * 14 - Scrub uncorrected error
+ * 15 - Physical Memory Map-out event
+ */
mem_err->error_type = 2;
mem_err->validation_bits |= CPER_MEM_VALID_PHYSICAL_ADDRESS;
@@ -224,7 +242,7 @@ static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status)
mem_err->bit_pos = 5;
mem_err->validation_bits |= CPER_MEM_VALID_ERROR_STATUS;
- mem_err->error_status = 4 << 8;
+ mem_err->error_status = (ERR_MEM << ERR_TYPE_OFFSET);
return BFAPEI_OK;
}
@@ -364,12 +382,12 @@ int main(int argc, char *argv[]) {
}
if (strncmp(blob_type, "hest", 4) == 0) {
- if (bfapei_hest(&buf, &size, paddr, 0))
+ if (bfapei_hest(&buf, &size, paddr))
return BFAPEI_FAIL;
}
if (strncmp(blob_type, "einj", 4) == 0) {
- if (bfapei_hest(&buf, &size, paddr, 0))
+ if (bfapei_hest(&buf, &size, paddr))
return BFAPEI_FAIL;
if (bfapei_einj(&buf, &size, paddr))
@@ -378,7 +396,7 @@ int main(int argc, char *argv[]) {
/* Set status flag so error will be visible for BERT driver */
if (strncmp(blob_type, "bert", 4) == 0) {
- if (bfapei_hest(&buf, &size, paddr, 1))
+ if (bfapei_hest(&buf, &size, paddr))
return BFAPEI_FAIL;
}
diff --git a/tools/bfapei/bfapei.h b/tools/bfapei/bfapei.h
index f62d080..efb43f9 100644
--- a/tools/bfapei/bfapei.h
+++ b/tools/bfapei/bfapei.h
@@ -87,3 +87,26 @@ uint64_t einj_reg_map[] = {
WRITE_LONG(blob, einj_reg_map[reg], value)
#endif
+
+#define ERR_TYPE_OFFSET 8
+
+enum cper_err_typt {
+ ERR_INTERNAL = 1,
+ ERR_MEM = 4,
+ ERR_TLB,
+ ERR_CACHE,
+ ERR_FUNCTION,
+ ERR_SELFTEST,
+ ERR_FLOW,
+ ERR_BUS = 16,
+ ERR_MAP,
+ ERR_IMPROPER,
+ ERR_UNIMPL,
+ ERR_LOL,
+ ERR_RESPONSE,
+ ERR_PARITY,
+ ERR_PROTOCOL,
+ ERR_ERROR,
+ ERR_TIMEOUT,
+ ERR_POISONED /* 27 and greater are reserved */
+};
diff --git a/tools/common/include/acpi.h b/tools/common/include/acpi.h
index 01dad20..55f9f46 100644
--- a/tools/common/include/acpi.h
+++ b/tools/common/include/acpi.h
@@ -139,6 +139,7 @@ enum {
#define GHES_ERR_TYPE_CORRECTABLE 1
#define GHES_ERR_TYPE_MULTIPLE_UNCORRECTABLE 2
#define GHES_ERR_TYPE_MULTIPLE_CORRECTABLE 3
+#define GHES_ERR_ENTRY_COUNT 4
struct acpi_hest_generic_status {
uint32_t block_status;