diff mbox series

[8/9] hw/arm/stellaris: Only map existing devices as unimplemented

Message ID 20250110160204.74997-9-philmd@linaro.org
State New
Headers show
Series hw/arm/stellaris: Fix overwritten IRQs and cleanups | expand

Commit Message

Philippe Mathieu-Daudé Jan. 10, 2025, 4:02 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/stellaris.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Comments

Peter Maydell Jan. 27, 2025, 2:18 p.m. UTC | #1
On Fri, 10 Jan 2025 at 16:02, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/arm/stellaris.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index d87587225c2..c89522332e2 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -1390,11 +1390,21 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
>      /* Add dummy regions for the devices we don't implement yet,
>       * so guest accesses don't cause unlogged crashes.
>       */
> -    create_unimplemented_device("PWM", 0x40028000, 0x1000);
> -    create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
> -    create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
> -    create_unimplemented_device("analogue-comparator", 0x4003c000, 0x1000);
> -    create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
> +    if (DEV_CAP(1, PWM)) {
> +        create_unimplemented_device("PWM", 0x40028000, 0x1000);
> +    }
> +    if (DEV_CAP(2, QEI(0))) {
> +        create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
> +    }
> +    if (DEV_CAP(2, QEI(0))) {

Should be QEI(1), I guess.

> +        create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
> +    }
> +    if (DEV_CAP(2, COMP(0))) {
> +        create_unimplemented_device("analogue-comparator", 0x4003c000, 0x1000);
> +    }
> +    if (DEV_CAP(1, HIB)) {
> +        create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
> +    }

Again, it would be helpful to flag up the behaviour changes here.
I think:

 * both boards have the PWM bit set : no change
 * both boards have COMP(0) set : no change
 * both boards have HIB set : no change
 * LM3S6965EVB sets QEI(0) and QEI(1), but LM3S811EVB does not:
   so we are (correctly) removing the unimplemented-device regions
   on that board type.

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index d87587225c2..c89522332e2 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -1390,11 +1390,21 @@  static void stellaris_init(MachineState *ms, stellaris_board_info *board)
     /* Add dummy regions for the devices we don't implement yet,
      * so guest accesses don't cause unlogged crashes.
      */
-    create_unimplemented_device("PWM", 0x40028000, 0x1000);
-    create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
-    create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
-    create_unimplemented_device("analogue-comparator", 0x4003c000, 0x1000);
-    create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
+    if (DEV_CAP(1, PWM)) {
+        create_unimplemented_device("PWM", 0x40028000, 0x1000);
+    }
+    if (DEV_CAP(2, QEI(0))) {
+        create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
+    }
+    if (DEV_CAP(2, QEI(0))) {
+        create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
+    }
+    if (DEV_CAP(2, COMP(0))) {
+        create_unimplemented_device("analogue-comparator", 0x4003c000, 0x1000);
+    }
+    if (DEV_CAP(1, HIB)) {
+        create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
+    }
     create_unimplemented_device("flash-control", 0x400fd000, 0x1000);
 
     armv7m_load_kernel(ARM_CPU(first_cpu), ms->kernel_filename, 0, flash_size);