[PATCH] x86: merge __acpi_map_table

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Wednesday, July 9, 2008 - 8:16 pm

and let 64bit fallback to use fixmap too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/acpi/boot.c |   23 ++++++-----------------
 include/asm-x86/fixmap_64.h |    5 +++++
 2 files changed, 11 insertions(+), 17 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -109,21 +109,6 @@ static u64 acpi_lapic_addr __initdata =
  */
 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 
-#ifdef	CONFIG_X86_64
-
-/* rely on all ACPI tables being in the direct mapping */
-char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-	if (!phys_addr || !size)
-		return NULL;
-
-	if (phys_addr+size <= (max_pfn_mapped << PAGE_SHIFT) + PAGE_SIZE)
-		return __va(phys_addr);
-
-	return NULL;
-}
-
-#else
 
 /*
  * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
@@ -142,11 +127,15 @@ char *__init __acpi_map_table(unsigned l
 	unsigned long base, offset, mapped_size;
 	int idx;
 
-	if (phys + size < 8 * 1024 * 1024)
+	if (!phys || !size)
+		return NULL;
+
+	if (phys+size <= (max_pfn_mapped << PAGE_SHIFT))
 		return __va(phys);
 
 	offset = phys & (PAGE_SIZE - 1);
 	mapped_size = PAGE_SIZE - offset;
+	clear_fixmap(FIX_ACPI_END);
 	set_fixmap(FIX_ACPI_END, phys);
 	base = fix_to_virt(FIX_ACPI_END);
 
@@ -158,13 +147,13 @@ char *__init __acpi_map_table(unsigned l
 		if (--idx < FIX_ACPI_BEGIN)
 			return NULL;	/* cannot handle this */
 		phys += PAGE_SIZE;
+		clear_fixmap(idx);
 		set_fixmap(idx, phys);
 		mapped_size += PAGE_SIZE;
 	}
 
 	return ((unsigned char *)base + offset);
 }
-#endif
 
 #ifdef CONFIG_PCI_MMCONFIG
 /* The physical address of the MMCONFIG aperture.  Set from ACPI tables. */
Index: linux-2.6/include/asm-x86/fixmap_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/fixmap_64.h
+++ linux-2.6/include/asm-x86/fixmap_64.h
@@ -12,6 +12,7 @@
 #define _ASM_FIXMAP_64_H
 
 #include <linux/kernel.h>
+#include <asm/acpi.h>
 #include <asm/apicdef.h>
 #include <asm/page.h>
 #include <asm/vsyscall.h>
@@ -49,6 +50,10 @@ enum fixed_addresses {
 #ifdef CONFIG_PARAVIRT
 	FIX_PARAVIRT_BOOTMAP,
 #endif
+#ifdef CONFIG_ACPI
+	FIX_ACPI_BEGIN,
+	FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
+#endif
 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
 	FIX_OHCI1394_BASE,
 #endif
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86: introduce page_size_mask for 64bit, Yinghai Lu, (Tue Jul 8, 1:41 am)
Re: [PATCH] x86: introduce page_size_mask for 64bit, Ingo Molnar, (Wed Jul 9, 12:38 am)
[PATCH] x86: merge __acpi_map_table, Yinghai Lu, (Wed Jul 9, 8:16 pm)
Re: [PATCH] x86: merge __acpi_map_table, Ingo Molnar, (Wed Jul 9, 11:54 pm)
Re: [PATCh] x86: overmapped fix when 4K pages on tail - 64bit, Arjan van de Ven, (Thu Jul 10, 7:16 am)
[PATCH] x86: save slit, Yinghai Lu, (Thu Jul 10, 8:36 pm)
[PATCH] x86: introduce max_low_pfn_mapped for 64bit, Yinghai Lu, (Thu Jul 10, 8:38 pm)
Re: [PATCH] x86: save slit, Ingo Molnar, (Fri Jul 11, 1:22 am)
[PATCH] x86: let 32bit use apic_ops too, Yinghai Lu, (Fri Jul 11, 6:41 pm)
[PATCH] x86: make read_apic_id return final apicid, Yinghai Lu, (Fri Jul 11, 6:44 pm)
[PATCH] x86: make 64bit have get_apic_id, Yinghai Lu, (Sat Jul 12, 1:01 am)
[PATCH] x86: max_low_pfn_mapped fix #1, Yinghai Lu, (Sat Jul 12, 2:30 pm)
[PATCH] x86: max_low_pfn_mapped fix #2, Yinghai Lu, (Sat Jul 12, 2:31 pm)
[PATCH] x86: max_low_pfn_mapped fix #3, Yinghai Lu, (Sat Jul 12, 2:32 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Suresh Siddha, (Sat Jul 12, 6:08 pm)
Re: [PATCH] x86: make read_apic_id return final apicid, Suresh Siddha, (Sat Jul 12, 6:19 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Sat Jul 12, 6:43 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Yinghai Lu, (Sat Jul 12, 6:45 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Sat Jul 12, 6:54 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Yinghai Lu, (Sat Jul 12, 7:04 pm)
Re: [PATCH] x86: make 64bit have get_apic_id, Ingo Molnar, (Sat Jul 12, 11:28 pm)
Re: [PATCH] x86: make 64bit have get_apic_id, Ingo Molnar, (Sat Jul 12, 11:59 pm)
Re: [PATCH] x86: make 64bit have get_apic_id, Yinghai Lu, (Sun Jul 13, 12:05 am)
Re: [PATCH] x86: make 64bit have get_apic_id, Ingo Molnar, (Sun Jul 13, 2:23 am)
Re: [PATCH] x86: make 64bit have get_apic_id, Ingo Molnar, (Sun Jul 13, 2:28 am)
Re: [PATCH] x86: max_low_pfn_mapped fix #1, Ingo Molnar, (Sun Jul 13, 2:45 am)
Re: [PATCh] x86: overmapped fix when 4K pages on tail - 64bit, Arjan van de Ven, (Sun Jul 13, 8:33 am)
Re: [PATCH] x86: make 64bit have get_apic_id, Suresh Siddha, (Sun Jul 13, 9:15 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Suresh Siddha, (Sun Jul 13, 9:28 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Suresh Siddha, (Sun Jul 13, 9:43 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Sun Jul 13, 9:51 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Sun Jul 13, 10:05 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Cyrill Gorcunov, (Sun Jul 13, 10:16 am)
[PATCH] x86: max_low_pfn_mapped fix #4, Yinghai Lu, (Sun Jul 13, 2:29 pm)
[PATCH] x86: get x86_phys_bits early, Yinghai Lu, (Sun Jul 13, 2:30 pm)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Sun Jul 13, 4:46 pm)
[PATCH] x86: let 32bit use apic_ops too - fix, Yinghai Lu, (Sun Jul 13, 10:19 pm)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Ingo Molnar, (Mon Jul 14, 12:12 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Cyrill Gorcunov, (Mon Jul 14, 9:48 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Suresh Siddha, (Mon Jul 14, 9:49 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Yinghai Lu, (Mon Jul 14, 10:00 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Mon Jul 14, 10:20 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Suresh Siddha, (Mon Jul 14, 11:03 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Cyrill Gorcunov, (Mon Jul 14, 11:09 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Maciej W. Rozycki, (Mon Jul 14, 11:24 am)
Re: [PATCH] x86: let 32bit use apic_ops too, Cyrill Gorcunov, (Mon Jul 14, 11:32 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Suresh Siddha, (Tue Jul 15, 10:33 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Yinghai Lu, (Tue Jul 15, 11:10 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Suresh Siddha, (Tue Jul 15, 11:27 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Ingo Molnar, (Fri Jul 18, 10:06 am)
Re: [PATCH] x86: let 32bit use apic_ops too - fix, Ingo Molnar, (Fri Jul 18, 10:07 am)