aboutsummaryrefslogtreecommitdiff
path: root/core/console.c
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2015-12-18 17:15:36 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-01-12 12:13:32 +1100
commitf2efc652cbad6b32e1f0295aac819f6062777e31 (patch)
treeded31817c9ce70d1fb454134a45ffdbb13cb97b2 /core/console.c
parentd4b142823e28deed097cf79b25d8d1e60b6f4e67 (diff)
downloadskiboot-f2efc652cbad6b32e1f0295aac819f6062777e31.zip
skiboot-f2efc652cbad6b32e1f0295aac819f6062777e31.tar.gz
skiboot-f2efc652cbad6b32e1f0295aac819f6062777e31.tar.bz2
Add OPAL_CONSOLE_FLUSH to the OPAL API
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 flush the buffer. If the system has a uart console (i.e. BMC machines), it will incrementally flush the buffer, returning if there is more to be flushed or not. If the system has a different console, the function will have no effect. This will allow the Linux kernel to ensure that panic message have been fully printed out. The existing synchronous flushing mechanism used in OPAL's shutdown and reboot routines has been refactored into a helper that repeatedly calls the new partial flush function. Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/console.c')
-rw-r--r--core/console.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/core/console.c b/core/console.c
index 1cee5da..e851fcf 100644
--- a/core/console.c
+++ b/core/console.c
@@ -290,10 +290,29 @@ ssize_t read(int fd __unused, void *buf, size_t req_count)
return count;
}
-void flush_console_driver(void)
+static int64_t opal_console_flush(int64_t term_number)
{
- if (con_driver && con_driver->flush != NULL)
- con_driver->flush();
+ if (term_number != 0)
+ return OPAL_PARAMETER;
+
+ if (con_driver == NULL || con_driver->flush == NULL)
+ return OPAL_UNSUPPORTED;
+
+ return con_driver->flush();
+}
+opal_call(OPAL_CONSOLE_FLUSH, opal_console_flush, 1);
+
+/* Helper function to perform a full synchronous flush */
+void console_complete_flush(void)
+{
+ int64_t ret = opal_console_flush(0);
+
+ if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER)
+ return;
+
+ while (ret != OPAL_SUCCESS) {
+ ret = opal_console_flush(0);
+ }
}
void set_console(struct con_ops *driver)