Commit b0f2e7d7 authored by Jose Marinho's avatar Jose Marinho Committed by Rafael J. Wysocki
Browse files

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: https://github.com/acpica/acpica/commit/ef7cf185


Signed-off-by: default avatarJose Marinho <jose.marinho@arm.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 24a4b872
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -287,4 +287,6 @@ struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);

void acpi_db_uint32_to_hex_string(u32 value, char *buffer);

void acpi_db_generate_interrupt(char *gsiv_arg);

#endif				/* __ACDEBUG_H__ */
+58 −0
Original line number Diff line number Diff line
@@ -1010,6 +1010,64 @@ void acpi_db_display_resources(char *object_arg)
	acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_generate_ged
 *
 * PARAMETERS:  ged_arg             - Raw GED number, ascii string
 *
 * RETURN:      None
 *
 * DESCRIPTION: Simulate firing of a GED
 *
 ******************************************************************************/

void acpi_db_generate_interrupt(char *gsiv_arg)
{
	u32 gsiv_number;
	struct acpi_ged_handler_info *ged_info = acpi_gbl_ged_handler_list;

	if (!ged_info) {
		acpi_os_printf("No GED handling present\n");
	}

	gsiv_number = strtoul(gsiv_arg, NULL, 0);

	while (ged_info) {

		if (ged_info->int_id == gsiv_number) {
			struct acpi_object_list arg_list;
			union acpi_object arg0;
			acpi_handle evt_handle = ged_info->evt_method;
			acpi_status status;

			acpi_os_printf("Evaluate GED _EVT (GSIV=%d)\n",
				       gsiv_number);

			if (!evt_handle) {
				acpi_os_printf("Undefined _EVT method\n");
				return;
			}

			arg0.integer.type = ACPI_TYPE_INTEGER;
			arg0.integer.value = gsiv_number;

			arg_list.count = 1;
			arg_list.pointer = &arg0;

			status =
			    acpi_evaluate_object(evt_handle, NULL, &arg_list,
						 NULL);
			if (ACPI_FAILURE(status)) {
				acpi_os_printf("Could not evaluate _EVT\n");
				return;
			}

		}
		ged_info = ged_info->next;
	}
}

#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
 *
+8 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ enum acpi_ex_debugger_commands {
	CMD_THREADS,

	CMD_TEST,
	CMD_INTERRUPT,
#endif
};

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

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

	case CMD_INTERRUPT:

		acpi_db_generate_interrupt(acpi_gbl_db_args[1]);
		break;

	case CMD_GPE:

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