mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/uart: set a default baudrate if non specified neither found
If the user has set baudrate as "auto" (use whatever was configured) but Xen cannot find any set baudrate use a default fallback baudrate of 115200. Otherwise the console will very likely end up being non-functional, as further values are derived from the baudrate (like the transmit timeout), and using -1 will result in screwed parameters being derived from the baudrate. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
1 parent
18b718b6af
commit
12e50da43d
1 file changed
+8
-1
@@ -346,9 +346,16 @@ static void ns16550_setup_preirq(struct ns16550 *uart)
|
||||
if ( divisor )
|
||||
uart->baud = uart->clock_hz / (divisor << 4);
|
||||
else
|
||||
{
|
||||
uart->baud = 115200;
|
||||
printk(XENLOG_ERR
|
||||
"Automatic baud rate determination was requested,"
|
||||
" but a baud rate was not set up\n");
|
||||
" but a baud rate was not set up\n"
|
||||
"Setting baudrate to %u\n", uart->baud);
|
||||
divisor = uart->clock_hz / (uart->baud << 4);
|
||||
ns_write_reg(uart, UART_DLL, (uint8_t)divisor);
|
||||
ns_write_reg(uart, UART_DLM, (uint8_t)(divisor >> 8));
|
||||
}
|
||||
}
|
||||
ns_write_reg(uart, UART_LCR, lcr);
|
||||
|
||||
|
||||