浏览代码

macio: add addr property to macio IDE object

This contains the offset of the IDE controller within the macio address space
and is required to allow the address to be included within the fw path.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Mark Cave-Ayland 7 年之前
父节点
当前提交
5c8e3d17ed
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 1 0
      hw/ide/macio.c
  2. 3 2
      hw/misc/macio/macio.c
  3. 1 0
      include/hw/misc/macio/macio.h

+ 1 - 0
hw/ide/macio.c

@@ -461,6 +461,7 @@ static void macio_ide_initfn(Object *obj)
 
 
 static Property macio_ide_properties[] = {
 static Property macio_ide_properties[] = {
     DEFINE_PROP_UINT32("channel", MACIOIDEState, channel, 0),
     DEFINE_PROP_UINT32("channel", MACIOIDEState, channel, 0),
+    DEFINE_PROP_UINT32("addr", MACIOIDEState, addr, -1),
     DEFINE_PROP_END_OF_LIST(),
     DEFINE_PROP_END_OF_LIST(),
 };
 };
 
 

+ 3 - 2
hw/misc/macio/macio.c

@@ -219,10 +219,11 @@ static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, size_t ide_size,
                            int index)
                            int index)
 {
 {
     gchar *name = g_strdup_printf("ide[%i]", index);
     gchar *name = g_strdup_printf("ide[%i]", index);
+    uint32_t addr = 0x1f000 + ((index + 1) * 0x1000);
 
 
     macio_init_child_obj(s, name, ide, ide_size, TYPE_MACIO_IDE);
     macio_init_child_obj(s, name, ide, ide_size, TYPE_MACIO_IDE);
-    memory_region_add_subregion(&s->bar, 0x1f000 + ((index + 1) * 0x1000),
-                                &ide->mem);
+    qdev_prop_set_uint32(DEVICE(ide), "addr", addr);
+    memory_region_add_subregion(&s->bar, addr, &ide->mem);
     g_free(name);
     g_free(name);
 }
 }
 
 

+ 1 - 0
include/hw/misc/macio/macio.h

@@ -51,6 +51,7 @@ typedef struct MACIOIDEState {
     /*< private >*/
     /*< private >*/
     SysBusDevice parent_obj;
     SysBusDevice parent_obj;
     /*< public >*/
     /*< public >*/
+    uint32_t addr;
     uint32_t channel;
     uint32_t channel;
     qemu_irq real_ide_irq;
     qemu_irq real_ide_irq;
     qemu_irq real_dma_irq;
     qemu_irq real_dma_irq;