aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/e820_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/e820_32.c')
-rw-r--r--arch/x86/kernel/e820_32.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index e8a3b968c9fa..8de3df9548db 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -207,36 +207,6 @@ void __init init_iomem_resources(struct resource *code_resource,
207 } 207 }
208} 208}
209 209
210void __init limit_regions(unsigned long long size)
211{
212 unsigned long long current_addr;
213 int i;
214
215 e820_print_map("limit_regions start");
216 for (i = 0; i < e820.nr_map; i++) {
217 current_addr = e820.map[i].addr + e820.map[i].size;
218 if (current_addr < size)
219 continue;
220
221 if (e820.map[i].type != E820_RAM)
222 continue;
223
224 if (e820.map[i].addr >= size) {
225 /*
226 * This region starts past the end of the
227 * requested size, skip it completely.
228 */
229 e820.nr_map = i;
230 } else {
231 e820.nr_map = i + 1;
232 e820.map[i].size -= current_addr - size;
233 }
234 e820_print_map("limit_regions endfor");
235 return;
236 }
237 e820_print_map("limit_regions endfunc");
238}
239
240/* Overridden in paravirt.c if CONFIG_PARAVIRT */ 210/* Overridden in paravirt.c if CONFIG_PARAVIRT */
241char * __init __attribute__((weak)) memory_setup(void) 211char * __init __attribute__((weak)) memory_setup(void)
242{ 212{
@@ -249,93 +219,3 @@ void __init setup_memory_map(void)
249 e820_print_map(memory_setup()); 219 e820_print_map(memory_setup());
250} 220}
251 221
252static int __initdata user_defined_memmap;
253
254/*
255 * "mem=nopentium" disables the 4MB page tables.
256 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
257 * to <mem>, overriding the bios size.
258 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
259 * <start> to <start>+<mem>, overriding the bios size.
260 *
261 * HPA tells me bootloaders need to parse mem=, so no new
262 * option should be mem= [also see Documentation/i386/boot.txt]
263 */
264static int __init parse_mem(char *arg)
265{
266 if (!arg)
267 return -EINVAL;
268
269 if (strcmp(arg, "nopentium") == 0) {
270 setup_clear_cpu_cap(X86_FEATURE_PSE);
271 } else {
272 /* If the user specifies memory size, we
273 * limit the BIOS-provided memory map to
274 * that size. exactmap can be used to specify
275 * the exact map. mem=number can be used to
276 * trim the existing memory map.
277 */
278 unsigned long long mem_size;
279
280 mem_size = memparse(arg, &arg);
281 limit_regions(mem_size);
282 user_defined_memmap = 1;
283 }
284 return 0;
285}
286early_param("mem", parse_mem);
287
288static int __init parse_memmap(char *arg)
289{
290 if (!arg)
291 return -EINVAL;
292
293 if (strcmp(arg, "exactmap") == 0) {
294#ifdef CONFIG_CRASH_DUMP
295 /* If we are doing a crash dump, we
296 * still need to know the real mem
297 * size before original memory map is
298 * reset.
299 */
300 e820_register_active_regions(0, 0, -1UL);
301 saved_max_pfn = e820_end_of_ram();
302 remove_all_active_ranges();
303#endif
304 e820.nr_map = 0;
305 user_defined_memmap = 1;
306 } else {
307 /* If the user specifies memory size, we
308 * limit the BIOS-provided memory map to
309 * that size. exactmap can be used to specify
310 * the exact map. mem=number can be used to
311 * trim the existing memory map.
312 */
313 unsigned long long start_at, mem_size;
314
315 mem_size = memparse(arg, &arg);
316 if (*arg == '@') {
317 start_at = memparse(arg+1, &arg);
318 add_memory_region(start_at, mem_size, E820_RAM);
319 } else if (*arg == '#') {
320 start_at = memparse(arg+1, &arg);
321 add_memory_region(start_at, mem_size, E820_ACPI);
322 } else if (*arg == '$') {
323 start_at = memparse(arg+1, &arg);
324 add_memory_region(start_at, mem_size, E820_RESERVED);
325 } else {
326 limit_regions(mem_size);
327 user_defined_memmap = 1;
328 }
329 }
330 return 0;
331}
332early_param("memmap", parse_memmap);
333
334void __init finish_e820_parsing(void)
335{
336 if (user_defined_memmap) {
337 printk(KERN_INFO "user-defined physical RAM map:\n");
338 e820_print_map("user");
339 }
340}
341