diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-05-22 11:05:49 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-03-04 14:45:34 +0100 |
commit | abf2b6a028670bd2890bb3aee7e103fe53e4b0df (patch) | |
tree | a25f013c93874c2dce66fd482609d281dd3fba74 /hw/char | |
parent | 92988c45017ca9385f408eb109184d68d4fef8e7 (diff) | |
download | qemu-abf2b6a028670bd2890bb3aee7e103fe53e4b0df.zip qemu-abf2b6a028670bd2890bb3aee7e103fe53e4b0df.tar.gz qemu-abf2b6a028670bd2890bb3aee7e103fe53e4b0df.tar.bz2 |
hw/char/pl011: Warn when using disabled receiver
We shouldn't receive characters when the full UART or its
receiver is disabled. However we don't want to break the
possibly incomplete "my first bare metal assembly program"s,
so we choose to simply display a warning when this occurs.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Luc Michel <luc.michel@amd.com>
Message-Id: <20250220092903.3726-2-philmd@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/pl011.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 06ce851..12a2d4b 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -85,6 +85,7 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr) #define CR_OUT1 (1 << 12) #define CR_RTS (1 << 11) #define CR_DTR (1 << 10) +#define CR_RXE (1 << 9) #define CR_TXE (1 << 8) #define CR_LBE (1 << 7) #define CR_UARTEN (1 << 0) @@ -487,6 +488,14 @@ static int pl011_can_receive(void *opaque) PL011State *s = (PL011State *)opaque; int r; + if (!(s->cr & CR_UARTEN)) { + qemu_log_mask(LOG_GUEST_ERROR, + "PL011 receiving data on disabled UART\n"); + } + if (!(s->cr & CR_RXE)) { + qemu_log_mask(LOG_GUEST_ERROR, + "PL011 receiving data on disabled RX UART\n"); + } r = s->read_count < pl011_get_fifo_depth(s); trace_pl011_can_receive(s->lcr, s->read_count, r); return r; |