All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pl011: early_panic if baud rate not set in hardware
@ 2013-08-22 16:01 Ian Campbell
  2013-08-22 16:34 ` Julien Grall
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2013-08-22 16:01 UTC (permalink / raw)
  To: xen-devel; +Cc: julien.grall, tim, Ian Campbell, stefano.stabellini

Now that the driver defaults to BAUD_AUTO this can happen if the early uart !=
console or if early printk isn't in use.

The following division by zero causes a trap but that uses regular printk and
not early_printk, so it is never seen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index 0e1eb64..7eb90b0 100644
--- a/xen/drivers/char/pl011.c
+++ b/xen/drivers/char/pl011.c
@@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port)
     {
         /* Baud rate already set: read it out from the divisor latch. */
         divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD));
+        if (!divisor)
+            early_panic("pl011: No Baud rate configured\n");
         uart->baud = (uart->clock_hz << 2) / divisor;
     }
     /* This write must follow FBRD and IBRD writes. */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-27 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 16:01 [PATCH] pl011: early_panic if baud rate not set in hardware Ian Campbell
2013-08-22 16:34 ` Julien Grall
2013-08-22 18:49   ` Ian Campbell
2013-08-22 21:09     ` Julien Grall
2013-08-23  0:41       ` Chen Baozi
2013-08-27 13:46   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.