mirror of
https://github.com/acpica/acpica/
synced 2024-12-29 05:39:57 +03:00
Support for disassembler external generation
This commit is contained in:
parent
45f68a29b6
commit
6f70255c7a
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: adisasm - Application-level disassembler routines
|
||||
* $Revision: 1.95 $
|
||||
* $Revision: 1.96 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -125,31 +125,24 @@
|
||||
#include "acapps.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_TOOLS
|
||||
ACPI_MODULE_NAME ("adisasm")
|
||||
|
||||
/* Local prototypes */
|
||||
extern int AslCompilerdebug;
|
||||
|
||||
static ACPI_STATUS
|
||||
AdXrefDescendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
static ACPI_STATUS
|
||||
AdXrefAscendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
static void
|
||||
AdCrossReferenceNamespace (
|
||||
ACPI_STATUS
|
||||
LsDisplayNamespace (
|
||||
void);
|
||||
|
||||
void
|
||||
LsSetupNsList (void * Handle);
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
void
|
||||
AdCreateTableHeader (
|
||||
char *Filename,
|
||||
@ -159,7 +152,7 @@ void
|
||||
AdDisassemblerHeader (
|
||||
char *Filename);
|
||||
|
||||
ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
|
||||
ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
|
||||
|
||||
|
||||
/* Stubs for ASL compiler */
|
||||
@ -217,120 +210,6 @@ AcpiDsMethodDataInitArgs (
|
||||
}
|
||||
|
||||
|
||||
#define FILE_SUFFIX_DISASSEMBLY "dsl"
|
||||
#define ACPI_TABLE_FILE_SUFFIX ".dat"
|
||||
char FilenameBuf[20];
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AfGenerateFilename
|
||||
*
|
||||
* PARAMETERS: Prefix - prefix string
|
||||
* TableId - The table ID
|
||||
*
|
||||
* RETURN: Pointer to the completed string
|
||||
*
|
||||
* DESCRIPTION: Build an output filename from an ACPI table ID string
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
AdGenerateFilename (
|
||||
char *Prefix,
|
||||
char *TableId)
|
||||
{
|
||||
ACPI_NATIVE_UINT i;
|
||||
ACPI_NATIVE_UINT j;
|
||||
|
||||
|
||||
for (i = 0; Prefix[i]; i++)
|
||||
{
|
||||
FilenameBuf[i] = Prefix[i];
|
||||
}
|
||||
|
||||
FilenameBuf[i] = '_';
|
||||
i++;
|
||||
|
||||
for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
|
||||
{
|
||||
FilenameBuf[i] = TableId[j];
|
||||
}
|
||||
|
||||
FilenameBuf[i] = 0;
|
||||
strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
|
||||
return FilenameBuf;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AfWriteBuffer
|
||||
*
|
||||
* PARAMETERS: Filename - name of file
|
||||
* Buffer - data to write
|
||||
* Length - length of data
|
||||
*
|
||||
* RETURN: Actual number of bytes written
|
||||
*
|
||||
* DESCRIPTION: Open a file and write out a single buffer
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_NATIVE_INT
|
||||
AdWriteBuffer (
|
||||
char *Filename,
|
||||
char *Buffer,
|
||||
UINT32 Length)
|
||||
{
|
||||
FILE *fp;
|
||||
ACPI_SIZE Actual;
|
||||
|
||||
|
||||
fp = fopen (Filename, "wb");
|
||||
if (!fp)
|
||||
{
|
||||
printf ("Couldn't open %s\n", Filename);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
Actual = fwrite (Buffer, (size_t) Length, 1, fp);
|
||||
fclose (fp);
|
||||
return ((ACPI_NATIVE_INT) Actual);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AfWriteTable
|
||||
*
|
||||
* PARAMETERS: Table - pointer to the ACPI table
|
||||
* Length - length of the table
|
||||
* TableName - the table signature
|
||||
* OemTableID - from the table header
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump the loaded tables to a file (or files)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AdWriteTable (
|
||||
ACPI_TABLE_HEADER *Table,
|
||||
UINT32 Length,
|
||||
char *TableName,
|
||||
char *OemTableId)
|
||||
{
|
||||
char *Filename;
|
||||
|
||||
|
||||
Filename = AdGenerateFilename (TableName, OemTableId);
|
||||
AdWriteBuffer (Filename, (char *) Table, Length);
|
||||
|
||||
AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdInitialize
|
||||
@ -366,300 +245,75 @@ AdInitialize (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlGenerateFilename
|
||||
* FUNCTION: AdAddExternalsToNamespace
|
||||
*
|
||||
* PARAMETERS: InputFilename - Original ASL source filename
|
||||
* Suffix - New extension.
|
||||
*
|
||||
* RETURN: New filename containing the original base + the new suffix
|
||||
*
|
||||
* DESCRIPTION: Generate a new filename from the ASL source filename and a new
|
||||
* extension. Used to create the *.LST, *.TXT, etc. files.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
FlGenerateFilename (
|
||||
char *InputFilename,
|
||||
char *Suffix)
|
||||
{
|
||||
char *Position;
|
||||
char *NewFilename;
|
||||
|
||||
|
||||
/*
|
||||
* Copy the original filename to a new buffer. Leave room for the worst case
|
||||
* where we append the suffix, an added dot and the null terminator.
|
||||
*/
|
||||
NewFilename = ACPI_ALLOCATE_ZEROED (
|
||||
strlen (InputFilename) + strlen (Suffix) + 2);
|
||||
strcpy (NewFilename, InputFilename);
|
||||
|
||||
/* Try to find the last dot in the filename */
|
||||
|
||||
Position = strrchr (NewFilename, '.');
|
||||
if (Position)
|
||||
{
|
||||
/* Tack on the new suffix */
|
||||
|
||||
Position++;
|
||||
*Position = 0;
|
||||
strcat (Position, Suffix);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No dot, add one and then the suffix */
|
||||
|
||||
strcat (NewFilename, ".");
|
||||
strcat (NewFilename, Suffix);
|
||||
}
|
||||
|
||||
return NewFilename;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlStrdup
|
||||
*
|
||||
* DESCRIPTION: Local strdup function
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static char *
|
||||
FlStrdup (
|
||||
char *String)
|
||||
{
|
||||
char *NewString;
|
||||
|
||||
|
||||
NewString = ACPI_ALLOCATE (strlen (String) + 1);
|
||||
if (!NewString)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
strcpy (NewString, String);
|
||||
return (NewString);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlSplitInputPathname
|
||||
*
|
||||
* PARAMETERS: InputFilename - The user-specified ASL source file to be
|
||||
* compiled
|
||||
* OutDirectoryPath - Where the directory path prefix is
|
||||
* returned
|
||||
* OutFilename - Where the filename part is returned
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Split the input path into a directory and filename part
|
||||
* 1) Directory part used to open include files
|
||||
* 2) Filename part used to generate output filenames
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
FlSplitInputPathname (
|
||||
char *InputPath,
|
||||
char **OutDirectoryPath,
|
||||
char **OutFilename)
|
||||
{
|
||||
char *Substring;
|
||||
char *DirectoryPath;
|
||||
char *Filename;
|
||||
|
||||
|
||||
*OutDirectoryPath = NULL;
|
||||
*OutFilename = NULL;
|
||||
|
||||
if (!InputPath)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Get the path to the input filename's directory */
|
||||
|
||||
DirectoryPath = FlStrdup (InputPath);
|
||||
if (!DirectoryPath)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
Substring = strrchr (DirectoryPath, '\\');
|
||||
if (!Substring)
|
||||
{
|
||||
Substring = strrchr (DirectoryPath, '/');
|
||||
if (!Substring)
|
||||
{
|
||||
Substring = strrchr (DirectoryPath, ':');
|
||||
}
|
||||
}
|
||||
|
||||
if (!Substring)
|
||||
{
|
||||
DirectoryPath[0] = 0;
|
||||
Filename = FlStrdup (InputPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Filename = FlStrdup (Substring + 1);
|
||||
*(Substring+1) = 0;
|
||||
}
|
||||
|
||||
if (!Filename)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
*OutDirectoryPath = DirectoryPath;
|
||||
*OutFilename = Filename;
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdXrefDescendingOp
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Descending handler for namespace cross reference
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AdXrefDescendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_OP_WALK_INFO *Info = Context;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
ACPI_OBJECT_TYPE ObjectType;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
WalkState = Info->WalkState;
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
|
||||
ObjectType = OpInfo->ObjectType;
|
||||
if (AcpiNsOpensScope (ObjectType))
|
||||
{
|
||||
if (Op->Common.Node)
|
||||
{
|
||||
|
||||
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this operator contains a reference to a resource descriptor.
|
||||
* If so, convert the reference into a symbolic reference.
|
||||
*/
|
||||
AcpiDmCheckResourceReference (Op, WalkState);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdXrefAscendingOp
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Ascending handler for namespace cross reference
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AdXrefAscendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_OP_WALK_INFO *Info = Context;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
ACPI_OBJECT_TYPE ObjectType;
|
||||
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
ObjectType = OpInfo->ObjectType;
|
||||
|
||||
if (AcpiNsOpensScope (ObjectType))
|
||||
{
|
||||
(void) AcpiDsScopeStackPop (Info->WalkState);
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdCrossReferenceNamespace
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Cross reference the namespace to create externals and to
|
||||
* convert fixed-offset references to resource descriptors to
|
||||
* symbolic references.
|
||||
*
|
||||
* TBD: Currently only generates resource symbolic references.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
AdCrossReferenceNamespace (
|
||||
void
|
||||
AdAddExternalsToNamespace (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_PARSE_OBJECT *Op = AcpiGbl_ParsedNamespaceRoot;
|
||||
ACPI_OP_WALK_INFO Info;
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
|
||||
ACPI_OPERAND_OBJECT *MethodDesc;
|
||||
|
||||
|
||||
if (!Op)
|
||||
while (External)
|
||||
{
|
||||
return;
|
||||
Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
|
||||
ACPI_IMODE_LOAD_PASS1, ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
|
||||
NULL, &Node);
|
||||
|
||||
if (External->Type == ACPI_TYPE_METHOD)
|
||||
{
|
||||
MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
|
||||
MethodDesc->Method.ParamCount = (UINT8) External->Value;
|
||||
Node->Object = MethodDesc;
|
||||
}
|
||||
|
||||
External = External->Next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdMethodExternalCount
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AdMethodExternalCount (
|
||||
void)
|
||||
{
|
||||
ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
|
||||
UINT32 Count = 0;
|
||||
|
||||
|
||||
while (External)
|
||||
{
|
||||
if (External->Type == ACPI_TYPE_METHOD)
|
||||
{
|
||||
Count++;
|
||||
}
|
||||
|
||||
External = External->Next;
|
||||
}
|
||||
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
WalkState = AcpiDsCreateWalkState (0, AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
|
||||
if (!WalkState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Status = AcpiDsScopeStackPush (AcpiGbl_RootNode,
|
||||
AcpiGbl_RootNode->Type, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Info.Flags = 0;
|
||||
Info.Level = 0;
|
||||
Info.WalkState = WalkState;
|
||||
AcpiDmWalkParseTree (Op, AdXrefDescendingOp, AdXrefAscendingOp, &Info);
|
||||
ACPI_FREE (WalkState);
|
||||
return;
|
||||
return (Count);
|
||||
}
|
||||
|
||||
|
||||
@ -779,12 +433,84 @@ AdAmlDisassemble (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if (AslCompilerdebug)
|
||||
{
|
||||
AcpiOsPrintf ("/**** Before second load \n");
|
||||
|
||||
LsSetupNsList (File);
|
||||
LsDisplayNamespace ();
|
||||
AcpiOsPrintf ("*****/\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Load namespace from names created within control methods
|
||||
*/
|
||||
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
|
||||
|
||||
if (AslCompilerdebug)
|
||||
{
|
||||
AcpiOsPrintf ("/**** After second load \n");
|
||||
LsSetupNsList (File);
|
||||
LsDisplayNamespace ();
|
||||
AcpiOsPrintf ("*****/\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Cross reference the namespace here, in order to
|
||||
* generate External() statements and to convert fixed-offset
|
||||
* references to resource descriptors to symbolic references.
|
||||
*/
|
||||
AdCrossReferenceNamespace ();
|
||||
AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
|
||||
|
||||
if (AslCompilerdebug)
|
||||
{
|
||||
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
|
||||
}
|
||||
|
||||
/* Find possible calls to external control methods */
|
||||
|
||||
AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
|
||||
|
||||
/*
|
||||
* If we found any external control methods, we must reparse the entire
|
||||
* tree with the new information (namely, the number of arguments per
|
||||
* method)
|
||||
*/
|
||||
if (AdMethodExternalCount ())
|
||||
{
|
||||
fprintf (stderr, "\nFound %d external control methods, reparsing with new information\n", AdMethodExternalCount());
|
||||
|
||||
/*
|
||||
* Reparse, rebuild namespace. no need to xref namespace
|
||||
*/
|
||||
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
|
||||
AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
|
||||
|
||||
AcpiGbl_RootNode = NULL;
|
||||
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
|
||||
AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
|
||||
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
|
||||
AcpiGbl_RootNodeStruct.Child = NULL;
|
||||
AcpiGbl_RootNodeStruct.Peer = NULL;
|
||||
AcpiGbl_RootNodeStruct.Object = NULL;
|
||||
AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
|
||||
|
||||
Status = AcpiNsRootInitialize ();
|
||||
AdAddExternalsToNamespace ();
|
||||
|
||||
Status = AdParseTable (Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
|
||||
AcpiFormatException (Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if (AslCompilerdebug)
|
||||
{
|
||||
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
|
||||
}
|
||||
}
|
||||
|
||||
/* Optional displays */
|
||||
|
||||
@ -808,7 +534,7 @@ Cleanup:
|
||||
AcpiOsRedirectOutput (stdout);
|
||||
}
|
||||
|
||||
AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
|
||||
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -863,6 +589,8 @@ AdCreateTableHeader (
|
||||
char *Filename,
|
||||
ACPI_TABLE_HEADER *Table)
|
||||
{
|
||||
char *NewFilename;
|
||||
|
||||
|
||||
AdDisassemblerHeader (Filename);
|
||||
|
||||
@ -877,11 +605,15 @@ AdCreateTableHeader (
|
||||
AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
|
||||
AcpiOsPrintf (" */\n");
|
||||
|
||||
/* Create AML output filename based on input filename */
|
||||
|
||||
NewFilename = FlGenerateFilename (Filename, "aml");
|
||||
|
||||
/* Open the ASL definition block */
|
||||
|
||||
AcpiOsPrintf (
|
||||
"DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
|
||||
Table->Signature, Table->Signature, Table->Revision,
|
||||
"DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
|
||||
NewFilename, Table->Signature, Table->Revision,
|
||||
Table->OemId, Table->OemTableId, Table->OemRevision);
|
||||
}
|
||||
|
||||
@ -906,7 +638,7 @@ AdDisplayTables (
|
||||
{
|
||||
|
||||
|
||||
if (!AcpiGbl_ParsedNamespaceRoot)
|
||||
if (!AcpiGbl_ParseOpRoot)
|
||||
{
|
||||
return AE_NOT_EXIST;
|
||||
}
|
||||
@ -916,7 +648,7 @@ AdDisplayTables (
|
||||
AdCreateTableHeader (Filename, Table);
|
||||
}
|
||||
|
||||
AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX);
|
||||
AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
|
||||
|
||||
if (AcpiGbl_DbOpt_verbose)
|
||||
{
|
||||
@ -1290,8 +1022,8 @@ AdParseTable (
|
||||
|
||||
/* Create the root object */
|
||||
|
||||
AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp ();
|
||||
if (!AcpiGbl_ParsedNamespaceRoot)
|
||||
AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp ();
|
||||
if (!AcpiGbl_ParseOpRoot)
|
||||
{
|
||||
return AE_NO_MEMORY;
|
||||
}
|
||||
@ -1299,13 +1031,13 @@ AdParseTable (
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
WalkState = AcpiDsCreateWalkState (0,
|
||||
AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
|
||||
AcpiGbl_ParseOpRoot, NULL, NULL);
|
||||
if (!WalkState)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
|
||||
Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
|
||||
NULL, AmlStart, AmlLength, NULL, 1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
@ -1335,11 +1067,11 @@ AdParseTable (
|
||||
|
||||
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
|
||||
|
||||
Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot);
|
||||
Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
|
||||
|
||||
/* Process Resource Templates */
|
||||
|
||||
AcpiDmFindResources (AcpiGbl_ParsedNamespaceRoot);
|
||||
AcpiDmFindResources (AcpiGbl_ParseOpRoot);
|
||||
|
||||
fprintf (stderr, "Parsing completed\n");
|
||||
return AE_OK;
|
||||
|
@ -3,7 +3,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslglobal.h - Global variable definitions
|
||||
* $Revision: 1.53 $
|
||||
* $Revision: 1.54 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -181,7 +181,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, F
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GenerateExternals, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswload - Dispatcher namespace load callbacks
|
||||
* $Revision: 1.74 $
|
||||
* $Revision: 1.75 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -486,8 +486,26 @@ LdNamespace1Begin (
|
||||
*/
|
||||
ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
|
||||
ObjectType = ACPI_TYPE_ANY;
|
||||
break;
|
||||
|
||||
/*
|
||||
* We will mark every new node along the path as "External". This
|
||||
* allows some or all of the nodes to be created later in the ASL
|
||||
* code. Handles cases like this:
|
||||
*
|
||||
* External (\_SB_.PCI0.ABCD, IntObj)
|
||||
* Scope (_SB_)
|
||||
* {
|
||||
* Device (PCI0)
|
||||
* {
|
||||
* }
|
||||
* }
|
||||
* Method (X)
|
||||
* {
|
||||
* Store (\_SB_.PCI0.ABCD, Local0)
|
||||
* }
|
||||
*/
|
||||
Flags |= ACPI_NS_EXTERNAL;
|
||||
break;
|
||||
|
||||
case PARSEOP_DEFAULT_ARG:
|
||||
|
||||
@ -638,11 +656,36 @@ LdNamespace1Begin (
|
||||
|
||||
if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
|
||||
{
|
||||
/* Allow multiple references to the same scope */
|
||||
|
||||
Node->Type = (UINT8) ObjectType;
|
||||
Status = AE_OK;
|
||||
}
|
||||
else if (Node->Flags & ANOBJ_IS_EXTERNAL)
|
||||
{
|
||||
/*
|
||||
* Allow one create on an object or segment that was
|
||||
* previously declared External
|
||||
*/
|
||||
Node->Flags &= ~ANOBJ_IS_EXTERNAL;
|
||||
Node->Type = (UINT8) ObjectType;
|
||||
|
||||
/* Just retyped a node, probably will need to open a scope */
|
||||
|
||||
if (AcpiNsOpensScope (ObjectType))
|
||||
{
|
||||
Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
Status = AE_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Valid error, object already exists */
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
|
||||
Op->Asl.ExternalName);
|
||||
Status = AE_OK;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: asllookup- Namespace lookup
|
||||
* $Revision: 1.101 $
|
||||
* $Revision: 1.102 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -451,6 +451,8 @@ LsDisplayNamespace (
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
Gbl_NumNamespaceObjects = 0;
|
||||
|
||||
/* File header */
|
||||
|
||||
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
|
||||
@ -647,7 +649,10 @@ LkIsObjectUsed (
|
||||
|
||||
/* All others are valid unreferenced namespace objects */
|
||||
|
||||
AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
|
||||
if (Node->Op)
|
||||
{
|
||||
AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
|
||||
}
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@ -912,7 +917,7 @@ LkNamespaceLocateBegin (
|
||||
*/
|
||||
Gbl_NsLookupCount++;
|
||||
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
|
||||
ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslmain - compiler main and utilities
|
||||
* $Revision: 1.90 $
|
||||
* $Revision: 1.91 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -214,7 +214,6 @@ Options (
|
||||
printf (" -dc [file] Disassemble AML and immediately compile it\n");
|
||||
printf (" (Obtain DSDT from current system if no input file)\n");
|
||||
printf (" -2 Emit ACPI 2.0 compatible ASL code\n");
|
||||
printf (" -e Generate External() statements for unresolved symbols\n");
|
||||
printf (" -g Get ACPI tables and write to files (*.dat)\n");
|
||||
|
||||
printf ("\nHelp:\n");
|
||||
@ -252,7 +251,7 @@ HelpMessage (
|
||||
|
||||
Options ();
|
||||
|
||||
printf ("\nCompiler Debug Options:\n");
|
||||
printf ("\nCompiler/Disassembler Debug Options:\n");
|
||||
printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
|
||||
printf (" Types: Parse/Tree/Both\n");
|
||||
printf (" -f Ignore errors, force creation of AML output file(s)\n");
|
||||
@ -417,14 +416,6 @@ AslCommandLine (
|
||||
break;
|
||||
|
||||
|
||||
case 'e':
|
||||
|
||||
/* Generate external statements for unresolved symbols */
|
||||
|
||||
Gbl_GenerateExternals = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case 'f':
|
||||
|
||||
/* Ignore errors and force creation of aml file */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmopcode - AML disassembler, specific AML opcodes
|
||||
* $Revision: 1.97 $
|
||||
* $Revision: 1.98 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -375,6 +375,7 @@ AcpiDmDisassembleOneOp (
|
||||
const ACPI_OPCODE_INFO *OpInfo = NULL;
|
||||
UINT32 Offset;
|
||||
UINT32 Length;
|
||||
ACPI_PARSE_OBJECT *Child;
|
||||
|
||||
|
||||
if (!Op)
|
||||
@ -390,40 +391,52 @@ AcpiDmDisassembleOneOp (
|
||||
AcpiDmMatchKeyword (Op);
|
||||
return;
|
||||
|
||||
case ACPI_DASM_LNOT_SUFFIX:
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_LEQUAL_OP:
|
||||
AcpiOsPrintf ("LNotEqual");
|
||||
break;
|
||||
|
||||
case AML_LGREATER_OP:
|
||||
AcpiOsPrintf ("LLessEqual");
|
||||
break;
|
||||
|
||||
case AML_LLESS_OP:
|
||||
AcpiOsPrintf ("LGreaterEqual");
|
||||
break;
|
||||
}
|
||||
Op->Common.DisasmOpcode = 0;
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
|
||||
/* The op and arguments */
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
#if 0
|
||||
case AML_ZERO_OP:
|
||||
case AML_LNOT_OP:
|
||||
|
||||
AcpiOsPrintf ("Zero");
|
||||
Child = Op->Common.Value.Arg;
|
||||
if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
|
||||
(Child->Common.AmlOpcode == AML_LGREATER_OP) ||
|
||||
(Child->Common.AmlOpcode == AML_LLESS_OP))
|
||||
{
|
||||
Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
|
||||
Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("%s", OpInfo->Name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_ONE_OP:
|
||||
|
||||
AcpiOsPrintf ("One");
|
||||
break;
|
||||
|
||||
|
||||
case AML_ONES_OP:
|
||||
|
||||
AcpiOsPrintf ("Ones");
|
||||
break;
|
||||
|
||||
|
||||
case AML_REVISION_OP:
|
||||
|
||||
AcpiOsPrintf ("Revision");
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
case AML_BYTE_OP:
|
||||
|
||||
AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
|
||||
@ -545,7 +558,7 @@ AcpiDmDisassembleOneOp (
|
||||
|
||||
if (Info->BitOffset % 8 == 0)
|
||||
{
|
||||
AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
|
||||
AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -558,7 +571,7 @@ AcpiDmDisassembleOneOp (
|
||||
|
||||
case AML_INT_ACCESSFIELD_OP:
|
||||
|
||||
AcpiOsPrintf ("AccessAs (%s, ",
|
||||
AcpiOsPrintf (" AccessAs (%s, ",
|
||||
AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
|
||||
|
||||
AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
|
||||
@ -575,7 +588,6 @@ AcpiDmDisassembleOneOp (
|
||||
|
||||
case AML_INT_METHODCALL_OP:
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
Op = AcpiPsGetDepthNext (NULL, Op);
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
@ -587,7 +599,6 @@ AcpiDmDisassembleOneOp (
|
||||
|
||||
/* Just get the opcode name and print it */
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
AcpiOsPrintf ("%s", OpInfo->Name);
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
|
||||
* $Revision: 1.34 $
|
||||
* $Revision: 1.35 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -129,19 +129,19 @@
|
||||
|
||||
static char *AcpiDmAddressNames[] =
|
||||
{
|
||||
"Address Space Granularity",
|
||||
"Address Range Minimum",
|
||||
"Address Range Maximum",
|
||||
"Address Translation Offset",
|
||||
"Address Length"
|
||||
"Granularity",
|
||||
"Range Minimum",
|
||||
"Range Maximum",
|
||||
"Translation Offset",
|
||||
"Length"
|
||||
};
|
||||
|
||||
static char *AcpiDmMemoryNames[] =
|
||||
{
|
||||
"Address Range Minimum",
|
||||
"Address Range Maximum",
|
||||
"Address Alignment",
|
||||
"Address Length"
|
||||
"Range Minimum",
|
||||
"Range Maximum",
|
||||
"Alignment",
|
||||
"Length"
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmutils - AML disassembler utilities
|
||||
* $Revision: 1.23 $
|
||||
* $Revision: 1.24 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -219,10 +219,14 @@ const char *AcpiGbl_IrqDecode[] =
|
||||
|
||||
void
|
||||
AcpiDmAddToExternalList (
|
||||
char *Path)
|
||||
char *Path,
|
||||
UINT8 Type,
|
||||
UINT32 Value)
|
||||
{
|
||||
char *ExternalPath;
|
||||
ACPI_EXTERNAL_LIST *NewExternal;
|
||||
ACPI_EXTERNAL_LIST *NextExternal;
|
||||
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
@ -235,24 +239,84 @@ AcpiDmAddToExternalList (
|
||||
|
||||
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
|
||||
NULL, &ExternalPath);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Allocate and init a new External() descriptor */
|
||||
return;
|
||||
}
|
||||
|
||||
NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
|
||||
NewExternal->Path = ExternalPath;
|
||||
/* Ensure that we don't have duplicate externals */
|
||||
|
||||
/* Link the new descriptor into the global list */
|
||||
NextExternal = AcpiGbl_ExternalList;
|
||||
while (NextExternal)
|
||||
{
|
||||
/* Allow upgrade of type from ANY */
|
||||
|
||||
if (AcpiGbl_ExternalList)
|
||||
if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
|
||||
{
|
||||
NewExternal->Next = AcpiGbl_ExternalList;
|
||||
/* Duplicate method, check that the Value (ArgCount) is the same */
|
||||
|
||||
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
|
||||
(NextExternal->Value != Value))
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO, "Argument count mismatch for method %s %d %d",
|
||||
NextExternal->Path, NextExternal->Value, Value));
|
||||
}
|
||||
if (NextExternal->Type == ACPI_TYPE_ANY)
|
||||
{
|
||||
NextExternal->Type = Type;
|
||||
NextExternal->Value = Value;
|
||||
}
|
||||
ACPI_FREE (ExternalPath);
|
||||
return;
|
||||
}
|
||||
NextExternal = NextExternal->Next;
|
||||
}
|
||||
|
||||
/* Allocate and init a new External() descriptor */
|
||||
|
||||
NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
|
||||
NewExternal->InternalPath = Path;
|
||||
NewExternal->Path = ExternalPath;
|
||||
NewExternal->Type = Type;
|
||||
NewExternal->Value = Value;
|
||||
NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
|
||||
|
||||
/* Link the new descriptor into the global list, ordered by string length */
|
||||
|
||||
NextExternal = AcpiGbl_ExternalList;
|
||||
while (NextExternal)
|
||||
{
|
||||
if (NewExternal->Length <= NextExternal->Length)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDecodeAttribute
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmwalk - AML disassembly tree walk
|
||||
* $Revision: 1.30 $
|
||||
* $Revision: 1.31 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -181,6 +181,7 @@ AcpiDmDisassemble (
|
||||
|
||||
Info.Flags = 0;
|
||||
Info.Level = 0;
|
||||
Info.Count = 0;
|
||||
Info.WalkState = WalkState;
|
||||
AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
|
||||
return;
|
||||
@ -223,10 +224,13 @@ AcpiDmWalkParseTree (
|
||||
{
|
||||
if (NodePreviouslyVisited)
|
||||
{
|
||||
Status = AscendingCallback (Op, Info->Level, Context);
|
||||
if (ACPI_FAILURE (Status))
|
||||
if (AscendingCallback)
|
||||
{
|
||||
return;
|
||||
Status = AscendingCallback (Op, Info->Level, Context);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -489,18 +493,44 @@ AcpiDmDescendingOp (
|
||||
|
||||
if (AcpiGbl_ExternalList)
|
||||
{
|
||||
AcpiOsPrintf (
|
||||
" /*\n * These objects were referenced but not defined in this table\n */\n");
|
||||
|
||||
/*
|
||||
* Walk the list of externals (unresolved references)
|
||||
* found during parsing
|
||||
*/
|
||||
while (AcpiGbl_ExternalList)
|
||||
{
|
||||
AcpiOsPrintf (" External (%s, DeviceObj)\n",
|
||||
AcpiOsPrintf (" External (%s",
|
||||
AcpiGbl_ExternalList->Path);
|
||||
|
||||
/* TBD: should be a lookup table */
|
||||
|
||||
switch (AcpiGbl_ExternalList->Type)
|
||||
{
|
||||
case ACPI_TYPE_DEVICE:
|
||||
AcpiOsPrintf (", DeviceObj");
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
AcpiOsPrintf (", MethodObj");
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
AcpiOsPrintf (", IntObj");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
|
||||
{
|
||||
AcpiOsPrintf (") // %d Arguments\n", AcpiGbl_ExternalList->Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf (")\n");
|
||||
}
|
||||
|
||||
NextExternal = AcpiGbl_ExternalList->Next;
|
||||
ACPI_FREE (AcpiGbl_ExternalList->Path);
|
||||
ACPI_FREE (AcpiGbl_ExternalList);
|
||||
@ -521,12 +551,33 @@ AcpiDmDescendingOp (
|
||||
* indent a new line
|
||||
*/
|
||||
AcpiDmIndent (Level);
|
||||
Info->LastLevel = Level;
|
||||
Info->Count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an inexpensive mechanism to try and keep lines from getting
|
||||
* too long. When the limit is hit, start a new line at the previous
|
||||
* indent plus one. A better but more expensive mechanism would be to
|
||||
* keep track of the current column.
|
||||
*/
|
||||
Info->Count++;
|
||||
if (Info->Count /*+Info->LastLevel*/ > 10)
|
||||
{
|
||||
Info->Count = 0;
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Info->LastLevel + 1);
|
||||
}
|
||||
|
||||
/* Print the opcode name */
|
||||
|
||||
AcpiDmDisassembleOneOp (NULL, Info, Op);
|
||||
|
||||
if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_RETURN_OP))
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswload - Dispatcher namespace load callbacks
|
||||
* $Revision: 1.107 $
|
||||
* $Revision: 1.108 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -263,10 +263,10 @@ AcpiDsLoad1BeginOp (
|
||||
* Target of Scope() not found. Generate an External for it, and
|
||||
* insert the name into the namespace.
|
||||
*/
|
||||
AcpiDmAddToExternalList (Path);
|
||||
AcpiDmAddToExternalList (Path, ACPI_TYPE_DEVICE, 0);
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
|
||||
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
|
||||
WalkState, &(Node));
|
||||
WalkState, &Node);
|
||||
}
|
||||
#endif
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -387,16 +387,46 @@ AcpiDsLoad1BeginOp (
|
||||
* parse tree later.
|
||||
*/
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
|
||||
ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
|
||||
ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_ERROR_NAMESPACE (Path, Status);
|
||||
return_ACPI_STATUS (Status);
|
||||
if (Status == AE_ALREADY_EXISTS)
|
||||
{
|
||||
/* The name already exists in this scope */
|
||||
|
||||
if (Node->Flags & ANOBJ_IS_EXTERNAL)
|
||||
{
|
||||
/*
|
||||
* Allow one create on an object or segment that was
|
||||
* previously declared External
|
||||
*/
|
||||
Node->Flags &= ~ANOBJ_IS_EXTERNAL;
|
||||
Node->Type = (UINT8) ObjectType;
|
||||
|
||||
/* Just retyped a node, probably will need to open a scope */
|
||||
|
||||
if (AcpiNsOpensScope (ObjectType))
|
||||
{
|
||||
Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
Status = AE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
|
||||
ACPI_ERROR_NAMESPACE (Path, Status);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Common exit */
|
||||
|
||||
if (!Op)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
|
||||
* $Revision: 1.198 $
|
||||
* $Revision: 1.199 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -396,8 +396,7 @@ AcpiNsLookup (
|
||||
ACPI_OBJECT_TYPE TypeToCheckFor;
|
||||
ACPI_OBJECT_TYPE ThisSearchType;
|
||||
UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
|
||||
UINT32 LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND |
|
||||
ACPI_NS_SEARCH_PARENT);
|
||||
UINT32 LocalFlags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (NsLookup);
|
||||
@ -408,8 +407,9 @@ AcpiNsLookup (
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
AcpiGbl_NsLookupCount++;
|
||||
LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
|
||||
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
|
||||
AcpiGbl_NsLookupCount++;
|
||||
|
||||
if (!AcpiGbl_RootNode)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: nssearch - Namespace search
|
||||
* $Revision: 1.116 $
|
||||
* $Revision: 1.117 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -389,7 +389,7 @@ AcpiNsSearchAndEnter (
|
||||
if (!Node || !TargetName || !ReturnNode)
|
||||
{
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Null param: Node %p Name %X ReturnNode %p",
|
||||
"Null parameter: Node %p Name %X ReturnNode %p",
|
||||
Node, TargetName, ReturnNode));
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
@ -485,6 +485,13 @@ AcpiNsSearchAndEnter (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
#ifdef ACPI_ASL_COMPILER
|
||||
if (Flags & ACPI_NS_EXTERNAL)
|
||||
{
|
||||
NewNode->Flags |= ANOBJ_IS_EXTERNAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Install the new object into the parent's list of children */
|
||||
|
||||
AcpiNsInstallNode (WalkState, Node, NewNode, Type);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: utglobal - Global variables for the ACPI subsystem
|
||||
* $Revision: 1.238 $
|
||||
* $Revision: 1.239 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -472,7 +472,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
|
||||
|
||||
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
|
||||
{
|
||||
/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
|
||||
"SystemMemory",
|
||||
"SystemIO",
|
||||
"PCI_Config",
|
||||
@ -481,7 +480,6 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
|
||||
"CMOS",
|
||||
"PCIBARTarget",
|
||||
"DataTable"
|
||||
/*! [End] no source code translation !*/
|
||||
};
|
||||
|
||||
|
||||
@ -519,13 +517,11 @@ AcpiUtGetRegionName (
|
||||
|
||||
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
|
||||
{
|
||||
/*! [Begin] no source code translation (keep these strings as-is) */
|
||||
"PM_Timer",
|
||||
"GlobalLock",
|
||||
"PowerButton",
|
||||
"SleepButton",
|
||||
"RealTimeClock",
|
||||
/*! [End] no source code translation !*/
|
||||
};
|
||||
|
||||
|
||||
@ -569,7 +565,6 @@ static const char AcpiGbl_BadType[] = "UNDEFINED";
|
||||
|
||||
static const char *AcpiGbl_NsTypeNames[] =
|
||||
{
|
||||
/*! [Begin] no source code translation (keep these strings as-is) */
|
||||
/* 00 */ "Untyped",
|
||||
/* 01 */ "Integer",
|
||||
/* 02 */ "String",
|
||||
@ -601,7 +596,6 @@ static const char *AcpiGbl_NsTypeNames[] =
|
||||
/* 28 */ "Extra",
|
||||
/* 29 */ "Data",
|
||||
/* 30 */ "Invalid"
|
||||
/*! [End] no source code translation !*/
|
||||
};
|
||||
|
||||
|
||||
@ -703,7 +697,6 @@ AcpiUtGetNodeName (
|
||||
|
||||
static const char *AcpiGbl_DescTypeNames[] =
|
||||
{
|
||||
/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
|
||||
/* 00 */ "Invalid",
|
||||
/* 01 */ "Cached",
|
||||
/* 02 */ "State-Generic",
|
||||
@ -720,7 +713,6 @@ static const char *AcpiGbl_DescTypeNames[] =
|
||||
/* 13 */ "Parser",
|
||||
/* 14 */ "Operand",
|
||||
/* 15 */ "Node"
|
||||
/*! [End] no source code translation !*/
|
||||
};
|
||||
|
||||
|
||||
|
@ -121,6 +121,9 @@
|
||||
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
#define FILE_SUFFIX_DISASSEMBLY "dsl"
|
||||
#define ACPI_TABLE_FILE_SUFFIX ".dat"
|
||||
|
||||
extern UINT8 *DsdtPtr;
|
||||
extern UINT32 AcpiDsdtLength;
|
||||
extern UINT8 *AmlStart;
|
||||
@ -136,21 +139,9 @@ AcpiGetopt(
|
||||
char **argv,
|
||||
char *opts);
|
||||
|
||||
ACPI_STATUS
|
||||
AdInitialize (
|
||||
void);
|
||||
|
||||
char *
|
||||
FlGenerateFilename (
|
||||
char *InputFilename,
|
||||
char *Suffix);
|
||||
|
||||
ACPI_STATUS
|
||||
FlSplitInputPathname (
|
||||
char *InputPath,
|
||||
char **OutDirectoryPath,
|
||||
char **OutFilename);
|
||||
|
||||
/*
|
||||
* adisasm
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AdAmlDisassemble (
|
||||
BOOLEAN OutToFile,
|
||||
@ -187,6 +178,61 @@ AdDisplayTables (
|
||||
ACPI_STATUS
|
||||
AdDisplayStatistics (void);
|
||||
|
||||
/*
|
||||
* adwalk
|
||||
*/
|
||||
void
|
||||
AcpiDmCrossReferenceNamespace (
|
||||
ACPI_PARSE_OBJECT *ParseTreeRoot,
|
||||
ACPI_NAMESPACE_NODE *NamespaceRoot);
|
||||
|
||||
void
|
||||
AcpiDmDumpTree (
|
||||
ACPI_PARSE_OBJECT *Origin);
|
||||
|
||||
void
|
||||
AcpiDmFindOrphanMethods (
|
||||
ACPI_PARSE_OBJECT *Origin);
|
||||
|
||||
void
|
||||
AcpiDmFinishNamespaceLoad (
|
||||
ACPI_PARSE_OBJECT *ParseTreeRoot,
|
||||
ACPI_NAMESPACE_NODE *NamespaceRoot);
|
||||
|
||||
/*
|
||||
* adfile
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AdInitialize (
|
||||
void);
|
||||
|
||||
char *
|
||||
FlGenerateFilename (
|
||||
char *InputFilename,
|
||||
char *Suffix);
|
||||
|
||||
ACPI_STATUS
|
||||
FlSplitInputPathname (
|
||||
char *InputPath,
|
||||
char **OutDirectoryPath,
|
||||
char **OutFilename);
|
||||
|
||||
char *
|
||||
FlGenerateFilename (
|
||||
char *InputFilename,
|
||||
char *Suffix);
|
||||
|
||||
char *
|
||||
AdGenerateFilename (
|
||||
char *Prefix,
|
||||
char *TableId);
|
||||
|
||||
void
|
||||
AdWriteTable (
|
||||
ACPI_TABLE_HEADER *Table,
|
||||
UINT32 Length,
|
||||
char *TableName,
|
||||
char *OemTableId);
|
||||
|
||||
#endif /* _ACAPPS */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acdisasm.h - AML disassembler
|
||||
* $Revision: 1.34 $
|
||||
* $Revision: 1.35 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -129,7 +129,11 @@
|
||||
typedef struct acpi_external_list
|
||||
{
|
||||
char *Path;
|
||||
char *InternalPath;
|
||||
struct acpi_external_list *Next;
|
||||
UINT32 Value;
|
||||
UINT16 Length;
|
||||
UINT8 Type;
|
||||
|
||||
} ACPI_EXTERNAL_LIST;
|
||||
|
||||
@ -190,6 +194,8 @@ typedef struct acpi_dmtable_data
|
||||
typedef struct acpi_op_walk_info
|
||||
{
|
||||
UINT32 Level;
|
||||
UINT32 LastLevel;
|
||||
UINT32 Count;
|
||||
UINT32 BitOffset;
|
||||
UINT32 Flags;
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
@ -641,7 +647,9 @@ AcpiDmVendorSmallDescriptor (
|
||||
*/
|
||||
void
|
||||
AcpiDmAddToExternalList (
|
||||
char *Path);
|
||||
char *Path,
|
||||
UINT8 Type,
|
||||
UINT32 Value);
|
||||
|
||||
/*
|
||||
* dmrestag
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acglobal.h - Declarations for global variables
|
||||
* $Revision: 1.179 $
|
||||
* $Revision: 1.180 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -372,15 +372,6 @@ ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList;
|
||||
ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Parser globals
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Hardware globals
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: aclocal.h - Internal data types used across the ACPI subsystem
|
||||
* $Revision: 1.229 $
|
||||
* $Revision: 1.230 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -301,6 +301,7 @@ typedef struct acpi_namespace_node
|
||||
#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
|
||||
#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
|
||||
|
||||
#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
|
||||
#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
|
||||
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
|
||||
#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
|
||||
@ -787,6 +788,9 @@ typedef union acpi_parse_value
|
||||
#define ACPI_DASM_UNICODE 0x03
|
||||
#define ACPI_DASM_EISAID 0x04
|
||||
#define ACPI_DASM_MATCHOP 0x05
|
||||
#define ACPI_DASM_LNOT_PREFIX 0x06
|
||||
#define ACPI_DASM_LNOT_SUFFIX 0x07
|
||||
#define ACPI_DASM_IGNORE 0x08
|
||||
|
||||
/*
|
||||
* Generic operation (for example: If, While, Store)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
|
||||
* $Revision: 1.145 $
|
||||
* $Revision: 1.146 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -138,6 +138,7 @@
|
||||
#define ACPI_NS_NO_PEER_SEARCH 0x04
|
||||
#define ACPI_NS_ERROR_IF_FOUND 0x08
|
||||
#define ACPI_NS_PREFIX_IS_SCOPE 0x10
|
||||
#define ACPI_NS_EXTERNAL 0x20
|
||||
|
||||
#define ACPI_NS_WALK_UNLOCK TRUE
|
||||
#define ACPI_NS_WALK_NO_UNLOCK FALSE
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
|
||||
* Declarations and definitions contained herein are derived
|
||||
* directly from the ACPI specification.
|
||||
* $Revision: 1.83 $
|
||||
* $Revision: 1.84 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -254,8 +254,10 @@
|
||||
#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */
|
||||
|
||||
|
||||
/* Bogus opcodes (they are actually two separate opcodes) */
|
||||
|
||||
/*
|
||||
* Combination opcodes (actually two one-byte opcodes)
|
||||
* Used by the disassembler and iASL compiler
|
||||
*/
|
||||
#define AML_LGREATEREQUAL_OP (UINT16) 0x9295
|
||||
#define AML_LLESSEQUAL_OP (UINT16) 0x9294
|
||||
#define AML_LNOTEQUAL_OP (UINT16) 0x9293
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amlresrc.h - AML resource descriptors
|
||||
* $Revision: 1.38 $
|
||||
* $Revision: 1.39 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -121,8 +121,6 @@
|
||||
#define __AMLRESRC_H
|
||||
|
||||
|
||||
/*! [Begin] no source code translation */
|
||||
|
||||
/*
|
||||
* Resource descriptor tags, as defined in the ACPI specification.
|
||||
* Used to symbolically reference fields within a descriptor.
|
||||
@ -157,7 +155,6 @@
|
||||
#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
|
||||
#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
|
||||
#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
|
||||
/*! [End] no source code translation !*/
|
||||
|
||||
|
||||
/* Default sizes for "small" resource descriptors */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aeexec - Support routines for AcpiExec utility
|
||||
* $Revision: 1.105 $
|
||||
* $Revision: 1.106 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -120,7 +120,6 @@
|
||||
ACPI_MODULE_NAME ("aeexec")
|
||||
|
||||
|
||||
ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
|
||||
ACPI_PARSE_OBJECT *root;
|
||||
UINT8 *AmlStart;
|
||||
UINT32 AmlLength;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: ascase - Source conversion - lower/upper case utilities
|
||||
* $Revision: 1.18 $
|
||||
* $Revision: 1.19 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -247,6 +247,20 @@ AsMixedCaseToUnderscores (
|
||||
{
|
||||
SubBuffer++;
|
||||
}
|
||||
TokenStart = NULL;
|
||||
HasLowerCase = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Ignore commas */
|
||||
|
||||
if ((*SubBuffer == ',') ||
|
||||
(*SubBuffer == '>') ||
|
||||
(*SubBuffer == ')'))
|
||||
{
|
||||
SubBuffer++;
|
||||
TokenStart = NULL;
|
||||
HasLowerCase = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -311,20 +325,22 @@ AsMixedCaseToUnderscores (
|
||||
}
|
||||
}
|
||||
|
||||
// OBSOLETE CODE, all quoted strings now completely ignored.
|
||||
#if 0
|
||||
/* Ignore format specification fields */
|
||||
|
||||
if (SubBuffer[0] == '%')
|
||||
{
|
||||
SubBuffer++;
|
||||
|
||||
while ((isalnum (*SubBuffer)) ||
|
||||
(*SubBuffer == '.'))
|
||||
while ((isalnum (*SubBuffer)) || (*SubBuffer == '.'))
|
||||
{
|
||||
SubBuffer++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore standard escape sequences (\n, \r, etc.) Not Hex or Octal escapes */
|
||||
|
||||
@ -340,16 +356,30 @@ AsMixedCaseToUnderscores (
|
||||
* Note: there are some cases where identifiers have underscores
|
||||
* AcpiGbl_* for example. HasLowerCase flag handles these.
|
||||
*/
|
||||
if ((*SubBuffer == '_') && (!HasLowerCase))
|
||||
if ((*SubBuffer == '_') && (!HasLowerCase) && (TokenStart))
|
||||
{
|
||||
while ((isalnum (*SubBuffer)) || (*SubBuffer == '_'))
|
||||
/* Check the rest of the identifier for any lower case letters */
|
||||
|
||||
SubString = SubBuffer;
|
||||
while ((isalnum (*SubString)) || (*SubString == '_'))
|
||||
{
|
||||
SubBuffer++;
|
||||
if (islower (*SubString))
|
||||
{
|
||||
HasLowerCase = TRUE;
|
||||
}
|
||||
SubString++;
|
||||
}
|
||||
|
||||
/* If no lower case letters, we can safely ignore the entire token */
|
||||
|
||||
if (!HasLowerCase)
|
||||
{
|
||||
SubBuffer = SubString;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A capital letter may indicate the start of a token; save it */
|
||||
/* A capital letter may indicate the start of a token; save it */
|
||||
|
||||
if (isupper (SubBuffer[0]))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user