diff mbox

- Mapping ACPI tables as CACHED

Message ID 20101214220932.GA1206@sgi.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jack Steiner Dec. 14, 2010, 10:09 p.m. UTC
None
diff mbox

Patch

Index: linux/arch/ia64/kernel/acpi.c
===================================================================
--- linux.orig/arch/ia64/kernel/acpi.c	2010-12-14 15:51:33.230235579 -0600
+++ linux/arch/ia64/kernel/acpi.c	2010-12-14 16:02:26.718529904 -0600
@@ -176,6 +176,12 @@  void __init __acpi_unmap_table(char *map
 {
 }
 
+char *__init __acpi_map_table_permanent(unsigned long phys_addr,
+					unsigned long size)
+{
+	return ioremap(phys_addr, size);
+}
+
 /* --------------------------------------------------------------------------
                             Boot-time Table Parsing
    -------------------------------------------------------------------------- */
Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux.orig/arch/x86/kernel/acpi/boot.c	2010-12-14 15:51:33.230235579 -0600
+++ linux/arch/x86/kernel/acpi/boot.c	2010-12-14 15:52:06.070227289 -0600
@@ -167,6 +167,20 @@  void __init __acpi_unmap_table(char *map
 	early_iounmap(map, size);
 }
 
+/*
+ * Permanently map memory for ACPI. Map ACPI tables and RAM as WB,
+ * other regions as UC.
+ */
+char *__init __acpi_map_table_permanent(unsigned long phys, unsigned long size)
+{
+	if (e820_all_mapped(phys, phys + size, E820_RAM) ||
+			e820_all_mapped(phys, phys + size, E820_ACPI) ||
+			e820_all_mapped(phys, phys + size, E820_NVS))
+		return ioremap_cache((unsigned long)phys, size);
+	 else
+		return ioremap(phys, size);
+}
+
 #ifdef CONFIG_X86_LOCAL_APIC
 static int __init acpi_parse_madt(struct acpi_table_header *table)
 {
Index: linux/drivers/acpi/osl.c
===================================================================
--- linux.orig/drivers/acpi/osl.c	2010-12-14 15:51:33.230235579 -0600
+++ linux/drivers/acpi/osl.c	2010-12-14 15:52:06.098240079 -0600
@@ -324,7 +324,7 @@  acpi_os_map_memory(acpi_physical_address
 
 	pg_off = round_down(phys, PAGE_SIZE);
 	pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-	virt = ioremap(pg_off, pg_sz);
+	virt = __acpi_map_table_permanent(pg_off, pg_sz);
 	if (!virt) {
 		kfree(map);
 		return NULL;
Index: linux/include/linux/acpi.h
===================================================================
--- linux.orig/include/linux/acpi.h	2010-12-14 15:51:33.230235579 -0600
+++ linux/include/linux/acpi.h	2010-12-14 16:03:23.042529564 -0600
@@ -77,6 +77,7 @@  typedef int (*acpi_table_handler) (struc
 typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
 
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
+char *__acpi_map_table_permanent(unsigned long 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);