All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support
@ 2018-02-16  7:01 Pekka Enberg
  2018-02-16  7:01 ` [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable Pekka Enberg
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pekka Enberg @ 2018-02-16  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Pekka Enberg

This patch series adds support for Raspberry Pi 3 as a new machine model
"raspi3", which is an extension of the "raspi2" model with the following
differences:

  - Default CPU type is "cortex-a53"
  - Firmware is at address 0x80000
  - Board ID is 0xc44 and board revision is 0xa02082

The patches were written by me but I used Zoltán Baldaszti's previous
work as a reference (with permission from the author):
    
  https://github.com/bztsrc/qemu-raspi3

Also available from:

  git@github.com:penberg/qemu.git raspi3/v2

Changes from v1 to v2:

- Wrap Raspberry Pi 3 machine definition with TARGET_AARCH64 (Peter
  Maydell)

Pekka Enberg (3):
  bcm2836: Make CPU type configurable
  raspi: Raspberry Pi 3 support
  raspi: Add "raspi3" machine type

 hw/arm/bcm2836.c         | 17 ++++++++-------
 hw/arm/raspi.c           | 57 +++++++++++++++++++++++++++++++++++++++---------
 include/hw/arm/bcm2836.h |  1 +
 3 files changed, 57 insertions(+), 18 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable
  2018-02-16  7:01 [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Pekka Enberg
@ 2018-02-16  7:01 ` Pekka Enberg
  2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support Pekka Enberg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2018-02-16  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Pekka Enberg

This patch adds a "cpu-type" property to BCM2836 SoC in preparation for
reusing the code for the Raspberry Pi 3, which has a different processor
model.

Signed-off-by: Pekka Enberg <penberg@iki.fi>
---
 hw/arm/bcm2836.c         | 17 +++++++++--------
 hw/arm/raspi.c           |  3 +++
 include/hw/arm/bcm2836.h |  1 +
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
index 8c43291112..40e8b25a46 100644
--- a/hw/arm/bcm2836.c
+++ b/hw/arm/bcm2836.c
@@ -26,14 +26,6 @@
 static void bcm2836_init(Object *obj)
 {
     BCM2836State *s = BCM2836(obj);
-    int n;
-
-    for (n = 0; n < BCM2836_NCPUS; n++) {
-        object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
-                          "cortex-a15-" TYPE_ARM_CPU);
-        object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
-                                  &error_abort);
-    }
 
     object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
     object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
@@ -59,6 +51,14 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
 
     /* common peripherals from bcm2835 */
 
+    obj = OBJECT(dev);
+    for (n = 0; n < BCM2836_NCPUS; n++) {
+        object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
+                          s->cpu_type);
+        object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
+                                  &error_abort);
+    }
+
     obj = object_property_get_link(OBJECT(dev), "ram", &err);
     if (obj == NULL) {
         error_setg(errp, "%s: required ram link not found: %s",
@@ -150,6 +150,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
 }
 
 static Property bcm2836_props[] = {
+    DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type),
     DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS),
     DEFINE_PROP_END_OF_LIST()
 };
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index cd5fa8c3dc..c24a4a1b14 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -135,6 +135,8 @@ static void raspi2_init(MachineState *machine)
     /* Setup the SOC */
     object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
                                    &error_abort);
+    object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
+                            &error_abort);
     object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
                             &error_abort);
     object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev",
@@ -166,6 +168,7 @@ static void raspi2_machine_init(MachineClass *mc)
     mc->no_parallel = 1;
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
     mc->max_cpus = BCM2836_NCPUS;
     mc->min_cpus = BCM2836_NCPUS;
     mc->default_cpus = BCM2836_NCPUS;
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
index 76de1996af..4758b4ae54 100644
--- a/include/hw/arm/bcm2836.h
+++ b/include/hw/arm/bcm2836.h
@@ -25,6 +25,7 @@ typedef struct BCM2836State {
     DeviceState parent_obj;
     /*< public >*/
 
+    char *cpu_type;
     uint32_t enabled_cpus;
 
     ARMCPU cpus[BCM2836_NCPUS];
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support
  2018-02-16  7:01 [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Pekka Enberg
  2018-02-16  7:01 ` [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable Pekka Enberg
@ 2018-02-16  7:02 ` Pekka Enberg
  2019-09-03 12:42   ` Philippe Mathieu-Daudé
  2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 3/3] raspi: Add "raspi3" machine type Pekka Enberg
  2018-02-16  9:16 ` [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Peter Maydell
  3 siblings, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2018-02-16  7:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Pekka Enberg

This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The
differences to Pi 2 are:

 - Firmware address
 - Board ID
 - Board revision

The CPU is different too, but that's going to be configured as part of
the machine default CPU when we introduce a new machine type.

The patch was written from scratch by me but the logic is similar to
Zoltán Baldaszti's previous work, which I used as a reference (with
permission from the author):

  https://github.com/bztsrc/qemu-raspi3

Signed-off-by: Pekka Enberg <penberg@iki.fi>
---
 hw/arm/raspi.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index c24a4a1b14..66fe10e376 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -5,6 +5,9 @@
  * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
  * Written by Andrew Baumann
  *
+ * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti
+ * Upstream code cleanup (c) 2018 Pekka Enberg 
+ *
  * This code is licensed under the GNU GPLv2 and later.
  */
 
@@ -22,10 +25,11 @@
 #define SMPBOOT_ADDR    0x300 /* this should leave enough space for ATAGS */
 #define MVBAR_ADDR      0x400 /* secure vectors */
 #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
-#define FIRMWARE_ADDR   0x8000 /* Pi loads kernel.img here by default */
+#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
+#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
 
 /* Table of Linux board IDs for different Pi versions */
-static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43};
+static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
 
 typedef struct RasPiState {
     BCM2836State soc;
@@ -83,8 +87,8 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
     binfo.secure_board_setup = true;
     binfo.secure_boot = true;
 
-    /* Pi2 requires SMP setup */
-    if (version == 2) {
+    /* Pi2 and Pi3 requires SMP setup */
+    if (version >= 2) {
         binfo.smp_loader_start = SMPBOOT_ADDR;
         binfo.write_secondary_boot = write_smpboot;
         binfo.secondary_cpu_reset_hook = reset_secondary;
@@ -94,15 +98,16 @@ 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;
         /* load the firmware image (typically kernel.img) */
-        r = load_image_targphys(machine->firmware, FIRMWARE_ADDR,
-                                ram_size - FIRMWARE_ADDR);
+        r = load_image_targphys(machine->firmware, firmware_addr,
+                                ram_size - firmware_addr);
         if (r < 0) {
             error_report("Failed to load firmware from %s", machine->firmware);
             exit(1);
         }
 
-        binfo.entry = FIRMWARE_ADDR;
+        binfo.entry = firmware_addr;
         binfo.firmware_loaded = true;
     } else {
         binfo.kernel_filename = machine->kernel_filename;
@@ -113,7 +118,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
     arm_load_kernel(ARM_CPU(first_cpu), &binfo);
 }
 
-static void raspi2_init(MachineState *machine)
+static void raspi_init(MachineState *machine, int version)
 {
     RasPiState *s = g_new0(RasPiState, 1);
     uint32_t vcram_size;
@@ -139,7 +144,8 @@ static void raspi2_init(MachineState *machine)
                             &error_abort);
     object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
                             &error_abort);
-    object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev",
+    int board_rev = version == 3 ? 0xa02082 : 0xa21041;
+    object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev",
                             &error_abort);
     object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort);
 
@@ -157,7 +163,12 @@ static void raspi2_init(MachineState *machine)
 
     vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",
                                           &error_abort);
-    setup_boot(machine, 2, machine->ram_size - vcram_size);
+    setup_boot(machine, version, machine->ram_size - vcram_size);
+}
+
+static void raspi2_init(MachineState *machine)
+{
+    raspi_init(machine, 2);
 }
 
 static void raspi2_machine_init(MachineClass *mc)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 3/3] raspi: Add "raspi3" machine type
  2018-02-16  7:01 [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Pekka Enberg
  2018-02-16  7:01 ` [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable Pekka Enberg
  2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support Pekka Enberg
@ 2018-02-16  7:02 ` Pekka Enberg
  2018-02-16  9:16 ` [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2018-02-16  7:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Pekka Enberg

This patch adds a "raspi3" machine type, which can now be selected as
the machine to run on by users via the "-M" command line option to QEMU.

The machine type does *not* ignore memory transaction failures so we
likely need to add some dummy devices later when people run something
more complicated than what I'm using for testing.

Signed-off-by: Pekka Enberg <penberg@iki.fi>
---
 hw/arm/raspi.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 66fe10e376..ff54f45e3e 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -187,3 +187,26 @@ static void raspi2_machine_init(MachineClass *mc)
     mc->ignore_memory_transaction_failures = true;
 };
 DEFINE_MACHINE("raspi2", raspi2_machine_init)
+
+#ifdef TARGET_AARCH64
+static void raspi3_init(MachineState *machine)
+{
+    raspi_init(machine, 3);
+}
+
+static void raspi3_machine_init(MachineClass *mc)
+{
+    mc->desc = "Raspberry Pi 3";
+    mc->init = raspi3_init;
+    mc->block_default_type = IF_SD;
+    mc->no_parallel = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
+    mc->max_cpus = BCM2836_NCPUS;
+    mc->min_cpus = BCM2836_NCPUS;
+    mc->default_cpus = BCM2836_NCPUS;
+    mc->default_ram_size = 1024 * 1024 * 1024;
+}
+DEFINE_MACHINE("raspi3", raspi3_machine_init)
+#endif
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support
  2018-02-16  7:01 [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Pekka Enberg
                   ` (2 preceding siblings ...)
  2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 3/3] raspi: Add "raspi3" machine type Pekka Enberg
@ 2018-02-16  9:16 ` Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2018-02-16  9:16 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: QEMU Developers

On 16 February 2018 at 07:01, Pekka Enberg <penberg@iki.fi> wrote:
> This patch series adds support for Raspberry Pi 3 as a new machine model
> "raspi3", which is an extension of the "raspi2" model with the following
> differences:
>
>   - Default CPU type is "cortex-a53"
>   - Firmware is at address 0x80000
>   - Board ID is 0xc44 and board revision is 0xa02082
>
> The patches were written by me but I used Zoltán Baldaszti's previous
> work as a reference (with permission from the author):
>
>   https://github.com/bztsrc/qemu-raspi3
>
> Also available from:
>
>   git@github.com:penberg/qemu.git raspi3/v2
>
> Changes from v1 to v2:
>
> - Wrap Raspberry Pi 3 machine definition with TARGET_AARCH64 (Peter
>   Maydell)

Hi. Patches 1 and 2 for this are already in master, and I have
patch 3 queued -- it's just dependent on a bugfix (patch posted)
that's needed for big-endian host systems.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support
  2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support Pekka Enberg
@ 2019-09-03 12:42   ` Philippe Mathieu-Daudé
  2019-09-04 14:35     ` bzt
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-03 12:42 UTC (permalink / raw)
  To: Pekka Enberg, Zoltán Baldaszti
  Cc: Peter Maydell, qemu-arm, qemu-devel@nongnu.org Developers,
	Andrew Baumann

Hi Pekka and Zoltán,

On Fri, Feb 16, 2018 at 8:04 AM Pekka Enberg <penberg@iki.fi> wrote:
>
> This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The
> differences to Pi 2 are:
>
>  - Firmware address
>  - Board ID
>  - Board revision
>
> The CPU is different too, but that's going to be configured as part of
> the machine default CPU when we introduce a new machine type.
>
> The patch was written from scratch by me but the logic is similar to
> Zoltán Baldaszti's previous work, which I used as a reference (with
> permission from the author):
>
>   https://github.com/bztsrc/qemu-raspi3
>
> Signed-off-by: Pekka Enberg <penberg@iki.fi>
> ---
>  hw/arm/raspi.c | 31 +++++++++++++++++++++----------
>  1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index c24a4a1b14..66fe10e376 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -5,6 +5,9 @@
>   * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
>   * Written by Andrew Baumann
>   *
> + * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti
> + * Upstream code cleanup (c) 2018 Pekka Enberg
> + *
>   * This code is licensed under the GNU GPLv2 and later.
>   */
>
> @@ -22,10 +25,11 @@
>  #define SMPBOOT_ADDR    0x300 /* this should leave enough space for ATAGS */
>  #define MVBAR_ADDR      0x400 /* secure vectors */
>  #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
> -#define FIRMWARE_ADDR   0x8000 /* Pi loads kernel.img here by default */
> +#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
> +#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
>
>  /* Table of Linux board IDs for different Pi versions */
> -static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43};
> +static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};

Where does the value 0xc44 comes from?

I can only find 0xc42/0xc43 defined:
https://github.com/raspberrypi/linux/blob/rpi-3.18.y/arch/arm/tools/mach-types#L525

0xc43 seems controversial, see
http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-February/001268.html
addition: https://github.com/raspberrypi/linux/commit/d9fac63adac#diff-6722037d79570df5b392a49e0e006573R526

Looking at the firmware source, the r1 register is always set to the
BCM2708 machine id before calling the kernel:
https://github.com/raspberrypi/tools/blob/920c7ed2ee/armstubs/armstub7.S#L133

Thanks,

Phil.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support
  2019-09-03 12:42   ` Philippe Mathieu-Daudé
@ 2019-09-04 14:35     ` bzt
  0 siblings, 0 replies; 7+ messages in thread
From: bzt @ 2019-09-04 14:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, qemu-arm, Pekka Enberg, Andrew Baumann,
	qemu-devel@nongnu.org Developers

Dear Phil,

As you can see, the board ids are quite controversial, and bcm2837 is
not listed at all. Therefore 0xc44 is just a constant to identify qemu
"board". Feel free to change the id if you'd like.

About the r1 register, you've liked the wrong firmware. That's for
AArch32 mode, not for AArch64 mode which the raspi3 machine type uses.
In AArch64 mode, the firmware
https://github.com/raspberrypi/tools/blob/920c7ed2ee/armstubs/armstub8.S
passes only the device tree pointer in x0 and only for the primary
CPU, no board id of any kind.

Yes I know that the real firmware can start a hw raspi3 board in 32
bit mode, but it's better to have 64 bit as default, as raspi2 is 32
bit only anyway. Unfortunately there's no way to autodetect if the
image passed to the -kernel argument was compiled for AArch32 or
AArch64 mode, the instructions are way to similarly encoded and
there's no magic in raw binaries. Real hw board differentiates by
checking the file name of the kernel file on the boot partition (named
kernel7.img vs. kernel8.img) and parsing config.txt for arm specific
options. This is not an option for qemu as it does not emulate VC GPU
bootcode nor does it receive an entire boot partition with the -kernel
argument. Another reason to use AArch64 for raspi3 machine is if a
real board finds both kernel7.img and kernel8.img on the boot
partition, then it will load the AArch64 kernel.

Cheers,
bzt

On 9/3/19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Pekka and Zoltán,
>
> On Fri, Feb 16, 2018 at 8:04 AM Pekka Enberg <penberg@iki.fi> wrote:
>>
>> This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The
>> differences to Pi 2 are:
>>
>>  - Firmware address
>>  - Board ID
>>  - Board revision
>>
>> The CPU is different too, but that's going to be configured as part of
>> the machine default CPU when we introduce a new machine type.
>>
>> The patch was written from scratch by me but the logic is similar to
>> Zoltán Baldaszti's previous work, which I used as a reference (with
>> permission from the author):
>>
>>   https://github.com/bztsrc/qemu-raspi3
>>
>> Signed-off-by: Pekka Enberg <penberg@iki.fi>
>> ---
>>  hw/arm/raspi.c | 31 +++++++++++++++++++++----------
>>  1 file changed, 21 insertions(+), 10 deletions(-)
>>
>> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
>> index c24a4a1b14..66fe10e376 100644
>> --- a/hw/arm/raspi.c
>> +++ b/hw/arm/raspi.c
>> @@ -5,6 +5,9 @@
>>   * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
>>   * Written by Andrew Baumann
>>   *
>> + * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti
>> + * Upstream code cleanup (c) 2018 Pekka Enberg
>> + *
>>   * This code is licensed under the GNU GPLv2 and later.
>>   */
>>
>> @@ -22,10 +25,11 @@
>>  #define SMPBOOT_ADDR    0x300 /* this should leave enough space for ATAGS
>> */
>>  #define MVBAR_ADDR      0x400 /* secure vectors */
>>  #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
>> -#define FIRMWARE_ADDR   0x8000 /* Pi loads kernel.img here by default */
>> +#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default
>> */
>> +#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default
>> */
>>
>>  /* Table of Linux board IDs for different Pi versions */
>> -static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43};
>> +static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] =
>> 0xc44};
>
> Where does the value 0xc44 comes from?
>
> I can only find 0xc42/0xc43 defined:
> https://github.com/raspberrypi/linux/blob/rpi-3.18.y/arch/arm/tools/mach-types#L525
>
> 0xc43 seems controversial, see
> http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-February/001268.html
> addition:
> https://github.com/raspberrypi/linux/commit/d9fac63adac#diff-6722037d79570df5b392a49e0e006573R526
>
> Looking at the firmware source, the r1 register is always set to the
> BCM2708 machine id before calling the kernel:
> https://github.com/raspberrypi/tools/blob/920c7ed2ee/armstubs/armstub7.S#L133
>
> Thanks,
>
> Phil.
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-09-04 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16  7:01 [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Pekka Enberg
2018-02-16  7:01 ` [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable Pekka Enberg
2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support Pekka Enberg
2019-09-03 12:42   ` Philippe Mathieu-Daudé
2019-09-04 14:35     ` bzt
2018-02-16  7:02 ` [Qemu-devel] [PATCH v2 3/3] raspi: Add "raspi3" machine type Pekka Enberg
2018-02-16  9:16 ` [Qemu-devel] [PATCH v2 0/3] Raspberry Pi 3 support Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.