aboutsummaryrefslogtreecommitdiff
path: root/machine/minit.c
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-12-12 19:04:56 -0800
committerPalmer Dabbelt <palmer@dabbelt.com>2017-12-12 20:08:17 -0800
commit132c6292bb3fc18e52a1e3a3a5cdd3b8ca838b28 (patch)
treee8bb8c83b10f637b83566058fb65d4ee80dafa40 /machine/minit.c
parent3d921d3c76db3af7b9ae0b5df0f0790f26222246 (diff)
downloadriscv-pk-132c6292bb3fc18e52a1e3a3a5cdd3b8ca838b28.zip
riscv-pk-132c6292bb3fc18e52a1e3a3a5cdd3b8ca838b28.tar.gz
riscv-pk-132c6292bb3fc18e52a1e3a3a5cdd3b8ca838b28.tar.bz2
Add a 16550 UART driver to back the SBI console
QEMU currently provides the console via HTIF and the SBI. That's a bit messy because BBL polls for serial input, which means that typing too quickly loses characters. While QEMU has a standard 16550 device model, there's no way to have two consoles share the console in QEMU (as they'd step all over each other) so that means we can't have both the HTIF console and the 16550 console. With this patch, QEMU can be changed to use a 16650 instead of the HTIF for serial output. Linux will use the SBI for early printk support (which is fine, polling for output is stable) and then swap over as soon as it detects the UART. When Linux swaps it prints out the whole history, but there's probably a way to get around that. There's a few lines that are output to both, but it appears the Linux driver is close enough to ours that nothing catastrophic happens -- there's not much to the device, so hopefully that pans out on real hardware too. Once Linux swaps over to natively using the driver we get reliable console input. If you don't have the in-kernel driver then Linux never swaps over and keeps using the SBI console just like before.
Diffstat (limited to 'machine/minit.c')
-rw-r--r--machine/minit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/machine/minit.c b/machine/minit.c
index 3623f38..ee83f98 100644
--- a/machine/minit.c
+++ b/machine/minit.c
@@ -4,6 +4,7 @@
#include "fp_emulation.h"
#include "fdt.h"
#include "uart.h"
+#include "uart16550.h"
#include "finisher.h"
#include "disabled_hart_mask.h"
#include "htif.h"
@@ -141,6 +142,7 @@ void init_first_hart(uintptr_t hartid, uintptr_t dtb)
{
// Confirm console as early as possible
query_uart(dtb);
+ query_uart16550(dtb);
query_htif(dtb);
hart_init();