From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Keir Fraser <keir@xen.org>,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
Julien Grall <julien.grall@linaro.org>,
tim@xen.org, patches@linaro.org
Subject: [RFC 4/6] xen/console: Add support for early printk
Date: Sun, 5 Jan 2014 21:26:29 +0000 [thread overview]
Message-ID: <1388957191-10337-5-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1388957191-10337-1-git-send-email-julien.grall@linaro.org>
On ARM, a function (early_printk) was introduced to output message when the
serial port is not initialized.
This solution is fragile because the developper needs to know when the serial
port is initialized, to use either early_printk or printk. Moreover some
functions (mainly in common code), only use printk. This will result to a loss
of message sometimes.
Directly call early_printk in console code when the serial port is not yet
initialized. For this purpose use serial_steal_fn.
Cc: Keir Fraser <keir@xen.org>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
xen/drivers/char/console.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 532c426..f83c92e 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -28,6 +28,9 @@
#include <asm/debugger.h>
#include <asm/div64.h>
#include <xen/hypercall.h> /* for do_console_io */
+#ifdef CONFIG_EARLY_PRINTK
+#include <asm/early_printk.h>
+#endif
/* console: comma-separated list of console outputs. */
static char __initdata opt_console[30] = OPT_CONSOLE_STR;
@@ -245,7 +248,12 @@ long read_console_ring(struct xen_sysctl_readconsole *op)
static char serial_rx_ring[SERIAL_RX_SIZE];
static unsigned int serial_rx_cons, serial_rx_prod;
-static void (*serial_steal_fn)(const char *);
+#ifndef CONFIG_EARLY_PRINTK
+static inline void early_puts(const char *str)
+{}
+#endif
+
+static void (*serial_steal_fn)(const char *) = early_puts;
int console_steal(int handle, void (*fn)(const char *))
{
@@ -652,7 +660,10 @@ void __init console_init_preirq(void)
else if ( !strncmp(p, "none", 4) )
continue;
else if ( (sh = serial_parse_handle(p)) >= 0 )
+ {
sercon_handle = sh;
+ serial_steal_fn = NULL;
+ }
else
{
char *q = strchr(p, ',');
--
1.8.3.1
next prev parent reply other threads:[~2014-01-05 21:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 21:26 [RFC 0/6] xen/arm: Merge early_printk function in console code Julien Grall
2014-01-05 21:26 ` [RFC 1/6] xen/arm: earlyprintk: move early_flush in early_puts Julien Grall
2014-02-19 11:13 ` Ian Campbell
2014-01-05 21:26 ` [RFC 2/6] xen/arm: earlyprintk: export early_puts Julien Grall
2014-02-19 11:14 ` Ian Campbell
2014-01-05 21:26 ` [RFC 3/6] xen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK Julien Grall
2014-02-19 11:16 ` Ian Campbell
2014-01-05 21:26 ` Julien Grall [this message]
2014-02-19 11:19 ` [RFC 4/6] xen/console: Add support for early printk Ian Campbell
2014-02-20 16:38 ` Julien Grall
2014-01-05 21:26 ` [RFC 5/6] xen/console: Add noreturn attribute to panic function Julien Grall
2014-01-05 22:44 ` Andrew Cooper
2014-01-06 11:39 ` Julien Grall
2014-01-06 11:42 ` Andrew Cooper
2014-01-06 11:46 ` Julien Grall
2014-01-05 21:26 ` [RFC 6/6] xen/arm: Replace early_printk call to printk call Julien Grall
2014-02-19 11:20 ` Ian Campbell
2014-02-19 17:56 ` Julien Grall
2014-02-20 9:04 ` Ian Campbell
2014-02-20 11:01 ` Julien Grall
2014-02-20 11:05 ` Ian Campbell
2014-02-20 11:14 ` Julien Grall
2014-02-20 11:20 ` Ian Campbell
2014-02-20 11:37 ` Julien Grall
2014-02-20 13:02 ` Ian Campbell
2014-02-19 12:33 ` Ian Campbell
2014-03-05 7:53 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388957191-10337-5-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=patches@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).