[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/8] aspeed: Map unimplemented devices in SoC memory
From: |
Peter Delevoryas |
Subject: |
[PATCH v2 4/8] aspeed: Map unimplemented devices in SoC memory |
Date: |
Thu, 23 Jun 2022 17:36:57 -0700 |
Signed-off-by: Peter Delevoryas <pdel@fb.com>
---
hw/arm/aspeed_ast10x0.c | 16 ++++++++++------
hw/arm/aspeed_ast2600.c | 27 ++++++++++++++++++---------
hw/arm/aspeed_soc.c | 23 +++++++++++++++++++----
include/hw/arm/aspeed_soc.h | 9 +++++++++
4 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index f8f321374a..d34c06db16 100644
--- a/hw/arm/aspeed_ast10x0.c
+++ b/hw/arm/aspeed_ast10x0.c
@@ -142,6 +142,10 @@ static void aspeed_soc_ast1030_init(Object *obj)
snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
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)
@@ -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 */
- create_unimplemented_device("aspeed.sbc",
- sc->memmap[ASPEED_DEV_SBC],
- 0x40000);
- create_unimplemented_device("aspeed.io",
- sc->memmap[ASPEED_DEV_IOMEM],
- ASPEED_SOC_IOMEM_SIZE);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
+ sc->memmap[ASPEED_DEV_IOMEM],
+ ASPEED_SOC_IOMEM_SIZE);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sbc_unimplemented),
+ "aspeed.sbc", sc->memmap[ASPEED_DEV_SBC],
+ 0x40000);
/* AST1030 CPU Core */
armv7m = DEVICE(&s->armv7m);
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 477dd36042..8693660271 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -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, "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,21 +274,22 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
qemu_irq irq;
/* IO space */
- create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
- ASPEED_SOC_IOMEM_SIZE);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
+ sc->memmap[ASPEED_DEV_IOMEM],
+ ASPEED_SOC_IOMEM_SIZE);
/* RAM */
if (!aspeed_soc_dram_init(s, errp)) {
return;
}
/* Video engine stub */
- create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
- 0x1000);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.video",
+ sc->memmap[ASPEED_DEV_VIDEO], 0x1000);
/* eMMC Boot Controller stub */
- create_unimplemented_device("aspeed.emmc-boot-controller",
- sc->memmap[ASPEED_DEV_EMMC_BC],
- 0x1000);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->emmc_boot_controller),
+ "aspeed.emmc-boot-controller",
+ sc->memmap[ASPEED_DEV_EMMC_BC], 0x1000);
/* CPU */
for (i = 0; i < sc->num_cpus; i++) {
@@ -337,8 +345,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
sc->memmap[ASPEED_DEV_SRAM], &s->sram);
/* DPMCU */
- create_unimplemented_device("aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMCU],
- ASPEED_SOC_DPMCU_SIZE);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->dpmcu), "aspeed.dpmcu",
+ sc->memmap[ASPEED_DEV_DPMCU],
+ ASPEED_SOC_DPMCU_SIZE);
/* SCU */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 46cbc63644..16394c8e0b 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -223,6 +223,9 @@ static void aspeed_soc_init(Object *obj)
snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname);
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)
@@ -233,8 +236,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
Error *err = NULL;
/* IO space */
- create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
- ASPEED_SOC_IOMEM_SIZE);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
+ sc->memmap[ASPEED_DEV_IOMEM],
+ ASPEED_SOC_IOMEM_SIZE);
/* RAM */
if (!aspeed_soc_dram_init(s, errp)) {
@@ -242,8 +246,8 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
}
/* Video engine stub */
- create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
- 0x1000);
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->video), "aspeed.video",
+ sc->memmap[ASPEED_DEV_VIDEO], 0x1000);
/* CPU */
for (i = 0; i < sc->num_cpus; i++) {
@@ -611,3 +615,14 @@ void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev,
int n, hwaddr addr)
memory_region_add_subregion(s->memory, addr,
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);
+}
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 1ab328d00c..6cfc063985 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -34,6 +34,7 @@
#include "hw/usb/hcd-ehci.h"
#include "qom/object.h"
#include "hw/misc/aspeed_lpc.h"
+#include "hw/misc/unimp.h"
#define ASPEED_SPIS_NUM 2
#define ASPEED_EHCIS_NUM 2
@@ -66,6 +67,7 @@ struct AspeedSoCState {
AspeedSMCState spi[ASPEED_SPIS_NUM];
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
AspeedSBCState sbc;
+ UnimplementedDeviceState sbc_unimplemented;
AspeedSDMCState sdmc;
AspeedWDTState wdt[ASPEED_WDTS_NUM];
FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
@@ -77,6 +79,10 @@ struct AspeedSoCState {
AspeedLPCState lpc;
uint32_t uart_default;
Clock *sysclk;
+ UnimplementedDeviceState iomem;
+ UnimplementedDeviceState video;
+ UnimplementedDeviceState emmc_boot_controller;
+ UnimplementedDeviceState dpmcu;
};
#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);
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_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
+ const char *name, hwaddr addr,
+ uint64_t size);
#endif /* ASPEED_SOC_H */
--
2.30.2
- [PATCH v2 0/8] aspeed: Add multi-SoC machine, Peter Delevoryas, 2022/06/23
- [PATCH v2 4/8] aspeed: Map unimplemented devices in SoC memory,
Peter Delevoryas <=
- [PATCH v2 3/8] aspeed: Remove usage of sysbus_mmio_map, Peter Delevoryas, 2022/06/23
- [PATCH v2 2/8] aspeed: Add memory property to Aspeed SoC, Peter Delevoryas, 2022/06/23
- [PATCH v2 8/8] aspeed: Add AST2600 (BMC) to fby35, Peter Delevoryas, 2022/06/23
- [PATCH v2 7/8] aspeed: Make aspeed_board_init_flashes public, Peter Delevoryas, 2022/06/23