@@ -296,7 +296,6 @@ static void mips_fulong2e_init(MachineState *machine)
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *bios = g_new(MemoryRegion, 1);
- ram_addr_t ram_size = machine->ram_size;
long bios_size;
uint8_t *spd_data;
Error *err = NULL;
@@ -315,10 +314,14 @@ static void mips_fulong2e_init(MachineState *machine)
qemu_register_reset(main_cpu_reset, cpu);
/* TODO: support more than 256M RAM as highmem */
- ram_size = 256 * MiB;
+ if (machine->ram_size != 256 * MiB) {
+ error_report("Invalid RAM size, should be 256MB");
+ exit(EXIT_FAILURE);
+ }
/* allocate RAM */
- memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size);
+ memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram",
+ machine->ram_size);
memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE,
&error_fatal);
memory_region_set_readonly(bios, true);
@@ -332,7 +335,7 @@ static void mips_fulong2e_init(MachineState *machine)
*/
if (kernel_filename) {
- loaderparams.ram_size = ram_size;
+ loaderparams.ram_size = machine->ram_size;
loaderparams.kernel_filename = kernel_filename;
loaderparams.kernel_cmdline = kernel_cmdline;
loaderparams.initrd_filename = initrd_filename;
@@ -378,7 +381,7 @@ static void mips_fulong2e_init(MachineState *machine)
}
/* Populate SPD eeprom data */
- spd_data = spd_data_generate(DDR, ram_size, &err);
+ spd_data = spd_data_generate(DDR, machine->ram_size, &err);
if (err) {
warn_report_err(err);
}