Loading...
1// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2/*******************************************************************************
3 *
4 * Module Name: dbmethod - Debug commands for control methods
5 *
6 ******************************************************************************/
7
8#include <acpi/acpi.h>
9#include "accommon.h"
10#include "acdispat.h"
11#include "acnamesp.h"
12#include "acdebug.h"
13#include "acparser.h"
14#include "acpredef.h"
15
16#define _COMPONENT ACPI_CA_DEBUGGER
17ACPI_MODULE_NAME("dbmethod")
18
19/* Local prototypes */
20static acpi_status
21acpi_db_walk_for_execute(acpi_handle obj_handle,
22 u32 nesting_level, void *context, void **return_value);
23
24/*******************************************************************************
25 *
26 * FUNCTION: acpi_db_set_method_breakpoint
27 *
28 * PARAMETERS: location - AML offset of breakpoint
29 * walk_state - Current walk info
30 * op - Current Op (from parse walk)
31 *
32 * RETURN: None
33 *
34 * DESCRIPTION: Set a breakpoint in a control method at the specified
35 * AML offset
36 *
37 ******************************************************************************/
38
39void
40acpi_db_set_method_breakpoint(char *location,
41 struct acpi_walk_state *walk_state,
42 union acpi_parse_object *op)
43{
44 u32 address;
45 u32 aml_offset;
46
47 if (!op) {
48 acpi_os_printf("There is no method currently executing\n");
49 return;
50 }
51
52 /* Get and verify the breakpoint address */
53
54 address = strtoul(location, NULL, 16);
55 aml_offset = (u32)ACPI_PTR_DIFF(op->common.aml,
56 walk_state->parser_state.aml_start);
57 if (address <= aml_offset) {
58 acpi_os_printf("Breakpoint %X is beyond current address %X\n",
59 address, aml_offset);
60 }
61
62 /* Save breakpoint in current walk */
63
64 walk_state->user_breakpoint = address;
65 acpi_os_printf("Breakpoint set at AML offset %X\n", address);
66}
67
68/*******************************************************************************
69 *
70 * FUNCTION: acpi_db_set_method_call_breakpoint
71 *
72 * PARAMETERS: op - Current Op (from parse walk)
73 *
74 * RETURN: None
75 *
76 * DESCRIPTION: Set a breakpoint in a control method at the specified
77 * AML offset
78 *
79 ******************************************************************************/
80
81void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op)
82{
83
84 if (!op) {
85 acpi_os_printf("There is no method currently executing\n");
86 return;
87 }
88
89 acpi_gbl_step_to_next_call = TRUE;
90}
91
92/*******************************************************************************
93 *
94 * FUNCTION: acpi_db_set_method_data
95 *
96 * PARAMETERS: type_arg - L for local, A for argument
97 * index_arg - which one
98 * value_arg - Value to set.
99 *
100 * RETURN: None
101 *
102 * DESCRIPTION: Set a local or argument for the running control method.
103 * NOTE: only object supported is Number.
104 *
105 ******************************************************************************/
106
107void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg)
108{
109 char type;
110 u32 index;
111 u32 value;
112 struct acpi_walk_state *walk_state;
113 union acpi_operand_object *obj_desc;
114 acpi_status status;
115 struct acpi_namespace_node *node;
116
117 /* Validate type_arg */
118
119 acpi_ut_strupr(type_arg);
120 type = type_arg[0];
121 if ((type != 'L') && (type != 'A') && (type != 'N')) {
122 acpi_os_printf("Invalid SET operand: %s\n", type_arg);
123 return;
124 }
125
126 value = strtoul(value_arg, NULL, 16);
127
128 if (type == 'N') {
129 node = acpi_db_convert_to_node(index_arg);
130 if (!node) {
131 return;
132 }
133
134 if (node->type != ACPI_TYPE_INTEGER) {
135 acpi_os_printf("Can only set Integer nodes\n");
136 return;
137 }
138 obj_desc = node->object;
139 obj_desc->integer.value = value;
140 return;
141 }
142
143 /* Get the index and value */
144
145 index = strtoul(index_arg, NULL, 16);
146
147 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
148 if (!walk_state) {
149 acpi_os_printf("There is no method currently executing\n");
150 return;
151 }
152
153 /* Create and initialize the new object */
154
155 obj_desc = acpi_ut_create_integer_object((u64)value);
156 if (!obj_desc) {
157 acpi_os_printf("Could not create an internal object\n");
158 return;
159 }
160
161 /* Store the new object into the target */
162
163 switch (type) {
164 case 'A':
165
166 /* Set a method argument */
167
168 if (index > ACPI_METHOD_MAX_ARG) {
169 acpi_os_printf("Arg%u - Invalid argument name\n",
170 index);
171 goto cleanup;
172 }
173
174 status = acpi_ds_store_object_to_local(ACPI_REFCLASS_ARG,
175 index, obj_desc,
176 walk_state);
177 if (ACPI_FAILURE(status)) {
178 goto cleanup;
179 }
180
181 obj_desc = walk_state->arguments[index].object;
182
183 acpi_os_printf("Arg%u: ", index);
184 acpi_db_display_internal_object(obj_desc, walk_state);
185 break;
186
187 case 'L':
188
189 /* Set a method local */
190
191 if (index > ACPI_METHOD_MAX_LOCAL) {
192 acpi_os_printf
193 ("Local%u - Invalid local variable name\n", index);
194 goto cleanup;
195 }
196
197 status = acpi_ds_store_object_to_local(ACPI_REFCLASS_LOCAL,
198 index, obj_desc,
199 walk_state);
200 if (ACPI_FAILURE(status)) {
201 goto cleanup;
202 }
203
204 obj_desc = walk_state->local_variables[index].object;
205
206 acpi_os_printf("Local%u: ", index);
207 acpi_db_display_internal_object(obj_desc, walk_state);
208 break;
209
210 default:
211
212 break;
213 }
214
215cleanup:
216 acpi_ut_remove_reference(obj_desc);
217}
218
219#ifdef ACPI_DISASSEMBLER
220/*******************************************************************************
221 *
222 * FUNCTION: acpi_db_disassemble_aml
223 *
224 * PARAMETERS: statements - Number of statements to disassemble
225 * op - Current Op (from parse walk)
226 *
227 * RETURN: None
228 *
229 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
230 * of statements specified.
231 *
232 ******************************************************************************/
233
234void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op)
235{
236 u32 num_statements = 8;
237
238 if (!op) {
239 acpi_os_printf("There is no method currently executing\n");
240 return;
241 }
242
243 if (statements) {
244 num_statements = strtoul(statements, NULL, 0);
245 }
246
247 acpi_dm_disassemble(NULL, op, num_statements);
248}
249
250/*******************************************************************************
251 *
252 * FUNCTION: acpi_db_disassemble_method
253 *
254 * PARAMETERS: name - Name of control method
255 *
256 * RETURN: None
257 *
258 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
259 * of statements specified.
260 *
261 ******************************************************************************/
262
263acpi_status acpi_db_disassemble_method(char *name)
264{
265 acpi_status status;
266 union acpi_parse_object *op;
267 struct acpi_walk_state *walk_state;
268 union acpi_operand_object *obj_desc;
269 struct acpi_namespace_node *method;
270
271 method = acpi_db_convert_to_node(name);
272 if (!method) {
273 return (AE_BAD_PARAMETER);
274 }
275
276 if (method->type != ACPI_TYPE_METHOD) {
277 ACPI_ERROR((AE_INFO, "%s (%s): Object must be a control method",
278 name, acpi_ut_get_type_name(method->type)));
279 return (AE_BAD_PARAMETER);
280 }
281
282 obj_desc = method->object;
283
284 op = acpi_ps_create_scope_op(obj_desc->method.aml_start);
285 if (!op) {
286 return (AE_NO_MEMORY);
287 }
288
289 /* Create and initialize a new walk state */
290
291 walk_state = acpi_ds_create_walk_state(0, op, NULL, NULL);
292 if (!walk_state) {
293 return (AE_NO_MEMORY);
294 }
295
296 status = acpi_ds_init_aml_walk(walk_state, op, NULL,
297 obj_desc->method.aml_start,
298 obj_desc->method.aml_length, NULL,
299 ACPI_IMODE_LOAD_PASS1);
300 if (ACPI_FAILURE(status)) {
301 return (status);
302 }
303
304 status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
305 if (ACPI_FAILURE(status)) {
306 return (status);
307 }
308
309 walk_state->owner_id = obj_desc->method.owner_id;
310
311 /* Push start scope on scope stack and make it current */
312
313 status = acpi_ds_scope_stack_push(method, method->type, walk_state);
314 if (ACPI_FAILURE(status)) {
315 return (status);
316 }
317
318 /* Parse the entire method AML including deferred operators */
319
320 walk_state->parse_flags &= ~ACPI_PARSE_DELETE_TREE;
321 walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE;
322
323 status = acpi_ps_parse_aml(walk_state);
324 if (ACPI_FAILURE(status)) {
325 return (status);
326 }
327
328 (void)acpi_dm_parse_deferred_ops(op);
329
330 /* Now we can disassemble the method */
331
332 acpi_gbl_dm_opt_verbose = FALSE;
333 acpi_dm_disassemble(NULL, op, 0);
334 acpi_gbl_dm_opt_verbose = TRUE;
335
336 acpi_ps_delete_parse_tree(op);
337
338 /* Method cleanup */
339
340 acpi_ns_delete_namespace_subtree(method);
341 acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
342 acpi_ut_release_owner_id(&obj_desc->method.owner_id);
343 return (AE_OK);
344}
345#endif
346
347/*******************************************************************************
348 *
349 * FUNCTION: acpi_db_walk_for_execute
350 *
351 * PARAMETERS: Callback from walk_namespace
352 *
353 * RETURN: Status
354 *
355 * DESCRIPTION: Batch execution module. Currently only executes predefined
356 * ACPI names.
357 *
358 ******************************************************************************/
359
360static acpi_status
361acpi_db_walk_for_execute(acpi_handle obj_handle,
362 u32 nesting_level, void *context, void **return_value)
363{
364 struct acpi_namespace_node *node =
365 (struct acpi_namespace_node *)obj_handle;
366 struct acpi_db_execute_walk *info =
367 (struct acpi_db_execute_walk *)context;
368 struct acpi_buffer return_obj;
369 acpi_status status;
370 char *pathname;
371 u32 i;
372 struct acpi_device_info *obj_info;
373 struct acpi_object_list param_objects;
374 union acpi_object params[ACPI_METHOD_NUM_ARGS];
375 const union acpi_predefined_info *predefined;
376
377 predefined = acpi_ut_match_predefined_method(node->name.ascii);
378 if (!predefined) {
379 return (AE_OK);
380 }
381
382 if (node->type == ACPI_TYPE_LOCAL_SCOPE) {
383 return (AE_OK);
384 }
385
386 pathname = acpi_ns_get_external_pathname(node);
387 if (!pathname) {
388 return (AE_OK);
389 }
390
391 /* Get the object info for number of method parameters */
392
393 status = acpi_get_object_info(obj_handle, &obj_info);
394 if (ACPI_FAILURE(status)) {
395 ACPI_FREE(pathname);
396 return (status);
397 }
398
399 param_objects.pointer = NULL;
400 param_objects.count = 0;
401
402 if (obj_info->type == ACPI_TYPE_METHOD) {
403
404 /* Setup default parameters */
405
406 for (i = 0; i < obj_info->param_count; i++) {
407 params[i].type = ACPI_TYPE_INTEGER;
408 params[i].integer.value = 1;
409 }
410
411 param_objects.pointer = params;
412 param_objects.count = obj_info->param_count;
413 }
414
415 ACPI_FREE(obj_info);
416 return_obj.pointer = NULL;
417 return_obj.length = ACPI_ALLOCATE_BUFFER;
418
419 /* Do the actual method execution */
420
421 acpi_gbl_method_executing = TRUE;
422
423 status = acpi_evaluate_object(node, NULL, ¶m_objects, &return_obj);
424
425 acpi_os_printf("%-32s returned %s\n", pathname,
426 acpi_format_exception(status));
427 acpi_gbl_method_executing = FALSE;
428 ACPI_FREE(pathname);
429
430 /* Ignore status from method execution */
431
432 status = AE_OK;
433
434 /* Update count, check if we have executed enough methods */
435
436 info->count++;
437 if (info->count >= info->max_count) {
438 status = AE_CTRL_TERMINATE;
439 }
440
441 return (status);
442}
443
444/*******************************************************************************
445 *
446 * FUNCTION: acpi_db_evaluate_predefined_names
447 *
448 * PARAMETERS: None
449 *
450 * RETURN: None
451 *
452 * DESCRIPTION: Namespace batch execution. Execute predefined names in the
453 * namespace, up to the max count, if specified.
454 *
455 ******************************************************************************/
456
457void acpi_db_evaluate_predefined_names(void)
458{
459 struct acpi_db_execute_walk info;
460
461 info.count = 0;
462 info.max_count = ACPI_UINT32_MAX;
463
464 /* Search all nodes in namespace */
465
466 (void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
467 ACPI_UINT32_MAX, acpi_db_walk_for_execute,
468 NULL, (void *)&info, NULL);
469
470 acpi_os_printf("Evaluated %u predefined names in the namespace\n",
471 info.count);
472}
1/*******************************************************************************
2 *
3 * Module Name: dbmethod - Debug commands for control methods
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acdispat.h"
47#include "acnamesp.h"
48#include "acdebug.h"
49#include "acparser.h"
50#include "acpredef.h"
51
52#define _COMPONENT ACPI_CA_DEBUGGER
53ACPI_MODULE_NAME("dbmethod")
54
55/*******************************************************************************
56 *
57 * FUNCTION: acpi_db_set_method_breakpoint
58 *
59 * PARAMETERS: location - AML offset of breakpoint
60 * walk_state - Current walk info
61 * op - Current Op (from parse walk)
62 *
63 * RETURN: None
64 *
65 * DESCRIPTION: Set a breakpoint in a control method at the specified
66 * AML offset
67 *
68 ******************************************************************************/
69void
70acpi_db_set_method_breakpoint(char *location,
71 struct acpi_walk_state *walk_state,
72 union acpi_parse_object *op)
73{
74 u32 address;
75 u32 aml_offset;
76
77 if (!op) {
78 acpi_os_printf("There is no method currently executing\n");
79 return;
80 }
81
82 /* Get and verify the breakpoint address */
83
84 address = strtoul(location, NULL, 16);
85 aml_offset = (u32)ACPI_PTR_DIFF(op->common.aml,
86 walk_state->parser_state.aml_start);
87 if (address <= aml_offset) {
88 acpi_os_printf("Breakpoint %X is beyond current address %X\n",
89 address, aml_offset);
90 }
91
92 /* Save breakpoint in current walk */
93
94 walk_state->user_breakpoint = address;
95 acpi_os_printf("Breakpoint set at AML offset %X\n", address);
96}
97
98/*******************************************************************************
99 *
100 * FUNCTION: acpi_db_set_method_call_breakpoint
101 *
102 * PARAMETERS: op - Current Op (from parse walk)
103 *
104 * RETURN: None
105 *
106 * DESCRIPTION: Set a breakpoint in a control method at the specified
107 * AML offset
108 *
109 ******************************************************************************/
110
111void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op)
112{
113
114 if (!op) {
115 acpi_os_printf("There is no method currently executing\n");
116 return;
117 }
118
119 acpi_gbl_step_to_next_call = TRUE;
120}
121
122/*******************************************************************************
123 *
124 * FUNCTION: acpi_db_set_method_data
125 *
126 * PARAMETERS: type_arg - L for local, A for argument
127 * index_arg - which one
128 * value_arg - Value to set.
129 *
130 * RETURN: None
131 *
132 * DESCRIPTION: Set a local or argument for the running control method.
133 * NOTE: only object supported is Number.
134 *
135 ******************************************************************************/
136
137void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg)
138{
139 char type;
140 u32 index;
141 u32 value;
142 struct acpi_walk_state *walk_state;
143 union acpi_operand_object *obj_desc;
144 acpi_status status;
145 struct acpi_namespace_node *node;
146
147 /* Validate type_arg */
148
149 acpi_ut_strupr(type_arg);
150 type = type_arg[0];
151 if ((type != 'L') && (type != 'A') && (type != 'N')) {
152 acpi_os_printf("Invalid SET operand: %s\n", type_arg);
153 return;
154 }
155
156 value = strtoul(value_arg, NULL, 16);
157
158 if (type == 'N') {
159 node = acpi_db_convert_to_node(index_arg);
160 if (!node) {
161 return;
162 }
163
164 if (node->type != ACPI_TYPE_INTEGER) {
165 acpi_os_printf("Can only set Integer nodes\n");
166 return;
167 }
168 obj_desc = node->object;
169 obj_desc->integer.value = value;
170 return;
171 }
172
173 /* Get the index and value */
174
175 index = strtoul(index_arg, NULL, 16);
176
177 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
178 if (!walk_state) {
179 acpi_os_printf("There is no method currently executing\n");
180 return;
181 }
182
183 /* Create and initialize the new object */
184
185 obj_desc = acpi_ut_create_integer_object((u64)value);
186 if (!obj_desc) {
187 acpi_os_printf("Could not create an internal object\n");
188 return;
189 }
190
191 /* Store the new object into the target */
192
193 switch (type) {
194 case 'A':
195
196 /* Set a method argument */
197
198 if (index > ACPI_METHOD_MAX_ARG) {
199 acpi_os_printf("Arg%u - Invalid argument name\n",
200 index);
201 goto cleanup;
202 }
203
204 status = acpi_ds_store_object_to_local(ACPI_REFCLASS_ARG,
205 index, obj_desc,
206 walk_state);
207 if (ACPI_FAILURE(status)) {
208 goto cleanup;
209 }
210
211 obj_desc = walk_state->arguments[index].object;
212
213 acpi_os_printf("Arg%u: ", index);
214 acpi_db_display_internal_object(obj_desc, walk_state);
215 break;
216
217 case 'L':
218
219 /* Set a method local */
220
221 if (index > ACPI_METHOD_MAX_LOCAL) {
222 acpi_os_printf
223 ("Local%u - Invalid local variable name\n", index);
224 goto cleanup;
225 }
226
227 status = acpi_ds_store_object_to_local(ACPI_REFCLASS_LOCAL,
228 index, obj_desc,
229 walk_state);
230 if (ACPI_FAILURE(status)) {
231 goto cleanup;
232 }
233
234 obj_desc = walk_state->local_variables[index].object;
235
236 acpi_os_printf("Local%u: ", index);
237 acpi_db_display_internal_object(obj_desc, walk_state);
238 break;
239
240 default:
241
242 break;
243 }
244
245cleanup:
246 acpi_ut_remove_reference(obj_desc);
247}
248
249/*******************************************************************************
250 *
251 * FUNCTION: acpi_db_disassemble_aml
252 *
253 * PARAMETERS: statements - Number of statements to disassemble
254 * op - Current Op (from parse walk)
255 *
256 * RETURN: None
257 *
258 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
259 * of statements specified.
260 *
261 ******************************************************************************/
262
263void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op)
264{
265 u32 num_statements = 8;
266
267 if (!op) {
268 acpi_os_printf("There is no method currently executing\n");
269 return;
270 }
271
272 if (statements) {
273 num_statements = strtoul(statements, NULL, 0);
274 }
275#ifdef ACPI_DISASSEMBLER
276 acpi_dm_disassemble(NULL, op, num_statements);
277#endif
278}
279
280/*******************************************************************************
281 *
282 * FUNCTION: acpi_db_disassemble_method
283 *
284 * PARAMETERS: name - Name of control method
285 *
286 * RETURN: None
287 *
288 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
289 * of statements specified.
290 *
291 ******************************************************************************/
292
293acpi_status acpi_db_disassemble_method(char *name)
294{
295 acpi_status status;
296 union acpi_parse_object *op;
297 struct acpi_walk_state *walk_state;
298 union acpi_operand_object *obj_desc;
299 struct acpi_namespace_node *method;
300
301 method = acpi_db_convert_to_node(name);
302 if (!method) {
303 return (AE_BAD_PARAMETER);
304 }
305
306 if (method->type != ACPI_TYPE_METHOD) {
307 ACPI_ERROR((AE_INFO, "%s (%s): Object must be a control method",
308 name, acpi_ut_get_type_name(method->type)));
309 return (AE_BAD_PARAMETER);
310 }
311
312 obj_desc = method->object;
313
314 op = acpi_ps_create_scope_op(obj_desc->method.aml_start);
315 if (!op) {
316 return (AE_NO_MEMORY);
317 }
318
319 /* Create and initialize a new walk state */
320
321 walk_state = acpi_ds_create_walk_state(0, op, NULL, NULL);
322 if (!walk_state) {
323 return (AE_NO_MEMORY);
324 }
325
326 status = acpi_ds_init_aml_walk(walk_state, op, NULL,
327 obj_desc->method.aml_start,
328 obj_desc->method.aml_length, NULL,
329 ACPI_IMODE_LOAD_PASS1);
330 if (ACPI_FAILURE(status)) {
331 return (status);
332 }
333
334 status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
335 walk_state->owner_id = obj_desc->method.owner_id;
336
337 /* Push start scope on scope stack and make it current */
338
339 status = acpi_ds_scope_stack_push(method, method->type, walk_state);
340 if (ACPI_FAILURE(status)) {
341 return (status);
342 }
343
344 /* Parse the entire method AML including deferred operators */
345
346 walk_state->parse_flags &= ~ACPI_PARSE_DELETE_TREE;
347 walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE;
348
349 status = acpi_ps_parse_aml(walk_state);
350
351#ifdef ACPI_DISASSEMBLER
352 (void)acpi_dm_parse_deferred_ops(op);
353
354 /* Now we can disassemble the method */
355
356 acpi_gbl_dm_opt_verbose = FALSE;
357 acpi_dm_disassemble(NULL, op, 0);
358 acpi_gbl_dm_opt_verbose = TRUE;
359#endif
360
361 acpi_ps_delete_parse_tree(op);
362
363 /* Method cleanup */
364
365 acpi_ns_delete_namespace_subtree(method);
366 acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
367 acpi_ut_release_owner_id(&obj_desc->method.owner_id);
368 return (AE_OK);
369}