@@ -24,6 +24,13 @@ acpi_db_start_command(struct acpi_walk_state *walk_state,
2424void acpi_db_method_end (struct acpi_walk_state * walk_state );
2525#endif
2626
27+ #ifdef ACPI_DISASSEMBLER
28+ static union acpi_parse_object * acpi_db_get_display_op (struct acpi_walk_state
29+ * walk_state ,
30+ union acpi_parse_object
31+ * op );
32+ #endif
33+
2734/*******************************************************************************
2835 *
2936 * FUNCTION: acpi_db_start_command
@@ -113,6 +120,70 @@ void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
113120 acpi_os_printf ("**break** Executed AML BreakPoint opcode\n" );
114121}
115122
123+ #ifdef ACPI_DISASSEMBLER
124+ /*******************************************************************************
125+ *
126+ * FUNCTION: acpi_db_get_display_op
127+ *
128+ * PARAMETERS: walk_state - Current walk
129+ * op - Current executing op (from aml interpreter)
130+ *
131+ * RETURN: Opcode to display
132+ *
133+ * DESCRIPTION: Find the opcode to display during single stepping
134+ *
135+ ******************************************************************************/
136+
137+ static union acpi_parse_object * acpi_db_get_display_op (struct acpi_walk_state
138+ * walk_state ,
139+ union acpi_parse_object
140+ * op )
141+ {
142+ union acpi_parse_object * display_op ;
143+ union acpi_parse_object * parent_op ;
144+
145+ display_op = op ;
146+ parent_op = op -> common .parent ;
147+ if (parent_op ) {
148+ if ((walk_state -> control_state ) &&
149+ (walk_state -> control_state -> common .state ==
150+ ACPI_CONTROL_PREDICATE_EXECUTING )) {
151+ /*
152+ * We are executing the predicate of an IF or WHILE statement
153+ * Search upwards for the containing IF or WHILE so that the
154+ * entire predicate can be displayed.
155+ */
156+ while (parent_op ) {
157+ if ((parent_op -> common .aml_opcode == AML_IF_OP )
158+ || (parent_op -> common .aml_opcode ==
159+ AML_WHILE_OP )) {
160+ display_op = parent_op ;
161+ break ;
162+ }
163+ parent_op = parent_op -> common .parent ;
164+ }
165+ } else {
166+ while (parent_op ) {
167+ if ((parent_op -> common .aml_opcode == AML_IF_OP )
168+ || (parent_op -> common .aml_opcode ==
169+ AML_ELSE_OP )
170+ || (parent_op -> common .aml_opcode ==
171+ AML_SCOPE_OP )
172+ || (parent_op -> common .aml_opcode ==
173+ AML_METHOD_OP )
174+ || (parent_op -> common .aml_opcode ==
175+ AML_WHILE_OP )) {
176+ break ;
177+ }
178+ display_op = parent_op ;
179+ parent_op = parent_op -> common .parent ;
180+ }
181+ }
182+ }
183+ return display_op ;
184+ }
185+ #endif
186+
116187/*******************************************************************************
117188 *
118189 * FUNCTION: acpi_db_single_step
@@ -134,8 +205,6 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
134205 union acpi_parse_object * next ;
135206 acpi_status status = AE_OK ;
136207 u32 original_debug_level ;
137- union acpi_parse_object * display_op ;
138- union acpi_parse_object * parent_op ;
139208 u32 aml_offset ;
140209
141210 ACPI_FUNCTION_ENTRY ();
@@ -222,51 +291,12 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
222291 next = op -> common .next ;
223292 op -> common .next = NULL ;
224293
225- display_op = op ;
226- parent_op = op -> common .parent ;
227- if (parent_op ) {
228- if ((walk_state -> control_state ) &&
229- (walk_state -> control_state -> common .state ==
230- ACPI_CONTROL_PREDICATE_EXECUTING )) {
231- /*
232- * We are executing the predicate of an IF or WHILE statement
233- * Search upwards for the containing IF or WHILE so that the
234- * entire predicate can be displayed.
235- */
236- while (parent_op ) {
237- if ((parent_op -> common .aml_opcode ==
238- AML_IF_OP )
239- || (parent_op -> common .aml_opcode ==
240- AML_WHILE_OP )) {
241- display_op = parent_op ;
242- break ;
243- }
244- parent_op = parent_op -> common .parent ;
245- }
246- } else {
247- while (parent_op ) {
248- if ((parent_op -> common .aml_opcode ==
249- AML_IF_OP )
250- || (parent_op -> common .aml_opcode ==
251- AML_ELSE_OP )
252- || (parent_op -> common .aml_opcode ==
253- AML_SCOPE_OP )
254- || (parent_op -> common .aml_opcode ==
255- AML_METHOD_OP )
256- || (parent_op -> common .aml_opcode ==
257- AML_WHILE_OP )) {
258- break ;
259- }
260- display_op = parent_op ;
261- parent_op = parent_op -> common .parent ;
262- }
263- }
264- }
265-
266294 /* Now we can disassemble and display it */
267295
268296#ifdef ACPI_DISASSEMBLER
269- acpi_dm_disassemble (walk_state , display_op , ACPI_UINT32_MAX );
297+ acpi_dm_disassemble (walk_state ,
298+ acpi_db_get_display_op (walk_state , op ),
299+ ACPI_UINT32_MAX );
270300#else
271301 /*
272302 * The AML Disassembler is not configured - at least we can
0 commit comments