diff mbox series

[v3,7/8] hw/arm/raspi: Use RaspiProcessorId to set the firmware load address

Message ID 20200921075628.466506-8-f4bug@amsat.org
State New
Headers show
Series hw/arm/raspi: QOM housekeeping to be able to add more machines | expand

Commit Message

Philippe Mathieu-Daudé Sept. 21, 2020, 7:56 a.m. UTC
The firmware load address depends of the SoC ("processor id") used,
not of the version of the board.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/raspi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Sept. 21, 2020, 4:41 p.m. UTC | #1
On 9/21/20 9:56 AM, Philippe Mathieu-Daudé wrote:
> The firmware load address depends of the SoC ("processor id") used,

> not of the version of the board.

> 


I forgot:
Suggested-by: Luc Michel <luc.michel@greensocs.com>

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>  hw/arm/raspi.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c

> index 0d8e5a34c78..ae98a2fbfca 100644

> --- a/hw/arm/raspi.c

> +++ b/hw/arm/raspi.c

> @@ -238,7 +238,8 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)

>       * the normal Linux boot process

>       */

>      if (machine->firmware) {

> -        hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2;

> +        hwaddr firmware_addr = processor_id <= PROCESSOR_ID_BCM2836

> +                             ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3;

>          /* load the firmware image (typically kernel.img) */

>          r = load_image_targphys(machine->firmware, firmware_addr,

>                                  ram_size - firmware_addr);

>
Luc Michel Sept. 21, 2020, 7:59 p.m. UTC | #2
Hi Phil,

Just two small typos in the commit message.

On 9/21/20 9:56 AM, Philippe Mathieu-Daudé wrote:
> The firmware load address depends of the SoC ("processor id") used,

"depends on"
> not of the version of the board.

"not on"

Otherwise:

Reviewed-by: Luc Michel <luc.michel@greensocs.com>



> 

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>   hw/arm/raspi.c | 3 ++-

>   1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c

> index 0d8e5a34c78..ae98a2fbfca 100644

> --- a/hw/arm/raspi.c

> +++ b/hw/arm/raspi.c

> @@ -238,7 +238,8 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)

>        * the normal Linux boot process

>        */

>       if (machine->firmware) {

> -        hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2;

> +        hwaddr firmware_addr = processor_id <= PROCESSOR_ID_BCM2836

> +                             ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3;

>           /* load the firmware image (typically kernel.img) */

>           r = load_image_targphys(machine->firmware, firmware_addr,

>                                   ram_size - firmware_addr);

>
diff mbox series

Patch

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 0d8e5a34c78..ae98a2fbfca 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -238,7 +238,8 @@  static void setup_boot(MachineState *machine, int version, size_t ram_size)
      * the normal Linux boot process
      */
     if (machine->firmware) {
-        hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2;
+        hwaddr firmware_addr = processor_id <= PROCESSOR_ID_BCM2836
+                             ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3;
         /* load the firmware image (typically kernel.img) */
         r = load_image_targphys(machine->firmware, firmware_addr,
                                 ram_size - firmware_addr);