Add interrupt command to acpiexec

This commit add the Interrupt command to acpiexec.
The Interrupt command simulates an interrupt with a IntID (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 IntID.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Signed-off-by: Jose Marinho <jose.marinho@arm.com>
This commit is contained in:
Jose Marinho 2023-03-26 20:06:00 +01:00
parent dc6fd1d129
commit ef7cf185a0
3 changed files with 71 additions and 1 deletions

View File

@ -156,7 +156,7 @@
#include "acnamesp.h"
#include "acresrc.h"
#include "actables.h"
#include "limits.h"
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbcmds")
@ -1291,6 +1291,64 @@ AcpiDbDisplayResources (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbGenerateGed
*
* PARAMETERS: GedArg - Raw GED number, ascii string
*
* RETURN: None
*
* DESCRIPTION: Simulate firing of a GED
*
******************************************************************************/
void
AcpiDbGenerateInterrupt (
char *GsivArg)
{
UINT32 GsivNumber;
ACPI_GED_HANDLER_INFO *GedInfo = AcpiGbl_GedHandlerList;
if (!GedInfo) {
AcpiOsPrintf ("No GED handling present\n");
}
GsivNumber = strtoul (GsivArg, NULL, 0);
while (GedInfo) {
if (GedInfo->IntId == GsivNumber) {
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg0;
ACPI_HANDLE EvtHandle = GedInfo->EvtMethod;
ACPI_STATUS Status;
AcpiOsPrintf ("Evaluate GED _EVT (GSIV=%d)\n", GsivNumber);
if (!EvtHandle) {
AcpiOsPrintf ("Undefined _EVT method\n");
return;
}
Arg0.Integer.Type = ACPI_TYPE_INTEGER;
Arg0.Integer.Value = GsivNumber;
ArgList.Count = 1;
ArgList.Pointer = &Arg0;
Status = AcpiEvaluateObject (EvtHandle, NULL, &ArgList, NULL);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not evaluate _EVT\n");
return;
}
}
GedInfo = GedInfo->Next;
}
}
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*

View File

@ -264,6 +264,7 @@ enum AcpiExDebuggerCommands
CMD_THREADS,
CMD_TEST,
CMD_INTERRUPT,
#endif
};
@ -345,6 +346,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"THREADS", 3},
{"TEST", 1},
{"INTERRUPT", 1},
#endif
{NULL, 0}
};
@ -461,6 +463,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{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}
};
@ -1263,6 +1266,11 @@ AcpiDbCommandDispatch (
AcpiOsPrintf ("Event command not implemented\n");
break;
case CMD_INTERRUPT:
AcpiDbGenerateInterrupt (AcpiGbl_DbArgs[1]);
break;
case CMD_GPE:
AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);

View File

@ -619,4 +619,8 @@ AcpiDbUint32ToHexString (
UINT32 Value,
char *Buffer);
void
AcpiDbGenerateInterrupt (
char *GsivArg);
#endif /* __ACDEBUG_H__ */