aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exstoren.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exstoren.c')
-rw-r--r--drivers/acpi/executer/exstoren.c121
1 files changed, 61 insertions, 60 deletions
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index 433588ab432a..382f63c14ea1 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -43,15 +43,12 @@
43 * POSSIBILITY OF SUCH DAMAGES. 43 * POSSIBILITY OF SUCH DAMAGES.
44 */ 44 */
45 45
46
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
49#include <acpi/amlcode.h> 48#include <acpi/amlcode.h>
50 49
51
52#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exstoren") 51ACPI_MODULE_NAME("exstoren")
54
55 52
56/******************************************************************************* 53/*******************************************************************************
57 * 54 *
@@ -67,19 +64,15 @@
67 * it and return the actual object in the source_desc_ptr. 64 * it and return the actual object in the source_desc_ptr.
68 * 65 *
69 ******************************************************************************/ 66 ******************************************************************************/
70
71acpi_status 67acpi_status
72acpi_ex_resolve_object ( 68acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
73 union acpi_operand_object **source_desc_ptr, 69 acpi_object_type target_type,
74 acpi_object_type target_type, 70 struct acpi_walk_state *walk_state)
75 struct acpi_walk_state *walk_state)
76{ 71{
77 union acpi_operand_object *source_desc = *source_desc_ptr; 72 union acpi_operand_object *source_desc = *source_desc_ptr;
78 acpi_status status = AE_OK; 73 acpi_status status = AE_OK;
79
80
81 ACPI_FUNCTION_TRACE ("ex_resolve_object");
82 74
75 ACPI_FUNCTION_TRACE("ex_resolve_object");
83 76
84 /* Ensure we have a Target that can be stored to */ 77 /* Ensure we have a Target that can be stored to */
85 78
@@ -102,11 +95,14 @@ acpi_ex_resolve_object (
102 * are all essentially the same. This case handles the 95 * are all essentially the same. This case handles the
103 * "interchangeable" types Integer, String, and Buffer. 96 * "interchangeable" types Integer, String, and Buffer.
104 */ 97 */
105 if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) { 98 if (ACPI_GET_OBJECT_TYPE(source_desc) ==
99 ACPI_TYPE_LOCAL_REFERENCE) {
106 /* Resolve a reference object first */ 100 /* Resolve a reference object first */
107 101
108 status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state); 102 status =
109 if (ACPI_FAILURE (status)) { 103 acpi_ex_resolve_to_value(source_desc_ptr,
104 walk_state);
105 if (ACPI_FAILURE(status)) {
110 break; 106 break;
111 } 107 }
112 } 108 }
@@ -119,31 +115,32 @@ acpi_ex_resolve_object (
119 115
120 /* Must have a Integer, Buffer, or String */ 116 /* Must have a Integer, Buffer, or String */
121 117
122 if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && 118 if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
123 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && 119 (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
124 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && 120 (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
125 !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { 121 !((ACPI_GET_OBJECT_TYPE(source_desc) ==
122 ACPI_TYPE_LOCAL_REFERENCE)
123 && (source_desc->reference.opcode == AML_LOAD_OP))) {
126 /* Conversion successful but still not a valid type */ 124 /* Conversion successful but still not a valid type */
127 125
128 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 126 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
129 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", 127 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
130 acpi_ut_get_object_type_name (source_desc), 128 acpi_ut_get_object_type_name
131 acpi_ut_get_type_name (target_type))); 129 (source_desc),
130 acpi_ut_get_type_name(target_type)));
132 status = AE_AML_OPERAND_TYPE; 131 status = AE_AML_OPERAND_TYPE;
133 } 132 }
134 break; 133 break;
135 134
136
137 case ACPI_TYPE_LOCAL_ALIAS: 135 case ACPI_TYPE_LOCAL_ALIAS:
138 case ACPI_TYPE_LOCAL_METHOD_ALIAS: 136 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
139 137
140 /* Aliases are resolved by acpi_ex_prep_operands */ 138 /* Aliases are resolved by acpi_ex_prep_operands */
141 139
142 ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); 140 ACPI_REPORT_ERROR(("Store into Alias - should never happen\n"));
143 status = AE_AML_INTERNAL; 141 status = AE_AML_INTERNAL;
144 break; 142 break;
145 143
146
147 case ACPI_TYPE_PACKAGE: 144 case ACPI_TYPE_PACKAGE:
148 default: 145 default:
149 146
@@ -154,10 +151,9 @@ acpi_ex_resolve_object (
154 break; 151 break;
155 } 152 }
156 153
157 return_ACPI_STATUS (status); 154 return_ACPI_STATUS(status);
158} 155}
159 156
160
161/******************************************************************************* 157/*******************************************************************************
162 * 158 *
163 * FUNCTION: acpi_ex_store_object_to_object 159 * FUNCTION: acpi_ex_store_object_to_object
@@ -194,18 +190,15 @@ acpi_ex_resolve_object (
194 ******************************************************************************/ 190 ******************************************************************************/
195 191
196acpi_status 192acpi_status
197acpi_ex_store_object_to_object ( 193acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
198 union acpi_operand_object *source_desc, 194 union acpi_operand_object *dest_desc,
199 union acpi_operand_object *dest_desc, 195 union acpi_operand_object **new_desc,
200 union acpi_operand_object **new_desc, 196 struct acpi_walk_state *walk_state)
201 struct acpi_walk_state *walk_state)
202{ 197{
203 union acpi_operand_object *actual_src_desc; 198 union acpi_operand_object *actual_src_desc;
204 acpi_status status = AE_OK; 199 acpi_status status = AE_OK;
205
206
207 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc);
208 200
201 ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
209 202
210 actual_src_desc = source_desc; 203 actual_src_desc = source_desc;
211 if (!dest_desc) { 204 if (!dest_desc) {
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object (
214 * package element), so we can simply copy the source object 207 * package element), so we can simply copy the source object
215 * creating a new destination object 208 * creating a new destination object
216 */ 209 */
217 status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state); 210 status =
218 return_ACPI_STATUS (status); 211 acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc,
212 walk_state);
213 return_ACPI_STATUS(status);
219 } 214 }
220 215
221 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) { 216 if (ACPI_GET_OBJECT_TYPE(source_desc) !=
217 ACPI_GET_OBJECT_TYPE(dest_desc)) {
222 /* 218 /*
223 * The source type does not match the type of the destination. 219 * The source type does not match the type of the destination.
224 * Perform the "implicit conversion" of the source to the current type 220 * Perform the "implicit conversion" of the source to the current type
@@ -228,10 +224,13 @@ acpi_ex_store_object_to_object (
228 * Otherwise, actual_src_desc is a temporary object to hold the 224 * Otherwise, actual_src_desc is a temporary object to hold the
229 * converted object. 225 * converted object.
230 */ 226 */
231 status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc), 227 status =
232 source_desc, &actual_src_desc, walk_state); 228 acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
233 if (ACPI_FAILURE (status)) { 229 (dest_desc), source_desc,
234 return_ACPI_STATUS (status); 230 &actual_src_desc,
231 walk_state);
232 if (ACPI_FAILURE(status)) {
233 return_ACPI_STATUS(status);
235 } 234 }
236 235
237 if (source_desc == actual_src_desc) { 236 if (source_desc == actual_src_desc) {
@@ -240,7 +239,7 @@ acpi_ex_store_object_to_object (
240 * new object. 239 * new object.
241 */ 240 */
242 *new_desc = source_desc; 241 *new_desc = source_desc;
243 return_ACPI_STATUS (AE_OK); 242 return_ACPI_STATUS(AE_OK);
244 } 243 }
245 } 244 }
246 245
@@ -248,38 +247,42 @@ acpi_ex_store_object_to_object (
248 * We now have two objects of identical types, and we can perform a 247 * We now have two objects of identical types, and we can perform a
249 * copy of the *value* of the source object. 248 * copy of the *value* of the source object.
250 */ 249 */
251 switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { 250 switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
252 case ACPI_TYPE_INTEGER: 251 case ACPI_TYPE_INTEGER:
253 252
254 dest_desc->integer.value = actual_src_desc->integer.value; 253 dest_desc->integer.value = actual_src_desc->integer.value;
255 254
256 /* Truncate value if we are executing from a 32-bit ACPI table */ 255 /* Truncate value if we are executing from a 32-bit ACPI table */
257 256
258 acpi_ex_truncate_for32bit_table (dest_desc); 257 acpi_ex_truncate_for32bit_table(dest_desc);
259 break; 258 break;
260 259
261 case ACPI_TYPE_STRING: 260 case ACPI_TYPE_STRING:
262 261
263 status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc); 262 status =
263 acpi_ex_store_string_to_string(actual_src_desc, dest_desc);
264 break; 264 break;
265 265
266 case ACPI_TYPE_BUFFER: 266 case ACPI_TYPE_BUFFER:
267 267
268 status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc); 268 status =
269 acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc);
269 break; 270 break;
270 271
271 case ACPI_TYPE_PACKAGE: 272 case ACPI_TYPE_PACKAGE:
272 273
273 status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc, 274 status =
274 walk_state); 275 acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
276 walk_state);
275 break; 277 break;
276 278
277 default: 279 default:
278 /* 280 /*
279 * All other types come here. 281 * All other types come here.
280 */ 282 */
281 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n", 283 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
282 acpi_ut_get_object_type_name (dest_desc))); 284 "Store into type %s not implemented\n",
285 acpi_ut_get_object_type_name(dest_desc)));
283 286
284 status = AE_NOT_IMPLEMENTED; 287 status = AE_NOT_IMPLEMENTED;
285 break; 288 break;
@@ -288,11 +291,9 @@ acpi_ex_store_object_to_object (
288 if (actual_src_desc != source_desc) { 291 if (actual_src_desc != source_desc) {
289 /* Delete the intermediate (temporary) source object */ 292 /* Delete the intermediate (temporary) source object */
290 293
291 acpi_ut_remove_reference (actual_src_desc); 294 acpi_ut_remove_reference(actual_src_desc);
292 } 295 }
293 296
294 *new_desc = dest_desc; 297 *new_desc = dest_desc;
295 return_ACPI_STATUS (status); 298 return_ACPI_STATUS(status);
296} 299}
297
298