diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-09-20 09:22:55 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-09-20 09:22:55 +0200 |
commit | d2f664abe8f8f0159bd7d11390b332f14047b7a9 (patch) | |
tree | 7d737145634a303a00b395fd8d35ef4b797fb620 /xen/drivers/acpi | |
parent | 3616eb8796b44e7df42687a342b9207b26c9e483 (diff) | |
download | xen-d2f664abe8f8f0159bd7d11390b332f14047b7a9.tar.gz xen-d2f664abe8f8f0159bd7d11390b332f14047b7a9.tar.bz2 xen-d2f664abe8f8f0159bd7d11390b332f14047b7a9.zip |
ACPI: move tables.c fully into .init.*
The only non-init item was the space reserved for the initial tables,
but we can as well dynamically allocate that array.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/drivers/acpi')
-rw-r--r-- | xen/drivers/acpi/Makefile | 2 | ||||
-rw-r--r-- | xen/drivers/acpi/osl.c | 36 | ||||
-rw-r--r-- | xen/drivers/acpi/tables.c | 4 |
3 files changed, 38 insertions, 4 deletions
diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile index abc66f8a07..bbb06a7468 100644 --- a/xen/drivers/acpi/Makefile +++ b/xen/drivers/acpi/Makefile @@ -2,7 +2,7 @@ subdir-y += tables subdir-y += utilities subdir-$(x86) += apei -obj-y += tables.o +obj-bin-y += tables.init.o obj-y += numa.o obj-y += osl.o obj-y += pmstat.o diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index dd96a1a20e..1b60be621c 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -27,6 +27,7 @@ #include <asm/io.h> #include <xen/config.h> #include <xen/init.h> +#include <xen/pfn.h> #include <xen/types.h> #include <xen/errno.h> #include <xen/acpi.h> @@ -182,3 +183,38 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) return AE_OK; } + +#define is_xmalloc_memory(ptr) ((unsigned long)(ptr) & (PAGE_SIZE - 1)) + +void *__init acpi_os_alloc_memory(size_t sz) +{ + void *ptr; + + if (system_state == SYS_STATE_early_boot) + return mfn_to_virt(alloc_boot_pages(PFN_UP(sz), 1)); + + ptr = xmalloc_bytes(sz); + ASSERT(!ptr || is_xmalloc_memory(ptr)); + return ptr; +} + +void *__init acpi_os_zalloc_memory(size_t sz) +{ + void *ptr; + + if (system_state != SYS_STATE_early_boot) { + ptr = xzalloc_bytes(sz); + ASSERT(!ptr || is_xmalloc_memory(ptr)); + return ptr; + } + ptr = acpi_os_alloc_memory(sz); + return ptr ? memset(ptr, 0, sz) : NULL; +} + +void __init acpi_os_free_memory(void *ptr) +{ + if (is_xmalloc_memory(ptr)) + xfree(ptr); + else if (ptr && system_state == SYS_STATE_early_boot) + init_boot_pages(__pa(ptr), __pa(ptr) + PAGE_SIZE); +} diff --git a/xen/drivers/acpi/tables.c b/xen/drivers/acpi/tables.c index d1136a8f80..a0e9c163a8 100644 --- a/xen/drivers/acpi/tables.c +++ b/xen/drivers/acpi/tables.c @@ -41,8 +41,6 @@ mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; static const char *__initdata mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" }; -static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES]; - static int acpi_apic_instance __initdata; void __init acpi_table_print_madt_entry(struct acpi_subtable_header *header) @@ -324,7 +322,7 @@ static void __init check_multiple_madt(void) int __init acpi_table_init(void) { - acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); + acpi_initialize_tables(NULL, ACPI_MAX_TABLES, 0); check_multiple_madt(); return 0; } |