aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-09-24 13:18:08 +0200
committerPeter Maydell <peter.maydell@linaro.org>2020-10-01 15:31:01 +0100
commitcdfaa57dcb53ba012439765a1462247dfda8595d (patch)
tree9b8c739960b9355934664d48e183a325a616eec4
parent1af702690e07f50d154e40a353f1e43ab2fbcaf1 (diff)
downloadqemu-arm-pull-target-arm-20201001.tar.gz
hw/arm/raspi: Remove use of the 'version' value in the board codepull-target-arm-20201001
We expected the 'version' ID to match the board processor ID, but this is not always true (for example boards with revision id 0xa02042/0xa22042 are Raspberry Pi 2 with a BCM2837 SoC). This was not important because we were not modelling them, but since the recent refactor now allow to model these boards, it is safer to check the processor id directly. Remove the version check. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Luc Michel <luc.michel@greensocs.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20200924111808.77168-9-f4bug@amsat.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/arm/raspi.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index ae98a2fbfc..b5b30f0f38 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -98,11 +98,6 @@ static RaspiProcessorId board_processor_id(uint32_t board_rev)
return proc_id;
}
-static int board_version(uint32_t board_rev)
-{
- return board_processor_id(board_rev) + 1;
-}
-
static const char *board_soc_type(uint32_t board_rev)
{
return soc_property[board_processor_id(board_rev)].type;
@@ -201,7 +196,8 @@ static void reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info)
cpu_set_pc(cs, info->smp_loader_start);
}
-static void setup_boot(MachineState *machine, int version, size_t ram_size)
+static void setup_boot(MachineState *machine, RaspiProcessorId processor_id,
+ size_t ram_size)
{
RaspiMachineState *s = RASPI_MACHINE(machine);
int r;
@@ -210,12 +206,13 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
s->binfo.ram_size = ram_size;
s->binfo.nb_cpus = machine->smp.cpus;
- if (version <= 2) {
- /* The rpi1 and 2 require some custom setup code to run in Secure
- * mode before booting a kernel (to set up the SMC vectors so
- * that we get a no-op SMC; this is used by Linux to call the
+ if (processor_id <= PROCESSOR_ID_BCM2836) {
+ /*
+ * The BCM2835 and BCM2836 require some custom setup code to run
+ * in Secure mode before booting a kernel (to set up the SMC vectors
+ * so that we get a no-op SMC; this is used by Linux to call the
* firmware for some cache maintenance operations.
- * The rpi3 doesn't need this.
+ * The BCM2837 doesn't need this.
*/
s->binfo.board_setup_addr = BOARDSETUP_ADDR;
s->binfo.write_board_setup = write_board_setup;
@@ -223,10 +220,10 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
s->binfo.secure_boot = true;
}
- /* Pi2 and Pi3 requires SMP setup */
- if (version >= 2) {
+ /* BCM2836 and BCM2837 requires SMP setup */
+ if (processor_id >= PROCESSOR_ID_BCM2836) {
s->binfo.smp_loader_start = SMPBOOT_ADDR;
- if (version == 2) {
+ if (processor_id == PROCESSOR_ID_BCM2836) {
s->binfo.write_secondary_boot = write_smpboot;
} else {
s->binfo.write_secondary_boot = write_smpboot64;
@@ -260,7 +257,6 @@ static void raspi_machine_init(MachineState *machine)
RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine);
RaspiMachineState *s = RASPI_MACHINE(machine);
uint32_t board_rev = mc->board_rev;
- int version = board_version(board_rev);
uint64_t ram_size = board_ram_size(board_rev);
uint32_t vcram_size;
DriveInfo *di;
@@ -301,7 +297,8 @@ static void raspi_machine_init(MachineState *machine)
vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",
&error_abort);
- setup_boot(machine, version, machine->ram_size - vcram_size);
+ setup_boot(machine, board_processor_id(mc->board_rev),
+ machine->ram_size - vcram_size);
}
static void raspi_machine_class_common_init(MachineClass *mc,