From patchwork Mon Nov 23 06:00:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 547379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C46B91402A3 for ; Mon, 23 Nov 2015 17:03:04 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 643731A02BE for ; Mon, 23 Nov 2015 17:03:04 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from russell.cc (russell.cc [43.229.61.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id F00B21A029E for ; Mon, 23 Nov 2015 17:03:00 +1100 (AEDT) Received: from snap.ozlabs.ibm.com (static-82-10.transact.net.au [122.99.82.10]) by russell.cc (OpenSMTPD) with ESMTPSA id 727718bf TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO; Mon, 23 Nov 2015 06:00:47 +0000 (UTC) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Mon, 23 Nov 2015 17:00:44 +1100 Message-Id: <1448258444-7362-1-git-send-email-ruscur@russell.cc> X-Mailer: git-send-email 2.6.2 Subject: [Skiboot] [PATCH] Add OPAL_CONSOLE_FLUSH to the OPAL API X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell Currey MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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 */