diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-27 10:03:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-27 10:03:12 -0400 |
commit | 02c646ef4e9040aa538fa6ed22bb3fb502df5a77 (patch) | |
tree | 7fc4595c4a8b9b1053aba6838063a18ce7661993 | |
parent | 4303ef19c6e6d16ea845c04b02b9cf086bcb8ed7 (diff) | |
parent | 2cebc5e27e18acb2226b22f66b3b1b11deb76aa0 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
ACPI / PM: Do not enable GPEs for system wakeup in advance
ACPICA: Truncate I/O addresses to 16 bits for Windows compatibility
ACPICA: Limit maximum time for Sleep() operator
ACPICA: Fix namestring associated with AE_NO_HANDLER exception
ACPI / ACPICA: Fix sysfs GPE interface
ACPI / ACPICA: Fix GPE initialization
ACPI / ACPICA: Avoid writing full enable masks to GPE registers
ACPI / ACPICA: Fix low-level GPE manipulation code
ACPI / ACPICA: Use helper function for computing GPE masks
ACPI / ACPICA: Do not attempt to disable GPE when installing handler
ACPI: Disable Vista compatibility for Sony VGN-NS50B_L
ACPI: fan: fix unbalanced code block
ACPI: Store NVS state even when entering suspend to RAM
suspend: Move NVS save/restore code to generic suspend functionality
ACPI: Do not try to set up acpi processor stuff on cores exceeding maxcpus=
ACPI: acpi_pad: Don't needlessly mark LAPIC unstable
30 files changed, 298 insertions, 237 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 7bca3c6a02fb..0d6fc71bedb1 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -729,7 +729,7 @@ static int __init e820_mark_nvs_memory(void) | |||
729 | struct e820entry *ei = &e820.map[i]; | 729 | struct e820entry *ei = &e820.map[i]; |
730 | 730 | ||
731 | if (ei->type == E820_NVS) | 731 | if (ei->type == E820_NVS) |
732 | hibernate_nvs_register(ei->addr, ei->size); | 732 | suspend_nvs_register(ei->addr, ei->size); |
733 | } | 733 | } |
734 | 734 | ||
735 | return 0; | 735 | return 0; |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index d269a8f3329c..446aced33aff 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -46,6 +46,8 @@ static unsigned long power_saving_mwait_eax; | |||
46 | 46 | ||
47 | static unsigned char tsc_detected_unstable; | 47 | static unsigned char tsc_detected_unstable; |
48 | static unsigned char tsc_marked_unstable; | 48 | static unsigned char tsc_marked_unstable; |
49 | static unsigned char lapic_detected_unstable; | ||
50 | static unsigned char lapic_marked_unstable; | ||
49 | 51 | ||
50 | static void power_saving_mwait_init(void) | 52 | static void power_saving_mwait_init(void) |
51 | { | 53 | { |
@@ -75,9 +77,6 @@ static void power_saving_mwait_init(void) | |||
75 | power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | | 77 | power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | |
76 | (highest_subcstate - 1); | 78 | (highest_subcstate - 1); |
77 | 79 | ||
78 | for_each_online_cpu(i) | ||
79 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &i); | ||
80 | |||
81 | #if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) | 80 | #if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) |
82 | switch (boot_cpu_data.x86_vendor) { | 81 | switch (boot_cpu_data.x86_vendor) { |
83 | case X86_VENDOR_AMD: | 82 | case X86_VENDOR_AMD: |
@@ -86,13 +85,15 @@ static void power_saving_mwait_init(void) | |||
86 | * AMD Fam10h TSC will tick in all | 85 | * AMD Fam10h TSC will tick in all |
87 | * C/P/S0/S1 states when this bit is set. | 86 | * C/P/S0/S1 states when this bit is set. |
88 | */ | 87 | */ |
89 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) | 88 | if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
90 | return; | 89 | tsc_detected_unstable = 1; |
91 | 90 | if (!boot_cpu_has(X86_FEATURE_ARAT)) | |
92 | /*FALL THROUGH*/ | 91 | lapic_detected_unstable = 1; |
92 | break; | ||
93 | default: | 93 | default: |
94 | /* TSC could halt in idle */ | 94 | /* TSC & LAPIC could halt in idle */ |
95 | tsc_detected_unstable = 1; | 95 | tsc_detected_unstable = 1; |
96 | lapic_detected_unstable = 1; | ||
96 | } | 97 | } |
97 | #endif | 98 | #endif |
98 | } | 99 | } |
@@ -180,10 +181,20 @@ static int power_saving_thread(void *data) | |||
180 | mark_tsc_unstable("TSC halts in idle"); | 181 | mark_tsc_unstable("TSC halts in idle"); |
181 | tsc_marked_unstable = 1; | 182 | tsc_marked_unstable = 1; |
182 | } | 183 | } |
184 | if (lapic_detected_unstable && !lapic_marked_unstable) { | ||
185 | int i; | ||
186 | /* LAPIC could halt in idle, so notify users */ | ||
187 | for_each_online_cpu(i) | ||
188 | clockevents_notify( | ||
189 | CLOCK_EVT_NOTIFY_BROADCAST_ON, | ||
190 | &i); | ||
191 | lapic_marked_unstable = 1; | ||
192 | } | ||
183 | local_irq_disable(); | 193 | local_irq_disable(); |
184 | cpu = smp_processor_id(); | 194 | cpu = smp_processor_id(); |
185 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, | 195 | if (lapic_marked_unstable) |
186 | &cpu); | 196 | clockevents_notify( |
197 | CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | ||
187 | stop_critical_timings(); | 198 | stop_critical_timings(); |
188 | 199 | ||
189 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | 200 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
@@ -192,8 +203,9 @@ static int power_saving_thread(void *data) | |||
192 | __mwait(power_saving_mwait_eax, 1); | 203 | __mwait(power_saving_mwait_eax, 1); |
193 | 204 | ||
194 | start_critical_timings(); | 205 | start_critical_timings(); |
195 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, | 206 | if (lapic_marked_unstable) |
196 | &cpu); | 207 | clockevents_notify( |
208 | CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | ||
197 | local_irq_enable(); | 209 | local_irq_enable(); |
198 | 210 | ||
199 | if (jiffies > expire_time) { | 211 | if (jiffies > expire_time) { |
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index 33181ad350d5..b17d8de9f6ff 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
@@ -119,6 +119,10 @@ | |||
119 | 119 | ||
120 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF | 120 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF |
121 | 121 | ||
122 | /* Maximum sleep allowed via Sleep() operator */ | ||
123 | |||
124 | #define ACPI_MAX_SLEEP 20000 /* Two seconds */ | ||
125 | |||
122 | /****************************************************************************** | 126 | /****************************************************************************** |
123 | * | 127 | * |
124 | * ACPI Specification constants (Do not change unless the specification changes) | 128 | * ACPI Specification constants (Do not change unless the specification changes) |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 64d1e5c2d4ae..c3f43daa8be3 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -80,10 +80,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | |||
80 | acpi_status | 80 | acpi_status |
81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); | 81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); |
82 | 82 | ||
83 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
84 | |||
85 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
86 | |||
87 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | 83 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
88 | u32 gpe_number); | 84 | u32 gpe_number); |
89 | 85 | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 9070f1fe8f17..899d68afc3c5 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -125,6 +125,14 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); | |||
125 | */ | 125 | */ |
126 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); | 126 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); |
127 | 127 | ||
128 | /* | ||
129 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility | ||
130 | * with other ACPI implementations. NOTE: During ACPICA initialization, | ||
131 | * this value is set to TRUE if any Windows OSI strings have been | ||
132 | * requested by the BIOS. | ||
133 | */ | ||
134 | u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE); | ||
135 | |||
128 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ | 136 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ |
129 | 137 | ||
130 | struct acpi_table_fadt acpi_gbl_FADT; | 138 | struct acpi_table_fadt acpi_gbl_FADT; |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 5900f135dc6d..32391588e163 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -90,7 +90,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
90 | /* | 90 | /* |
91 | * hwgpe - GPE support | 91 | * hwgpe - GPE support |
92 | */ | 92 | */ |
93 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | 93 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, |
94 | struct acpi_gpe_register_info *gpe_register_info); | ||
95 | |||
96 | acpi_status | ||
97 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action); | ||
94 | 98 | ||
95 | acpi_status | 99 | acpi_status |
96 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); | 100 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index a221ad404167..7c2c336006a1 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_status | |||
69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | 69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) |
70 | { | 70 | { |
71 | struct acpi_gpe_register_info *gpe_register_info; | 71 | struct acpi_gpe_register_info *gpe_register_info; |
72 | u8 register_bit; | 72 | u32 register_bit; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); | 74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
75 | 75 | ||
@@ -78,9 +78,8 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 78 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 79 | } |
80 | 80 | ||
81 | register_bit = (u8) | 81 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
82 | (1 << | 82 | gpe_register_info); |
83 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | ||
84 | 83 | ||
85 | /* Clear the wake/run bits up front */ | 84 | /* Clear the wake/run bits up front */ |
86 | 85 | ||
@@ -100,106 +99,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
100 | return_ACPI_STATUS(AE_OK); | 99 | return_ACPI_STATUS(AE_OK); |
101 | } | 100 | } |
102 | 101 | ||
103 | /******************************************************************************* | ||
104 | * | ||
105 | * FUNCTION: acpi_ev_enable_gpe | ||
106 | * | ||
107 | * PARAMETERS: gpe_event_info - GPE to enable | ||
108 | * | ||
109 | * RETURN: Status | ||
110 | * | ||
111 | * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless | ||
112 | * of type or number of references. | ||
113 | * | ||
114 | * Note: The GPE lock should be already acquired when this function is called. | ||
115 | * | ||
116 | ******************************************************************************/ | ||
117 | |||
118 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
119 | { | ||
120 | acpi_status status; | ||
121 | |||
122 | |||
123 | ACPI_FUNCTION_TRACE(ev_enable_gpe); | ||
124 | |||
125 | |||
126 | /* | ||
127 | * We will only allow a GPE to be enabled if it has either an | ||
128 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
129 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
130 | * first time it fires. | ||
131 | */ | ||
132 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
133 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
134 | } | ||
135 | |||
136 | /* Ensure the HW enable masks are current */ | ||
137 | |||
138 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | return_ACPI_STATUS(status); | ||
141 | } | ||
142 | |||
143 | /* Clear the GPE (of stale events) */ | ||
144 | |||
145 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | return_ACPI_STATUS(status); | ||
148 | } | ||
149 | |||
150 | /* Enable the requested GPE */ | ||
151 | |||
152 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
153 | return_ACPI_STATUS(status); | ||
154 | } | ||
155 | |||
156 | /******************************************************************************* | ||
157 | * | ||
158 | * FUNCTION: acpi_ev_disable_gpe | ||
159 | * | ||
160 | * PARAMETERS: gpe_event_info - GPE to disable | ||
161 | * | ||
162 | * RETURN: Status | ||
163 | * | ||
164 | * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE, | ||
165 | * regardless of the type or number of references. | ||
166 | * | ||
167 | * Note: The GPE lock should be already acquired when this function is called. | ||
168 | * | ||
169 | ******************************************************************************/ | ||
170 | |||
171 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
172 | { | ||
173 | acpi_status status; | ||
174 | |||
175 | ACPI_FUNCTION_TRACE(ev_disable_gpe); | ||
176 | |||
177 | |||
178 | /* | ||
179 | * Note: Always disable the GPE, even if we think that that it is already | ||
180 | * disabled. It is possible that the AML or some other code has enabled | ||
181 | * the GPE behind our back. | ||
182 | */ | ||
183 | |||
184 | /* Ensure the HW enable masks are current */ | ||
185 | |||
186 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
187 | if (ACPI_FAILURE(status)) { | ||
188 | return_ACPI_STATUS(status); | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * Always H/W disable this GPE, even if we don't know the GPE type. | ||
193 | * Simply clear the enable bit for this particular GPE, but do not | ||
194 | * write out the current GPE enable mask since this may inadvertently | ||
195 | * enable GPEs too early. An example is a rogue GPE that has arrived | ||
196 | * during ACPICA initialization - possibly because AML or other code | ||
197 | * has enabled the GPE. | ||
198 | */ | ||
199 | status = acpi_hw_low_disable_gpe(gpe_event_info); | ||
200 | return_ACPI_STATUS(status); | ||
201 | } | ||
202 | |||
203 | 102 | ||
204 | /******************************************************************************* | 103 | /******************************************************************************* |
205 | * | 104 | * |
@@ -451,10 +350,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
451 | return_VOID; | 350 | return_VOID; |
452 | } | 351 | } |
453 | 352 | ||
454 | /* Update the GPE register masks for return to enabled state */ | ||
455 | |||
456 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
457 | |||
458 | /* | 353 | /* |
459 | * Take a snapshot of the GPE info for this level - we copy the info to | 354 | * Take a snapshot of the GPE info for this level - we copy the info to |
460 | * prevent a race condition with remove_handler/remove_block. | 355 | * prevent a race condition with remove_handler/remove_block. |
@@ -607,7 +502,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
607 | * Disable the GPE, so it doesn't keep firing before the method has a | 502 | * Disable the GPE, so it doesn't keep firing before the method has a |
608 | * chance to run (it runs asynchronously with interrupts enabled). | 503 | * chance to run (it runs asynchronously with interrupts enabled). |
609 | */ | 504 | */ |
610 | status = acpi_ev_disable_gpe(gpe_event_info); | 505 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
611 | if (ACPI_FAILURE(status)) { | 506 | if (ACPI_FAILURE(status)) { |
612 | ACPI_EXCEPTION((AE_INFO, status, | 507 | ACPI_EXCEPTION((AE_INFO, status, |
613 | "Unable to disable GPE[0x%2X]", | 508 | "Unable to disable GPE[0x%2X]", |
@@ -644,7 +539,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
644 | * Disable the GPE. The GPE will remain disabled a handler | 539 | * Disable the GPE. The GPE will remain disabled a handler |
645 | * is installed or ACPICA is restarted. | 540 | * is installed or ACPICA is restarted. |
646 | */ | 541 | */ |
647 | status = acpi_ev_disable_gpe(gpe_event_info); | 542 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
648 | if (ACPI_FAILURE(status)) { | 543 | if (ACPI_FAILURE(status)) { |
649 | ACPI_EXCEPTION((AE_INFO, status, | 544 | ACPI_EXCEPTION((AE_INFO, status, |
650 | "Unable to disable GPE[0x%2X]", | 545 | "Unable to disable GPE[0x%2X]", |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 7c28f2d9fd35..341a38ce8aa6 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -500,6 +500,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
500 | 500 | ||
501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; | 501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; |
502 | gpe_event_info = &gpe_block->event_info[gpe_index]; | 502 | gpe_event_info = &gpe_block->event_info[gpe_index]; |
503 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
504 | |||
505 | /* | ||
506 | * If the GPE has already been enabled for runtime | ||
507 | * signaling, make sure it remains enabled, but do not | ||
508 | * increment its reference counter. | ||
509 | */ | ||
510 | if (gpe_event_info->runtime_count) { | ||
511 | acpi_set_gpe(gpe_device, gpe_number, | ||
512 | ACPI_GPE_ENABLE); | ||
513 | gpe_enabled_count++; | ||
514 | continue; | ||
515 | } | ||
503 | 516 | ||
504 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { | 517 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { |
505 | wake_gpe_count++; | 518 | wake_gpe_count++; |
@@ -516,7 +529,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
516 | 529 | ||
517 | /* Enable this GPE */ | 530 | /* Enable this GPE */ |
518 | 531 | ||
519 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
520 | status = acpi_enable_gpe(gpe_device, gpe_number, | 532 | status = acpi_enable_gpe(gpe_device, gpe_number, |
521 | ACPI_GPE_TYPE_RUNTIME); | 533 | ACPI_GPE_TYPE_RUNTIME); |
522 | if (ACPI_FAILURE(status)) { | 534 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index cc825023012a..4a531cdf7942 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -719,13 +719,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
719 | handler->context = context; | 719 | handler->context = context; |
720 | handler->method_node = gpe_event_info->dispatch.method_node; | 720 | handler->method_node = gpe_event_info->dispatch.method_node; |
721 | 721 | ||
722 | /* Disable the GPE before installing the handler */ | ||
723 | |||
724 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
725 | if (ACPI_FAILURE (status)) { | ||
726 | goto unlock_and_exit; | ||
727 | } | ||
728 | |||
729 | /* Install the handler */ | 722 | /* Install the handler */ |
730 | 723 | ||
731 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 724 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index d5a5efc043bf..d97b8dce1668 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -210,6 +210,44 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
210 | 210 | ||
211 | /******************************************************************************* | 211 | /******************************************************************************* |
212 | * | 212 | * |
213 | * FUNCTION: acpi_clear_and_enable_gpe | ||
214 | * | ||
215 | * PARAMETERS: gpe_event_info - GPE to enable | ||
216 | * | ||
217 | * RETURN: Status | ||
218 | * | ||
219 | * DESCRIPTION: Clear the given GPE from stale events and enable it. | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | static acpi_status | ||
223 | acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
224 | { | ||
225 | acpi_status status; | ||
226 | |||
227 | /* | ||
228 | * We will only allow a GPE to be enabled if it has either an | ||
229 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
230 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
231 | * first time it fires. | ||
232 | */ | ||
233 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
234 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
235 | } | ||
236 | |||
237 | /* Clear the GPE (of stale events) */ | ||
238 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
239 | if (ACPI_FAILURE(status)) { | ||
240 | return_ACPI_STATUS(status); | ||
241 | } | ||
242 | |||
243 | /* Enable the requested GPE */ | ||
244 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | ||
245 | |||
246 | return_ACPI_STATUS(status); | ||
247 | } | ||
248 | |||
249 | /******************************************************************************* | ||
250 | * | ||
213 | * FUNCTION: acpi_set_gpe | 251 | * FUNCTION: acpi_set_gpe |
214 | * | 252 | * |
215 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 253 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
@@ -249,11 +287,11 @@ acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action) | |||
249 | 287 | ||
250 | switch (action) { | 288 | switch (action) { |
251 | case ACPI_GPE_ENABLE: | 289 | case ACPI_GPE_ENABLE: |
252 | status = acpi_ev_enable_gpe(gpe_event_info); | 290 | status = acpi_clear_and_enable_gpe(gpe_event_info); |
253 | break; | 291 | break; |
254 | 292 | ||
255 | case ACPI_GPE_DISABLE: | 293 | case ACPI_GPE_DISABLE: |
256 | status = acpi_ev_disable_gpe(gpe_event_info); | 294 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
257 | break; | 295 | break; |
258 | 296 | ||
259 | default: | 297 | default: |
@@ -316,7 +354,11 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
316 | 354 | ||
317 | gpe_event_info->runtime_count++; | 355 | gpe_event_info->runtime_count++; |
318 | if (gpe_event_info->runtime_count == 1) { | 356 | if (gpe_event_info->runtime_count == 1) { |
319 | status = acpi_ev_enable_gpe(gpe_event_info); | 357 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
358 | if (ACPI_SUCCESS(status)) { | ||
359 | status = acpi_clear_and_enable_gpe(gpe_event_info); | ||
360 | } | ||
361 | |||
320 | if (ACPI_FAILURE(status)) { | 362 | if (ACPI_FAILURE(status)) { |
321 | gpe_event_info->runtime_count--; | 363 | gpe_event_info->runtime_count--; |
322 | goto unlock_and_exit; | 364 | goto unlock_and_exit; |
@@ -343,7 +385,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
343 | */ | 385 | */ |
344 | gpe_event_info->wakeup_count++; | 386 | gpe_event_info->wakeup_count++; |
345 | if (gpe_event_info->wakeup_count == 1) { | 387 | if (gpe_event_info->wakeup_count == 1) { |
346 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 388 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
347 | } | 389 | } |
348 | } | 390 | } |
349 | 391 | ||
@@ -403,7 +445,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
403 | 445 | ||
404 | gpe_event_info->runtime_count--; | 446 | gpe_event_info->runtime_count--; |
405 | if (!gpe_event_info->runtime_count) { | 447 | if (!gpe_event_info->runtime_count) { |
406 | status = acpi_ev_disable_gpe(gpe_event_info); | 448 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
449 | if (ACPI_SUCCESS(status)) { | ||
450 | status = acpi_hw_low_set_gpe(gpe_event_info, | ||
451 | ACPI_GPE_DISABLE); | ||
452 | } | ||
453 | |||
407 | if (ACPI_FAILURE(status)) { | 454 | if (ACPI_FAILURE(status)) { |
408 | gpe_event_info->runtime_count++; | 455 | gpe_event_info->runtime_count++; |
409 | goto unlock_and_exit; | 456 | goto unlock_and_exit; |
@@ -424,7 +471,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
424 | 471 | ||
425 | gpe_event_info->wakeup_count--; | 472 | gpe_event_info->wakeup_count--; |
426 | if (!gpe_event_info->wakeup_count) { | 473 | if (!gpe_event_info->wakeup_count) { |
427 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 474 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
428 | } | 475 | } |
429 | } | 476 | } |
430 | 477 | ||
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 6d32e09327f1..675aaa91a770 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -201,6 +201,14 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
201 | 201 | ||
202 | acpi_ex_relinquish_interpreter(); | 202 | acpi_ex_relinquish_interpreter(); |
203 | 203 | ||
204 | /* | ||
205 | * For compatibility with other ACPI implementations and to prevent | ||
206 | * accidental deep sleeps, limit the sleep time to something reasonable. | ||
207 | */ | ||
208 | if (how_long > ACPI_MAX_SLEEP) { | ||
209 | how_long = ACPI_MAX_SLEEP; | ||
210 | } | ||
211 | |||
204 | acpi_os_sleep(how_long); | 212 | acpi_os_sleep(how_long); |
205 | 213 | ||
206 | /* And now we must get the interpreter again */ | 214 | /* And now we must get the interpreter again */ |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index bd72319a38f0..3450309c2786 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -57,21 +57,47 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
57 | 57 | ||
58 | /****************************************************************************** | 58 | /****************************************************************************** |
59 | * | 59 | * |
60 | * FUNCTION: acpi_hw_low_disable_gpe | 60 | * FUNCTION: acpi_hw_gpe_register_bit |
61 | * | ||
62 | * PARAMETERS: gpe_event_info - Info block for the GPE | ||
63 | * gpe_register_info - Info block for the GPE register | ||
64 | * | ||
65 | * RETURN: Status | ||
66 | * | ||
67 | * DESCRIPTION: Compute GPE enable mask with one bit corresponding to the given | ||
68 | * GPE set. | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | |||
72 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | ||
73 | struct acpi_gpe_register_info *gpe_register_info) | ||
74 | { | ||
75 | return (u32)1 << (gpe_event_info->gpe_number - | ||
76 | gpe_register_info->base_gpe_number); | ||
77 | } | ||
78 | |||
79 | /****************************************************************************** | ||
80 | * | ||
81 | * FUNCTION: acpi_hw_low_set_gpe | ||
61 | * | 82 | * |
62 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled | 83 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled |
84 | * action - Enable or disable | ||
63 | * | 85 | * |
64 | * RETURN: Status | 86 | * RETURN: Status |
65 | * | 87 | * |
66 | * DESCRIPTION: Disable a single GPE in the enable register. | 88 | * DESCRIPTION: Enable or disable a single GPE in its enable register. |
67 | * | 89 | * |
68 | ******************************************************************************/ | 90 | ******************************************************************************/ |
69 | 91 | ||
70 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | 92 | acpi_status |
93 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action) | ||
71 | { | 94 | { |
72 | struct acpi_gpe_register_info *gpe_register_info; | 95 | struct acpi_gpe_register_info *gpe_register_info; |
73 | acpi_status status; | 96 | acpi_status status; |
74 | u32 enable_mask; | 97 | u32 enable_mask; |
98 | u32 register_bit; | ||
99 | |||
100 | ACPI_FUNCTION_ENTRY(); | ||
75 | 101 | ||
76 | /* Get the info block for the entire GPE register */ | 102 | /* Get the info block for the entire GPE register */ |
77 | 103 | ||
@@ -87,11 +113,27 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
87 | return (status); | 113 | return (status); |
88 | } | 114 | } |
89 | 115 | ||
90 | /* Clear just the bit that corresponds to this GPE */ | 116 | /* Set ot clear just the bit that corresponds to this GPE */ |
91 | 117 | ||
92 | ACPI_CLEAR_BIT(enable_mask, ((u32)1 << | 118 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
93 | (gpe_event_info->gpe_number - | 119 | gpe_register_info); |
94 | gpe_register_info->base_gpe_number))); | 120 | switch (action) { |
121 | case ACPI_GPE_COND_ENABLE: | ||
122 | if (!(register_bit & gpe_register_info->enable_for_run)) | ||
123 | return (AE_BAD_PARAMETER); | ||
124 | |||
125 | case ACPI_GPE_ENABLE: | ||
126 | ACPI_SET_BIT(enable_mask, register_bit); | ||
127 | break; | ||
128 | |||
129 | case ACPI_GPE_DISABLE: | ||
130 | ACPI_CLEAR_BIT(enable_mask, register_bit); | ||
131 | break; | ||
132 | |||
133 | default: | ||
134 | ACPI_ERROR((AE_INFO, "Invalid action\n")); | ||
135 | return (AE_BAD_PARAMETER); | ||
136 | } | ||
95 | 137 | ||
96 | /* Write the updated enable mask */ | 138 | /* Write the updated enable mask */ |
97 | 139 | ||
@@ -116,23 +158,11 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
116 | acpi_status | 158 | acpi_status |
117 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | 159 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) |
118 | { | 160 | { |
119 | struct acpi_gpe_register_info *gpe_register_info; | ||
120 | acpi_status status; | 161 | acpi_status status; |
121 | 162 | ||
122 | ACPI_FUNCTION_ENTRY(); | 163 | ACPI_FUNCTION_ENTRY(); |
123 | 164 | ||
124 | /* Get the info block for the entire GPE register */ | 165 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE); |
125 | |||
126 | gpe_register_info = gpe_event_info->register_info; | ||
127 | if (!gpe_register_info) { | ||
128 | return (AE_NOT_EXIST); | ||
129 | } | ||
130 | |||
131 | /* Write the entire GPE (runtime) enable register */ | ||
132 | |||
133 | status = acpi_hw_write(gpe_register_info->enable_for_run, | ||
134 | &gpe_register_info->enable_address); | ||
135 | |||
136 | return (status); | 166 | return (status); |
137 | } | 167 | } |
138 | 168 | ||
@@ -150,21 +180,28 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | |||
150 | 180 | ||
151 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | 181 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) |
152 | { | 182 | { |
183 | struct acpi_gpe_register_info *gpe_register_info; | ||
153 | acpi_status status; | 184 | acpi_status status; |
154 | u8 register_bit; | 185 | u32 register_bit; |
155 | 186 | ||
156 | ACPI_FUNCTION_ENTRY(); | 187 | ACPI_FUNCTION_ENTRY(); |
157 | 188 | ||
158 | register_bit = (u8)(1 << | 189 | /* Get the info block for the entire GPE register */ |
159 | (gpe_event_info->gpe_number - | 190 | |
160 | gpe_event_info->register_info->base_gpe_number)); | 191 | gpe_register_info = gpe_event_info->register_info; |
192 | if (!gpe_register_info) { | ||
193 | return (AE_NOT_EXIST); | ||
194 | } | ||
195 | |||
196 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | ||
197 | gpe_register_info); | ||
161 | 198 | ||
162 | /* | 199 | /* |
163 | * Write a one to the appropriate bit in the status register to | 200 | * Write a one to the appropriate bit in the status register to |
164 | * clear this GPE. | 201 | * clear this GPE. |
165 | */ | 202 | */ |
166 | status = acpi_hw_write(register_bit, | 203 | status = acpi_hw_write(register_bit, |
167 | &gpe_event_info->register_info->status_address); | 204 | &gpe_register_info->status_address); |
168 | 205 | ||
169 | return (status); | 206 | return (status); |
170 | } | 207 | } |
@@ -187,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
187 | acpi_event_status * event_status) | 224 | acpi_event_status * event_status) |
188 | { | 225 | { |
189 | u32 in_byte; | 226 | u32 in_byte; |
190 | u8 register_bit; | 227 | u32 register_bit; |
191 | struct acpi_gpe_register_info *gpe_register_info; | 228 | struct acpi_gpe_register_info *gpe_register_info; |
192 | acpi_status status; | 229 | acpi_status status; |
193 | acpi_event_status local_event_status = 0; | 230 | acpi_event_status local_event_status = 0; |
@@ -204,9 +241,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
204 | 241 | ||
205 | /* Get the register bitmask for this GPE */ | 242 | /* Get the register bitmask for this GPE */ |
206 | 243 | ||
207 | register_bit = (u8)(1 << | 244 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
208 | (gpe_event_info->gpe_number - | 245 | gpe_register_info); |
209 | gpe_event_info->register_info->base_gpe_number)); | ||
210 | 246 | ||
211 | /* GPE currently enabled? (enabled for runtime?) */ | 247 | /* GPE currently enabled? (enabled for runtime?) */ |
212 | 248 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index c10d587c1641..e1d9c777b213 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -222,6 +222,12 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
222 | u32 one_byte; | 222 | u32 one_byte; |
223 | u32 i; | 223 | u32 i; |
224 | 224 | ||
225 | /* Truncate address to 16 bits if requested */ | ||
226 | |||
227 | if (acpi_gbl_truncate_io_addresses) { | ||
228 | address &= ACPI_UINT16_MAX; | ||
229 | } | ||
230 | |||
225 | /* Validate the entire request and perform the I/O */ | 231 | /* Validate the entire request and perform the I/O */ |
226 | 232 | ||
227 | status = acpi_hw_validate_io_request(address, width); | 233 | status = acpi_hw_validate_io_request(address, width); |
@@ -279,6 +285,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | |||
279 | acpi_status status; | 285 | acpi_status status; |
280 | u32 i; | 286 | u32 i; |
281 | 287 | ||
288 | /* Truncate address to 16 bits if requested */ | ||
289 | |||
290 | if (acpi_gbl_truncate_io_addresses) { | ||
291 | address &= ACPI_UINT16_MAX; | ||
292 | } | ||
293 | |||
282 | /* Validate the entire request and perform the I/O */ | 294 | /* Validate the entire request and perform the I/O */ |
283 | 295 | ||
284 | status = acpi_hw_validate_io_request(address, width); | 296 | status = acpi_hw_validate_io_request(address, width); |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 9bd6f050f299..4e5272c313e0 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -193,6 +193,15 @@ acpi_status acpi_ns_initialize_devices(void) | |||
193 | acpi_ns_init_one_device, NULL, &info, | 193 | acpi_ns_init_one_device, NULL, &info, |
194 | NULL); | 194 | NULL); |
195 | 195 | ||
196 | /* | ||
197 | * Any _OSI requests should be completed by now. If the BIOS has | ||
198 | * requested any Windows OSI strings, we will always truncate | ||
199 | * I/O addresses to 16 bits -- for Windows compatibility. | ||
200 | */ | ||
201 | if (acpi_gbl_osi_data >= ACPI_OSI_WIN_2000) { | ||
202 | acpi_gbl_truncate_io_addresses = TRUE; | ||
203 | } | ||
204 | |||
196 | ACPI_FREE(info.evaluate_info); | 205 | ACPI_FREE(info.evaluate_info); |
197 | if (ACPI_FAILURE(status)) { | 206 | if (ACPI_FAILURE(status)) { |
198 | goto error_exit; | 207 | goto error_exit; |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 2815df66f6f7..01381be05e96 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -218,6 +218,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
218 | }, | 218 | }, |
219 | }, | 219 | }, |
220 | { | 220 | { |
221 | .callback = dmi_disable_osi_vista, | ||
222 | .ident = "VGN-NS50B_L", | ||
223 | .matches = { | ||
224 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
225 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"), | ||
226 | }, | ||
227 | }, | ||
228 | { | ||
221 | .callback = dmi_disable_osi_win7, | 229 | .callback = dmi_disable_osi_win7, |
222 | .ident = "ASUS K50IJ", | 230 | .ident = "ASUS K50IJ", |
223 | .matches = { | 231 | .matches = { |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index fd51c4ab4829..7d857dabdde4 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -425,7 +425,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
425 | /* Button's GPE is run-wake GPE */ | 425 | /* Button's GPE is run-wake GPE */ |
426 | acpi_enable_gpe(device->wakeup.gpe_device, | 426 | acpi_enable_gpe(device->wakeup.gpe_device, |
427 | device->wakeup.gpe_number, | 427 | device->wakeup.gpe_number, |
428 | ACPI_GPE_TYPE_WAKE_RUN); | 428 | ACPI_GPE_TYPE_RUNTIME); |
429 | device->wakeup.run_wake_count++; | 429 | device->wakeup.run_wake_count++; |
430 | device->wakeup.state.enabled = 1; | 430 | device->wakeup.state.enabled = 1; |
431 | } | 431 | } |
@@ -449,7 +449,7 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
449 | if (device->wakeup.flags.valid) { | 449 | if (device->wakeup.flags.valid) { |
450 | acpi_disable_gpe(device->wakeup.gpe_device, | 450 | acpi_disable_gpe(device->wakeup.gpe_device, |
451 | device->wakeup.gpe_number, | 451 | device->wakeup.gpe_number, |
452 | ACPI_GPE_TYPE_WAKE_RUN); | 452 | ACPI_GPE_TYPE_RUNTIME); |
453 | device->wakeup.run_wake_count--; | 453 | device->wakeup.run_wake_count--; |
454 | device->wakeup.state.enabled = 0; | 454 | device->wakeup.state.enabled = 0; |
455 | } | 455 | } |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index acf2ab249842..8a3b840c0bb2 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -347,7 +347,6 @@ static int __init acpi_fan_init(void) | |||
347 | { | 347 | { |
348 | int result = 0; | 348 | int result = 0; |
349 | 349 | ||
350 | |||
351 | #ifdef CONFIG_ACPI_PROCFS | 350 | #ifdef CONFIG_ACPI_PROCFS |
352 | acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); | 351 | acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); |
353 | if (!acpi_fan_dir) | 352 | if (!acpi_fan_dir) |
@@ -356,7 +355,9 @@ static int __init acpi_fan_init(void) | |||
356 | 355 | ||
357 | result = acpi_bus_register_driver(&acpi_fan_driver); | 356 | result = acpi_bus_register_driver(&acpi_fan_driver); |
358 | if (result < 0) { | 357 | if (result < 0) { |
358 | #ifdef CONFIG_ACPI_PROCFS | ||
359 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); | 359 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); |
360 | #endif | ||
360 | return -ENODEV; | 361 | return -ENODEV; |
361 | } | 362 | } |
362 | 363 | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index b1034a9ada4e..38ea0cc6dc49 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -581,6 +581,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) | |||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
583 | 583 | ||
584 | #ifdef CONFIG_SMP | ||
585 | if (pr->id >= setup_max_cpus && pr->id != 0) | ||
586 | return 0; | ||
587 | #endif | ||
588 | |||
584 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); | 589 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); |
585 | 590 | ||
586 | /* | 591 | /* |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3fb4bdea7e06..5b7c52e4a00f 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -114,6 +114,8 @@ static int __acpi_pm_prepare(void) | |||
114 | { | 114 | { |
115 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | 115 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
116 | 116 | ||
117 | suspend_nvs_save(); | ||
118 | |||
117 | if (error) | 119 | if (error) |
118 | acpi_target_sleep_state = ACPI_STATE_S0; | 120 | acpi_target_sleep_state = ACPI_STATE_S0; |
119 | return error; | 121 | return error; |
@@ -143,6 +145,9 @@ static void acpi_pm_finish(void) | |||
143 | { | 145 | { |
144 | u32 acpi_state = acpi_target_sleep_state; | 146 | u32 acpi_state = acpi_target_sleep_state; |
145 | 147 | ||
148 | suspend_nvs_free(); | ||
149 | acpi_ec_unblock_transactions(); | ||
150 | |||
146 | if (acpi_state == ACPI_STATE_S0) | 151 | if (acpi_state == ACPI_STATE_S0) |
147 | return; | 152 | return; |
148 | 153 | ||
@@ -192,6 +197,11 @@ static int acpi_suspend_begin(suspend_state_t pm_state) | |||
192 | u32 acpi_state = acpi_suspend_states[pm_state]; | 197 | u32 acpi_state = acpi_suspend_states[pm_state]; |
193 | int error = 0; | 198 | int error = 0; |
194 | 199 | ||
200 | error = suspend_nvs_alloc(); | ||
201 | |||
202 | if (error) | ||
203 | return error; | ||
204 | |||
195 | if (sleep_states[acpi_state]) { | 205 | if (sleep_states[acpi_state]) { |
196 | acpi_target_sleep_state = acpi_state; | 206 | acpi_target_sleep_state = acpi_state; |
197 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 207 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
@@ -269,12 +279,13 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
269 | if (acpi_state == ACPI_STATE_S3) | 279 | if (acpi_state == ACPI_STATE_S3) |
270 | acpi_restore_state_mem(); | 280 | acpi_restore_state_mem(); |
271 | 281 | ||
282 | suspend_nvs_restore(); | ||
283 | |||
272 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 284 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
273 | } | 285 | } |
274 | 286 | ||
275 | static void acpi_suspend_finish(void) | 287 | static void acpi_suspend_finish(void) |
276 | { | 288 | { |
277 | acpi_ec_unblock_transactions(); | ||
278 | acpi_pm_finish(); | 289 | acpi_pm_finish(); |
279 | } | 290 | } |
280 | 291 | ||
@@ -404,7 +415,7 @@ static int acpi_hibernation_begin(void) | |||
404 | { | 415 | { |
405 | int error; | 416 | int error; |
406 | 417 | ||
407 | error = s4_no_nvs ? 0 : hibernate_nvs_alloc(); | 418 | error = s4_no_nvs ? 0 : suspend_nvs_alloc(); |
408 | if (!error) { | 419 | if (!error) { |
409 | acpi_target_sleep_state = ACPI_STATE_S4; | 420 | acpi_target_sleep_state = ACPI_STATE_S4; |
410 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 421 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
@@ -418,7 +429,7 @@ static int acpi_hibernation_pre_snapshot(void) | |||
418 | int error = acpi_pm_prepare(); | 429 | int error = acpi_pm_prepare(); |
419 | 430 | ||
420 | if (!error) | 431 | if (!error) |
421 | hibernate_nvs_save(); | 432 | suspend_nvs_save(); |
422 | 433 | ||
423 | return error; | 434 | return error; |
424 | } | 435 | } |
@@ -441,13 +452,6 @@ static int acpi_hibernation_enter(void) | |||
441 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 452 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
442 | } | 453 | } |
443 | 454 | ||
444 | static void acpi_hibernation_finish(void) | ||
445 | { | ||
446 | hibernate_nvs_free(); | ||
447 | acpi_ec_unblock_transactions(); | ||
448 | acpi_pm_finish(); | ||
449 | } | ||
450 | |||
451 | static void acpi_hibernation_leave(void) | 455 | static void acpi_hibernation_leave(void) |
452 | { | 456 | { |
453 | /* | 457 | /* |
@@ -464,7 +468,7 @@ static void acpi_hibernation_leave(void) | |||
464 | panic("ACPI S4 hardware signature mismatch"); | 468 | panic("ACPI S4 hardware signature mismatch"); |
465 | } | 469 | } |
466 | /* Restore the NVS memory area */ | 470 | /* Restore the NVS memory area */ |
467 | hibernate_nvs_restore(); | 471 | suspend_nvs_restore(); |
468 | /* Allow EC transactions to happen. */ | 472 | /* Allow EC transactions to happen. */ |
469 | acpi_ec_unblock_transactions_early(); | 473 | acpi_ec_unblock_transactions_early(); |
470 | } | 474 | } |
@@ -479,7 +483,7 @@ static struct platform_hibernation_ops acpi_hibernation_ops = { | |||
479 | .begin = acpi_hibernation_begin, | 483 | .begin = acpi_hibernation_begin, |
480 | .end = acpi_pm_end, | 484 | .end = acpi_pm_end, |
481 | .pre_snapshot = acpi_hibernation_pre_snapshot, | 485 | .pre_snapshot = acpi_hibernation_pre_snapshot, |
482 | .finish = acpi_hibernation_finish, | 486 | .finish = acpi_pm_finish, |
483 | .prepare = acpi_pm_prepare, | 487 | .prepare = acpi_pm_prepare, |
484 | .enter = acpi_hibernation_enter, | 488 | .enter = acpi_hibernation_enter, |
485 | .leave = acpi_hibernation_leave, | 489 | .leave = acpi_hibernation_leave, |
@@ -507,7 +511,7 @@ static int acpi_hibernation_begin_old(void) | |||
507 | 511 | ||
508 | if (!error) { | 512 | if (!error) { |
509 | if (!s4_no_nvs) | 513 | if (!s4_no_nvs) |
510 | error = hibernate_nvs_alloc(); | 514 | error = suspend_nvs_alloc(); |
511 | if (!error) | 515 | if (!error) |
512 | acpi_target_sleep_state = ACPI_STATE_S4; | 516 | acpi_target_sleep_state = ACPI_STATE_S4; |
513 | } | 517 | } |
@@ -517,7 +521,7 @@ static int acpi_hibernation_begin_old(void) | |||
517 | static int acpi_hibernation_pre_snapshot_old(void) | 521 | static int acpi_hibernation_pre_snapshot_old(void) |
518 | { | 522 | { |
519 | acpi_pm_freeze(); | 523 | acpi_pm_freeze(); |
520 | hibernate_nvs_save(); | 524 | suspend_nvs_save(); |
521 | return 0; | 525 | return 0; |
522 | } | 526 | } |
523 | 527 | ||
@@ -529,8 +533,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
529 | .begin = acpi_hibernation_begin_old, | 533 | .begin = acpi_hibernation_begin_old, |
530 | .end = acpi_pm_end, | 534 | .end = acpi_pm_end, |
531 | .pre_snapshot = acpi_hibernation_pre_snapshot_old, | 535 | .pre_snapshot = acpi_hibernation_pre_snapshot_old, |
532 | .finish = acpi_hibernation_finish, | ||
533 | .prepare = acpi_pm_freeze, | 536 | .prepare = acpi_pm_freeze, |
537 | .finish = acpi_pm_finish, | ||
534 | .enter = acpi_hibernation_enter, | 538 | .enter = acpi_hibernation_enter, |
535 | .leave = acpi_hibernation_leave, | 539 | .leave = acpi_hibernation_leave, |
536 | .pre_restore = acpi_pm_freeze, | 540 | .pre_restore = acpi_pm_freeze, |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index c79e789ed03a..f8db50a0941c 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -388,10 +388,12 @@ static ssize_t counter_set(struct kobject *kobj, | |||
388 | if (index < num_gpes) { | 388 | if (index < num_gpes) { |
389 | if (!strcmp(buf, "disable\n") && | 389 | if (!strcmp(buf, "disable\n") && |
390 | (status & ACPI_EVENT_FLAG_ENABLED)) | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
391 | result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE); | 391 | result = acpi_disable_gpe(handle, index, |
392 | ACPI_GPE_TYPE_RUNTIME); | ||
392 | else if (!strcmp(buf, "enable\n") && | 393 | else if (!strcmp(buf, "enable\n") && |
393 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 394 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
394 | result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE); | 395 | result = acpi_enable_gpe(handle, index, |
396 | ACPI_GPE_TYPE_RUNTIME); | ||
395 | else if (!strcmp(buf, "clear\n") && | 397 | else if (!strcmp(buf, "clear\n") && |
396 | (status & ACPI_EVENT_FLAG_SET)) | 398 | (status & ACPI_EVENT_FLAG_SET)) |
397 | result = acpi_clear_gpe(handle, index); | 399 | result = acpi_clear_gpe(handle, index); |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 4b9d339a6e28..388747a7ef4f 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -64,16 +64,13 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
64 | struct acpi_device *dev = | 64 | struct acpi_device *dev = |
65 | container_of(node, struct acpi_device, wakeup_list); | 65 | container_of(node, struct acpi_device, wakeup_list); |
66 | 66 | ||
67 | if (!dev->wakeup.flags.valid) | 67 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled |
68 | continue; | ||
69 | |||
70 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) | ||
71 | || sleep_state > (u32) dev->wakeup.sleep_state) | 68 | || sleep_state > (u32) dev->wakeup.sleep_state) |
72 | continue; | 69 | continue; |
73 | 70 | ||
74 | /* The wake-up power should have been enabled already. */ | 71 | /* The wake-up power should have been enabled already. */ |
75 | acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | 72 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
76 | ACPI_GPE_ENABLE); | 73 | ACPI_GPE_TYPE_WAKE); |
77 | } | 74 | } |
78 | } | 75 | } |
79 | 76 | ||
@@ -96,6 +93,8 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
96 | || (sleep_state > (u32) dev->wakeup.sleep_state)) | 93 | || (sleep_state > (u32) dev->wakeup.sleep_state)) |
97 | continue; | 94 | continue; |
98 | 95 | ||
96 | acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | ||
97 | ACPI_GPE_TYPE_WAKE); | ||
99 | acpi_disable_wakeup_device_power(dev); | 98 | acpi_disable_wakeup_device_power(dev); |
100 | } | 99 | } |
101 | } | 100 | } |
@@ -109,13 +108,8 @@ int __init acpi_wakeup_device_init(void) | |||
109 | struct acpi_device *dev = container_of(node, | 108 | struct acpi_device *dev = container_of(node, |
110 | struct acpi_device, | 109 | struct acpi_device, |
111 | wakeup_list); | 110 | wakeup_list); |
112 | /* In case user doesn't load button driver */ | 111 | if (dev->wakeup.flags.always_enabled) |
113 | if (!dev->wakeup.flags.always_enabled || | 112 | dev->wakeup.state.enabled = 1; |
114 | dev->wakeup.state.enabled) | ||
115 | continue; | ||
116 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | ||
117 | ACPI_GPE_TYPE_WAKE); | ||
118 | dev->wakeup.state.enabled = 1; | ||
119 | } | 113 | } |
120 | mutex_unlock(&acpi_device_lock); | 114 | mutex_unlock(&acpi_device_lock); |
121 | return 0; | 115 | return 0; |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 5958d7845bd5..17714beb868e 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -212,7 +212,7 @@ char const *acpi_gbl_exception_names_env[] = { | |||
212 | "AE_NO_GLOBAL_LOCK", | 212 | "AE_NO_GLOBAL_LOCK", |
213 | "AE_ABORT_METHOD", | 213 | "AE_ABORT_METHOD", |
214 | "AE_SAME_HANDLER", | 214 | "AE_SAME_HANDLER", |
215 | "AE_WAKE_ONLY_GPE", | 215 | "AE_NO_HANDLER", |
216 | "AE_OWNER_ID_LIMIT" | 216 | "AE_OWNER_ID_LIMIT" |
217 | }; | 217 | }; |
218 | 218 | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 0e4ab1fe5966..1371cc997393 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -69,6 +69,7 @@ extern acpi_name acpi_gbl_trace_method_name; | |||
69 | extern u32 acpi_gbl_trace_flags; | 69 | extern u32 acpi_gbl_trace_flags; |
70 | extern u8 acpi_gbl_enable_aml_debug_object; | 70 | extern u8 acpi_gbl_enable_aml_debug_object; |
71 | extern u8 acpi_gbl_copy_dsdt_locally; | 71 | extern u8 acpi_gbl_copy_dsdt_locally; |
72 | extern u8 acpi_gbl_truncate_io_addresses; | ||
72 | 73 | ||
73 | extern u32 acpi_current_gpe_count; | 74 | extern u32 acpi_current_gpe_count; |
74 | extern struct acpi_table_fadt acpi_gbl_FADT; | 75 | extern struct acpi_table_fadt acpi_gbl_FADT; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index bade172cad47..d55f4a7b824d 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -663,10 +663,11 @@ typedef u32 acpi_event_status; | |||
663 | #define ACPI_GPE_MAX 0xFF | 663 | #define ACPI_GPE_MAX 0xFF |
664 | #define ACPI_NUM_GPE 256 | 664 | #define ACPI_NUM_GPE 256 |
665 | 665 | ||
666 | /* Actions for acpi_set_gpe */ | 666 | /* Actions for acpi_set_gpe and acpi_hw_low_set_gpe */ |
667 | 667 | ||
668 | #define ACPI_GPE_ENABLE 0 | 668 | #define ACPI_GPE_ENABLE 0 |
669 | #define ACPI_GPE_DISABLE 1 | 669 | #define ACPI_GPE_DISABLE 1 |
670 | #define ACPI_GPE_COND_ENABLE 2 | ||
670 | 671 | ||
671 | /* gpe_types for acpi_enable_gpe and acpi_disable_gpe */ | 672 | /* gpe_types for acpi_enable_gpe and acpi_disable_gpe */ |
672 | 673 | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 5e781d824e6d..bc7d6bb4cd8e 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -256,22 +256,22 @@ static inline int hibernate(void) { return -ENOSYS; } | |||
256 | static inline bool system_entering_hibernation(void) { return false; } | 256 | static inline bool system_entering_hibernation(void) { return false; } |
257 | #endif /* CONFIG_HIBERNATION */ | 257 | #endif /* CONFIG_HIBERNATION */ |
258 | 258 | ||
259 | #ifdef CONFIG_HIBERNATION_NVS | 259 | #ifdef CONFIG_SUSPEND_NVS |
260 | extern int hibernate_nvs_register(unsigned long start, unsigned long size); | 260 | extern int suspend_nvs_register(unsigned long start, unsigned long size); |
261 | extern int hibernate_nvs_alloc(void); | 261 | extern int suspend_nvs_alloc(void); |
262 | extern void hibernate_nvs_free(void); | 262 | extern void suspend_nvs_free(void); |
263 | extern void hibernate_nvs_save(void); | 263 | extern void suspend_nvs_save(void); |
264 | extern void hibernate_nvs_restore(void); | 264 | extern void suspend_nvs_restore(void); |
265 | #else /* CONFIG_HIBERNATION_NVS */ | 265 | #else /* CONFIG_SUSPEND_NVS */ |
266 | static inline int hibernate_nvs_register(unsigned long a, unsigned long b) | 266 | static inline int suspend_nvs_register(unsigned long a, unsigned long b) |
267 | { | 267 | { |
268 | return 0; | 268 | return 0; |
269 | } | 269 | } |
270 | static inline int hibernate_nvs_alloc(void) { return 0; } | 270 | static inline int suspend_nvs_alloc(void) { return 0; } |
271 | static inline void hibernate_nvs_free(void) {} | 271 | static inline void suspend_nvs_free(void) {} |
272 | static inline void hibernate_nvs_save(void) {} | 272 | static inline void suspend_nvs_save(void) {} |
273 | static inline void hibernate_nvs_restore(void) {} | 273 | static inline void suspend_nvs_restore(void) {} |
274 | #endif /* CONFIG_HIBERNATION_NVS */ | 274 | #endif /* CONFIG_SUSPEND_NVS */ |
275 | 275 | ||
276 | #ifdef CONFIG_PM_SLEEP | 276 | #ifdef CONFIG_PM_SLEEP |
277 | void save_processor_state(void); | 277 | void save_processor_state(void); |
diff --git a/init/main.c b/init/main.c index 3bdb152f412f..ac2e4a5f59ee 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -125,7 +125,9 @@ static char *ramdisk_execute_command; | |||
125 | 125 | ||
126 | #ifdef CONFIG_SMP | 126 | #ifdef CONFIG_SMP |
127 | /* Setup configured maximum number of CPUs to activate */ | 127 | /* Setup configured maximum number of CPUs to activate */ |
128 | unsigned int __initdata setup_max_cpus = NR_CPUS; | 128 | unsigned int setup_max_cpus = NR_CPUS; |
129 | EXPORT_SYMBOL(setup_max_cpus); | ||
130 | |||
129 | 131 | ||
130 | /* | 132 | /* |
131 | * Setup routine for controlling SMP activation | 133 | * Setup routine for controlling SMP activation |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 5c36ea9d55d2..ca6066a6952e 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -99,9 +99,13 @@ config PM_SLEEP_ADVANCED_DEBUG | |||
99 | depends on PM_ADVANCED_DEBUG | 99 | depends on PM_ADVANCED_DEBUG |
100 | default n | 100 | default n |
101 | 101 | ||
102 | config SUSPEND_NVS | ||
103 | bool | ||
104 | |||
102 | config SUSPEND | 105 | config SUSPEND |
103 | bool "Suspend to RAM and standby" | 106 | bool "Suspend to RAM and standby" |
104 | depends on PM && ARCH_SUSPEND_POSSIBLE | 107 | depends on PM && ARCH_SUSPEND_POSSIBLE |
108 | select SUSPEND_NVS if HAS_IOMEM | ||
105 | default y | 109 | default y |
106 | ---help--- | 110 | ---help--- |
107 | Allow the system to enter sleep states in which main memory is | 111 | Allow the system to enter sleep states in which main memory is |
@@ -130,13 +134,10 @@ config SUSPEND_FREEZER | |||
130 | 134 | ||
131 | Turning OFF this setting is NOT recommended! If in doubt, say Y. | 135 | Turning OFF this setting is NOT recommended! If in doubt, say Y. |
132 | 136 | ||
133 | config HIBERNATION_NVS | ||
134 | bool | ||
135 | |||
136 | config HIBERNATION | 137 | config HIBERNATION |
137 | bool "Hibernation (aka 'suspend to disk')" | 138 | bool "Hibernation (aka 'suspend to disk')" |
138 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE | 139 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE |
139 | select HIBERNATION_NVS if HAS_IOMEM | 140 | select SUSPEND_NVS if HAS_IOMEM |
140 | ---help--- | 141 | ---help--- |
141 | Enable the suspend to disk (STD) functionality, which is usually | 142 | Enable the suspend to disk (STD) functionality, which is usually |
142 | called "hibernation" in user interfaces. STD checkpoints the | 143 | called "hibernation" in user interfaces. STD checkpoints the |
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index 524e058dcf06..f9063c6b185d 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -10,6 +10,6 @@ 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_HIBERNATION_NVS) += hibernate_nvs.o | 13 | obj-$(CONFIG_SUSPEND_NVS) += nvs.o |
14 | 14 | ||
15 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o | 15 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o |
diff --git a/kernel/power/hibernate_nvs.c b/kernel/power/nvs.c index fdcad9ed5a7b..1836db60bbb6 100644 --- a/kernel/power/hibernate_nvs.c +++ b/kernel/power/nvs.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Platforms, like ACPI, may want us to save some memory used by them during | 17 | * Platforms, like ACPI, may want us to save some memory used by them during |
18 | * hibernation and to restore the contents of this memory during the subsequent | 18 | * suspend and to restore the contents of this memory during the subsequent |
19 | * resume. The code below implements a mechanism allowing us to do that. | 19 | * resume. The code below implements a mechanism allowing us to do that. |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -30,7 +30,7 @@ struct nvs_page { | |||
30 | static LIST_HEAD(nvs_list); | 30 | static LIST_HEAD(nvs_list); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * hibernate_nvs_register - register platform NVS memory region to save | 33 | * suspend_nvs_register - register platform NVS memory region to save |
34 | * @start - physical address of the region | 34 | * @start - physical address of the region |
35 | * @size - size of the region | 35 | * @size - size of the region |
36 | * | 36 | * |
@@ -38,7 +38,7 @@ static LIST_HEAD(nvs_list); | |||
38 | * things so that the data from page-aligned addresses in this region will | 38 | * things so that the data from page-aligned addresses in this region will |
39 | * be copied into separate RAM pages. | 39 | * be copied into separate RAM pages. |
40 | */ | 40 | */ |
41 | int hibernate_nvs_register(unsigned long start, unsigned long size) | 41 | int suspend_nvs_register(unsigned long start, unsigned long size) |
42 | { | 42 | { |
43 | struct nvs_page *entry, *next; | 43 | struct nvs_page *entry, *next; |
44 | 44 | ||
@@ -68,9 +68,9 @@ int hibernate_nvs_register(unsigned long start, unsigned long size) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * hibernate_nvs_free - free data pages allocated for saving NVS regions | 71 | * suspend_nvs_free - free data pages allocated for saving NVS regions |
72 | */ | 72 | */ |
73 | void hibernate_nvs_free(void) | 73 | void suspend_nvs_free(void) |
74 | { | 74 | { |
75 | struct nvs_page *entry; | 75 | struct nvs_page *entry; |
76 | 76 | ||
@@ -86,16 +86,16 @@ void hibernate_nvs_free(void) | |||
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * hibernate_nvs_alloc - allocate memory necessary for saving NVS regions | 89 | * suspend_nvs_alloc - allocate memory necessary for saving NVS regions |
90 | */ | 90 | */ |
91 | int hibernate_nvs_alloc(void) | 91 | int suspend_nvs_alloc(void) |
92 | { | 92 | { |
93 | struct nvs_page *entry; | 93 | struct nvs_page *entry; |
94 | 94 | ||
95 | list_for_each_entry(entry, &nvs_list, node) { | 95 | list_for_each_entry(entry, &nvs_list, node) { |
96 | entry->data = (void *)__get_free_page(GFP_KERNEL); | 96 | entry->data = (void *)__get_free_page(GFP_KERNEL); |
97 | if (!entry->data) { | 97 | if (!entry->data) { |
98 | hibernate_nvs_free(); | 98 | suspend_nvs_free(); |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -103,9 +103,9 @@ int hibernate_nvs_alloc(void) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * hibernate_nvs_save - save NVS memory regions | 106 | * suspend_nvs_save - save NVS memory regions |
107 | */ | 107 | */ |
108 | void hibernate_nvs_save(void) | 108 | void suspend_nvs_save(void) |
109 | { | 109 | { |
110 | struct nvs_page *entry; | 110 | struct nvs_page *entry; |
111 | 111 | ||
@@ -119,12 +119,12 @@ void hibernate_nvs_save(void) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * hibernate_nvs_restore - restore NVS memory regions | 122 | * suspend_nvs_restore - restore NVS memory regions |
123 | * | 123 | * |
124 | * This function is going to be called with interrupts disabled, so it | 124 | * This function is going to be called with interrupts disabled, so it |
125 | * cannot iounmap the virtual addresses used to access the NVS region. | 125 | * cannot iounmap the virtual addresses used to access the NVS region. |
126 | */ | 126 | */ |
127 | void hibernate_nvs_restore(void) | 127 | void suspend_nvs_restore(void) |
128 | { | 128 | { |
129 | struct nvs_page *entry; | 129 | struct nvs_page *entry; |
130 | 130 | ||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 56e7dbb8b996..f37cb7dd4402 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -16,6 +16,12 @@ | |||
16 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
17 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
18 | #include <linux/gfp.h> | 18 | #include <linux/gfp.h> |
19 | #include <linux/io.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/mm.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/suspend.h> | ||
19 | 25 | ||
20 | #include "power.h" | 26 | #include "power.h" |
21 | 27 | ||