Skip to content

Commit

Permalink
examples/aarch64: initialize uart device
Browse files Browse the repository at this point in the history
Actually initialize the uart to silence all the "PL011 data written to
disabled UART" guest errors from QEMU.

Signed-off-by: Manos Pitsidianakis <[email protected]>
  • Loading branch information
epilys committed Feb 13, 2025
1 parent d435c89 commit 7bd800e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/aarch64/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ struct Logger {
pub fn init(max_level: LevelFilter) -> Result<(), SetLoggerError> {
// Safe because BASE_ADDRESS is the base of the MMIO region for a UART and is mapped as device
// memory.
let uart = unsafe { Uart::new(UART_BASE_ADDRESS) };
#[cfg_attr(platform = "crosvm", allow(unused_mut))]
let mut uart = unsafe { Uart::new(UART_BASE_ADDRESS) };
#[cfg(platform = "qemu")]
uart.init(50000000, 115200);
LOGGER.uart.lock().replace(uart);

log::set_logger(&LOGGER)?;
Expand Down

0 comments on commit 7bd800e

Please sign in to comment.