hw/char: cadence_uart: Log a guest error when device is unclocked or in reset
We've got SW that expects FSBL (Bootlooader) to setup clocks and resets. It's quite common that users run that SW on QEMU without FSBL (FSBL typically requires the Xilinx tools installed). That's fine, since users can stil use -device loader to enable clocks etc. To help folks understand what's going, a log (guest-error) message would be helpful here. In particular with the serial port since things will go very quiet if they get things wrong. Suggested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20210901124521.30599-7-bmeng.cn@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
9834ecaaea
commit
47c305f6f2
@ -240,6 +240,8 @@ static int uart_can_receive(void *opaque)
|
|||||||
|
|
||||||
/* ignore characters when unclocked or in reset */
|
/* ignore characters when unclocked or in reset */
|
||||||
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
||||||
|
qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
|
||||||
|
__func__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +378,8 @@ static void uart_event(void *opaque, QEMUChrEvent event)
|
|||||||
|
|
||||||
/* ignore characters when unclocked or in reset */
|
/* ignore characters when unclocked or in reset */
|
||||||
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
||||||
|
qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
|
||||||
|
__func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,6 +417,8 @@ static MemTxResult uart_write(void *opaque, hwaddr offset,
|
|||||||
|
|
||||||
/* ignore access when unclocked or in reset */
|
/* ignore access when unclocked or in reset */
|
||||||
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
||||||
|
qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
|
||||||
|
__func__);
|
||||||
return MEMTX_ERROR;
|
return MEMTX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,6 +484,8 @@ static MemTxResult uart_read(void *opaque, hwaddr offset,
|
|||||||
|
|
||||||
/* ignore access when unclocked or in reset */
|
/* ignore access when unclocked or in reset */
|
||||||
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
|
||||||
|
qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
|
||||||
|
__func__);
|
||||||
return MEMTX_ERROR;
|
return MEMTX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user