[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/6] hw/arm/raspi: Get board RAM size from board revision cod
From: |
Igor Mammedov |
Subject: |
Re: [PATCH 4/6] hw/arm/raspi: Get board RAM size from board revision code |
Date: |
Mon, 3 Feb 2020 10:58:39 +0100 |
On Mon, 3 Feb 2020 09:26:17 +0100
Philippe Mathieu-Daudé <address@hidden> wrote:
> The amount of RAM is encoded in the board revision.
> Add the board_ram_size() helper, it will allow us to quickly
> support new boards.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Acked-by: Igor Mammedov <address@hidden>
> ---
> hw/arm/raspi.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index f5e54fe876..656d834e07 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -13,6 +13,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu/units.h"
> +#include "qemu/cutils.h"
> #include "qapi/error.h"
> #include "cpu.h"
> #include "hw/arm/bcm2836.h"
> @@ -71,6 +72,11 @@ static const RaspiBoardInfo raspi_boards[] = {
> #endif
> };
>
> +static uint64_t board_ram_size(const RaspiBoardInfo *config)
> +{
> + return 1 * MiB << extract32(config->board_rev, 20, 4);
> +}
> +
> static int board_chip_id(const RaspiBoardInfo *config)
> {
> return extract32(config->board_rev, 12, 4);
> @@ -222,10 +228,13 @@ static void raspi_init(MachineState *machine, const
> RaspiBoardInfo *config)
> BlockBackend *blk;
> BusState *bus;
> DeviceState *carddev;
> + uint64_t ram_size;
>
> - if (machine->ram_size > 1 * GiB) {
> - error_report("Requested ram size is too large for this machine: "
> - "maximum is 1GB");
> + ram_size = board_ram_size(config);
> + if (machine->ram_size != ram_size) {
> + char *size_str = size_to_str(ram_size);
> + error_report("This machine can only be used with %s", size_str);
> + g_free(size_str);
> exit(1);
> }
>
- [PATCH 0/6] hw/arm/raspi: Dynamically create machines based on the board revision, Philippe Mathieu-Daudé, 2020/02/03
- [PATCH 2/6] hw/arm/raspi: Get board version from board revision code, Philippe Mathieu-Daudé, 2020/02/03
- [PATCH 3/6] hw/arm/raspi: Get the SoC type name from the revision code, Philippe Mathieu-Daudé, 2020/02/03
- [PATCH 1/6] hw/arm/raspi: Use BCM2708 machine type with pre Device Tree kernels, Philippe Mathieu-Daudé, 2020/02/03
- [PATCH 4/6] hw/arm/raspi: Get board RAM size from board revision code, Philippe Mathieu-Daudé, 2020/02/03
- Re: [PATCH 4/6] hw/arm/raspi: Get board RAM size from board revision code,
Igor Mammedov <=
- [PATCH 6/6] hw/arm/raspi: Get the CPU core count from the revision code, Philippe Mathieu-Daudé, 2020/02/03
- [PATCH 5/6] hw/arm/raspi: Dynamically create machines based on the board revision, Philippe Mathieu-Daudé, 2020/02/03
- Re: [PATCH 0/6] hw/arm/raspi: Dynamically create machines based on the board revision, no-reply, 2020/02/03