riscv: qemu: Enumerate virtio bus during early boot
authorBin Meng <bmeng.cn@gmail.com>
Mon, 15 Oct 2018 09:21:13 +0000 (02:21 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 14 Nov 2018 17:16:27 +0000 (09:16 -0800)
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@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
board/emulation/qemu-riscv/Kconfig
board/emulation/qemu-riscv/qemu-riscv.c

index af23363fcf719c214b35aa67cf672d61dd64467f..5ae56da7645a1372bff8b08cef5d811a2f45a96a 100644 (file)
@@ -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
index 041e716c9bf1bdb78cfd7c181a7c96f3e7e10863..2730a288fb123554ad6e1c8c06b35266332aa464 100644 (file)
@@ -4,12 +4,21 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <fdtdec.h>
+#include <virtio_types.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;
 }