diff options
Diffstat (limited to 'hw/lm32/milkymist.c')
-rw-r--r-- | hw/lm32/milkymist.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 85913bb68b..9f8fe9fef1 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -34,6 +34,7 @@ #include "elf.h" #include "milkymist-hw.h" #include "hw/display/milkymist_tmu2.h" +#include "hw/sd/sd.h" #include "lm32.h" #include "exec/address-spaces.h" #include "qemu/cutils.h" @@ -80,6 +81,29 @@ static void main_cpu_reset(void *opaque) env->deba = reset_info->flash_base; } +static DeviceState *milkymist_memcard_create(hwaddr base) +{ + DeviceState *dev; + DriveInfo *dinfo; + + dev = qdev_new("milkymist-memcard"); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + + dinfo = drive_get_next(IF_SD); + if (dinfo) { + DeviceState *card; + + card = qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), + &error_fatal); + qdev_realize_and_unref(card, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); + } + + return dev; +} + static void milkymist_init(MachineState *machine) { |