diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/executer/exoparg1.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exoparg1.c')
-rw-r--r-- | drivers/acpi/executer/exoparg1.c | 555 |
1 files changed, 267 insertions, 288 deletions
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 48c30f800083..97e34542f5e4 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
@@ -50,10 +49,8 @@ | |||
50 | #include <acpi/amlcode.h> | 49 | #include <acpi/amlcode.h> |
51 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exoparg1") | 53 | ACPI_MODULE_NAME("exoparg1") |
56 | |||
57 | 54 | ||
58 | /*! | 55 | /*! |
59 | * Naming convention for AML interpreter execution routines. | 56 | * Naming convention for AML interpreter execution routines. |
@@ -76,7 +73,6 @@ | |||
76 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 73 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
77 | * fully resolved operands. | 74 | * fully resolved operands. |
78 | !*/ | 75 | !*/ |
79 | |||
80 | /******************************************************************************* | 76 | /******************************************************************************* |
81 | * | 77 | * |
82 | * FUNCTION: acpi_ex_opcode_0A_0T_1R | 78 | * FUNCTION: acpi_ex_opcode_0A_0T_1R |
@@ -88,61 +84,53 @@ | |||
88 | * DESCRIPTION: Execute operator with no operands, one return value | 84 | * DESCRIPTION: Execute operator with no operands, one return value |
89 | * | 85 | * |
90 | ******************************************************************************/ | 86 | ******************************************************************************/ |
91 | 87 | acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |
92 | acpi_status | ||
93 | acpi_ex_opcode_0A_0T_1R ( | ||
94 | struct acpi_walk_state *walk_state) | ||
95 | { | 88 | { |
96 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
97 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
98 | |||
99 | |||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", | ||
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
102 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | ||
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
103 | 94 | ||
104 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
105 | 96 | ||
106 | switch (walk_state->opcode) { | 97 | switch (walk_state->opcode) { |
107 | case AML_TIMER_OP: /* Timer () */ | 98 | case AML_TIMER_OP: /* Timer () */ |
108 | 99 | ||
109 | /* Create a return object of type Integer */ | 100 | /* Create a return object of type Integer */ |
110 | 101 | ||
111 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 102 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
112 | if (!return_desc) { | 103 | if (!return_desc) { |
113 | status = AE_NO_MEMORY; | 104 | status = AE_NO_MEMORY; |
114 | goto cleanup; | 105 | goto cleanup; |
115 | } | 106 | } |
116 | #if ACPI_MACHINE_WIDTH != 16 | 107 | #if ACPI_MACHINE_WIDTH != 16 |
117 | return_desc->integer.value = acpi_os_get_timer (); | 108 | return_desc->integer.value = acpi_os_get_timer(); |
118 | #endif | 109 | #endif |
119 | break; | 110 | break; |
120 | 111 | ||
121 | default: /* Unknown opcode */ | 112 | default: /* Unknown opcode */ |
122 | 113 | ||
123 | ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", | 114 | ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
124 | walk_state->opcode)); | ||
125 | status = AE_AML_BAD_OPCODE; | 115 | status = AE_AML_BAD_OPCODE; |
126 | break; | 116 | break; |
127 | } | 117 | } |
128 | 118 | ||
129 | cleanup: | 119 | cleanup: |
130 | 120 | ||
131 | /* Delete return object on error */ | 121 | /* Delete return object on error */ |
132 | 122 | ||
133 | if ((ACPI_FAILURE (status)) || walk_state->result_obj) { | 123 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { |
134 | acpi_ut_remove_reference (return_desc); | 124 | acpi_ut_remove_reference(return_desc); |
135 | } | 125 | } else { |
136 | else { | ||
137 | /* Save the return value */ | 126 | /* Save the return value */ |
138 | 127 | ||
139 | walk_state->result_obj = return_desc; | 128 | walk_state->result_obj = return_desc; |
140 | } | 129 | } |
141 | 130 | ||
142 | return_ACPI_STATUS (status); | 131 | return_ACPI_STATUS(status); |
143 | } | 132 | } |
144 | 133 | ||
145 | |||
146 | /******************************************************************************* | 134 | /******************************************************************************* |
147 | * | 135 | * |
148 | * FUNCTION: acpi_ex_opcode_1A_0T_0R | 136 | * FUNCTION: acpi_ex_opcode_1A_0T_0R |
@@ -156,69 +144,58 @@ cleanup: | |||
156 | * | 144 | * |
157 | ******************************************************************************/ | 145 | ******************************************************************************/ |
158 | 146 | ||
159 | acpi_status | 147 | acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) |
160 | acpi_ex_opcode_1A_0T_0R ( | ||
161 | struct acpi_walk_state *walk_state) | ||
162 | { | 148 | { |
163 | union acpi_operand_object **operand = &walk_state->operands[0]; | 149 | union acpi_operand_object **operand = &walk_state->operands[0]; |
164 | acpi_status status = AE_OK; | 150 | acpi_status status = AE_OK; |
165 | |||
166 | |||
167 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", | ||
168 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
169 | 151 | ||
152 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | ||
153 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
170 | 154 | ||
171 | /* Examine the AML opcode */ | 155 | /* Examine the AML opcode */ |
172 | 156 | ||
173 | switch (walk_state->opcode) { | 157 | switch (walk_state->opcode) { |
174 | case AML_RELEASE_OP: /* Release (mutex_object) */ | 158 | case AML_RELEASE_OP: /* Release (mutex_object) */ |
175 | 159 | ||
176 | status = acpi_ex_release_mutex (operand[0], walk_state); | 160 | status = acpi_ex_release_mutex(operand[0], walk_state); |
177 | break; | 161 | break; |
178 | 162 | ||
163 | case AML_RESET_OP: /* Reset (event_object) */ | ||
179 | 164 | ||
180 | case AML_RESET_OP: /* Reset (event_object) */ | 165 | status = acpi_ex_system_reset_event(operand[0]); |
181 | |||
182 | status = acpi_ex_system_reset_event (operand[0]); | ||
183 | break; | 166 | break; |
184 | 167 | ||
168 | case AML_SIGNAL_OP: /* Signal (event_object) */ | ||
185 | 169 | ||
186 | case AML_SIGNAL_OP: /* Signal (event_object) */ | 170 | status = acpi_ex_system_signal_event(operand[0]); |
187 | |||
188 | status = acpi_ex_system_signal_event (operand[0]); | ||
189 | break; | 171 | break; |
190 | 172 | ||
173 | case AML_SLEEP_OP: /* Sleep (msec_time) */ | ||
191 | 174 | ||
192 | case AML_SLEEP_OP: /* Sleep (msec_time) */ | 175 | status = acpi_ex_system_do_suspend(operand[0]->integer.value); |
193 | |||
194 | status = acpi_ex_system_do_suspend (operand[0]->integer.value); | ||
195 | break; | 176 | break; |
196 | 177 | ||
178 | case AML_STALL_OP: /* Stall (usec_time) */ | ||
197 | 179 | ||
198 | case AML_STALL_OP: /* Stall (usec_time) */ | 180 | status = |
199 | 181 | acpi_ex_system_do_stall((u32) operand[0]->integer.value); | |
200 | status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value); | ||
201 | break; | 182 | break; |
202 | 183 | ||
184 | case AML_UNLOAD_OP: /* Unload (Handle) */ | ||
203 | 185 | ||
204 | case AML_UNLOAD_OP: /* Unload (Handle) */ | 186 | status = acpi_ex_unload_table(operand[0]); |
205 | |||
206 | status = acpi_ex_unload_table (operand[0]); | ||
207 | break; | 187 | break; |
208 | 188 | ||
189 | default: /* Unknown opcode */ | ||
209 | 190 | ||
210 | default: /* Unknown opcode */ | 191 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
211 | |||
212 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", | ||
213 | walk_state->opcode)); | ||
214 | status = AE_AML_BAD_OPCODE; | 192 | status = AE_AML_BAD_OPCODE; |
215 | break; | 193 | break; |
216 | } | 194 | } |
217 | 195 | ||
218 | return_ACPI_STATUS (status); | 196 | return_ACPI_STATUS(status); |
219 | } | 197 | } |
220 | 198 | ||
221 | |||
222 | /******************************************************************************* | 199 | /******************************************************************************* |
223 | * | 200 | * |
224 | * FUNCTION: acpi_ex_opcode_1A_1T_0R | 201 | * FUNCTION: acpi_ex_opcode_1A_1T_0R |
@@ -232,41 +209,34 @@ acpi_ex_opcode_1A_0T_0R ( | |||
232 | * | 209 | * |
233 | ******************************************************************************/ | 210 | ******************************************************************************/ |
234 | 211 | ||
235 | acpi_status | 212 | acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) |
236 | acpi_ex_opcode_1A_1T_0R ( | ||
237 | struct acpi_walk_state *walk_state) | ||
238 | { | 213 | { |
239 | acpi_status status = AE_OK; | 214 | acpi_status status = AE_OK; |
240 | union acpi_operand_object **operand = &walk_state->operands[0]; | 215 | union acpi_operand_object **operand = &walk_state->operands[0]; |
241 | |||
242 | |||
243 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", | ||
244 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
245 | 216 | ||
217 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | ||
218 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
246 | 219 | ||
247 | /* Examine the AML opcode */ | 220 | /* Examine the AML opcode */ |
248 | 221 | ||
249 | switch (walk_state->opcode) { | 222 | switch (walk_state->opcode) { |
250 | case AML_LOAD_OP: | 223 | case AML_LOAD_OP: |
251 | 224 | ||
252 | status = acpi_ex_load_op (operand[0], operand[1], walk_state); | 225 | status = acpi_ex_load_op(operand[0], operand[1], walk_state); |
253 | break; | 226 | break; |
254 | 227 | ||
255 | default: /* Unknown opcode */ | 228 | default: /* Unknown opcode */ |
256 | 229 | ||
257 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", | 230 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); |
258 | walk_state->opcode)); | ||
259 | status = AE_AML_BAD_OPCODE; | 231 | status = AE_AML_BAD_OPCODE; |
260 | goto cleanup; | 232 | goto cleanup; |
261 | } | 233 | } |
262 | 234 | ||
235 | cleanup: | ||
263 | 236 | ||
264 | cleanup: | 237 | return_ACPI_STATUS(status); |
265 | |||
266 | return_ACPI_STATUS (status); | ||
267 | } | 238 | } |
268 | 239 | ||
269 | |||
270 | /******************************************************************************* | 240 | /******************************************************************************* |
271 | * | 241 | * |
272 | * FUNCTION: acpi_ex_opcode_1A_1T_1R | 242 | * FUNCTION: acpi_ex_opcode_1A_1T_1R |
@@ -280,23 +250,19 @@ cleanup: | |||
280 | * | 250 | * |
281 | ******************************************************************************/ | 251 | ******************************************************************************/ |
282 | 252 | ||
283 | acpi_status | 253 | acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) |
284 | acpi_ex_opcode_1A_1T_1R ( | ||
285 | struct acpi_walk_state *walk_state) | ||
286 | { | 254 | { |
287 | acpi_status status = AE_OK; | 255 | acpi_status status = AE_OK; |
288 | union acpi_operand_object **operand = &walk_state->operands[0]; | 256 | union acpi_operand_object **operand = &walk_state->operands[0]; |
289 | union acpi_operand_object *return_desc = NULL; | 257 | union acpi_operand_object *return_desc = NULL; |
290 | union acpi_operand_object *return_desc2 = NULL; | 258 | union acpi_operand_object *return_desc2 = NULL; |
291 | u32 temp32; | 259 | u32 temp32; |
292 | u32 i; | 260 | u32 i; |
293 | acpi_integer power_of_ten; | 261 | acpi_integer power_of_ten; |
294 | acpi_integer digit; | 262 | acpi_integer digit; |
295 | 263 | ||
296 | 264 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | |
297 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", | 265 | acpi_ps_get_opcode_name(walk_state->opcode)); |
298 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
299 | |||
300 | 266 | ||
301 | /* Examine the AML opcode */ | 267 | /* Examine the AML opcode */ |
302 | 268 | ||
@@ -310,20 +276,19 @@ acpi_ex_opcode_1A_1T_1R ( | |||
310 | 276 | ||
311 | /* Create a return object of type Integer for these opcodes */ | 277 | /* Create a return object of type Integer for these opcodes */ |
312 | 278 | ||
313 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 279 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
314 | if (!return_desc) { | 280 | if (!return_desc) { |
315 | status = AE_NO_MEMORY; | 281 | status = AE_NO_MEMORY; |
316 | goto cleanup; | 282 | goto cleanup; |
317 | } | 283 | } |
318 | 284 | ||
319 | switch (walk_state->opcode) { | 285 | switch (walk_state->opcode) { |
320 | case AML_BIT_NOT_OP: /* Not (Operand, Result) */ | 286 | case AML_BIT_NOT_OP: /* Not (Operand, Result) */ |
321 | 287 | ||
322 | return_desc->integer.value = ~operand[0]->integer.value; | 288 | return_desc->integer.value = ~operand[0]->integer.value; |
323 | break; | 289 | break; |
324 | 290 | ||
325 | 291 | case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ | |
326 | case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ | ||
327 | 292 | ||
328 | return_desc->integer.value = operand[0]->integer.value; | 293 | return_desc->integer.value = operand[0]->integer.value; |
329 | 294 | ||
@@ -332,15 +297,14 @@ acpi_ex_opcode_1A_1T_1R ( | |||
332 | * endian unsigned value, so this boundary condition is valid. | 297 | * endian unsigned value, so this boundary condition is valid. |
333 | */ | 298 | */ |
334 | for (temp32 = 0; return_desc->integer.value && | 299 | for (temp32 = 0; return_desc->integer.value && |
335 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { | 300 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { |
336 | return_desc->integer.value >>= 1; | 301 | return_desc->integer.value >>= 1; |
337 | } | 302 | } |
338 | 303 | ||
339 | return_desc->integer.value = temp32; | 304 | return_desc->integer.value = temp32; |
340 | break; | 305 | break; |
341 | 306 | ||
342 | 307 | case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ | |
343 | case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ | ||
344 | 308 | ||
345 | return_desc->integer.value = operand[0]->integer.value; | 309 | return_desc->integer.value = operand[0]->integer.value; |
346 | 310 | ||
@@ -349,18 +313,17 @@ acpi_ex_opcode_1A_1T_1R ( | |||
349 | * endian unsigned value, so this boundary condition is valid. | 313 | * endian unsigned value, so this boundary condition is valid. |
350 | */ | 314 | */ |
351 | for (temp32 = 0; return_desc->integer.value && | 315 | for (temp32 = 0; return_desc->integer.value && |
352 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { | 316 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { |
353 | return_desc->integer.value <<= 1; | 317 | return_desc->integer.value <<= 1; |
354 | } | 318 | } |
355 | 319 | ||
356 | /* Since the bit position is one-based, subtract from 33 (65) */ | 320 | /* Since the bit position is one-based, subtract from 33 (65) */ |
357 | 321 | ||
358 | return_desc->integer.value = temp32 == 0 ? 0 : | 322 | return_desc->integer.value = temp32 == 0 ? 0 : |
359 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 323 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; |
360 | break; | 324 | break; |
361 | 325 | ||
362 | 326 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | |
363 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | ||
364 | 327 | ||
365 | /* | 328 | /* |
366 | * The 64-bit ACPI integer can hold 16 4-bit BCD characters | 329 | * The 64-bit ACPI integer can hold 16 4-bit BCD characters |
@@ -373,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R ( | |||
373 | 336 | ||
374 | /* Convert each BCD digit (each is one nybble wide) */ | 337 | /* Convert each BCD digit (each is one nybble wide) */ |
375 | 338 | ||
376 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 339 | for (i = 0; |
340 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | ||
341 | i++) { | ||
377 | /* Get the least significant 4-bit BCD digit */ | 342 | /* Get the least significant 4-bit BCD digit */ |
378 | 343 | ||
379 | temp32 = ((u32) digit) & 0xF; | 344 | temp32 = ((u32) digit) & 0xF; |
@@ -381,9 +346,9 @@ acpi_ex_opcode_1A_1T_1R ( | |||
381 | /* Check the range of the digit */ | 346 | /* Check the range of the digit */ |
382 | 347 | ||
383 | if (temp32 > 9) { | 348 | if (temp32 > 9) { |
384 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 349 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
385 | "BCD digit too large (not decimal): 0x%X\n", | 350 | "BCD digit too large (not decimal): 0x%X\n", |
386 | temp32)); | 351 | temp32)); |
387 | 352 | ||
388 | status = AE_AML_NUMERIC_OVERFLOW; | 353 | status = AE_AML_NUMERIC_OVERFLOW; |
389 | goto cleanup; | 354 | goto cleanup; |
@@ -391,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
391 | 356 | ||
392 | /* Sum the digit into the result with the current power of 10 */ | 357 | /* Sum the digit into the result with the current power of 10 */ |
393 | 358 | ||
394 | return_desc->integer.value += (((acpi_integer) temp32) * | 359 | return_desc->integer.value += |
395 | power_of_ten); | 360 | (((acpi_integer) temp32) * power_of_ten); |
396 | 361 | ||
397 | /* Shift to next BCD digit */ | 362 | /* Shift to next BCD digit */ |
398 | 363 | ||
@@ -404,45 +369,50 @@ acpi_ex_opcode_1A_1T_1R ( | |||
404 | } | 369 | } |
405 | break; | 370 | break; |
406 | 371 | ||
407 | 372 | case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ | |
408 | case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ | ||
409 | 373 | ||
410 | return_desc->integer.value = 0; | 374 | return_desc->integer.value = 0; |
411 | digit = operand[0]->integer.value; | 375 | digit = operand[0]->integer.value; |
412 | 376 | ||
413 | /* Each BCD digit is one nybble wide */ | 377 | /* Each BCD digit is one nybble wide */ |
414 | 378 | ||
415 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 379 | for (i = 0; |
416 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); | 380 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
381 | i++) { | ||
382 | (void)acpi_ut_short_divide(digit, 10, &digit, | ||
383 | &temp32); | ||
417 | 384 | ||
418 | /* | 385 | /* |
419 | * Insert the BCD digit that resides in the | 386 | * Insert the BCD digit that resides in the |
420 | * remainder from above | 387 | * remainder from above |
421 | */ | 388 | */ |
422 | return_desc->integer.value |= (((acpi_integer) temp32) << | 389 | return_desc->integer.value |= |
423 | ACPI_MUL_4 (i)); | 390 | (((acpi_integer) temp32) << ACPI_MUL_4(i)); |
424 | } | 391 | } |
425 | 392 | ||
426 | /* Overflow if there is any data left in Digit */ | 393 | /* Overflow if there is any data left in Digit */ |
427 | 394 | ||
428 | if (digit > 0) { | 395 | if (digit > 0) { |
429 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 396 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
430 | "Integer too large to convert to BCD: %8.8X%8.8X\n", | 397 | "Integer too large to convert to BCD: %8.8X%8.8X\n", |
431 | ACPI_FORMAT_UINT64 (operand[0]->integer.value))); | 398 | ACPI_FORMAT_UINT64(operand |
399 | [0]-> | ||
400 | integer. | ||
401 | value))); | ||
432 | status = AE_AML_NUMERIC_OVERFLOW; | 402 | status = AE_AML_NUMERIC_OVERFLOW; |
433 | goto cleanup; | 403 | goto cleanup; |
434 | } | 404 | } |
435 | break; | 405 | break; |
436 | 406 | ||
437 | 407 | case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ | |
438 | case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ | ||
439 | 408 | ||
440 | /* | 409 | /* |
441 | * This op is a little strange because the internal return value is | 410 | * This op is a little strange because the internal return value is |
442 | * different than the return value stored in the result descriptor | 411 | * different than the return value stored in the result descriptor |
443 | * (There are really two return values) | 412 | * (There are really two return values) |
444 | */ | 413 | */ |
445 | if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) { | 414 | if ((struct acpi_namespace_node *)operand[0] == |
415 | acpi_gbl_root_node) { | ||
446 | /* | 416 | /* |
447 | * This means that the object does not exist in the namespace, | 417 | * This means that the object does not exist in the namespace, |
448 | * return FALSE | 418 | * return FALSE |
@@ -453,38 +423,38 @@ acpi_ex_opcode_1A_1T_1R ( | |||
453 | 423 | ||
454 | /* Get the object reference, store it, and remove our reference */ | 424 | /* Get the object reference, store it, and remove our reference */ |
455 | 425 | ||
456 | status = acpi_ex_get_object_reference (operand[0], | 426 | status = acpi_ex_get_object_reference(operand[0], |
457 | &return_desc2, walk_state); | 427 | &return_desc2, |
458 | if (ACPI_FAILURE (status)) { | 428 | walk_state); |
429 | if (ACPI_FAILURE(status)) { | ||
459 | goto cleanup; | 430 | goto cleanup; |
460 | } | 431 | } |
461 | 432 | ||
462 | status = acpi_ex_store (return_desc2, operand[1], walk_state); | 433 | status = |
463 | acpi_ut_remove_reference (return_desc2); | 434 | acpi_ex_store(return_desc2, operand[1], walk_state); |
435 | acpi_ut_remove_reference(return_desc2); | ||
464 | 436 | ||
465 | /* The object exists in the namespace, return TRUE */ | 437 | /* The object exists in the namespace, return TRUE */ |
466 | 438 | ||
467 | return_desc->integer.value = ACPI_INTEGER_MAX; | 439 | return_desc->integer.value = ACPI_INTEGER_MAX; |
468 | goto cleanup; | 440 | goto cleanup; |
469 | 441 | ||
470 | |||
471 | default: | 442 | default: |
472 | /* No other opcodes get here */ | 443 | /* No other opcodes get here */ |
473 | break; | 444 | break; |
474 | } | 445 | } |
475 | break; | 446 | break; |
476 | 447 | ||
477 | 448 | case AML_STORE_OP: /* Store (Source, Target) */ | |
478 | case AML_STORE_OP: /* Store (Source, Target) */ | ||
479 | 449 | ||
480 | /* | 450 | /* |
481 | * A store operand is typically a number, string, buffer or lvalue | 451 | * A store operand is typically a number, string, buffer or lvalue |
482 | * Be careful about deleting the source object, | 452 | * Be careful about deleting the source object, |
483 | * since the object itself may have been stored. | 453 | * since the object itself may have been stored. |
484 | */ | 454 | */ |
485 | status = acpi_ex_store (operand[0], operand[1], walk_state); | 455 | status = acpi_ex_store(operand[0], operand[1], walk_state); |
486 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE(status)) { |
487 | return_ACPI_STATUS (status); | 457 | return_ACPI_STATUS(status); |
488 | } | 458 | } |
489 | 459 | ||
490 | /* It is possible that the Store already produced a return object */ | 460 | /* It is possible that the Store already produced a return object */ |
@@ -497,92 +467,84 @@ acpi_ex_opcode_1A_1T_1R ( | |||
497 | * cancel out, and we simply don't do anything. | 467 | * cancel out, and we simply don't do anything. |
498 | */ | 468 | */ |
499 | walk_state->result_obj = operand[0]; | 469 | walk_state->result_obj = operand[0]; |
500 | walk_state->operands[0] = NULL; /* Prevent deletion */ | 470 | walk_state->operands[0] = NULL; /* Prevent deletion */ |
501 | } | 471 | } |
502 | return_ACPI_STATUS (status); | 472 | return_ACPI_STATUS(status); |
503 | |||
504 | 473 | ||
505 | /* | 474 | /* |
506 | * ACPI 2.0 Opcodes | 475 | * ACPI 2.0 Opcodes |
507 | */ | 476 | */ |
508 | case AML_COPY_OP: /* Copy (Source, Target) */ | 477 | case AML_COPY_OP: /* Copy (Source, Target) */ |
509 | 478 | ||
510 | status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc, | 479 | status = |
511 | walk_state); | 480 | acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc, |
481 | walk_state); | ||
512 | break; | 482 | break; |
513 | 483 | ||
484 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ | ||
514 | 485 | ||
515 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ | 486 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
516 | 487 | ACPI_EXPLICIT_CONVERT_DECIMAL); | |
517 | status = acpi_ex_convert_to_string (operand[0], &return_desc, | ||
518 | ACPI_EXPLICIT_CONVERT_DECIMAL); | ||
519 | if (return_desc == operand[0]) { | 488 | if (return_desc == operand[0]) { |
520 | /* No conversion performed, add ref to handle return value */ | 489 | /* No conversion performed, add ref to handle return value */ |
521 | acpi_ut_add_reference (return_desc); | 490 | acpi_ut_add_reference(return_desc); |
522 | } | 491 | } |
523 | break; | 492 | break; |
524 | 493 | ||
494 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ | ||
525 | 495 | ||
526 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ | 496 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
527 | 497 | ACPI_EXPLICIT_CONVERT_HEX); | |
528 | status = acpi_ex_convert_to_string (operand[0], &return_desc, | ||
529 | ACPI_EXPLICIT_CONVERT_HEX); | ||
530 | if (return_desc == operand[0]) { | 498 | if (return_desc == operand[0]) { |
531 | /* No conversion performed, add ref to handle return value */ | 499 | /* No conversion performed, add ref to handle return value */ |
532 | acpi_ut_add_reference (return_desc); | 500 | acpi_ut_add_reference(return_desc); |
533 | } | 501 | } |
534 | break; | 502 | break; |
535 | 503 | ||
504 | case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ | ||
536 | 505 | ||
537 | case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ | 506 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
538 | |||
539 | status = acpi_ex_convert_to_buffer (operand[0], &return_desc); | ||
540 | if (return_desc == operand[0]) { | 507 | if (return_desc == operand[0]) { |
541 | /* No conversion performed, add ref to handle return value */ | 508 | /* No conversion performed, add ref to handle return value */ |
542 | acpi_ut_add_reference (return_desc); | 509 | acpi_ut_add_reference(return_desc); |
543 | } | 510 | } |
544 | break; | 511 | break; |
545 | 512 | ||
513 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ | ||
546 | 514 | ||
547 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ | 515 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
548 | 516 | ACPI_ANY_BASE); | |
549 | status = acpi_ex_convert_to_integer (operand[0], &return_desc, | ||
550 | ACPI_ANY_BASE); | ||
551 | if (return_desc == operand[0]) { | 517 | if (return_desc == operand[0]) { |
552 | /* No conversion performed, add ref to handle return value */ | 518 | /* No conversion performed, add ref to handle return value */ |
553 | acpi_ut_add_reference (return_desc); | 519 | acpi_ut_add_reference(return_desc); |
554 | } | 520 | } |
555 | break; | 521 | break; |
556 | 522 | ||
557 | 523 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | |
558 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | 524 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ |
559 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ | ||
560 | 525 | ||
561 | /* These are two obsolete opcodes */ | 526 | /* These are two obsolete opcodes */ |
562 | 527 | ||
563 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 528 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
564 | "%s is obsolete and not implemented\n", | 529 | "%s is obsolete and not implemented\n", |
565 | acpi_ps_get_opcode_name (walk_state->opcode))); | 530 | acpi_ps_get_opcode_name(walk_state->opcode))); |
566 | status = AE_SUPPORT; | 531 | status = AE_SUPPORT; |
567 | goto cleanup; | 532 | goto cleanup; |
568 | 533 | ||
534 | default: /* Unknown opcode */ | ||
569 | 535 | ||
570 | default: /* Unknown opcode */ | 536 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); |
571 | |||
572 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", | ||
573 | walk_state->opcode)); | ||
574 | status = AE_AML_BAD_OPCODE; | 537 | status = AE_AML_BAD_OPCODE; |
575 | goto cleanup; | 538 | goto cleanup; |
576 | } | 539 | } |
577 | 540 | ||
578 | if (ACPI_SUCCESS (status)) { | 541 | if (ACPI_SUCCESS(status)) { |
579 | /* Store the return value computed above into the target object */ | 542 | /* Store the return value computed above into the target object */ |
580 | 543 | ||
581 | status = acpi_ex_store (return_desc, operand[1], walk_state); | 544 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
582 | } | 545 | } |
583 | 546 | ||
584 | 547 | cleanup: | |
585 | cleanup: | ||
586 | 548 | ||
587 | if (!walk_state->result_obj) { | 549 | if (!walk_state->result_obj) { |
588 | walk_state->result_obj = return_desc; | 550 | walk_state->result_obj = return_desc; |
@@ -590,14 +552,13 @@ cleanup: | |||
590 | 552 | ||
591 | /* Delete return object on error */ | 553 | /* Delete return object on error */ |
592 | 554 | ||
593 | if (ACPI_FAILURE (status)) { | 555 | if (ACPI_FAILURE(status)) { |
594 | acpi_ut_remove_reference (return_desc); | 556 | acpi_ut_remove_reference(return_desc); |
595 | } | 557 | } |
596 | 558 | ||
597 | return_ACPI_STATUS (status); | 559 | return_ACPI_STATUS(status); |
598 | } | 560 | } |
599 | 561 | ||
600 | |||
601 | /******************************************************************************* | 562 | /******************************************************************************* |
602 | * | 563 | * |
603 | * FUNCTION: acpi_ex_opcode_1A_0T_1R | 564 | * FUNCTION: acpi_ex_opcode_1A_0T_1R |
@@ -610,28 +571,24 @@ cleanup: | |||
610 | * | 571 | * |
611 | ******************************************************************************/ | 572 | ******************************************************************************/ |
612 | 573 | ||
613 | acpi_status | 574 | acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
614 | acpi_ex_opcode_1A_0T_1R ( | ||
615 | struct acpi_walk_state *walk_state) | ||
616 | { | 575 | { |
617 | union acpi_operand_object **operand = &walk_state->operands[0]; | 576 | union acpi_operand_object **operand = &walk_state->operands[0]; |
618 | union acpi_operand_object *temp_desc; | 577 | union acpi_operand_object *temp_desc; |
619 | union acpi_operand_object *return_desc = NULL; | 578 | union acpi_operand_object *return_desc = NULL; |
620 | acpi_status status = AE_OK; | 579 | acpi_status status = AE_OK; |
621 | u32 type; | 580 | u32 type; |
622 | acpi_integer value; | 581 | acpi_integer value; |
623 | |||
624 | |||
625 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", | ||
626 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
627 | 582 | ||
583 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | ||
584 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
628 | 585 | ||
629 | /* Examine the AML opcode */ | 586 | /* Examine the AML opcode */ |
630 | 587 | ||
631 | switch (walk_state->opcode) { | 588 | switch (walk_state->opcode) { |
632 | case AML_LNOT_OP: /* LNot (Operand) */ | 589 | case AML_LNOT_OP: /* LNot (Operand) */ |
633 | 590 | ||
634 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 591 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
635 | if (!return_desc) { | 592 | if (!return_desc) { |
636 | status = AE_NO_MEMORY; | 593 | status = AE_NO_MEMORY; |
637 | goto cleanup; | 594 | goto cleanup; |
@@ -646,15 +603,14 @@ acpi_ex_opcode_1A_0T_1R ( | |||
646 | } | 603 | } |
647 | break; | 604 | break; |
648 | 605 | ||
649 | 606 | case AML_DECREMENT_OP: /* Decrement (Operand) */ | |
650 | case AML_DECREMENT_OP: /* Decrement (Operand) */ | 607 | case AML_INCREMENT_OP: /* Increment (Operand) */ |
651 | case AML_INCREMENT_OP: /* Increment (Operand) */ | ||
652 | 608 | ||
653 | /* | 609 | /* |
654 | * Create a new integer. Can't just get the base integer and | 610 | * Create a new integer. Can't just get the base integer and |
655 | * increment it because it may be an Arg or Field. | 611 | * increment it because it may be an Arg or Field. |
656 | */ | 612 | */ |
657 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 613 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
658 | if (!return_desc) { | 614 | if (!return_desc) { |
659 | status = AE_NO_MEMORY; | 615 | status = AE_NO_MEMORY; |
660 | goto cleanup; | 616 | goto cleanup; |
@@ -665,10 +621,11 @@ acpi_ex_opcode_1A_0T_1R ( | |||
665 | * NS Node or an internal object. | 621 | * NS Node or an internal object. |
666 | */ | 622 | */ |
667 | temp_desc = operand[0]; | 623 | temp_desc = operand[0]; |
668 | if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) { | 624 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
625 | ACPI_DESC_TYPE_OPERAND) { | ||
669 | /* Internal reference object - prevent deletion */ | 626 | /* Internal reference object - prevent deletion */ |
670 | 627 | ||
671 | acpi_ut_add_reference (temp_desc); | 628 | acpi_ut_add_reference(temp_desc); |
672 | } | 629 | } |
673 | 630 | ||
674 | /* | 631 | /* |
@@ -678,11 +635,15 @@ acpi_ex_opcode_1A_0T_1R ( | |||
678 | * NOTE: We use LNOT_OP here in order to force resolution of the | 635 | * NOTE: We use LNOT_OP here in order to force resolution of the |
679 | * reference operand to an actual integer. | 636 | * reference operand to an actual integer. |
680 | */ | 637 | */ |
681 | status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state); | 638 | status = |
682 | if (ACPI_FAILURE (status)) { | 639 | acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, |
683 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", | 640 | walk_state); |
684 | acpi_ps_get_opcode_name (walk_state->opcode), | 641 | if (ACPI_FAILURE(status)) { |
685 | acpi_format_exception(status))); | 642 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
643 | "%s: bad operand(s) %s\n", | ||
644 | acpi_ps_get_opcode_name(walk_state-> | ||
645 | opcode), | ||
646 | acpi_format_exception(status))); | ||
686 | 647 | ||
687 | goto cleanup; | 648 | goto cleanup; |
688 | } | 649 | } |
@@ -692,25 +653,25 @@ acpi_ex_opcode_1A_0T_1R ( | |||
692 | * Perform the actual increment or decrement | 653 | * Perform the actual increment or decrement |
693 | */ | 654 | */ |
694 | if (walk_state->opcode == AML_INCREMENT_OP) { | 655 | if (walk_state->opcode == AML_INCREMENT_OP) { |
695 | return_desc->integer.value = temp_desc->integer.value +1; | 656 | return_desc->integer.value = |
696 | } | 657 | temp_desc->integer.value + 1; |
697 | else { | 658 | } else { |
698 | return_desc->integer.value = temp_desc->integer.value -1; | 659 | return_desc->integer.value = |
660 | temp_desc->integer.value - 1; | ||
699 | } | 661 | } |
700 | 662 | ||
701 | /* Finished with this Integer object */ | 663 | /* Finished with this Integer object */ |
702 | 664 | ||
703 | acpi_ut_remove_reference (temp_desc); | 665 | acpi_ut_remove_reference(temp_desc); |
704 | 666 | ||
705 | /* | 667 | /* |
706 | * Store the result back (indirectly) through the original | 668 | * Store the result back (indirectly) through the original |
707 | * Reference object | 669 | * Reference object |
708 | */ | 670 | */ |
709 | status = acpi_ex_store (return_desc, operand[0], walk_state); | 671 | status = acpi_ex_store(return_desc, operand[0], walk_state); |
710 | break; | 672 | break; |
711 | 673 | ||
712 | 674 | case AML_TYPE_OP: /* object_type (source_object) */ | |
713 | case AML_TYPE_OP: /* object_type (source_object) */ | ||
714 | 675 | ||
715 | /* | 676 | /* |
716 | * Note: The operand is not resolved at this point because we want to | 677 | * Note: The operand is not resolved at this point because we want to |
@@ -721,13 +682,15 @@ acpi_ex_opcode_1A_0T_1R ( | |||
721 | 682 | ||
722 | /* Get the type of the base object */ | 683 | /* Get the type of the base object */ |
723 | 684 | ||
724 | status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL); | 685 | status = |
725 | if (ACPI_FAILURE (status)) { | 686 | acpi_ex_resolve_multiple(walk_state, operand[0], &type, |
687 | NULL); | ||
688 | if (ACPI_FAILURE(status)) { | ||
726 | goto cleanup; | 689 | goto cleanup; |
727 | } | 690 | } |
728 | /* Allocate a descriptor to hold the type. */ | 691 | /* Allocate a descriptor to hold the type. */ |
729 | 692 | ||
730 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 693 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
731 | if (!return_desc) { | 694 | if (!return_desc) { |
732 | status = AE_NO_MEMORY; | 695 | status = AE_NO_MEMORY; |
733 | goto cleanup; | 696 | goto cleanup; |
@@ -736,8 +699,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
736 | return_desc->integer.value = type; | 699 | return_desc->integer.value = type; |
737 | break; | 700 | break; |
738 | 701 | ||
739 | 702 | case AML_SIZE_OF_OP: /* size_of (source_object) */ | |
740 | case AML_SIZE_OF_OP: /* size_of (source_object) */ | ||
741 | 703 | ||
742 | /* | 704 | /* |
743 | * Note: The operand is not resolved at this point because we want to | 705 | * Note: The operand is not resolved at this point because we want to |
@@ -746,9 +708,10 @@ acpi_ex_opcode_1A_0T_1R ( | |||
746 | 708 | ||
747 | /* Get the base object */ | 709 | /* Get the base object */ |
748 | 710 | ||
749 | status = acpi_ex_resolve_multiple (walk_state, | 711 | status = acpi_ex_resolve_multiple(walk_state, |
750 | operand[0], &type, &temp_desc); | 712 | operand[0], &type, |
751 | if (ACPI_FAILURE (status)) { | 713 | &temp_desc); |
714 | if (ACPI_FAILURE(status)) { | ||
752 | goto cleanup; | 715 | goto cleanup; |
753 | } | 716 | } |
754 | 717 | ||
@@ -779,9 +742,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
779 | break; | 742 | break; |
780 | 743 | ||
781 | default: | 744 | default: |
782 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 745 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
783 | "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", | 746 | "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", |
784 | acpi_ut_get_type_name (type))); | 747 | acpi_ut_get_type_name(type))); |
785 | status = AE_AML_OPERAND_TYPE; | 748 | status = AE_AML_OPERAND_TYPE; |
786 | goto cleanup; | 749 | goto cleanup; |
787 | } | 750 | } |
@@ -790,7 +753,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
790 | * Now that we have the size of the object, create a result | 753 | * Now that we have the size of the object, create a result |
791 | * object to hold the value | 754 | * object to hold the value |
792 | */ | 755 | */ |
793 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 756 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
794 | if (!return_desc) { | 757 | if (!return_desc) { |
795 | status = AE_NO_MEMORY; | 758 | status = AE_NO_MEMORY; |
796 | goto cleanup; | 759 | goto cleanup; |
@@ -799,22 +762,23 @@ acpi_ex_opcode_1A_0T_1R ( | |||
799 | return_desc->integer.value = value; | 762 | return_desc->integer.value = value; |
800 | break; | 763 | break; |
801 | 764 | ||
765 | case AML_REF_OF_OP: /* ref_of (source_object) */ | ||
802 | 766 | ||
803 | case AML_REF_OF_OP: /* ref_of (source_object) */ | 767 | status = |
804 | 768 | acpi_ex_get_object_reference(operand[0], &return_desc, | |
805 | status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state); | 769 | walk_state); |
806 | if (ACPI_FAILURE (status)) { | 770 | if (ACPI_FAILURE(status)) { |
807 | goto cleanup; | 771 | goto cleanup; |
808 | } | 772 | } |
809 | break; | 773 | break; |
810 | 774 | ||
811 | 775 | case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ | |
812 | case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ | ||
813 | 776 | ||
814 | /* Check for a method local or argument, or standalone String */ | 777 | /* Check for a method local or argument, or standalone String */ |
815 | 778 | ||
816 | if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) { | 779 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != |
817 | switch (ACPI_GET_OBJECT_TYPE (operand[0])) { | 780 | ACPI_DESC_TYPE_NAMED) { |
781 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | ||
818 | case ACPI_TYPE_LOCAL_REFERENCE: | 782 | case ACPI_TYPE_LOCAL_REFERENCE: |
819 | /* | 783 | /* |
820 | * This is a deref_of (local_x | arg_x) | 784 | * This is a deref_of (local_x | arg_x) |
@@ -827,11 +791,12 @@ acpi_ex_opcode_1A_0T_1R ( | |||
827 | 791 | ||
828 | /* Set Operand[0] to the value of the local/arg */ | 792 | /* Set Operand[0] to the value of the local/arg */ |
829 | 793 | ||
830 | status = acpi_ds_method_data_get_value ( | 794 | status = |
831 | operand[0]->reference.opcode, | 795 | acpi_ds_method_data_get_value |
832 | operand[0]->reference.offset, | 796 | (operand[0]->reference.opcode, |
833 | walk_state, &temp_desc); | 797 | operand[0]->reference.offset, |
834 | if (ACPI_FAILURE (status)) { | 798 | walk_state, &temp_desc); |
799 | if (ACPI_FAILURE(status)) { | ||
835 | goto cleanup; | 800 | goto cleanup; |
836 | } | 801 | } |
837 | 802 | ||
@@ -839,7 +804,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
839 | * Delete our reference to the input object and | 804 | * Delete our reference to the input object and |
840 | * point to the object just retrieved | 805 | * point to the object just retrieved |
841 | */ | 806 | */ |
842 | acpi_ut_remove_reference (operand[0]); | 807 | acpi_ut_remove_reference(operand[0]); |
843 | operand[0] = temp_desc; | 808 | operand[0] = temp_desc; |
844 | break; | 809 | break; |
845 | 810 | ||
@@ -847,8 +812,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
847 | 812 | ||
848 | /* Get the object to which the reference refers */ | 813 | /* Get the object to which the reference refers */ |
849 | 814 | ||
850 | temp_desc = operand[0]->reference.object; | 815 | temp_desc = |
851 | acpi_ut_remove_reference (operand[0]); | 816 | operand[0]->reference.object; |
817 | acpi_ut_remove_reference(operand[0]); | ||
852 | operand[0] = temp_desc; | 818 | operand[0] = temp_desc; |
853 | break; | 819 | break; |
854 | 820 | ||
@@ -859,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R ( | |||
859 | } | 825 | } |
860 | break; | 826 | break; |
861 | 827 | ||
862 | |||
863 | case ACPI_TYPE_STRING: | 828 | case ACPI_TYPE_STRING: |
864 | 829 | ||
865 | /* | 830 | /* |
@@ -870,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R ( | |||
870 | * 2) Dereference the node to an actual object. Could be a | 835 | * 2) Dereference the node to an actual object. Could be a |
871 | * Field, so we need to resolve the node to a value. | 836 | * Field, so we need to resolve the node to a value. |
872 | */ | 837 | */ |
873 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, | 838 | status = |
874 | walk_state->scope_info->scope.node, | 839 | acpi_ns_get_node_by_path(operand[0]->string. |
875 | ACPI_NS_SEARCH_PARENT, | 840 | pointer, |
876 | ACPI_CAST_INDIRECT_PTR ( | 841 | walk_state-> |
877 | struct acpi_namespace_node, &return_desc)); | 842 | scope_info->scope. |
878 | if (ACPI_FAILURE (status)) { | 843 | node, |
844 | ACPI_NS_SEARCH_PARENT, | ||
845 | ACPI_CAST_INDIRECT_PTR | ||
846 | (struct | ||
847 | acpi_namespace_node, | ||
848 | &return_desc)); | ||
849 | if (ACPI_FAILURE(status)) { | ||
879 | goto cleanup; | 850 | goto cleanup; |
880 | } | 851 | } |
881 | 852 | ||
882 | status = acpi_ex_resolve_node_to_value ( | 853 | status = |
883 | ACPI_CAST_INDIRECT_PTR ( | 854 | acpi_ex_resolve_node_to_value |
884 | struct acpi_namespace_node, &return_desc), | 855 | (ACPI_CAST_INDIRECT_PTR |
885 | walk_state); | 856 | (struct acpi_namespace_node, &return_desc), |
857 | walk_state); | ||
886 | goto cleanup; | 858 | goto cleanup; |
887 | 859 | ||
888 | |||
889 | default: | 860 | default: |
890 | 861 | ||
891 | status = AE_AML_OPERAND_TYPE; | 862 | status = AE_AML_OPERAND_TYPE; |
@@ -895,18 +866,20 @@ acpi_ex_opcode_1A_0T_1R ( | |||
895 | 866 | ||
896 | /* Operand[0] may have changed from the code above */ | 867 | /* Operand[0] may have changed from the code above */ |
897 | 868 | ||
898 | if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) { | 869 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
870 | ACPI_DESC_TYPE_NAMED) { | ||
899 | /* | 871 | /* |
900 | * This is a deref_of (object_reference) | 872 | * This is a deref_of (object_reference) |
901 | * Get the actual object from the Node (This is the dereference). | 873 | * Get the actual object from the Node (This is the dereference). |
902 | * This case may only happen when a local_x or arg_x is | 874 | * This case may only happen when a local_x or arg_x is |
903 | * dereferenced above. | 875 | * dereferenced above. |
904 | */ | 876 | */ |
905 | return_desc = acpi_ns_get_attached_object ( | 877 | return_desc = acpi_ns_get_attached_object((struct |
906 | (struct acpi_namespace_node *) operand[0]); | 878 | acpi_namespace_node |
907 | acpi_ut_add_reference (return_desc); | 879 | *) |
908 | } | 880 | operand[0]); |
909 | else { | 881 | acpi_ut_add_reference(return_desc); |
882 | } else { | ||
910 | /* | 883 | /* |
911 | * This must be a reference object produced by either the | 884 | * This must be a reference object produced by either the |
912 | * Index() or ref_of() operator | 885 | * Index() or ref_of() operator |
@@ -921,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
921 | switch (operand[0]->reference.target_type) { | 894 | switch (operand[0]->reference.target_type) { |
922 | case ACPI_TYPE_BUFFER_FIELD: | 895 | case ACPI_TYPE_BUFFER_FIELD: |
923 | 896 | ||
924 | temp_desc = operand[0]->reference.object; | 897 | temp_desc = |
898 | operand[0]->reference.object; | ||
925 | 899 | ||
926 | /* | 900 | /* |
927 | * Create a new object that contains one element of the | 901 | * Create a new object that contains one element of the |
@@ -931,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
931 | * sub-buffer of the main buffer, it is only a pointer to a | 905 | * sub-buffer of the main buffer, it is only a pointer to a |
932 | * single element (byte) of the buffer! | 906 | * single element (byte) of the buffer! |
933 | */ | 907 | */ |
934 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 908 | return_desc = |
909 | acpi_ut_create_internal_object | ||
910 | (ACPI_TYPE_INTEGER); | ||
935 | if (!return_desc) { | 911 | if (!return_desc) { |
936 | status = AE_NO_MEMORY; | 912 | status = AE_NO_MEMORY; |
937 | goto cleanup; | 913 | goto cleanup; |
@@ -943,56 +919,63 @@ acpi_ex_opcode_1A_0T_1R ( | |||
943 | * reference to the buffer itself. | 919 | * reference to the buffer itself. |
944 | */ | 920 | */ |
945 | return_desc->integer.value = | 921 | return_desc->integer.value = |
946 | temp_desc->buffer.pointer[operand[0]->reference.offset]; | 922 | temp_desc->buffer. |
923 | pointer[operand[0]->reference. | ||
924 | offset]; | ||
947 | break; | 925 | break; |
948 | 926 | ||
949 | |||
950 | case ACPI_TYPE_PACKAGE: | 927 | case ACPI_TYPE_PACKAGE: |
951 | 928 | ||
952 | /* | 929 | /* |
953 | * Return the referenced element of the package. We must | 930 | * Return the referenced element of the package. We must |
954 | * add another reference to the referenced object, however. | 931 | * add another reference to the referenced object, however. |
955 | */ | 932 | */ |
956 | return_desc = *(operand[0]->reference.where); | 933 | return_desc = |
934 | *(operand[0]->reference.where); | ||
957 | if (return_desc) { | 935 | if (return_desc) { |
958 | acpi_ut_add_reference (return_desc); | 936 | acpi_ut_add_reference |
937 | (return_desc); | ||
959 | } | 938 | } |
960 | 939 | ||
961 | break; | 940 | break; |
962 | 941 | ||
963 | |||
964 | default: | 942 | default: |
965 | 943 | ||
966 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 944 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
967 | "Unknown Index target_type %X in obj %p\n", | 945 | "Unknown Index target_type %X in obj %p\n", |
968 | operand[0]->reference.target_type, operand[0])); | 946 | operand[0]->reference. |
947 | target_type, | ||
948 | operand[0])); | ||
969 | status = AE_AML_OPERAND_TYPE; | 949 | status = AE_AML_OPERAND_TYPE; |
970 | goto cleanup; | 950 | goto cleanup; |
971 | } | 951 | } |
972 | break; | 952 | break; |
973 | 953 | ||
974 | |||
975 | case AML_REF_OF_OP: | 954 | case AML_REF_OF_OP: |
976 | 955 | ||
977 | return_desc = operand[0]->reference.object; | 956 | return_desc = operand[0]->reference.object; |
978 | 957 | ||
979 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == | 958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
980 | ACPI_DESC_TYPE_NAMED) { | 959 | ACPI_DESC_TYPE_NAMED) { |
981 | 960 | ||
982 | return_desc = acpi_ns_get_attached_object ( | 961 | return_desc = |
983 | (struct acpi_namespace_node *) return_desc); | 962 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | ||
964 | *) | ||
965 | return_desc); | ||
984 | } | 966 | } |
985 | 967 | ||
986 | /* Add another reference to the object! */ | 968 | /* Add another reference to the object! */ |
987 | 969 | ||
988 | acpi_ut_add_reference (return_desc); | 970 | acpi_ut_add_reference(return_desc); |
989 | break; | 971 | break; |
990 | 972 | ||
991 | |||
992 | default: | 973 | default: |
993 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 974 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
994 | "Unknown opcode in ref(%p) - %X\n", | 975 | "Unknown opcode in ref(%p) - %X\n", |
995 | operand[0], operand[0]->reference.opcode)); | 976 | operand[0], |
977 | operand[0]->reference. | ||
978 | opcode)); | ||
996 | 979 | ||
997 | status = AE_TYPE; | 980 | status = AE_TYPE; |
998 | goto cleanup; | 981 | goto cleanup; |
@@ -1000,25 +983,21 @@ acpi_ex_opcode_1A_0T_1R ( | |||
1000 | } | 983 | } |
1001 | break; | 984 | break; |
1002 | 985 | ||
1003 | |||
1004 | default: | 986 | default: |
1005 | 987 | ||
1006 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", | 988 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
1007 | walk_state->opcode)); | ||
1008 | status = AE_AML_BAD_OPCODE; | 989 | status = AE_AML_BAD_OPCODE; |
1009 | goto cleanup; | 990 | goto cleanup; |
1010 | } | 991 | } |
1011 | 992 | ||
1012 | 993 | cleanup: | |
1013 | cleanup: | ||
1014 | 994 | ||
1015 | /* Delete return object on error */ | 995 | /* Delete return object on error */ |
1016 | 996 | ||
1017 | if (ACPI_FAILURE (status)) { | 997 | if (ACPI_FAILURE(status)) { |
1018 | acpi_ut_remove_reference (return_desc); | 998 | acpi_ut_remove_reference(return_desc); |
1019 | } | 999 | } |
1020 | 1000 | ||
1021 | walk_state->result_obj = return_desc; | 1001 | walk_state->result_obj = return_desc; |
1022 | return_ACPI_STATUS (status); | 1002 | return_ACPI_STATUS(status); |
1023 | } | 1003 | } |
1024 | |||