[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/27] aspeed: Map unimplemented devices in SoC memory
From: |
Cédric Le Goater |
Subject: |
[PULL 11/27] aspeed: Map unimplemented devices in SoC memory |
Date: |
Thu, 30 Jun 2022 13:23:55 +0200 |
From: Peter Delevoryas <pdel@fb.com>
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>
---
include/hw/arm/aspeed_soc.h | 9 +++++++++
hw/arm/aspeed_ast10x0.c | 16 ++++++++++------
hw/arm/aspeed_ast2600.c | 27 ++++++++++++++++++---------
hw/arm/aspeed_soc.c | 23 +++++++++++++++++++----
4 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 1ab328d00cc5..6cfc0639852e 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 */
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index f8f321374a69..d34c06db1699 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 f8c640e7fda1..dbb4a2e838f9 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,17 +274,18 @@ 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);
/* 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++) {
@@ -333,8 +341,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 500cfda724ae..369c59a0100d 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,12 +236,13 @@ 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);
/* 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++) {
@@ -619,3 +623,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);
+}
--
2.35.3
- [PULL 03/27] aspeed: Set the dram container at the SoC level, (continued)
- [PULL 03/27] aspeed: Set the dram container at the SoC level, Cédric Le Goater, 2022/06/30
- [PULL 01/27] hw: m25p80: add WP# pin and SRWD bit for write protection, Cédric Le Goater, 2022/06/30
- [PULL 04/27] aspeed/scu: Add trace events for read ops, Cédric Le Goater, 2022/06/30
- [PULL 07/27] aspeed/smc: Fix potential overflow, Cédric Le Goater, 2022/06/30
- [PULL 05/27] aspeed/i2c: Change trace event for NORMAL_STOP states, Cédric Le Goater, 2022/06/30
- [PULL 06/27] aspeed/hace: Accumulative mode supported, Cédric Le Goater, 2022/06/30
- [PULL 08/27] aspeed: Set CPU memory property explicitly, Cédric Le Goater, 2022/06/30
- [PULL 09/27] aspeed: Add memory property to Aspeed SoC, Cédric Le Goater, 2022/06/30
- [PULL 10/27] aspeed: Remove usage of sysbus_mmio_map, Cédric Le Goater, 2022/06/30
- [PULL 12/27] aspeed: Remove use of qemu_get_cpu, Cédric Le Goater, 2022/06/30
- [PULL 11/27] aspeed: Map unimplemented devices in SoC memory,
Cédric Le Goater <=
- [PULL 13/27] hw/arm/aspeed: add support for the Qualcomm DC-SCM v1 board, Cédric Le Goater, 2022/06/30
- [PULL 14/27] hw/arm/aspeed: add Qualcomm Firework BMC machine, Cédric Le Goater, 2022/06/30
- [PULL 15/27] hw/i2c: pmbus: Page #255 is valid page for read requests., Cédric Le Goater, 2022/06/30
- [PULL 17/27] hw/arm/aspeed: Add MAX31785 Fan controllers, Cédric Le Goater, 2022/06/30
- [PULL 16/27] hw/sensor: add Maxim MAX31785 device, Cédric Le Goater, 2022/06/30
- [PULL 18/27] hw/arm/aspeed: firework: Add Thermal Diodes, Cédric Le Goater, 2022/06/30
- [PULL 19/27] hw/arm/aspeed: firework: add I2C MUXes for VR channels, Cédric Le Goater, 2022/06/30
- [PULL 20/27] hw/i2c/aspeed: Fix R_I2CD_FUN_CTRL reference, Cédric Le Goater, 2022/06/30
- [PULL 21/27] hw/i2c/aspeed: Fix DMA len write-enable bit handling, Cédric Le Goater, 2022/06/30
- [PULL 22/27] hw/i2c/aspeed: Fix MASTER_EN missing error message, Cédric Le Goater, 2022/06/30