Ran acpisrc source cleanup

date	2000.09.15.17.15.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:21:43 +00:00
parent bc7f0d326e
commit 507ba837fc
7 changed files with 682 additions and 704 deletions

View File

@ -1,9 +1,10 @@
/******************************************************************************
/*******************************************************************************
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 1.27 $
*
*****************************************************************************/
******************************************************************************/
/******************************************************************************
*
@ -125,33 +126,38 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbfileio");
MODULE_NAME ("dbfileio")
ACPI_GENERIC_OP *root;
ACPI_PARSE_OBJECT *root;
#ifdef ACPI_APPLICATION
#include <stdio.h>
FILE *DebugFile = NULL;
FILE *DebugFile = NULL;
#endif
/* NOTE: this is here for lack of a better place. It is used in all flavors of the debugger, need LCD file */
/*
* NOTE: this is here for lack of a better place. It is used in all
* flavors of the debugger, need LCD file
*/
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbMatchArgument
*
* PARAMETERS: UserArgument - User command line
* PARAMETERS: UserArgument - User command line
* Arguments - Array of commands to match against
*
* RETURN: Index into command array, -1 if not found
* RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found
*
* DESCRIPTION: Search command array for a command match
*
*****************************************************************************/
******************************************************************************/
OBJECT_TYPE_INTERNAL
AcpiDbMatchArgument (
INT8 *UserArgument,
NATIVE_CHAR *UserArgument,
ARGUMENT_INFO *Arguments)
{
UINT32 i;
@ -176,7 +182,7 @@ AcpiDbMatchArgument (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbCloseDebugFile
*
@ -186,7 +192,7 @@ AcpiDbMatchArgument (
*
* DESCRIPTION: If open, close the current debug output file
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbCloseDebugFile (
@ -207,21 +213,21 @@ AcpiDbCloseDebugFile (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbOpenDebugFile
*
* PARAMETERS: Name - Filename
* PARAMETERS: Name - Filename to open
*
* RETURN: Status
*
* DESCRIPTION: Open a file where debug output will be directed.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbOpenDebugFile (
INT8 *Name)
NATIVE_CHAR *Name)
{
#ifdef ACPI_APPLICATION
@ -240,17 +246,19 @@ AcpiDbOpenDebugFile (
#ifdef ACPI_APPLICATION
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbLoadTable
*
* PARAMETERS:
* PARAMETERS: fp - File that contains table
* TablePtr - Return value, buffer with table
* TableLenght - Return value, length of table
*
* RETURN: Status
*
* DESCRIPTION: Load the DSDT from the file pointer
*
*****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiDbLoadTable(
@ -259,7 +267,7 @@ AcpiDbLoadTable(
UINT32 *TableLength)
{
ACPI_TABLE_HEADER TableHeader;
INT8 *AmlPtr;
UINT8 *AmlPtr;
UINT32 AmlLength;
@ -290,7 +298,7 @@ AcpiDbLoadTable(
}
AmlPtr = (INT8 *) *TablePtr + sizeof (TableHeader);
AmlPtr = (UINT8 *) *TablePtr + sizeof (TableHeader);
AmlLength = *TableLength - sizeof (TableHeader);
/* Copy the header to the buffer */
@ -314,30 +322,31 @@ AcpiDbLoadTable(
#endif
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbLoadAcpiTable
*
* PARAMETERS:
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
*****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiDbLoadAcpiTable (
INT8 *Filename)
NATIVE_CHAR *Filename)
{
#ifdef ACPI_APPLICATION
FILE *fp;
ACPI_STATUS Status;
ACPI_TABLE_HEADER *TablePtr;
UINT32 TableLength;
ACPI_TABLE_DESC TableInfo;
/* Open the file */
fp = fopen (Filename, "rb");
if (!fp)
{
@ -345,6 +354,9 @@ AcpiDbLoadAcpiTable (
return (AE_ERROR);
}
/* Get the entire file */
AcpiOsPrintf ("Loading Acpi table from file %s\n", Filename);
Status = AcpiDbLoadTable (fp, &TablePtr, &TableLength);
fclose(fp);
@ -358,25 +370,25 @@ AcpiDbLoadAcpiTable (
/* Attempt to recognize and install the table */
TableInfo.Pointer = TablePtr;
Status = AcpiTbInstallTable (TablePtr, &TableInfo);
Status = AcpiLoadTable (TablePtr);
if (ACPI_FAILURE (Status))
{
if (Status == AE_EXIST)
{
AcpiOsPrintf ("Table is already installed/loaded\n");
AcpiOsPrintf ("Table %4.4s is already installed\n",
&TablePtr->Signature);
}
else
{
AcpiOsPrintf ("Could not install table, %s\n", AcpiCmFormatException (Status));
AcpiOsPrintf ("Could not install table, %s\n",
AcpiCmFormatException (Status));
}
free (TablePtr);
return (Status);
}
AcpiOsPrintf ("%s successfully loaded and installed at %p\n",
AcpiGbl_AcpiTableData[TableInfo.Type].Name, TablePtr);
AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n",
&TablePtr->Signature, TablePtr);
AcpiGbl_AcpiHardwarePresent = FALSE;

View File

@ -1,6 +1,7 @@
/******************************************************************************
*
*
* Module Name: dbhistry - debugger HISTORY command
* $Revision: 1.15 $
*
*****************************************************************************/
@ -37,9 +38,9 @@
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
@ -47,11 +48,11 @@
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
@ -85,7 +86,7 @@
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
@ -114,64 +115,68 @@
*****************************************************************************/
#include <acpi.h>
#include <parser.h>
#include <dispatch.h>
#include <amlcode.h>
#include <namesp.h>
#include <parser.h>
#include <events.h>
#include <interp.h>
#include <debugger.h>
#include <tables.h>
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "actables.h"
#ifdef ACPI_DEBUG
#ifdef ENABLE_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbhistry");
MODULE_NAME ("dbhistry")
#define HI_NO_HISTORY 0
#define HI_RECORD_HISTORY 1
#define HISTORY_SIZE 20
typedef struct HistoryInfo
{
char Command[80];
NATIVE_CHAR Command[80];
UINT32 CmdNum;
} HISTORY_INFO;
#define HI_NO_HISTORY 0
#define HI_RECORD_HISTORY 1
#define HISTORY_SIZE 20
HISTORY_INFO HistoryBuffer[HISTORY_SIZE];
UINT32 LoHistory = 0;
UINT32 NumHistory = 0;
UINT32 NextHistoryIndex = 0;
UINT16 LoHistory = 0;
UINT16 NumHistory = 0;
UINT16 NextHistoryIndex = 0;
UINT32 NextCmdNum = 1;
/******************************************************************************
*
* FUNCTION: DbAddToHistory
/*******************************************************************************
*
* PARAMETERS: None
* FUNCTION: AcpiDbAddToHistory
*
* PARAMETERS: CommandLine - Command to add
*
* RETURN: None
*
* DESCRIPTION: Add a command line to the history buffer.
*
*****************************************************************************/
******************************************************************************/
void
DbAddToHistory (
char *CommandLine)
AcpiDbAddToHistory (
NATIVE_CHAR *CommandLine)
{
/* Put command into the next available slot */
STRCPY (HistoryBuffer[NextHistoryIndex].Command, CommandLine);
HistoryBuffer[NextHistoryIndex].CmdNum = NextCmdNum;
/* Adjust indexes */
if ((NumHistory == HISTORY_SIZE) &&
(NextHistoryIndex == LoHistory))
{
@ -198,9 +203,9 @@ DbAddToHistory (
}
/******************************************************************************
*
* FUNCTION: DbDisplayHistory
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayHistory
*
* PARAMETERS: None
*
@ -208,19 +213,22 @@ DbAddToHistory (
*
* DESCRIPTION: Display the contents of the history buffer
*
*****************************************************************************/
******************************************************************************/
void
DbDisplayHistory (void)
AcpiDbDisplayHistory (void)
{
UINT32 i;
UINT32 HistoryIndex;
NATIVE_UINT i;
UINT16 HistoryIndex;
HistoryIndex = LoHistory;
/* Dump entire history buffer */
for (i = 0; i < NumHistory; i++)
{
OsdPrintf ("%d %s\n", HistoryBuffer[HistoryIndex].CmdNum, &HistoryBuffer[HistoryIndex].Command);
AcpiOsPrintf ("%ld %s\n", HistoryBuffer[HistoryIndex].CmdNum, HistoryBuffer[HistoryIndex].Command);
HistoryIndex++;
if (HistoryIndex >= HISTORY_SIZE)
@ -231,9 +239,9 @@ DbDisplayHistory (void)
}
/******************************************************************************
*
* FUNCTION: DbGetFromHistory
/*******************************************************************************
*
* FUNCTION: AcpiDbGetFromHistory
*
* PARAMETERS: CommandNumArg - String containing the number of the
* command to be retrieved
@ -242,14 +250,14 @@ DbDisplayHistory (void)
*
* DESCRIPTION: Get a command from the history buffer
*
*****************************************************************************/
******************************************************************************/
char *
DbGetFromHistory (
char *CommandNumArg)
NATIVE_CHAR *
AcpiDbGetFromHistory (
NATIVE_CHAR *CommandNumArg)
{
UINT32 i;
UINT32 HistoryIndex;
NATIVE_UINT i;
UINT16 HistoryIndex;
UINT32 CmdNum;
@ -263,11 +271,16 @@ DbGetFromHistory (
CmdNum = STRTOUL (CommandNumArg, NULL, 0);
}
/* Search history buffer */
HistoryIndex = LoHistory;
for (i = 0; i < NumHistory; i++)
{
if (HistoryBuffer[HistoryIndex].CmdNum == CmdNum)
{
/* Found the commnad, return it */
return (HistoryBuffer[HistoryIndex].Command);
}
@ -279,10 +292,10 @@ DbGetFromHistory (
}
}
OsdPrintf ("Invalid history number: %d\n", HistoryIndex);
return NULL;
AcpiOsPrintf ("Invalid history number: %d\n", HistoryIndex);
return (NULL);
}
#endif
#endif /* ENABLE_DEBUGGER */

View File

@ -1,8 +1,9 @@
/******************************************************************************
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 1.50 $
*
*****************************************************************************/
******************************************************************************/
/******************************************************************************
*
@ -114,41 +115,37 @@
*****************************************************************************/
#include "acpi.h"
#include "acxface.h"
#include "amlcode.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 ACPI_DEBUG
#ifdef ENABLE_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbinput");
MODULE_NAME ("dbinput")
/*
* 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;
NATIVE_CHAR LineBuf[80];
NATIVE_CHAR ParsedBuf[80];
NATIVE_CHAR ScopeBuf[40];
NATIVE_CHAR DebugFilename[40];
NATIVE_CHAR *Args[DB_MAX_ARGS];
NATIVE_CHAR *Buffer;
NATIVE_CHAR *Filename = NULL;
BOOLEAN OutputToFile = FALSE;
UINT32 AcpiGbl_DbDebugLevel = 0x0FFFFFFF;
UINT32 AcpiGbl_DbConsoleDebugLevel = DEBUG_DEFAULT;
UINT32 AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | TRACE_TABLES;
UINT8 AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
UINT32 AcpiGbl_MethodBreakpoint = 0;
BOOLEAN opt_tables = FALSE;
@ -158,8 +155,11 @@ BOOLEAN opt_parse_jit = FALSE;
BOOLEAN opt_verbose = TRUE;
/* This list of commands must match the string table below it */
/*
* Top-level debugger commands.
*
* This list of commands must match the string table below it
*/
enum AcpiAmlDebuggerCommands
{
@ -198,6 +198,7 @@ enum AcpiAmlDebuggerCommands
CMD_OWNER,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESULTS,
CMD_SET,
CMD_STATS,
@ -249,6 +250,7 @@ COMMAND_INFO Commands[] =
{"OWNER", 1},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESULTS", 0},
{"SET", 3},
{"STATS", 0},
@ -262,23 +264,21 @@ COMMAND_INFO Commands[] =
};
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayHelp
*
* PARAMETERS: None
* PARAMETERS: HelpType - Subcommand (optional)
*
* RETURN: None
*
* DESCRIPTION: Print a usage message
* DESCRIPTION: Print a usage message.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbDisplayHelp (
char *HelpType)
NATIVE_CHAR *HelpType)
{
@ -286,13 +286,13 @@ AcpiDbDisplayHelp (
if (!HelpType)
{
AcpiOsdPrintf ("ACPI CA Debugger Commands\n\n");
AcpiOsdPrintf ("The following classes of commands are available. Help is available for\n");
AcpiOsdPrintf ("each class by entering \"Help <ClassName>\"\n\n");
AcpiOsdPrintf (" [GENERAL] General-Purpose Commands\n");
AcpiOsdPrintf (" [NAMESPACE] Namespace Access Commands\n");
AcpiOsdPrintf (" [METHOD] Control Method Execution Commands\n");
AcpiOsdPrintf (" [FILE] File I/O Commands\n");
AcpiOsPrintf ("ACPI CA Debugger Commands\n\n");
AcpiOsPrintf ("The following classes of commands are available. Help is available for\n");
AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n");
AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n");
AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n");
AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n");
AcpiOsPrintf (" [FILE] File I/O Commands\n");
return;
}
@ -307,94 +307,96 @@ AcpiDbDisplayHelp (
switch (HelpType[0])
{
case 'G':
AcpiOsdPrintf ("\nGeneral-Purpose Commands\n\n");
AcpiOsdPrintf ("Allocations Display list of current memory allocations\n");
AcpiOsdPrintf ("Dump <Address>|<Namepath>\n");
AcpiOsdPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
AcpiOsdPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
AcpiOsdPrintf ("Help This help screen\n");
AcpiOsdPrintf ("History Display command history buffer\n");
AcpiOsdPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
AcpiOsdPrintf ("Quit or Exit Exit this command\n");
AcpiOsdPrintf ("Stats [Allocations|Memory|Misc\n");
AcpiOsdPrintf (" |Objects|Tables] Display namespace and memory statistics\n");
AcpiOsdPrintf ("Tables Display info about loaded ACPI tables\n");
AcpiOsdPrintf ("Unload Unload an ACPI table\n");
AcpiOsdPrintf ("! <CommandNumber> Execute command from history buffer\n");
AcpiOsdPrintf ("!! Execute last command again\n");
AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n");
AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
AcpiOsPrintf ("Dump <Address>|<Namepath>\n");
AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
AcpiOsPrintf ("Help This help screen\n");
AcpiOsPrintf ("History Display command history buffer\n");
AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
AcpiOsPrintf ("Quit or Exit Exit this command\n");
AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n");
AcpiOsPrintf (" |Objects|Tables] Display namespace and memory statistics\n");
AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n");
AcpiOsPrintf ("Unload Unload an ACPI table\n");
AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n");
AcpiOsPrintf ("!! Execute last command again\n");
return;
case 'N':
AcpiOsdPrintf ("\nNamespace Access Commands\n\n");
AcpiOsdPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
AcpiOsdPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
AcpiOsdPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
AcpiOsdPrintf ("Find <Name> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsdPrintf ("Method Display list of loaded control methods\n");
AcpiOsdPrintf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
AcpiOsdPrintf ("Notify <NamePath> <Value> Send a notification\n");
AcpiOsdPrintf ("Objects <ObjectType> Display all objects of the given type\n");
AcpiOsdPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsdPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsdPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsdPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf ("\nNamespace Access Commands\n\n");
AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
AcpiOsPrintf ("Find <Name> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsPrintf ("Method Display list of loaded control methods\n");
AcpiOsPrintf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
AcpiOsPrintf ("Notify <NamePath> <Value> Send a notification\n");
AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
return;
case 'M':
AcpiOsdPrintf ("\nControl Method Execution Commands\n\n");
AcpiOsdPrintf ("Arguments (or Args) Display method arguments\n");
AcpiOsdPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
AcpiOsdPrintf ("Call Run to next control method invocation\n");
AcpiOsdPrintf ("Go Allow method to run to completion\n");
AcpiOsdPrintf ("Information Display info about the current method\n");
AcpiOsdPrintf ("Into Step into (not over) a method call\n");
AcpiOsdPrintf ("List [# of AcpiAml Opcodes] Display method ASL statements\n");
AcpiOsdPrintf ("Locals Display method local variables\n");
AcpiOsdPrintf ("Results Display method result stack\n");
AcpiOsdPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsdPrintf ("Stop Terminate control method\n");
AcpiOsdPrintf ("Tree Display control method calling tree\n");
AcpiOsdPrintf ("<Enter> Single step next AML opcode (over calls)\n");
AcpiOsPrintf ("\nControl Method Execution Commands\n\n");
AcpiOsPrintf ("Arguments (or Args) Display method arguments\n");
AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
AcpiOsPrintf ("Call Run to next control method invocation\n");
AcpiOsPrintf ("Go Allow method to run to completion\n");
AcpiOsPrintf ("Information Display info about the current method\n");
AcpiOsPrintf ("Into Step into (not over) a method call\n");
AcpiOsPrintf ("List [# of AcpiAml Opcodes] Display method ASL statements\n");
AcpiOsPrintf ("Locals Display method local variables\n");
AcpiOsPrintf ("Results Display method result stack\n");
AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsPrintf ("Stop Terminate control method\n");
AcpiOsPrintf ("Tree Display control method calling tree\n");
AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
return;
case 'F':
AcpiOsdPrintf ("\nFile I/O Commands\n\n");
AcpiOsdPrintf ("Close Close debug output file\n");
AcpiOsdPrintf ("Open <Output Filename> Open a file for debug output\n");
AcpiOsdPrintf ("Load <Input Filename> Load ACPI table from a file\n");
AcpiOsPrintf ("\nFile I/O Commands\n\n");
AcpiOsPrintf ("Close Close debug output file\n");
AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n");
AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n");
return;
default:
AcpiOsdPrintf ("Unrecognized Command Class: %x\n", HelpType);
AcpiOsPrintf ("Unrecognized Command Class: %x\n", HelpType);
return;
}
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbGetNextToken
*
* PARAMETERS: None
* PARAMETERS: String - Command buffer
* Next - Return value, end of next token
*
* RETURN: None
* RETURN: Pointer to the start of the next token.
*
* DESCRIPTION: Command line parsing
* DESCRIPTION: Command line parsing. Get the next token on the command line
*
*****************************************************************************/
******************************************************************************/
char *
NATIVE_CHAR *
AcpiDbGetNextToken (
char *String,
char **Next)
NATIVE_CHAR *String,
NATIVE_CHAR **Next)
{
char *Start;
NATIVE_CHAR *Start;
/* At end of buffer? */
if (!String || !(*String))
{
return NULL;
return (NULL);
}
@ -409,7 +411,7 @@ AcpiDbGetNextToken (
if (!(*String))
{
return NULL;
return (NULL);
}
}
@ -434,32 +436,31 @@ AcpiDbGetNextToken (
*Next = String + 1;
}
return Start;
return (Start);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbGetLine
*
* PARAMETERS: None
* PARAMETERS: InputBuffer - Command line buffer
*
* RETURN: None
*
* DESCRIPTION: Get the next command line from the user. Gets entire line
* up to the next newline
*
*****************************************************************************/
******************************************************************************/
INT32
UINT32
AcpiDbGetLine (
char *InputBuffer)
NATIVE_CHAR *InputBuffer)
{
UINT32 i;
INT32 Count;
char *Next;
char *This;
UINT32 Count;
NATIVE_CHAR *Next;
NATIVE_CHAR *This;
STRCPY (ParsedBuf, InputBuffer);
@ -487,13 +488,15 @@ AcpiDbGetLine (
Count = i;
if (Count)
{
Count--; /* Number of args only */
}
return Count;
return (Count);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbMatchCommand
*
@ -503,56 +506,58 @@ AcpiDbGetLine (
*
* DESCRIPTION: Search command array for a command match
*
*****************************************************************************/
******************************************************************************/
INT32
UINT32
AcpiDbMatchCommand (
char *UserCommand)
NATIVE_CHAR *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);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbCommandDispatch
*
* PARAMETERS:
* PARAMETERS: InputBuffer - Command line buffer
* WalkState - Current walk
* Op - Current (executing) parse op
*
* RETURN: Status
*
* DESCRIPTION: Command dispatcher. Called from two places:
*
*****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiDbCommandDispatch (
char *InputBuffer,
NATIVE_CHAR *InputBuffer,
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
UINT32 Temp;
INT32 CommandIndex;
INT32 ParamCount;
char *CommandLine;
UINT32 CommandIndex;
UINT32 ParamCount;
NATIVE_CHAR *CommandLine;
ACPI_STATUS Status = AE_CTRL_TRUE;
@ -571,7 +576,7 @@ AcpiDbCommandDispatch (
if (ParamCount < Commands[CommandIndex].MinArgs)
{
AcpiOsdPrintf ("%d parameters entered, [%s] requires %d parameters\n",
AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n",
ParamCount, Commands[CommandIndex].Name, Commands[CommandIndex].MinArgs);
return (AE_CTRL_TRUE);
}
@ -621,13 +626,13 @@ AcpiDbCommandDispatch (
Status = AcpiEnable();
if (ACPI_FAILURE(Status))
{
AcpiOsdPrintf("AcpiEnable failed (0x%x)\n", Status);
return Status;
AcpiOsPrintf("AcpiEnable failed (0x%x)\n", Status);
return (Status);
}
break;
case CMD_EVENT:
AcpiOsdPrintf ("Event command not implemented\n");
AcpiOsPrintf ("Event command not implemented\n");
break;
case CMD_EXECUTE:
@ -655,26 +660,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);
@ -684,28 +689,30 @@ 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;
case CMD_LEVEL:
if (ParamCount == 0)
{
AcpiOsdPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel);
AcpiOsdPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel);
AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel);
AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel);
}
else if (ParamCount == 2)
{
Temp = AcpiGbl_DbConsoleDebugLevel;
AcpiGbl_DbConsoleDebugLevel = STRTOUL (Args[1], NULL, 16);
AcpiOsdPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
}
else
{
Temp = AcpiGbl_DbDebugLevel;
AcpiGbl_DbDebugLevel = STRTOUL (Args[1], NULL, 16);
AcpiOsdPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
}
break;
@ -717,16 +724,12 @@ AcpiDbCommandDispatch (
Status = AcpiDbLoadAcpiTable (Args[1]);
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
Status = AcpiLoadNamespace ();
AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
break;
@ -763,6 +766,10 @@ AcpiDbCommandDispatch (
AcpiDbSetScope (Args[1]);
break;
case CMD_REFERENCES:
AcpiDbFindReferences (Args[1]);
break;
case CMD_RESULTS:
AcpiDbDisplayResults ();
break;
@ -789,7 +796,7 @@ AcpiDbCommandDispatch (
/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
// AcpiInitialize (NULL);
/* AcpiInitialize (NULL); */
break;
case CMD_THREADS:
@ -813,12 +820,12 @@ AcpiDbCommandDispatch (
if (!OutputToFile)
{
DebugLevel = DEBUG_DEFAULT;
AcpiDbgLevel = DEBUG_DEFAULT;
}
/* Shutdown */
// AcpiCmSubsystemShutdown ();
/* AcpiCmSubsystemShutdown (); */
AcpiDbCloseDebugFile ();
AcpiGbl_DbTerminateThreads = TRUE;
@ -826,7 +833,7 @@ AcpiDbCommandDispatch (
return (AE_CTRL_TERMINATE);
case CMD_NOT_FOUND:
AcpiOsdPrintf ("Unknown Command\n");
AcpiOsPrintf ("Unknown Command\n");
return (AE_CTRL_TRUE);
}
@ -834,22 +841,22 @@ AcpiDbCommandDispatch (
/* Add all commands that come here to the history buffer */
AcpiDbAddToHistory (InputBuffer);
return Status;
return (Status);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbExecuteThread
*
* PARAMETERS: None
* PARAMETERS: Context - Not used
*
* RETURN: None
*
* DESCRIPTION: Debugger execute thread. Waits for a command line, then
* simply dispatches it.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbExecuteThread (
@ -863,14 +870,14 @@ AcpiDbExecuteThread (
AcpiGbl_MethodExecuting = FALSE;
AcpiGbl_StepToNextCall = FALSE;
AcpiCmAcquireMutex (MTX_DEBUG_CMD_READY);
AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
Status = AcpiDbCommandDispatch (LineBuf, NULL, NULL);
AcpiCmReleaseMutex (MTX_DEBUG_CMD_COMPLETE);
AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
}
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbSingleThread
*
@ -881,7 +888,7 @@ AcpiDbExecuteThread (
* DESCRIPTION: Debugger execute thread. Waits for a command line, then
* simply dispatches it.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbSingleThread (
@ -897,25 +904,24 @@ AcpiDbSingleThread (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbUserCommands
*
* PARAMETERS: None
* PARAMETERS: Prompt - User prompt (depends on mode)
* Op - Current executing parse op
*
* RETURN: None
*
* DESCRIPTION: Command line execution for the AML debugger. Commands are
* matched and dispatched here.
*
*****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiDbUserCommands (
char Prompt,
ACPI_GENERIC_OP *Op)
NATIVE_CHAR Prompt,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
@ -932,16 +938,16 @@ AcpiDbUserCommands (
if (!AcpiGbl_MethodExecuting)
{
AcpiOsdPrintf ("%1c ", DB_COMMAND_PROMPT);
AcpiOsPrintf ("%1c ", DB_COMMAND_PROMPT);
}
else
{
AcpiOsdPrintf ("%1c ", DB_EXECUTE_PROMPT);
AcpiOsPrintf ("%1c ", DB_EXECUTE_PROMPT);
}
/* Get the user input line */
AcpiOsdGetLine (LineBuf);
AcpiOsGetLine (LineBuf);
/* Check for single or multithreaded debug */
@ -953,8 +959,8 @@ AcpiDbUserCommands (
* and wait for the command to complete.
*/
AcpiCmReleaseMutex (MTX_DEBUG_CMD_READY);
AcpiCmAcquireMutex (MTX_DEBUG_CMD_COMPLETE);
AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
}
else
@ -972,10 +978,9 @@ AcpiDbUserCommands (
*/
AcpiTerminate ();
return Status;
return (Status);
}
#endif /* ACPI_DEBUG */
#endif /* ENABLE_DEBUGGER */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 1.42 $
* $Revision: 1.34 $
*
******************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
@ -123,7 +123,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbstats")
/*
@ -378,8 +378,6 @@ AcpiDbDisplayStatistics (
{
UINT32 i;
UINT32 Type;
UINT32 Outstanding;
UINT32 Size;
if (!AcpiGbl_DSDT)
@ -411,9 +409,7 @@ AcpiDbDisplayStatistics (
{
#ifndef PARSER_ONLY
case CMD_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiUtDumpAllocationInfo ();
#endif
AcpiCmDumpAllocationInfo ();
break;
#endif
@ -422,7 +418,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("ACPI Table Information:\n\n");
if (AcpiGbl_DSDT)
{
AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
AcpiOsPrintf ("DSDT Length:................% 7ld (0x%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
}
break;
@ -434,7 +430,7 @@ AcpiDbDisplayStatistics (
for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++)
{
AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiCmGetTypeName (i),
AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
}
AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
@ -456,46 +452,39 @@ AcpiDbDisplayStatistics (
case CMD_MEMORY:
AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
AcpiOsPrintf ("\nDynamic Memory Estimates:\n\n");
AcpiOsPrintf ("Parse Tree without Methods:.% 7ld\n", SizeOfParseTree);
AcpiOsPrintf ("Control Method Parse Trees:.% 7ld (If parsed simultaneously)\n", SizeOfMethodTrees);
AcpiOsPrintf ("Namespace Nodes:............% 7ld (%d nodes)\n", sizeof (ACPI_NAMESPACE_NODE) * NumNodes, NumNodes);
AcpiOsPrintf ("Named Internal Objects......% 7ld\n", SizeOfAcpiObjects);
AcpiOsPrintf ("State Cache size............% 7ld\n", AcpiGbl_GenericStateCacheDepth * sizeof (ACPI_GENERIC_STATE));
AcpiOsPrintf ("Parse Cache size............% 7ld\n", AcpiGbl_ParseCacheDepth * sizeof (ACPI_PARSE_OBJECT));
AcpiOsPrintf ("Object Cache size...........% 7ld\n", AcpiGbl_ObjectCacheDepth * sizeof (ACPI_OPERAND_OBJECT));
AcpiOsPrintf ("WalkState Cache size........% 7ld\n", AcpiGbl_WalkStateCacheDepth * sizeof (ACPI_WALK_STATE));
for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
{
AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
{
AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
AcpiGbl_MemoryLists[i].CacheDepth,
AcpiGbl_MemoryLists[i].MaxCacheDepth,
AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
(AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
AcpiGbl_MemoryLists[i].CacheRequests,
AcpiGbl_MemoryLists[i].CacheHits,
AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
AcpiGbl_MemoryLists[i].ObjectSize);
}
Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
AcpiGbl_MemoryLists[i].TotalFreed -
AcpiGbl_MemoryLists[i].CacheDepth;
if (AcpiGbl_MemoryLists[i].ObjectSize)
{
Size = ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
}
else
{
Size = ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
}
AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
AcpiGbl_MemoryLists[i].TotalAllocated,
AcpiGbl_MemoryLists[i].TotalFreed,
Outstanding, Size);
}
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Cache Statistics:\n\n");
AcpiOsPrintf ("State Cache requests........% 7ld\n", AcpiGbl_StateCacheRequests);
AcpiOsPrintf ("State Cache hits............% 7ld\n", AcpiGbl_StateCacheHits);
AcpiOsPrintf ("State Cache depth...........% 7ld (%d remaining entries)\n", AcpiGbl_GenericStateCacheDepth,
MAX_STATE_CACHE_DEPTH - AcpiGbl_GenericStateCacheDepth);
AcpiOsPrintf ("Parse Cache requests........% 7ld\n", AcpiGbl_ParseCacheRequests);
AcpiOsPrintf ("Parse Cache hits............% 7ld\n", AcpiGbl_ParseCacheHits);
AcpiOsPrintf ("Parse Cache depth...........% 7ld (%d remaining entries)\n", AcpiGbl_ParseCacheDepth,
MAX_PARSE_CACHE_DEPTH - AcpiGbl_ParseCacheDepth);
AcpiOsPrintf ("Ext Parse Cache requests....% 7ld\n", AcpiGbl_ExtParseCacheRequests);
AcpiOsPrintf ("Ext Parse Cache hits........% 7ld\n", AcpiGbl_ExtParseCacheHits);
AcpiOsPrintf ("Ext Parse Cache depth.......% 7ld (%d remaining entries)\n", AcpiGbl_ExtParseCacheDepth,
MAX_EXTPARSE_CACHE_DEPTH - AcpiGbl_ExtParseCacheDepth);
AcpiOsPrintf ("Object Cache requests.......% 7ld\n", AcpiGbl_ObjectCacheRequests);
AcpiOsPrintf ("Object Cache hits...........% 7ld\n", AcpiGbl_ObjectCacheHits);
AcpiOsPrintf ("Object Cache depth..........% 7ld (%d remaining entries)\n", AcpiGbl_ObjectCacheDepth,
MAX_OBJECT_CACHE_DEPTH - AcpiGbl_ObjectCacheDepth);
AcpiOsPrintf ("WalkState Cache requests....% 7ld\n", AcpiGbl_WalkStateCacheRequests);
AcpiOsPrintf ("WalkState Cache hits........% 7ld\n", AcpiGbl_WalkStateCacheHits);
AcpiOsPrintf ("WalkState Cache depth.......% 7ld (%d remaining entries)\n", AcpiGbl_WalkStateCacheDepth,
MAX_WALK_CACHE_DEPTH - AcpiGbl_WalkStateCacheDepth);
break;
case CMD_MISC:
@ -509,7 +498,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("Mutex usage:\n\n");
for (i = 0; i < NUM_MTX; i++)
{
AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
AcpiOsPrintf ("%-20s: % 7ld\n", AcpiCmGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
}
break;
@ -519,11 +508,11 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("\nInternal object sizes:\n\n");
AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_NUMBER));
AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
AcpiOsPrintf ("FieldUnit %3d\n", sizeof (ACPI_OBJECT_FIELD_UNIT));
AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
@ -532,7 +521,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
AcpiOsPrintf ("Field %3d\n", sizeof (ACPI_OBJECT_FIELD));
AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));

View File

@ -1,8 +1,9 @@
/******************************************************************************
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 1.31 $
*
*****************************************************************************/
******************************************************************************/
/******************************************************************************
*
@ -115,36 +116,38 @@
#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 ACPI_DEBUG
#ifdef ENABLE_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbutils");
MODULE_NAME ("dbutils")
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbSetOutputDestination
*
* PARAMETERS: Address - Pointer to the buffer
* PARAMETERS: OutputFlags - Current flags word
*
* RETURN: None
*
* DESCRIPTION: Print a portion of a buffer
* DESCRIPTION: Set the current destination for debugger output. Alos sets
* the debug output level accordingly.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbSetOutputDestination (
INT32 OutputFlags)
UINT32 OutputFlags)
{
AcpiGbl_DbOutputFlags = (UINT8) OutputFlags;
@ -162,7 +165,8 @@ AcpiDbSetOutputDestination (
}
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpBuffer
*
@ -172,32 +176,32 @@ AcpiDbSetOutputDestination (
*
* DESCRIPTION: Print a portion of a buffer
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbDumpBuffer (
UINT32 Address)
{
AcpiOsdPrintf ("\nLocation 0x%X:\n", Address);
AcpiOsPrintf ("\nLocation 0x%X:\n", Address);
AcpiDbgLevel |= TRACE_TABLES;
AcpiCmDumpBuffer ((char *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
AcpiCmDumpBuffer ((UINT8 *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpObject
*
* PARAMETERS: MethodName - Method that returned the object
* ReturnObj - The object to dump
* PARAMETERS: ObjDesc - External ACPI object to dump
* Level - Nesting level.
*
* RETURN: None
*
* DESCRIPTION: Dump the contents of an ACPI external object
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbDumpObject (
@ -209,49 +213,49 @@ AcpiDbDumpObject (
if (!ObjDesc)
{
AcpiOsdPrintf ("[Null Object]\n");
AcpiOsPrintf ("[Null Object]\n");
return;
}
for (i = 0; i < Level; i++)
{
AcpiOsdPrintf (" ");
AcpiOsPrintf (" ");
}
switch (ObjDesc->Type)
{
case ACPI_TYPE_ANY:
AcpiOsdPrintf ("[Object Reference] Value: %p\n", ObjDesc->Reference.Handle);
AcpiOsPrintf ("[Object Reference] Value: %p\n", ObjDesc->Reference.Handle);
break;
case ACPI_TYPE_NUMBER:
AcpiOsdPrintf ("[Number] Value: %ld (0x%lX)\n", ObjDesc->Number.Value, ObjDesc->Number.Value);
AcpiOsPrintf ("[Number] Value: %ld (0x%lX)\n", ObjDesc->Number.Value, ObjDesc->Number.Value);
break;
case ACPI_TYPE_STRING:
AcpiOsdPrintf ("[String] Value: ");
AcpiOsPrintf ("[String] Value: ");
for (i = 0; i < ObjDesc->String.Length; i++)
{
AcpiOsdPrintf ("%c", ObjDesc->String.Pointer[i]);
AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
}
AcpiOsdPrintf ("\n");
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_BUFFER:
AcpiOsdPrintf ("[Buffer] Value: ");
AcpiCmDumpBuffer ((char *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
AcpiOsPrintf ("[Buffer] Value: ");
AcpiCmDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
break;
case ACPI_TYPE_PACKAGE:
AcpiOsdPrintf ("[Package] Contains %d Elements: \n", ObjDesc->Package.Count);
AcpiOsPrintf ("[Package] Contains %d Elements: \n", ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
{
@ -262,28 +266,27 @@ AcpiDbDumpObject (
default:
AcpiOsdPrintf ("[Unknown Type] 0x%X \n", ObjDesc->Type);
AcpiOsPrintf ("[Unknown Type] 0x%X \n", ObjDesc->Type);
break;
}
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbPrepNamestring
*
* PARAMETERS:
* PARAMETERS: Name - String to prepare
*
* RETURN: None
*
* DESCRIPTION: Translate all forward slashes and dots to backslashes.
*
*****************************************************************************/
******************************************************************************/
void
AcpiDbPrepNamestring (
char *Name)
NATIVE_CHAR *Name)
{
@ -323,38 +326,40 @@ AcpiDbPrepNamestring (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AdSecondPassParse
* FUNCTION: AcpiDbSecondPassParse
*
* PARAMETERS: Root - Root of the parse tree
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Need to wait until second pass to parse the control methods
* DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until
* second pass to parse the control methods
*
*****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiDbSecondPassParse (
ACPI_GENERIC_OP *Root)
ACPI_PARSE_OBJECT *Root)
{
ACPI_GENERIC_OP *Op = Root;
ACPI_DEFERRED_OP *Method;
ACPI_GENERIC_OP *SearchOp;
ACPI_GENERIC_OP *StartOp;
ACPI_PARSE_OBJECT *Op = Root;
ACPI_PARSE2_OBJECT *Method;
ACPI_PARSE_OBJECT *SearchOp;
ACPI_PARSE_OBJECT *StartOp;
ACPI_STATUS Status = AE_OK;
UINT32 BaseAmlOffset;
AcpiOsdPrintf ("Pass two parse ....\n");
AcpiOsPrintf ("Pass two parse ....\n");
while (Op)
{
if (Op->Opcode == AML_METHOD_OP)
{
Method = (ACPI_DEFERRED_OP *) Op;
Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength, 0);
Method = (ACPI_PARSE2_OBJECT *) Op;
Status = AcpiPsParseAml (Op, Method->Data, Method->Length, 0,
NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
BaseAmlOffset = (Method->Value.Arg)->AmlOffset + 1;
@ -372,42 +377,44 @@ AcpiDbSecondPassParse (
if (Op->Opcode == AML_REGION_OP)
{
/* TBD: [Investigate] this isn't quite the right thing to do! */
// Method = (ACPI_DEFERRED_OP *) Op;
// Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
/*
*
* Method = (ACPI_DEFERRED_OP *) Op;
* Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
*/
}
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
Op = AcpiPsGetDepthNext (Root, Op);
}
return Status;
return (Status);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiDbLocalNsLookup
*
* PARAMETERS:
* PARAMETERS: Name - Name to lookup
*
* RETURN: None
* RETURN: Pointer to a namespace node
*
* DESCRIPTION: Lookup a name in the ACPI namespace
*
*****************************************************************************/
******************************************************************************/
NAME_TABLE_ENTRY *
ACPI_NAMESPACE_NODE *
AcpiDbLocalNsLookup (
char *Name)
NATIVE_CHAR *Name)
{
char *InternalPath;
NATIVE_CHAR *InternalPath;
ACPI_STATUS Status;
NAME_TABLE_ENTRY *Entry = NULL;
ACPI_NAMESPACE_NODE *Node = NULL;
AcpiDbPrepNamestring (Name);
@ -417,8 +424,8 @@ AcpiDbLocalNsLookup (
Status = AcpiNsInternalizeName (Name, &InternalPath);
if (ACPI_FAILURE (Status))
{
AcpiOsdPrintf ("Invalid namestring: %s\n", Name);
return NULL;
AcpiOsPrintf ("Invalid namestring: %s\n", Name);
return (NULL);
}
/* Lookup the name */
@ -427,22 +434,20 @@ AcpiDbLocalNsLookup (
/* Use the root scope for the start of the search */
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, IMODE_EXECUTE,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &Entry);
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
AcpiOsdPrintf ("Could not locate name: %s %s\n", Name, AcpiCmFormatException (Status));
AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiCmFormatException (Status));
}
AcpiCmFree (InternalPath);
return Entry;
return (Node);
}
#endif /* ACPI_DEBUG */
#endif /* ENABLE_DEBUGGER */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
* $Revision: 1.47 $
* $Revision: 1.30 $
*
******************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
@ -124,7 +124,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
#define _COMPONENT DEBUGGER
MODULE_NAME ("dbdisasm")
@ -135,7 +135,7 @@
#define DB_FULL_OP_INFO "%5.5X #%4.4X [%2.2d] "
NATIVE_CHAR *AcpiGbl_DbDisasmIndent = "....";
NATIVE_CHAR *INDENT_STRING = "....";
/*******************************************************************************
@ -194,6 +194,8 @@ AcpiPsDisplayObjectPathname (
ACPI_PARSE_OBJECT *TargetOp;
AcpiOsPrintf (" (Path ");
/* Search parent tree up to the root if necessary */
TargetOp = AcpiPsFind (Op, Op->Value.Name, 0, 0);
@ -205,18 +207,18 @@ AcpiPsDisplayObjectPathname (
* (such as _OS_). Rather than worry about looking up all
* the predefined names, just display the name as given
*/
AcpiOsPrintf (" **** Path not found in parse tree");
AcpiDbDisplayNamestring (Op->Value.Name);
}
else
{
/* The target was found, print the name and complete path */
AcpiOsPrintf (" (Path ");
AcpiDbDisplayPath (TargetOp);
AcpiOsPrintf (")");
}
AcpiOsPrintf (")");
return (AE_OK);
}
@ -298,7 +300,7 @@ AcpiDbDisplayOp (
/* indentation */
DepthCount = 0;
if (!AcpiGbl_DbOpt_verbose)
if (!opt_verbose)
{
DepthCount++;
}
@ -329,17 +331,13 @@ AcpiDbDisplayOp (
VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth));
for (i = 0; i < LastDepth; i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
AcpiOsPrintf (INDENT_STRING);
}
if (AcpiDbBlockType (Op) == BLOCK_PAREN)
{
AcpiOsPrintf ("(\n");
}
else
{
AcpiOsPrintf ("{\n");
}
}
/* Close a block if we are nested less than last time */
@ -351,17 +349,13 @@ AcpiDbDisplayOp (
VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - j));
for (i = 0; i < (LastDepth - j - 1); i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
AcpiOsPrintf (INDENT_STRING);
}
if (AcpiDbBlockType (Op) == BLOCK_PAREN)
{
AcpiOsPrintf (")\n");
}
else
{
AcpiOsPrintf ("}\n");
}
}
}
@ -374,7 +368,7 @@ AcpiDbDisplayOp (
for (i = 0; i < DepthCount; i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
AcpiOsPrintf (INDENT_STRING);
}
@ -384,9 +378,9 @@ AcpiDbDisplayOp (
/* Resolve a name reference */
if ((Op->Opcode == AML_INT_NAMEPATH_OP && Op->Value.Name) &&
if ((Op->Opcode == AML_NAMEPATH_OP && Op->Value.Name) &&
(Op->Parent) &&
(AcpiGbl_DbOpt_verbose))
(opt_verbose))
{
AcpiPsDisplayObjectPathname (Op);
}
@ -413,7 +407,7 @@ AcpiDbDisplayOp (
VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - i));
for (j = 0; j < DepthCount; j++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
AcpiOsPrintf (INDENT_STRING);
}
AcpiOsPrintf ("}\n");
DepthCount--;
@ -521,19 +515,17 @@ AcpiDbDisplayPath (
UINT32 Name;
BOOLEAN DoDot = FALSE;
ACPI_PARSE_OBJECT *NamePath;
const ACPI_OPCODE_INFO *OpInfo;
/* We are only interested in named objects */
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
if (!(OpInfo->Flags & AML_NSNODE))
if (!AcpiPsIsNodeOp (Op->Opcode))
{
return;
}
if (OpInfo->Flags & AML_CREATE)
if (AcpiPsIsCreateFieldOp (Op->Opcode))
{
/* Field creation - check for a fully qualified namepath */
@ -574,46 +566,42 @@ AcpiDbDisplayPath (
Search = Search->Parent;
}
if (Prev)
if (Prev && !AcpiPsIsFieldOp (Search->Opcode))
{
OpInfo = AcpiPsGetOpcodeInfo (Search->Opcode);
if (!(OpInfo->Flags & AML_FIELD))
/* below root scope, append scope name */
if (DoDot)
{
/* below root scope, append scope name */
/* append dot */
if (DoDot)
AcpiOsPrintf (".");
}
if (AcpiPsIsCreateFieldOp (Search->Opcode))
{
if (Op->Opcode == AML_CREATE_FIELD_OP)
{
/* append dot */
AcpiOsPrintf (".");
NamePath = AcpiPsGetArg (Op, 3);
}
if (OpInfo->Flags & AML_CREATE)
{
if (Op->Opcode == AML_CREATE_FIELD_OP)
{
NamePath = AcpiPsGetArg (Op, 3);
}
else
{
NamePath = AcpiPsGetArg (Op, 2);
}
if ((NamePath) &&
(NamePath->Value.String))
{
AcpiOsPrintf ("%4.4s", NamePath->Value.String);
}
}
else
{
Name = AcpiPsGetName (Search);
AcpiOsPrintf ("%4.4s", &Name);
NamePath = AcpiPsGetArg (Op, 2);
}
DoDot = TRUE;
if ((NamePath) &&
(NamePath->Value.String))
{
AcpiOsPrintf ("%4.4s", NamePath->Value.String);
}
}
else
{
Name = AcpiPsGetName (Search);
AcpiOsPrintf ("%4.4s", &Name);
}
DoDot = TRUE;
}
Prev = Search;
@ -644,7 +632,7 @@ AcpiDbDisplayOpcode (
UINT8 *ByteData;
UINT32 ByteCount;
UINT32 i;
const ACPI_OPCODE_INFO *OpInfo = NULL;
ACPI_OPCODE_INFO *Opc = NULL;
UINT32 Name;
@ -661,14 +649,14 @@ AcpiDbDisplayOpcode (
case AML_BYTE_OP:
if (AcpiGbl_DbOpt_verbose)
if (opt_verbose)
{
AcpiOsPrintf ("(UINT8) 0x%2.2X", Op->Value.Integer8);
AcpiOsPrintf ("(UINT8) 0x%2.2X", Op->Value.Integer & 0xff);
}
else
{
AcpiOsPrintf ("0x%2.2X", Op->Value.Integer8);
AcpiOsPrintf ("0x%2.2X", Op->Value.Integer & 0xff);
}
break;
@ -676,14 +664,14 @@ AcpiDbDisplayOpcode (
case AML_WORD_OP:
if (AcpiGbl_DbOpt_verbose)
if (opt_verbose)
{
AcpiOsPrintf ("(UINT16) 0x%4.4X", Op->Value.Integer16);
AcpiOsPrintf ("(UINT16) 0x%4.4X", Op->Value.Integer & 0xffff);
}
else
{
AcpiOsPrintf ("0x%4.4X", Op->Value.Integer16);
AcpiOsPrintf ("0x%4.4X", Op->Value.Integer & 0xffff);
}
break;
@ -691,31 +679,14 @@ AcpiDbDisplayOpcode (
case AML_DWORD_OP:
if (AcpiGbl_DbOpt_verbose)
if (opt_verbose)
{
AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Value.Integer32);
AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Value.Integer);
}
else
{
AcpiOsPrintf ("0x%8.8X", Op->Value.Integer32);
}
break;
case AML_QWORD_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Value.Integer64.Hi,
Op->Value.Integer64.Lo);
}
else
{
AcpiOsPrintf ("0x%8.8X%8.8X", Op->Value.Integer64.Hi,
Op->Value.Integer64.Lo);
AcpiOsPrintf ("0x%8.8X", Op->Value.Integer);
}
break;
@ -736,7 +707,7 @@ AcpiDbDisplayOpcode (
break;
case AML_INT_STATICSTRING_OP:
case AML_STATICSTRING_OP:
if (Op->Value.String)
{
@ -751,42 +722,42 @@ AcpiDbDisplayOpcode (
break;
case AML_INT_NAMEPATH_OP:
case AML_NAMEPATH_OP:
AcpiDbDisplayNamestring (Op->Value.Name);
break;
case AML_INT_NAMEDFIELD_OP:
case AML_NAMEDFIELD_OP:
AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Value.Integer32);
AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Value.Integer);
break;
case AML_INT_RESERVEDFIELD_OP:
case AML_RESERVEDFIELD_OP:
AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Value.Integer32);
AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Value.Integer);
break;
case AML_INT_ACCESSFIELD_OP:
case AML_ACCESSFIELD_OP:
AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Value.Integer32);
AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Value.Integer);
break;
case AML_INT_BYTELIST_OP:
case AML_BYTELIST_OP:
if (AcpiGbl_DbOpt_verbose)
if (opt_verbose)
{
AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Value.Integer32);
AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Value.Integer);
}
else
{
AcpiOsPrintf ("0x%2.2X", Op->Value.Integer32);
AcpiOsPrintf ("0x%2.2X", Op->Value.Integer);
ByteCount = Op->Value.Integer32;
ByteCount = Op->Value.Integer;
ByteData = ((ACPI_PARSE2_OBJECT *) Op)->Data;
for (i = 0; i < ByteCount; i++)
@ -802,23 +773,19 @@ AcpiDbDisplayOpcode (
/* Just get the opcode name and print it */
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
AcpiOsPrintf ("%s", OpInfo->Name);
Opc = AcpiPsGetOpcodeInfo (Op->Opcode);
DEBUG_ONLY_MEMBERS ((AcpiOsPrintf ("%s", Opc->Name)));
#ifndef PARSER_ONLY
if ((Op->Opcode == AML_INT_RETURN_VALUE_OP) &&
(WalkState->Results) &&
(WalkState->Results->Results.NumResults))
if ((Op->Opcode == AML_RETURN_VALUE_OP) &&
(WalkState->NumResults))
{
AcpiDbDecodeInternalObject (WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]);
AcpiDbDecodeInternalObject (WalkState->Results [WalkState->NumResults-1]);
}
#endif
break;
}
if (!OpInfo)
if (!Opc)
{
/* If there is another element in the list, add a comma */
@ -828,16 +795,17 @@ AcpiDbDisplayOpcode (
}
}
/*
* If this is a named opcode, print the associated name value
*/
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
if (Op && (OpInfo->Flags & AML_NAMED))
if (Op && AcpiPsIsNamedOp (Op->Opcode))
{
Name = AcpiPsGetName (Op);
AcpiOsPrintf (" %4.4s", &Name);
if (AcpiGbl_DbOpt_verbose)
if (opt_verbose)
{
AcpiOsPrintf (" (Path \\");
AcpiDbDisplayPath (Op);

View File

@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose AcpiEvent
* handling and dispatch
* $Revision: 1.49 $
* $Revision: 1.15 $
*
*****************************************************************************/
@ -10,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
@ -119,12 +119,13 @@
#include "achware.h"
#include "acevents.h"
#include "acnamesp.h"
#include "accommon.h"
#define _COMPONENT ACPI_EVENTS
#define _COMPONENT EVENT_HANDLING
MODULE_NAME ("evevent")
/*******************************************************************************
/**************************************************************************
*
* FUNCTION: AcpiEvInitialize
*
@ -136,7 +137,7 @@
* configured, disables SCI event sources, installs the SCI
* handler
*
******************************************************************************/
*************************************************************************/
ACPI_STATUS
AcpiEvInitialize (
@ -148,11 +149,11 @@ AcpiEvInitialize (
FUNCTION_TRACE ("EvInitialize");
/* Make sure we have ACPI tables */
/* Make sure we've got ACPI tables */
if (!AcpiGbl_DSDT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
DEBUG_PRINT (ACPI_WARN, ("EvInitialize: No ACPI tables present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
@ -161,7 +162,8 @@ AcpiEvInitialize (
if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities())
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "ACPI Mode is not supported!\n"));
DEBUG_PRINT (ACPI_WARN,
("EvInitialize: Only legacy mode supported!\n"));
return_ACPI_STATUS (AE_ERROR);
}
@ -173,17 +175,20 @@ AcpiEvInitialize (
* done prior to enabling SCIs to prevent interrupts from occuring
* before handers are installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize fixed events.\n"));
DEBUG_PRINT (ACPI_FATAL,
("EvInitialize: Unable to initialize fixed events.\n"));
return_ACPI_STATUS (Status);
}
Status = AcpiEvGpeInitialize ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize general purpose events.\n"));
DEBUG_PRINT (ACPI_FATAL,
("EvInitialize: Unable to initialize general purpose events.\n"));
return_ACPI_STATUS (Status);
}
@ -192,35 +197,26 @@ AcpiEvInitialize (
Status = AcpiEvInstallSciHandler ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to install System Control Interrupt Handler\n"));
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) */
Status = AcpiEvInitGpeControlMethods ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Gpe control methods\n"));
return_ACPI_STATUS (Status);
}
AcpiEvInitGpeControlMethods ();
/* Install the handler for the Global Lock */
Status = AcpiEvInitGlobalLockHandler ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Global Lock handler\n"));
return_ACPI_STATUS (Status);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvFixedEventInitialize
*
@ -239,23 +235,28 @@ AcpiEvFixedEventInitialize(void)
/* Initialize the structure that keeps track of fixed event handlers */
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
for (i = 0; i < NUM_FIXED_EVENTS; i++)
{
AcpiGbl_FixedEventHandlers[i].Handler = NULL;
AcpiGbl_FixedEventHandlers[i].Context = NULL;
}
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, TMR_EN, 0);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, GBL_EN, 0);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, PWRBTN_EN, 0);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, SLPBTN_EN, 0);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RTC_EN, 0);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_PMTIMER +
TMR_EN, 0);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_GLOBAL +
TMR_EN, 0);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_POWER_BUTTON +
TMR_EN, 0);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_SLEEP_BUTTON +
TMR_EN, 0);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_RTC +
TMR_EN, 0);
return (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvFixedEventDetect
*
@ -268,28 +269,35 @@ AcpiEvFixedEventInitialize(void)
******************************************************************************/
UINT32
AcpiEvFixedEventDetect (void)
AcpiEvFixedEventDetect(void)
{
UINT32 IntStatus = INTERRUPT_NOT_HANDLED;
UINT32 StatusRegister;
UINT32 EnableRegister;
PROC_NAME ("EvFixedEventDetect");
UINT32 StatusRegister = 0;
UINT32 EnableRegister = 0;
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values.
*/
StatusRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
EnableRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed AcpiEvent Block: Enable %08X Status %08X\n",
StatusRegister = (UINT32) AcpiOsIn16 (AcpiGbl_FACP->Pm1aEvtBlk);
if (AcpiGbl_FACP->Pm1bEvtBlk)
{
StatusRegister |= (UINT32) AcpiOsIn16 (AcpiGbl_FACP->Pm1bEvtBlk);
}
EnableRegister = (UINT32) AcpiOsIn16 (AcpiGbl_FACP->Pm1aEvtBlk +
DIV_2 (AcpiGbl_FACP->Pm1EvtLen));
if (AcpiGbl_FACP->Pm1bEvtBlk)
{
EnableRegister |= (UINT32) AcpiOsIn16 (AcpiGbl_FACP->Pm1bEvtBlk +
DIV_2 (AcpiGbl_FACP->Pm1EvtLen));
}
DEBUG_PRINT (TRACE_INTERRUPTS,
("Fixed AcpiEvent Block: Enable = %08x\tStatus = %08x\n",
EnableRegister, StatusRegister));
/* power management timer roll over */
if ((StatusRegister & ACPI_STATUS_PMTIMER) &&
@ -298,7 +306,7 @@ AcpiEvFixedEventDetect (void)
IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_PMTIMER);
}
/* global event (BIOS wants the global lock) */
/* global event (BIOS want's the global lock) */
if ((StatusRegister & ACPI_STATUS_GLOBAL) &&
(EnableRegister & ACPI_ENABLE_GLOBAL))
@ -326,7 +334,7 @@ AcpiEvFixedEventDetect (void)
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvFixedEventDispatch
*
@ -343,42 +351,10 @@ UINT32
AcpiEvFixedEventDispatch (
UINT32 Event)
{
UINT32 RegisterId;
FUNCTION_ENTRY ();
/* Clear the status bit */
switch (Event)
{
case ACPI_EVENT_PMTIMER:
RegisterId = TMR_STS;
break;
case ACPI_EVENT_GLOBAL:
RegisterId = GBL_STS;
break;
case ACPI_EVENT_POWER_BUTTON:
RegisterId = PWRBTN_STS;
break;
case ACPI_EVENT_SLEEP_BUTTON:
RegisterId = SLPBTN_STS;
break;
case ACPI_EVENT_RTC:
RegisterId = RTC_STS;
break;
default:
return 0;
break;
}
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, RegisterId, 1);
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS +
Event, 1);
/*
* Make sure we've got a handler. If not, report an error.
@ -386,13 +362,12 @@ AcpiEvFixedEventDispatch (
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
RegisterId = (PM1_EN | REGISTER_BIT_ID(RegisterId));
AcpiHwRegisterAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
TMR_EN + Event, 0);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
RegisterId, 0);
REPORT_ERROR (
("EvGpeDispatch: No installed handler for fixed event [%08X]\n",
REPORT_ERROR("No installed handler for fixed event.");
DEBUG_PRINT (ACPI_ERROR,
("EvGpeDispatch: No installed handler for fixed event [0x%08X].",
Event));
return (INTERRUPT_NOT_HANDLED);
@ -405,7 +380,7 @@ AcpiEvFixedEventDispatch (
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvGpeInitialize
*
@ -431,40 +406,30 @@ AcpiEvGpeInitialize (void)
FUNCTION_TRACE ("EvGpeInitialize");
/*
* Set up various GPE counts
*
* You may ask,why are the GPE register block lengths divided by 2?
* From the ACPI 2.0 Spec, section, 4.7.1.6 General-Purpose Event
* Registers, we have,
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
* The length of the GPE1_STS and GPE1_EN registers is equal to
* half the GPE1_LEN. If a generic register block is not supported
* then its respective block pointer and block length values in the
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size."
* Setup various GPE counts
*/
Gpe0RegisterCount = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
Gpe1RegisterCount = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
Gpe0RegisterCount = (UINT16) DIV_2 (AcpiGbl_FACP->Gpe0BlkLen);
Gpe1RegisterCount = (UINT16) DIV_2 (AcpiGbl_FACP->Gpe1BlkLen);
AcpiGbl_GpeRegisterCount = Gpe0RegisterCount + Gpe1RegisterCount;
if (!AcpiGbl_GpeRegisterCount)
{
REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
REPORT_WARNING ("No GPEs defined in the FACP");
DEBUG_PRINT (ACPI_ERROR, ("Zero GPE count!\n"));
return_ACPI_STATUS (AE_OK);
}
/*
* Allocate the Gpe information block
*/
AcpiGbl_GpeRegisters = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount *
sizeof (ACPI_GPE_REGISTERS));
AcpiGbl_GpeRegisters = AcpiCmCallocate (AcpiGbl_GpeRegisterCount *
sizeof (ACPI_GPE_REGISTERS));
if (!AcpiGbl_GpeRegisters)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the GpeRegisters block\n"));
DEBUG_PRINT (ACPI_ERROR,
("Could not allocate the GpeRegisters block\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
@ -473,18 +438,19 @@ AcpiEvGpeInitialize (void)
* There are eight distinct GP events per register.
* Initialization to zeros is sufficient
*/
AcpiGbl_GpeInfo = ACPI_MEM_CALLOCATE (MUL_8 (AcpiGbl_GpeRegisterCount) *
sizeof (ACPI_GPE_LEVEL_INFO));
AcpiGbl_GpeInfo = AcpiCmCallocate (MUL_8 (AcpiGbl_GpeRegisterCount) *
sizeof (ACPI_GPE_LEVEL_INFO));
if (!AcpiGbl_GpeInfo)
{
ACPI_MEM_FREE (AcpiGbl_GpeRegisters);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeInfo block\n"));
AcpiCmFree (AcpiGbl_GpeRegisters);
DEBUG_PRINT (ACPI_ERROR, ("Could not allocate the GpeInfo block\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Set the Gpe validation table to GPE_INVALID */
MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE);
MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, NUM_GPE);
/*
* Initialize the Gpe information and validation blocks. A goal of these
@ -500,10 +466,10 @@ AcpiEvGpeInitialize (void)
for (i = 0; i < Gpe0RegisterCount; i++)
{
AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr =
(UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + i);
(UINT16) (AcpiGbl_FACP->Gpe0Blk + i);
AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr =
(UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + i + Gpe0RegisterCount);
(UINT16) (AcpiGbl_FACP->Gpe0Blk + i + Gpe0RegisterCount);
AcpiGbl_GpeRegisters[RegisterIndex].GpeBase = (UINT8) MUL_8 (i);
@ -518,8 +484,8 @@ AcpiEvGpeInitialize (void)
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8);
AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8);
AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00);
AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF);
RegisterIndex++;
}
@ -529,13 +495,13 @@ AcpiEvGpeInitialize (void)
for (i = 0; i < Gpe1RegisterCount; i++)
{
AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr =
(UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + i);
(UINT16) (AcpiGbl_FACP->Gpe1Blk + i);
AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr =
(UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + i + Gpe1RegisterCount);
(UINT16) (AcpiGbl_FACP->Gpe1Blk + i + Gpe1RegisterCount);
AcpiGbl_GpeRegisters[RegisterIndex].GpeBase =
(UINT8) (AcpiGbl_FADT->Gpe1Base + MUL_8 (i));
(UINT8) (AcpiGbl_FACP->Gpe1Base + MUL_8 (i));
for (j = 0; j < 8; j++)
{
@ -548,21 +514,22 @@ AcpiEvGpeInitialize (void)
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8);
AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8);
AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00);
AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF);
RegisterIndex++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n",
Gpe0RegisterCount, AcpiGbl_FADT->XGpe0Blk.Address, Gpe1RegisterCount,
AcpiGbl_FADT->XGpe1Blk.Address));
DEBUG_PRINT (ACPI_INFO,
("GPE registers: %d@%X (Blk0) %d@%X (Blk1)\n",
Gpe0RegisterCount, AcpiGbl_FACP->Gpe0Blk, Gpe1RegisterCount,
AcpiGbl_FACP->Gpe1Blk));
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvSaveMethodInfo
*
@ -584,7 +551,7 @@ AcpiEvGpeInitialize (void)
*
******************************************************************************/
static ACPI_STATUS
ACPI_STATUS
AcpiEvSaveMethodInfo (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@ -596,9 +563,6 @@ AcpiEvSaveMethodInfo (
UINT8 Type;
PROC_NAME ("EvSaveMethodInfo");
/* Extract the name from the object and convert to a string */
MOVE_UNALIGNED32_TO_32 (Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name);
@ -619,8 +583,8 @@ AcpiEvSaveMethodInfo (
{
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
DEBUG_PRINT (ACPI_ERROR,
("EvSaveMethodInfo: Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
Name));
return (AE_OK);
}
@ -632,8 +596,8 @@ AcpiEvSaveMethodInfo (
{
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
DEBUG_PRINT (ACPI_ERROR,
("EvSaveMethodInfo: Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
Name));
return (AE_OK);
}
@ -651,6 +615,7 @@ AcpiEvSaveMethodInfo (
* Now we can add this information to the GpeInfo block
* for use during dispatch of this GPE.
*/
AcpiGbl_GpeInfo [GpeNumber].Type = Type;
AcpiGbl_GpeInfo [GpeNumber].MethodHandle = ObjHandle;
@ -658,15 +623,17 @@ AcpiEvSaveMethodInfo (
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
AcpiHwEnableGpe (GpeNumber);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n",
DEBUG_PRINT (ACPI_INFO,
("EvSaveMethodInfo: Registered GPE method %s as GPE number %d\n",
Name, GpeNumber));
return (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvInitGpeControlMethods
*
@ -707,7 +674,32 @@ AcpiEvInitGpeControlMethods (void)
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvGpeCleanup
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Cleanup in preparation for unload.
*
******************************************************************************/
void
AcpiEvGpeCleanup (void)
{
FUNCTION_TRACE ("EvGpeCleanup");
AcpiCmFree (AcpiGbl_GpeRegisters);
AcpiCmFree (AcpiGbl_GpeInfo);
return_VOID;
}
/******************************************************************************
*
* FUNCTION: AcpiEvGpeDetect
*
@ -729,32 +721,28 @@ AcpiEvGpeDetect (void)
UINT8 BitMask;
PROC_NAME ("EvGpeDetect");
/*
* Read all of the 8-bit GPE status and enable registers
* in both of the register blocks, saving all of it.
* Find all currently active GP events.
*/
for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
{
AcpiOsReadPort (AcpiGbl_GpeRegisters[i].StatusAddr,
&AcpiGbl_GpeRegisters[i].Status, 8);
AcpiGbl_GpeRegisters[i].Status =
AcpiOsIn8 (AcpiGbl_GpeRegisters[i].StatusAddr);
AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr,
&AcpiGbl_GpeRegisters[i].Enable, 8);
AcpiGbl_GpeRegisters[i].Enable =
AcpiOsIn8 (AcpiGbl_GpeRegisters[i].EnableAddr);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %X - Enable %08X Status %08X\n",
AcpiGbl_GpeRegisters[i].EnableAddr,
AcpiGbl_GpeRegisters[i].Status,
AcpiGbl_GpeRegisters[i].Enable));
DEBUG_PRINT (TRACE_INTERRUPTS,
("GPE block at %x - Enable: %08x\tStatus: %08x\n",
AcpiGbl_GpeRegisters[i].EnableAddr, AcpiGbl_GpeRegisters[i].Status, AcpiGbl_GpeRegisters[i].Enable));
/* First check if there is anything active at all in this register */
EnabledStatusByte = (UINT8) (AcpiGbl_GpeRegisters[i].Status &
AcpiGbl_GpeRegisters[i].Enable);
AcpiGbl_GpeRegisters[i].Enable);
if (!EnabledStatusByte)
{
@ -775,8 +763,8 @@ AcpiEvGpeDetect (void)
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
IntStatus |= AcpiEvGpeDispatch (
AcpiGbl_GpeRegisters[i].GpeBase + j);
IntStatus |=
AcpiEvGpeDispatch (AcpiGbl_GpeRegisters[i].GpeBase + j);
}
}
}
@ -785,7 +773,7 @@ AcpiEvGpeDetect (void)
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvAsynchExecuteGpeMethod
*
@ -801,7 +789,7 @@ AcpiEvGpeDetect (void)
*
******************************************************************************/
static void
void
AcpiEvAsynchExecuteGpeMethod (
void *Context)
{
@ -811,19 +799,29 @@ AcpiEvAsynchExecuteGpeMethod (
FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
/*
* Take a snapshot of the GPE info for this level
*/
AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
/* Take a snapshot of the GPE info for this level */
AcpiCmAcquireMutex (ACPI_MTX_EVENTS);
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
/*
* Function Handler (e.g. EC):
* ---------------------------
* Execute the installed function handler to handle this event.
*/
if (GpeInfo.Handler)
{
GpeInfo.Handler (GpeInfo.Context);
}
/*
* Method Handler (_Lxx, _Exx):
* ----------------------------
* Evaluate the _Lxx/_Exx control method that corresponds to this GPE.
* AcpiEvaluate the _Lxx/_Exx control method that corresponds to this GPE.
*/
if (GpeInfo.MethodHandle)
else if (GpeInfo.MethodHandle)
{
AcpiNsEvaluateByHandle (GpeInfo.MethodHandle, NULL, NULL);
}
@ -831,9 +829,11 @@ AcpiEvAsynchExecuteGpeMethod (
/*
* Level-Triggered?
* ----------------
* If level-triggered we clear the GPE status bit after handling the event.
* If level-triggered, clear the GPE status bit after execution. Note
* that edge-triggered events are cleared prior to calling (via DPC)
* this function.
*/
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
if (GpeInfo.Type | ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
@ -847,7 +847,7 @@ AcpiEvAsynchExecuteGpeMethod (
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEvGpeDispatch
*
@ -870,18 +870,18 @@ UINT32
AcpiEvGpeDispatch (
UINT32 GpeNumber)
{
ACPI_GPE_LEVEL_INFO GpeInfo;
FUNCTION_TRACE ("EvGpeDispatch");
/*
* Valid GPE number?
*/
DEBUG_PRINT (ACPI_INFO, ("GPE [%d] event occurred.\n", GpeNumber));
/*DEBUG_INCREMENT_EVENT_COUNT (EVENT_GENERAL);*/
/* Ensure that we have a valid GPE number */
if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid GPE bit [%X].\n", GpeNumber));
DEBUG_PRINT (ACPI_ERROR, ("Invalid GPE [%d].\n", GpeNumber));
return_VALUE (INTERRUPT_NOT_HANDLED);
}
@ -890,69 +890,55 @@ AcpiEvGpeDispatch (
*/
AcpiHwDisableGpe (GpeNumber);
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
/*
* Edge-Triggered?
* ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
* level-triggered events are cleared after the GPE is serviced
* (see AcpiEvAsynchExecuteGpeMethod).
*/
if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
if (AcpiGbl_GpeInfo [GpeNumber].Type | ACPI_EVENT_EDGE_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/*
* Function Handler (e.g. EC)?
*/
if (GpeInfo.Handler)
{
/* Invoke function handler (at interrupt level). */
GpeInfo.Handler (GpeInfo.Context);
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/* Enable GPE */
AcpiHwEnableGpe (GpeNumber);
}
/*
* Method Handler (e.g. _Exx/_Lxx)?
* Queue-up the Handler:
* ---------------------
* Queue the handler, which is either an installable function handler
* (e.g. EC) or a control method (e.g. _Lxx/_Exx) for later execution.
*/
else if (GpeInfo.MethodHandle)
if (AcpiGbl_GpeInfo [GpeNumber].Handler ||
AcpiGbl_GpeInfo [GpeNumber].MethodHandle)
{
if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod, (void*) GpeNumber)))
if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod,
(void*)(NATIVE_UINT)GpeNumber)))
{
/*
* Shoudn't occur, but if it does report an error. Note that
* the GPE will remain disabled until the ACPI Core Subsystem
* is restarted, or the handler is removed/reinstalled.
*/
REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
REPORT_ERROR ("Unable to queue-up handler for GPE.");
DEBUG_PRINT (ACPI_ERROR,
("EvGpeDispatch: Unable to queue-up handler for GPE [0x%08X].",
GpeNumber));
}
}
/*
* No Handler? Report an error and leave the GPE disabled.
* Non Handled GPEs:
* -----------------
* GPEs without handlers are disabled and kept that way until a handler
* is registered for them.
*/
else
{
REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
REPORT_ERROR ("No installed handler for GPE.");
DEBUG_PRINT (ACPI_ERROR,
("EvGpeDispatch: No installed handler for GPE [0x%08X].",
GpeNumber));
}
return_VALUE (INTERRUPT_HANDLED);