This is a draft and incomplete implementation Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> --- lib/x86/acpi.c | 32 +++++++++++++++++++++++--------- x86/s3.c | 10 ++++++++-- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/lib/x86/acpi.c b/lib/x86/acpi.c index 4373106298d8..6536ff9f988c 100644 --- a/lib/x86/acpi.c +++ b/lib/x86/acpi.c @@ -1,5 +1,6 @@ #include "libcflat.h" #include "acpi.h" +#include "asm/io.h" void* find_acpi_table_addr(u32 sig) { @@ -16,7 +17,7 @@ void* find_acpi_table_addr(u32 sig) if (!fadt) { return NULL; } - return (void*)(ulong)fadt->firmware_ctrl; + return ioremap(fadt->firmware_ctrl, PAGE_SIZE); } for(addr = 0xf0000; addr < 0x100000; addr += 16) { @@ -26,16 +27,22 @@ void* find_acpi_table_addr(u32 sig) } if (addr == 0x100000) { printf("Can't find RSDP\n"); - return 0; + return NULL; } if (sig == RSDP_SIGNATURE) { return rsdp; } - rsdt = (void*)(ulong)rsdp->rsdt_physical_address; - if (!rsdt || rsdt->signature != RSDT_SIGNATURE) - return 0; + if (!rsdp->rsdt_physical_address) { + return NULL; + } + + rsdt = ioremap(rsdp->rsdt_physical_address, sizeof(*rsdt)); + if (rsdt->signature != RSDT_SIGNATURE) { + return NULL; + } + rsdt = ioremap(rsdp->rsdt_physical_address, rsdt->length); if (sig == RSDT_SIGNATURE) { return rsdt; @@ -43,10 +50,17 @@ void* find_acpi_table_addr(u32 sig) end = (void*)rsdt + rsdt->length; for (i=0; (void*)&rsdt->table_offset_entry[i] < end; i++) { - struct acpi_table *t = (void*)(ulong)rsdt->table_offset_entry[i]; - if (t && t->signature == sig) { - return t; + struct acpi_table *table; + + if (!rsdt->table_offset_entry[i]) { + continue; + } + + table = ioremap(rsdt->table_offset_entry[i], sizeof(*table)); + if (table->signature == sig) { + return ioremap(rsdt->table_offset_entry[i], table->length); } } - return NULL; + + return NULL; } diff --git a/x86/s3.c b/x86/s3.c index cef956e0b8a4..255046319925 100644 --- a/x86/s3.c +++ b/x86/s3.c @@ -1,4 +1,5 @@ #include "libcflat.h" +#include "x86/vm.h" #include "x86/acpi.h" #include "asm/io.h" @@ -39,10 +40,15 @@ extern char resume_start, resume_end; int main(int argc, char **argv) { - struct fadt_descriptor_rev1 *fadt = find_acpi_table_addr(FACP_SIGNATURE); - volatile u32 *resume_vector_ptr = find_resume_vector_addr(); + struct fadt_descriptor_rev1 *fadt; + volatile u32 *resume_vector_ptr; char *addr, *resume_vec = (void*)0x1000; + setup_vm(); + + fadt = find_acpi_table_addr(FACP_SIGNATURE); + resume_vector_ptr = find_resume_vector_addr(); + *resume_vector_ptr = (u32)(ulong)resume_vec; printf("resume vector addr is %p\n", resume_vector_ptr); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html