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