summaryrefslogtreecommitdiff
path: root/src/drivers/ocp/ewl/ewl.c
diff options
context:
space:
mode:
authorJohnny Lin <johnny_lin@wiwynn.com>2022-11-07 11:41:52 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-05-12 15:03:29 +0000
commite0b140627607569ca36da2d8cc7eec15e970bd71 (patch)
tree85d8fc4da4717d20bb11f1ab6db4a17da12f93c2 /src/drivers/ocp/ewl/ewl.c
parentb3907c74d51357ad40c69e30b4e41bcbdfd7cec6 (diff)
drivers/ocp/ewl: Add EWL driver for EWL type 3 error handling
1. Restore the reverted 'commit 059902882ce5 ("drivers/ocp/ewl: Add EWL driver for EWL type 3 error handling")'. 2. Print more EWL type 3 error information when it occurs. Change-Id: Ib83b7653a839d18a065b929127549acd10bce7a7 Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69280 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Zhang <jon.zhixiong.zhang@gmail.com>
Diffstat (limited to 'src/drivers/ocp/ewl/ewl.c')
-rw-r--r--src/drivers/ocp/ewl/ewl.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/drivers/ocp/ewl/ewl.c b/src/drivers/ocp/ewl/ewl.c
new file mode 100644
index 0000000000..871981a28b
--- /dev/null
+++ b/src/drivers/ocp/ewl/ewl.c
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <soc/soc_util.h>
+#include <lib.h>
+#include "ocp_ewl.h"
+
+static void process_ewl_type3(EWL_ENTRY_HEADER *header, EWL_ENTRY_MEMORY_LOCATION memory_location)
+{
+ /* Treat warning as type 3, collect basic information and print to serial log */
+ EWL_ENTRY_TYPE3 *basic_warning;
+ basic_warning = (EWL_ENTRY_TYPE3 *)header;
+ printk(BIOS_ERR, "Major Warning Code = 0x%02x, Minor Warning Code = 0x%02x,\n",
+ basic_warning->Context.MajorWarningCode,
+ basic_warning->Context.MinorWarningCode);
+ printk(BIOS_ERR, "Major Checkpoint: 0x%02x\n", basic_warning->Context.MajorCheckpoint);
+ printk(BIOS_ERR, "Minor Checkpoint: 0x%02x\n", basic_warning->Context.MinorCheckpoint);
+
+ if (memory_location.Socket != 0xff)
+ printk(BIOS_ERR, "Socket %d\n", memory_location.Socket);
+ if (memory_location.Channel != 0xff)
+ printk(BIOS_ERR, "Channel %d\n", memory_location.Channel);
+ if (memory_location.Dimm != 0xff)
+ printk(BIOS_ERR, "Dimm %d\n", memory_location.Dimm);
+ if (memory_location.Rank != 0xff)
+ printk(BIOS_ERR, "Rank %d\n", memory_location.Rank);
+}
+
+void get_ewl(void)
+{
+ const EWL_PRIVATE_DATA *hob = get_ewl_hob();
+ int offset = 0;
+ bool type3_flag = 0;
+ EWL_ENTRY_HEADER *warning_header;
+ printk(BIOS_DEBUG, "Number of EWL entries %d\n", hob->numEntries);
+ while (offset < hob->status.Header.FreeOffset) {
+ warning_header = (EWL_ENTRY_HEADER *) &(hob->status.Buffer[offset]);
+ if (warning_header->Type == EwlType3) {
+ printk(BIOS_ERR, "EWL type: %d size:%d severity level:%d\n",
+ warning_header->Type,
+ warning_header->Size,
+ warning_header->Severity);
+ if (warning_header->Size != sizeof(EWL_ENTRY_TYPE3)) {
+ printk(BIOS_ERR, "EWL type3 size mismatch!\n");
+ return;
+ }
+ EWL_ENTRY_TYPE3 *type3;
+ type3 = (EWL_ENTRY_TYPE3 *)warning_header;
+ process_ewl_type3(warning_header, type3->MemoryLocation);
+ type3_flag = 1;
+ } else {
+ printk(BIOS_DEBUG, "EWL type: %d size:%d severity level:%d\n",
+ warning_header->Type,
+ warning_header->Size,
+ warning_header->Severity);
+ hexdump(&(hob->status.Buffer[offset]), warning_header->Size);
+ }
+ offset += warning_header->Size;
+ }
+ if (type3_flag)
+ die("Memory Training Error!\n");
+}