Skip to content

Commit cde89fd

Browse files
superm1rafaeljw
authored andcommitted
ACPICA: Add support for printing AML arguments when trace point enabled
When debug level is set to `ACPI_LV_TRACE_POINT` method start and exit are emitted into the debug logs. This can be useful to understand call paths, however none of the arguments for the method calls are populated even when turning up other debug levels. This can be useful for BIOSes that contain debug strings to see those strings. When `ACPI_LV_TRACE_POINT` is set also output all of the arguments for a given method call. This enables this type of debugging: ``` extrace-0138 ex_trace_point : Method Begin [0x0000000096b240c4:\M460] execution. extrace-0173 ex_trace_args : " POST CODE: %X ACPI TIMER: %X TIME: %d.%d ms\n", b0003f53, 1a26a8b2, 0, 15e, 0, 0 extrace-0138 ex_trace_point : Method End [0x0000000096b240c4:\M460] execution. ``` Link: acpica/acpica@08219d9 Signed-off-by: Mario Limonciello <[email protected]> Link: https://patch.msgid.link/[email protected] Link: acpica/acpica#1012 Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0f8af03 commit cde89fd

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

drivers/acpi/acpica/acinterp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ void
120120
acpi_ex_trace_point(acpi_trace_event_type type,
121121
u8 begin, u8 *aml, char *pathname);
122122

123+
void
124+
acpi_ex_trace_args(union acpi_operand_object **params, u32 count);
125+
123126
/*
124127
* exfield - ACPI AML (p-code) execution - field manipulation
125128
*/

drivers/acpi/acpica/dsmthdat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
188188

189189
index++;
190190
}
191+
acpi_ex_trace_args(params, index);
191192

192193
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%u args passed to method\n", index));
193194
return_ACPI_STATUS(AE_OK);

drivers/acpi/acpica/extrace.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,57 @@ acpi_ex_trace_point(acpi_trace_event_type type,
147147
}
148148
}
149149

150+
/*******************************************************************************
151+
*
152+
* FUNCTION: acpi_ex_trace_args
153+
*
154+
* PARAMETERS: params - AML method arguments
155+
* count - numer of method arguments
156+
*
157+
* RETURN: None
158+
*
159+
* DESCRIPTION: Trace any arguments
160+
*
161+
******************************************************************************/
162+
163+
void
164+
acpi_ex_trace_args(union acpi_operand_object **params, u32 count)
165+
{
166+
u32 i;
167+
168+
ACPI_FUNCTION_NAME(ex_trace_args);
169+
170+
for (i = 0; i < count; i++) {
171+
union acpi_operand_object *obj_desc = params[i];
172+
173+
if (!i) {
174+
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, " "));
175+
}
176+
177+
switch (obj_desc->common.type) {
178+
case ACPI_TYPE_INTEGER:
179+
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "%llx", obj_desc->integer.value));
180+
break;
181+
case ACPI_TYPE_STRING:
182+
if (!obj_desc->string.length) {
183+
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "NULL"));
184+
continue;
185+
}
186+
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_TRACE_POINT, _COMPONENT))
187+
acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
188+
break;
189+
default:
190+
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "Unknown"));
191+
break;
192+
}
193+
if (i+1 == count) {
194+
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "\n"));
195+
} else {
196+
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, ", "));
197+
}
198+
}
199+
}
200+
150201
/*******************************************************************************
151202
*
152203
* FUNCTION: acpi_ex_start_trace_method

0 commit comments

Comments
 (0)