diff options
-rw-r--r-- | arch/ia64/include/asm/io.h | 5 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 1 | ||||
-rw-r--r-- | drivers/acpi/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 8 | ||||
-rw-r--r-- | drivers/acpi/nvs.c (renamed from kernel/power/nvs.c) | 20 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 6 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 5 | ||||
-rw-r--r-- | include/linux/acpi.h | 9 | ||||
-rw-r--r-- | include/linux/suspend.h | 17 | ||||
-rw-r--r-- | kernel/power/Kconfig | 5 | ||||
-rw-r--r-- | kernel/power/Makefile | 1 |
11 files changed, 43 insertions, 36 deletions
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h index cc8335eb3110..e5a6c3530c6c 100644 --- a/arch/ia64/include/asm/io.h +++ b/arch/ia64/include/asm/io.h | |||
@@ -426,6 +426,11 @@ extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size) | |||
426 | extern void iounmap (volatile void __iomem *addr); | 426 | extern void iounmap (volatile void __iomem *addr); |
427 | extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size); | 427 | extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size); |
428 | extern void early_iounmap (volatile void __iomem *addr, unsigned long size); | 428 | extern void early_iounmap (volatile void __iomem *addr, unsigned long size); |
429 | static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size) | ||
430 | { | ||
431 | return ioremap(phys_addr, size); | ||
432 | } | ||
433 | |||
429 | 434 | ||
430 | /* | 435 | /* |
431 | * String version of IO memory access ops: | 436 | * String version of IO memory access ops: |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 0c2b7ef7a34d..294f26da0c0c 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
15 | #include <linux/pfn.h> | 15 | #include <linux/pfn.h> |
16 | #include <linux/suspend.h> | 16 | #include <linux/suspend.h> |
17 | #include <linux/acpi.h> | ||
17 | #include <linux/firmware-map.h> | 18 | #include <linux/firmware-map.h> |
18 | #include <linux/memblock.h> | 19 | #include <linux/memblock.h> |
19 | 20 | ||
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 3d031d02e54b..9cc9f2c4da79 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -24,7 +24,7 @@ acpi-y += atomicio.o | |||
24 | # sleep related files | 24 | # sleep related files |
25 | acpi-y += wakeup.o | 25 | acpi-y += wakeup.o |
26 | acpi-y += sleep.o | 26 | acpi-y += sleep.o |
27 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o | 27 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o nvs.o |
28 | 28 | ||
29 | 29 | ||
30 | # | 30 | # |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 8df5d7061a45..bc428a9607df 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -83,8 +83,16 @@ extern int acpi_sleep_init(void); | |||
83 | 83 | ||
84 | #ifdef CONFIG_ACPI_SLEEP | 84 | #ifdef CONFIG_ACPI_SLEEP |
85 | int acpi_sleep_proc_init(void); | 85 | int acpi_sleep_proc_init(void); |
86 | int suspend_nvs_alloc(void); | ||
87 | void suspend_nvs_free(void); | ||
88 | int suspend_nvs_save(void); | ||
89 | void suspend_nvs_restore(void); | ||
86 | #else | 90 | #else |
87 | static inline int acpi_sleep_proc_init(void) { return 0; } | 91 | static inline int acpi_sleep_proc_init(void) { return 0; } |
92 | static inline int suspend_nvs_alloc(void) { return 0; } | ||
93 | static inline void suspend_nvs_free(void) {} | ||
94 | static inline int suspend_nvs_save(void) {} | ||
95 | static inline void suspend_nvs_restore(void) {} | ||
88 | #endif | 96 | #endif |
89 | 97 | ||
90 | #endif /* _ACPI_INTERNAL_H_ */ | 98 | #endif /* _ACPI_INTERNAL_H_ */ |
diff --git a/kernel/power/nvs.c b/drivers/acpi/nvs.c index 1836db60bbb6..54b6ab8040a6 100644 --- a/kernel/power/nvs.c +++ b/drivers/acpi/nvs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/kernel/power/hibernate_nvs.c - Routines for handling NVS memory | 2 | * nvs.c - Routines for saving and restoring ACPI NVS memory region |
3 | * | 3 | * |
4 | * Copyright (C) 2008,2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | 4 | * Copyright (C) 2008-2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. |
5 | * | 5 | * |
6 | * This file is released under the GPLv2. | 6 | * This file is released under the GPLv2. |
7 | */ | 7 | */ |
@@ -11,7 +11,8 @@ | |||
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/suspend.h> | 14 | #include <linux/acpi.h> |
15 | #include <acpi/acpiosxf.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Platforms, like ACPI, may want us to save some memory used by them during | 18 | * Platforms, like ACPI, may want us to save some memory used by them during |
@@ -79,7 +80,7 @@ void suspend_nvs_free(void) | |||
79 | free_page((unsigned long)entry->data); | 80 | free_page((unsigned long)entry->data); |
80 | entry->data = NULL; | 81 | entry->data = NULL; |
81 | if (entry->kaddr) { | 82 | if (entry->kaddr) { |
82 | iounmap(entry->kaddr); | 83 | acpi_os_unmap_memory(entry->kaddr, entry->size); |
83 | entry->kaddr = NULL; | 84 | entry->kaddr = NULL; |
84 | } | 85 | } |
85 | } | 86 | } |
@@ -105,7 +106,7 @@ int suspend_nvs_alloc(void) | |||
105 | /** | 106 | /** |
106 | * suspend_nvs_save - save NVS memory regions | 107 | * suspend_nvs_save - save NVS memory regions |
107 | */ | 108 | */ |
108 | void suspend_nvs_save(void) | 109 | int suspend_nvs_save(void) |
109 | { | 110 | { |
110 | struct nvs_page *entry; | 111 | struct nvs_page *entry; |
111 | 112 | ||
@@ -113,9 +114,16 @@ void suspend_nvs_save(void) | |||
113 | 114 | ||
114 | list_for_each_entry(entry, &nvs_list, node) | 115 | list_for_each_entry(entry, &nvs_list, node) |
115 | if (entry->data) { | 116 | if (entry->data) { |
116 | entry->kaddr = ioremap(entry->phys_start, entry->size); | 117 | entry->kaddr = acpi_os_map_memory(entry->phys_start, |
118 | entry->size); | ||
119 | if (!entry->kaddr) { | ||
120 | suspend_nvs_free(); | ||
121 | return -ENOMEM; | ||
122 | } | ||
117 | memcpy(entry->data, entry->kaddr, entry->size); | 123 | memcpy(entry->data, entry->kaddr, entry->size); |
118 | } | 124 | } |
125 | |||
126 | return 0; | ||
119 | } | 127 | } |
120 | 128 | ||
121 | /** | 129 | /** |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 055d7b701fff..3a7b4879fd99 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -320,7 +320,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size) | |||
320 | 320 | ||
321 | pg_off = round_down(phys, PAGE_SIZE); | 321 | pg_off = round_down(phys, PAGE_SIZE); |
322 | pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; | 322 | pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; |
323 | virt = ioremap(pg_off, pg_sz); | 323 | virt = ioremap_cache(pg_off, pg_sz); |
324 | if (!virt) { | 324 | if (!virt) { |
325 | kfree(map); | 325 | kfree(map); |
326 | return NULL; | 326 | return NULL; |
@@ -642,7 +642,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | |||
642 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 642 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
643 | rcu_read_unlock(); | 643 | rcu_read_unlock(); |
644 | if (!virt_addr) { | 644 | if (!virt_addr) { |
645 | virt_addr = ioremap(phys_addr, size); | 645 | virt_addr = ioremap_cache(phys_addr, size); |
646 | unmap = 1; | 646 | unmap = 1; |
647 | } | 647 | } |
648 | if (!value) | 648 | if (!value) |
@@ -678,7 +678,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
678 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 678 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
679 | rcu_read_unlock(); | 679 | rcu_read_unlock(); |
680 | if (!virt_addr) { | 680 | if (!virt_addr) { |
681 | virt_addr = ioremap(phys_addr, size); | 681 | virt_addr = ioremap_cache(phys_addr, size); |
682 | unmap = 1; | 682 | unmap = 1; |
683 | } | 683 | } |
684 | 684 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index ddc5cce508a1..75c232084740 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -124,8 +124,7 @@ static int acpi_pm_freeze(void) | |||
124 | static int acpi_pm_pre_suspend(void) | 124 | static int acpi_pm_pre_suspend(void) |
125 | { | 125 | { |
126 | acpi_pm_freeze(); | 126 | acpi_pm_freeze(); |
127 | suspend_nvs_save(); | 127 | return suspend_nvs_save(); |
128 | return 0; | ||
129 | } | 128 | } |
130 | 129 | ||
131 | /** | 130 | /** |
@@ -151,7 +150,7 @@ static int acpi_pm_prepare(void) | |||
151 | { | 150 | { |
152 | int error = __acpi_pm_prepare(); | 151 | int error = __acpi_pm_prepare(); |
153 | if (!error) | 152 | if (!error) |
154 | acpi_pm_pre_suspend(); | 153 | error = acpi_pm_pre_suspend(); |
155 | 154 | ||
156 | return error; | 155 | return error; |
157 | } | 156 | } |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 67c91b4418b0..fa7ed6a983d0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -254,6 +254,15 @@ void __init acpi_old_suspend_ordering(void); | |||
254 | void __init acpi_nvs_nosave(void); | 254 | void __init acpi_nvs_nosave(void); |
255 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
256 | 256 | ||
257 | #ifdef CONFIG_ACPI_SLEEP | ||
258 | int suspend_nvs_register(unsigned long start, unsigned long size); | ||
259 | #else | ||
260 | static inline int suspend_nvs_register(unsigned long a, unsigned long b) | ||
261 | { | ||
262 | return 0; | ||
263 | } | ||
264 | #endif | ||
265 | |||
257 | struct acpi_osc_context { | 266 | struct acpi_osc_context { |
258 | char *uuid_str; /* uuid string */ | 267 | char *uuid_str; /* uuid string */ |
259 | int rev; | 268 | int rev; |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 26697514c5ec..0e288e3c37be 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -258,23 +258,6 @@ static inline int hibernate(void) { return -ENOSYS; } | |||
258 | static inline bool system_entering_hibernation(void) { return false; } | 258 | static inline bool system_entering_hibernation(void) { return false; } |
259 | #endif /* CONFIG_HIBERNATION */ | 259 | #endif /* CONFIG_HIBERNATION */ |
260 | 260 | ||
261 | #ifdef CONFIG_SUSPEND_NVS | ||
262 | extern int suspend_nvs_register(unsigned long start, unsigned long size); | ||
263 | extern int suspend_nvs_alloc(void); | ||
264 | extern void suspend_nvs_free(void); | ||
265 | extern void suspend_nvs_save(void); | ||
266 | extern void suspend_nvs_restore(void); | ||
267 | #else /* CONFIG_SUSPEND_NVS */ | ||
268 | static inline int suspend_nvs_register(unsigned long a, unsigned long b) | ||
269 | { | ||
270 | return 0; | ||
271 | } | ||
272 | static inline int suspend_nvs_alloc(void) { return 0; } | ||
273 | static inline void suspend_nvs_free(void) {} | ||
274 | static inline void suspend_nvs_save(void) {} | ||
275 | static inline void suspend_nvs_restore(void) {} | ||
276 | #endif /* CONFIG_SUSPEND_NVS */ | ||
277 | |||
278 | #ifdef CONFIG_PM_SLEEP | 261 | #ifdef CONFIG_PM_SLEEP |
279 | void save_processor_state(void); | 262 | void save_processor_state(void); |
280 | void restore_processor_state(void); | 263 | void restore_processor_state(void); |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index a5aff3ebad38..265729966ece 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -100,13 +100,9 @@ config PM_SLEEP_ADVANCED_DEBUG | |||
100 | depends on PM_ADVANCED_DEBUG | 100 | depends on PM_ADVANCED_DEBUG |
101 | default n | 101 | default n |
102 | 102 | ||
103 | config SUSPEND_NVS | ||
104 | bool | ||
105 | |||
106 | config SUSPEND | 103 | config SUSPEND |
107 | bool "Suspend to RAM and standby" | 104 | bool "Suspend to RAM and standby" |
108 | depends on PM && ARCH_SUSPEND_POSSIBLE | 105 | depends on PM && ARCH_SUSPEND_POSSIBLE |
109 | select SUSPEND_NVS if HAS_IOMEM | ||
110 | default y | 106 | default y |
111 | ---help--- | 107 | ---help--- |
112 | Allow the system to enter sleep states in which main memory is | 108 | Allow the system to enter sleep states in which main memory is |
@@ -140,7 +136,6 @@ config HIBERNATION | |||
140 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE | 136 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE |
141 | select LZO_COMPRESS | 137 | select LZO_COMPRESS |
142 | select LZO_DECOMPRESS | 138 | select LZO_DECOMPRESS |
143 | select SUSPEND_NVS if HAS_IOMEM | ||
144 | ---help--- | 139 | ---help--- |
145 | Enable the suspend to disk (STD) functionality, which is usually | 140 | Enable the suspend to disk (STD) functionality, which is usually |
146 | called "hibernation" in user interfaces. STD checkpoints the | 141 | called "hibernation" in user interfaces. STD checkpoints the |
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index f9063c6b185d..120a15823325 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -10,6 +10,5 @@ obj-$(CONFIG_SUSPEND) += suspend.o | |||
10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o | 10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o |
11 | obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ | 11 | obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ |
12 | block_io.o | 12 | block_io.o |
13 | obj-$(CONFIG_SUSPEND_NVS) += nvs.o | ||
14 | 13 | ||
15 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o | 14 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o |