[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/12] aspeed/smc: Stop using the model name for the memory re
From: |
Cédric Le Goater |
Subject: |
[PATCH v2 03/12] aspeed/smc: Stop using the model name for the memory regions |
Date: |
Mon, 20 Sep 2021 18:23:00 +0200 |
There is no real reason to use this name. It's simply nice to have in
the monitor output but it's a burden for the following patch which
removes the AspeedSMCController structure describing the controller.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/ssi/aspeed_smc.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index def1cb4c74c0..612040493cf1 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -1392,20 +1392,15 @@ static const MemoryRegionOps aspeed_smc_ops = {
*/
static void aspeed_smc_dma_setup(AspeedSMCState *s, Error **errp)
{
- char *name;
-
if (!s->dram_mr) {
error_setg(errp, TYPE_ASPEED_SMC ": 'dram' link not set");
return;
}
- name = g_strdup_printf("%s-dma-flash", s->ctrl->name);
- address_space_init(&s->flash_as, &s->mmio_flash, name);
- g_free(name);
-
- name = g_strdup_printf("%s-dma-dram", s->ctrl->name);
- address_space_init(&s->dram_as, s->dram_mr, name);
- g_free(name);
+ address_space_init(&s->flash_as, &s->mmio_flash,
+ TYPE_ASPEED_SMC ".dma-flash");
+ address_space_init(&s->dram_as, s->dram_mr,
+ TYPE_ASPEED_SMC ".dma-dram");
}
static void aspeed_smc_realize(DeviceState *dev, Error **errp)
@@ -1446,7 +1441,7 @@ static void aspeed_smc_realize(DeviceState *dev, Error
**errp)
/* The memory region for the controller registers */
memory_region_init_io(&s->mmio, OBJECT(s), &aspeed_smc_ops, s,
- s->ctrl->name, s->ctrl->nregs * 4);
+ TYPE_ASPEED_SMC, s->ctrl->nregs * 4);
sysbus_init_mmio(sbd, &s->mmio);
/*
@@ -1454,12 +1449,12 @@ static void aspeed_smc_realize(DeviceState *dev, Error
**errp)
* window in which the flash modules are mapped. The size and
* address depends on the SoC model and controller type.
*/
- snprintf(name, sizeof(name), "%s.flash", s->ctrl->name);
-
memory_region_init_io(&s->mmio_flash, OBJECT(s),
- &aspeed_smc_flash_default_ops, s, name,
+ &aspeed_smc_flash_default_ops, s,
+ TYPE_ASPEED_SMC ".flash",
s->ctrl->flash_window_size);
- memory_region_init_alias(&s->mmio_flash_alias, OBJECT(s), name,
+ memory_region_init_alias(&s->mmio_flash_alias, OBJECT(s),
+ TYPE_ASPEED_SMC ".flash",
&s->mmio_flash, 0, s->ctrl->flash_window_size);
sysbus_init_mmio(sbd, &s->mmio_flash_alias);
@@ -1475,7 +1470,7 @@ static void aspeed_smc_realize(DeviceState *dev, Error
**errp)
for (i = 0; i < s->ctrl->max_peripherals; ++i) {
AspeedSMCFlash *fl = &s->flashes[i];
- snprintf(name, sizeof(name), "%s.%d", s->ctrl->name, i);
+ snprintf(name, sizeof(name), TYPE_ASPEED_SMC ".flash.%d", i);
fl->id = i;
fl->controller = s;
--
2.31.1
- [PATCH v2 00/12] aspeed: SMC cleanups and QOMification, Cédric Le Goater, 2021/09/20
- [PATCH v2 01/12] aspeed/smc: Add watchdog Control/Status Registers, Cédric Le Goater, 2021/09/20
- [PATCH v2 02/12] aspeed/smc: Introduce aspeed_smc_error() helper, Cédric Le Goater, 2021/09/20
- [PATCH v2 03/12] aspeed/smc: Stop using the model name for the memory regions,
Cédric Le Goater <=
- [PATCH v2 06/12] aspeed/smc: Remove the 'size' attribute from AspeedSMCFlash, Cédric Le Goater, 2021/09/20
- [PATCH v2 05/12] aspeed/smc: Remove the 'flash' attribute from AspeedSMCFlash, Cédric Le Goater, 2021/09/20
- [PATCH v2 07/12] aspeed/smc: Rename AspeedSMCFlash 'id' to 'cs', Cédric Le Goater, 2021/09/20
- [PATCH v2 04/12] aspeed/smc: Drop AspeedSMCController structure, Cédric Le Goater, 2021/09/20
- [PATCH v2 11/12] aspeed/smc: Remove unused attribute 'irqline', Cédric Le Goater, 2021/09/20
- [PATCH v2 08/12] aspeed/smc: QOMify AspeedSMCFlash, Cédric Le Goater, 2021/09/20
- [PATCH v2 12/12] aspeed/i2c: QOMify AspeedI2CBus, Cédric Le Goater, 2021/09/20
- [PATCH v2 09/12] aspeed/smc: Add default reset values, Cédric Le Goater, 2021/09/20
- [PATCH v2 10/12] aspeed/smc: Introduce a new addr_width() class handler, Cédric Le Goater, 2021/09/20