Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: exsystem - Interface to OS services |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
David E. Box | 82a8094 | 2015-02-05 15:20:45 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2015, 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
| 46 | #include "acinterp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #define _COMPONENT ACPI_EXECUTER |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 49 | ACPI_MODULE_NAME("exsystem") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
| 51 | /******************************************************************************* |
| 52 | * |
| 53 | * FUNCTION: acpi_ex_system_wait_semaphore |
| 54 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 55 | * PARAMETERS: semaphore - Semaphore to wait on |
| 56 | * timeout - Max time to wait |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | * |
| 58 | * RETURN: Status |
| 59 | * |
| 60 | * DESCRIPTION: Implements a semaphore wait with a check to see if the |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 61 | * semaphore is available immediately. If it is not, the |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 62 | * interpreter is released before waiting. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | * |
| 64 | ******************************************************************************/ |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 65 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 67 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 69 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 71 | status = acpi_os_wait_semaphore(semaphore, 1, ACPI_DO_NOT_WAIT); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 72 | if (ACPI_SUCCESS(status)) { |
| 73 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | if (status == AE_TIME) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | /* We must wait, so unlock the interpreter */ |
| 79 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 80 | acpi_ex_exit_interpreter(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 84 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 85 | "*** Thread awake after blocking, %s\n", |
| 86 | acpi_format_exception(status))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | |
| 88 | /* Reacquire the interpreter */ |
| 89 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 90 | acpi_ex_enter_interpreter(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 93 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | /******************************************************************************* |
| 97 | * |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 98 | * FUNCTION: acpi_ex_system_wait_mutex |
| 99 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 100 | * PARAMETERS: mutex - Mutex to wait on |
| 101 | * timeout - Max time to wait |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 102 | * |
| 103 | * RETURN: Status |
| 104 | * |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 105 | * DESCRIPTION: Implements a mutex wait with a check to see if the |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 106 | * mutex is available immediately. If it is not, the |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 107 | * interpreter is released before waiting. |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 108 | * |
| 109 | ******************************************************************************/ |
| 110 | |
| 111 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) |
| 112 | { |
| 113 | acpi_status status; |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 114 | |
| 115 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); |
| 116 | |
| 117 | status = acpi_os_acquire_mutex(mutex, ACPI_DO_NOT_WAIT); |
| 118 | if (ACPI_SUCCESS(status)) { |
| 119 | return_ACPI_STATUS(status); |
| 120 | } |
| 121 | |
| 122 | if (status == AE_TIME) { |
| 123 | |
| 124 | /* We must wait, so unlock the interpreter */ |
| 125 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 126 | acpi_ex_exit_interpreter(); |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 127 | |
| 128 | status = acpi_os_acquire_mutex(mutex, timeout); |
| 129 | |
| 130 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 131 | "*** Thread awake after blocking, %s\n", |
| 132 | acpi_format_exception(status))); |
| 133 | |
| 134 | /* Reacquire the interpreter */ |
| 135 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 136 | acpi_ex_enter_interpreter(); |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | return_ACPI_STATUS(status); |
| 140 | } |
| 141 | |
| 142 | /******************************************************************************* |
| 143 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | * FUNCTION: acpi_ex_system_do_stall |
| 145 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 146 | * PARAMETERS: how_long - The amount of time to stall, |
| 147 | * in microseconds |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | * |
| 149 | * RETURN: Status |
| 150 | * |
| 151 | * DESCRIPTION: Suspend running thread for specified amount of time. |
| 152 | * Note: ACPI specification requires that Stall() does not |
| 153 | * relinquish the processor, and delays longer than 100 usec |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 154 | * should use Sleep() instead. We allow stalls up to 255 usec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | * for compatibility with other interpreters and existing BIOSs. |
| 156 | * |
| 157 | ******************************************************************************/ |
| 158 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 159 | acpi_status acpi_ex_system_do_stall(u32 how_long) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 161 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 163 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 165 | if (how_long > 255) { /* 255 microseconds */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | /* |
| 167 | * Longer than 255 usec, this is an error |
| 168 | * |
| 169 | * (ACPI specifies 100 usec as max, but this gives some slack in |
| 170 | * order to support existing BIOSs) |
| 171 | */ |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 172 | ACPI_ERROR((AE_INFO, "Time parameter is too large (%u)", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 173 | how_long)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | status = AE_AML_OPERAND_VALUE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 175 | } else { |
| 176 | acpi_os_stall(how_long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | return (status); |
| 180 | } |
| 181 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | /******************************************************************************* |
| 183 | * |
Bob Moore | ada241d | 2010-04-27 11:48:02 +0800 | [diff] [blame] | 184 | * FUNCTION: acpi_ex_system_do_sleep |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | * |
Bob Moore | ada241d | 2010-04-27 11:48:02 +0800 | [diff] [blame] | 186 | * PARAMETERS: how_long - The amount of time to sleep, |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 187 | * in milliseconds |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | * |
| 189 | * RETURN: None |
| 190 | * |
Bob Moore | ada241d | 2010-04-27 11:48:02 +0800 | [diff] [blame] | 191 | * DESCRIPTION: Sleep the running thread for specified amount of time. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | * |
| 193 | ******************************************************************************/ |
| 194 | |
Bob Moore | ada241d | 2010-04-27 11:48:02 +0800 | [diff] [blame] | 195 | acpi_status acpi_ex_system_do_sleep(u64 how_long) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 197 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | |
| 199 | /* Since this thread will sleep, we must release the interpreter */ |
| 200 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 201 | acpi_ex_exit_interpreter(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
Bob Moore | 9cbfa18 | 2010-05-26 11:22:41 +0800 | [diff] [blame] | 203 | /* |
| 204 | * For compatibility with other ACPI implementations and to prevent |
| 205 | * accidental deep sleeps, limit the sleep time to something reasonable. |
| 206 | */ |
| 207 | if (how_long > ACPI_MAX_SLEEP) { |
| 208 | how_long = ACPI_MAX_SLEEP; |
| 209 | } |
| 210 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 211 | acpi_os_sleep(how_long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
| 213 | /* And now we must get the interpreter again */ |
| 214 | |
Lv Zheng | e2b8ddc | 2014-03-24 14:48:45 +0800 | [diff] [blame] | 215 | acpi_ex_enter_interpreter(); |
Len Brown | 4d2acd9 | 2007-05-09 22:56:38 -0400 | [diff] [blame] | 216 | return (AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | } |
| 218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | /******************************************************************************* |
| 220 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | * FUNCTION: acpi_ex_system_signal_event |
| 222 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 223 | * PARAMETERS: obj_desc - The object descriptor for this op |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 225 | * RETURN: Status |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | * |
| 227 | * DESCRIPTION: Provides an access point to perform synchronization operations |
| 228 | * within the AML. |
| 229 | * |
| 230 | ******************************************************************************/ |
| 231 | |
Bob Moore | c81da66 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 232 | acpi_status acpi_ex_system_signal_event(union acpi_operand_object * obj_desc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 234 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 236 | ACPI_FUNCTION_TRACE(ex_system_signal_event); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
| 238 | if (obj_desc) { |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 239 | status = |
| 240 | acpi_os_signal_semaphore(obj_desc->event.os_semaphore, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 243 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | /******************************************************************************* |
| 247 | * |
| 248 | * FUNCTION: acpi_ex_system_wait_event |
| 249 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 250 | * PARAMETERS: time_desc - The 'time to delay' object descriptor |
| 251 | * obj_desc - The object descriptor for this op |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | * |
| 253 | * RETURN: Status |
| 254 | * |
| 255 | * DESCRIPTION: Provides an access point to perform synchronization operations |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 256 | * within the AML. This operation is a request to wait for an |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | * event. |
| 258 | * |
| 259 | ******************************************************************************/ |
| 260 | |
| 261 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 262 | acpi_ex_system_wait_event(union acpi_operand_object *time_desc, |
| 263 | union acpi_operand_object *obj_desc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 265 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 267 | ACPI_FUNCTION_TRACE(ex_system_wait_event); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
| 269 | if (obj_desc) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 270 | status = |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 271 | acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 272 | (u16) time_desc->integer. |
| 273 | value); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | } |
| 275 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 276 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | /******************************************************************************* |
| 280 | * |
| 281 | * FUNCTION: acpi_ex_system_reset_event |
| 282 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 283 | * PARAMETERS: obj_desc - The object descriptor for this op |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | * |
| 285 | * RETURN: Status |
| 286 | * |
| 287 | * DESCRIPTION: Reset an event to a known state. |
| 288 | * |
| 289 | ******************************************************************************/ |
| 290 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 291 | acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 293 | acpi_status status = AE_OK; |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 294 | acpi_semaphore temp_semaphore; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 296 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
| 298 | /* |
| 299 | * We are going to simply delete the existing semaphore and |
| 300 | * create a new one! |
| 301 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 302 | status = |
| 303 | acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); |
| 304 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 305 | (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore); |
| 306 | obj_desc->event.os_semaphore = temp_semaphore; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | return (status); |
| 310 | } |