aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2013-08-22 17:01:59 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-08-27 14:35:44 +0100
commit2050ad703c65ed997f1328af702054d1960fb168 (patch)
treeecd146974f5ded6a323422dc9e1536586be4e107 /xen/drivers
parentceb93c72d2046bffecd57fcbebd04aa0801414a2 (diff)
downloadxen-2050ad703c65ed997f1328af702054d1960fb168.tar.gz
xen-2050ad703c65ed997f1328af702054d1960fb168.tar.bz2
xen-2050ad703c65ed997f1328af702054d1960fb168.zip
pl011: early_panic if baud rate not set in hardware
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> Acked-by: Julien Grall <julien.grall@linaro.org>
Diffstat (limited to 'xen/drivers')
-rw-r--r--xen/drivers/char/pl011.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index e4bd702f3f..3ea0d41f8c 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. */