aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2011-01-12 04:56:08 -0500
committerLen Brown <len.brown@intel.com>2011-01-12 04:56:08 -0500
commitd16675e1f1de98cc73ae77c6df26154ffae6230a (patch)
treebe7ffdaabdaa06f8c917c7a6c9919d4b5fd13a52
parentfb4af417cce9ff87abf33a6bb9a0cf613e285364 (diff)
parent6d5bbf00d251cc73223a71422d69e069dc2e0b8d (diff)
Merge branch 'suspend-ioremap-cache' into release
-rw-r--r--arch/ia64/include/asm/io.h5
-rw-r--r--arch/x86/kernel/e820.c1
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/internal.h8
-rw-r--r--drivers/acpi/nvs.c (renamed from kernel/power/nvs.c)20
-rw-r--r--drivers/acpi/osl.c6
-rw-r--r--drivers/acpi/sleep.c5
-rw-r--r--include/linux/acpi.h9
-rw-r--r--include/linux/suspend.h17
-rw-r--r--kernel/power/Kconfig5
-rw-r--r--kernel/power/Makefile1
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)
426extern void iounmap (volatile void __iomem *addr); 426extern void iounmap (volatile void __iomem *addr);
427extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size); 427extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size);
428extern void early_iounmap (volatile void __iomem *addr, unsigned long size); 428extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
429static 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
25acpi-y += wakeup.o 25acpi-y += wakeup.o
26acpi-y += sleep.o 26acpi-y += sleep.o
27acpi-$(CONFIG_ACPI_SLEEP) += proc.o 27acpi-$(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
85int acpi_sleep_proc_init(void); 85int acpi_sleep_proc_init(void);
86int suspend_nvs_alloc(void);
87void suspend_nvs_free(void);
88int suspend_nvs_save(void);
89void suspend_nvs_restore(void);
86#else 90#else
87static inline int acpi_sleep_proc_init(void) { return 0; } 91static inline int acpi_sleep_proc_init(void) { return 0; }
92static inline int suspend_nvs_alloc(void) { return 0; }
93static inline void suspend_nvs_free(void) {}
94static inline int suspend_nvs_save(void) {}
95static 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 */
108void suspend_nvs_save(void) 109int 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)
124static int acpi_pm_pre_suspend(void) 124static 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);
254void __init acpi_nvs_nosave(void); 254void __init acpi_nvs_nosave(void);
255#endif /* CONFIG_PM_SLEEP */ 255#endif /* CONFIG_PM_SLEEP */
256 256
257#ifdef CONFIG_ACPI_SLEEP
258int suspend_nvs_register(unsigned long start, unsigned long size);
259#else
260static inline int suspend_nvs_register(unsigned long a, unsigned long b)
261{
262 return 0;
263}
264#endif
265
257struct acpi_osc_context { 266struct 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; }
258static inline bool system_entering_hibernation(void) { return false; } 258static inline bool system_entering_hibernation(void) { return false; }
259#endif /* CONFIG_HIBERNATION */ 259#endif /* CONFIG_HIBERNATION */
260 260
261#ifdef CONFIG_SUSPEND_NVS
262extern int suspend_nvs_register(unsigned long start, unsigned long size);
263extern int suspend_nvs_alloc(void);
264extern void suspend_nvs_free(void);
265extern void suspend_nvs_save(void);
266extern void suspend_nvs_restore(void);
267#else /* CONFIG_SUSPEND_NVS */
268static inline int suspend_nvs_register(unsigned long a, unsigned long b)
269{
270 return 0;
271}
272static inline int suspend_nvs_alloc(void) { return 0; }
273static inline void suspend_nvs_free(void) {}
274static inline void suspend_nvs_save(void) {}
275static inline void suspend_nvs_restore(void) {}
276#endif /* CONFIG_SUSPEND_NVS */
277
278#ifdef CONFIG_PM_SLEEP 261#ifdef CONFIG_PM_SLEEP
279void save_processor_state(void); 262void save_processor_state(void);
280void restore_processor_state(void); 263void 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
103config SUSPEND_NVS
104 bool
105
106config SUSPEND 103config 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
10obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o 10obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o
11obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ 11obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \
12 block_io.o 12 block_io.o
13obj-$(CONFIG_SUSPEND_NVS) += nvs.o
14 13
15obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o 14obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o