This source file includes following definitions.
- pfn_is_nosave
- save_processor_state
- restore_processor_state
- arch_save_image
- swsusp_arch_suspend
- arch_restore_image
- swsusp_arch_resume
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <linux/mm.h>
18 #include <linux/suspend.h>
19 #include <asm/system_misc.h>
20 #include <asm/idmap.h>
21 #include <asm/suspend.h>
22 #include <asm/memory.h>
23 #include <asm/sections.h>
24 #include "reboot.h"
25
26 int pfn_is_nosave(unsigned long pfn)
27 {
28 unsigned long nosave_begin_pfn = virt_to_pfn(&__nosave_begin);
29 unsigned long nosave_end_pfn = virt_to_pfn(&__nosave_end - 1);
30
31 return (pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn);
32 }
33
34 void notrace save_processor_state(void)
35 {
36 WARN_ON(num_online_cpus() != 1);
37 local_fiq_disable();
38 }
39
40 void notrace restore_processor_state(void)
41 {
42 local_fiq_enable();
43 }
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 static int notrace arch_save_image(unsigned long unused)
59 {
60 int ret;
61
62 ret = swsusp_save();
63 if (ret == 0)
64 _soft_restart(virt_to_idmap(cpu_resume), false);
65 return ret;
66 }
67
68
69
70
71 int notrace swsusp_arch_suspend(void)
72 {
73 return cpu_suspend(0, arch_save_image);
74 }
75
76
77
78
79
80
81 static void notrace arch_restore_image(void *unused)
82 {
83 struct pbe *pbe;
84
85 cpu_switch_mm(idmap_pgd, &init_mm);
86 for (pbe = restore_pblist; pbe; pbe = pbe->next)
87 copy_page(pbe->orig_address, pbe->address);
88
89 _soft_restart(virt_to_idmap(cpu_resume), false);
90 }
91
92 static u64 resume_stack[PAGE_SIZE/2/sizeof(u64)] __nosavedata;
93
94
95
96
97
98
99
100 int swsusp_arch_resume(void)
101 {
102 call_with_stack(arch_restore_image, 0,
103 resume_stack + ARRAY_SIZE(resume_stack));
104 return 0;
105 }