diff mbox series

[v3,1/8] hw/arm/raspi: Display the board revision in the machine description

Message ID 20200921075628.466506-2-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
Display the board revision in the machine description.

Before:

  $ qemu-system-aarch64 -M help | fgrep raspi
  raspi2               Raspberry Pi 2B
  raspi3               Raspberry Pi 3B

After:

  raspi2               Raspberry Pi 2B (revision 1.1)
  raspi3               Raspberry Pi 3B (revision 1.2)

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

Comments

Luc Michel Sept. 21, 2020, 7:53 p.m. UTC | #1
On 9/21/20 9:56 AM, Philippe Mathieu-Daudé wrote:
> Display the board revision in the machine description.

> 

> Before:

> 

>    $ qemu-system-aarch64 -M help | fgrep raspi

>    raspi2               Raspberry Pi 2B

>    raspi3               Raspberry Pi 3B

> 

> After:

> 

>    raspi2               Raspberry Pi 2B (revision 1.1)

>    raspi3               Raspberry Pi 3B (revision 1.2)

> 

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


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


> ---

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

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

> 

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

> index 811eaf52ff5..46d9ed7f054 100644

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

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

> @@ -312,7 +312,9 @@ static void raspi_machine_class_init(ObjectClass *oc, void *data)

>       uint32_t board_rev = (uint32_t)(uintptr_t)data;

>   

>       rmc->board_rev = board_rev;

> -    mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev));

> +    mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)",

> +                               board_type(board_rev),

> +                               FIELD_EX32(board_rev, REV_CODE, REVISION));

>       mc->init = raspi_machine_init;

>       mc->block_default_type = IF_SD;

>       mc->no_parallel = 1;

>
diff mbox series

Patch

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 811eaf52ff5..46d9ed7f054 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -312,7 +312,9 @@  static void raspi_machine_class_init(ObjectClass *oc, void *data)
     uint32_t board_rev = (uint32_t)(uintptr_t)data;
 
     rmc->board_rev = board_rev;
-    mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev));
+    mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)",
+                               board_type(board_rev),
+                               FIELD_EX32(board_rev, REV_CODE, REVISION));
     mc->init = raspi_machine_init;
     mc->block_default_type = IF_SD;
     mc->no_parallel = 1;