blob: b96d41bbc64e38ee254cda4f7132304594ed5462 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
Bob Moore70958572012-02-14 18:47:42 +08003 * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support functions for the
4 * original/legacy sleep/PM registers.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 *****************************************************************************/
7
8/*
Bob Moore77848132012-01-12 13:27:23 +08009 * Copyright (C) 2000 - 2012, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050046#include "accommon.h"
Shane Wang69575d32009-09-01 18:25:07 -070047#include <linux/tboot.h>
Paul Gortmakercc4b8592011-07-01 14:30:49 -040048#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#define _COMPONENT ACPI_HARDWARE
Len Brown4be44fc2005-08-05 00:44:28 -040051ACPI_MODULE_NAME("hwsleep")
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Bob Moore70958572012-02-14 18:47:42 +080053#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
Bob Moore2feec472012-02-14 15:00:53 +080054/*******************************************************************************
55 *
56 * FUNCTION: acpi_hw_legacy_sleep
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 *
58 * PARAMETERS: sleep_state - Which sleep state to enter
59 *
60 * RETURN: Status
61 *
Bob Moore2feec472012-02-14 15:00:53 +080062 * DESCRIPTION: Enter a system sleep state via the legacy FADT PM registers
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
64 *
65 ******************************************************************************/
Bob Moore2feec472012-02-14 15:00:53 +080066acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
Linus Torvalds1da177e2005-04-16 15:20:36 -070067{
Len Brown4be44fc2005-08-05 00:44:28 -040068 struct acpi_bit_register_info *sleep_type_reg_info;
69 struct acpi_bit_register_info *sleep_enable_reg_info;
Bob Moore2feec472012-02-14 15:00:53 +080070 u32 pm1a_control;
71 u32 pm1b_control;
Len Brown4be44fc2005-08-05 00:44:28 -040072 u32 in_value;
73 acpi_status status;
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Bob Moore2feec472012-02-14 15:00:53 +080075 ACPI_FUNCTION_TRACE(hw_legacy_sleep);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Len Brown4be44fc2005-08-05 00:44:28 -040077 sleep_type_reg_info =
Bob Moore82d79b82009-02-18 14:31:05 +080078 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
Len Brown4be44fc2005-08-05 00:44:28 -040079 sleep_enable_reg_info =
80 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82 /* Clear wake status */
83
Bob Moore768aaaf2009-03-06 09:49:25 +080084 status =
85 acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
Len Brown4be44fc2005-08-05 00:44:28 -040086 if (ACPI_FAILURE(status)) {
87 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 }
89
90 /* Clear all fixed and general purpose status bits */
91
Bob Moored8c71b62007-02-02 19:48:21 +030092 status = acpi_hw_clear_acpi_status();
Len Brown4be44fc2005-08-05 00:44:28 -040093 if (ACPI_FAILURE(status)) {
94 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 }
96
Bob Moore2feec472012-02-14 15:00:53 +080097 if (sleep_state != ACPI_STATE_S5) {
98 /*
99 * Disable BM arbitration. This feature is contained within an
100 * optional register (PM2 Control), so ignore a BAD_ADDRESS
101 * exception.
102 */
103 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
104 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
105 return_ACPI_STATUS(status);
106 }
107 }
108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 /*
Pavel Machek23b168d2008-02-05 19:27:12 +0100110 * 1) Disable/Clear all GPEs
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 * 2) Enable all wakeup GPEs
112 */
Alexey Starikovskiy1d999672007-03-12 14:49:26 -0400113 status = acpi_hw_disable_all_gpes();
114 if (ACPI_FAILURE(status)) {
115 return_ACPI_STATUS(status);
116 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 acpi_gbl_system_awake_and_running = FALSE;
118
Len Brown4be44fc2005-08-05 00:44:28 -0400119 status = acpi_hw_enable_all_wakeup_gpes();
120 if (ACPI_FAILURE(status)) {
121 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 }
123
Bob Moore2feec472012-02-14 15:00:53 +0800124 /* Execute the _GTS method (Going To Sleep) */
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100125
Bob Mooref99648b2012-02-14 18:43:03 +0800126 acpi_hw_execute_sleep_method(METHOD_NAME__GTS, sleep_state);
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 /* Get current value of PM1A control */
129
Bob Moore32c9ef92009-02-18 14:36:05 +0800130 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
131 &pm1a_control);
Len Brown4be44fc2005-08-05 00:44:28 -0400132 if (ACPI_FAILURE(status)) {
133 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 }
Len Brown4be44fc2005-08-05 00:44:28 -0400135 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
Bob Mooreb27d6592010-05-26 11:47:13 +0800136 "Entering sleep state [S%u]\n", sleep_state));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Bob Moore32c9ef92009-02-18 14:36:05 +0800138 /* Clear the SLP_EN and SLP_TYP fields */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
Bob Moore32c9ef92009-02-18 14:36:05 +0800140 pm1a_control &= ~(sleep_type_reg_info->access_bit_mask |
141 sleep_enable_reg_info->access_bit_mask);
142 pm1b_control = pm1a_control;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
Bob Moore32c9ef92009-02-18 14:36:05 +0800144 /* Insert the SLP_TYP bits */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
Bob Moore32c9ef92009-02-18 14:36:05 +0800146 pm1a_control |=
Len Brown4be44fc2005-08-05 00:44:28 -0400147 (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
Bob Moore32c9ef92009-02-18 14:36:05 +0800148 pm1b_control |=
Len Brown4be44fc2005-08-05 00:44:28 -0400149 (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
151 /*
152 * We split the writes of SLP_TYP and SLP_EN to workaround
153 * poorly implemented hardware.
154 */
155
Bob Moore32c9ef92009-02-18 14:36:05 +0800156 /* Write #1: write the SLP_TYP data to the PM1 Control registers */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Bob Moore32c9ef92009-02-18 14:36:05 +0800158 status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
Len Brown4be44fc2005-08-05 00:44:28 -0400159 if (ACPI_FAILURE(status)) {
160 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 }
162
Bob Moore32c9ef92009-02-18 14:36:05 +0800163 /* Insert the sleep enable (SLP_EN) bit */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
Bob Moore32c9ef92009-02-18 14:36:05 +0800165 pm1a_control |= sleep_enable_reg_info->access_bit_mask;
166 pm1b_control |= sleep_enable_reg_info->access_bit_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
Bob Moore32c9ef92009-02-18 14:36:05 +0800168 /* Flush caches, as per ACPI specification */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
Len Brown4be44fc2005-08-05 00:44:28 -0400170 ACPI_FLUSH_CPU_CACHE();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
Joseph Cihula86886e52009-06-30 19:31:07 -0700172 tboot_sleep(sleep_state, pm1a_control, pm1b_control);
173
Bob Moore32c9ef92009-02-18 14:36:05 +0800174 /* Write #2: Write both SLP_TYP + SLP_EN */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Bob Moore32c9ef92009-02-18 14:36:05 +0800176 status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
Len Brown4be44fc2005-08-05 00:44:28 -0400177 if (ACPI_FAILURE(status)) {
178 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 }
180
181 if (sleep_state > ACPI_STATE_S3) {
182 /*
Robert Moore44f6c012005-04-18 22:49:35 -0400183 * We wanted to sleep > S3, but it didn't happen (by virtue of the
184 * fact that we are still executing!)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 *
Robert Moore44f6c012005-04-18 22:49:35 -0400186 * Wait ten seconds, then try again. This is to get S4/S5 to work on
187 * all machines.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 *
Bob Moored4913dc2009-03-06 10:05:18 +0800189 * We wait so long to allow chipsets that poll this reg very slowly
190 * to still read the right value. Ideally, this block would go
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 * away entirely.
192 */
Len Brown4be44fc2005-08-05 00:44:28 -0400193 acpi_os_stall(10000000);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Alexey Starikovskiyd30dc9ab2007-09-30 22:39:36 +0400195 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
Len Brown4be44fc2005-08-05 00:44:28 -0400196 sleep_enable_reg_info->
197 access_bit_mask);
198 if (ACPI_FAILURE(status)) {
199 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 }
201 }
202
Bob Moore2feec472012-02-14 15:00:53 +0800203 /* Wait for transition back to Working State */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
205 do {
Bob Moore50ffba12009-02-23 15:02:07 +0800206 status =
207 acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value);
Len Brown4be44fc2005-08-05 00:44:28 -0400208 if (ACPI_FAILURE(status)) {
209 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 }
Bob Moore2feec472012-02-14 15:00:53 +0800211
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 } while (!in_value);
213
Len Brown4be44fc2005-08-05 00:44:28 -0400214 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216
Robert Moore44f6c012005-04-18 22:49:35 -0400217/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 *
Bob Moore2feec472012-02-14 15:00:53 +0800219 * FUNCTION: acpi_hw_legacy_wake_prep
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 *
Bob Moore2feec472012-02-14 15:00:53 +0800221 * PARAMETERS: sleep_state - Which sleep state we just exited
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 *
223 * RETURN: Status
224 *
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100225 * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
226 * sleep.
Bob Moore2feec472012-02-14 15:00:53 +0800227 * Called with interrupts ENABLED.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 *
229 ******************************************************************************/
Bob Moore2feec472012-02-14 15:00:53 +0800230
231acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232{
Len Brown4be44fc2005-08-05 00:44:28 -0400233 acpi_status status;
234 struct acpi_bit_register_info *sleep_type_reg_info;
235 struct acpi_bit_register_info *sleep_enable_reg_info;
Bob Moore32c9ef92009-02-18 14:36:05 +0800236 u32 pm1a_control;
237 u32 pm1b_control;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238
Bob Moore2feec472012-02-14 15:00:53 +0800239 ACPI_FUNCTION_TRACE(hw_legacy_wake_prep);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240
241 /*
242 * Set SLP_TYPE and SLP_EN to state S0.
243 * This is unclear from the ACPI Spec, but it is required
244 * by some machines.
245 */
Len Brown4be44fc2005-08-05 00:44:28 -0400246 status = acpi_get_sleep_type_data(ACPI_STATE_S0,
247 &acpi_gbl_sleep_type_a,
248 &acpi_gbl_sleep_type_b);
249 if (ACPI_SUCCESS(status)) {
250 sleep_type_reg_info =
Bob Moore82d79b82009-02-18 14:31:05 +0800251 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
Len Brown4be44fc2005-08-05 00:44:28 -0400252 sleep_enable_reg_info =
253 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
255 /* Get current value of PM1A control */
256
Alexey Starikovskiyd30dc9ab2007-09-30 22:39:36 +0400257 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
Bob Moore32c9ef92009-02-18 14:36:05 +0800258 &pm1a_control);
Len Brown4be44fc2005-08-05 00:44:28 -0400259 if (ACPI_SUCCESS(status)) {
Bob Moore52fc0b02006-10-02 00:00:00 -0400260
Bob Moore32c9ef92009-02-18 14:36:05 +0800261 /* Clear the SLP_EN and SLP_TYP fields */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
Bob Moore32c9ef92009-02-18 14:36:05 +0800263 pm1a_control &= ~(sleep_type_reg_info->access_bit_mask |
264 sleep_enable_reg_info->
265 access_bit_mask);
266 pm1b_control = pm1a_control;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267
Bob Moore32c9ef92009-02-18 14:36:05 +0800268 /* Insert the SLP_TYP bits */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
Bob Moored4913dc2009-03-06 10:05:18 +0800270 pm1a_control |= (acpi_gbl_sleep_type_a <<
271 sleep_type_reg_info->bit_position);
272 pm1b_control |= (acpi_gbl_sleep_type_b <<
273 sleep_type_reg_info->bit_position);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274
Bob Moore32c9ef92009-02-18 14:36:05 +0800275 /* Write the control registers and ignore any errors */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276
Bob Moore32c9ef92009-02-18 14:36:05 +0800277 (void)acpi_hw_write_pm1_control(pm1a_control,
278 pm1b_control);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 }
280 }
281
Bob Mooref99648b2012-02-14 18:43:03 +0800282 acpi_hw_execute_sleep_method(METHOD_NAME__BFS, sleep_state);
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100283 return_ACPI_STATUS(status);
284}
285
286/*******************************************************************************
287 *
Bob Moore2feec472012-02-14 15:00:53 +0800288 * FUNCTION: acpi_hw_legacy_wake
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100289 *
290 * PARAMETERS: sleep_state - Which sleep state we just exited
291 *
292 * RETURN: Status
293 *
294 * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
295 * Called with interrupts ENABLED.
296 *
297 ******************************************************************************/
Bob Moore2feec472012-02-14 15:00:53 +0800298
299acpi_status acpi_hw_legacy_wake(u8 sleep_state)
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100300{
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100301 acpi_status status;
302
Bob Moore2feec472012-02-14 15:00:53 +0800303 ACPI_FUNCTION_TRACE(hw_legacy_wake);
Rafael J. Wysockic95d47a2008-01-08 00:05:21 +0100304
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */
306
307 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
Bob Mooref99648b2012-02-14 18:43:03 +0800308 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WAKING);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 /*
Thomas Renninger79d2dfa2007-08-24 01:24:47 -0400311 * GPEs must be enabled before _WAK is called as GPEs
312 * might get fired there
313 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 * Restore the GPEs:
315 * 1) Disable/Clear all GPEs
316 * 2) Enable all runtime GPEs
317 */
Len Brown4be44fc2005-08-05 00:44:28 -0400318 status = acpi_hw_disable_all_gpes();
319 if (ACPI_FAILURE(status)) {
320 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 }
Bob Moore2feec472012-02-14 15:00:53 +0800322
Len Brown4be44fc2005-08-05 00:44:28 -0400323 status = acpi_hw_enable_all_runtime_gpes();
324 if (ACPI_FAILURE(status)) {
325 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326 }
327
Bob Moore2feec472012-02-14 15:00:53 +0800328 /*
329 * Now we can execute _WAK, etc. Some machines require that the GPEs
330 * are enabled before the wake methods are executed.
331 */
Bob Mooref99648b2012-02-14 18:43:03 +0800332 acpi_hw_execute_sleep_method(METHOD_NAME__WAK, sleep_state);
Thomas Renninger79d2dfa2007-08-24 01:24:47 -0400333
Matthew Garretta68823e2008-08-06 19:12:04 +0100334 /*
Bob Moore2feec472012-02-14 15:00:53 +0800335 * Some BIOS code assumes that WAK_STS will be cleared on resume
336 * and use it to determine whether the system is rebooting or
337 * resuming. Clear WAK_STS for compatibility.
Matthew Garretta68823e2008-08-06 19:12:04 +0100338 */
Bob Moore50ffba12009-02-23 15:02:07 +0800339 acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1);
Thomas Renninger79d2dfa2007-08-24 01:24:47 -0400340 acpi_gbl_system_awake_and_running = TRUE;
341
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 /* Enable power button */
343
Len Brown4be44fc2005-08-05 00:44:28 -0400344 (void)
Bob Moore50ffba12009-02-23 15:02:07 +0800345 acpi_write_bit_register(acpi_gbl_fixed_event_info
Bob Moore2feec472012-02-14 15:00:53 +0800346 [ACPI_EVENT_POWER_BUTTON].
347 enable_register_id, ACPI_ENABLE_EVENT);
Robert Moore44f6c012005-04-18 22:49:35 -0400348
Len Brown4be44fc2005-08-05 00:44:28 -0400349 (void)
Bob Moore50ffba12009-02-23 15:02:07 +0800350 acpi_write_bit_register(acpi_gbl_fixed_event_info
Bob Moore2feec472012-02-14 15:00:53 +0800351 [ACPI_EVENT_POWER_BUTTON].
352 status_register_id, ACPI_CLEAR_STATUS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353
Bob Moore2feec472012-02-14 15:00:53 +0800354 /*
355 * Enable BM arbitration. This feature is contained within an
356 * optional register (PM2 Control), so ignore a BAD_ADDRESS
357 * exception.
358 */
359 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
360 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
361 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 }
363
Bob Mooref99648b2012-02-14 18:43:03 +0800364 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WORKING);
Len Brown4be44fc2005-08-05 00:44:28 -0400365 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366}
Bob Moore83135242006-10-03 00:00:00 -0400367
Bob Moore33620c52012-02-14 18:14:27 +0800368#endif /* !ACPI_REDUCED_HARDWARE */