Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 148549 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-1 / +49 lines)
Line  Link Here
0
-- linux-2.6.18-rc1-mm2.orig/arch/x86_64/kernel/e820.c
0
++ linux-2.6.18-rc1-mm2/arch/x86_64/kernel/e820.c
Lines 16-21 Link Here
16
#include <linux/string.h>
16
#include <linux/string.h>
17
#include <linux/kexec.h>
17
#include <linux/kexec.h>
18
#include <linux/module.h>
18
#include <linux/module.h>
19
#include <linux/mm.h>
19
#include <asm/pgtable.h>
20
#include <asm/pgtable.h>
20
#include <asm/page.h>
21
#include <asm/page.h>
Lines 293-298 void __init e820_reserve_resources(void) Link Here
293
	}
294
	}
294
}
295
}
296
/* Mark pages corresponding to given address range as nosave */
297
static void __init
298
e820_mark_nosave_range(unsigned long start, unsigned long end)
299
{
300
	unsigned long pfn, max_pfn;
301
302
	if (start >= end)
303
		return;
304
305
	printk("Nosave address range: %016lx - %016lx\n", start, end);
306
	max_pfn = end >> PAGE_SHIFT;
307
	for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++)
308
		if (pfn_valid(pfn))
309
			SetPageNosave(pfn_to_page(pfn));
310
}
311
312
/*
313
 * Find the ranges of physical addresses that do not correspond to
314
 * e820 RAM areas and mark the corresponding pages as nosave for software
315
 * suspend and suspend to RAM.
316
 *
317
 * This function requires the e820 map to be sorted and without any
318
 * overlapping entries and assumes the first e820 area to be RAM.
319
 */
320
void __init e820_mark_nosave_regions(void)
321
{
322
	int i;
323
	unsigned long paddr;
324
325
	paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
326
	for (i = 1; i < e820.nr_map; i++) {
327
		struct e820entry *ei = &e820.map[i];
328
329
		if (paddr < ei->addr)
330
			e820_mark_nosave_range(paddr,
331
					round_up(ei->addr, PAGE_SIZE));
332
333
		paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
334
		if (ei->type != E820_RAM)
335
			e820_mark_nosave_range(round_up(ei->addr, PAGE_SIZE),
336
					paddr);
337
338
		if (paddr >= (end_pfn << PAGE_SHIFT))
339
			break;
340
	}
341
}
342
295
/*
343
/*
296
 * Add a memory region to the kernel e820 map.
344
 * Add a memory region to the kernel e820 map.
297
 */
345
 */
(-)linux-2.6.18-rc1-mm2/arch/x86_64/kernel/setup.c (+1 lines)
Lines 684-689 void __init setup_arch(char **cmdline_p) Link Here
684
	probe_roms();
684
	probe_roms();
685
	e820_reserve_resources();
685
	e820_reserve_resources();
686
	e820_mark_nosave_regions();
686
	request_resource(&iomem_resource, &video_ram_resource);
687
	request_resource(&iomem_resource, &video_ram_resource);
(-)linux-2.6.18-rc1-mm2/include/asm-x86_64/e820.h (-1 / +1 lines)
Lines 46-51 extern void setup_memory_region(void); Link Here
46
extern void contig_e820_setup(void);
46
extern void contig_e820_setup(void);
47
extern unsigned long e820_end_of_ram(void);
47
extern unsigned long e820_end_of_ram(void);
48
extern void e820_reserve_resources(void);
48
extern void e820_reserve_resources(void);
49
extern void e820_mark_nosave_regions(void);
49
extern void e820_print_map(char *who);
50
extern void e820_print_map(char *who);
50
extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
51
extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
51
extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
52
extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
52

Return to bug 148549