diff options
Diffstat (limited to 'arch/s390/power/suspend.c')
| -rw-r--r-- | arch/s390/power/suspend.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/s390/power/suspend.c b/arch/s390/power/suspend.c new file mode 100644 index 000000000000..b3351eceebbe --- /dev/null +++ b/arch/s390/power/suspend.c | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | * Suspend support specific for s390. | ||
| 3 | * | ||
| 4 | * Copyright IBM Corp. 2009 | ||
| 5 | * | ||
| 6 | * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/mm.h> | ||
| 10 | #include <linux/suspend.h> | ||
| 11 | #include <linux/reboot.h> | ||
| 12 | #include <linux/pfn.h> | ||
| 13 | #include <asm/sections.h> | ||
| 14 | #include <asm/ipl.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * References to section boundaries | ||
| 18 | */ | ||
| 19 | extern const void __nosave_begin, __nosave_end; | ||
| 20 | |||
| 21 | /* | ||
| 22 | * check if given pfn is in the 'nosave' or in the read only NSS section | ||
| 23 | */ | ||
| 24 | int pfn_is_nosave(unsigned long pfn) | ||
| 25 | { | ||
| 26 | unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT; | ||
| 27 | unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) | ||
| 28 | >> PAGE_SHIFT; | ||
| 29 | unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1; | ||
| 30 | unsigned long stext_pfn = PFN_DOWN(__pa(&_stext)); | ||
| 31 | |||
| 32 | if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn) | ||
| 33 | return 1; | ||
| 34 | if (pfn >= stext_pfn && pfn <= eshared_pfn) { | ||
| 35 | if (ipl_info.type == IPL_TYPE_NSS) | ||
| 36 | return 1; | ||
| 37 | } else if ((tprot(pfn * PAGE_SIZE) && pfn > 0)) | ||
| 38 | return 1; | ||
| 39 | return 0; | ||
| 40 | } | ||
