[Skiboot] [PATCH V7 12/12] errorlog: Add generic elog write interface

Mukesh Ojha mukesh02 at linux.vnet.ibm.com
Wed Sep 7 20:21:26 AEST 2016


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 at linux.vnet.ibm.com>
Reviewed-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
---
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 --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 70d3fda..38bf5b7 100644
--- a/core/init.c
+++ b/core/init.c
@@ -45,6 +45,7 @@
 #include <sensor.h>
 #include <xive.h>
 #include <nvram.h>
+#include <errorlog.h>
 
 enum proc_gen proc_gen;
 
@@ -829,6 +830,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt, u32 master_cpu)
 	/* Register routine to dispatch and read sensors */
 	sensor_init();
 
+	/* Initialize the error log framework */
+	opal_elog_init();
+
 	/*
 	 * We have initialized the basic HW, we can now call into the
 	 * platform to perform subsequent inits, such as establishing
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 0dfed45..665438a 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();
-- 
2.7.4



More information about the Skiboot mailing list