Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: exstore - AML Interpreter object store support |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
Len Brown | 75a44ce | 2008-04-23 23:00:13 -0400 | [diff] [blame] | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * All rights reserved. |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, are permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions, and the following disclaimer, |
| 17 | * without modification. |
| 18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 19 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 20 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 21 | * including a substantially similar Disclaimer requirement for further |
| 22 | * binary redistribution. |
| 23 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 24 | * of any contributors may be used to endorse or promote products derived |
| 25 | * from this software without specific prior written permission. |
| 26 | * |
| 27 | * Alternatively, this software may be distributed under the terms of the |
| 28 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 29 | * Software Foundation. |
| 30 | * |
| 31 | * NO WARRANTY |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 42 | * POSSIBILITY OF SUCH DAMAGES. |
| 43 | */ |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 46 | #include "accommon.h" |
| 47 | #include "acdispat.h" |
| 48 | #include "acinterp.h" |
| 49 | #include "amlcode.h" |
| 50 | #include "acnamesp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #define _COMPONENT ACPI_EXECUTER |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | ACPI_MODULE_NAME("exstore") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 55 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 56 | static void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 57 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, |
| 58 | u32 level, u32 index); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 59 | |
| 60 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 61 | acpi_ex_store_object_to_index(union acpi_operand_object *val_desc, |
| 62 | union acpi_operand_object *dest_desc, |
| 63 | struct acpi_walk_state *walk_state); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 64 | |
| 65 | /******************************************************************************* |
| 66 | * |
| 67 | * FUNCTION: acpi_ex_do_debug_object |
| 68 | * |
| 69 | * PARAMETERS: source_desc - Value to be stored |
| 70 | * Level - Indentation level (used for packages) |
| 71 | * Index - Current package element, zero if not pkg |
| 72 | * |
| 73 | * RETURN: None |
| 74 | * |
| 75 | * DESCRIPTION: Handles stores to the Debug Object. |
| 76 | * |
| 77 | ******************************************************************************/ |
| 78 | |
| 79 | static void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, |
| 81 | u32 level, u32 index) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 82 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 83 | u32 i; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 84 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 86 | |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 87 | /* Print line header as long as we are not in the middle of an object display */ |
| 88 | |
| 89 | if (!((level > 0) && index == 0)) { |
| 90 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", |
| 91 | level, " ")); |
| 92 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 93 | |
| 94 | /* Display index for package output only */ |
| 95 | |
| 96 | if (index > 0) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 97 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 98 | "(%.2u) ", index - 1)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | if (!source_desc) { |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 102 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 103 | return_VOID; |
| 104 | } |
| 105 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 106 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 107 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s ", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 108 | acpi_ut_get_object_type_name |
| 109 | (source_desc))); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 110 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 111 | if (!acpi_ut_valid_internal_object(source_desc)) { |
| 112 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 113 | "%p, Invalid Internal Object!\n", |
| 114 | source_desc)); |
| 115 | return_VOID; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 116 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 117 | } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == |
| 118 | ACPI_DESC_TYPE_NAMED) { |
| 119 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", |
| 120 | acpi_ut_get_type_name(((struct |
| 121 | acpi_namespace_node |
| 122 | *)source_desc)-> |
| 123 | type), |
| 124 | source_desc)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 125 | return_VOID; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 126 | } else { |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 127 | return_VOID; |
| 128 | } |
| 129 | |
Bob Moore | 61ce421 | 2008-04-10 19:06:39 +0400 | [diff] [blame] | 130 | /* source_desc is of type ACPI_DESC_TYPE_OPERAND */ |
| 131 | |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 132 | switch (source_desc->common.type) { |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 133 | case ACPI_TYPE_INTEGER: |
| 134 | |
| 135 | /* Output correct integer width */ |
| 136 | |
| 137 | if (acpi_gbl_integer_byte_width == 4) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 138 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", |
| 139 | (u32) source_desc->integer. |
| 140 | value)); |
| 141 | } else { |
| 142 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 143 | "0x%8.8X%8.8X\n", |
| 144 | ACPI_FORMAT_UINT64(source_desc-> |
| 145 | integer. |
| 146 | value))); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 147 | } |
| 148 | break; |
| 149 | |
| 150 | case ACPI_TYPE_BUFFER: |
| 151 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 152 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", |
| 153 | (u32) source_desc->buffer.length)); |
| 154 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, |
| 155 | (source_desc->buffer.length < |
Bob Moore | 422f4f9 | 2008-04-10 19:06:37 +0400 | [diff] [blame] | 156 | 256) ? source_desc->buffer.length : 256); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 157 | break; |
| 158 | |
| 159 | case ACPI_TYPE_STRING: |
| 160 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 161 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", |
| 162 | source_desc->string.length, |
| 163 | source_desc->string.pointer)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 164 | break; |
| 165 | |
| 166 | case ACPI_TYPE_PACKAGE: |
| 167 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 168 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 169 | "[Contains 0x%.2X Elements]\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 170 | source_desc->package.count)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 171 | |
| 172 | /* Output the entire contents of the package */ |
| 173 | |
| 174 | for (i = 0; i < source_desc->package.count; i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 175 | acpi_ex_do_debug_object(source_desc->package. |
| 176 | elements[i], level + 4, i + 1); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 177 | } |
| 178 | break; |
| 179 | |
| 180 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 181 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 182 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s] ", |
| 183 | acpi_ut_get_reference_name(source_desc))); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 184 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 185 | /* Decode the reference */ |
| 186 | |
| 187 | switch (source_desc->reference.class) { |
| 188 | case ACPI_REFCLASS_INDEX: |
| 189 | |
| 190 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%X\n", |
Bob Moore | 57e664c | 2008-09-27 10:40:39 +0800 | [diff] [blame] | 191 | source_desc->reference.value)); |
Bob Moore | 61ce421 | 2008-04-10 19:06:39 +0400 | [diff] [blame] | 192 | break; |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 193 | |
| 194 | case ACPI_REFCLASS_TABLE: |
| 195 | |
Bob Moore | a76b772 | 2009-05-21 10:06:19 +0800 | [diff] [blame] | 196 | /* Case for ddb_handle */ |
| 197 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 198 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 199 | "Table Index 0x%X\n", |
| 200 | source_desc->reference.value)); |
Bob Moore | a76b772 | 2009-05-21 10:06:19 +0800 | [diff] [blame] | 201 | return; |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 202 | |
| 203 | default: |
| 204 | break; |
Bob Moore | 61ce421 | 2008-04-10 19:06:39 +0400 | [diff] [blame] | 205 | } |
| 206 | |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 207 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " ")); |
| 208 | |
| 209 | /* Check for valid node first, then valid object */ |
| 210 | |
| 211 | if (source_desc->reference.node) { |
| 212 | if (ACPI_GET_DESCRIPTOR_TYPE |
| 213 | (source_desc->reference.node) != |
| 214 | ACPI_DESC_TYPE_NAMED) { |
| 215 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 216 | " %p - Not a valid namespace node\n", |
| 217 | source_desc->reference. |
| 218 | node)); |
| 219 | } else { |
| 220 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
| 221 | "Node %p [%4.4s] ", |
| 222 | source_desc->reference. |
| 223 | node, |
| 224 | (source_desc->reference. |
| 225 | node)->name.ascii)); |
| 226 | |
| 227 | switch ((source_desc->reference.node)->type) { |
| 228 | |
| 229 | /* These types have no attached object */ |
| 230 | |
| 231 | case ACPI_TYPE_DEVICE: |
| 232 | acpi_os_printf("Device\n"); |
| 233 | break; |
| 234 | |
| 235 | case ACPI_TYPE_THERMAL: |
| 236 | acpi_os_printf("Thermal Zone\n"); |
| 237 | break; |
| 238 | |
| 239 | default: |
| 240 | acpi_ex_do_debug_object((source_desc-> |
| 241 | reference. |
| 242 | node)->object, |
| 243 | level + 4, 0); |
| 244 | break; |
| 245 | } |
| 246 | } |
| 247 | } else if (source_desc->reference.object) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 248 | if (ACPI_GET_DESCRIPTOR_TYPE |
| 249 | (source_desc->reference.object) == |
| 250 | ACPI_DESC_TYPE_NAMED) { |
| 251 | acpi_ex_do_debug_object(((struct |
| 252 | acpi_namespace_node *) |
| 253 | source_desc->reference. |
| 254 | object)->object, |
| 255 | level + 4, 0); |
| 256 | } else { |
| 257 | acpi_ex_do_debug_object(source_desc->reference. |
| 258 | object, level + 4, 0); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 259 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 260 | } |
| 261 | break; |
| 262 | |
| 263 | default: |
| 264 | |
Bob Moore | d884657 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 265 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p\n", |
| 266 | source_desc)); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 267 | break; |
| 268 | } |
| 269 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 270 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n")); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 271 | return_VOID; |
| 272 | } |
| 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | /******************************************************************************* |
| 275 | * |
| 276 | * FUNCTION: acpi_ex_store |
| 277 | * |
| 278 | * PARAMETERS: *source_desc - Value to be stored |
| 279 | * *dest_desc - Where to store it. Must be an NS node |
Frederik Schwarzer | 0211a9c | 2008-12-29 22:14:56 +0100 | [diff] [blame] | 280 | * or a union acpi_operand_object of type |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | * Reference; |
| 282 | * walk_state - Current walk state |
| 283 | * |
| 284 | * RETURN: Status |
| 285 | * |
| 286 | * DESCRIPTION: Store the value described by source_desc into the location |
| 287 | * described by dest_desc. Called by various interpreter |
| 288 | * functions to store the result of an operation into |
| 289 | * the destination operand -- not just simply the actual "Store" |
| 290 | * ASL operator. |
| 291 | * |
| 292 | ******************************************************************************/ |
| 293 | |
| 294 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 295 | acpi_ex_store(union acpi_operand_object *source_desc, |
| 296 | union acpi_operand_object *dest_desc, |
| 297 | struct acpi_walk_state *walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 299 | acpi_status status = AE_OK; |
| 300 | union acpi_operand_object *ref_desc = dest_desc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 302 | ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
| 304 | /* Validate parameters */ |
| 305 | |
| 306 | if (!source_desc || !dest_desc) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 307 | ACPI_ERROR((AE_INFO, "Null parameter")); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 308 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | /* dest_desc can be either a namespace node or an ACPI object */ |
| 312 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 313 | if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | /* |
| 315 | * Dest is a namespace node, |
| 316 | * Storing an object into a Named node. |
| 317 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 318 | status = acpi_ex_store_object_to_node(source_desc, |
| 319 | (struct |
| 320 | acpi_namespace_node *) |
| 321 | dest_desc, walk_state, |
| 322 | ACPI_IMPLICIT_CONVERSION); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 324 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | /* Destination object must be a Reference or a Constant object */ |
| 328 | |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 329 | switch (dest_desc->common.type) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 331 | break; |
| 332 | |
| 333 | case ACPI_TYPE_INTEGER: |
| 334 | |
| 335 | /* Allow stores to Constants -- a Noop as per ACPI spec */ |
| 336 | |
| 337 | if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 338 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | /*lint -fallthrough */ |
| 342 | |
| 343 | default: |
| 344 | |
| 345 | /* Destination is not a Reference object */ |
| 346 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 347 | ACPI_ERROR((AE_INFO, |
| 348 | "Target is not a Reference or Constant object - %s [%p]", |
| 349 | acpi_ut_get_object_type_name(dest_desc), |
| 350 | dest_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 352 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | /* |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 356 | * Examine the Reference class. These cases are handled: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | * |
| 358 | * 1) Store to Name (Change the object associated with a name) |
| 359 | * 2) Store to an indexed area of a Buffer or Package |
| 360 | * 3) Store to a Method Local or Arg |
| 361 | * 4) Store to the debug object |
| 362 | */ |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 363 | switch (ref_desc->reference.class) { |
| 364 | case ACPI_REFCLASS_REFOF: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* Storing an object into a Name "container" */ |
| 367 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 368 | status = acpi_ex_store_object_to_node(source_desc, |
| 369 | ref_desc->reference. |
| 370 | object, walk_state, |
| 371 | ACPI_IMPLICIT_CONVERSION); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | break; |
| 373 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 374 | case ACPI_REFCLASS_INDEX: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | |
| 376 | /* Storing to an Index (pointer into a packager or buffer) */ |
| 377 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 378 | status = |
| 379 | acpi_ex_store_object_to_index(source_desc, ref_desc, |
| 380 | walk_state); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | break; |
| 382 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 383 | case ACPI_REFCLASS_LOCAL: |
| 384 | case ACPI_REFCLASS_ARG: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | |
| 386 | /* Store to a method local/arg */ |
| 387 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 388 | status = |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 389 | acpi_ds_store_object_to_local(ref_desc->reference.class, |
| 390 | ref_desc->reference.value, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 391 | source_desc, walk_state); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | break; |
| 393 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 394 | case ACPI_REFCLASS_DEBUG: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | |
| 396 | /* |
| 397 | * Storing to the Debug object causes the value stored to be |
| 398 | * displayed and otherwise has no effect -- see ACPI Specification |
| 399 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 400 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 401 | "**** Write to Debug Object: Object %p %s ****:\n\n", |
| 402 | source_desc, |
| 403 | acpi_ut_get_object_type_name(source_desc))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 405 | acpi_ex_do_debug_object(source_desc, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | break; |
| 407 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | default: |
| 409 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 410 | ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X", |
| 411 | ref_desc->reference.class)); |
Bob Moore | 23d3e05 | 2008-09-28 15:00:47 +0800 | [diff] [blame] | 412 | ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_INFO); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | |
| 414 | status = AE_AML_INTERNAL; |
| 415 | break; |
| 416 | } |
| 417 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 418 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | } |
| 420 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | /******************************************************************************* |
| 422 | * |
| 423 | * FUNCTION: acpi_ex_store_object_to_index |
| 424 | * |
| 425 | * PARAMETERS: *source_desc - Value to be stored |
| 426 | * *dest_desc - Named object to receive the value |
| 427 | * walk_state - Current walk state |
| 428 | * |
| 429 | * RETURN: Status |
| 430 | * |
| 431 | * DESCRIPTION: Store the object to indexed Buffer or Package element |
| 432 | * |
| 433 | ******************************************************************************/ |
| 434 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 435 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 436 | acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, |
| 437 | union acpi_operand_object *index_desc, |
| 438 | struct acpi_walk_state *walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 440 | acpi_status status = AE_OK; |
| 441 | union acpi_operand_object *obj_desc; |
| 442 | union acpi_operand_object *new_desc; |
| 443 | u8 value = 0; |
| 444 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 446 | ACPI_FUNCTION_TRACE(ex_store_object_to_index); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | |
| 448 | /* |
| 449 | * Destination must be a reference pointer, and |
| 450 | * must point to either a buffer or a package |
| 451 | */ |
| 452 | switch (index_desc->reference.target_type) { |
| 453 | case ACPI_TYPE_PACKAGE: |
| 454 | /* |
| 455 | * Storing to a package element. Copy the object and replace |
| 456 | * any existing object with the new object. No implicit |
| 457 | * conversion is performed. |
| 458 | * |
| 459 | * The object at *(index_desc->Reference.Where) is the |
| 460 | * element within the package that is to be modified. |
| 461 | * The parent package object is at index_desc->Reference.Object |
| 462 | */ |
| 463 | obj_desc = *(index_desc->reference.where); |
| 464 | |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 465 | if (source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE && |
| 466 | source_desc->reference.class == ACPI_REFCLASS_TABLE) { |
Lin Ming | bc7a36a | 2008-04-10 19:06:42 +0400 | [diff] [blame] | 467 | |
| 468 | /* This is a DDBHandle, just add a reference to it */ |
| 469 | |
| 470 | acpi_ut_add_reference(source_desc); |
| 471 | new_desc = source_desc; |
| 472 | } else { |
| 473 | /* Normal object, copy it */ |
| 474 | |
| 475 | status = |
| 476 | acpi_ut_copy_iobject_to_iobject(source_desc, |
| 477 | &new_desc, |
| 478 | walk_state); |
| 479 | if (ACPI_FAILURE(status)) { |
| 480 | return_ACPI_STATUS(status); |
| 481 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | if (obj_desc) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | /* Decrement reference count by the ref count of the parent package */ |
| 487 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 488 | for (i = 0; i < ((union acpi_operand_object *) |
| 489 | index_desc->reference.object)->common. |
| 490 | reference_count; i++) { |
| 491 | acpi_ut_remove_reference(obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | } |
| 493 | } |
| 494 | |
| 495 | *(index_desc->reference.where) = new_desc; |
| 496 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 497 | /* Increment ref count by the ref count of the parent package-1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 499 | for (i = 1; i < ((union acpi_operand_object *) |
| 500 | index_desc->reference.object)->common. |
| 501 | reference_count; i++) { |
| 502 | acpi_ut_add_reference(new_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | break; |
| 506 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | case ACPI_TYPE_BUFFER_FIELD: |
| 508 | |
| 509 | /* |
| 510 | * Store into a Buffer or String (not actually a real buffer_field) |
| 511 | * at a location defined by an Index. |
| 512 | * |
| 513 | * The first 8-bit element of the source object is written to the |
| 514 | * 8-bit Buffer location defined by the Index destination object, |
| 515 | * according to the ACPI 2.0 specification. |
| 516 | */ |
| 517 | |
| 518 | /* |
| 519 | * Make sure the target is a Buffer or String. An error should |
| 520 | * not happen here, since the reference_object was constructed |
| 521 | * by the INDEX_OP code. |
| 522 | */ |
| 523 | obj_desc = index_desc->reference.object; |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 524 | if ((obj_desc->common.type != ACPI_TYPE_BUFFER) && |
| 525 | (obj_desc->common.type != ACPI_TYPE_STRING)) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 526 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | /* |
| 530 | * The assignment of the individual elements will be slightly |
| 531 | * different for each source type. |
| 532 | */ |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 533 | switch (source_desc->common.type) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | case ACPI_TYPE_INTEGER: |
| 535 | |
| 536 | /* Use the least-significant byte of the integer */ |
| 537 | |
| 538 | value = (u8) (source_desc->integer.value); |
| 539 | break; |
| 540 | |
| 541 | case ACPI_TYPE_BUFFER: |
| 542 | case ACPI_TYPE_STRING: |
| 543 | |
| 544 | /* Note: Takes advantage of common string/buffer fields */ |
| 545 | |
| 546 | value = source_desc->buffer.pointer[0]; |
| 547 | break; |
| 548 | |
| 549 | default: |
| 550 | |
| 551 | /* All other types are invalid */ |
| 552 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 553 | ACPI_ERROR((AE_INFO, |
| 554 | "Source must be Integer/Buffer/String type, not %s", |
| 555 | acpi_ut_get_object_type_name(source_desc))); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 556 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | /* Store the source value into the target buffer byte */ |
| 560 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 561 | obj_desc->buffer.pointer[index_desc->reference.value] = value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | break; |
| 563 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | default: |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 565 | ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | status = AE_AML_OPERAND_TYPE; |
| 567 | break; |
| 568 | } |
| 569 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 570 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | } |
| 572 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | /******************************************************************************* |
| 574 | * |
| 575 | * FUNCTION: acpi_ex_store_object_to_node |
| 576 | * |
| 577 | * PARAMETERS: source_desc - Value to be stored |
| 578 | * Node - Named object to receive the value |
| 579 | * walk_state - Current walk state |
| 580 | * implicit_conversion - Perform implicit conversion (yes/no) |
| 581 | * |
| 582 | * RETURN: Status |
| 583 | * |
| 584 | * DESCRIPTION: Store the object to the named object. |
| 585 | * |
| 586 | * The Assignment of an object to a named object is handled here |
| 587 | * The value passed in will replace the current value (if any) |
| 588 | * with the input value. |
| 589 | * |
| 590 | * When storing into an object the data is converted to the |
| 591 | * target object type then stored in the object. This means |
| 592 | * that the target object type (for an initialized target) will |
| 593 | * not be changed by a store operation. |
| 594 | * |
| 595 | * Assumes parameters are already validated. |
| 596 | * |
| 597 | ******************************************************************************/ |
| 598 | |
| 599 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 600 | acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, |
| 601 | struct acpi_namespace_node *node, |
| 602 | struct acpi_walk_state *walk_state, |
| 603 | u8 implicit_conversion) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 605 | acpi_status status = AE_OK; |
| 606 | union acpi_operand_object *target_desc; |
| 607 | union acpi_operand_object *new_desc; |
| 608 | acpi_object_type target_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 610 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 612 | /* Get current type of the node, and object attached to Node */ |
| 613 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 614 | target_type = acpi_ns_get_type(node); |
| 615 | target_desc = acpi_ns_get_attached_object(node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 617 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", |
| 618 | source_desc, |
| 619 | acpi_ut_get_object_type_name(source_desc), node, |
| 620 | acpi_ut_get_type_name(target_type))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 621 | |
| 622 | /* |
| 623 | * Resolve the source object to an actual value |
| 624 | * (If it is a reference object) |
| 625 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 626 | status = acpi_ex_resolve_object(&source_desc, target_type, walk_state); |
| 627 | if (ACPI_FAILURE(status)) { |
| 628 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | } |
| 630 | |
| 631 | /* If no implicit conversion, drop into the default case below */ |
| 632 | |
Lin Ming | a3df4da | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 633 | if ((!implicit_conversion) || |
| 634 | ((walk_state->opcode == AML_COPY_OP) && |
| 635 | (target_type != ACPI_TYPE_LOCAL_REGION_FIELD) && |
| 636 | (target_type != ACPI_TYPE_LOCAL_BANK_FIELD) && |
| 637 | (target_type != ACPI_TYPE_LOCAL_INDEX_FIELD))) { |
| 638 | /* |
| 639 | * Force execution of default (no implicit conversion). Note: |
| 640 | * copy_object does not perform an implicit conversion, as per the ACPI |
| 641 | * spec -- except in case of region/bank/index fields -- because these |
| 642 | * objects must retain their original type permanently. |
| 643 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | target_type = ACPI_TYPE_ANY; |
| 645 | } |
| 646 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 647 | /* Do the actual store operation */ |
| 648 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | switch (target_type) { |
| 650 | case ACPI_TYPE_BUFFER_FIELD: |
| 651 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
| 652 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
| 653 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
| 654 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 655 | /* For fields, copy the source data to the target field. */ |
| 656 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 657 | status = acpi_ex_write_data_to_field(source_desc, target_desc, |
| 658 | &walk_state->result_obj); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | break; |
| 660 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | case ACPI_TYPE_INTEGER: |
| 662 | case ACPI_TYPE_STRING: |
| 663 | case ACPI_TYPE_BUFFER: |
| 664 | |
| 665 | /* |
| 666 | * These target types are all of type Integer/String/Buffer, and |
| 667 | * therefore support implicit conversion before the store. |
| 668 | * |
| 669 | * Copy and/or convert the source object to a new target object |
| 670 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 671 | status = |
| 672 | acpi_ex_store_object_to_object(source_desc, target_desc, |
| 673 | &new_desc, walk_state); |
| 674 | if (ACPI_FAILURE(status)) { |
| 675 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | if (new_desc != target_desc) { |
| 679 | /* |
| 680 | * Store the new new_desc as the new value of the Name, and set |
| 681 | * the Name's type to that of the value being stored in it. |
| 682 | * source_desc reference count is incremented by attach_object. |
| 683 | * |
| 684 | * Note: This may change the type of the node if an explicit store |
| 685 | * has been performed such that the node/object type has been |
| 686 | * changed. |
| 687 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 688 | status = |
| 689 | acpi_ns_attach_object(node, new_desc, |
| 690 | new_desc->common.type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 692 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 693 | "Store %s into %s via Convert/Attach\n", |
| 694 | acpi_ut_get_object_type_name |
| 695 | (source_desc), |
| 696 | acpi_ut_get_object_type_name |
| 697 | (new_desc))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | } |
| 699 | break; |
| 700 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | default: |
| 702 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 703 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 704 | "Storing %s (%p) directly into node (%p) with no implicit conversion\n", |
| 705 | acpi_ut_get_object_type_name(source_desc), |
| 706 | source_desc, node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | |
| 708 | /* No conversions for all other types. Just attach the source object */ |
| 709 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 710 | status = acpi_ns_attach_object(node, source_desc, |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 711 | source_desc->common.type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | break; |
| 713 | } |
| 714 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 715 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 716 | } |