aspeed: add a RAM memory region container
The RAM memory region is defined after the SoC is realized when the SDMC controller has checked that the defined RAM size for the machine is correct. This is problematic for controller models requiring a link on the RAM region, for DMA support in the SMC controller for instance. Introduce a container memory region for the RAM that we can link into the controllers early, before the SoC is realized. It will be populated with the RAM region after the checks have be done. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-id: 20190618165311.27066-14-clg@kaod.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
026498a8f1
commit
ad1a978218
@ -33,6 +33,7 @@ static struct arm_boot_info aspeed_board_binfo = {
|
||||
|
||||
struct AspeedBoardState {
|
||||
AspeedSoCState soc;
|
||||
MemoryRegion ram_container;
|
||||
MemoryRegion ram;
|
||||
MemoryRegion max_ram;
|
||||
};
|
||||
@ -159,6 +160,10 @@ static void aspeed_board_init(MachineState *machine,
|
||||
ram_addr_t max_ram_size;
|
||||
|
||||
bmc = g_new0(AspeedBoardState, 1);
|
||||
|
||||
memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container",
|
||||
UINT32_MAX);
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
|
||||
(sizeof(bmc->soc)), cfg->soc_name, &error_abort,
|
||||
NULL);
|
||||
@ -193,16 +198,16 @@ static void aspeed_board_init(MachineState *machine,
|
||||
&error_abort);
|
||||
|
||||
memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
|
||||
memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
sc->info->memmap[ASPEED_SDRAM], &bmc->ram);
|
||||
sc->info->memmap[ASPEED_SDRAM],
|
||||
&bmc->ram_container);
|
||||
|
||||
max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
|
||||
&error_abort);
|
||||
memory_region_init_io(&bmc->max_ram, NULL, &max_ram_ops, NULL,
|
||||
"max_ram", max_ram_size - ram_size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
sc->info->memmap[ASPEED_SDRAM] + ram_size,
|
||||
&bmc->max_ram);
|
||||
memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
|
||||
|
||||
aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort);
|
||||
aspeed_board_init_flashes(&bmc->soc.spi[0], cfg->spi_model, &error_abort);
|
||||
|
Loading…
Reference in New Issue
Block a user