[U-Boot] [PATCH 17/27] riscv: qemu: Enumerate virtio bus during early boot

Bin Meng bmeng.cn at gmail.com
Sun Sep 23 13:42:15 UTC 2018


Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 board/emulation/qemu-riscv/Kconfig      | 3 +++
 board/emulation/qemu-riscv/qemu-riscv.c | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
index af23363..5ae56da 100644
--- a/board/emulation/qemu-riscv/Kconfig
+++ b/board/emulation/qemu-riscv/Kconfig
@@ -18,5 +18,8 @@ config SYS_TEXT_BASE
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
 	imply SYS_NS16550
+	imply VIRTIO_MMIO
+	imply VIRTIO_NET
+	imply VIRTIO_BLK
 
 endif
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index 041e716..5ab0a62 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -5,11 +5,18 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <virtio.h>
 
 #define MROM_FDT_ADDR	0x1020
 
 int board_init(void)
 {
+	/*
+	 * Make sure virtio bus is enumerated so that peripherals
+	 * on the virtio bus can be discovered by their drivers
+	 */
+	virtio_init();
+
 	return 0;
 }
 
-- 
2.7.4



More information about the U-Boot mailing list