[Skiboot] [PATCH] Add OPAL_CONSOLE_FLUSH to the OPAL API

Russell Currey ruscur at russell.cc
Mon Nov 23 17:00:44 AEDT 2015


uart consoles only flush output when polled.  The Linux kernel calls these
pollers frequently, except when in a panic state.  As such, panic messages
are not fully printed unless the system is configured to reboot after panic.

This patch adds a new call to the OPAL API to completely flush the buffer.
If the system has a uart console (i.e. BMC machines), it will fully flush
the buffer.  If not, this function will have no effect.  This will allow
the Linux kernel to ensure the panic message has been fully printed out.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
A patch to the Linux kernel to call this function while panicking will be
sent upstream shortly.  If this function is not defined (i.e. an older
Skiboot version), it will just call opal_poll_events a bunch of times.
---
 core/console.c                               |  1 +
 doc/opal-api/opal-console-read-write-1-2.txt | 16 +++++++++++++++-
 include/opal-api.h                           |  3 ++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/core/console.c b/core/console.c
index 1cee5da..9295d6c 100644
--- a/core/console.c
+++ b/core/console.c
@@ -295,6 +295,7 @@ void flush_console_driver(void)
 	if (con_driver && con_driver->flush != NULL)
 		con_driver->flush();
 }
+opal_call(OPAL_CONSOLE_FLUSH, flush_console_driver, 0);
 
 void set_console(struct con_ops *driver)
 {
diff --git a/doc/opal-api/opal-console-read-write-1-2.txt b/doc/opal-api/opal-console-read-write-1-2.txt
index b8fbc12..97d0632 100644
--- a/doc/opal-api/opal-console-read-write-1-2.txt
+++ b/doc/opal-api/opal-console-read-write-1-2.txt
@@ -1,11 +1,12 @@
 OPAL Console calls
 ------------------
 
-There are three OPAL calls relating to the OPAL console:
+There are four OPAL calls relating to the OPAL console:
 
 #define OPAL_CONSOLE_WRITE			1
 #define OPAL_CONSOLE_READ			2
 #define OPAL_CONSOLE_WRITE_BUFFER_SPACE		25
+#define OPAL_CONSOLE_FLUSH			117
 
 The OPAL console calls can support multiple consoles. Each console MUST
 be represented in the device tree.
@@ -64,3 +65,16 @@ Returns:
 	OPAL_CLOSED
 
 Use OPAL_POLL_EVENTS for how to determine
+
+OPAL_CONSOLE_FLUSH
+------------------
+
+Parameters:
+	none
+
+Returns:
+	none
+
+Completely flushes the console's output buffer. Currently only implemented
+for uart consoles that only flush output when polled, so that the kernel
+has a way to flush output when in a panic state.
diff --git a/include/opal-api.h b/include/opal-api.h
index 7a11fe8..369aa93 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -162,7 +162,8 @@
 #define OPAL_LEDS_GET_INDICATOR			114
 #define OPAL_LEDS_SET_INDICATOR			115
 #define OPAL_CEC_REBOOT2			116
-#define OPAL_LAST				116
+#define OPAL_CONSOLE_FLUSH			117
+#define OPAL_LAST				117
 
 /* Device tree flags */
 
-- 
2.6.2



More information about the Skiboot mailing list