aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/power/hibernate.c
diff options
context:
space:
mode:
authorTkhai Kirill <tkhai@yandex.ru>2013-03-19 11:11:07 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-20 14:06:54 -0400
commitbdde6b3c8ba48fa5847b6d75f0541c8b8db9205c (patch)
tree9fccf29eca02be11f5e6e9eec13ae6d056ff3288 /arch/sparc/power/hibernate.c
parent1ab0a67601ca7be81bfaaa0a2540ee0d0393f40b (diff)
sparc64: Hibernation support
This patch adds CONFIG_HIBERNATION support for sparc64 architecture. The suspend function is the same as on another platforms. The restore function uses Bypass feature of MMU which allows to make the process more comfortable and plesant. Signed-off-by: Kirill Tkhai <tkhai@yandex.ru> CC: David Miller <davem@davemloft.net> CC: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/power/hibernate.c')
-rw-r--r--arch/sparc/power/hibernate.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
new file mode 100644
index 000000000000..42b0b8ce699a
--- /dev/null
+++ b/arch/sparc/power/hibernate.c
@@ -0,0 +1,42 @@
1/*
2 * hibernate.c: Hibernaton support specific for sparc64.
3 *
4 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
5 */
6
7#include <linux/mm.h>
8
9#include <asm/hibernate.h>
10#include <asm/visasm.h>
11#include <asm/page.h>
12#include <asm/tlb.h>
13
14/* References to section boundaries */
15extern const void __nosave_begin, __nosave_end;
16
17struct saved_context saved_context;
18
19/*
20 * pfn_is_nosave - check if given pfn is in the 'nosave' section
21 */
22
23int pfn_is_nosave(unsigned long pfn)
24{
25 unsigned long nosave_begin_pfn = PFN_DOWN((unsigned long)&__nosave_begin);
26 unsigned long nosave_end_pfn = PFN_DOWN((unsigned long)&__nosave_end);
27
28 return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
29}
30
31void save_processor_state(void)
32{
33 save_and_clear_fpu();
34}
35
36void restore_processor_state(void)
37{
38 struct mm_struct *mm = current->active_mm;
39
40 load_secondary_context(mm);
41 tsb_context_switch(mm);
42}