Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: hwgpe - Low level GPE enable/disable/clear functions |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
Bob Moore | a8357b0 | 2010-01-22 19:07:36 +0800 | [diff] [blame^] | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * 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 | |
| 45 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 46 | #include "accommon.h" |
| 47 | #include "acevents.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | #define _COMPONENT ACPI_HARDWARE |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("hwgpe") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 52 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 53 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 54 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 55 | struct acpi_gpe_block_info *gpe_block, |
| 56 | void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
| 58 | /****************************************************************************** |
| 59 | * |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 60 | * FUNCTION: acpi_hw_low_disable_gpe |
| 61 | * |
| 62 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled |
| 63 | * |
| 64 | * RETURN: Status |
| 65 | * |
| 66 | * DESCRIPTION: Disable a single GPE in the enable register. |
| 67 | * |
| 68 | ******************************************************************************/ |
| 69 | |
| 70 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) |
| 71 | { |
| 72 | struct acpi_gpe_register_info *gpe_register_info; |
| 73 | acpi_status status; |
| 74 | u32 enable_mask; |
| 75 | |
| 76 | /* Get the info block for the entire GPE register */ |
| 77 | |
| 78 | gpe_register_info = gpe_event_info->register_info; |
| 79 | if (!gpe_register_info) { |
| 80 | return (AE_NOT_EXIST); |
| 81 | } |
| 82 | |
| 83 | /* Get current value of the enable register that contains this GPE */ |
| 84 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 85 | status = acpi_hw_read(&enable_mask, &gpe_register_info->enable_address); |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 86 | if (ACPI_FAILURE(status)) { |
| 87 | return (status); |
| 88 | } |
| 89 | |
| 90 | /* Clear just the bit that corresponds to this GPE */ |
| 91 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 92 | ACPI_CLEAR_BIT(enable_mask, ((u32)1 << |
| 93 | (gpe_event_info->gpe_number - |
| 94 | gpe_register_info->base_gpe_number))); |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 95 | |
| 96 | /* Write the updated enable mask */ |
| 97 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 98 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 99 | return (status); |
| 100 | } |
| 101 | |
| 102 | /****************************************************************************** |
| 103 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | * FUNCTION: acpi_hw_write_gpe_enable_reg |
| 105 | * |
| 106 | * PARAMETERS: gpe_event_info - Info block for the GPE to be enabled |
| 107 | * |
| 108 | * RETURN: Status |
| 109 | * |
| 110 | * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must |
| 111 | * already be cleared or set in the parent register |
| 112 | * enable_for_run mask. |
| 113 | * |
| 114 | ******************************************************************************/ |
| 115 | |
| 116 | acpi_status |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 117 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 119 | struct acpi_gpe_register_info *gpe_register_info; |
| 120 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 122 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
| 124 | /* Get the info block for the entire GPE register */ |
| 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 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 133 | status = acpi_hw_write(gpe_register_info->enable_for_run, |
| 134 | &gpe_register_info->enable_address); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | |
| 136 | return (status); |
| 137 | } |
| 138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | /****************************************************************************** |
| 140 | * |
| 141 | * FUNCTION: acpi_hw_clear_gpe |
| 142 | * |
| 143 | * PARAMETERS: gpe_event_info - Info block for the GPE to be cleared |
| 144 | * |
| 145 | * RETURN: Status |
| 146 | * |
| 147 | * DESCRIPTION: Clear the status bit for a single GPE. |
| 148 | * |
| 149 | ******************************************************************************/ |
| 150 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 151 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 153 | acpi_status status; |
Alexey Starikovskiy | 6987416 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 154 | u8 register_bit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 156 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 158 | register_bit = (u8)(1 << |
| 159 | (gpe_event_info->gpe_number - |
| 160 | gpe_event_info->register_info->base_gpe_number)); |
Alexey Starikovskiy | 6987416 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 161 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | /* |
| 163 | * Write a one to the appropriate bit in the status register to |
| 164 | * clear this GPE. |
| 165 | */ |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 166 | status = acpi_hw_write(register_bit, |
| 167 | &gpe_event_info->register_info->status_address); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
| 169 | return (status); |
| 170 | } |
| 171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | /****************************************************************************** |
| 173 | * |
| 174 | * FUNCTION: acpi_hw_get_gpe_status |
| 175 | * |
| 176 | * PARAMETERS: gpe_event_info - Info block for the GPE to queried |
| 177 | * event_status - Where the GPE status is returned |
| 178 | * |
| 179 | * RETURN: Status |
| 180 | * |
| 181 | * DESCRIPTION: Return the status of a single GPE. |
| 182 | * |
| 183 | ******************************************************************************/ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 184 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 186 | acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, |
| 187 | acpi_event_status * event_status) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 189 | u32 in_byte; |
| 190 | u8 register_bit; |
| 191 | struct acpi_gpe_register_info *gpe_register_info; |
| 192 | acpi_status status; |
| 193 | acpi_event_status local_event_status = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 195 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
| 197 | if (!event_status) { |
| 198 | return (AE_BAD_PARAMETER); |
| 199 | } |
| 200 | |
| 201 | /* Get the info block for the entire GPE register */ |
| 202 | |
| 203 | gpe_register_info = gpe_event_info->register_info; |
| 204 | |
| 205 | /* Get the register bitmask for this GPE */ |
| 206 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 207 | register_bit = (u8)(1 << |
| 208 | (gpe_event_info->gpe_number - |
| 209 | gpe_event_info->register_info->base_gpe_number)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | /* GPE currently enabled? (enabled for runtime?) */ |
| 212 | |
| 213 | if (register_bit & gpe_register_info->enable_for_run) { |
| 214 | local_event_status |= ACPI_EVENT_FLAG_ENABLED; |
| 215 | } |
| 216 | |
| 217 | /* GPE enabled for wake? */ |
| 218 | |
| 219 | if (register_bit & gpe_register_info->enable_for_wake) { |
| 220 | local_event_status |= ACPI_EVENT_FLAG_WAKE_ENABLED; |
| 221 | } |
| 222 | |
| 223 | /* GPE currently active (status bit == 1)? */ |
| 224 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 226 | if (ACPI_FAILURE(status)) { |
Bob Moore | 2147d3f | 2010-01-21 09:08:31 +0800 | [diff] [blame] | 227 | return (status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | if (register_bit & in_byte) { |
| 231 | local_event_status |= ACPI_EVENT_FLAG_SET; |
| 232 | } |
| 233 | |
| 234 | /* Set return value */ |
| 235 | |
| 236 | (*event_status) = local_event_status; |
Bob Moore | 2147d3f | 2010-01-21 09:08:31 +0800 | [diff] [blame] | 237 | return (AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | |
| 240 | /****************************************************************************** |
| 241 | * |
| 242 | * FUNCTION: acpi_hw_disable_gpe_block |
| 243 | * |
| 244 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
| 245 | * gpe_block - Gpe Block info |
| 246 | * |
| 247 | * RETURN: Status |
| 248 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 249 | * DESCRIPTION: Disable all GPEs within a single GPE block |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | * |
| 251 | ******************************************************************************/ |
| 252 | |
| 253 | acpi_status |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 254 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
| 255 | struct acpi_gpe_block_info *gpe_block, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 257 | u32 i; |
| 258 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
| 260 | /* Examine each GPE Register within the block */ |
| 261 | |
| 262 | for (i = 0; i < gpe_block->register_count; i++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 263 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | /* Disable all GPEs in this register */ |
| 265 | |
Bob Moore | ecfbbc7 | 2008-12-31 02:55:32 +0800 | [diff] [blame] | 266 | status = |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 267 | acpi_hw_write(0x00, |
| 268 | &gpe_block->register_info[i].enable_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 269 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | return (status); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | return (AE_OK); |
| 275 | } |
| 276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | /****************************************************************************** |
| 278 | * |
| 279 | * FUNCTION: acpi_hw_clear_gpe_block |
| 280 | * |
| 281 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
| 282 | * gpe_block - Gpe Block info |
| 283 | * |
| 284 | * RETURN: Status |
| 285 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 286 | * DESCRIPTION: Clear status bits for all GPEs within a single GPE block |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | * |
| 288 | ******************************************************************************/ |
| 289 | |
| 290 | acpi_status |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 291 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
| 292 | struct acpi_gpe_block_info *gpe_block, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 294 | u32 i; |
| 295 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | /* Examine each GPE Register within the block */ |
| 298 | |
| 299 | for (i = 0; i < gpe_block->register_count; i++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 300 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | /* Clear status on all GPEs in this register */ |
| 302 | |
Bob Moore | ecfbbc7 | 2008-12-31 02:55:32 +0800 | [diff] [blame] | 303 | status = |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 304 | acpi_hw_write(0xFF, |
| 305 | &gpe_block->register_info[i].status_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 306 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | return (status); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | return (AE_OK); |
| 312 | } |
| 313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | /****************************************************************************** |
| 315 | * |
| 316 | * FUNCTION: acpi_hw_enable_runtime_gpe_block |
| 317 | * |
| 318 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
| 319 | * gpe_block - Gpe Block info |
| 320 | * |
| 321 | * RETURN: Status |
| 322 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 323 | * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes |
| 324 | * combination wake/run GPEs. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | * |
| 326 | ******************************************************************************/ |
| 327 | |
| 328 | acpi_status |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 329 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
| 330 | struct acpi_gpe_block_info *gpe_block, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 332 | u32 i; |
| 333 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | |
| 335 | /* NOTE: assumes that all GPEs are currently disabled */ |
| 336 | |
| 337 | /* Examine each GPE Register within the block */ |
| 338 | |
| 339 | for (i = 0; i < gpe_block->register_count; i++) { |
| 340 | if (!gpe_block->register_info[i].enable_for_run) { |
| 341 | continue; |
| 342 | } |
| 343 | |
| 344 | /* Enable all "runtime" GPEs in this register */ |
| 345 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 346 | status = |
| 347 | acpi_hw_write(gpe_block->register_info[i].enable_for_run, |
| 348 | &gpe_block->register_info[i].enable_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 349 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | return (status); |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | return (AE_OK); |
| 355 | } |
| 356 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | /****************************************************************************** |
| 358 | * |
| 359 | * FUNCTION: acpi_hw_enable_wakeup_gpe_block |
| 360 | * |
| 361 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
| 362 | * gpe_block - Gpe Block info |
| 363 | * |
| 364 | * RETURN: Status |
| 365 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 366 | * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes |
| 367 | * combination wake/run GPEs. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | * |
| 369 | ******************************************************************************/ |
| 370 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 371 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 372 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 373 | struct acpi_gpe_block_info *gpe_block, |
| 374 | void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 376 | u32 i; |
| 377 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | |
| 379 | /* Examine each GPE Register within the block */ |
| 380 | |
| 381 | for (i = 0; i < gpe_block->register_count; i++) { |
| 382 | if (!gpe_block->register_info[i].enable_for_wake) { |
| 383 | continue; |
| 384 | } |
| 385 | |
| 386 | /* Enable all "wake" GPEs in this register */ |
| 387 | |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 388 | status = |
| 389 | acpi_hw_write(gpe_block->register_info[i].enable_for_wake, |
| 390 | &gpe_block->register_info[i].enable_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 391 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | return (status); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | return (AE_OK); |
| 397 | } |
| 398 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | /****************************************************************************** |
| 400 | * |
| 401 | * FUNCTION: acpi_hw_disable_all_gpes |
| 402 | * |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 403 | * PARAMETERS: None |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | * |
| 405 | * RETURN: Status |
| 406 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 407 | * DESCRIPTION: Disable and clear all GPEs in all GPE blocks |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | * |
| 409 | ******************************************************************************/ |
| 410 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 411 | acpi_status acpi_hw_disable_all_gpes(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 413 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 415 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 417 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); |
| 418 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 419 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | } |
| 421 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | /****************************************************************************** |
| 423 | * |
| 424 | * FUNCTION: acpi_hw_enable_all_runtime_gpes |
| 425 | * |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 426 | * PARAMETERS: None |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | * |
| 428 | * RETURN: Status |
| 429 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 430 | * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | * |
| 432 | ******************************************************************************/ |
| 433 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 434 | acpi_status acpi_hw_enable_all_runtime_gpes(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 436 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 438 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 440 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 441 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | /****************************************************************************** |
| 445 | * |
| 446 | * FUNCTION: acpi_hw_enable_all_wakeup_gpes |
| 447 | * |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 448 | * PARAMETERS: None |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | * |
| 450 | * RETURN: Status |
| 451 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 452 | * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | * |
| 454 | ******************************************************************************/ |
| 455 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 456 | acpi_status acpi_hw_enable_all_wakeup_gpes(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 458 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 460 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 462 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 463 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |