Conversion to new minimal-parse-subtree model of method execution

date	2000.08.08.17.34.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:24:10 +00:00
parent 0cca16da97
commit 36b178a8d2
5 changed files with 113 additions and 195 deletions

View File

@ -115,11 +115,11 @@
#include "acpi.h"
#include "parser.h"
#include "tables.h"
#include "namesp.h"
#include "interp.h"
#include "debugger.h"
#include "acparser.h"
#include "actables.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acdebug.h"
#ifdef ENABLE_DEBUGGER
@ -132,20 +132,19 @@
* Globals that are specific to the debugger
*/
char LineBuf[80];
char ParsedBuf[80];
char ScopeBuf[40];
char DebugFilename[40];
char *Args[DB_MAX_ARGS];
char *Buffer;
char *Filename = NULL;
INT8 LineBuf[80];
INT8 ParsedBuf[80];
INT8 ScopeBuf[40];
INT8 DebugFilename[40];
INT8 *Args[DB_MAX_ARGS];
INT8 *Buffer;
INT8 *Filename = NULL;
BOOLEAN OutputToFile = FALSE;
UINT32 AcpiGbl_DbDebugLevel = 0x0FFFFFFF;
UINT32 AcpiGbl_DbConsoleDebugLevel = DEBUG_DEFAULT;
UINT8 AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
UINT32 AcpiGbl_MethodBreakpoint = 0;
BOOLEAN opt_tables = FALSE;
@ -274,7 +273,7 @@ COMMAND_INFO Commands[] =
void
AcpiDbDisplayHelp (
char *HelpType)
INT8 *HelpType)
{
@ -380,18 +379,18 @@ AcpiDbDisplayHelp (
*
*****************************************************************************/
char *
INT8 *
AcpiDbGetNextToken (
char *String,
char **Next)
INT8 *String,
INT8 **Next)
{
char *Start;
INT8 *Start;
/* At end of buffer? */
if (!String || !(*String))
{
return NULL;
return (NULL);
}
@ -406,7 +405,7 @@ AcpiDbGetNextToken (
if (!(*String))
{
return NULL;
return (NULL);
}
}
@ -431,7 +430,7 @@ AcpiDbGetNextToken (
*Next = String + 1;
}
return Start;
return (Start);
}
@ -450,12 +449,12 @@ AcpiDbGetNextToken (
INT32
AcpiDbGetLine (
char *InputBuffer)
INT8 *InputBuffer)
{
UINT32 i;
INT32 Count;
char *Next;
char *This;
INT8 *Next;
INT8 *This;
STRCPY (ParsedBuf, InputBuffer);
@ -485,7 +484,7 @@ AcpiDbGetLine (
if (Count)
Count--; /* Number of args only */
return Count;
return (Count);
}
@ -503,27 +502,27 @@ AcpiDbGetLine (
INT32
AcpiDbMatchCommand (
char *UserCommand)
INT8 *UserCommand)
{
UINT32 i;
if (!UserCommand || UserCommand[0] == 0)
{
return CMD_NULL;
return (CMD_NULL);
}
for (i = CMD_FIRST_VALID; Commands[i].Name; i++)
{
if (STRSTR (Commands[i].Name, UserCommand) == Commands[i].Name)
{
return i;
return (i);
}
}
/* Command not recognized */
return CMD_NOT_FOUND;
return (CMD_NOT_FOUND);
}
@ -541,14 +540,14 @@ AcpiDbMatchCommand (
ACPI_STATUS
AcpiDbCommandDispatch (
char *InputBuffer,
INT8 *InputBuffer,
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
{
UINT32 Temp;
INT32 CommandIndex;
INT32 ParamCount;
char *CommandLine;
INT8 *CommandLine;
ACPI_STATUS Status = AE_CTRL_TRUE;
@ -618,7 +617,7 @@ AcpiDbCommandDispatch (
if (ACPI_FAILURE(Status))
{
AcpiOsPrintf("AcpiEnable failed (0x%x)\n", Status);
return Status;
return (Status);
}
break;
@ -651,26 +650,26 @@ AcpiDbCommandDispatch (
CommandLine = AcpiDbGetFromHistory (Args[1]);
if (!CommandLine)
{
return AE_CTRL_TRUE;
return (AE_CTRL_TRUE);
}
Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
if (Status == AE_OK)
if (ACPI_SUCCESS (Status))
Status = AE_CTRL_TRUE;
return Status;
return (Status);
break;
case CMD_HISTORY_LAST:
CommandLine = AcpiDbGetFromHistory (NULL);
if (!CommandLine)
{
return AE_CTRL_TRUE;
return (AE_CTRL_TRUE);
}
Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
if (Status == AE_OK)
if (ACPI_SUCCESS (Status))
Status = AE_CTRL_TRUE;
return Status;
return (Status);
case CMD_INFORMATION:
AcpiDbDisplayMethodInfo (Op);
@ -680,8 +679,10 @@ AcpiDbCommandDispatch (
if (Op)
{
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_MethodBreakpoint = 0;
return AE_OK;
/* TBD: Must get current walk state */
/* AcpiGbl_MethodBreakpoint = 0; */
return (AE_OK);
}
break;
@ -713,7 +714,7 @@ AcpiDbCommandDispatch (
Status = AcpiDbLoadAcpiTable (Args[1]);
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
@ -722,7 +723,7 @@ AcpiDbCommandDispatch (
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
break;
@ -834,7 +835,7 @@ AcpiDbCommandDispatch (
/* Add all commands that come here to the history buffer */
AcpiDbAddToHistory (InputBuffer);
return Status;
return (Status);
}
@ -912,7 +913,7 @@ AcpiDbSingleThread (
ACPI_STATUS
AcpiDbUserCommands (
char Prompt,
INT8 Prompt,
ACPI_GENERIC_OP *Op)
{
ACPI_STATUS Status = AE_OK;
@ -970,7 +971,7 @@ AcpiDbUserCommands (
*/
AcpiTerminate ();
return Status;
return (Status);
}

View File

@ -115,13 +115,14 @@
#include "acpi.h"
#include "parser.h"
#include "acparser.h"
#include "amlcode.h"
#include "namesp.h"
#include "parser.h"
#include "events.h"
#include "interp.h"
#include "debugger.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "acdispat.h"
#ifdef ENABLE_DEBUGGER
@ -182,7 +183,7 @@ AcpiDbDumpBuffer (
AcpiOsPrintf ("\nLocation 0x%X:\n", Address);
AcpiDbgLevel |= TRACE_TABLES;
AcpiCmDumpBuffer ((char *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
AcpiCmDumpBuffer ((INT8 *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
@ -245,7 +246,7 @@ AcpiDbDumpObject (
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("[Buffer] Value: ");
AcpiCmDumpBuffer ((char *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
AcpiCmDumpBuffer ((INT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
break;
@ -282,7 +283,7 @@ AcpiDbDumpObject (
void
AcpiDbPrepNamestring (
char *Name)
INT8 *Name)
{
@ -353,7 +354,8 @@ AcpiDbSecondPassParse (
if (Op->Opcode == AML_METHOD_OP)
{
Method = (ACPI_DEFERRED_OP *) Op;
Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength, 0);
Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength, 0,
NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
BaseAmlOffset = (Method->Value.Arg)->AmlOffset + 1;
@ -380,13 +382,13 @@ AcpiDbSecondPassParse (
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
Op = AcpiPsGetDepthNext (Root, Op);
}
return Status;
return (Status);
}
@ -404,9 +406,9 @@ AcpiDbSecondPassParse (
ACPI_NAMED_OBJECT*
AcpiDbLocalNsLookup (
char *Name)
INT8 *Name)
{
char *InternalPath;
INT8 *InternalPath;
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *Entry = NULL;
@ -419,7 +421,7 @@ AcpiDbLocalNsLookup (
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Invalid namestring: %s\n", Name);
return NULL;
return (NULL);
}
/* Lookup the name */
@ -438,7 +440,7 @@ AcpiDbLocalNsLookup (
AcpiCmFree (InternalPath);
return Entry;
return (Entry);
}

View File

@ -115,13 +115,13 @@
#include "acpi.h"
#include "parser.h"
#include "acparser.h"
#include "amlcode.h"
#include "namesp.h"
#include "parser.h"
#include "events.h"
#include "interp.h"
#include "debugger.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#ifdef ENABLE_DEBUGGER
@ -155,19 +155,18 @@ AcpiDbSingleStep (
/* Is there a breakpoint set? */
if (AcpiGbl_MethodBreakpoint)
if (WalkState->MethodBreakpoint)
{
/* Check if the breakpoint has been reached or passed */
if ((AcpiGbl_BreakpointWalk == WalkState) &&
(AcpiGbl_MethodBreakpoint <= Op->AmlOffset))
if (WalkState->MethodBreakpoint <= Op->AmlOffset)
{
/* Hit the breakpoint, resume single step, reset breakpoint */
AcpiOsPrintf ("***Break*** at AML offset 0x%X\n", Op->AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
AcpiGbl_MethodBreakpoint = 0;
WalkState->MethodBreakpoint = 0;
}
}
@ -179,7 +178,7 @@ AcpiDbSingleStep (
if (Op->Opcode == AML_NAMEDFIELD_OP)
{
return AE_OK;
return (AE_OK);
}
switch (OpType)
@ -232,6 +231,24 @@ AcpiDbSingleStep (
AcpiDbDisplayOp (Op, ACPI_UINT32_MAX);
if ((Op->Opcode == AML_IF_OP) ||
(Op->Opcode == AML_WHILE_OP))
{
if (WalkState->ControlState->Common.Value)
{
AcpiOsPrintf ("Predicate was TRUE, executed block\n");
}
else
{
AcpiOsPrintf ("Predicate is FALSE, skipping block\n");
}
}
else if (Op->Opcode == AML_ELSE_OP)
{
}
/* Restore everything */
Op->Next = Next;
@ -281,8 +298,7 @@ AcpiDbSingleStep (
/* TBD: [Future] don't kill the user breakpoint! */
AcpiGbl_MethodBreakpoint = Op->AmlOffset + 1; /* Must be non-zero! */
AcpiGbl_BreakpointWalk = WalkState;
WalkState->MethodBreakpoint = Op->AmlOffset + 1; /* Must be non-zero! */
}
@ -334,7 +350,7 @@ AcpiDbSingleStep (
/* User commands complete, continue execution of the interrupted method */
return Status;
return (Status);
}
@ -391,7 +407,7 @@ AcpiDbInitialize (void)
}
return 0;
return (0);
}

View File

@ -115,10 +115,10 @@
#include "acpi.h"
#include "parser.h"
#include "acparser.h"
#include "amlcode.h"
#include "namesp.h"
#include "debugger.h"
#include "acnamesp.h"
#include "acdebug.h"
#ifdef ENABLE_DEBUGGER
@ -130,7 +130,7 @@
#define MAX_SHOW_ENTRY 128
char *INDENT_STRING = "....";
INT8 *INDENT_STRING = "....";
/*******************************************************************************
@ -156,14 +156,14 @@ AcpiDbBlockType (
switch (Op->Opcode)
{
case AML_METHOD_OP:
return BLOCK_BRACE;
return (BLOCK_BRACE);
break;
default:
break;
}
return BLOCK_PAREN;
return (BLOCK_PAREN);
}
@ -216,7 +216,7 @@ AcpiPsDisplayObjectPathname (
}
AcpiOsPrintf (")");
return AE_OK;
return (AE_OK);
}
#else
@ -227,7 +227,7 @@ AcpiPsDisplayObjectPathname (
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *Nte;
char Buffer[MAX_SHOW_ENTRY];
INT8 Buffer[MAX_SHOW_ENTRY];
UINT32 BufferSize = MAX_SHOW_ENTRY;
@ -243,7 +243,7 @@ AcpiPsDisplayObjectPathname (
* is not in the namespace. This can happen during single
* stepping where a dynamic named object is *about* to be created.
*/
return AE_OK;
return (AE_OK);
}
/* Convert NTE/handle to a full pathname */
@ -252,11 +252,11 @@ AcpiPsDisplayObjectPathname (
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("****Could not get pathname****)");
return Status;
return (Status);
}
AcpiOsPrintf ("%s)", Buffer);
return AE_OK;
return (AE_OK);
}
#endif
@ -434,7 +434,7 @@ AcpiDbDisplayOp (
void
AcpiDbDisplayNamestring (
char *Name)
INT8 *Name)
{
UINT32 SegCount;
BOOLEAN DoDot = FALSE;
@ -771,16 +771,7 @@ AcpiDbDisplayOpcode (
/* Just get the opcode name and print it */
Opc = AcpiPsGetOpcodeInfo (Op->Opcode);
if (Opc)
{
DEBUG_ONLY_MEMBERS ((AcpiOsPrintf ("%s", Opc->Name)));
}
else
{
AcpiOsPrintf ("<Opcode 0x%04x>", Op->Opcode);
}
DEBUG_ONLY_MEMBERS ((AcpiOsPrintf ("%s", Opc->Name)));
break;
}

View File

@ -2,7 +2,6 @@
*
* Module Name: evevent - Fixed and General Purpose AcpiEvent
* handling and dispatch
* $Revision: 1.15 $
*
*****************************************************************************/
@ -122,98 +121,7 @@
#include "accommon.h"
#define _COMPONENT EVENT_HANDLING
MODULE_NAME ("evevent")
/**************************************************************************
*
* FUNCTION: AcpiEvInitialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
* configured, disables SCI event sources, installs the SCI
* handler
*
*************************************************************************/
ACPI_STATUS
AcpiEvInitialize (
void)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("EvInitialize");
/* Make sure we've got ACPI tables */
if (!AcpiGbl_DSDT)
{
DEBUG_PRINT (ACPI_WARN, ("EvInitialize: No ACPI tables present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/* Make sure the BIOS supports ACPI mode */
if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities())
{
DEBUG_PRINT (ACPI_WARN,
("EvInitialize: Only legacy mode supported!\n"));
return_ACPI_STATUS (AE_ERROR);
}
AcpiGbl_OriginalMode = AcpiHwGetMode();
/*
* Initialize the Fixed and General Purpose AcpiEvents prior. This is
* done prior to enabling SCIs to prevent interrupts from occuring
* before handers are installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_FATAL,
("EvInitialize: Unable to initialize fixed events.\n"));
return_ACPI_STATUS (Status);
}
Status = AcpiEvGpeInitialize ();
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_FATAL,
("EvInitialize: Unable to initialize general purpose events.\n"));
return_ACPI_STATUS (Status);
}
/* Install the SCI handler */
Status = AcpiEvInstallSciHandler ();
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_FATAL,
("EvInitialize: Unable to install System Control Interrupt Handler\n"));
return_ACPI_STATUS (Status);
}
/* Install handlers for control method GPE handlers (_Lxx, _Exx) */
AcpiEvInitGpeControlMethods ();
/* Install the handler for the Global Lock */
Status = AcpiEvInitGlobalLockHandler ();
return_ACPI_STATUS (Status);
}
MODULE_NAME ("evevent");
/******************************************************************************
@ -353,7 +261,7 @@ AcpiEvFixedEventDispatch (
{
/* Clear the status bit */
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS +
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, (INT32)TMR_STS +
Event, 1);
/*
@ -559,13 +467,13 @@ AcpiEvSaveMethodInfo (
void **ReturnValue)
{
UINT32 GpeNumber;
NATIVE_CHAR Name[ACPI_NAME_SIZE + 1];
INT8 Name[ACPI_NAME_SIZE + 1];
UINT8 Type;
/* Extract the name from the object and convert to a string */
MOVE_UNALIGNED32_TO_32 (Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name);
MOVE_UNALIGNED32_TO_32 (Name, &((ACPI_NAMED_OBJECT*) ObjHandle)->Name);
Name[ACPI_NAME_SIZE] = 0;
/*
@ -667,7 +575,7 @@ AcpiEvInitGpeControlMethods (void)
/* Traverse the namespace under \_GPE to find all methods there */
Status = AcpiWalkNamespace (ACPI_TYPE_METHOD, AcpiGbl_GpeObjHandle,
ACPI_UINT32_MAX, AcpiEvSaveMethodInfo,
ACPI_INT32_MAX, AcpiEvSaveMethodInfo,
NULL, NULL);
return_ACPI_STATUS (Status);