Import ACPICA 20130823.

This commit is contained in:
Jung-uk Kim 2013-08-23 18:01:58 +00:00
parent dbded195f9
commit 59ce063597
63 changed files with 2426 additions and 919 deletions

View File

@ -1,3 +1,87 @@
----------------------------------------
23 August 2013. Summary of changes for version 20130823:
1) ACPICA kernel-resident subsystem:
Implemented support for host-installed System Control Interrupt (SCI)
handlers. Certain ACPI functionality requires the host to handle raw
SCIs. For example, the "SCI Doorbell" that is defined for memory power
state support requires the host device driver to handle SCIs to examine
if the doorbell has been activated. Multiple SCI handlers can be
installed to allow for future expansion. New external interfaces are
AcpiInstallSciHandler, AcpiRemoveSciHandler; see the ACPICA reference for
details. Lv Zheng, Bob Moore. ACPICA BZ 1032.
Operation region support: Never locally free the handler "context"
pointer. This change removes some dangerous code that attempts to free
the handler context pointer in some (rare) circumstances. The owner of
the handler owns this pointer and the ACPICA code should never touch it.
Although not seen to be an issue in any kernel, it did show up as a
problem (fault) under AcpiExec. Also, set the internal storage field for
the context pointer to zero when the region is deactivated, simply for
sanity. David Box. ACPICA BZ 1039.
AcpiRead: On error, do not modify the return value target location. If an
error happens in the middle of a split 32/32 64-bit I/O operation, do not
modify the target of the return value pointer. Makes the code consistent
with the rest of ACPICA. Bjorn Helgaas.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.
Current Release:
Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total
Debug Version: 184.4K Code, 76.8K Data, 261.2K Total
Previous Release:
Non-Debug Version: 96.2K Code, 27.1K Data, 123.3K Total
Debug Version: 185.4K Code, 77.1K Data, 262.5K Total
2) iASL Compiler/Disassembler and Tools:
AcpiDump: Implemented several new features and fixed some problems:
1) Added support to dump the RSDP, RSDT, and XSDT tables.
2) Added support for multiple table instances (SSDT, UEFI).
3) Added option to dump "customized" (overridden) tables (-c).
4) Fixed a problem where some table filenames were improperly
constructed.
5) Improved some error messages, removed some unnecessary messages.
iASL: Implemented additional support for disassembly of ACPI tables that
contain invocations of external control methods. The -fe<file> option
allows the import of a file that specifies the external methods along
with the required number of arguments for each -- allowing for the
correct disassembly of the table. This is a workaround for a limitation
of AML code where the disassembler often cannot determine the number of
arguments required for an external control method and generates incorrect
ASL code. See the iASL reference for details. ACPICA BZ 1030.
Debugger: Implemented a new command (paths) that displays the full
pathnames (namepaths) and object types of all objects in the namespace.
This is an alternative to the namespace command.
Debugger: Implemented a new command (sci) that invokes the SCI dispatch
mechanism and any installed handlers.
iASL: Fixed a possible segfault for "too many parent prefixes" condition.
This can occur if there are too many parent prefixes in a namepath (for
example, ^^^^^^PCI0.ECRD). ACPICA BZ 1035.
Application OSLs: Set the return value for the PCI read functions. These
functions simply return AE_OK, but should set the return value to zero
also. This change implements this. ACPICA BZ 1038.
Debugger: Prevent possible command line buffer overflow. Increase the
size of a couple of the debugger line buffers, and ensure that overflow
cannot happen. ACPICA BZ 1037.
iASL: Changed to abort immediately on serious errors during the parsing
phase. Due to the nature of ASL, there is no point in attempting to
compile these types of errors, and they typically end up causing a
cascade of hundreds of errors which obscure the original problem.
----------------------------------------
25 July 2013. Summary of changes for version 20130725:

View File

@ -31,6 +31,8 @@ OBJECTS = \
$(OBJDIR)/apdump.o\
$(OBJDIR)/apfiles.o\
$(OBJDIR)/apmain.o\
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/osunixmap.o\
$(OBJDIR)/tbprint.o\
$(OBJDIR)/tbxfroot.o\
$(OBJDIR)/utbuffer.o\

View File

@ -341,6 +341,10 @@ AdAmlDisassemble (
{
AcpiDmClearExternalList ();
}
/* Load any externals defined in the optional external ref file */
AcpiDmGetExternalsFromFile ();
}
else
{

View File

@ -373,10 +373,18 @@ AcpiDmDumpDescending (
switch (Op->Common.AmlOpcode)
{
case AML_BYTE_OP:
AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer);
break;
case AML_WORD_OP:
AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer);
break;
case AML_DWORD_OP:
AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer);
break;
case AML_QWORD_OP:

View File

@ -46,7 +46,9 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
#include "aslcompiler.h"
#include <stdio.h>
#include <errno.h>
/*
@ -87,6 +89,8 @@ static const char *AcpiGbl_DmTypeNames[] =
/* 19 */ ", FieldUnitObj"
};
#define METHOD_SEPARATORS " \t,()\n"
/* Local prototypes */
@ -99,6 +103,12 @@ AcpiDmNormalizeParentPrefix (
ACPI_PARSE_OBJECT *Op,
char *Path);
static void
AcpiDmAddToExternalListFromFile (
char *Path,
UINT8 Type,
UINT32 Value);
/*******************************************************************************
*
@ -444,7 +454,7 @@ AcpiDmAddToExternalList (
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
"Argument count mismatch for method %s %u %u",
"External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
}
@ -534,6 +544,275 @@ AcpiDmAddToExternalList (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmGetExternalsFromFile
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Process the optional external reference file.
*
* Each line in the file should be of the form:
* External (<Method namepath>, MethodObj, <ArgCount>)
*
* Example:
* External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4)
*
******************************************************************************/
void
AcpiDmGetExternalsFromFile (
void)
{
FILE *ExternalRefFile;
char *Token;
char *MethodName;
UINT32 ArgCount;
UINT32 ImportCount = 0;
if (!Gbl_ExternalRefFilename)
{
return;
}
/* Open the file */
ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r");
if (!ExternalRefFile)
{
fprintf (stderr, "Could not open external reference file \"%s\"\n",
Gbl_ExternalRefFilename);
return;
}
/* Each line defines a method */
while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile))
{
Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */
if (!Token) continue;
if (strcmp (Token, "External")) continue;
MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */
if (!MethodName) continue;
Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */
if (!Token) continue;
if (strcmp (Token, "MethodObj")) continue;
Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */
if (!Token) continue;
/* Convert arg count string to an integer */
errno = 0;
ArgCount = strtoul (Token, NULL, 0);
if (errno)
{
fprintf (stderr, "Invalid argument count (%s)\n", Token);
continue;
}
if (ArgCount > 7)
{
fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
continue;
}
/* Add this external to the global list */
AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
Gbl_ExternalRefFilename, ArgCount, MethodName);
AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80);
ImportCount++;
}
if (!ImportCount)
{
fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
Gbl_ExternalRefFilename);
}
else
{
/* Add the external(s) to the namespace */
AcpiDmAddExternalsToNamespace ();
AcpiOsPrintf ("%s: Imported %u external method definitions\n",
Gbl_ExternalRefFilename, ImportCount);
}
fclose (ExternalRefFile);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddToExternalListFromFile
*
* PARAMETERS: Path - Internal (AML) path to the object
* Type - ACPI object type to be added
* Value - Arg count if adding a Method object
*
* RETURN: None
*
* DESCRIPTION: Insert a new name into the global list of Externals which
* will in turn be later emitted as an External() declaration
* in the disassembled output.
*
******************************************************************************/
static void
AcpiDmAddToExternalListFromFile (
char *Path,
UINT8 Type,
UINT32 Value)
{
char *InternalPath;
char *ExternalPath;
ACPI_EXTERNAL_LIST *NewExternal;
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
BOOLEAN Resolved = FALSE;
if (!Path)
{
return;
}
/* TBD: Add a flags parameter */
if (Type == ACPI_TYPE_METHOD)
{
if (Value & 0x80)
{
Resolved = TRUE;
}
Value &= 0x07;
}
/*
* We don't want External() statements to contain a leading '\'.
* This prevents duplicate external statements of the form:
*
* External (\ABCD)
* External (ABCD)
*
* This would cause a compile time error when the disassembled
* output file is recompiled.
*/
if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
{
Path++;
}
/* Check all existing externals to ensure no duplicates */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!ACPI_STRCMP (Path, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
"(File) External method arg count mismatch %s: Current %u, override to %u",
NextExternal->Path, NextExternal->Value, Value));
/* Override, since new value came from external reference file */
NextExternal->Value = Value;
}
/* Allow upgrade of type from ANY */
else if (NextExternal->Type == ACPI_TYPE_ANY)
{
NextExternal->Type = Type;
NextExternal->Value = Value;
}
return;
}
NextExternal = NextExternal->Next;
}
/* Get the internal pathname (AML format) */
Status = AcpiNsInternalizeName (Path, &InternalPath);
if (ACPI_FAILURE (Status))
{
return;
}
/* Allocate and init a new External() descriptor */
NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
if (!NewExternal)
{
ACPI_FREE (InternalPath);
return;
}
/* Must copy and normalize the input path */
AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath);
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Value = Value;
NewExternal->Resolved = Resolved;
NewExternal->Length = (UINT16) ACPI_STRLEN (Path);
NewExternal->InternalPath = InternalPath;
/* Set flag to indicate External->InternalPath needs to be freed */
NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE;
/* Link the new descriptor into the global list, alphabetically ordered */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
{
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
NewExternal->Next = NextExternal;
return;
}
PrevExternal = NextExternal;
NextExternal = NextExternal->Next;
}
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddExternalsToNamespace
@ -563,7 +842,7 @@ AcpiDmAddExternalsToNamespace (
Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
@ -731,7 +1010,8 @@ AcpiDmEmitExternals (
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
AcpiOsPrintf (") // Warning: Unresolved Method, "
AcpiOsPrintf (
") // Warning: Unresolved Method, "
"guessing %u arguments (may be incorrect, see warning above)\n",
NextExternal->Value);
@ -743,9 +1023,45 @@ AcpiDmEmitExternals (
AcpiOsPrintf ("\n");
/* Emit externals that were imported from a file */
if (Gbl_ExternalRefFilename)
{
AcpiOsPrintf (
" /*\n * External declarations that were imported from\n"
" * the reference file [%s]\n */\n",
Gbl_ExternalRefFilename);
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE))
{
AcpiOsPrintf (" External (%s%s",
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
if (NextExternal->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %u Arguments\n",
NextExternal->Value);
}
else
{
AcpiOsPrintf (")\n");
}
NextExternal->Emitted = TRUE;
}
NextExternal = NextExternal->Next;
}
AcpiOsPrintf ("\n");
}
/*
* Walk the list of externals (unresolved references)
* found during the AML parsing
* Walk the list of externals found during the AML parsing
*/
while (AcpiGbl_ExternalList)
{

View File

@ -446,7 +446,7 @@ AcpiDmDumpDataTable (
Length = Table->Length;
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
}
else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
Length = AcpiDmDumpRsdp (Table);
}

View File

@ -593,10 +593,15 @@ CmDoCompile (
AslCompilerparse();
UtEndEvent (Event);
/* Flush out any remaining source after parse tree is complete */
/* Check for parse errors */
Event = UtBeginEvent ("Flush source input");
CmFlushSourceCode ();
Status = AslCheckForErrorExit ();
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n");
LsDumpParseTree ();
goto ErrorExit;
}
/* Did the parse tree get successfully constructed? */
@ -606,16 +611,18 @@ CmDoCompile (
* If there are no errors, then we have some sort of
* internal problem.
*/
Status = AslCheckForErrorExit ();
if (Status == AE_OK)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
NULL, "- Could not resolve parse tree root node");
}
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
NULL, "- Could not resolve parse tree root node");
goto ErrorExit;
}
/* Flush out any remaining source after parse tree is complete */
Event = UtBeginEvent ("Flush source input");
CmFlushSourceCode ();
/* Optional parse tree dump, compiler debug output only */
LsDumpParseTree ();

View File

@ -186,6 +186,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL)
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);

View File

@ -487,6 +487,10 @@ LdNamespace1Begin (
ACPI_TYPE_LOCAL_SCOPE,
ACPI_IMODE_LOAD_PASS1, Flags,
WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* However, this is an error -- primarily because the MS

View File

@ -138,6 +138,7 @@ Usage (
ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");

View File

@ -68,7 +68,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
/*******************************************************************************
@ -136,8 +136,7 @@ AslCommandLine (
if (BadCommandLine)
{
printf ("\n");
Usage ();
printf ("Use -h option for help information\n");
exit (1);
}
@ -276,9 +275,30 @@ AslDoOptions (
}
break;
case 'f': /* Ignore errors and force creation of aml file */
case 'f':
Gbl_IgnoreErrors = TRUE;
switch (AcpiGbl_Optarg[0])
{
case '^': /* Ignore errors and force creation of aml file */
Gbl_IgnoreErrors = TRUE;
break;
case 'e': /* Disassembler: Get external declaration file */
if (AcpiGetoptArgument (argc, argv))
{
return (-1);
}
Gbl_ExternalRefFilename = AcpiGbl_Optarg;
break;
default:
printf ("Unknown option: -f%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
case 'G':

View File

@ -317,7 +317,7 @@ DtCompileDataTable (
DtSetTableLength ();
return (Status);
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
else if (ACPI_VALIDATE_RSDP_SIG (Signature))
{
Status = DtCompileRsdp (FieldList);
return (Status);

View File

@ -1211,6 +1211,14 @@ AcpiDbGenerateGpe (
(void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
}
void
AcpiDbGenerateSci (
void)
{
AcpiEvSciDispatch ();
}
#endif /* !ACPI_REDUCED_HARDWARE */
#endif /* ACPI_DEBUGGER */

View File

@ -142,7 +142,8 @@ AcpiDbOpenDebugFile (
}
AcpiOsPrintf ("Debug output file %s opened\n", Name);
ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name,
sizeof (AcpiGbl_DbDebugFilename));
AcpiGbl_DbOutputToFile = TRUE;
#endif
@ -274,11 +275,9 @@ AcpiDbReadTable (
fseek (fp, 0, SEEK_SET);
/* The RSDT, FACS and S3PT tables do not have standard ACPI headers */
/* The RSDP table does not have standard ACPI header */
if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") ||
ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT"))
if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD "))
{
*TableLength = FileSize;
StandardHeader = FALSE;

View File

@ -132,12 +132,14 @@ enum AcpiExDebuggerCommands
CMD_OPEN,
CMD_OSI,
CMD_OWNER,
CMD_PATHS,
CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
CMD_SCI,
CMD_SET,
CMD_SLEEP,
CMD_STATS,
@ -203,12 +205,14 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"OPEN", 1},
{"OSI", 0},
{"OWNER", 1},
{"PATHS", 0},
{"PREDEFINED", 0},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESOURCES", 0},
{"RESULTS", 0},
{"SCI", 0},
{"SET", 3},
{"SLEEP", 0},
{"STATS", 1},
@ -259,22 +263,19 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{0, "\nNamespace Access Commands:", "\n"},
{1, " Businfo", "Display system bus info\n"},
{1, " Disassemble <Method>", "Disassemble a control method\n"},
{1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
{1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"},
{1, " Gpes", "Display info on all GPEs\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
{1, " Objects <ObjectType>", "Display all objects of the given type\n"},
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
{1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
{1, " Terminate", "Delete namespace and all internal objects\n"},
{1, " Type <Object>", "Display object type\n"},
@ -288,7 +289,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
{1, " Hex Integer", "Integer method argument\n"},
{1, " \"Ascii String\"", "String method argument\n"},
{1, " (Byte List)", "Buffer method argument\n"},
{1, " (Hex Byte List)", "Buffer method argument\n"},
{1, " [Package Element List]", "Package method argument\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
@ -303,6 +304,13 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
{0, "\nHardware Related Commands:", "\n"},
{1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"},
{1, " Gpes", "Display info on all GPEs\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{0, "\nFile I/O Commands:", "\n"},
{1, " Close", "Close debug output file\n"},
{1, " Load <Input Filename>", "Load ACPI table from a file\n"},
@ -1002,6 +1010,11 @@ AcpiDbCommandDispatch (
AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
case CMD_PATHS:
AcpiDbDumpNamespacePaths ();
break;
case CMD_PREDEFINED:
AcpiDbCheckPredefinedNames ();
@ -1027,6 +1040,11 @@ AcpiDbCommandDispatch (
AcpiDbDisplayResults ();
break;
case CMD_SCI:
AcpiDbGenerateSci ();
break;
case CMD_SET:
AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],

View File

@ -254,6 +254,37 @@ AcpiDbDumpNamespace (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespacePaths
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Dump entire namespace with full object pathnames and object
* type information. Alternative to "namespace" command.
*
******************************************************************************/
void
AcpiDbDumpNamespacePaths (
void)
{
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("ACPI Namespace (from root):\n");
/* Display the entire namespace */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY,
ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespaceByOwner

View File

@ -216,7 +216,7 @@ AcpiEvGetGpeDevice (
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*

View File

@ -292,15 +292,6 @@ AcpiEvTerminate (
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
/* Remove SCI handler */
Status = AcpiEvRemoveSciHandler ();
if (ACPI_FAILURE(Status))
{
ACPI_ERROR ((AE_INFO,
"Could not remove SCI handler"));
}
Status = AcpiEvRemoveGlobalLockHandler ();
if (ACPI_FAILURE(Status))
{
@ -311,6 +302,15 @@ AcpiEvTerminate (
AcpiGbl_EventsInitialized = FALSE;
}
/* Remove SCI handlers */
Status = AcpiEvRemoveAllSciHandlers ();
if (ACPI_FAILURE(Status))
{
ACPI_ERROR ((AE_INFO,
"Could not remove SCI handler"));
}
/* Deallocate all handler objects installed within GPE info structs */
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);

View File

@ -234,18 +234,12 @@ AcpiEvAddressSpaceDispatch (
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
if (RegionObj2->Extra.RegionContext)
/*
* Save the returned context for use in all accesses to
* the handler for this particular region
*/
if (!(RegionObj2->Extra.RegionContext))
{
/* The handler for this region was already installed */
ACPI_FREE (RegionContext);
}
else
{
/*
* Save the returned context for use in all accesses to
* this particular region
*/
RegionObj2->Extra.RegionContext = RegionContext;
}
}
@ -261,7 +255,6 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
/*
* Special handling for GenericSerialBus and GeneralPurposeIo:
* There are three extra parameters that must be passed to the
@ -424,6 +417,15 @@ AcpiEvDetachRegion(
Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
HandlerObj->AddressSpace.Context, RegionContext);
/*
* RegionContext should have been released by the deactivate
* operation. We don't need access to it anymore here.
*/
if (RegionContext)
{
*RegionContext = NULL;
}
/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE (Status))

View File

@ -59,6 +59,57 @@ AcpiEvSciXruptHandler (
void *Context);
/*******************************************************************************
*
* FUNCTION: AcpiEvSciDispatch
*
* PARAMETERS: None
*
* RETURN: Status code indicates whether interrupt was handled.
*
* DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
*
******************************************************************************/
UINT32
AcpiEvSciDispatch (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
ACPI_FUNCTION_NAME (EvSciDispatch);
/* Are there any host-installed SCI handlers? */
if (!AcpiGbl_SciHandlerList)
{
return (IntStatus);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Invoke all host-installed SCI handlers */
SciHandler = AcpiGbl_SciHandlerList;
while (SciHandler)
{
/* Invoke the installed handler (at interrupt level) */
IntStatus |= SciHandler->Address (
SciHandler->Context);
SciHandler = SciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvSciXruptHandler
@ -100,6 +151,10 @@ AcpiEvSciXruptHandler (
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
/* Invoke all host-installed SCI handlers */
InterruptHandled |= AcpiEvSciDispatch ();
AcpiSciCount++;
return_UINT32 (InterruptHandled);
}
@ -129,14 +184,13 @@ AcpiEvGpeXruptHandler (
/*
* We are guaranteed by the ACPI CA initialization/shutdown code that
* We are guaranteed by the ACPICA initialization/shutdown code that
* if this interrupt handler is installed, ACPI is enabled.
*/
/* GPEs: Check for and dispatch any GPEs that have occurred */
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
return_UINT32 (InterruptHandled);
}
@ -171,15 +225,15 @@ AcpiEvInstallSciHandler (
/******************************************************************************
*
* FUNCTION: AcpiEvRemoveSciHandler
* FUNCTION: AcpiEvRemoveAllSciHandlers
*
* PARAMETERS: none
*
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
* installed to begin with
*
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* taken.
* taken. Remove all host-installed SCI handlers.
*
* Note: It doesn't seem important to disable all events or set the event
* enable registers to their original values. The OS should disable
@ -189,13 +243,15 @@ AcpiEvInstallSciHandler (
******************************************************************************/
ACPI_STATUS
AcpiEvRemoveSciHandler (
AcpiEvRemoveAllSciHandlers (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
/* Just let the OS remove the handler and disable the level */
@ -203,6 +259,23 @@ AcpiEvRemoveSciHandler (
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
AcpiEvSciXruptHandler);
if (!AcpiGbl_SciHandlerList)
{
return (Status);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Free all host-installed SCI handlers */
while (AcpiGbl_SciHandlerList)
{
SciHandler = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = SciHandler->Next;
ACPI_FREE (SciHandler);
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}

View File

@ -433,6 +433,169 @@ ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiInstallSciHandler
*
* PARAMETERS: Address - Address of the handler
* Context - Value passed to the handler on each SCI
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for a System Control Interrupt.
*
******************************************************************************/
ACPI_STATUS
AcpiInstallSciHandler (
ACPI_SCI_HANDLER Address,
void *Context)
{
ACPI_SCI_HANDLER_INFO *NewSciHandler;
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiInstallSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Allocate and init a handler object */
NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
if (!NewSciHandler)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
NewSciHandler->Address = Address;
NewSciHandler->Context = Context;
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Lock list during installation */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
SciHandler = AcpiGbl_SciHandlerList;
/* Ensure handler does not already exist */
while (SciHandler)
{
if (Address == SciHandler->Address)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
}
SciHandler = SciHandler->Next;
}
/* Install the new handler into the global list (at head) */
NewSciHandler->Next = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = NewSciHandler;
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
Exit:
if (ACPI_FAILURE (Status))
{
ACPI_FREE (NewSciHandler);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiRemoveSciHandler
*
* PARAMETERS: Address - Address of the handler
*
* RETURN: Status
*
* DESCRIPTION: Remove a handler for a System Control Interrupt.
*
******************************************************************************/
ACPI_STATUS
AcpiRemoveSciHandler (
ACPI_SCI_HANDLER Address)
{
ACPI_SCI_HANDLER_INFO *PrevSciHandler;
ACPI_SCI_HANDLER_INFO *NextSciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Remove the SCI handler with lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
PrevSciHandler = NULL;
NextSciHandler = AcpiGbl_SciHandlerList;
while (NextSciHandler)
{
if (NextSciHandler->Address == Address)
{
/* Unlink and free the SCI handler info block */
if (PrevSciHandler)
{
PrevSciHandler->Next = NextSciHandler->Next;
}
else
{
AcpiGbl_SciHandlerList = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
ACPI_FREE (NextSciHandler);
goto UnlockAndExit;
}
PrevSciHandler = NextSciHandler;
NextSciHandler = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
Status = AE_NOT_EXIST;
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiInstallGlobalEventHandler

View File

@ -131,7 +131,8 @@ AcpiRead (
UINT64 *ReturnValue,
ACPI_GENERIC_ADDRESS *Reg)
{
UINT32 Value;
UINT32 ValueLo;
UINT32 ValueHi;
UINT32 Width;
UINT64 Address;
ACPI_STATUS Status;
@ -153,13 +154,8 @@ AcpiRead (
return (Status);
}
/* Initialize entire 64-bit return value to zero */
*ReturnValue = 0;
Value = 0;
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* Two address spaces supported: Memory or I/O. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
@ -173,6 +169,9 @@ AcpiRead (
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
ValueLo = 0;
ValueHi = 0;
Width = Reg->BitWidth;
if (Width == 64)
{
@ -180,25 +179,27 @@ AcpiRead (
}
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
Address, &Value, Width);
Address, &ValueLo, Width);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*ReturnValue = Value;
if (Reg->BitWidth == 64)
{
/* Read the top 32 bits */
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
(Address + 4), &Value, 32);
(Address + 4), &ValueHi, 32);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*ReturnValue |= ((UINT64) Value << 32);
}
/* Set the return value only if status is AE_OK */
*ReturnValue = (ValueLo | ((UINT64) ValueHi << 32));
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
@ -207,7 +208,7 @@ AcpiRead (
ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
return (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiRead)

View File

@ -448,8 +448,8 @@ AcpiNsLookup (
/* Current scope has no parent scope */
ACPI_ERROR ((AE_INFO,
"ACPI path has too many parent prefixes (^) "
"- reached beyond root node"));
"%s: Path has too many parent prefixes (^) "
"- reached beyond root node", Pathname));
return_ACPI_STATUS (AE_NOT_FOUND);
}
}

View File

@ -69,6 +69,22 @@ AcpiNsDumpOneDevice (
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
static ACPI_STATUS
AcpiNsDumpOneObjectPath (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiNsGetMaxDepth (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
/*******************************************************************************
*
* FUNCTION: AcpiNsPrintPathname
@ -695,6 +711,142 @@ AcpiNsDumpObjects (
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
*
* PARAMETERS: ObjHandle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
* ReturnValue - Not used
*
* RETURN: Status
*
* DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
* computes the maximum nesting depth in the namespace tree, in
* order to simplify formatting in AcpiNsDumpOneObjectPath.
* These procedures are UserFunctions called by AcpiNsWalkNamespace.
*
******************************************************************************/
static ACPI_STATUS
AcpiNsDumpOneObjectPath (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
UINT32 MaxLevel = *((UINT32 *) Context);
char *Pathname;
ACPI_NAMESPACE_NODE *Node;
int PathIndent;
if (!ObjHandle)
{
return (AE_OK);
}
Node = AcpiNsValidateHandle (ObjHandle);
Pathname = AcpiNsGetExternalPathname (Node);
PathIndent = 1;
if (Level <= MaxLevel)
{
PathIndent = MaxLevel - Level + 1;
}
AcpiOsPrintf ("%2d%*s%-12s%*s",
Level, Level, " ", AcpiUtGetTypeName (Node->Type),
PathIndent, " ");
AcpiOsPrintf ("%s\n", &Pathname[1]);
ACPI_FREE (Pathname);
return (AE_OK);
}
static ACPI_STATUS
AcpiNsGetMaxDepth (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
UINT32 *MaxLevel = (UINT32 *) Context;
if (Level > *MaxLevel)
{
*MaxLevel = Level;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpObjectPaths
*
* PARAMETERS: Type - Object type to be dumped
* DisplayType - 0 or ACPI_DISPLAY_SUMMARY
* MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth.
* OwnerId - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners.
* StartHandle - Where in namespace to start/end search
*
* RETURN: None
*
* DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
* AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
*
******************************************************************************/
void
AcpiNsDumpObjectPaths (
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle)
{
ACPI_STATUS Status;
UINT32 MaxLevel = 0;
ACPI_FUNCTION_ENTRY ();
/*
* Just lock the entire namespace for the duration of the dump.
* We don't want any changes to the namespace during this time,
* especially the temporary nodes since we are going to display
* them also.
*/
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not acquire namespace mutex\n");
return;
}
/* Get the max depth of the namespace tree, for formatting later */
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
/* Now dump the entire namespace */
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpEntry

View File

@ -654,10 +654,19 @@ AcpiWalkNamespace (
goto UnlockAndExit;
}
/* Now we can validate the starting node */
if (!AcpiNsValidateHandle (StartObject))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit2;
}
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
ACPI_NS_WALK_UNLOCK, DescendingCallback,
AscendingCallback, Context, ReturnValue);
UnlockAndExit2:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
UnlockAndExit:

View File

@ -93,14 +93,9 @@ AcpiTbVerifyTable (
}
}
/* FACS is the odd table, has no standard ACPI header and no checksum */
/* Always calculate checksum, ignore bad checksum if requested */
if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
{
/* Always calculate checksum, ignore bad checksum if requested */
Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
}
Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
return_ACPI_STATUS (Status);
}

View File

@ -158,7 +158,7 @@ AcpiTbPrintTableHeader (
Header->Signature, ACPI_CAST_PTR (void, Address),
Header->Length));
}
else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
{
/* RSDP has no common fields */
@ -211,6 +211,17 @@ AcpiTbVerifyChecksum (
UINT8 Checksum;
/*
* FACS/S3PT:
* They are the odd tables, have no standard ACPI header and no checksum
*/
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT) ||
ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
{
return (AE_OK);
}
/* Compute the checksum on the table */
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);

View File

@ -75,8 +75,7 @@ AcpiTbValidateRsdp (
* Note: Sometimes there exists more than one RSDP in memory; the valid
* RSDP has a valid checksum, all others have an invalid checksum.
*/
if (ACPI_STRNCMP ((char *) Rsdp->Signature, ACPI_SIG_RSDP,
sizeof (ACPI_SIG_RSDP)-1) != 0)
if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature))
{
/* Nope, BAD Signature */

View File

@ -216,7 +216,7 @@ AcpiDebugPrint (
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
if (ACPI_LV_THREADS & AcpiDbgLevel)
{

View File

@ -274,7 +274,7 @@ AcpiUtInitGlobals (
#if (!ACPI_REDUCED_HARDWARE)
/* GPE support */
/* GPE/SCI support */
AcpiGbl_AllGpesInitialized = FALSE;
AcpiGbl_GpeXruptListHead = NULL;
@ -283,6 +283,7 @@ AcpiUtInitGlobals (
AcpiCurrentGpeCount = 0;
AcpiGbl_GlobalEventHandler = NULL;
AcpiGbl_SciHandlerList = NULL;
#endif /* !ACPI_REDUCED_HARDWARE */

View File

@ -159,6 +159,10 @@ AcpiDbGenerateGpe (
char *GpeArg,
char *BlockArg))
ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbGenerateSci (
void))
/*
* dbconvert - miscellaneous conversion routines
@ -233,6 +237,10 @@ AcpiDbDumpNamespace (
char *StartArg,
char *DepthArg);
void
AcpiDbDumpNamespacePaths (
void);
void
AcpiDbDumpNamespaceByOwner (
char *OwnerArg,

View File

@ -694,6 +694,9 @@ void
AcpiDmUnresolvedWarning (
UINT8 Type);
void
AcpiDmGetExternalsFromFile (
void);
/*
* dmresrc

View File

@ -338,18 +338,18 @@ UINT32 ACPI_SYSTEM_XFACE
AcpiEvGpeXruptHandler (
void *Context);
UINT32
AcpiEvSciDispatch (
void);
UINT32
AcpiEvInstallSciHandler (
void);
ACPI_STATUS
AcpiEvRemoveSciHandler (
AcpiEvRemoveAllSciHandlers (
void);
UINT32
AcpiEvInitializeSCI (
UINT32 ProgramSCI);
ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiEvTerminate (

View File

@ -127,8 +127,9 @@ typedef struct acpi_exception_info
#define AE_NO_HANDLER EXCEP_ENV (0x001A)
#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
#define AE_ACCESS EXCEP_ENV (0x001D)
#define AE_CODE_ENV_MAX 0x001C
#define AE_CODE_ENV_MAX 0x001D
/*
@ -235,7 +236,7 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] =
EXCEP_TXT ("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
EXCEP_TXT ("AE_NO_NAMESPACE", "A namespace has not been loaded"),
EXCEP_TXT ("AE_NO_MEMORY", "Insufficient dynamic memory"),
EXCEP_TXT ("AE_NOT_FOUND", "The name was not found in the namespace"),
EXCEP_TXT ("AE_NOT_FOUND", "A requested entity is not found"),
EXCEP_TXT ("AE_NOT_EXIST", "A required entity does not exist"),
EXCEP_TXT ("AE_ALREADY_EXISTS", "An entity already exists"),
EXCEP_TXT ("AE_TYPE", "The object type is incorrect"),
@ -258,7 +259,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] =
EXCEP_TXT ("AE_SAME_HANDLER", "Attempt was made to install the same handler that is already installed"),
EXCEP_TXT ("AE_NO_HANDLER", "A handler for the operation is not installed"),
EXCEP_TXT ("AE_OWNER_ID_LIMIT", "There are no more Owner IDs available for ACPI tables or control methods"),
EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration")
EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration"),
EXCEP_TXT ("AE_ACCESS", "Permission denied for the requested operation")
};
static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] =

View File

@ -274,6 +274,7 @@ ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
ACPI_EXTERN void *AcpiGbl_TableHandlerContext;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler;
ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList;
/* Owner ID support */
@ -453,13 +454,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport;
ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
ACPI_EXTERN char AcpiGbl_DbScopeBuf[80];
ACPI_EXTERN char AcpiGbl_DbDebugFilename[80];
ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
ACPI_EXTERN char *AcpiGbl_DbBuffer;
ACPI_EXTERN char *AcpiGbl_DbFilename;
@ -467,6 +461,16 @@ ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode;
ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
/* These buffers should all be the same size */
ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE];
ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE];
/*
* Statistic globals
*/

View File

@ -453,6 +453,16 @@ typedef struct acpi_simple_repair_info
*
****************************************************************************/
/* Dispatch info for each host-installed SCI handler */
typedef struct acpi_sci_handler_info
{
struct acpi_sci_handler_info *Next;
ACPI_SCI_HANDLER Address; /* Address of handler */
void *Context; /* Context to be passed to handler */
} ACPI_SCI_HANDLER_INFO;
/* Dispatch info for each GPE -- either a method or handler, cannot be both */
typedef struct acpi_gpe_handler_info
@ -1217,7 +1227,8 @@ typedef struct acpi_external_list
/* Values for Flags field above */
#define ACPI_IPATH_ALLOCATED 0x01
#define ACPI_IPATH_ALLOCATED 0x01
#define ACPI_FROM_REFERENCE_FILE 0x02
typedef struct acpi_external_file

View File

@ -272,6 +272,14 @@ AcpiNsDumpObjects (
ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle);
void
AcpiNsDumpObjectPaths (
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle);
/*
* nseval - Namespace evaluation functions

View File

@ -404,6 +404,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address);
ACPI_STATUS

View File

@ -47,7 +47,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20130725
#define ACPI_CA_VERSION 0x20130823
#include "acconfig.h"
#include "actypes.h"
@ -375,6 +375,17 @@ AcpiInstallInitializationHandler (
ACPI_INIT_HANDLER Handler,
UINT32 Function);
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallSciHandler (
ACPI_SCI_HANDLER Address,
void *Context))
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiRemoveSciHandler (
ACPI_SCI_HANDLER Address))
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallGlobalEventHandler (

View File

@ -488,6 +488,11 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
#endif
/* Support for the special RSDP signature (8 characters) */
#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
/*******************************************************************************
*
@ -1006,6 +1011,10 @@ typedef void
* Various handlers and callback procedures
*/
typedef
UINT32 (*ACPI_SCI_HANDLER) (
void *Context);
typedef
void (*ACPI_GBL_EVENT_HANDLER) (
UINT32 EventType,
ACPI_HANDLE Device,

View File

@ -87,7 +87,7 @@
#define ACPI_FLUSH_CPU_CACHE()
#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread))
#if defined(__ia64__) || defined(__x86_64__)
#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long

View File

@ -45,7 +45,6 @@
#include <kenv.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/sysctl.h>
@ -78,10 +77,6 @@ OslGetTableViaRoot (
ACPI_PHYSICAL_ADDRESS *Address);
/* File locations */
#define SYSTEM_MEMORY "/dev/mem"
/* Hints for RSDP */
#define SYSTEM_KENV "hint.acpi.0.rsdp"
@ -278,6 +273,8 @@ AcpiOsGetTableByName (
*
* PARAMETERS: Index - Which table to get
* Table - Where a pointer to the table is returned
* Instance - Where a pointer to the table instance no. is
* returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
@ -293,6 +290,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address)
{
OSL_TABLE_INFO *Info;
@ -346,89 +344,15 @@ AcpiOsGetTableByIndex (
Status = AcpiOsGetTableByName (Info->Signature, Info->Instance,
Table, Address);
}
if (ACPI_SUCCESS (Status))
{
*Instance = Info->Instance;
}
return (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiOsMapMemory
*
* PARAMETERS: Where - Physical address of memory to be mapped
* Length - How much memory to map
*
* RETURN: Pointer to mapped memory. Null on error.
*
* DESCRIPTION: Map physical memory into local address space.
*
*****************************************************************************/
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS Where,
ACPI_SIZE Length)
{
UINT8 *MappedMemory;
ACPI_PHYSICAL_ADDRESS Offset;
int fd;
fd = open (SYSTEM_MEMORY, O_RDONLY);
if (fd < 0)
{
fprintf (stderr, "Cannot open %s\n", SYSTEM_MEMORY);
return (NULL);
}
/* Align the offset to use mmap */
Offset = Where % PAGE_SIZE;
/* Map the table header to get the length of the full table */
MappedMemory = mmap (NULL, (Length + Offset), PROT_READ, MAP_SHARED,
fd, (Where - Offset));
close (fd);
if (MappedMemory == MAP_FAILED)
{
fprintf (stderr,
"Could not map memory at 0x%8.8X%8.8X length 0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Where), ACPI_FORMAT_NATIVE_UINT (Length));
return (NULL);
}
return (ACPI_CAST8 (MappedMemory + Offset));
}
/******************************************************************************
*
* FUNCTION: AcpiOsUnmapMemory
*
* PARAMETERS: Where - Logical address of memory to be unmapped
* Length - How much memory to unmap
*
* RETURN: None.
*
* DESCRIPTION: Delete a previously created mapping. Where and Length must
* correspond to a previous mapping exactly.
*
*****************************************************************************/
void
AcpiOsUnmapMemory (
void *Where,
ACPI_SIZE Length)
{
ACPI_PHYSICAL_ADDRESS Offset;
Offset = (ACPI_PHYSICAL_ADDRESS) Where % PAGE_SIZE;
munmap ((UINT8 *) Where - Offset, (Length + Offset));
}
/******************************************************************************
*
* FUNCTION: OslTableInitialize
@ -467,7 +391,11 @@ OslTableInitialize (
/* Attempt to use kenv or sysctl to find RSD PTR record. */
if (kenv (KENV_GET, SYSTEM_KENV, Buffer, sizeof (Buffer)) > 0)
if (Gbl_RsdpBase)
{
Address = Gbl_RsdpBase;
}
else if (kenv (KENV_GET, SYSTEM_KENV, Buffer, sizeof (Buffer)) > 0)
{
Address = ACPI_STRTOUL (Buffer, NULL, 0);
}
@ -962,18 +890,9 @@ OslMapTable (
return (AE_BAD_ADDRESS);
}
(void) ApIsValidChecksum (MappedTable);
*Table = MappedTable;
/*
* Checksum for RSDP.
* Note: Other checksums are computed during the table dump.
*/
if (AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MappedTable)) ==
AE_BAD_CHECKSUM)
{
fprintf (stderr, "Warning: wrong checksum for RSDP\n");
}
return (AE_OK);
}

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi.h>
#include <stdio.h>
#include <stdlib.h>
@ -50,8 +51,6 @@
#include <ctype.h>
#include <sys/stat.h>
#include "acpisrc.h"
/*
* Allocated structure returned from OsOpenDirectory
*/
@ -103,6 +102,7 @@ AcpiOsOpenDirectory (
dir = opendir (DirPathname);
if (!dir)
{
fprintf (stderr, "Cannot open directory - %s\n", DirPathname);
free (ExternalInfo);
return (NULL);
}
@ -157,7 +157,8 @@ AcpiOsGetNextFilename (
temp_str = calloc (str_len, 1);
if (!temp_str)
{
printf ("Could not allocate buffer for temporary string\n");
fprintf (stderr,
"Could not allocate buffer for temporary string\n");
return (NULL);
}
@ -169,7 +170,9 @@ AcpiOsGetNextFilename (
free (temp_str);
if (err == -1)
{
printf ("stat() error - should not happen\n");
fprintf (stderr,
"Cannot stat file (should not happen) - %s\n",
temp_str);
return (NULL);
}

View File

@ -0,0 +1,171 @@
/******************************************************************************
*
* Module Name: osunixmap - Unix OSL for file mappings
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpidump.h"
#include <unistd.h>
#include <sys/mman.h>
#ifdef _FreeBSD
#include <sys/param.h>
#endif
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("osunixmap")
#ifndef O_BINARY
#define O_BINARY 0
#endif
#ifdef _FreeBSD
#define MMAP_FLAGS MAP_SHARED
#else
#define MMAP_FLAGS MAP_PRIVATE
#endif
#define SYSTEM_MEMORY "/dev/mem"
/*******************************************************************************
*
* FUNCTION: AcpiOsGetPageSize
*
* PARAMETERS: None
*
* RETURN: Page size of the platform.
*
* DESCRIPTION: Obtain page size of the platform.
*
******************************************************************************/
static ACPI_SIZE
AcpiOsGetPageSize (
void)
{
#ifdef PAGE_SIZE
return PAGE_SIZE;
#else
return sysconf (_SC_PAGESIZE);
#endif
}
/******************************************************************************
*
* FUNCTION: AcpiOsMapMemory
*
* PARAMETERS: Where - Physical address of memory to be mapped
* Length - How much memory to map
*
* RETURN: Pointer to mapped memory. Null on error.
*
* DESCRIPTION: Map physical memory into local address space.
*
*****************************************************************************/
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS Where,
ACPI_SIZE Length)
{
UINT8 *MappedMemory;
ACPI_PHYSICAL_ADDRESS Offset;
ACPI_SIZE PageSize;
int fd;
fd = open (SYSTEM_MEMORY, O_RDONLY | O_BINARY);
if (fd < 0)
{
fprintf (stderr, "Cannot open %s\n", SYSTEM_MEMORY);
return (NULL);
}
/* Align the offset to use mmap */
PageSize = AcpiOsGetPageSize ();
Offset = Where % PageSize;
/* Map the table header to get the length of the full table */
MappedMemory = mmap (NULL, (Length + Offset), PROT_READ, MMAP_FLAGS,
fd, (Where - Offset));
if (MappedMemory == MAP_FAILED)
{
fprintf (stderr, "Cannot map %s\n", SYSTEM_MEMORY);
close (fd);
return (NULL);
}
close (fd);
return (ACPI_CAST8 (MappedMemory + Offset));
}
/******************************************************************************
*
* FUNCTION: AcpiOsUnmapMemory
*
* PARAMETERS: Where - Logical address of memory to be unmapped
* Length - How much memory to unmap
*
* RETURN: None.
*
* DESCRIPTION: Delete a previously created mapping. Where and Length must
* correspond to a previous mapping exactly.
*
*****************************************************************************/
void
AcpiOsUnmapMemory (
void *Where,
ACPI_SIZE Length)
{
ACPI_PHYSICAL_ADDRESS Offset;
ACPI_SIZE PageSize;
PageSize = AcpiOsGetPageSize ();
Offset = (ACPI_PHYSICAL_ADDRESS) Where % PageSize;
munmap ((UINT8 *) Where - Offset, (Length + Offset));
}

View File

@ -1023,6 +1023,7 @@ AcpiOsReadPciConfiguration (
UINT32 Width)
{
*Value = 0;
return (AE_OK);
}

View File

@ -144,6 +144,8 @@ AcpiOsGetTableByAddress (
*
* PARAMETERS: Index - Which table to get
* Table - Where a pointer to the table is returned
* Instance - Where a pointer to the table instance no. is
* returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
@ -163,6 +165,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address)
{
ACPI_STATUS Status;
@ -352,3 +355,54 @@ Cleanup:
*Address = 0;
return (AE_OK);
}
/* These are here for acpidump only, so we don't need to link oswinxf */
#ifdef ACPI_DUMP_APP
/******************************************************************************
*
* FUNCTION: AcpiOsMapMemory
*
* PARAMETERS: Where - Physical address of memory to be mapped
* Length - How much memory to map
*
* RETURN: Pointer to mapped memory. Null on error.
*
* DESCRIPTION: Map physical memory into caller's address space
*
*****************************************************************************/
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS Where,
ACPI_SIZE Length)
{
return (ACPI_TO_POINTER ((ACPI_SIZE) Where));
}
/******************************************************************************
*
* FUNCTION: AcpiOsUnmapMemory
*
* PARAMETERS: Where - Logical address of memory to be unmapped
* Length - How much memory to unmap
*
* RETURN: None.
*
* DESCRIPTION: Delete a previously created mapping. Where and Length must
* correspond to a previous mapping exactly.
*
*****************************************************************************/
void
AcpiOsUnmapMemory (
void *Where,
ACPI_SIZE Length)
{
return;
}
#endif

View File

@ -1167,6 +1167,7 @@ AcpiOsReadPciConfiguration (
UINT32 Width)
{
*Value = 0;
return (AE_OK);
}

View File

@ -53,6 +53,10 @@ AbDisplayUsage (
UINT8 OptionCount);
#define AB_UTILITY_NAME "ACPI Binary Table Dump Utility"
#define AB_SUPPORTED_OPTIONS "c:d:e:h:s:tv"
/******************************************************************************
*
* FUNCTION: AbDisplayUsage
@ -73,12 +77,13 @@ AbDisplayUsage (
ACPI_USAGE_HEADER ("acpibin [options]");
ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files");
ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file");
ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file");
ACPI_OPTION ("-h <File>", "Display table header for binary AML file");
ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
ACPI_OPTION ("-t", "Terse mode");
ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files");
ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file");
ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file");
ACPI_OPTION ("-h <File>", "Display table header for binary AML file");
ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
ACPI_OPTION ("-t", "Terse mode");
ACPI_OPTION ("-v", "Display version information");
}
@ -105,7 +110,7 @@ main (
AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
AcpiOsInitialize ();
printf (ACPI_COMMON_SIGNON ("ACPI Binary AML File Utility"));
printf (ACPI_COMMON_SIGNON (AB_UTILITY_NAME));
if (argc < 2)
{
@ -115,7 +120,7 @@ main (
/* Command line options */
while ((j = AcpiGetopt (argc, argv, "c:d:e:h:s:t")) != EOF) switch(j)
while ((j = AcpiGetopt (argc, argv, AB_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'c': /* Compare Files */
@ -178,6 +183,10 @@ main (
Gbl_TerseMode = TRUE;
break;
case 'v': /* -v: (Version): signon already emitted, just exit */
return (0);
default:
AbDisplayUsage (0);

View File

@ -67,9 +67,10 @@
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_VerboseMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_BinaryMode, FALSE);
EXTERN UINT32 INIT_GLOBAL (Gbl_SsdtCount, 0);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_DumpCustomizedTables, FALSE);
EXTERN FILE INIT_GLOBAL (*Gbl_OutputFile, NULL);
EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL);
EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
/* Globals required for use with ACPICA modules */
@ -89,6 +90,10 @@ typedef struct ap_dump_action
} AP_DUMP_ACTION;
/* Local RSDP signature (Not the same as the actual signature which is "RSD PTR ") */
#define AP_DUMP_SIG_RSDP "RSDP"
#define AP_MAX_ACTIONS 32
#define AP_DUMP_ALL_TABLES 0
@ -129,6 +134,14 @@ BOOLEAN
ApIsValidHeader (
ACPI_TABLE_HEADER *Table);
BOOLEAN
ApIsValidChecksum (
ACPI_TABLE_HEADER *Table);
UINT32
ApGetTableLength (
ACPI_TABLE_HEADER *Table);
/*
* apfiles - File I/O utilities
@ -143,7 +156,8 @@ ApOpenOutputFile (
int
ApWriteToBinaryFile (
ACPI_TABLE_HEADER *Table);
ACPI_TABLE_HEADER *Table,
UINT32 Instance);
ACPI_TABLE_HEADER *
ApGetTableFromFile (

View File

@ -49,6 +49,7 @@
static int
ApDumpTableBuffer (
ACPI_TABLE_HEADER *Table,
UINT32 Instance,
ACPI_PHYSICAL_ADDRESS Address);
@ -68,34 +69,120 @@ BOOLEAN
ApIsValidHeader (
ACPI_TABLE_HEADER *Table)
{
/* Make sure signature is all ASCII and a valid ACPI name */
if (!AcpiUtValidAcpiName (Table->Signature))
if (!ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
*(UINT32 *) Table->Signature);
return (FALSE);
}
/* Make sure signature is all ASCII and a valid ACPI name */
/* Check for minimum table length */
if (!AcpiUtValidAcpiName (Table->Signature))
{
fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
*(UINT32 *) Table->Signature);
return (FALSE);
}
if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
{
fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
return (FALSE);
/* Check for minimum table length */
if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
{
fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
return (FALSE);
}
}
return (TRUE);
}
/******************************************************************************
*
* FUNCTION: ApIsValidChecksum
*
* PARAMETERS: Table - Pointer to table to be validated
*
* RETURN: TRUE if the checksum appears to be valid. FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI table checksum
*
******************************************************************************/
BOOLEAN
ApIsValidChecksum (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_RSDP *Rsdp;
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
/*
* Checksum for RSDP.
* Note: Other checksums are computed during the table dump.
*/
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
Status = AcpiTbValidateRsdp (Rsdp);
}
else
{
Status = AcpiTbVerifyChecksum (Table, Table->Length);
}
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "%4.4s: Warning: wrong checksum\n",
Table->Signature);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: ApGetTableLength
*
* PARAMETERS: Table - Pointer to the table
*
* RETURN: Table length
*
* DESCRIPTION: Obtain table length according to table signature
*
******************************************************************************/
UINT32
ApGetTableLength (
ACPI_TABLE_HEADER *Table)
{
ACPI_TABLE_RSDP *Rsdp;
/* Check if table is valid */
if (!ApIsValidHeader (Table))
{
return (0);
}
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
return (Rsdp->Length);
}
else
{
return (Table->Length);
}
}
/******************************************************************************
*
* FUNCTION: ApDumpTableBuffer
*
* PARAMETERS: Table - ACPI table to be dumped
* Instance - ACPI table instance no. to be dumped
* Address - Physical address of the table
*
* RETURN: None
@ -108,22 +195,13 @@ ApIsValidHeader (
static int
ApDumpTableBuffer (
ACPI_TABLE_HEADER *Table,
UINT32 Instance,
ACPI_PHYSICAL_ADDRESS Address)
{
UINT32 TableLength;
/* Check if the table header appears to be valid */
if (!ApIsValidHeader (Table))
{
return (-1);
}
/* Validate the table checksum (except FACS - has no checksum) */
if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
{
(void) AcpiTbVerifyChecksum (Table, Table->Length);
}
TableLength = ApGetTableLength (Table);
/* Print only the header if requested */
@ -137,7 +215,7 @@ ApDumpTableBuffer (
if (Gbl_BinaryMode)
{
return (ApWriteToBinaryFile (Table));
return (ApWriteToBinaryFile (Table, Instance));
}
/*
@ -148,7 +226,7 @@ ApDumpTableBuffer (
printf ("%4.4s @ 0x%8.8X%8.8X\n", Table->Signature,
ACPI_FORMAT_UINT64 (Address));
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), Table->Length,
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), TableLength,
DB_BYTE_DISPLAY, 0);
printf ("\n");
return (0);
@ -173,6 +251,7 @@ ApDumpAllTables (
void)
{
ACPI_TABLE_HEADER *Table;
UINT32 Instance = 0;
ACPI_PHYSICAL_ADDRESS Address;
ACPI_STATUS Status;
UINT32 i;
@ -182,7 +261,7 @@ ApDumpAllTables (
for (i = 0; i < AP_MAX_ACPI_FILES; i++)
{
Status = AcpiOsGetTableByIndex (i, &Table, &Address);
Status = AcpiOsGetTableByIndex (i, &Table, &Instance, &Address);
if (ACPI_FAILURE (Status))
{
/* AE_LIMIT means that no more tables are available */
@ -205,7 +284,7 @@ ApDumpAllTables (
}
}
if (ApDumpTableBuffer (Table, Address))
if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
@ -261,7 +340,7 @@ ApDumpTableByAddress (
return (-1);
}
TableStatus = ApDumpTableBuffer (Table, Address);
TableStatus = ApDumpTableBuffer (Table, 0, Address);
free (Table);
return (TableStatus);
}
@ -306,7 +385,11 @@ ApDumpTableByName (
/* To be friendly, handle tables whose signatures do not match the name */
if (ACPI_COMPARE_NAME (LocalSignature, "FADT"))
if (ACPI_COMPARE_NAME (LocalSignature, AP_DUMP_SIG_RSDP))
{
strcpy (LocalSignature, AP_DUMP_SIG_RSDP);
}
else if (ACPI_COMPARE_NAME (LocalSignature, "FADT"))
{
strcpy (LocalSignature, ACPI_SIG_FADT);
}
@ -336,7 +419,7 @@ ApDumpTableByName (
return (-1);
}
if (ApDumpTableBuffer (Table, Address))
if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
@ -395,7 +478,7 @@ ApDumpTableFromFile (
Pathname, Table->Signature, FileSize, FileSize);
}
TableStatus = ApDumpTableBuffer (Table, 0);
TableStatus = ApDumpTableBuffer (Table, 0, 0);
free (Table);
return (TableStatus);
}

View File

@ -100,6 +100,7 @@ ApOpenOutputFile (
* FUNCTION: ApWriteToBinaryFile
*
* PARAMETERS: Table - ACPI table to be written
* Instance - ACPI table instance no. to be written
*
* RETURN: Status
*
@ -110,29 +111,42 @@ ApOpenOutputFile (
int
ApWriteToBinaryFile (
ACPI_TABLE_HEADER *Table)
ACPI_TABLE_HEADER *Table,
UINT32 Instance)
{
char Filename[ACPI_NAME_SIZE + 16];
char SsdtInstance [16];
char InstanceStr [16];
FILE *File;
size_t Actual;
UINT32 TableLength;
/* Construct lower-case filename from the table signature */
/* Obtain table length */
Filename[0] = (char) ACPI_TOLOWER (Table->Signature[0]);
Filename[1] = (char) ACPI_TOLOWER (Table->Signature[1]);
Filename[2] = (char) ACPI_TOLOWER (Table->Signature[2]);
Filename[3] = (char) ACPI_TOLOWER (Table->Signature[3]);
TableLength = ApGetTableLength (Table);
/* Construct lower-case filename from the table local signature */
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
ACPI_MOVE_NAME (Filename, AP_DUMP_SIG_RSDP);
}
else
{
ACPI_MOVE_NAME (Filename, Table->Signature);
}
Filename[0] = (char) ACPI_TOLOWER (Filename[0]);
Filename[1] = (char) ACPI_TOLOWER (Filename[1]);
Filename[2] = (char) ACPI_TOLOWER (Filename[2]);
Filename[3] = (char) ACPI_TOLOWER (Filename[3]);
Filename[ACPI_NAME_SIZE] = 0;
/* Handle multiple SSDTs - create different filenames for each */
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
if (Instance > 0)
{
sprintf (SsdtInstance, "%u", Gbl_SsdtCount);
strcat (Filename, SsdtInstance);
Gbl_SsdtCount++;
sprintf (InstanceStr, "%u", Instance);
strcat (Filename, InstanceStr);
}
strcat (Filename, ACPI_TABLE_FILE_SUFFIX);
@ -153,8 +167,8 @@ ApWriteToBinaryFile (
return (-1);
}
Actual = fwrite (Table, 1, Table->Length, File);
if (Actual != Table->Length)
Actual = fwrite (Table, 1, TableLength, File);
if (Actual != TableLength)
{
perror ("Error writing binary output file");
fclose (File);

View File

@ -92,7 +92,7 @@ UINT32 CurrentAction = 0;
#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
#define AP_SUPPORTED_OPTIONS "?a:bf:hn:o:svz"
#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svz"
/******************************************************************************
@ -111,10 +111,12 @@ ApDisplayUsage (
ACPI_USAGE_HEADER ("acpidump [options]");
ACPI_OPTION ("-b", "Dump tables to binary files");
ACPI_OPTION ("-c", "Dump customized tables");
ACPI_OPTION ("-h -?", "This help message");
ACPI_OPTION ("-o <File>", "Redirect output to file");
ACPI_OPTION ("-r <Address>", "Dump tables from specified RSDP");
ACPI_OPTION ("-s", "Print table summaries only");
ACPI_OPTION ("-v", "Version of this utility");
ACPI_OPTION ("-v", "Display version information");
ACPI_OPTION ("-z", "Verbose mode");
printf ("\nTable Options:\n");
@ -182,6 +184,7 @@ ApDoOptions (
char **argv)
{
int j;
ACPI_STATUS Status;
/* Command line options */
@ -196,6 +199,11 @@ ApDoOptions (
Gbl_BinaryMode = TRUE;
continue;
case 'c': /* Dump customized tables */
Gbl_DumpCustomizedTables = TRUE;
continue;
case 'h':
case '?':
@ -210,6 +218,17 @@ ApDoOptions (
}
continue;
case 'r': /* Dump tables from specified RSDP */
Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, 0, &Gbl_RsdpBase);
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "%s: Could not convert to a physical address\n",
AcpiGbl_Optarg);
exit (-1);
}
continue;
case 's': /* Print table summaries only */
Gbl_SummaryMode = TRUE;

View File

@ -126,6 +126,10 @@ static UINT32
AeEventHandler (
void *Context);
static UINT32
AeSciHandler (
void *Context);
static char *TableEvents[] =
{
"LOAD",
@ -632,9 +636,9 @@ AeInterfaceHandler (
#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
* FUNCTION: AeEventHandler
* FUNCTION: AeEventHandler, AeSciHandler
*
* DESCRIPTION: Handler for Fixed Events
* DESCRIPTION: Handler for Fixed Events and SCIs
*
*****************************************************************************/
@ -644,6 +648,16 @@ AeEventHandler (
{
return (0);
}
static UINT32
AeSciHandler (
void *Context)
{
AcpiOsPrintf ("[AcpiExec] Received an SCI at handler\n");
return (0);
}
#endif /* !ACPI_REDUCED_HARDWARE */
@ -666,15 +680,65 @@ AeRegionInit (
void *HandlerContext,
void **RegionContext)
{
/*
* Real simple, set the RegionContext to the RegionHandle
*/
*RegionContext = RegionHandle;
if (Function == ACPI_REGION_DEACTIVATE)
{
*RegionContext = NULL;
}
else
{
*RegionContext = RegionHandle;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AeInstallSciHandler
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Install handler for SCIs. Exercise the code by doing an
* install/remove/install.
*
******************************************************************************/
static ACPI_STATUS
AeInstallSciHandler (
void)
{
ACPI_STATUS Status;
Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an SCI handler (1)"));
}
Status = AcpiRemoveSciHandler (AeSciHandler);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not remove an SCI handler"));
}
Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an SCI handler (2)"));
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AeInstallDeviceHandlers, AeInstallEcHandler,
@ -685,7 +749,7 @@ AeRegionInit (
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every EC
* device found.
* and PCI device found.
*
******************************************************************************/
@ -785,6 +849,11 @@ AeInstallLateHandlers (
#if (!ACPI_REDUCED_HARDWARE)
if (!AcpiGbl_ReducedHardware)
{
/* Install a user SCI handler */
Status = AeInstallSciHandler ();
AE_CHECK_OK (AeInstallSciHandler, Status);
/* Install some fixed event handlers */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);

View File

@ -91,7 +91,8 @@ static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buf
static char *FileList[ASL_MAX_FILES];
static AE_TABLE_DESC *AeTableListHead = NULL;
#define AE_SUPPORTED_OPTIONS "?b:d:e:f:ghm^orv:x:"
#define ACPIEXEC_NAME "AML Execution/Debug Utility"
#define AE_SUPPORTED_OPTIONS "?b:d:e:f:ghm^orv^:x:"
/******************************************************************************
@ -134,6 +135,7 @@ usage (
ACPI_OPTION ("-f <Value>", "Operation Region initialization fill value");
ACPI_OPTION ("-r", "Use hardware-reduced FADT V5");
ACPI_OPTION ("-v", "Display version information");
ACPI_OPTION ("-vi", "Verbose initialization output");
ACPI_OPTION ("-vr", "Verbose region handler output");
ACPI_OPTION ("-x <DebugLevel>", "Debug output level");
@ -302,6 +304,10 @@ AeDoOptions (
switch (AcpiGbl_Optarg[0])
{
case '^': /* -v: (Version): signon already emitted, just exit */
exit (0);
case 'i':
AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
@ -366,7 +372,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility"));
printf (ACPI_COMMON_SIGNON (ACPIEXEC_NAME));
if (argc < 2)
{
usage ();

View File

@ -247,7 +247,7 @@ AeBuildLocalTables (
/* Build an RSDP */
ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);
ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
LocalRSDP.Revision = 2;
LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);

View File

@ -50,6 +50,9 @@ static void
AhDisplayUsage (
void);
#define AH_UTILITY_NAME "ACPI Help Utility"
#define AH_SUPPORTED_OPTIONS "ehikmopsv"
/******************************************************************************
*
@ -66,6 +69,7 @@ AhDisplayUsage (
ACPI_USAGE_HEADER ("acpihelp <options> [NamePrefix | HexValue]");
ACPI_OPTION ("-h", "Display help");
ACPI_OPTION ("-v", "Display version information");
printf ("\nACPI Names and Symbols:\n");
ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)");
@ -104,7 +108,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
printf (ACPI_COMMON_SIGNON ("ACPI Help Utility"));
printf (ACPI_COMMON_SIGNON (AH_UTILITY_NAME));
DecodeType = AH_DECODE_DEFAULT;
if (argc < 2)
@ -115,7 +119,7 @@ main (
/* Command line options */
while ((j = AcpiGetopt (argc, argv, "ehikmops")) != EOF) switch (j)
while ((j = AcpiGetopt (argc, argv, AH_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case 'e':
@ -152,6 +156,10 @@ main (
DecodeType = AH_DECODE_ASL;
break;
case 'v': /* -v: (Version): signon already emitted, just exit */
return (0);
case 'h':
default:

View File

@ -53,7 +53,8 @@ FILE *AcpiGbl_DebugFile;
static AE_TABLE_DESC *AeTableListHead = NULL;
#define AE_SUPPORTED_OPTIONS "?h"
#define AN_UTILITY_NAME "ACPI Namespace Dump Utility"
#define AN_SUPPORTED_OPTIONS "?hv"
/******************************************************************************
@ -75,6 +76,7 @@ usage (
ACPI_USAGE_HEADER ("AcpiNames [options] AMLfile");
ACPI_OPTION ("-?", "Display this message");
ACPI_OPTION ("-v", "Display version information");
}
@ -240,7 +242,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
printf (ACPI_COMMON_SIGNON ("ACPI Namespace Dump Utility"));
printf (ACPI_COMMON_SIGNON (AN_UTILITY_NAME));
if (argc < 2)
{
@ -258,8 +260,12 @@ main (
/* Get the command line options */
while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j)
while ((j = AcpiGetopt (argc, argv, AN_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'v': /* -v: (Version): signon already emitted, just exit */
return (0);
case '?':
case 'h':
default:

View File

@ -178,7 +178,7 @@ AeBuildLocalTables (
/* Build an RSDP */
ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);
ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
LocalRSDP.Revision = 2;
LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);

View File

@ -98,6 +98,9 @@ BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE;
BOOLEAN Gbl_HasLoneLineFeeds = FALSE;
BOOLEAN Gbl_Cleanup = FALSE;
#define AS_UTILITY_NAME "ACPI Source Code Conversion Utility"
#define AS_SUPPORTED_OPTIONS "cdhlqsuv^y"
/******************************************************************************
*
@ -295,7 +298,8 @@ AsDisplayUsage (
printf ("\n");
ACPI_OPTION ("-d", "Leave debug statements in code");
ACPI_OPTION ("-s", "Generate source statistics only");
ACPI_OPTION ("-v", "Verbose mode");
ACPI_OPTION ("-v", "Display version information");
ACPI_OPTION ("-vb", "Verbose mode");
ACPI_OPTION ("-y", "Suppress file overwrite prompts");
}
@ -321,7 +325,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
printf (ACPI_COMMON_SIGNON ("ACPI Source Code Conversion Utility"));
printf (ACPI_COMMON_SIGNON (AS_UTILITY_NAME));
if (argc < 2)
{
@ -331,7 +335,7 @@ main (
/* Command line options */
while ((j = AcpiGetopt (argc, argv, "cdhlqsuvy")) != EOF) switch(j)
while ((j = AcpiGetopt (argc, argv, AS_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'l':
@ -376,9 +380,25 @@ main (
case 'v':
/* Verbose mode */
switch (AcpiGbl_Optarg[0])
{
case '^': /* -v: (Version): signon already emitted, just exit */
exit (0);
case 'b':
/* Verbose mode */
Gbl_VerboseMode = TRUE;
break;
default:
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
return (-1);
}
Gbl_VerboseMode = TRUE;
break;
case 'y':

View File

@ -383,6 +383,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_RSDUMP_INFO", SRC_TYPE_STRUCT},
{"ACPI_RW_LOCK", SRC_TYPE_STRUCT},
{"ACPI_S3PT_HEADER", SRC_TYPE_STRUCT},
{"ACPI_SCI_HANDLER", SRC_TYPE_SIMPLE},
{"ACPI_SCI_HANDLER_INFO", SRC_TYPE_STRUCT},
{"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT},
{"ACPI_SEMAPHORE", SRC_TYPE_SIMPLE},
{"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT},

View File

@ -74,6 +74,9 @@ static int AxAction = AX_EXTRACT_AML_TABLES; /* DSDT & SSDTs */
#define AX_OPTIONAL_TABLES 0
#define AX_REQUIRED_TABLE 1
#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility"
#define AX_SUPPORTED_OPTIONS "ahls:v"
/******************************************************************************
*
@ -93,6 +96,7 @@ DisplayUsage (
ACPI_OPTION ("-a", "Extract all tables, not just DSDT/SSDT");
ACPI_OPTION ("-l", "List table summaries, do not extract");
ACPI_OPTION ("-s <signature>", "Extract all tables with <signature>");
ACPI_OPTION ("-v", "Display version information");
printf ("\nExtract binary ACPI tables from text acpidump output\n");
printf ("Default invocation extracts the DSDT and all SSDTs\n");
@ -118,7 +122,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
printf (ACPI_COMMON_SIGNON ("ACPI Binary Table Extraction Utility"));
printf (ACPI_COMMON_SIGNON (AX_UTILITY_NAME));
if (argc < 2)
{
@ -128,7 +132,7 @@ main (
/* Command line options */
while ((j = AcpiGetopt (argc, argv, "ahls:")) != EOF) switch (j)
while ((j = AcpiGetopt (argc, argv, AX_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case 'a':
@ -145,6 +149,10 @@ main (
AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */
break;
case 'v': /* -v: (Version): signon already emitted, just exit */
return (0);
case 'h':
default:

View File

@ -242,7 +242,7 @@ DefinitionBlock (
}
})
Method (_CRS, 0, NotSerialized)
Method (_CRS, 0, Serialized)
{
Name (PRT0, ResourceTemplate ()
{
@ -401,7 +401,7 @@ DefinitionBlock (
Return (PRT0)
}
Method (_PRS, 0, NotSerialized)
Method (_PRS, 0, Serialized)
{
Name (BUF0, ResourceTemplate ()
{
@ -508,7 +508,7 @@ DefinitionBlock (
MFLD,8
}
Method (TCOP)
Method (TCOP,, Serialized)
{
Name (_STR, Unicode ("test"))
Store (4, MFLD)
@ -707,7 +707,7 @@ DefinitionBlock (
Name(_HID,EISAID("PNP0A03"))
Name(_ADR,0x0)
Method(_CRS)
Method(_CRS,, Serialized)
{
Name(PRT0, ResourceTemplate() {
WORDBusNumber( // Bus number resource(0)
@ -870,7 +870,7 @@ DefinitionBlock (
Return(RBIF)
}
Method(_BST) {
Method(_BST,, Serialized) {
_INI()
@ -1310,7 +1310,7 @@ DefinitionBlock (
* Field Creation
*/
Method (FLDS)
Method (FLDS,, Serialized)
{
Store ("++++++++ Creating BufferFields", Debug)
Name (BUF2, Buffer (128) {})
@ -1401,7 +1401,7 @@ DefinitionBlock (
/* Field execution */
Method (FLDX)
Method (FLDX,, Serialized)
{
Field (\_SB_.MEM.SMEM, AnyAcc, NoLock, Preserve)
{ // Field: SMEM overlay using 32-bit field elements
@ -1434,7 +1434,7 @@ DefinitionBlock (
}
Method (OBJ2, 1)
Method (OBJ2, 1, Serialized)
{
Store ("++++++++ Creating Buffer BUFO", Debug)
Name (BUFO, Buffer (32) {})
@ -1906,7 +1906,7 @@ DefinitionBlock (
}
Method (REFS)
Method (REFS,, Serialized)
{
Name (BBUF, Buffer() {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7})
@ -1982,7 +1982,7 @@ DefinitionBlock (
}
Method (INDX, 0)
Method (INDX, 0, Serialized)
{
Name(STAT,Package(4){})
Store(0x44443333,Index(STAT,0))
@ -2158,7 +2158,7 @@ DefinitionBlock (
//
Device (NOSV)
{
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ NoSave Test", Debug)
@ -2659,7 +2659,7 @@ DefinitionBlock (
Return (Arg0)
}
Method (RBUF)
Method (RBUF,, Serialized)
{ // RBUF: Return Buffer from local variable
Name (ABUF, Buffer() {"ARBITRARY_BUFFER"})
@ -3333,7 +3333,7 @@ DefinitionBlock (
}//OROP
Method(TEST)
Method(TEST,, Serialized)
{
Store ("++++++++ AndOrOp Test", Debug)
@ -3425,7 +3425,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ AddSubOp Test", Debug)
@ -3518,7 +3518,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ IncDecOp Test", Debug)
@ -4125,7 +4125,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ MulDivOp Test", Debug)
@ -4682,7 +4682,7 @@ DefinitionBlock (
Device (XORD)
{
//This Method tests XOr operator for all the data types i.e. BYTE, WORD and DWORD
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ Xor Test", Debug)
@ -5108,7 +5108,7 @@ DefinitionBlock (
// index), but are guaranteed to be unique so the failing test
// case can be uniquely identified.
//
Method (MADM, 1) // Misaligned Dynamic RAM SystemMemory OperationRegion
Method (MADM, 1, Serialized) // Misaligned Dynamic RAM SystemMemory OperationRegion
// Arg0 -- SystemMemory OperationRegion base address
{ // MADM: Misaligned Dynamic RAM SystemMemory OperationRegion
OperationRegion (RAM, SystemMemory, Arg0, 0x100)
@ -6396,7 +6396,7 @@ DefinitionBlock (
// zero if the strings mismatch, or 1 if the strings match.
// This exercises the test case of copying a string into a buffer
// and performing an IndexOp on the resulting buffer.
Method (MCTH, 2) // Control Method to compare two strings
Method (MCTH, 2, Serialized) // Control Method to compare two strings
{ // MCTH: Control Method to compare two strings
// Arg0: first string to compare
// Arg1: second string to compare
@ -6546,7 +6546,7 @@ DefinitionBlock (
{ Return (0x0F) } // Battery not present
} // _STA
Method (_BIF)
Method (_BIF,, Serialized)
{
Name (BUFR, Package(13) {})
Store (\_SB.PCI2.ISA.EC0.BPU0, Index (BUFR,0)) // Power Unit
@ -6570,7 +6570,7 @@ DefinitionBlock (
Return (BUFR)
} // _BIF
Method (_BST)
Method (_BST,, Serialized)
{
Name (BUFR, Package(4) {1, 0x100, 0x76543210, 0x180})
Return (BUFR)
@ -6581,7 +6581,7 @@ DefinitionBlock (
Store (arg0, \_SB.PCI2.ISA.EC0.BTP0) // Set Battery Trip point
}
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ IndexOp Test", Debug)
@ -6838,7 +6838,7 @@ DefinitionBlock (
Package (3) {0, 0, 0}
}) // C17A
Method (C17B, 1)
Method (C17B, 1, Serialized)
{ // C17B: _BIF implementation
Name (C17C, Package (13)
{ // C17C: _BIF control method return package
@ -6908,7 +6908,7 @@ DefinitionBlock (
Device (IDX3)
{
Method (LCLB)
Method (LCLB,, Serialized)
{ // LCLB control method: test Index(Local#) where Local# is buffer
// Local0 is index counter
// Local1 is buffer
@ -6960,7 +6960,7 @@ DefinitionBlock (
Return (0) // Pass
} // LCLB control method: test Index(Local#) where Local# is buffer
Method (LCLP)
Method (LCLP,, Serialized)
{ // LCLP control method: test Index(Local#) where Local# is package
// Local0 is index counter
// Local1 is package
@ -7066,7 +7066,7 @@ DefinitionBlock (
// Generic Test method
//
// This test returns 0xE (14) - ObjectType = Buffer Field
Method(TST1)
Method(TST1,, Serialized)
{
Name (DEST, Buffer () // 62 characters plus NULL
{"Destination buffer that is longer than the short source buffer"})
@ -7085,7 +7085,7 @@ DefinitionBlock (
}
Method(TST2)
Method(TST2,, Serialized)
{
Name (BUF0, Buffer() {0x1, 0x2, 0x3, 0x4, 0x5})
Store(0x55, Index(BUF0, 2))
@ -7102,7 +7102,7 @@ DefinitionBlock (
}
Method(TST3)
Method(TST3,, Serialized)
{
Name (BUF1, Buffer() {0x1, 0x2, 0x3, 0x4, 0x5})
Store(Index(BUF1, 1), Local0)
@ -7293,7 +7293,7 @@ DefinitionBlock (
}
Method (TSTF)
Method (TSTF,, Serialized)
{
Name (SRCB, Buffer (12) {}) // 12 characters
Store ("Short Buffer", SRCB)
@ -7318,7 +7318,7 @@ DefinitionBlock (
Return(0)
}
Method (TSTG)
Method (TSTG,, Serialized)
{
Name (SRCB, Buffer (12) {}) // 12 characters
@ -7403,7 +7403,7 @@ DefinitionBlock (
// This test shows that MS ACPI.SYS stores only the lower 8-bits of a 32-bit
// number into the index'ed buffer
//
Method (TSTH)
Method (TSTH,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@ -7439,7 +7439,7 @@ DefinitionBlock (
Return(0)
}
Method (TSTI)
Method (TSTI,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@ -7475,7 +7475,7 @@ DefinitionBlock (
Return(0)
}
Method(TSTJ)
Method(TSTJ,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@ -7511,7 +7511,7 @@ DefinitionBlock (
Return(0)
}
Method(TSTK)
Method(TSTK,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@ -7547,7 +7547,7 @@ DefinitionBlock (
Return(0)
}
Method(TSTL)
Method(TSTL,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@ -7733,7 +7733,7 @@ DefinitionBlock (
Device (MTCH)
{
Method (TEST)
Method (TEST,, Serialized)
{
Store ("++++++++ MatchOp Test", Debug)
@ -8267,7 +8267,7 @@ DefinitionBlock (
{ Return (0x0F) } // battery not present
} // _STA
Method (_BIF)
Method (_BIF,, Serialized)
{ // _BIF
Name (BUFR, Package (13) {})
@ -8291,7 +8291,7 @@ DefinitionBlock (
Device (IDX2)
{
Method (B2IB)
Method (B2IB,, Serialized)
{ // B2IB: store from Buffer into Index'ed Buffer
Name (SRCB, Buffer () {"Short Buffer"}) // 12 characters plus NULL
@ -8485,7 +8485,7 @@ DefinitionBlock (
Return (0) // pass
} // B2IB: store from Buffer into Index'ed Buffer
Method (FB2P)
Method (FB2P,, Serialized)
{ // FB2P: store from Field Buffer into Index'ed Package
Name (DEST, Package (2) {})
@ -8700,7 +8700,7 @@ DefinitionBlock (
Return (0)
} // SAR0: SizeOf(Arg) test control method
Method (SARG)
Method (SARG,, Serialized)
{ // SARG: SizeOf(Arg) test control method
Name (BUFR, Buffer (12) {}) // uninitialized Buffer
Name (BUF1, Buffer() {0x01, 0x02, 0x03, 0x04, 0x05})
@ -8965,7 +8965,7 @@ DefinitionBlock (
Return (0)
} // SARG: SizeOf(Arg) test control method
Method (SBUF)
Method (SBUF,, Serialized)
{ // SBUF: SizeOf(Buffer) test control method
Name (BUFR, Buffer (12) {})
@ -9026,7 +9026,7 @@ DefinitionBlock (
} // SIND: SizeOf(Index(,,)) test control method
****************************************************/
Method (SLOC)
Method (SLOC,, Serialized)
{ // SLOC: SizeOf(Local) test control method
Name (BUFR, Buffer (12) {}) // uninitialized Buffer
Name (STR0, "String")