Skip to content

Commit b0f2e7d

Browse files
jmarinhorafaeljw
authored andcommitted
ACPICA: Add interrupt command to acpiexec
ACPICA commit ef7cf185a046d76119b631f16e7c991543c80edc This commit add the Interrupt command to acpiexec. The Interrupt command simulates an interrupt with a int_ID (GSIV) equal to the first argument of the call. The acpiexec code simulates the behaviour by OSPM: execute the _EVT method of the GED device associated with that int_ID. Link: acpica/acpica@ef7cf185 Signed-off-by: Jose Marinho <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 24a4b87 commit b0f2e7d

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

drivers/acpi/acpica/acdebug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,6 @@ struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
287287

288288
void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
289289

290+
void acpi_db_generate_interrupt(char *gsiv_arg);
291+
290292
#endif /* __ACDEBUG_H__ */

drivers/acpi/acpica/dbcmds.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,64 @@ void acpi_db_display_resources(char *object_arg)
10101010
acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
10111011
}
10121012

1013+
/*******************************************************************************
1014+
*
1015+
* FUNCTION: acpi_db_generate_ged
1016+
*
1017+
* PARAMETERS: ged_arg - Raw GED number, ascii string
1018+
*
1019+
* RETURN: None
1020+
*
1021+
* DESCRIPTION: Simulate firing of a GED
1022+
*
1023+
******************************************************************************/
1024+
1025+
void acpi_db_generate_interrupt(char *gsiv_arg)
1026+
{
1027+
u32 gsiv_number;
1028+
struct acpi_ged_handler_info *ged_info = acpi_gbl_ged_handler_list;
1029+
1030+
if (!ged_info) {
1031+
acpi_os_printf("No GED handling present\n");
1032+
}
1033+
1034+
gsiv_number = strtoul(gsiv_arg, NULL, 0);
1035+
1036+
while (ged_info) {
1037+
1038+
if (ged_info->int_id == gsiv_number) {
1039+
struct acpi_object_list arg_list;
1040+
union acpi_object arg0;
1041+
acpi_handle evt_handle = ged_info->evt_method;
1042+
acpi_status status;
1043+
1044+
acpi_os_printf("Evaluate GED _EVT (GSIV=%d)\n",
1045+
gsiv_number);
1046+
1047+
if (!evt_handle) {
1048+
acpi_os_printf("Undefined _EVT method\n");
1049+
return;
1050+
}
1051+
1052+
arg0.integer.type = ACPI_TYPE_INTEGER;
1053+
arg0.integer.value = gsiv_number;
1054+
1055+
arg_list.count = 1;
1056+
arg_list.pointer = &arg0;
1057+
1058+
status =
1059+
acpi_evaluate_object(evt_handle, NULL, &arg_list,
1060+
NULL);
1061+
if (ACPI_FAILURE(status)) {
1062+
acpi_os_printf("Could not evaluate _EVT\n");
1063+
return;
1064+
}
1065+
1066+
}
1067+
ged_info = ged_info->next;
1068+
}
1069+
}
1070+
10131071
#if (!ACPI_REDUCED_HARDWARE)
10141072
/*******************************************************************************
10151073
*

drivers/acpi/acpica/dbinput.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ enum acpi_ex_debugger_commands {
106106
CMD_THREADS,
107107

108108
CMD_TEST,
109+
CMD_INTERRUPT,
109110
#endif
110111
};
111112

@@ -185,6 +186,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
185186
{"THREADS", 3},
186187

187188
{"TEST", 1},
189+
{"INTERRUPT", 1},
188190
#endif
189191
{NULL, 0}
190192
};
@@ -318,6 +320,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
318320
{1, " Gpes", "Display info on all GPE devices\n"},
319321
{1, " Sci", "Generate an SCI\n"},
320322
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
323+
{1, " Interrupt <GSIV>", "Simulate an interrupt\n"},
321324
#endif
322325
{0, NULL, NULL}
323326
};
@@ -1064,6 +1067,11 @@ acpi_db_command_dispatch(char *input_buffer,
10641067
acpi_os_printf("Event command not implemented\n");
10651068
break;
10661069

1070+
case CMD_INTERRUPT:
1071+
1072+
acpi_db_generate_interrupt(acpi_gbl_db_args[1]);
1073+
break;
1074+
10671075
case CMD_GPE:
10681076

10691077
acpi_db_generate_gpe(acpi_gbl_db_args[1], acpi_gbl_db_args[2]);

0 commit comments

Comments
 (0)