suspend.c 1002 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <linux/mm.h>
  9. #include <linux/suspend.h>
  10. #include <linux/reboot.h>
  11. #include <linux/pfn.h>
  12. #include <asm/sections.h>
  13. #include <asm/ipl.h>
  14. /*
  15. * References to section boundaries
  16. */
  17. extern const void __nosave_begin, __nosave_end;
  18. /*
  19. * check if given pfn is in the 'nosave' or in the read only NSS section
  20. */
  21. int pfn_is_nosave(unsigned long pfn)
  22. {
  23. unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT;
  24. unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end))
  25. >> PAGE_SHIFT;
  26. unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
  27. unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
  28. if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
  29. return 1;
  30. if (pfn >= stext_pfn && pfn <= eshared_pfn) {
  31. if (ipl_info.type == IPL_TYPE_NSS)
  32. return 1;
  33. } else if ((tprot(pfn * PAGE_SIZE) && pfn > 0))
  34. return 1;
  35. return 0;
  36. }