Received: from eggs.gnu.org ([2001:4830:134:3::10]:53732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biObd-0003Zy-FE for qemu-devel@nongnu.org; Fri, 09 Sep 2016 12:24:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biObX-00067i-SP for qemu-devel@nongnu.org; Fri, 09 Sep 2016 12:24:44 -0400 Received: from 8.mo178.mail-out.ovh.net ([46.105.74.227]:43284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biObX-00067U-NK for qemu-devel@nongnu.org; Fri, 09 Sep 2016 12:24:39 -0400 Received: from player714.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 4875BFFC95D for ; Fri, 9 Sep 2016 18:24:39 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Fri, 9 Sep 2016 18:22:57 +0200 Message-Id: <1473438177-26079-15-git-send-email-clg@kaod.org> In-Reply-To: <1473438177-26079-1-git-send-email-clg@kaod.org> References: <1473438177-26079-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v5 14/14] aspeed: allocate RAM after the memory controller has checked the size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= If the RAM size is invalid, the memory controller will use a default value. Signed-off-by: C=C3=A9dric Le Goater --- hw/arm/aspeed.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 562bbb253391..6b18c7f1727c 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -108,11 +108,6 @@ static void aspeed_board_init(MachineState *machine, =20 sc =3D ASPEED_SOC_GET_CLASS(&bmc->soc); =20 - memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_siz= e); - memory_region_add_subregion(get_system_memory(), sc->info->sdram_bas= e, - &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-strap= 1", @@ -120,6 +115,19 @@ static void aspeed_board_init(MachineState *machine, object_property_set_bool(OBJECT(&bmc->soc), true, "realized", &error_abort); =20 + /* + * Allocate RAM after the memory controller has checked the size + * was valid. If not, a default value is used. + */ + ram_size =3D object_property_get_int(OBJECT(&bmc->soc), "ram-size", + &error_abort); + + memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_siz= e); + memory_region_add_subregion(get_system_memory(), sc->info->sdram_bas= e, + &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= ); =20 --=20 2.7.4