#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "qemu/cutils.h"
#include "qapi/error.h"
#include "cpu.h"
#include "hw/arm/bcm2836.h"
FIELD(REV_CODE, MEMORY_SIZE, 20, 3);
FIELD(REV_CODE, STYLE, 23, 1);
+static uint64_t board_ram_size(uint32_t board_rev)
+{
+ assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */
+ return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE);
+}
+
static int board_processor_id(uint32_t board_rev)
{
assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */
{
RasPiState *s = g_new0(RasPiState, 1);
int version = board_version(board_rev);
+ uint64_t ram_size = board_ram_size(board_rev);
uint32_t vcram_size;
DriveInfo *di;
BlockBackend *blk;
BusState *bus;
DeviceState *carddev;
- if (machine->ram_size > 1 * GiB) {
- error_report("Requested ram size is too large for this machine: "
- "maximum is 1GB");
+ if (machine->ram_size != ram_size) {
+ char *size_str = size_to_str(ram_size);
+ error_report("Invalid RAM size, should be %s", size_str);
+ g_free(size_str);
exit(1);
}