On Tue, Sep 24, 2013 at 02:46:01PM -0600, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
This patch converts the ACPI initialization sequence so that it uses early_memremap() prior to paging_init() having been called. This allows us to provide a more uniform mechanism for passing the ACPI data into the kernel via RAM on boot. Prior mechanisms would collide with DMI or FDT use of RAM so that no data was loaded; this allows for peaceful coexistence.
Signed-off-by: Al Stone al.stone@linaro.org
arch/arm/kernel/setup.c | 9 ++++++--- drivers/acpi/osl.c | 12 ++++++------ drivers/acpi/plat/arm/boot.c | 19 +++++++------------ include/linux/acpi.h | 2 +- include/linux/acpi_io.h | 4 ++++ 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index a440211..c3fac4f 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -895,9 +895,6 @@ void __init setup_arch(char **cmdline_p) efi_memblock_arm_reserve_range(); #endif
- paging_init(mdesc);
- request_standard_resources(mdesc);
#ifdef CONFIG_ACPI /* * Parse the ACPI tables for possible boot-time configuration @@ -906,9 +903,15 @@ void __init setup_arch(char **cmdline_p) early_acpi_boot_init(); #endif
- paging_init(mdesc);
- request_standard_resources(mdesc);
- if (mdesc->restart) arm_pm_restart = mdesc->restart;
+#ifdef CONFIG_EFI
- efi_remap_regions();
+#endif unflatten_device_tree(); arm_dt_init_cpu_maps(); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ebe34b3..3ed2207 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -290,7 +290,7 @@ void acpi_find_arm_root_pointer(acpi_physical_address *pa) (u64)rp->xsdt_physical_address); pr_debug(" x_checksum: 0x%02x\n", rp->extended_checksum);
- *pa = (acpi_physical_address)(virt_to_phys(rp));
*pa = (acpi_physical_address)(virt_to_phys(rp));
Random spacing change?
} else { pr_err("ACPI missing rsdp info\n"); *pa = (acpi_physical_address)NULL; @@ -309,9 +309,9 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) if (efi_enabled(EFI_CONFIG_TABLES)) { if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
return efi.acpi20;
else if (efi.acpi != EFI_INVALID_TABLE_ADDR)return efi.acpi20 + ACPI_BLOB_HEADER_SIZE;
return efi.acpi;
else {return efi.acpi + ACPI_BLOB_HEADER_SIZE;
Definately wrong, grub should fixup the offset not here. My original grub patch did fix this offset inside grub.
If you do this tables built into UEFI will be broken.
printk(KERN_ERR PREFIX "System description tables not found\n");
@@ -386,11 +386,11 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; } -#ifndef CONFIG_IA64 -#define should_use_kmap(pfn) page_is_ram(pfn) -#else +#if defined(CONFIG_IA64) || defined(CONFIG_ARM) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0 +#else +#define should_use_kmap(pfn) page_is_ram(pfn) #endif static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz) diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 5ca62dc..b22c57e 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -40,7 +40,10 @@ #include <asm/pgtable.h> #include <asm/io.h> +#include <asm/mach/map.h> +#ifdef CONFIG_SMP #include <asm/smp.h> +#endif #include <asm/acpi.h> /* @@ -82,7 +85,7 @@ int acpi_use_timer_override __initdata; int acpi_fix_pin2_polarity __initdata; static u64 acpi_lapic_addr __initdata; -struct acpi_arm_root acpi_arm_rsdp_info; /* info about RSDP from FDT */ +struct acpi_arm_root acpi_arm_rsdp_info; /* info about RSDP */
Unrelated comment change!
/*
- Boot-time Configuration
@@ -103,17 +106,12 @@ static unsigned int gsi_to_irq(unsigned int gsi) return irq; } -/*
- BOZO: is it reasonable to just reserve the memory space? Or are there
- other restrictions needed? Or does it need copying to some other place?
- */
-char *__init __acpi_map_table(unsigned long phys, unsigned long size) +char *__init __acpi_map_table(phys_addr_t phys, unsigned long size) { if (!phys || !size) return NULL;
- /* we're already in memory so we cannot io_remap the entry */
- return phys_to_virt(phys);
- return early_memremap(phys, size);
} void __init __acpi_unmap_table(char *map, unsigned long size) @@ -121,10 +119,7 @@ void __init __acpi_unmap_table(char *map, unsigned long size) if (!map || !size) return;
- /* we're already in memory so we cannot io_remap the entry;
* since we're not io_remap'ing, unmap'ing is especially
* pointless
*/
- early_iounmap(map, size); return;
} diff --git a/include/linux/acpi.h b/include/linux/acpi.h index f0eb673..53e0fa1 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -88,7 +88,7 @@ static inline void acpi_initrd_override(void *data, size_t size) } #endif -char * __acpi_map_table (unsigned long phys_addr, unsigned long size); +char *__acpi_map_table(phys_addr_t phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void); int acpi_boot_init (void); diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h index b0ffa21..74a1eed 100644 --- a/include/linux/acpi_io.h +++ b/include/linux/acpi_io.h @@ -7,7 +7,11 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { +#ifdef CONFIG_ARM
- return early_memremap(phys, size);
+#else return ioremap_cache(phys, size); +#endif }
How can this even work? It is called after paging_init()?
void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
I shall make an attempt to fix the issues I have found in this and re-send this patch.
This I guess will mean there is a fix needed for grub patch as well.
Graeme