Patchwork [RFC,9/9] hw/exynos4210.c: Create two virtio-mmio transport instances.

login
register
mail settings
Submitter Evgeny Voevodin
Date April 25, 2012, 5:54 a.m.
Message ID <1335333257-5128-10-git-send-email-e.voevodin@samsung.com>
Download mbox | patch
Permalink /patch/154805/
State New
Headers show

Comments

Evgeny Voevodin - April 25, 2012, 5:54 a.m.
NB: This is for test purposes only.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 hw/exynos4210.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/exynos4210.c b/hw/exynos4210.c
index afc4bdc..e065a86 100644
--- a/hw/exynos4210.c
+++ b/hw/exynos4210.c
@@ -26,6 +26,7 @@ 
 #include "sysbus.h"
 #include "arm-misc.h"
 #include "loader.h"
+#include "virtio-mmio.h"
 #include "exynos4210.h"
 
 #define EXYNOS4210_CHIPID_ADDR         0x10000000
@@ -62,6 +63,11 @@ 
 /* Display controllers (FIMD) */
 #define EXYNOS4210_FIMD0_BASE_ADDR          0x11C00000
 
+/* VirtIO BLK */
+#define EXYNOS4210_VIRTIO_BLK_BASE_ADDR     0x10AD0000
+/* VirtIO NET */
+#define EXYNOS4210_VIRTIO_NET_BASE_ADDR     0x10AC0000
+
 static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43,
                                     0x09, 0x00, 0x00, 0x00 };
 
@@ -105,6 +111,7 @@  Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
     unsigned long mem_size;
     DeviceState *dev;
     SysBusDevice *busdev;
+    BusState *virtio_bus;
 
     for (n = 0; n < EXYNOS4210_NCPUS; n++) {
         s->env[n] = cpu_init("cortex-a9");
@@ -296,5 +303,10 @@  Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
             s->irq_table[exynos4210_get_irq(11, 2)],
             NULL);
 
+    virtio_bus = virtio_mmio_bus_init();
+    virtio_mmio_create_transport(virtio_bus, EXYNOS4210_VIRTIO_BLK_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(37, 3)]);
+    virtio_mmio_create_transport(virtio_bus, EXYNOS4210_VIRTIO_NET_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(37, 2)]);
     return s;
 }