Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Module Name: utstate - state object support procedures |
| 4 | * |
| 5 | ******************************************************************************/ |
| 6 | |
| 7 | /* |
David E. Box | 82a8094 | 2015-02-05 15:20:45 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2015, Intel Corp. |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [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 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 46 | |
| 47 | #define _COMPONENT ACPI_UTILITIES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 48 | ACPI_MODULE_NAME("utstate") |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 49 | |
| 50 | /******************************************************************************* |
| 51 | * |
| 52 | * FUNCTION: acpi_ut_create_pkg_state_and_push |
| 53 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 54 | * PARAMETERS: object - Object to be added to the new state |
| 55 | * action - Increment/Decrement |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 56 | * state_list - List the state will be added to |
| 57 | * |
| 58 | * RETURN: Status |
| 59 | * |
| 60 | * DESCRIPTION: Create a new state and push it |
| 61 | * |
| 62 | ******************************************************************************/ |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 63 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 64 | acpi_ut_create_pkg_state_and_push(void *internal_object, |
| 65 | void *external_object, |
| 66 | u16 index, |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 67 | union acpi_generic_state **state_list) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 68 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 69 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 70 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 71 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 72 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 73 | state = |
| 74 | acpi_ut_create_pkg_state(internal_object, external_object, index); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 75 | if (!state) { |
| 76 | return (AE_NO_MEMORY); |
| 77 | } |
| 78 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 79 | acpi_ut_push_generic_state(state_list, state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 80 | return (AE_OK); |
| 81 | } |
| 82 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 83 | /******************************************************************************* |
| 84 | * |
| 85 | * FUNCTION: acpi_ut_push_generic_state |
| 86 | * |
| 87 | * PARAMETERS: list_head - Head of the state stack |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 88 | * state - State object to push |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 89 | * |
| 90 | * RETURN: None |
| 91 | * |
| 92 | * DESCRIPTION: Push a state object onto a state stack |
| 93 | * |
| 94 | ******************************************************************************/ |
| 95 | |
| 96 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 97 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
| 98 | union acpi_generic_state *state) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 99 | { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 100 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 101 | |
| 102 | /* Push the state object onto the front of the list (stack) */ |
| 103 | |
| 104 | state->common.next = *list_head; |
| 105 | *list_head = state; |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 106 | return; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 107 | } |
| 108 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 109 | /******************************************************************************* |
| 110 | * |
| 111 | * FUNCTION: acpi_ut_pop_generic_state |
| 112 | * |
| 113 | * PARAMETERS: list_head - Head of the state stack |
| 114 | * |
| 115 | * RETURN: The popped state object |
| 116 | * |
| 117 | * DESCRIPTION: Pop a state object from a state stack |
| 118 | * |
| 119 | ******************************************************************************/ |
| 120 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 121 | union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state |
| 122 | **list_head) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 123 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 124 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 125 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 126 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 127 | |
| 128 | /* Remove the state object at the head of the list (stack) */ |
| 129 | |
| 130 | state = *list_head; |
| 131 | if (state) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 132 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 133 | /* Update the list head */ |
| 134 | |
| 135 | *list_head = state->common.next; |
| 136 | } |
| 137 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 138 | return (state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 139 | } |
| 140 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 141 | /******************************************************************************* |
| 142 | * |
| 143 | * FUNCTION: acpi_ut_create_generic_state |
| 144 | * |
| 145 | * PARAMETERS: None |
| 146 | * |
| 147 | * RETURN: The new state object. NULL on failure. |
| 148 | * |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 149 | * DESCRIPTION: Create a generic state object. Attempt to obtain one from |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 150 | * the global state cache; If none available, create a new one. |
| 151 | * |
| 152 | ******************************************************************************/ |
| 153 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 154 | union acpi_generic_state *acpi_ut_create_generic_state(void) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 155 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 156 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 157 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 158 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 159 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 160 | state = acpi_os_acquire_object(acpi_gbl_state_cache); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 161 | if (state) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 162 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 163 | /* Initialize */ |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 164 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | return (state); |
| 168 | } |
| 169 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 170 | /******************************************************************************* |
| 171 | * |
| 172 | * FUNCTION: acpi_ut_create_thread_state |
| 173 | * |
| 174 | * PARAMETERS: None |
| 175 | * |
| 176 | * RETURN: New Thread State. NULL on failure |
| 177 | * |
| 178 | * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used |
| 179 | * to track per-thread info during method execution |
| 180 | * |
| 181 | ******************************************************************************/ |
| 182 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 183 | struct acpi_thread_state *acpi_ut_create_thread_state(void) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 184 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 185 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 186 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 187 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 188 | |
| 189 | /* Create the generic state object */ |
| 190 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 191 | state = acpi_ut_create_generic_state(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 192 | if (!state) { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 193 | return (NULL); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | /* Init fields specific to the update struct */ |
| 197 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 198 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 199 | state->thread.thread_id = acpi_os_get_thread_id(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 200 | |
Bob Moore | f6dd922 | 2006-07-07 20:44:38 -0400 | [diff] [blame] | 201 | /* Check for invalid thread ID - zero is very bad, it will break things */ |
| 202 | |
| 203 | if (!state->thread.thread_id) { |
| 204 | ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId")); |
| 205 | state->thread.thread_id = (acpi_thread_id) 1; |
| 206 | } |
| 207 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 208 | return ((struct acpi_thread_state *)state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 209 | } |
| 210 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 211 | /******************************************************************************* |
| 212 | * |
| 213 | * FUNCTION: acpi_ut_create_update_state |
| 214 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 215 | * PARAMETERS: object - Initial Object to be installed in the state |
| 216 | * action - Update action to be performed |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 217 | * |
| 218 | * RETURN: New state object, null on failure |
| 219 | * |
| 220 | * DESCRIPTION: Create an "Update State" - a flavor of the generic state used |
| 221 | * to update reference counts and delete complex objects such |
| 222 | * as packages. |
| 223 | * |
| 224 | ******************************************************************************/ |
| 225 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 226 | union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object |
| 227 | *object, u16 action) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 228 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 229 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 230 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 231 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 232 | |
| 233 | /* Create the generic state object */ |
| 234 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 235 | state = acpi_ut_create_generic_state(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 236 | if (!state) { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 237 | return (NULL); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | /* Init fields specific to the update struct */ |
| 241 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 242 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 243 | state->update.object = object; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 244 | state->update.value = action; |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 245 | return (state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 246 | } |
| 247 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 248 | /******************************************************************************* |
| 249 | * |
| 250 | * FUNCTION: acpi_ut_create_pkg_state |
| 251 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 252 | * PARAMETERS: object - Initial Object to be installed in the state |
| 253 | * action - Update action to be performed |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 254 | * |
| 255 | * RETURN: New state object, null on failure |
| 256 | * |
| 257 | * DESCRIPTION: Create a "Package State" |
| 258 | * |
| 259 | ******************************************************************************/ |
| 260 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 261 | union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, |
| 262 | void *external_object, |
| 263 | u16 index) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 264 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 265 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 266 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 267 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 268 | |
| 269 | /* Create the generic state object */ |
| 270 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 271 | state = acpi_ut_create_generic_state(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 272 | if (!state) { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 273 | return (NULL); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | /* Init fields specific to the update struct */ |
| 277 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 278 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 279 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
| 280 | state->pkg.dest_object = external_object; |
| 281 | state->pkg.index = index; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 282 | state->pkg.num_packages = 1; |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 283 | return (state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 284 | } |
| 285 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 286 | /******************************************************************************* |
| 287 | * |
| 288 | * FUNCTION: acpi_ut_create_control_state |
| 289 | * |
| 290 | * PARAMETERS: None |
| 291 | * |
| 292 | * RETURN: New state object, null on failure |
| 293 | * |
| 294 | * DESCRIPTION: Create a "Control State" - a flavor of the generic state used |
| 295 | * to support nested IF/WHILE constructs in the AML. |
| 296 | * |
| 297 | ******************************************************************************/ |
| 298 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 299 | union acpi_generic_state *acpi_ut_create_control_state(void) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 300 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 301 | union acpi_generic_state *state; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 302 | |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 303 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 304 | |
| 305 | /* Create the generic state object */ |
| 306 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 307 | state = acpi_ut_create_generic_state(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 308 | if (!state) { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 309 | return (NULL); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | /* Init fields specific to the control struct */ |
| 313 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 314 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 315 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 316 | return (state); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 317 | } |
| 318 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 319 | /******************************************************************************* |
| 320 | * |
| 321 | * FUNCTION: acpi_ut_delete_generic_state |
| 322 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 323 | * PARAMETERS: state - The state object to be deleted |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 324 | * |
| 325 | * RETURN: None |
| 326 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 327 | * DESCRIPTION: Release a state object to the state cache. NULL state objects |
| 328 | * are ignored. |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 329 | * |
| 330 | ******************************************************************************/ |
| 331 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 332 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 333 | { |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 334 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 335 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 336 | /* Ignore null state */ |
| 337 | |
| 338 | if (state) { |
| 339 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); |
| 340 | } |
Bob Moore | 0e770b3 | 2012-12-19 05:37:59 +0000 | [diff] [blame] | 341 | return; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 342 | } |