aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi/boot.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-07-09 23:16:36 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-10 03:01:25 -0400
commitf34fa82b19581affffb14f8ad9bdad9b5ab4daf5 (patch)
treef8b5568037d71cd9212c49aa96c0f14c239aeecc /arch/x86/kernel/acpi/boot.c
parent7b16eb8930d1e2a7ce5c7f35c87d62252ecc91f2 (diff)
x86, acpi: merge __acpi_map_table
and let 64-bit to fall back to use fixmap too. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/acpi/boot.c')
-rw-r--r--arch/x86/kernel/acpi/boot.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index bf7b4f7f60e1..a31a579a47ca 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -109,21 +109,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
109 */ 109 */
110enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; 110enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
111 111
112#ifdef CONFIG_X86_64
113
114/* rely on all ACPI tables being in the direct mapping */
115char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
116{
117 if (!phys_addr || !size)
118 return NULL;
119
120 if (phys_addr+size <= (max_pfn_mapped << PAGE_SHIFT) + PAGE_SIZE)
121 return __va(phys_addr);
122
123 return NULL;
124}
125
126#else
127 112
128/* 113/*
129 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END, 114 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
@@ -142,11 +127,15 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
142 unsigned long base, offset, mapped_size; 127 unsigned long base, offset, mapped_size;
143 int idx; 128 int idx;
144 129
145 if (phys + size < 8 * 1024 * 1024) 130 if (!phys || !size)
131 return NULL;
132
133 if (phys+size <= (max_pfn_mapped << PAGE_SHIFT))
146 return __va(phys); 134 return __va(phys);
147 135
148 offset = phys & (PAGE_SIZE - 1); 136 offset = phys & (PAGE_SIZE - 1);
149 mapped_size = PAGE_SIZE - offset; 137 mapped_size = PAGE_SIZE - offset;
138 clear_fixmap(FIX_ACPI_END);
150 set_fixmap(FIX_ACPI_END, phys); 139 set_fixmap(FIX_ACPI_END, phys);
151 base = fix_to_virt(FIX_ACPI_END); 140 base = fix_to_virt(FIX_ACPI_END);
152 141
@@ -158,13 +147,13 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
158 if (--idx < FIX_ACPI_BEGIN) 147 if (--idx < FIX_ACPI_BEGIN)
159 return NULL; /* cannot handle this */ 148 return NULL; /* cannot handle this */
160 phys += PAGE_SIZE; 149 phys += PAGE_SIZE;
150 clear_fixmap(idx);
161 set_fixmap(idx, phys); 151 set_fixmap(idx, phys);
162 mapped_size += PAGE_SIZE; 152 mapped_size += PAGE_SIZE;
163 } 153 }
164 154
165 return ((unsigned char *)base + offset); 155 return ((unsigned char *)base + offset);
166} 156}
167#endif
168 157
169#ifdef CONFIG_PCI_MMCONFIG 158#ifdef CONFIG_PCI_MMCONFIG
170/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 159/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */