aboutsummaryrefslogtreecommitdiff
path: root/test/dm/acpi.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-31 08:25:54 -0700
committerSimon Glass <sjg@chromium.org>2024-01-07 13:45:07 -0700
commita8efebe71978b3b21e04c7f104987ada879e0800 (patch)
treebd0394b2a6d67b3e40d13fe538576e91259a1708 /test/dm/acpi.c
parent5e3adc44a4da72b25fa78e9f9847a8c297b3ebaf (diff)
downloadu-boot-a8efebe71978b3b21e04c7f104987ada879e0800.zip
u-boot-a8efebe71978b3b21e04c7f104987ada879e0800.tar.gz
u-boot-a8efebe71978b3b21e04c7f104987ada879e0800.tar.bz2
acpi: Write pointers to tables instead of addresses
Sandbox uses an API to map between addresses and pointers. This allows it to have (emulated) memory at zero and avoid arch-specific addressing details. It also allows memory-mapped peripherals to work. As an example, on many machines sandbox maps address 100 to pointer value 10000000. However this is not correct for ACPI, if sandbox starts another program (e.g EFI app) and passes it the tables. That app has no knowledge of sandbox's address mapping. So to make this work we want to store 10000000 as the value in the table. Add two new 'nomap' functions which clearly make this exeption to how sandbox works. This should allow EFI apps to access ACPI tables with sandbox, e.g. for testing purposes. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'test/dm/acpi.c')
-rw-r--r--test/dm/acpi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 1211e2f..c53ebcd 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -291,8 +291,8 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts)
/* Check that the pointers were added correctly */
for (i = 0; i < 3; i++) {
- ut_asserteq(map_to_sysmem(dmar + i), ctx.rsdt->entry[i]);
- ut_asserteq(map_to_sysmem(dmar + i), ctx.xsdt->entry[i]);
+ ut_asserteq(nomap_to_sysmem(dmar + i), ctx.rsdt->entry[i]);
+ ut_asserteq(nomap_to_sysmem(dmar + i), ctx.xsdt->entry[i]);
}
ut_asserteq(0, ctx.rsdt->entry[3]);
ut_asserteq(0, ctx.xsdt->entry[3]);
@@ -371,8 +371,8 @@ static int dm_test_acpi_ctx_and_base_tables(struct unit_test_state *uts)
end = PTR_ALIGN((void *)xsdt + sizeof(*xsdt), 64);
ut_asserteq_ptr(end, ctx.current);
- ut_asserteq(map_to_sysmem(rsdt), rsdp->rsdt_address);
- ut_asserteq(map_to_sysmem(xsdt), rsdp->xsdt_address);
+ ut_asserteq(nomap_to_sysmem(rsdt), rsdp->rsdt_address);
+ ut_asserteq(nomap_to_sysmem(xsdt), rsdp->xsdt_address);
return 0;
}
@@ -445,7 +445,7 @@ static int dm_test_acpi_cmd_dump(struct unit_test_state *uts)
/* Now a real table */
console_record_reset();
run_command("acpi dump dmar", 0);
- addr = ALIGN(map_to_sysmem(ctx.xsdt) + sizeof(struct acpi_xsdt), 64);
+ addr = ALIGN(nomap_to_sysmem(ctx.xsdt) + sizeof(struct acpi_xsdt), 64);
ut_assert_nextline("DMAR @ %16lx", addr);
ut_assert_nextlines_are_dump(0x30);
ut_assert_console_end();