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>
This commit is contained in:
12
cmd/acpi.c
12
cmd/acpi.c
@@ -45,7 +45,7 @@ static int dump_table_name(const char *sig)
|
||||
if (!hdr)
|
||||
return -ENOENT;
|
||||
printf("%.*s @ %16lx\n", ACPI_NAME_LEN, hdr->signature,
|
||||
(ulong)map_to_sysmem(hdr));
|
||||
(ulong)nomap_to_sysmem(hdr));
|
||||
print_buffer(0, hdr, 1, hdr->length, 0);
|
||||
|
||||
return 0;
|
||||
@@ -54,9 +54,9 @@ static int dump_table_name(const char *sig)
|
||||
static void list_fadt(struct acpi_fadt *fadt)
|
||||
{
|
||||
if (fadt->dsdt)
|
||||
dump_hdr(map_sysmem(fadt->dsdt, 0));
|
||||
dump_hdr(nomap_sysmem(fadt->dsdt, 0));
|
||||
if (fadt->firmware_ctrl)
|
||||
dump_hdr(map_sysmem(fadt->firmware_ctrl, 0));
|
||||
dump_hdr(nomap_sysmem(fadt->firmware_ctrl, 0));
|
||||
}
|
||||
|
||||
static void list_rsdt(struct acpi_rsdp *rsdp)
|
||||
@@ -66,11 +66,11 @@ static void list_rsdt(struct acpi_rsdp *rsdp)
|
||||
struct acpi_xsdt *xsdt;
|
||||
|
||||
if (rsdp->rsdt_address) {
|
||||
rsdt = map_sysmem(rsdp->rsdt_address, 0);
|
||||
rsdt = nomap_sysmem(rsdp->rsdt_address, 0);
|
||||
dump_hdr(&rsdt->header);
|
||||
}
|
||||
if (rsdp->xsdt_address) {
|
||||
xsdt = map_sysmem(rsdp->xsdt_address, 0);
|
||||
xsdt = nomap_sysmem(rsdp->xsdt_address, 0);
|
||||
dump_hdr(&xsdt->header);
|
||||
len = xsdt->header.length - sizeof(xsdt->header);
|
||||
count = len / sizeof(u64);
|
||||
@@ -91,7 +91,7 @@ static void list_rsdt(struct acpi_rsdp *rsdp)
|
||||
entry = rsdt->entry[i];
|
||||
if (!entry)
|
||||
break;
|
||||
hdr = map_sysmem(entry, 0);
|
||||
hdr = nomap_sysmem(entry, 0);
|
||||
dump_hdr(hdr);
|
||||
if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN))
|
||||
list_fadt((struct acpi_fadt *)hdr);
|
||||
|
||||
Reference in New Issue
Block a user