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

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

Return to bug 148549