From 4f66b188cdb50992b038bd2aa76da151646e2cb8 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Wed, 24 Jul 2024 15:10:30 +0800 Subject: [PATCH] riscv/virt: probe virtio earlier This allows virtio devices to be probed upon board_early_init, thus making virito-serial ready earlier for console use. Signed-off-by: Yanfeng Liu --- boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c index fc4bd3f4b6..999adea53f 100644 --- a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c +++ b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c @@ -135,7 +135,9 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef CONFIG_DRIVERS_VIRTIO_MMIO +#ifndef CONFIG_BOARD_EARLY_INITIALIZE qemu_virtio_register_mmio_devices(); +#endif #endif return OK; @@ -197,6 +199,13 @@ void board_late_initialize(void) #endif } +void board_early_initialize(void) +{ +#ifdef CONFIG_DRIVERS_VIRTIO_MMIO + qemu_virtio_register_mmio_devices(); +#endif +} + #ifdef CONFIG_BOARDCTL_POWEROFF int board_power_off(int status) {