Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: evxface - External interfaces for ACPI events |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | fbb7a2d | 2014-02-08 09:42:25 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Lv Zheng | 839e928 | 2013-10-29 09:29:51 +0800 | [diff] [blame] | 44 | #define EXPORT_ACPI_INTERFACES |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 47 | #include "accommon.h" |
| 48 | #include "acnamesp.h" |
| 49 | #include "acevents.h" |
| 50 | #include "acinterp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | #define _COMPONENT ACPI_EVENTS |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | ACPI_MODULE_NAME("evxface") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | /******************************************************************************* |
| 57 | * |
| 58 | * FUNCTION: acpi_install_notify_handler |
| 59 | * |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 60 | * PARAMETERS: device - The device for which notifies will be handled |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | * handler_type - The type of handler: |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 62 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) |
| 63 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) |
| 64 | * ACPI_ALL_NOTIFY: Both System and Device |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 65 | * handler - Address of the handler |
| 66 | * context - Value passed to the handler on each GPE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | * |
| 68 | * RETURN: Status |
| 69 | * |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 70 | * DESCRIPTION: Install a handler for notifications on an ACPI Device, |
| 71 | * thermal_zone, or Processor object. |
| 72 | * |
| 73 | * NOTES: The Root namespace object may have only one handler for each |
| 74 | * type of notify (System/Device). Device/Thermal/Processor objects |
| 75 | * may have one device notify handler, and multiple system notify |
| 76 | * handlers. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | * |
| 78 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | acpi_install_notify_handler(acpi_handle device, |
| 81 | u32 handler_type, |
| 82 | acpi_notify_handler handler, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 84 | struct acpi_namespace_node *node = |
| 85 | ACPI_CAST_PTR(struct acpi_namespace_node, device); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 86 | union acpi_operand_object *obj_desc; |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 87 | union acpi_operand_object *handler_obj; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 88 | acpi_status status; |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 89 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 91 | ACPI_FUNCTION_TRACE(acpi_install_notify_handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
| 93 | /* Parameter validation */ |
| 94 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 95 | if ((!device) || (!handler) || (!handler_type) || |
| 96 | (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 97 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | } |
| 99 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 100 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 101 | if (ACPI_FAILURE(status)) { |
| 102 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | /* |
| 106 | * Root Object: |
| 107 | * Registering a notify handler on the root object indicates that the |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 108 | * caller wishes to receive notifications for all objects. Note that |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 109 | * only one global handler can be registered per notify type. |
| 110 | * Ensure that a handler is not already installed. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | */ |
| 112 | if (device == ACPI_ROOT_OBJECT) { |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 113 | for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { |
| 114 | if (handler_type & (i + 1)) { |
| 115 | if (acpi_gbl_global_notify[i].handler) { |
Rafael J. Wysocki | 3f0be67 | 2010-02-17 23:42:59 +0100 | [diff] [blame] | 116 | status = AE_ALREADY_EXISTS; |
| 117 | goto unlock_and_exit; |
| 118 | } |
| 119 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 120 | acpi_gbl_global_notify[i].handler = handler; |
| 121 | acpi_gbl_global_notify[i].context = context; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 125 | goto unlock_and_exit; /* Global notify handler installed, all done */ |
| 126 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 128 | /* |
| 129 | * All Other Objects: |
| 130 | * Caller will only receive notifications specific to the target |
| 131 | * object. Note that only certain object types are allowed to |
| 132 | * receive notifications. |
| 133 | */ |
| 134 | |
| 135 | /* Are Notifies allowed on this object? */ |
| 136 | |
| 137 | if (!acpi_ev_is_notify_object(node)) { |
| 138 | status = AE_TYPE; |
| 139 | goto unlock_and_exit; |
| 140 | } |
| 141 | |
| 142 | /* Check for an existing internal object, might not exist */ |
| 143 | |
| 144 | obj_desc = acpi_ns_get_attached_object(node); |
| 145 | if (!obj_desc) { |
| 146 | |
| 147 | /* Create a new object */ |
| 148 | |
| 149 | obj_desc = acpi_ut_create_internal_object(node->type); |
| 150 | if (!obj_desc) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | status = AE_NO_MEMORY; |
| 152 | goto unlock_and_exit; |
| 153 | } |
| 154 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 155 | /* Attach new object to the Node, remove local reference */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 157 | status = acpi_ns_attach_object(device, obj_desc, node->type); |
| 158 | acpi_ut_remove_reference(obj_desc); |
| 159 | if (ACPI_FAILURE(status)) { |
| 160 | goto unlock_and_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | } |
| 162 | } |
| 163 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 164 | /* Ensure that the handler is not already installed in the lists */ |
| 165 | |
| 166 | for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { |
| 167 | if (handler_type & (i + 1)) { |
| 168 | handler_obj = obj_desc->common_notify.notify_list[i]; |
| 169 | while (handler_obj) { |
| 170 | if (handler_obj->notify.handler == handler) { |
| 171 | status = AE_ALREADY_EXISTS; |
| 172 | goto unlock_and_exit; |
| 173 | } |
| 174 | |
| 175 | handler_obj = handler_obj->notify.next[i]; |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /* Create and populate a new notify handler object */ |
| 181 | |
| 182 | handler_obj = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY); |
| 183 | if (!handler_obj) { |
| 184 | status = AE_NO_MEMORY; |
| 185 | goto unlock_and_exit; |
| 186 | } |
| 187 | |
| 188 | handler_obj->notify.node = node; |
| 189 | handler_obj->notify.handler_type = handler_type; |
| 190 | handler_obj->notify.handler = handler; |
| 191 | handler_obj->notify.context = context; |
| 192 | |
| 193 | /* Install the handler at the list head(s) */ |
| 194 | |
| 195 | for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { |
| 196 | if (handler_type & (i + 1)) { |
| 197 | handler_obj->notify.next[i] = |
| 198 | obj_desc->common_notify.notify_list[i]; |
| 199 | |
| 200 | obj_desc->common_notify.notify_list[i] = handler_obj; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /* Add an extra reference if handler was installed in both lists */ |
| 205 | |
| 206 | if (handler_type == ACPI_ALL_NOTIFY) { |
| 207 | acpi_ut_add_reference(handler_obj); |
| 208 | } |
| 209 | |
| 210 | unlock_and_exit: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 211 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 212 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 215 | ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | |
| 217 | /******************************************************************************* |
| 218 | * |
| 219 | * FUNCTION: acpi_remove_notify_handler |
| 220 | * |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 221 | * PARAMETERS: device - The device for which the handler is installed |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | * handler_type - The type of handler: |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 223 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) |
| 224 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) |
| 225 | * ACPI_ALL_NOTIFY: Both System and Device |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 226 | * handler - Address of the handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | * |
| 228 | * RETURN: Status |
| 229 | * |
| 230 | * DESCRIPTION: Remove a handler for notifies on an ACPI device |
| 231 | * |
| 232 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 234 | acpi_remove_notify_handler(acpi_handle device, |
| 235 | u32 handler_type, acpi_notify_handler handler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | { |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 237 | struct acpi_namespace_node *node = |
| 238 | ACPI_CAST_PTR(struct acpi_namespace_node, device); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 239 | union acpi_operand_object *obj_desc; |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 240 | union acpi_operand_object *handler_obj; |
| 241 | union acpi_operand_object *previous_handler_obj; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 242 | acpi_status status; |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 243 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 245 | ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | /* Parameter validation */ |
| 248 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 249 | if ((!device) || (!handler) || (!handler_type) || |
| 250 | (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { |
| 251 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 253 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 254 | /* Make sure all deferred notify tasks are completed */ |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 255 | |
Lin Ming | bd6f10a | 2012-05-22 16:43:49 +0800 | [diff] [blame] | 256 | acpi_os_wait_events_complete(); |
Rafael J. Wysocki | 3f0be67 | 2010-02-17 23:42:59 +0100 | [diff] [blame] | 257 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 258 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 259 | if (ACPI_FAILURE(status)) { |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 260 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 263 | /* Root Object. Global handlers are removed here */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 265 | if (device == ACPI_ROOT_OBJECT) { |
| 266 | for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { |
| 267 | if (handler_type & (i + 1)) { |
| 268 | if (!acpi_gbl_global_notify[i].handler || |
| 269 | (acpi_gbl_global_notify[i].handler != |
| 270 | handler)) { |
| 271 | status = AE_NOT_EXIST; |
| 272 | goto unlock_and_exit; |
| 273 | } |
| 274 | |
| 275 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 276 | "Removing global notify handler\n")); |
| 277 | |
| 278 | acpi_gbl_global_notify[i].handler = NULL; |
| 279 | acpi_gbl_global_notify[i].context = NULL; |
| 280 | } |
| 281 | } |
| 282 | |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 283 | goto unlock_and_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 286 | /* All other objects: Are Notifies allowed on this object? */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 288 | if (!acpi_ev_is_notify_object(node)) { |
| 289 | status = AE_TYPE; |
| 290 | goto unlock_and_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 293 | /* Must have an existing internal object */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 295 | obj_desc = acpi_ns_get_attached_object(node); |
| 296 | if (!obj_desc) { |
| 297 | status = AE_NOT_EXIST; |
| 298 | goto unlock_and_exit; |
| 299 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 301 | /* Internal object exists. Find the handler and remove it */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 303 | for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { |
| 304 | if (handler_type & (i + 1)) { |
| 305 | handler_obj = obj_desc->common_notify.notify_list[i]; |
| 306 | previous_handler_obj = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 308 | /* Attempt to find the handler in the handler list */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 310 | while (handler_obj && |
| 311 | (handler_obj->notify.handler != handler)) { |
| 312 | previous_handler_obj = handler_obj; |
| 313 | handler_obj = handler_obj->notify.next[i]; |
| 314 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 316 | if (!handler_obj) { |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 317 | status = AE_NOT_EXIST; |
| 318 | goto unlock_and_exit; |
| 319 | } |
| 320 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 321 | /* Remove the handler object from the list */ |
| 322 | |
| 323 | if (previous_handler_obj) { /* Handler is not at the list head */ |
| 324 | previous_handler_obj->notify.next[i] = |
| 325 | handler_obj->notify.next[i]; |
| 326 | } else { /* Handler is at the list head */ |
| 327 | |
| 328 | obj_desc->common_notify.notify_list[i] = |
| 329 | handler_obj->notify.next[i]; |
Rafael J. Wysocki | 3f0be67 | 2010-02-17 23:42:59 +0100 | [diff] [blame] | 330 | } |
| 331 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 332 | acpi_ut_remove_reference(handler_obj); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 336 | unlock_and_exit: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 337 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 338 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 341 | ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | |
| 343 | /******************************************************************************* |
| 344 | * |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 345 | * FUNCTION: acpi_install_exception_handler |
| 346 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 347 | * PARAMETERS: handler - Pointer to the handler function for the |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 348 | * event |
| 349 | * |
| 350 | * RETURN: Status |
| 351 | * |
| 352 | * DESCRIPTION: Saves the pointer to the handler function |
| 353 | * |
| 354 | ******************************************************************************/ |
| 355 | #ifdef ACPI_FUTURE_USAGE |
| 356 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler) |
| 357 | { |
| 358 | acpi_status status; |
| 359 | |
| 360 | ACPI_FUNCTION_TRACE(acpi_install_exception_handler); |
| 361 | |
| 362 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 363 | if (ACPI_FAILURE(status)) { |
| 364 | return_ACPI_STATUS(status); |
| 365 | } |
| 366 | |
| 367 | /* Don't allow two handlers. */ |
| 368 | |
| 369 | if (acpi_gbl_exception_handler) { |
| 370 | status = AE_ALREADY_EXISTS; |
| 371 | goto cleanup; |
| 372 | } |
| 373 | |
| 374 | /* Install the handler */ |
| 375 | |
| 376 | acpi_gbl_exception_handler = handler; |
| 377 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 378 | cleanup: |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 379 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 380 | return_ACPI_STATUS(status); |
| 381 | } |
| 382 | |
| 383 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) |
| 384 | #endif /* ACPI_FUTURE_USAGE */ |
| 385 | |
| 386 | #if (!ACPI_REDUCED_HARDWARE) |
| 387 | /******************************************************************************* |
| 388 | * |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 389 | * FUNCTION: acpi_install_sci_handler |
| 390 | * |
| 391 | * PARAMETERS: address - Address of the handler |
| 392 | * context - Value passed to the handler on each SCI |
| 393 | * |
| 394 | * RETURN: Status |
| 395 | * |
| 396 | * DESCRIPTION: Install a handler for a System Control Interrupt. |
| 397 | * |
| 398 | ******************************************************************************/ |
| 399 | acpi_status acpi_install_sci_handler(acpi_sci_handler address, void *context) |
| 400 | { |
| 401 | struct acpi_sci_handler_info *new_sci_handler; |
| 402 | struct acpi_sci_handler_info *sci_handler; |
| 403 | acpi_cpu_flags flags; |
| 404 | acpi_status status; |
| 405 | |
| 406 | ACPI_FUNCTION_TRACE(acpi_install_sci_handler); |
| 407 | |
| 408 | if (!address) { |
| 409 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 410 | } |
| 411 | |
| 412 | /* Allocate and init a handler object */ |
| 413 | |
| 414 | new_sci_handler = ACPI_ALLOCATE(sizeof(struct acpi_sci_handler_info)); |
| 415 | if (!new_sci_handler) { |
| 416 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 417 | } |
| 418 | |
| 419 | new_sci_handler->address = address; |
| 420 | new_sci_handler->context = context; |
| 421 | |
| 422 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 423 | if (ACPI_FAILURE(status)) { |
| 424 | goto exit; |
| 425 | } |
| 426 | |
| 427 | /* Lock list during installation */ |
| 428 | |
| 429 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 430 | sci_handler = acpi_gbl_sci_handler_list; |
| 431 | |
| 432 | /* Ensure handler does not already exist */ |
| 433 | |
| 434 | while (sci_handler) { |
| 435 | if (address == sci_handler->address) { |
| 436 | status = AE_ALREADY_EXISTS; |
| 437 | goto unlock_and_exit; |
| 438 | } |
| 439 | |
| 440 | sci_handler = sci_handler->next; |
| 441 | } |
| 442 | |
| 443 | /* Install the new handler into the global list (at head) */ |
| 444 | |
| 445 | new_sci_handler->next = acpi_gbl_sci_handler_list; |
| 446 | acpi_gbl_sci_handler_list = new_sci_handler; |
| 447 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 448 | unlock_and_exit: |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 449 | |
| 450 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 451 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 452 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 453 | exit: |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 454 | if (ACPI_FAILURE(status)) { |
| 455 | ACPI_FREE(new_sci_handler); |
| 456 | } |
| 457 | return_ACPI_STATUS(status); |
| 458 | } |
| 459 | |
Bob Moore | 1d44efa | 2014-04-04 12:36:47 +0800 | [diff] [blame^] | 460 | ACPI_EXPORT_SYMBOL(acpi_install_sci_handler) |
| 461 | |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 462 | /******************************************************************************* |
| 463 | * |
| 464 | * FUNCTION: acpi_remove_sci_handler |
| 465 | * |
| 466 | * PARAMETERS: address - Address of the handler |
| 467 | * |
| 468 | * RETURN: Status |
| 469 | * |
| 470 | * DESCRIPTION: Remove a handler for a System Control Interrupt. |
| 471 | * |
| 472 | ******************************************************************************/ |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 473 | acpi_status acpi_remove_sci_handler(acpi_sci_handler address) |
| 474 | { |
| 475 | struct acpi_sci_handler_info *prev_sci_handler; |
| 476 | struct acpi_sci_handler_info *next_sci_handler; |
| 477 | acpi_cpu_flags flags; |
| 478 | acpi_status status; |
| 479 | |
| 480 | ACPI_FUNCTION_TRACE(acpi_remove_sci_handler); |
| 481 | |
| 482 | if (!address) { |
| 483 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 484 | } |
| 485 | |
| 486 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 487 | if (ACPI_FAILURE(status)) { |
| 488 | return_ACPI_STATUS(status); |
| 489 | } |
| 490 | |
| 491 | /* Remove the SCI handler with lock */ |
| 492 | |
| 493 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 494 | |
| 495 | prev_sci_handler = NULL; |
| 496 | next_sci_handler = acpi_gbl_sci_handler_list; |
| 497 | while (next_sci_handler) { |
| 498 | if (next_sci_handler->address == address) { |
| 499 | |
| 500 | /* Unlink and free the SCI handler info block */ |
| 501 | |
| 502 | if (prev_sci_handler) { |
| 503 | prev_sci_handler->next = next_sci_handler->next; |
| 504 | } else { |
| 505 | acpi_gbl_sci_handler_list = |
| 506 | next_sci_handler->next; |
| 507 | } |
| 508 | |
| 509 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 510 | ACPI_FREE(next_sci_handler); |
| 511 | goto unlock_and_exit; |
| 512 | } |
| 513 | |
| 514 | prev_sci_handler = next_sci_handler; |
| 515 | next_sci_handler = next_sci_handler->next; |
| 516 | } |
| 517 | |
| 518 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 519 | status = AE_NOT_EXIST; |
| 520 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 521 | unlock_and_exit: |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 522 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 523 | return_ACPI_STATUS(status); |
| 524 | } |
| 525 | |
Bob Moore | 1d44efa | 2014-04-04 12:36:47 +0800 | [diff] [blame^] | 526 | ACPI_EXPORT_SYMBOL(acpi_remove_sci_handler) |
| 527 | |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 528 | /******************************************************************************* |
| 529 | * |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 530 | * FUNCTION: acpi_install_global_event_handler |
| 531 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 532 | * PARAMETERS: handler - Pointer to the global event handler function |
| 533 | * context - Value passed to the handler on each event |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 534 | * |
| 535 | * RETURN: Status |
| 536 | * |
| 537 | * DESCRIPTION: Saves the pointer to the handler function. The global handler |
| 538 | * is invoked upon each incoming GPE and Fixed Event. It is |
| 539 | * invoked at interrupt level at the time of the event dispatch. |
| 540 | * Can be used to update event counters, etc. |
| 541 | * |
| 542 | ******************************************************************************/ |
| 543 | acpi_status |
Lv Zheng | 644ef74 | 2012-10-31 02:25:36 +0000 | [diff] [blame] | 544 | acpi_install_global_event_handler(acpi_gbl_event_handler handler, void *context) |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 545 | { |
| 546 | acpi_status status; |
| 547 | |
| 548 | ACPI_FUNCTION_TRACE(acpi_install_global_event_handler); |
| 549 | |
| 550 | /* Parameter validation */ |
| 551 | |
| 552 | if (!handler) { |
| 553 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 554 | } |
| 555 | |
| 556 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 557 | if (ACPI_FAILURE(status)) { |
| 558 | return_ACPI_STATUS(status); |
| 559 | } |
| 560 | |
| 561 | /* Don't allow two handlers. */ |
| 562 | |
| 563 | if (acpi_gbl_global_event_handler) { |
| 564 | status = AE_ALREADY_EXISTS; |
| 565 | goto cleanup; |
| 566 | } |
| 567 | |
| 568 | acpi_gbl_global_event_handler = handler; |
| 569 | acpi_gbl_global_event_handler_context = context; |
| 570 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 571 | cleanup: |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 572 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 573 | return_ACPI_STATUS(status); |
| 574 | } |
| 575 | |
| 576 | ACPI_EXPORT_SYMBOL(acpi_install_global_event_handler) |
| 577 | |
| 578 | /******************************************************************************* |
| 579 | * |
| 580 | * FUNCTION: acpi_install_fixed_event_handler |
| 581 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 582 | * PARAMETERS: event - Event type to enable. |
| 583 | * handler - Pointer to the handler function for the |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 584 | * event |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 585 | * context - Value passed to the handler on each GPE |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 586 | * |
| 587 | * RETURN: Status |
| 588 | * |
| 589 | * DESCRIPTION: Saves the pointer to the handler function and then enables the |
| 590 | * event. |
| 591 | * |
| 592 | ******************************************************************************/ |
| 593 | acpi_status |
| 594 | acpi_install_fixed_event_handler(u32 event, |
| 595 | acpi_event_handler handler, void *context) |
| 596 | { |
| 597 | acpi_status status; |
| 598 | |
| 599 | ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler); |
| 600 | |
| 601 | /* Parameter validation */ |
| 602 | |
| 603 | if (event > ACPI_EVENT_MAX) { |
| 604 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 605 | } |
| 606 | |
| 607 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 608 | if (ACPI_FAILURE(status)) { |
| 609 | return_ACPI_STATUS(status); |
| 610 | } |
| 611 | |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 612 | /* Do not allow multiple handlers */ |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 613 | |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 614 | if (acpi_gbl_fixed_event_handlers[event].handler) { |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 615 | status = AE_ALREADY_EXISTS; |
| 616 | goto cleanup; |
| 617 | } |
| 618 | |
| 619 | /* Install the handler before enabling the event */ |
| 620 | |
| 621 | acpi_gbl_fixed_event_handlers[event].handler = handler; |
| 622 | acpi_gbl_fixed_event_handlers[event].context = context; |
| 623 | |
| 624 | status = acpi_clear_event(event); |
| 625 | if (ACPI_SUCCESS(status)) |
| 626 | status = acpi_enable_event(event, 0); |
| 627 | if (ACPI_FAILURE(status)) { |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 628 | ACPI_WARNING((AE_INFO, |
| 629 | "Could not enable fixed event - %s (%u)", |
| 630 | acpi_ut_get_event_name(event), event)); |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 631 | |
| 632 | /* Remove the handler */ |
| 633 | |
| 634 | acpi_gbl_fixed_event_handlers[event].handler = NULL; |
| 635 | acpi_gbl_fixed_event_handlers[event].context = NULL; |
| 636 | } else { |
| 637 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 638 | "Enabled fixed event %s (%X), Handler=%p\n", |
| 639 | acpi_ut_get_event_name(event), event, |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 640 | handler)); |
| 641 | } |
| 642 | |
Lv Zheng | 10622bf | 2013-10-29 09:30:02 +0800 | [diff] [blame] | 643 | cleanup: |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 644 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 645 | return_ACPI_STATUS(status); |
| 646 | } |
| 647 | |
| 648 | ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) |
| 649 | |
| 650 | /******************************************************************************* |
| 651 | * |
| 652 | * FUNCTION: acpi_remove_fixed_event_handler |
| 653 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 654 | * PARAMETERS: event - Event type to disable. |
| 655 | * handler - Address of the handler |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 656 | * |
| 657 | * RETURN: Status |
| 658 | * |
| 659 | * DESCRIPTION: Disables the event and unregisters the event handler. |
| 660 | * |
| 661 | ******************************************************************************/ |
| 662 | acpi_status |
| 663 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) |
| 664 | { |
| 665 | acpi_status status = AE_OK; |
| 666 | |
| 667 | ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler); |
| 668 | |
| 669 | /* Parameter validation */ |
| 670 | |
| 671 | if (event > ACPI_EVENT_MAX) { |
| 672 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 673 | } |
| 674 | |
| 675 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 676 | if (ACPI_FAILURE(status)) { |
| 677 | return_ACPI_STATUS(status); |
| 678 | } |
| 679 | |
| 680 | /* Disable the event before removing the handler */ |
| 681 | |
| 682 | status = acpi_disable_event(event, 0); |
| 683 | |
| 684 | /* Always Remove the handler */ |
| 685 | |
| 686 | acpi_gbl_fixed_event_handlers[event].handler = NULL; |
| 687 | acpi_gbl_fixed_event_handlers[event].context = NULL; |
| 688 | |
| 689 | if (ACPI_FAILURE(status)) { |
| 690 | ACPI_WARNING((AE_INFO, |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 691 | "Could not disable fixed event - %s (%u)", |
| 692 | acpi_ut_get_event_name(event), event)); |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 693 | } else { |
Bob Moore | d4d3219 | 2013-03-08 09:21:41 +0000 | [diff] [blame] | 694 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 695 | "Disabled fixed event - %s (%X)\n", |
| 696 | acpi_ut_get_event_name(event), event)); |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 700 | return_ACPI_STATUS(status); |
| 701 | } |
| 702 | |
| 703 | ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) |
| 704 | |
| 705 | /******************************************************************************* |
| 706 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | * FUNCTION: acpi_install_gpe_handler |
| 708 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 709 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
| 710 | * defined GPEs) |
| 711 | * gpe_number - The GPE number within the GPE block |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 712 | * type - Whether this GPE should be treated as an |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | * edge- or level-triggered interrupt. |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 714 | * address - Address of the handler |
| 715 | * context - Value passed to the handler on each GPE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 716 | * |
| 717 | * RETURN: Status |
| 718 | * |
| 719 | * DESCRIPTION: Install a handler for a General Purpose Event. |
| 720 | * |
| 721 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 723 | acpi_install_gpe_handler(acpi_handle gpe_device, |
| 724 | u32 gpe_number, |
Lin Ming | 8b6cd8a | 2010-12-13 13:38:46 +0800 | [diff] [blame] | 725 | u32 type, acpi_gpe_handler address, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 727 | struct acpi_gpe_event_info *gpe_event_info; |
Lin Ming | 8b6cd8a | 2010-12-13 13:38:46 +0800 | [diff] [blame] | 728 | struct acpi_gpe_handler_info *handler; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 729 | acpi_status status; |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 730 | acpi_cpu_flags flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 732 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 733 | |
| 734 | /* Parameter validation */ |
| 735 | |
Lin Ming | 0f849d2 | 2010-04-06 14:52:37 +0800 | [diff] [blame] | 736 | if ((!address) || (type & ~ACPI_GPE_XRUPT_TYPE_MASK)) { |
| 737 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 738 | } |
| 739 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 740 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 741 | if (ACPI_FAILURE(status)) { |
Lin Ming | 0f849d2 | 2010-04-06 14:52:37 +0800 | [diff] [blame] | 742 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 743 | } |
| 744 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 745 | /* Allocate and init handler object (before lock) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | |
Lin Ming | 8b6cd8a | 2010-12-13 13:38:46 +0800 | [diff] [blame] | 747 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_handler_info)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | if (!handler) { |
| 749 | status = AE_NO_MEMORY; |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 750 | goto unlock_and_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 751 | } |
| 752 | |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 753 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 754 | |
| 755 | /* Ensure that we have a valid GPE number */ |
| 756 | |
| 757 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
| 758 | if (!gpe_event_info) { |
| 759 | status = AE_BAD_PARAMETER; |
| 760 | goto free_and_exit; |
| 761 | } |
| 762 | |
| 763 | /* Make sure that there isn't a handler there already */ |
| 764 | |
| 765 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
| 766 | ACPI_GPE_DISPATCH_HANDLER) { |
| 767 | status = AE_ALREADY_EXISTS; |
| 768 | goto free_and_exit; |
| 769 | } |
| 770 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 771 | handler->address = address; |
| 772 | handler->context = context; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | handler->method_node = gpe_event_info->dispatch.method_node; |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 774 | handler->original_flags = (u8)(gpe_event_info->flags & |
| 775 | (ACPI_GPE_XRUPT_TYPE_MASK | |
| 776 | ACPI_GPE_DISPATCH_MASK)); |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 777 | |
| 778 | /* |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 779 | * If the GPE is associated with a method, it may have been enabled |
Rafael J. Wysocki | a210080 | 2010-09-16 00:30:43 +0200 | [diff] [blame] | 780 | * automatically during initialization, in which case it has to be |
| 781 | * disabled now to avoid spurious execution of the handler. |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 782 | */ |
| 783 | |
Lin Ming | 3a37898 | 2010-12-13 13:36:15 +0800 | [diff] [blame] | 784 | if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) |
Rafael J. Wysocki | a210080 | 2010-09-16 00:30:43 +0200 | [diff] [blame] | 785 | && gpe_event_info->runtime_count) { |
Lin Ming | 3a37898 | 2010-12-13 13:36:15 +0800 | [diff] [blame] | 786 | handler->originally_enabled = 1; |
| 787 | (void)acpi_ev_remove_gpe_reference(gpe_event_info); |
Rafael J. Wysocki | a210080 | 2010-09-16 00:30:43 +0200 | [diff] [blame] | 788 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 789 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 790 | /* Install the handler */ |
| 791 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | gpe_event_info->dispatch.handler = handler; |
| 793 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 794 | /* Setup up dispatch flags to indicate handler (vs. method/notify) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 795 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 796 | gpe_event_info->flags &= |
| 797 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 798 | gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER); |
| 799 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 800 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 801 | |
Lin Ming | 0f849d2 | 2010-04-06 14:52:37 +0800 | [diff] [blame] | 802 | unlock_and_exit: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 803 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 804 | return_ACPI_STATUS(status); |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 805 | |
| 806 | free_and_exit: |
| 807 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 808 | ACPI_FREE(handler); |
| 809 | goto unlock_and_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 810 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 812 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 813 | |
| 814 | /******************************************************************************* |
| 815 | * |
| 816 | * FUNCTION: acpi_remove_gpe_handler |
| 817 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 818 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
| 819 | * defined GPEs) |
| 820 | * gpe_number - The event to remove a handler |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 821 | * address - Address of the handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 822 | * |
| 823 | * RETURN: Status |
| 824 | * |
| 825 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. |
| 826 | * |
| 827 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 828 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 829 | acpi_remove_gpe_handler(acpi_handle gpe_device, |
Lin Ming | 8b6cd8a | 2010-12-13 13:38:46 +0800 | [diff] [blame] | 830 | u32 gpe_number, acpi_gpe_handler address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 831 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 832 | struct acpi_gpe_event_info *gpe_event_info; |
Lin Ming | 8b6cd8a | 2010-12-13 13:38:46 +0800 | [diff] [blame] | 833 | struct acpi_gpe_handler_info *handler; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 834 | acpi_status status; |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 835 | acpi_cpu_flags flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 836 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 837 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 838 | |
| 839 | /* Parameter validation */ |
| 840 | |
| 841 | if (!address) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 842 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | } |
| 844 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 845 | /* Make sure all deferred GPE tasks are completed */ |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 846 | |
Lin Ming | bd6f10a | 2012-05-22 16:43:49 +0800 | [diff] [blame] | 847 | acpi_os_wait_events_complete(); |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 848 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 849 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 850 | if (ACPI_FAILURE(status)) { |
| 851 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 852 | } |
| 853 | |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 854 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 855 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 856 | /* Ensure that we have a valid GPE number */ |
| 857 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 858 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 859 | if (!gpe_event_info) { |
| 860 | status = AE_BAD_PARAMETER; |
| 861 | goto unlock_and_exit; |
| 862 | } |
| 863 | |
| 864 | /* Make sure that a handler is indeed installed */ |
| 865 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 866 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != |
| 867 | ACPI_GPE_DISPATCH_HANDLER) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 868 | status = AE_NOT_EXIST; |
| 869 | goto unlock_and_exit; |
| 870 | } |
| 871 | |
| 872 | /* Make sure that the installed handler is the same */ |
| 873 | |
| 874 | if (gpe_event_info->dispatch.handler->address != address) { |
| 875 | status = AE_BAD_PARAMETER; |
| 876 | goto unlock_and_exit; |
| 877 | } |
| 878 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 879 | /* Remove the handler */ |
| 880 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | handler = gpe_event_info->dispatch.handler; |
| 882 | |
| 883 | /* Restore Method node (if any), set dispatch flags */ |
| 884 | |
| 885 | gpe_event_info->dispatch.method_node = handler->method_node; |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 886 | gpe_event_info->flags &= |
| 887 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
Lin Ming | 3a37898 | 2010-12-13 13:36:15 +0800 | [diff] [blame] | 888 | gpe_event_info->flags |= handler->original_flags; |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 889 | |
| 890 | /* |
Rafael J. Wysocki | a210080 | 2010-09-16 00:30:43 +0200 | [diff] [blame] | 891 | * If the GPE was previously associated with a method and it was |
| 892 | * enabled, it should be enabled at this point to restore the |
| 893 | * post-initialization configuration. |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 894 | */ |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 895 | if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) && |
| 896 | handler->originally_enabled) { |
Lin Ming | 3a37898 | 2010-12-13 13:36:15 +0800 | [diff] [blame] | 897 | (void)acpi_ev_add_gpe_reference(gpe_event_info); |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 898 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 899 | |
| 900 | /* Now we can free the handler object */ |
| 901 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 902 | ACPI_FREE(handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 903 | |
Rafael J. Wysocki | 28f4f8a | 2010-08-03 23:55:14 +0200 | [diff] [blame] | 904 | unlock_and_exit: |
| 905 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 906 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 907 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 908 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 911 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 912 | |
| 913 | /******************************************************************************* |
| 914 | * |
| 915 | * FUNCTION: acpi_acquire_global_lock |
| 916 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 917 | * PARAMETERS: timeout - How long the caller is willing to wait |
| 918 | * handle - Where the handle to the lock is returned |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 919 | * (if acquired) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | * |
| 921 | * RETURN: Status |
| 922 | * |
| 923 | * DESCRIPTION: Acquire the ACPI Global Lock |
| 924 | * |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 925 | * Note: Allows callers with the same thread ID to acquire the global lock |
| 926 | * multiple times. In other words, externally, the behavior of the global lock |
| 927 | * is identical to an AML mutex. On the first acquire, a new handle is |
| 928 | * returned. On any subsequent calls to acquire by the same thread, the same |
| 929 | * handle is returned. |
| 930 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 931 | ******************************************************************************/ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 932 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 933 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 934 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 935 | |
| 936 | if (!handle) { |
| 937 | return (AE_BAD_PARAMETER); |
| 938 | } |
| 939 | |
Len Brown | 4d2acd9 | 2007-05-09 22:56:38 -0400 | [diff] [blame] | 940 | /* Must lock interpreter to prevent race conditions */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 941 | |
Len Brown | 4d2acd9 | 2007-05-09 22:56:38 -0400 | [diff] [blame] | 942 | acpi_ex_enter_interpreter(); |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 943 | |
| 944 | status = acpi_ex_acquire_mutex_object(timeout, |
| 945 | acpi_gbl_global_lock_mutex, |
| 946 | acpi_os_get_thread_id()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 947 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 948 | if (ACPI_SUCCESS(status)) { |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 949 | |
Bob Moore | e5567af | 2008-04-10 19:06:38 +0400 | [diff] [blame] | 950 | /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */ |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 951 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 952 | *handle = acpi_gbl_global_lock_handle; |
| 953 | } |
| 954 | |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 955 | acpi_ex_exit_interpreter(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 956 | return (status); |
| 957 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 958 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 959 | ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 960 | |
| 961 | /******************************************************************************* |
| 962 | * |
| 963 | * FUNCTION: acpi_release_global_lock |
| 964 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 965 | * PARAMETERS: handle - Returned from acpi_acquire_global_lock |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 966 | * |
| 967 | * RETURN: Status |
| 968 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 969 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 970 | * |
| 971 | ******************************************************************************/ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 972 | acpi_status acpi_release_global_lock(u32 handle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 973 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 974 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 975 | |
Bob Moore | f02e9fa | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 976 | if (!handle || (handle != acpi_gbl_global_lock_handle)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 977 | return (AE_NOT_ACQUIRED); |
| 978 | } |
| 979 | |
Bob Moore | ba886cd | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 980 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 981 | return (status); |
| 982 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 983 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 984 | ACPI_EXPORT_SYMBOL(acpi_release_global_lock) |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 985 | #endif /* !ACPI_REDUCED_HARDWARE */ |