Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
| 9 | * Copyright (C) 2000 - 2005, R. Byron Moore |
| 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> |
| 46 | #include <acpi/acinterp.h> |
| 47 | #include <acpi/amlcode.h> |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #define _COMPONENT ACPI_EXECUTER |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("exmisc") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | /******************************************************************************* |
| 53 | * |
| 54 | * FUNCTION: acpi_ex_get_object_reference |
| 55 | * |
| 56 | * PARAMETERS: obj_desc - Create a reference to this object |
| 57 | * return_desc - Where to store the reference |
| 58 | * walk_state - Current state |
| 59 | * |
| 60 | * RETURN: Status |
| 61 | * |
| 62 | * DESCRIPTION: Obtain and return a "reference" to the target object |
| 63 | * Common code for the ref_of_op and the cond_ref_of_op. |
| 64 | * |
| 65 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 67 | acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, |
| 68 | union acpi_operand_object **return_desc, |
| 69 | struct acpi_walk_state *walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 71 | union acpi_operand_object *reference_obj; |
| 72 | union acpi_operand_object *referenced_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 74 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
| 76 | *return_desc = NULL; |
| 77 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 78 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | case ACPI_DESC_TYPE_OPERAND: |
| 80 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 81 | if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { |
| 82 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | /* |
| 86 | * Must be a reference to a Local or Arg |
| 87 | */ |
| 88 | switch (obj_desc->reference.opcode) { |
| 89 | case AML_LOCAL_OP: |
| 90 | case AML_ARG_OP: |
| 91 | case AML_DEBUG_OP: |
| 92 | |
| 93 | /* The referenced object is the pseudo-node for the local/arg */ |
| 94 | |
| 95 | referenced_obj = obj_desc->reference.object; |
| 96 | break; |
| 97 | |
| 98 | default: |
| 99 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 100 | ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); |
| 101 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | } |
| 103 | break; |
| 104 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | case ACPI_DESC_TYPE_NAMED: |
| 106 | |
| 107 | /* |
| 108 | * A named reference that has already been resolved to a Node |
| 109 | */ |
| 110 | referenced_obj = obj_desc; |
| 111 | break; |
| 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | default: |
| 114 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 115 | ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); |
| 116 | return_ACPI_STATUS(AE_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | } |
| 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | /* Create a new reference object */ |
| 120 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 121 | reference_obj = |
| 122 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | if (!reference_obj) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 124 | return_ACPI_STATUS(AE_NO_MEMORY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | reference_obj->reference.opcode = AML_REF_OF_OP; |
| 128 | reference_obj->reference.object = referenced_obj; |
| 129 | *return_desc = reference_obj; |
| 130 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 131 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 132 | "Object %p Type [%s], returning Reference %p\n", |
| 133 | obj_desc, acpi_ut_get_object_type_name(obj_desc), |
| 134 | *return_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 136 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | /******************************************************************************* |
| 140 | * |
| 141 | * FUNCTION: acpi_ex_concat_template |
| 142 | * |
| 143 | * PARAMETERS: Operand0 - First source object |
| 144 | * Operand1 - Second source object |
| 145 | * actual_return_desc - Where to place the return object |
| 146 | * walk_state - Current walk state |
| 147 | * |
| 148 | * RETURN: Status |
| 149 | * |
| 150 | * DESCRIPTION: Concatenate two resource templates |
| 151 | * |
| 152 | ******************************************************************************/ |
| 153 | |
| 154 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 155 | acpi_ex_concat_template(union acpi_operand_object *operand0, |
| 156 | union acpi_operand_object *operand1, |
| 157 | union acpi_operand_object **actual_return_desc, |
| 158 | struct acpi_walk_state *walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 160 | union acpi_operand_object *return_desc; |
| 161 | u8 *new_buf; |
| 162 | u8 *end_tag1; |
| 163 | u8 *end_tag2; |
| 164 | acpi_size length1; |
| 165 | acpi_size length2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 167 | ACPI_FUNCTION_TRACE("ex_concat_template"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
| 169 | /* Find the end_tags in each resource template */ |
| 170 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 171 | end_tag1 = acpi_ut_get_resource_end_tag(operand0); |
| 172 | end_tag2 = acpi_ut_get_resource_end_tag(operand1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | if (!end_tag1 || !end_tag2) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 174 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /* Compute the length of each part */ |
| 178 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 179 | length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); |
| 180 | length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | |
| 182 | /* Create a new buffer object for the result */ |
| 183 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 184 | return_desc = acpi_ut_create_buffer_object(length1 + length2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | if (!return_desc) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 186 | return_ACPI_STATUS(AE_NO_MEMORY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | /* Copy the templates to the new descriptor */ |
| 190 | |
| 191 | new_buf = return_desc->buffer.pointer; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 192 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); |
| 193 | ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | /* Compute the new checksum */ |
| 196 | |
| 197 | new_buf[return_desc->buffer.length - 1] = |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 198 | acpi_ut_generate_checksum(return_desc->buffer.pointer, |
| 199 | (return_desc->buffer.length - 1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | |
| 201 | /* Return the completed template descriptor */ |
| 202 | |
| 203 | *actual_return_desc = return_desc; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 204 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | } |
| 206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | /******************************************************************************* |
| 208 | * |
| 209 | * FUNCTION: acpi_ex_do_concatenate |
| 210 | * |
| 211 | * PARAMETERS: Operand0 - First source object |
| 212 | * Operand1 - Second source object |
| 213 | * actual_return_desc - Where to place the return object |
| 214 | * walk_state - Current walk state |
| 215 | * |
| 216 | * RETURN: Status |
| 217 | * |
| 218 | * DESCRIPTION: Concatenate two objects OF THE SAME TYPE. |
| 219 | * |
| 220 | ******************************************************************************/ |
| 221 | |
| 222 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 223 | acpi_ex_do_concatenate(union acpi_operand_object *operand0, |
| 224 | union acpi_operand_object *operand1, |
| 225 | union acpi_operand_object **actual_return_desc, |
| 226 | struct acpi_walk_state *walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 228 | union acpi_operand_object *local_operand1 = operand1; |
| 229 | union acpi_operand_object *return_desc; |
| 230 | char *new_buf; |
| 231 | acpi_status status; |
| 232 | acpi_size new_length; |
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_FUNCTION_TRACE("ex_do_concatenate"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
| 236 | /* |
| 237 | * Convert the second operand if necessary. The first operand |
| 238 | * determines the type of the second operand, (See the Data Types |
| 239 | * section of the ACPI specification.) Both object types are |
| 240 | * guaranteed to be either Integer/String/Buffer by the operand |
| 241 | * resolution mechanism. |
| 242 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 243 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | case ACPI_TYPE_INTEGER: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 245 | status = |
| 246 | acpi_ex_convert_to_integer(operand1, &local_operand1, 16); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | break; |
| 248 | |
| 249 | case ACPI_TYPE_STRING: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 250 | status = acpi_ex_convert_to_string(operand1, &local_operand1, |
| 251 | ACPI_IMPLICIT_CONVERT_HEX); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | break; |
| 253 | |
| 254 | case ACPI_TYPE_BUFFER: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 255 | status = acpi_ex_convert_to_buffer(operand1, &local_operand1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | break; |
| 257 | |
| 258 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 259 | ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", |
| 260 | ACPI_GET_OBJECT_TYPE(operand0))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | status = AE_AML_INTERNAL; |
| 262 | } |
| 263 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 264 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | goto cleanup; |
| 266 | } |
| 267 | |
| 268 | /* |
| 269 | * Both operands are now known to be the same object type |
| 270 | * (Both are Integer, String, or Buffer), and we can now perform the |
| 271 | * concatenation. |
| 272 | */ |
| 273 | |
| 274 | /* |
| 275 | * There are three cases to handle: |
| 276 | * |
| 277 | * 1) Two Integers concatenated to produce a new Buffer |
| 278 | * 2) Two Strings concatenated to produce a new String |
| 279 | * 3) Two Buffers concatenated to produce a new Buffer |
| 280 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 281 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | case ACPI_TYPE_INTEGER: |
| 283 | |
| 284 | /* Result of two Integers is a Buffer */ |
| 285 | /* Need enough buffer space for two integers */ |
| 286 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 287 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
| 288 | ACPI_MUL_2 |
| 289 | (acpi_gbl_integer_byte_width)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | if (!return_desc) { |
| 291 | status = AE_NO_MEMORY; |
| 292 | goto cleanup; |
| 293 | } |
| 294 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 295 | new_buf = (char *)return_desc->buffer.pointer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | /* Copy the first integer, LSB first */ |
| 298 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 299 | ACPI_MEMCPY(new_buf, |
| 300 | &operand0->integer.value, |
| 301 | acpi_gbl_integer_byte_width); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* Copy the second integer (LSB first) after the first */ |
| 304 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 305 | ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width, |
| 306 | &local_operand1->integer.value, |
| 307 | acpi_gbl_integer_byte_width); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | break; |
| 309 | |
| 310 | case ACPI_TYPE_STRING: |
| 311 | |
| 312 | /* Result of two Strings is a String */ |
| 313 | |
| 314 | new_length = (acpi_size) operand0->string.length + |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 315 | (acpi_size) local_operand1->string.length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | if (new_length > ACPI_MAX_STRING_CONVERSION) { |
| 317 | status = AE_AML_STRING_LIMIT; |
| 318 | goto cleanup; |
| 319 | } |
| 320 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 321 | return_desc = acpi_ut_create_string_object(new_length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | if (!return_desc) { |
| 323 | status = AE_NO_MEMORY; |
| 324 | goto cleanup; |
| 325 | } |
| 326 | |
| 327 | new_buf = return_desc->string.pointer; |
| 328 | |
| 329 | /* Concatenate the strings */ |
| 330 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 331 | ACPI_STRCPY(new_buf, operand0->string.pointer); |
| 332 | ACPI_STRCPY(new_buf + operand0->string.length, |
| 333 | local_operand1->string.pointer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | break; |
| 335 | |
| 336 | case ACPI_TYPE_BUFFER: |
| 337 | |
| 338 | /* Result of two Buffers is a Buffer */ |
| 339 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 340 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
| 341 | operand0->buffer. |
| 342 | length + |
| 343 | (acpi_size) |
| 344 | local_operand1-> |
| 345 | buffer.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | if (!return_desc) { |
| 347 | status = AE_NO_MEMORY; |
| 348 | goto cleanup; |
| 349 | } |
| 350 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 351 | new_buf = (char *)return_desc->buffer.pointer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
| 353 | /* Concatenate the buffers */ |
| 354 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 355 | ACPI_MEMCPY(new_buf, |
| 356 | operand0->buffer.pointer, operand0->buffer.length); |
| 357 | ACPI_MEMCPY(new_buf + operand0->buffer.length, |
| 358 | local_operand1->buffer.pointer, |
| 359 | local_operand1->buffer.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | break; |
| 361 | |
| 362 | default: |
| 363 | |
| 364 | /* Invalid object type, should not happen here */ |
| 365 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 366 | ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", |
| 367 | ACPI_GET_OBJECT_TYPE(operand0))); |
| 368 | status = AE_AML_INTERNAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | goto cleanup; |
| 370 | } |
| 371 | |
| 372 | *actual_return_desc = return_desc; |
| 373 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 374 | cleanup: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | if (local_operand1 != operand1) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 376 | acpi_ut_remove_reference(local_operand1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 378 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | } |
| 380 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | /******************************************************************************* |
| 382 | * |
| 383 | * FUNCTION: acpi_ex_do_math_op |
| 384 | * |
| 385 | * PARAMETERS: Opcode - AML opcode |
| 386 | * Integer0 - Integer operand #0 |
| 387 | * Integer1 - Integer operand #1 |
| 388 | * |
| 389 | * RETURN: Integer result of the operation |
| 390 | * |
| 391 | * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the |
| 392 | * math functions here is to prevent a lot of pointer dereferencing |
| 393 | * to obtain the operands. |
| 394 | * |
| 395 | ******************************************************************************/ |
| 396 | |
| 397 | acpi_integer |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 398 | acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | { |
| 400 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 401 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | |
| 403 | switch (opcode) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 404 | case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | |
| 406 | return (integer0 + integer1); |
| 407 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 408 | case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | |
| 410 | return (integer0 & integer1); |
| 411 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 412 | case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | |
| 414 | return (~(integer0 & integer1)); |
| 415 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 416 | case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | |
| 418 | return (integer0 | integer1); |
| 419 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 420 | case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | |
| 422 | return (~(integer0 | integer1)); |
| 423 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 424 | case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | |
| 426 | return (integer0 ^ integer1); |
| 427 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 428 | case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | |
| 430 | return (integer0 * integer1); |
| 431 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 432 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | |
| 434 | return (integer0 << integer1); |
| 435 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 436 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | |
| 438 | return (integer0 >> integer1); |
| 439 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 440 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | |
| 442 | return (integer0 - integer1); |
| 443 | |
| 444 | default: |
| 445 | |
| 446 | return (0); |
| 447 | } |
| 448 | } |
| 449 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | /******************************************************************************* |
| 451 | * |
| 452 | * FUNCTION: acpi_ex_do_logical_numeric_op |
| 453 | * |
| 454 | * PARAMETERS: Opcode - AML opcode |
| 455 | * Integer0 - Integer operand #0 |
| 456 | * Integer1 - Integer operand #1 |
| 457 | * logical_result - TRUE/FALSE result of the operation |
| 458 | * |
| 459 | * RETURN: Status |
| 460 | * |
| 461 | * DESCRIPTION: Execute a logical "Numeric" AML opcode. For these Numeric |
| 462 | * operators (LAnd and LOr), both operands must be integers. |
| 463 | * |
| 464 | * Note: cleanest machine code seems to be produced by the code |
| 465 | * below, rather than using statements of the form: |
| 466 | * Result = (Integer0 && Integer1); |
| 467 | * |
| 468 | ******************************************************************************/ |
| 469 | |
| 470 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 471 | acpi_ex_do_logical_numeric_op(u16 opcode, |
| 472 | acpi_integer integer0, |
| 473 | acpi_integer integer1, u8 * logical_result) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 475 | acpi_status status = AE_OK; |
| 476 | u8 local_result = FALSE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 478 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | |
| 480 | switch (opcode) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 481 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | |
| 483 | if (integer0 && integer1) { |
| 484 | local_result = TRUE; |
| 485 | } |
| 486 | break; |
| 487 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 488 | case AML_LOR_OP: /* LOr (Integer0, Integer1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | |
| 490 | if (integer0 || integer1) { |
| 491 | local_result = TRUE; |
| 492 | } |
| 493 | break; |
| 494 | |
| 495 | default: |
| 496 | status = AE_AML_INTERNAL; |
| 497 | break; |
| 498 | } |
| 499 | |
| 500 | /* Return the logical result and status */ |
| 501 | |
| 502 | *logical_result = local_result; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 503 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | } |
| 505 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | /******************************************************************************* |
| 507 | * |
| 508 | * FUNCTION: acpi_ex_do_logical_op |
| 509 | * |
| 510 | * PARAMETERS: Opcode - AML opcode |
| 511 | * Operand0 - operand #0 |
| 512 | * Operand1 - operand #1 |
| 513 | * logical_result - TRUE/FALSE result of the operation |
| 514 | * |
| 515 | * RETURN: Status |
| 516 | * |
| 517 | * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the |
| 518 | * functions here is to prevent a lot of pointer dereferencing |
| 519 | * to obtain the operands and to simplify the generation of the |
| 520 | * logical value. For the Numeric operators (LAnd and LOr), both |
| 521 | * operands must be integers. For the other logical operators, |
| 522 | * operands can be any combination of Integer/String/Buffer. The |
| 523 | * first operand determines the type to which the second operand |
| 524 | * will be converted. |
| 525 | * |
| 526 | * Note: cleanest machine code seems to be produced by the code |
| 527 | * below, rather than using statements of the form: |
| 528 | * Result = (Operand0 == Operand1); |
| 529 | * |
| 530 | ******************************************************************************/ |
| 531 | |
| 532 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 533 | acpi_ex_do_logical_op(u16 opcode, |
| 534 | union acpi_operand_object *operand0, |
| 535 | union acpi_operand_object *operand1, u8 * logical_result) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 537 | union acpi_operand_object *local_operand1 = operand1; |
| 538 | acpi_integer integer0; |
| 539 | acpi_integer integer1; |
| 540 | u32 length0; |
| 541 | u32 length1; |
| 542 | acpi_status status = AE_OK; |
| 543 | u8 local_result = FALSE; |
| 544 | int compare; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 546 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | |
| 548 | /* |
| 549 | * Convert the second operand if necessary. The first operand |
| 550 | * determines the type of the second operand, (See the Data Types |
| 551 | * section of the ACPI 3.0+ specification.) Both object types are |
| 552 | * guaranteed to be either Integer/String/Buffer by the operand |
| 553 | * resolution mechanism. |
| 554 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 555 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | case ACPI_TYPE_INTEGER: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 557 | status = |
| 558 | acpi_ex_convert_to_integer(operand1, &local_operand1, 16); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | break; |
| 560 | |
| 561 | case ACPI_TYPE_STRING: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 562 | status = acpi_ex_convert_to_string(operand1, &local_operand1, |
| 563 | ACPI_IMPLICIT_CONVERT_HEX); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | break; |
| 565 | |
| 566 | case ACPI_TYPE_BUFFER: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 567 | status = acpi_ex_convert_to_buffer(operand1, &local_operand1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | break; |
| 569 | |
| 570 | default: |
| 571 | status = AE_AML_INTERNAL; |
| 572 | break; |
| 573 | } |
| 574 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 575 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | goto cleanup; |
| 577 | } |
| 578 | |
| 579 | /* |
| 580 | * Two cases: 1) Both Integers, 2) Both Strings or Buffers |
| 581 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 582 | if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | /* |
| 584 | * 1) Both operands are of type integer |
| 585 | * Note: local_operand1 may have changed above |
| 586 | */ |
| 587 | integer0 = operand0->integer.value; |
| 588 | integer1 = local_operand1->integer.value; |
| 589 | |
| 590 | switch (opcode) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 591 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | |
| 593 | if (integer0 == integer1) { |
| 594 | local_result = TRUE; |
| 595 | } |
| 596 | break; |
| 597 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 598 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | |
| 600 | if (integer0 > integer1) { |
| 601 | local_result = TRUE; |
| 602 | } |
| 603 | break; |
| 604 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 605 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | |
| 607 | if (integer0 < integer1) { |
| 608 | local_result = TRUE; |
| 609 | } |
| 610 | break; |
| 611 | |
| 612 | default: |
| 613 | status = AE_AML_INTERNAL; |
| 614 | break; |
| 615 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 616 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | /* |
| 618 | * 2) Both operands are Strings or both are Buffers |
| 619 | * Note: Code below takes advantage of common Buffer/String |
| 620 | * object fields. local_operand1 may have changed above. Use |
| 621 | * memcmp to handle nulls in buffers. |
| 622 | */ |
| 623 | length0 = operand0->buffer.length; |
| 624 | length1 = local_operand1->buffer.length; |
| 625 | |
| 626 | /* Lexicographic compare: compare the data bytes */ |
| 627 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 628 | compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, |
| 629 | (const char *)local_operand1->buffer. |
| 630 | pointer, |
| 631 | (length0 > length1) ? length1 : length0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | |
| 633 | switch (opcode) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 634 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | |
| 636 | /* Length and all bytes must be equal */ |
| 637 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 638 | if ((length0 == length1) && (compare == 0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 639 | /* Length and all bytes match ==> TRUE */ |
| 640 | |
| 641 | local_result = TRUE; |
| 642 | } |
| 643 | break; |
| 644 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 645 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | |
| 647 | if (compare > 0) { |
| 648 | local_result = TRUE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 649 | goto cleanup; /* TRUE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | } |
| 651 | if (compare < 0) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 652 | goto cleanup; /* FALSE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | /* Bytes match (to shortest length), compare lengths */ |
| 656 | |
| 657 | if (length0 > length1) { |
| 658 | local_result = TRUE; |
| 659 | } |
| 660 | break; |
| 661 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 662 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 663 | |
| 664 | if (compare > 0) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 665 | goto cleanup; /* FALSE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | } |
| 667 | if (compare < 0) { |
| 668 | local_result = TRUE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 669 | goto cleanup; /* TRUE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | } |
| 671 | |
| 672 | /* Bytes match (to shortest length), compare lengths */ |
| 673 | |
| 674 | if (length0 < length1) { |
| 675 | local_result = TRUE; |
| 676 | } |
| 677 | break; |
| 678 | |
| 679 | default: |
| 680 | status = AE_AML_INTERNAL; |
| 681 | break; |
| 682 | } |
| 683 | } |
| 684 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 685 | cleanup: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | |
| 687 | /* New object was created if implicit conversion performed - delete */ |
| 688 | |
| 689 | if (local_operand1 != operand1) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 690 | acpi_ut_remove_reference(local_operand1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | /* Return the logical result and status */ |
| 694 | |
| 695 | *logical_result = local_result; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 696 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | } |