mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
aspeed: Map unimplemented devices in SoC memory
Signed-off-by: Peter Delevoryas <pdel@fb.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220624003701.1363500-5-pdel@fb.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
5bfcbda70d
commit
80beb08567
4 changed files with 56 additions and 19 deletions
|
@ -142,6 +142,10 @@ static void aspeed_soc_ast1030_init(Object *obj)
|
||||||
|
|
||||||
snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
|
snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
|
||||||
object_initialize_child(obj, "gpio", &s->gpio, typename);
|
object_initialize_child(obj, "gpio", &s->gpio, typename);
|
||||||
|
|
||||||
|
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
|
object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented,
|
||||||
|
TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||||
|
@ -158,12 +162,12 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General I/O memory space to catch all unimplemented device */
|
/* General I/O memory space to catch all unimplemented device */
|
||||||
create_unimplemented_device("aspeed.sbc",
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
|
||||||
sc->memmap[ASPEED_DEV_SBC],
|
sc->memmap[ASPEED_DEV_IOMEM],
|
||||||
0x40000);
|
ASPEED_SOC_IOMEM_SIZE);
|
||||||
create_unimplemented_device("aspeed.io",
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sbc_unimplemented),
|
||||||
sc->memmap[ASPEED_DEV_IOMEM],
|
"aspeed.sbc", sc->memmap[ASPEED_DEV_SBC],
|
||||||
ASPEED_SOC_IOMEM_SIZE);
|
0x40000);
|
||||||
|
|
||||||
/* AST1030 CPU Core */
|
/* AST1030 CPU Core */
|
||||||
armv7m = DEVICE(&s->armv7m);
|
armv7m = DEVICE(&s->armv7m);
|
||||||
|
|
|
@ -246,6 +246,13 @@ static void aspeed_soc_ast2600_init(Object *obj)
|
||||||
object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
|
object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
|
||||||
|
|
||||||
object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_SBC);
|
object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_SBC);
|
||||||
|
|
||||||
|
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
|
object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
|
object_initialize_child(obj, "dpmcu", &s->dpmcu, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
|
object_initialize_child(obj, "emmc-boot-controller",
|
||||||
|
&s->emmc_boot_controller,
|
||||||
|
TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -267,17 +274,18 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
|
|
||||||
/* IO space */
|
/* IO space */
|
||||||
create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
|
||||||
ASPEED_SOC_IOMEM_SIZE);
|
sc->memmap[ASPEED_DEV_IOMEM],
|
||||||
|
ASPEED_SOC_IOMEM_SIZE);
|
||||||
|
|
||||||
/* Video engine stub */
|
/* Video engine stub */
|
||||||
create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.video",
|
||||||
0x1000);
|
sc->memmap[ASPEED_DEV_VIDEO], 0x1000);
|
||||||
|
|
||||||
/* eMMC Boot Controller stub */
|
/* eMMC Boot Controller stub */
|
||||||
create_unimplemented_device("aspeed.emmc-boot-controller",
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->emmc_boot_controller),
|
||||||
sc->memmap[ASPEED_DEV_EMMC_BC],
|
"aspeed.emmc-boot-controller",
|
||||||
0x1000);
|
sc->memmap[ASPEED_DEV_EMMC_BC], 0x1000);
|
||||||
|
|
||||||
/* CPU */
|
/* CPU */
|
||||||
for (i = 0; i < sc->num_cpus; i++) {
|
for (i = 0; i < sc->num_cpus; i++) {
|
||||||
|
@ -333,8 +341,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
|
||||||
sc->memmap[ASPEED_DEV_SRAM], &s->sram);
|
sc->memmap[ASPEED_DEV_SRAM], &s->sram);
|
||||||
|
|
||||||
/* DPMCU */
|
/* DPMCU */
|
||||||
create_unimplemented_device("aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMCU],
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu",
|
||||||
ASPEED_SOC_DPMCU_SIZE);
|
sc->memmap[ASPEED_DEV_DPMCU],
|
||||||
|
ASPEED_SOC_DPMCU_SIZE);
|
||||||
|
|
||||||
/* SCU */
|
/* SCU */
|
||||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
|
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
|
||||||
|
|
|
@ -223,6 +223,9 @@ static void aspeed_soc_init(Object *obj)
|
||||||
|
|
||||||
snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname);
|
snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname);
|
||||||
object_initialize_child(obj, "hace", &s->hace, typename);
|
object_initialize_child(obj, "hace", &s->hace, typename);
|
||||||
|
|
||||||
|
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
|
object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||||
|
@ -233,12 +236,13 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
/* IO space */
|
/* IO space */
|
||||||
create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
|
||||||
ASPEED_SOC_IOMEM_SIZE);
|
sc->memmap[ASPEED_DEV_IOMEM],
|
||||||
|
ASPEED_SOC_IOMEM_SIZE);
|
||||||
|
|
||||||
/* Video engine stub */
|
/* Video engine stub */
|
||||||
create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
|
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.video",
|
||||||
0x1000);
|
sc->memmap[ASPEED_DEV_VIDEO], 0x1000);
|
||||||
|
|
||||||
/* CPU */
|
/* CPU */
|
||||||
for (i = 0; i < sc->num_cpus; i++) {
|
for (i = 0; i < sc->num_cpus; i++) {
|
||||||
|
@ -619,3 +623,14 @@ void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr)
|
||||||
memory_region_add_subregion(s->memory, addr,
|
memory_region_add_subregion(s->memory, addr,
|
||||||
sysbus_mmio_get_region(dev, n));
|
sysbus_mmio_get_region(dev, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
|
||||||
|
const char *name, hwaddr addr, uint64_t size)
|
||||||
|
{
|
||||||
|
qdev_prop_set_string(DEVICE(dev), "name", name);
|
||||||
|
qdev_prop_set_uint64(DEVICE(dev), "size", size);
|
||||||
|
sysbus_realize(dev, &error_abort);
|
||||||
|
|
||||||
|
memory_region_add_subregion_overlap(s->memory, addr,
|
||||||
|
sysbus_mmio_get_region(dev, 0), -1000);
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "hw/usb/hcd-ehci.h"
|
#include "hw/usb/hcd-ehci.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
#include "hw/misc/aspeed_lpc.h"
|
#include "hw/misc/aspeed_lpc.h"
|
||||||
|
#include "hw/misc/unimp.h"
|
||||||
|
|
||||||
#define ASPEED_SPIS_NUM 2
|
#define ASPEED_SPIS_NUM 2
|
||||||
#define ASPEED_EHCIS_NUM 2
|
#define ASPEED_EHCIS_NUM 2
|
||||||
|
@ -66,6 +67,7 @@ struct AspeedSoCState {
|
||||||
AspeedSMCState spi[ASPEED_SPIS_NUM];
|
AspeedSMCState spi[ASPEED_SPIS_NUM];
|
||||||
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
|
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
|
||||||
AspeedSBCState sbc;
|
AspeedSBCState sbc;
|
||||||
|
UnimplementedDeviceState sbc_unimplemented;
|
||||||
AspeedSDMCState sdmc;
|
AspeedSDMCState sdmc;
|
||||||
AspeedWDTState wdt[ASPEED_WDTS_NUM];
|
AspeedWDTState wdt[ASPEED_WDTS_NUM];
|
||||||
FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
|
FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
|
||||||
|
@ -77,6 +79,10 @@ struct AspeedSoCState {
|
||||||
AspeedLPCState lpc;
|
AspeedLPCState lpc;
|
||||||
uint32_t uart_default;
|
uint32_t uart_default;
|
||||||
Clock *sysclk;
|
Clock *sysclk;
|
||||||
|
UnimplementedDeviceState iomem;
|
||||||
|
UnimplementedDeviceState video;
|
||||||
|
UnimplementedDeviceState emmc_boot_controller;
|
||||||
|
UnimplementedDeviceState dpmcu;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TYPE_ASPEED_SOC "aspeed-soc"
|
#define TYPE_ASPEED_SOC "aspeed-soc"
|
||||||
|
@ -169,5 +175,8 @@ qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
|
||||||
void aspeed_soc_uart_init(AspeedSoCState *s);
|
void aspeed_soc_uart_init(AspeedSoCState *s);
|
||||||
bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp);
|
bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp);
|
||||||
void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr);
|
void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr);
|
||||||
|
void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
|
||||||
|
const char *name, hwaddr addr,
|
||||||
|
uint64_t size);
|
||||||
|
|
||||||
#endif /* ASPEED_SOC_H */
|
#endif /* ASPEED_SOC_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue