spapr: Do NVDIMM/PC-DIMM device hotplug sanity checks at pre-plug only
[qemu/ar7.git] / hw / arm / mcimx6ul-evk.c
blobed69a7b037ad6e056ed3f06da9d0ed07e29550ed
1 /*
2 * Copyright (c) 2018 Jean-Christophe Dubois <jcd@tribudubois.net>
4 * MCIMX6UL_EVK Board System emulation.
6 * This code is licensed under the GPL, version 2 or later.
7 * See the file `COPYING' in the top level directory.
9 * It (partially) emulates a mcimx6ul_evk board, with a Freescale
10 * i.MX6ul SoC
13 #include "qemu/osdep.h"
14 #include "qapi/error.h"
15 #include "hw/arm/fsl-imx6ul.h"
16 #include "hw/boards.h"
17 #include "hw/qdev-properties.h"
18 #include "sysemu/sysemu.h"
19 #include "qemu/error-report.h"
20 #include "sysemu/qtest.h"
22 static void mcimx6ul_evk_init(MachineState *machine)
24 static struct arm_boot_info boot_info;
25 FslIMX6ULState *s;
26 int i;
28 if (machine->ram_size > FSL_IMX6UL_MMDC_SIZE) {
29 error_report("RAM size " RAM_ADDR_FMT " above max supported (%08x)",
30 machine->ram_size, FSL_IMX6UL_MMDC_SIZE);
31 exit(1);
34 boot_info = (struct arm_boot_info) {
35 .loader_start = FSL_IMX6UL_MMDC_ADDR,
36 .board_id = -1,
37 .ram_size = machine->ram_size,
38 .nb_cpus = machine->smp.cpus,
41 s = FSL_IMX6UL(object_new(TYPE_FSL_IMX6UL));
42 object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
43 object_property_set_uint(OBJECT(s), "fec1-phy-num", 2, &error_fatal);
44 object_property_set_uint(OBJECT(s), "fec2-phy-num", 1, &error_fatal);
45 qdev_realize(DEVICE(s), NULL, &error_fatal);
47 memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR,
48 machine->ram);
50 for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) {
51 BusState *bus;
52 DeviceState *carddev;
53 DriveInfo *di;
54 BlockBackend *blk;
56 di = drive_get_next(IF_SD);
57 blk = di ? blk_by_legacy_dinfo(di) : NULL;
58 bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
59 carddev = qdev_new(TYPE_SD_CARD);
60 qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
61 qdev_realize_and_unref(carddev, bus, &error_fatal);
64 if (!qtest_enabled()) {
65 arm_load_kernel(&s->cpu, machine, &boot_info);
69 static void mcimx6ul_evk_machine_init(MachineClass *mc)
71 mc->desc = "Freescale i.MX6UL Evaluation Kit (Cortex A7)";
72 mc->init = mcimx6ul_evk_init;
73 mc->max_cpus = FSL_IMX6UL_NUM_CPUS;
74 mc->default_ram_id = "mcimx6ul-evk.ram";
76 DEFINE_MACHINE("mcimx6ul-evk", mcimx6ul_evk_machine_init)