mirror of https://github.com/xemu-project/xemu.git
hw/arm/stellaris: Add missing QOM 'SoC' parent
QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Since we don't model the SoC, just use a QOM container. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240213155214.13619-5-philmd@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
7e4a8d9dbe
commit
243b8602a6
|
@ -1031,6 +1031,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
* 400fe000 system control
|
* 400fe000 system control
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Object *soc_container;
|
||||||
DeviceState *gpio_dev[7], *nvic;
|
DeviceState *gpio_dev[7], *nvic;
|
||||||
qemu_irq gpio_in[7][8];
|
qemu_irq gpio_in[7][8];
|
||||||
qemu_irq gpio_out[7][8];
|
qemu_irq gpio_out[7][8];
|
||||||
|
@ -1052,6 +1053,9 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
flash_size = (((board->dc0 & 0xffff) + 1) << 1) * 1024;
|
flash_size = (((board->dc0 & 0xffff) + 1) << 1) * 1024;
|
||||||
sram_size = ((board->dc0 >> 18) + 1) * 1024;
|
sram_size = ((board->dc0 >> 18) + 1) * 1024;
|
||||||
|
|
||||||
|
soc_container = object_new("container");
|
||||||
|
object_property_add_child(OBJECT(ms), "soc", soc_container);
|
||||||
|
|
||||||
/* Flash programming is done via the SCU, so pretend it is ROM. */
|
/* Flash programming is done via the SCU, so pretend it is ROM. */
|
||||||
memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size,
|
memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size,
|
||||||
&error_fatal);
|
&error_fatal);
|
||||||
|
@ -1066,6 +1070,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
* need its sysclk output.
|
* need its sysclk output.
|
||||||
*/
|
*/
|
||||||
ssys_dev = qdev_new(TYPE_STELLARIS_SYS);
|
ssys_dev = qdev_new(TYPE_STELLARIS_SYS);
|
||||||
|
object_property_add_child(soc_container, "sys", OBJECT(ssys_dev));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Most devices come preprogrammed with a MAC address in the user data.
|
* Most devices come preprogrammed with a MAC address in the user data.
|
||||||
|
@ -1092,6 +1097,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
|
||||||
|
|
||||||
nvic = qdev_new(TYPE_ARMV7M);
|
nvic = qdev_new(TYPE_ARMV7M);
|
||||||
|
object_property_add_child(soc_container, "v7m", OBJECT(nvic));
|
||||||
qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
|
qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
|
||||||
qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
|
qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
|
||||||
qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
|
qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
|
||||||
|
@ -1125,6 +1131,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
|
|
||||||
dev = qdev_new(TYPE_STELLARIS_GPTM);
|
dev = qdev_new(TYPE_STELLARIS_GPTM);
|
||||||
sbd = SYS_BUS_DEVICE(dev);
|
sbd = SYS_BUS_DEVICE(dev);
|
||||||
|
object_property_add_child(soc_container, "gptm[*]", OBJECT(dev));
|
||||||
qdev_connect_clock_in(dev, "clk",
|
qdev_connect_clock_in(dev, "clk",
|
||||||
qdev_get_clock_out(ssys_dev, "SYSCLK"));
|
qdev_get_clock_out(ssys_dev, "SYSCLK"));
|
||||||
sysbus_realize_and_unref(sbd, &error_fatal);
|
sysbus_realize_and_unref(sbd, &error_fatal);
|
||||||
|
@ -1138,7 +1145,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
|
|
||||||
if (board->dc1 & (1 << 3)) { /* watchdog present */
|
if (board->dc1 & (1 << 3)) { /* watchdog present */
|
||||||
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
|
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
|
||||||
|
object_property_add_child(soc_container, "wdg", OBJECT(dev));
|
||||||
qdev_connect_clock_in(dev, "WDOGCLK",
|
qdev_connect_clock_in(dev, "WDOGCLK",
|
||||||
qdev_get_clock_out(ssys_dev, "SYSCLK"));
|
qdev_get_clock_out(ssys_dev, "SYSCLK"));
|
||||||
|
|
||||||
|
@ -1178,6 +1185,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
SysBusDevice *sbd;
|
SysBusDevice *sbd;
|
||||||
|
|
||||||
dev = qdev_new("pl011_luminary");
|
dev = qdev_new("pl011_luminary");
|
||||||
|
object_property_add_child(soc_container, "uart[*]", OBJECT(dev));
|
||||||
sbd = SYS_BUS_DEVICE(dev);
|
sbd = SYS_BUS_DEVICE(dev);
|
||||||
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
|
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
|
||||||
sysbus_realize_and_unref(sbd, &error_fatal);
|
sysbus_realize_and_unref(sbd, &error_fatal);
|
||||||
|
@ -1298,6 +1306,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||||
DeviceState *enet;
|
DeviceState *enet;
|
||||||
|
|
||||||
enet = qdev_new("stellaris_enet");
|
enet = qdev_new("stellaris_enet");
|
||||||
|
object_property_add_child(soc_container, "enet", OBJECT(enet));
|
||||||
if (nd) {
|
if (nd) {
|
||||||
qdev_set_nic_properties(enet, nd);
|
qdev_set_nic_properties(enet, nd);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue