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 |
*/ |