diff mbox

[V8,9/9] errorlog: Add generic elog write interface

Message ID 1479204645-2865-10-git-send-email-mukesh02@linux.vnet.ibm.com
State New, archived
Headers show

Commit Message

Mukesh Ojha Nov. 15, 2016, 10:10 a.m. UTC
Lets add generic error log write interface to send OPAL generated
logs to host OS.

If platform provides error log commit hook, then call that hook and
let platform decide where to commit errors. Otherwise call this
generic interface so that logs are sent to host OS.

Also move opal_elog_init() call to core/init.c so that elog is initialized
for all platform.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
---
Changes in V8:
 - Previous version V7 1/12 to 3/12 is already in the master.
 - Rebased on master.

Changes in V7:
 - New patch.

 core/errorlog.c            | 10 ++++++----
 core/init.c                |  4 ++++
 platforms/astbmc/common.c  |  3 ---
 platforms/ibm-fsp/common.c |  3 ---
 platforms/qemu/qemu.c      |  2 --
 5 files changed, 10 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/core/errorlog.c b/core/errorlog.c
index a00cf0b..b2a0a3f 100644
--- a/core/errorlog.c
+++ b/core/errorlog.c
@@ -170,15 +170,17 @@  void log_commit(struct errorlog *elog)
 	/* Increments the number of users using error log buffer */
 	get_elog(elog);
 
+	/*
+	 * If platform doesn't provide elog commit hook, then call generic
+	 * commit interface to send ELOG to host OS.
+	 */
 	if (platform.elog_commit) {
 		rc = platform.elog_commit(elog);
 		if (rc)
 			prerror("ELOG: Platform commit error %d\n", rc);
-
-		return;
+	} else {
+		elog_append_write_to_host(elog);
 	}
-
-	opal_elog_complete(elog, false);
 }
 
 void log_append_data(struct errorlog *buf, unsigned char *data, uint16_t size)
diff --git a/core/init.c b/core/init.c
index 9d4ab60..112d787 100644
--- a/core/init.c
+++ b/core/init.c
@@ -29,6 +29,7 @@ 
 #include <io.h>
 #include <cec.h>
 #include <device.h>
+#include <errorlog.h>
 #include <pci.h>
 #include <lpc.h>
 #include <i2c.h>
@@ -875,6 +876,9 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	/* Register routine to dispatch and read sensors */
 	sensor_init();
 
+	/* Initialize the error log framework */
+	opal_elog_init();
+
         /*
 	 * Initialize the opal messaging before platform.init as we are
 	 *  getting request to queue occ load opal message when host services
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index c25f6a6..b0bf117 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -121,9 +121,6 @@  void astbmc_init(void)
 	/* Register the BT interface with the IPMI layer */
 	bt_init();
 
-	/* Initialize error log */
-	opal_elog_init();
-
 	ipmi_sel_init();
 	ipmi_wdt_init();
 	ipmi_rtc_init();
diff --git a/platforms/ibm-fsp/common.c b/platforms/ibm-fsp/common.c
index 17622a3..07928de 100644
--- a/platforms/ibm-fsp/common.c
+++ b/platforms/ibm-fsp/common.c
@@ -93,9 +93,6 @@  void ibm_fsp_init(void)
 	/* Get ready to receive OCC related messages */
 	occ_fsp_init();
 
-	/* Initialize the error log framework */
-	opal_elog_init();
-
 	/* Get ready to receive Memory [Un]corretable Error messages. */
 	fsp_memory_err_init();
 
diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c
index 73415a4..23667ba 100644
--- a/platforms/qemu/qemu.c
+++ b/platforms/qemu/qemu.c
@@ -92,8 +92,6 @@  static void qemu_init(void)
 
 	/* Register the BT interface with the IPMI layer */
 	bt_init();
-	/* Initialize error log */
-	opal_elog_init();
 	ipmi_sel_init();
 	ipmi_wdt_init();
 	ipmi_opal_init();