diff options
author | Jose Marinho <jose.marinho@arm.com> | 2023-03-26 20:06:00 +0100 |
---|---|---|
committer | Jose Marinho <jose.marinho@arm.com> | 2023-05-09 09:24:16 +0100 |
commit | ef7cf185a046d76119b631f16e7c991543c80edc (patch) | |
tree | ef5aed5eb59edaa93cb4c41f3f7ea501350b91ee | |
parent | dc6fd1d12903015726a8a6f87f63e86141576a68 (diff) | |
download | acpica-ef7cf185a046d76119b631f16e7c991543c80edc.tar.gz |
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>
-rw-r--r-- | source/components/debugger/dbcmds.c | 60 | ||||
-rw-r--r-- | source/components/debugger/dbinput.c | 8 | ||||
-rw-r--r-- | source/include/acdebug.h | 4 |
3 files changed, 71 insertions, 1 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index b8c2b4228..6636f7b97 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -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) /******************************************************************************* * diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 5e5c62893..d98c24870 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -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]); diff --git a/source/include/acdebug.h b/source/include/acdebug.h index c1596ee89..054de129e 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -619,4 +619,8 @@ AcpiDbUint32ToHexString ( UINT32 Value, char *Buffer); +void +AcpiDbGenerateInterrupt ( + char *GsivArg); + #endif /* __ACDEBUG_H__ */ |