aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2016-09-22 18:13:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-09-22 18:13:06 +0100
commitde46f5f46c1bb169045432a8208a9e10a662b55d (patch)
tree8fe36e4a7065bf2b47e5502f8186ec13694a7e3d /hw/arm
parentc6c7cfb01a00be0553f6694bbe71d45fc5e068c8 (diff)
aspeed: allocate RAM after the memory controller has checked the size
If the RAM size is invalid, the memory controller will use a default value. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Message-id: 1473438177-26079-15-git-send-email-clg@kaod.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/aspeed.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 562bbb2533..6b18c7f172 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -108,11 +108,6 @@ static void aspeed_board_init(MachineState *machine,
sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
- memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
- memory_region_add_subregion(get_system_memory(), sc->info->sdram_base,
- &bmc->ram);
- object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
- &error_abort);
object_property_set_int(OBJECT(&bmc->soc), ram_size, "ram-size",
&error_abort);
object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
@@ -120,6 +115,19 @@ static void aspeed_board_init(MachineState *machine,
object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
&error_abort);
+ /*
+ * Allocate RAM after the memory controller has checked the size
+ * was valid. If not, a default value is used.
+ */
+ ram_size = object_property_get_int(OBJECT(&bmc->soc), "ram-size",
+ &error_abort);
+
+ memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
+ memory_region_add_subregion(get_system_memory(), sc->info->sdram_base,
+ &bmc->ram);
+ object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
+ &error_abort);
+
aspeed_board_init_flashes(&bmc->soc.smc, "n25q256a", &error_abort);
aspeed_board_init_flashes(&bmc->soc.spi, "mx25l25635e", &error_abort);