diff mbox series

test: acpi: Handle both 32bit and 64bit ACPI tables

Message ID 20230813012559.361067-1-marek.vasut+renesas@mailbox.org
State Accepted
Commit 5ebe790ff02eb21fe74e0f3992b3b2416c609d18
Delegated to: Tom Rini
Headers show
Series test: acpi: Handle both 32bit and 64bit ACPI tables | expand

Commit Message

Marek Vasut Aug. 13, 2023, 1:25 a.m. UTC
Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
the same way drivers/cpu/cpu_sandbox.c sets those ACPI tables up.
This fixes "$ ./u-boot -Tc 'ut dm dm_test_acpi_write_tables'"
test failure on sandbox64.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Simon Glass <sjg@chromium.org>
---
 test/dm/acpi.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Simon Glass Aug. 13, 2023, 1:36 p.m. UTC | #1
On Sat, 12 Aug 2023 at 19:26, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
> the same way drivers/cpu/cpu_sandbox.c sets those ACPI tables up.
> This fixes "$ ./u-boot -Tc 'ut dm dm_test_acpi_write_tables'"
> test failure on sandbox64.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  test/dm/acpi.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/test/dm/acpi.c b/test/dm/acpi.c
> index 77eb524b59f..5997bda649b 100644
> --- a/test/dm/acpi.c
> +++ b/test/dm/acpi.c
> @@ -221,7 +221,8 @@ static int dm_test_acpi_create_dmar(struct unit_test_state *uts)
>         ut_assertnonnull(cpu);
>         ut_assertok(acpi_create_dmar(&dmar, DMAR_INTR_REMAP));
>         ut_asserteq(DMAR_INTR_REMAP, dmar.flags);
> -       ut_asserteq(32 - 1, dmar.host_address_width);
> +       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
> +                   dmar.host_address_width);
>
>         return 0;
>  }
> @@ -277,13 +278,16 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts)
>          */
>         ut_asserteq_ptr(dmar + 3, ctx.current);
>         ut_asserteq(DMAR_INTR_REMAP, dmar->flags);
> -       ut_asserteq(32 - 1, dmar->host_address_width);
> +       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
> +                   dmar->host_address_width);
>
>         ut_asserteq(DMAR_INTR_REMAP, dmar[1].flags);
> -       ut_asserteq(32 - 1, dmar[1].host_address_width);
> +       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
> +                   dmar[1].host_address_width);
>
>         ut_asserteq(DMAR_INTR_REMAP, dmar[2].flags);
> -       ut_asserteq(32 - 1, dmar[2].host_address_width);
> +       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
> +                   dmar[2].host_address_width);
>
>         /* Check that the pointers were added correctly */
>         for (i = 0; i < 3; i++) {
> --
> 2.40.1
>
Tom Rini Aug. 23, 2023, 2:41 p.m. UTC | #2
On Sun, Aug 13, 2023 at 03:25:59AM +0200, Marek Vasut wrote:

> Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
> the same way drivers/cpu/cpu_sandbox.c sets those ACPI tables up.
> This fixes "$ ./u-boot -Tc 'ut dm dm_test_acpi_write_tables'"
> test failure on sandbox64.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 77eb524b59f..5997bda649b 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -221,7 +221,8 @@  static int dm_test_acpi_create_dmar(struct unit_test_state *uts)
 	ut_assertnonnull(cpu);
 	ut_assertok(acpi_create_dmar(&dmar, DMAR_INTR_REMAP));
 	ut_asserteq(DMAR_INTR_REMAP, dmar.flags);
-	ut_asserteq(32 - 1, dmar.host_address_width);
+	ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+		    dmar.host_address_width);
 
 	return 0;
 }
@@ -277,13 +278,16 @@  static int dm_test_acpi_write_tables(struct unit_test_state *uts)
 	 */
 	ut_asserteq_ptr(dmar + 3, ctx.current);
 	ut_asserteq(DMAR_INTR_REMAP, dmar->flags);
-	ut_asserteq(32 - 1, dmar->host_address_width);
+	ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+		    dmar->host_address_width);
 
 	ut_asserteq(DMAR_INTR_REMAP, dmar[1].flags);
-	ut_asserteq(32 - 1, dmar[1].host_address_width);
+	ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+		    dmar[1].host_address_width);
 
 	ut_asserteq(DMAR_INTR_REMAP, dmar[2].flags);
-	ut_asserteq(32 - 1, dmar[2].host_address_width);
+	ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+		    dmar[2].host_address_width);
 
 	/* Check that the pointers were added correctly */
 	for (i = 0; i < 3; i++) {