xref: /openbmc/linux/arch/powerpc/kernel/suspend.c (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1767a67b0SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
249c3df6aSVivek Goyal /*
349c3df6aSVivek Goyal  * Suspend support specific for power.
449c3df6aSVivek Goyal  *
5a2531293SPavel Machek  * Copyright (c) 2002 Pavel Machek <pavel@ucw.cz>
649c3df6aSVivek Goyal  * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
749c3df6aSVivek Goyal  */
849c3df6aSVivek Goyal 
927ac792cSAndrea Righi #include <linux/mm.h>
10*1ec0cd82SMathieu Malaterre #include <linux/suspend.h>
1149c3df6aSVivek Goyal #include <asm/page.h>
127f8998c7SGeert Uytterhoeven #include <asm/sections.h>
1349c3df6aSVivek Goyal 
1449c3df6aSVivek Goyal /*
1549c3df6aSVivek Goyal  *	pfn_is_nosave - check if given pfn is in the 'nosave' section
1649c3df6aSVivek Goyal  */
1749c3df6aSVivek Goyal 
pfn_is_nosave(unsigned long pfn)1849c3df6aSVivek Goyal int pfn_is_nosave(unsigned long pfn)
1949c3df6aSVivek Goyal {
2049c3df6aSVivek Goyal 	unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT;
2149c3df6aSVivek Goyal 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) >> PAGE_SHIFT;
2249c3df6aSVivek Goyal 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
2349c3df6aSVivek Goyal }
24