aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-11-14 22:20:16 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-11-14 22:20:16 +0000
commitc2463a8709e5b3a5ce54c09d35b4820a756b0fc5 (patch)
tree2ffc551e57f0545a17c165d729c1438a26236f60
parent31aa864e8c068201d58aad3a8f82ddb51df11015 (diff)
downloadsrc-c2463a8709e5b3a5ce54c09d35b4820a756b0fc5.tar.gz
src-c2463a8709e5b3a5ce54c09d35b4820a756b0fc5.zip
Import ACPICA 20121114.vendor/acpica/20121114
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=243044 svn path=/vendor-sys/acpica/20121114/; revision=243045; tag=vendor/acpica/20121114
-rw-r--r--changes.txt90
-rw-r--r--generate/unix/acpibin/Makefile2
-rw-r--r--generate/unix/acpiexec/Makefile1
-rw-r--r--generate/unix/iasl/Makefile7
-rw-r--r--source/common/adfile.c17
-rw-r--r--source/common/adisasm.c216
-rw-r--r--source/common/dmextern.c41
-rw-r--r--source/common/dmrestag.c6
-rw-r--r--source/compiler/aslcompile.c15
-rw-r--r--source/compiler/aslcompiler.h4
-rw-r--r--source/compiler/aslerror.c16
-rw-r--r--source/compiler/aslfiles.c26
-rw-r--r--source/compiler/aslglobal.h1
-rw-r--r--source/compiler/asllisting.c45
-rw-r--r--source/compiler/asllookup.c11
-rw-r--r--source/compiler/aslmain.c8
-rw-r--r--source/compiler/aslstartup.c7
-rw-r--r--source/compiler/dttemplate.c27
-rw-r--r--source/compiler/prutils.c15
-rw-r--r--source/compiler/readme.txt21
-rw-r--r--source/components/debugger/dbfileio.c26
-rw-r--r--source/components/debugger/dbinput.c3
-rw-r--r--source/components/debugger/dbmethod.c39
-rw-r--r--source/components/disassembler/dmdeferred.c272
-rw-r--r--source/components/disassembler/dmopcode.c2
-rw-r--r--source/components/disassembler/dmresrc.c14
-rw-r--r--source/components/disassembler/dmresrcl.c54
-rw-r--r--source/components/disassembler/dmresrcl2.c44
-rw-r--r--source/components/disassembler/dmresrcs.c20
-rw-r--r--source/components/dispatcher/dsmethod.c3
-rw-r--r--source/components/executer/exregion.c8
-rw-r--r--source/components/namespace/nsutils.c8
-rw-r--r--source/components/namespace/nsxfname.c2
-rw-r--r--source/components/resources/rscalc.c2
-rw-r--r--source/components/resources/rscreate.c4
-rw-r--r--source/components/resources/rsdump.c6
-rw-r--r--source/components/resources/rslist.c2
-rw-r--r--source/components/resources/rsmisc.c62
-rw-r--r--source/components/resources/rsxface.c2
-rw-r--r--source/components/utilities/utdelete.c66
-rw-r--r--source/components/utilities/utresrc.c70
-rw-r--r--source/components/utilities/utstate.c40
-rw-r--r--source/components/utilities/uttrack.c16
-rw-r--r--source/include/acdisasm.h10
-rw-r--r--source/include/acmacros.h34
-rw-r--r--source/include/acpixf.h2
-rw-r--r--source/include/acrestyp.h5
-rw-r--r--source/include/acutils.h2
-rw-r--r--source/tools/acpibin/abcompare.c100
-rw-r--r--source/tools/acpibin/abmain.c4
-rw-r--r--source/tools/acpibin/acpibin.h15
-rw-r--r--source/tools/acpisrc/acpisrc.h30
-rw-r--r--source/tools/acpisrc/asfile.c58
-rw-r--r--source/tools/acpixtract/acpixtract.c10
54 files changed, 999 insertions, 612 deletions
diff --git a/changes.txt b/changes.txt
index 1aa5c8a89dbe..637478867b0f 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,94 @@
----------------------------------------
+14 November 2012. Summary of changes for version 20121114:
+
+This release is available at https://www.acpica.org/downloads
+The ACPI 5.0 specification is available at www.acpi.info
+
+1) ACPICA Kernel-resident Subsystem:
+
+Implemented a performance enhancement for ACPI/AML Package objects. This
+change greatly increases the performance of Package objects within the
+interpreter. It changes the processing of reference counts for packages by
+optimizing for the most common case where the package sub-objects are
+either Integers, Strings, or Buffers. Increases the overall performance of
+the ASLTS test suite by 1.5X (Increases the Slack Mode performance by 2X.)
+Chao Guan. ACPICA BZ 943.
+
+Implemented and deployed common macros to extract flag bits from resource
+descriptors. Improves readability and maintainability of the code. Fixes a
+problem with the UART serial bus descriptor for the number of data bits
+flags (was incorrectly 2 bits, should be 3).
+
+Enhanced the ACPI_GETx and ACPI_SETx macros. Improved the implementation
+of the macros and changed the SETx macros to the style of (destination,
+source). Also added ACPI_CASTx companion macros. Lv Zheng.
+
+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.
+
+ Previous Release:
+ Non-Debug Version: 93.9K Code, 25.2K Data, 119.1K Total
+ Debug Version: 175.5K Code, 74.5K Data, 250.0K Total
+ Current Release:
+ Non-Debug Version: 94.3K Code, 25.3K Data, 119.6K Total
+ Debug Version: 175.5K Code, 74.5K Data, 250.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Added the new ACPI 5.0 interrupt sharing flags. This change
+adds the ShareAndWake and ExclusiveAndWake flags which were added to the
+Irq, Interrupt, and Gpio resource descriptors in ACPI 5.0. ACPICA BZ 986.
+
+Disassembler: Fixed a problem with external declaration generation. Fixes
+a problem where an incorrect pathname could be generated for an external
+declaration if the original reference to the object includes leading
+carats (^). ACPICA BZ 984.
+
+Debugger: Completed a major update for the Disassemble<method> command.
+This command was out-of-date and did not properly disassemble control
+methods that had any reasonable complexity. This fix brings the command up
+to the same level as the rest of the disassembler. Adds one new file,
+dmdeferred.c, which is existing code that is now common with the main
+disassembler and the debugger disassemble command. ACPICA MZ 978.
+
+iASL: Moved the parser entry prototype to avoid a duplicate declaration.
+Newer versions of Bison emit this prototype, so moved the prototype out of
+the iASL header to where it is actually used in order to avoid a duplicate
+declaration.
+
+iASL/Tools: Standardized use of the stream I/O functions:
+ 1) Ensure check for I/O error after every fopen/fread/fwrite
+ 2) Ensure proper order of size/count arguments for fread/fwrite
+ 3) Use test of (Actual != Requested) after all fwrite, and most fread
+ 4) Standardize I/O error messages
+Improves reliability and maintainability of the code. Bob Moore, Lv Zheng.
+ACPICA BZ 981.
+
+Disassembler: Prevent duplicate External() statements. During generation
+of external statements, detect similar pathnames that are actually
+duplicates such as these:
+ External (\ABCD)
+ External (ABCD)
+Remove all leading '\' characters from pathnames during the external
+statement generation so that duplicates will be detected and tossed.
+ACPICA BZ 985.
+
+Tools: Replace low-level I/O with stream I/O functions. Replace
+open/read/write/close with the stream I/O equivalents
+fopen/fread/fwrite/fclose for portability and performance. Lv Zheng, Bob
+Moore.
+
+AcpiBin: Fix for the dump-to-hex function. Now correctly output the table
+name header so that AcpiXtract recognizes the output file/table.
+
+iASL: Remove obsolete -2 option flag. Originally intended to force the
+compiler/disassembler into an ACPI 2.0 mode, this was never implemented
+and the entire concept is now obsolete.
+
+----------------------------------------
18 October 2012. Summary of changes for version 20121018:
diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile
index 0ec293a64053..775eb235568d 100644
--- a/generate/unix/acpibin/Makefile
+++ b/generate/unix/acpibin/Makefile
@@ -27,7 +27,7 @@ HEADERS = \
$(wildcard $(ACPIBIN)/*.h)
OBJECTS = \
- $(OBJDIR)/abcompare.o \
+ $(OBJDIR)/abcompare.o \
$(OBJDIR)/abmain.o \
$(OBJDIR)/utalloc.o \
$(OBJDIR)/utcache.o \
diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile
index 17ab8ad71b5f..6bcc609ebb52 100644
--- a/generate/unix/acpiexec/Makefile
+++ b/generate/unix/acpiexec/Makefile
@@ -55,6 +55,7 @@ OBJECTS = \
$(OBJDIR)/dbutils.o \
$(OBJDIR)/dbxface.o \
$(OBJDIR)/dmbuffer.o \
+ $(OBJDIR)/dmdeferred.o \
$(OBJDIR)/dmnames.o \
$(OBJDIR)/dmobject.o \
$(OBJDIR)/dmopcode.o \
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
index fe7f98c00c37..551f4b7b87af 100644
--- a/generate/unix/iasl/Makefile
+++ b/generate/unix/iasl/Makefile
@@ -90,6 +90,7 @@ OBJECTS = \
$(OBJDIR)/dtutils.o \
$(OBJDIR)/dbfileio.o \
$(OBJDIR)/dmbuffer.o \
+ $(OBJDIR)/dmdeferred.o \
$(OBJDIR)/dmextern.o \
$(OBJDIR)/dmnames.o \
$(OBJDIR)/dmobject.o \
@@ -192,13 +193,13 @@ INTERMEDIATES = \
$(OBJDIR)/prparserparse.c
MISC = \
- $(OBJDIR)/aslcompilerparse.h \
+ $(OBJDIR)/aslcompilerparse.h \
$(OBJDIR)/aslcompiler.y.h \
$(OBJDIR)/aslcompilerparse.output \
- $(OBJDIR)/dtparserparse.h \
+ $(OBJDIR)/dtparserparse.h \
$(OBJDIR)/dtparser.y.h \
$(OBJDIR)/dtparserparse.output \
- $(OBJDIR)/prparserparse.h \
+ $(OBJDIR)/prparserparse.h \
$(OBJDIR)/prparser.y.h \
$(OBJDIR)/prparserparse.output
diff --git a/source/common/adfile.c b/source/common/adfile.c
index 2c864d4bc096..660b45bdf19d 100644
--- a/source/common/adfile.c
+++ b/source/common/adfile.c
@@ -124,19 +124,24 @@ AdWriteBuffer (
char *Buffer,
UINT32 Length)
{
- FILE *fp;
+ FILE *File;
ACPI_SIZE Actual;
- fp = fopen (Filename, "wb");
- if (!fp)
+ File = fopen (Filename, "wb");
+ if (!File)
{
- printf ("Couldn't open %s\n", Filename);
+ printf ("Could not open file %s\n", Filename);
return (-1);
}
- Actual = fwrite (Buffer, (size_t) Length, 1, fp);
- fclose (fp);
+ Actual = fwrite (Buffer, 1, (size_t) Length, File);
+ if (Actual != Length)
+ {
+ printf ("Could not write to file %s\n", Filename);
+ }
+
+ fclose (File);
return ((INT32) Actual);
}
diff --git a/source/common/adisasm.c b/source/common/adisasm.c
index 9ba89164c534..03bed076da60 100644
--- a/source/common/adisasm.c
+++ b/source/common/adisasm.c
@@ -88,17 +88,6 @@ AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table);
-static ACPI_STATUS
-AdDeferredParse (
- ACPI_PARSE_OBJECT *Op,
- UINT8 *Aml,
- UINT32 AmlLength);
-
-static ACPI_STATUS
-AdParseDeferredOps (
- ACPI_PARSE_OBJECT *Root);
-
-
/* Stubs for ASL compiler */
#ifndef ACPI_ASL_COMPILER
@@ -753,207 +742,6 @@ AdDisplayTables (
/******************************************************************************
*
- * FUNCTION: AdDeferredParse
- *
- * PARAMETERS: Op - Root Op of the deferred opcode
- * Aml - Pointer to the raw AML
- * AmlLength - Length of the AML
- *
- * RETURN: Status
- *
- * DESCRIPTION: Parse one deferred opcode
- * (Methods, operation regions, etc.)
- *
- *****************************************************************************/
-
-static ACPI_STATUS
-AdDeferredParse (
- ACPI_PARSE_OBJECT *Op,
- UINT8 *Aml,
- UINT32 AmlLength)
-{
- ACPI_WALK_STATE *WalkState;
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *SearchOp;
- ACPI_PARSE_OBJECT *StartOp;
- UINT32 BaseAmlOffset;
- ACPI_PARSE_OBJECT *ExtraOp;
-
-
- ACPI_FUNCTION_TRACE (AdDeferredParse);
-
-
- fprintf (stderr, ".");
-
- if (!Aml || !AmlLength)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n",
- Op->Common.AmlOpName, (char *) &Op->Named.Name));
-
- WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
- if (!WalkState)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
- AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Parse the method */
-
- WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
- WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
- Status = AcpiPsParseAml (WalkState);
-
- /*
- * We need to update all of the Aml offsets, since the parser thought
- * that the method began at offset zero. In reality, it began somewhere
- * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
- * was just created and update the AmlOffset in each Op
- */
- BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
- StartOp = (Op->Common.Value.Arg)->Common.Next;
- SearchOp = StartOp;
-
- /* Walk the parse tree */
-
- while (SearchOp)
- {
- SearchOp->Common.AmlOffset += BaseAmlOffset;
- SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
- }
-
- /*
- * Link the newly parsed subtree into the main parse tree
- */
- switch (Op->Common.AmlOpcode)
- {
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_PACKAGE_OP:
- ExtraOp = Op->Common.Value.Arg;
- ExtraOp = ExtraOp->Common.Next;
- Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
- break;
-
- case AML_VAR_PACKAGE_OP:
- case AML_BUFFER_OP:
- default:
- ExtraOp = Op->Common.Value.Arg;
- Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
- break;
- }
-
- /* Must point all parents to the main tree */
-
- StartOp = Op;
- SearchOp = StartOp;
- while (SearchOp)
- {
- if (SearchOp->Common.Parent == ExtraOp)
- {
- SearchOp->Common.Parent = Op;
- }
- SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
- }
- break;
-
- default:
- break;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AdParseDeferredOps
- *
- * PARAMETERS: Root - Root of the parse tree
- *
- * RETURN: Status
- *
- * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.)
- *
- *****************************************************************************/
-
-static ACPI_STATUS
-AdParseDeferredOps (
- ACPI_PARSE_OBJECT *Root)
-{
- ACPI_PARSE_OBJECT *Op = Root;
- ACPI_STATUS Status = AE_OK;
- const ACPI_OPCODE_INFO *OpInfo;
-
-
- ACPI_FUNCTION_NAME (AdParseDeferredOps);
- fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
-
- while (Op)
- {
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- if (!(OpInfo->Flags & AML_DEFER))
- {
- Op = AcpiPsGetDepthNext (Root, Op);
- continue;
- }
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_METHOD_OP:
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- break;
-
- case AML_REGION_OP:
- case AML_DATA_REGION_OP:
- case AML_CREATE_QWORD_FIELD_OP:
- case AML_CREATE_DWORD_FIELD_OP:
- case AML_CREATE_WORD_FIELD_OP:
- case AML_CREATE_BYTE_FIELD_OP:
- case AML_CREATE_BIT_FIELD_OP:
- case AML_CREATE_FIELD_OP:
- case AML_BANK_FIELD_OP:
-
- /* Nothing to do in these cases */
-
- break;
-
- default:
- ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
- Op->Common.AmlOpName));
- break;
- }
-
- Op = AcpiPsGetDepthNext (Root, Op);
- }
-
- fprintf (stderr, "\n");
- return (Status);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: AdGetLocalTables
*
* PARAMETERS: Filename - Not used
@@ -1191,7 +979,9 @@ AdParseTable (
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
- Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
+ fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
+ Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
+ fprintf (stderr, "\n");
/* Process Resource Templates */
diff --git a/source/common/dmextern.c b/source/common/dmextern.c
index 22924dd41688..c8764d893374 100644
--- a/source/common/dmextern.c
+++ b/source/common/dmextern.c
@@ -153,10 +153,17 @@ AcpiDmNormalizeParentPrefix (
char *Fullpath;
char *ParentPath;
ACPI_SIZE Length;
+ UINT32 Index = 0;
- /* Search upwards in the parse tree until we reach a namespace node */
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* Search upwards in the parse tree until we reach the next namespace node */
+ Op = Op->Common.Parent;
while (Op)
{
if (Op->Common.Node)
@@ -205,6 +212,13 @@ AcpiDmNormalizeParentPrefix (
* for the required dot separator (ParentPath.Path)
*/
Length++;
+
+ /* For External() statements, we do not want a leading '\' */
+
+ if (*ParentPath == AML_ROOT_PREFIX)
+ {
+ Index = 1;
+ }
}
Fullpath = ACPI_ALLOCATE_ZEROED (Length);
@@ -219,7 +233,7 @@ AcpiDmNormalizeParentPrefix (
*
* Copy the parent path
*/
- ACPI_STRCAT (Fullpath, ParentPath);
+ ACPI_STRCPY (Fullpath, &ParentPath[Index]);
/*
* Add dot separator
@@ -366,7 +380,22 @@ AcpiDmAddToExternalList (
return;
}
- /* Externalize the ACPI path */
+ /*
+ * 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++;
+ }
+
+ /* Externalize the ACPI pathname */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
@@ -375,8 +404,10 @@ AcpiDmAddToExternalList (
return;
}
- /* Get the full pathname from root if "Path" has a parent prefix */
-
+ /*
+ * Get the full pathname from the root if "Path" has one or more
+ * parent prefixes (^). Note: path will not contain a leading '\'.
+ */
if (*Path == (UINT8) AML_PARENT_PREFIX)
{
Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c
index 8426dff8448b..a13363bc6444 100644
--- a/source/common/dmrestag.c
+++ b/source/common/dmrestag.c
@@ -625,7 +625,7 @@ AcpiGetTagPathname (
Aml = ACPI_CAST_PTR (AML_RESOURCE,
&Op->Named.Data[ResourceNode->Value]);
- Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
+ Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
if (ACPI_FAILURE (Status))
{
return (NULL);
@@ -938,7 +938,7 @@ AcpiDmFindResources (
* resource descriptors to the namespace, as children of the
* buffer node.
*/
- if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
+ if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (NULL, Op)))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
@@ -991,7 +991,7 @@ AcpiDmAddResourcesToNamespace (
* Insert each resource into the namespace
* NextOp contains the Aml pointer and the Aml length
*/
- AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
+ AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
(ACPI_SIZE) NextOp->Common.Value.Integer,
AcpiDmAddResourceToNamespace, BufferNode);
}
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index f0fd3293d55a..269c1bffaf6d 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -50,6 +50,15 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcompile")
+/*
+ * Main parser entry
+ * External is here in case the parser emits the same external in the
+ * generated header. (Newer versions of Bison)
+ */
+int
+AslCompilerparse(
+ void);
+
/* Local prototypes */
static void
@@ -274,7 +283,7 @@ FlConsumeAnsiComment (
BOOLEAN ClosingComment = FALSE;
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
/* Scan until comment close is found */
@@ -317,7 +326,7 @@ FlConsumeNewComment (
UINT8 Byte;
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
Status->Offset++;
@@ -368,7 +377,7 @@ FlCheckForAscii (
/* Read the entire file */
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
/* Ignore comment fields (allow non-ascii within) */
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 98dc27d2216e..d591b46e4a3a 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -86,10 +86,6 @@
/*
* Main ASL parser - generated from flex/bison, lex/yacc, etc.
*/
-int
-AslCompilerparse(
- void);
-
ACPI_PARSE_OBJECT *
AslDoError (
void);
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 74c220d1214f..a8187fd2ae55 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -294,7 +294,7 @@ AePrintException (
else
{
RActual = fread (&SourceByte, 1, 1, SourceFile);
- if (!RActual)
+ if (RActual != 1)
{
fprintf (OutputFile,
"[*** iASL: Read error on source code temp file %s ***]",
@@ -304,8 +304,20 @@ AePrintException (
{
while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256))
{
- fwrite (&SourceByte, 1, 1, OutputFile);
+ if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
+ {
+ printf ("[*** iASL: Write error on output file ***]\n");
+ return;
+ }
+
RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (RActual != 1)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ return;
+ }
Total++;
}
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 3a3de3819e0e..f63504af4540 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -143,15 +143,14 @@ FlOpenFile (
File = fopen (Filename, Mode);
-
- Gbl_Files[FileId].Filename = Filename;
- Gbl_Files[FileId].Handle = File;
-
if (!File)
{
FlFileError (FileId, ASL_MSG_OPEN);
AslAbort ();
}
+
+ Gbl_Files[FileId].Filename = Filename;
+ Gbl_Files[FileId].Handle = File;
}
@@ -216,7 +215,7 @@ FlReadFile (
/* Read and check for error */
Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle);
- if (Actual != Length)
+ if (Actual < Length)
{
if (feof (Gbl_Files[FileId].Handle))
{
@@ -659,16 +658,17 @@ FlOpenIncludeWithPrefix (
/* Attempt to open the file, push if successful */
IncludeFile = fopen (Pathname, "r");
- if (IncludeFile)
+ if (!IncludeFile)
{
- /* Push the include file on the open input file stack */
-
- AslPushInputFileStack (IncludeFile, Pathname);
- return (IncludeFile);
+ fprintf (stderr, "Could not open include file %s\n", Pathname);
+ ACPI_FREE (Pathname);
+ return (NULL);
}
- ACPI_FREE (Pathname);
- return (NULL);
+ /* Push the include file on the open input file stack */
+
+ AslPushInputFileStack (IncludeFile, Pathname);
+ return (IncludeFile);
}
@@ -952,7 +952,7 @@ FlOpenMiscOutputFiles (
return (AE_OK);
}
- /* Create/Open a combined source output file */
+ /* Create/Open a combined source output file */
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
if (!Filename)
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 987ed1c2a2cf..101b23d35482 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -137,7 +137,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c
index 339cc01ac4c6..b70bcf8ab8d5 100644
--- a/source/compiler/asllisting.c
+++ b/source/compiler/asllisting.c
@@ -135,6 +135,10 @@ LsTreeWriteWalk (
UINT32 Level,
void *Context);
+static UINT32
+LsReadAmlOutputFile (
+ UINT8 *Buffer);
+
/*******************************************************************************
*
@@ -1282,6 +1286,38 @@ LsDoHexOutput (
/*******************************************************************************
*
+ * FUNCTION: LsReadAmlOutputFile
+ *
+ * PARAMETERS: Buffer - Where to return data
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Read a line of the AML output prior to formatting the data
+ *
+ ******************************************************************************/
+
+static UINT32
+LsReadAmlOutputFile (
+ UINT8 *Buffer)
+{
+ UINT32 Actual;
+
+
+ Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+
+ if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
+ {
+ FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
+ AslAbort ();
+ }
+
+ return (Actual);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: LsDoHexOutputC
*
* PARAMETERS: None
@@ -1319,8 +1355,7 @@ LsDoHexOutputC (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
@@ -1407,8 +1442,7 @@ LsDoHexOutputAsl (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
@@ -1494,8 +1528,7 @@ LsDoHexOutputAsm (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
diff --git a/source/compiler/asllookup.c b/source/compiler/asllookup.c
index 8bd93559bc51..f051879b3bfa 100644
--- a/source/compiler/asllookup.c
+++ b/source/compiler/asllookup.c
@@ -329,16 +329,19 @@ LsDoOneNamespaceObject (
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
- if (Node->Flags & 0x80)
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bits 0x%.4X Bytes] ",
+ Node->Value, Node->Value / 8);
+
+ if (Node->Flags & ANOBJ_IS_REFERENCED)
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
- " [Field Offset 0x%.4X Bits 0x%.4X Bytes]",
- Node->Value, Node->Value / 8);
+ "Referenced");
}
else
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
- " [Field Offset 0x%.4X Bytes]", Node->Value);
+ "Name not referenced");
}
break;
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 09eb9fcf702e..c832211544ed 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -100,7 +100,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b|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:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z"
/*******************************************************************************
@@ -171,7 +171,6 @@ Options (
ACPI_OPTION ("-dc [file]", "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 ("-2", "Emit ACPI 2.0 compatible ASL code");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
@@ -473,11 +472,6 @@ AslDoOptions (
break;
- case '2': /* ACPI 2.0 compatibility mode */
- Gbl_Acpi2 = TRUE;
- break;
-
-
case 'b': /* Debug output options */
switch (AcpiGbl_Optarg[0])
{
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 4d556f274622..fbc005c74053 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -337,6 +337,13 @@ AslDoOneFile (
return (Status);
}
+#if 0
+ /* TBD: Handle additional output files for disassembler */
+
+ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+ LsDisplayNamespace ();
+#endif
+
/* Shutdown compiler and ACPICA subsystem */
AeClearErrorLog ();
diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c
index 60844f030002..28fe072ef30f 100644
--- a/source/compiler/dttemplate.c
+++ b/source/compiler/dttemplate.c
@@ -280,6 +280,7 @@ DtCreateOneTemplate (
char *DisasmFilename;
FILE *File;
ACPI_STATUS Status = AE_OK;
+ ACPI_SIZE Actual;
/* New file will have a .asl suffix */
@@ -334,18 +335,32 @@ DtCreateOneTemplate (
}
else
{
- /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */
+ /* Special ACPI tables - DSDT, SSDT, FADT, RSDP */
AcpiOsPrintf (" */\n\n");
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
{
- fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File);
+ Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File);
+ if (Actual != sizeof (TemplateDsdt) -1)
+ {
+ fprintf (stderr,
+ "Could not write to output file %s\n", DisasmFilename);
+ Status = AE_ERROR;
+ goto Cleanup;
+ }
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
{
- fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File);
+ Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File);
+ if (Actual != sizeof (TemplateSsdt) -1)
+ {
+ fprintf (stderr,
+ "Could not write to output file %s\n", DisasmFilename);
+ Status = AE_ERROR;
+ goto Cleanup;
+ }
}
- else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateFacs));
@@ -359,7 +374,8 @@ DtCreateOneTemplate (
{
fprintf (stderr,
"%4.4s, Unrecognized ACPI table signature\n", Signature);
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
}
@@ -367,6 +383,7 @@ DtCreateOneTemplate (
"Created ACPI table template for [%4.4s], written to \"%s\"\n",
Signature, DisasmFilename);
+Cleanup:
fclose (File);
AcpiOsRedirectOutput (stdout);
ACPI_FREE (DisasmFilename);
diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c
index 9ec851a90d99..15027088ffa4 100644
--- a/source/compiler/prutils.c
+++ b/source/compiler/prutils.c
@@ -337,16 +337,17 @@ PrOpenIncludeWithPrefix (
/* Attempt to open the file, push if successful */
IncludeFile = fopen (Pathname, "r");
- if (IncludeFile)
+ if (!IncludeFile)
{
- /* Push the include file on the open input file stack */
-
- PrPushInputFileStack (IncludeFile, Pathname);
- return (IncludeFile);
+ fprintf (stderr, "Could not open include file %s\n", Pathname);
+ ACPI_FREE (Pathname);
+ return (NULL);
}
- ACPI_FREE (Pathname);
- return (NULL);
+ /* Push the include file on the open input file stack */
+
+ PrPushInputFileStack (IncludeFile, Pathname);
+ return (IncludeFile);
}
diff --git a/source/compiler/readme.txt b/source/compiler/readme.txt
index d891cd16a329..e47b99beac7a 100644
--- a/source/compiler/readme.txt
+++ b/source/compiler/readme.txt
@@ -2,6 +2,9 @@
* Miscellaneous instructions for building and using the iASL compiler.
*/
+Last update: 24 October 2012
+
+
1) Generating iASL from source
------------------------------
@@ -23,20 +26,28 @@ be installed):
constant expressions.
3) The "common" source directory that is used for all ACPI components.
+
+1a) Notes for Linux/Unix generation
+-----------------------------------
+
On Linux/Unix systems, the following commands will build the compiler:
cd acpica (or cd acpica/generate/unix)
make clean
make iasl
-On Windows, the Visual Studio 2008 project file appears in this directory:
+iASL has been generated with these versions of Flex/Bison:
+
+ Flex: Version 2.5.32
+ Bison: Version 2.6.2
- generate/msvc9/AcpiComponents.sln
+1b) Notes for Windows generation
+--------------------------------
+On Windows, the Visual Studio 2008 project file appears in this directory:
-1a) Notes for Windows GNU Flex and GNU Bison
---------------------------------------------
+ generate/msvc9/AcpiComponents.sln
The Windows versions of GNU Flex/Bison must be installed, and they must
be installed in a directory that contains no embedded spaces in the
@@ -56,7 +67,7 @@ the updated $PATH.
iASL has been generated with these versions of Flex/Bison for Windows:
- Flex for Windows: V2.5.4
+ Flex for Windows: V2.5.4a
Bison for Windows: V2.4.1
Flex is available at: http://gnuwin32.sourceforge.net/packages/flex.htm
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index 7b0870d1c991..4a0fe0034702 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -135,17 +135,16 @@ AcpiDbOpenDebugFile (
AcpiDbCloseDebugFile ();
AcpiGbl_DebugFile = fopen (Name, "w+");
- if (AcpiGbl_DebugFile)
- {
- AcpiOsPrintf ("Debug output file %s opened\n", Name);
- ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
- AcpiGbl_DbOutputToFile = TRUE;
- }
- else
+ if (!AcpiGbl_DebugFile)
{
AcpiOsPrintf ("Could not open debug file %s\n", Name);
+ return;
}
+ AcpiOsPrintf ("Debug output file %s opened\n", Name);
+ ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
+ AcpiGbl_DbOutputToFile = TRUE;
+
#endif
}
#endif
@@ -288,7 +287,7 @@ AcpiDbReadTable (
{
/* Read the table header */
- if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
+ if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) !=
sizeof (ACPI_TABLE_HEADER))
{
AcpiOsPrintf ("Could not read the table header\n");
@@ -387,7 +386,6 @@ AcpiDbReadTable (
AcpiOsFree (*Table);
*Table = NULL;
*TableLength = 0;
-
return (AE_ERROR);
}
@@ -485,15 +483,15 @@ AcpiDbReadTableFromFile (
char *Filename,
ACPI_TABLE_HEADER **Table)
{
- FILE *fp;
+ FILE *File;
UINT32 TableLength;
ACPI_STATUS Status;
/* Open the file */
- fp = fopen (Filename, "rb");
- if (!fp)
+ File = fopen (Filename, "rb");
+ if (!File)
{
AcpiOsPrintf ("Could not open input file %s\n", Filename);
return (AE_ERROR);
@@ -502,8 +500,8 @@ AcpiDbReadTableFromFile (
/* Get the entire file */
fprintf (stderr, "Loading Acpi table from file %s\n", Filename);
- Status = AcpiDbReadTable (fp, Table, &TableLength);
- fclose(fp);
+ Status = AcpiDbReadTable (File, Table, &TableLength);
+ fclose(File);
if (ACPI_FAILURE (Status))
{
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index a431ddcba509..d9c01c8c4ab3 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -100,6 +100,7 @@ enum AcpiExDebuggerCommands
CMD_CLOSE,
CMD_DEBUG,
CMD_DISASSEMBLE,
+ CMD_DISASM,
CMD_DUMP,
CMD_ENABLEACPI,
CMD_EVALUATE,
@@ -170,6 +171,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"CLOSE", 0},
{"DEBUG", 1},
{"DISASSEMBLE", 1},
+ {"DISASM", 1},
{"DUMP", 1},
{"ENABLEACPI", 0},
{"EVALUATE", 1},
@@ -796,6 +798,7 @@ AcpiDbCommandDispatch (
break;
case CMD_DISASSEMBLE:
+ case CMD_DISASM:
(void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
break;
diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c
index 5335611278f7..c3266c51e259 100644
--- a/source/components/debugger/dbmethod.c
+++ b/source/components/debugger/dbmethod.c
@@ -345,6 +345,13 @@ AcpiDbDisassembleMethod (
return (AE_BAD_PARAMETER);
}
+ if (Method->Type != ACPI_TYPE_METHOD)
+ {
+ ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method",
+ Name, AcpiUtGetTypeName (Method->Type)));
+ return (AE_BAD_PARAMETER);
+ }
+
ObjDesc = Method->Object;
Op = AcpiPsCreateScopeOp ();
@@ -362,21 +369,47 @@ AcpiDbDisassembleMethod (
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+ ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ WalkState->OwnerId = ObjDesc->Method.OwnerId;
+
+ /* Push start scope on scope stack and make it current */
+
+ Status = AcpiDsScopeStackPush (Method,
+ Method->Type, WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
- /* Parse the AML */
+ /* Parse the entire method AML including deferred operators */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
+
Status = AcpiPsParseAml (WalkState);
+ AcpiDmParseDeferredOps (Op);
+ /* Now we can disassemble the method */
+
+ AcpiGbl_DbOpt_verbose = TRUE;
+ AcpiGbl_DbOpt_verbose = FALSE;
AcpiDmDisassemble (NULL, Op, 0);
+ AcpiGbl_DbOpt_verbose = TRUE;
+
AcpiPsDeleteParseTree (Op);
+
+ /* Method cleanup */
+
+ AcpiNsDeleteNamespaceSubtree (Method);
+ AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId);
+ AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
return (AE_OK);
}
diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c
new file mode 100644
index 000000000000..a3f40aee9b1a
--- /dev/null
+++ b/source/components/disassembler/dmdeferred.c
@@ -0,0 +1,272 @@
+/******************************************************************************
+ *
+ * Module Name: dmdeferred - Disassembly of deferred AML opcodes
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, 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 "acpi.h"
+#include "accommon.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acdisasm.h"
+#include "acparser.h"
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmdeferred")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDmDeferredParse (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 *Aml,
+ UINT32 AmlLength);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiDmParseDeferredOps
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.)
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiDmParseDeferredOps (
+ ACPI_PARSE_OBJECT *Root)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME (DmParseDeferredOps);
+
+
+ /* Traverse the entire parse tree */
+
+ while (Op)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (!(OpInfo->Flags & AML_DEFER))
+ {
+ Op = AcpiPsGetDepthNext (Root, Op);
+ continue;
+ }
+
+ /* Now we know we have a deferred opcode */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ Status = AcpiDmDeferredParse (Op, Op->Named.Data, Op->Named.Length);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ break;
+
+ /* We don't need to do anything for these deferred opcodes */
+
+ case AML_REGION_OP:
+ case AML_DATA_REGION_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+ case AML_CREATE_DWORD_FIELD_OP:
+ case AML_CREATE_WORD_FIELD_OP:
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_CREATE_BIT_FIELD_OP:
+ case AML_CREATE_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+
+ break;
+
+ default:
+ ACPI_ERROR ((AE_INFO, "Unhandled deferred AML opcode [0x%.4X]",
+ Op->Common.AmlOpcode));
+ break;
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiDmDeferredParse
+ *
+ * PARAMETERS: Op - Root Op of the deferred opcode
+ * Aml - Pointer to the raw AML
+ * AmlLength - Length of the AML
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse one deferred opcode
+ * (Methods, operation regions, etc.)
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+AcpiDmDeferredParse (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 *Aml,
+ UINT32 AmlLength)
+{
+ ACPI_WALK_STATE *WalkState;
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *SearchOp;
+ ACPI_PARSE_OBJECT *StartOp;
+ UINT32 BaseAmlOffset;
+ ACPI_PARSE_OBJECT *NewRootOp;
+ ACPI_PARSE_OBJECT *ExtraOp;
+
+
+ ACPI_FUNCTION_TRACE (DmDeferredParse);
+
+
+ if (!Aml || !AmlLength)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing deferred opcode %s [%4.4s]\n",
+ Op->Common.AmlOpName, (char *) &Op->Named.Name));
+
+ /* Need a new walk state to parse the AML */
+
+ WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
+ if (!WalkState)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parse the AML for this deferred opcode */
+
+ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
+ Status = AcpiPsParseAml (WalkState);
+
+ /*
+ * We need to update all of the AML offsets, since the parser thought
+ * that the method began at offset zero. In reality, it began somewhere
+ * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
+ * was just created and update the AmlOffset in each Op.
+ */
+ BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
+ StartOp = (Op->Common.Value.Arg)->Common.Next;
+ SearchOp = StartOp;
+
+ while (SearchOp)
+ {
+ SearchOp->Common.AmlOffset += BaseAmlOffset;
+ SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
+ }
+
+ /*
+ * For Buffer and Package opcodes, link the newly parsed subtree
+ * into the main parse tree
+ */
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_PACKAGE_OP:
+
+ ExtraOp = Op->Common.Value.Arg;
+ NewRootOp = ExtraOp->Common.Next;
+ ACPI_FREE (ExtraOp);
+ break;
+
+ case AML_VAR_PACKAGE_OP:
+ case AML_BUFFER_OP:
+ default:
+
+ NewRootOp = Op->Common.Value.Arg;
+ break;
+ }
+
+ Op->Common.Value.Arg = NewRootOp->Common.Value.Arg;
+
+ /* Must point all parents to the main tree */
+
+ StartOp = Op;
+ SearchOp = StartOp;
+ while (SearchOp)
+ {
+ if (SearchOp->Common.Parent == NewRootOp)
+ {
+ SearchOp->Common.Parent = Op;
+ }
+
+ SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
+ }
+
+ ACPI_FREE (NewRootOp);
+ break;
+
+ default:
+ break;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c
index 9d61b0257906..443ef089e90b 100644
--- a/source/components/disassembler/dmopcode.c
+++ b/source/components/disassembler/dmopcode.c
@@ -645,7 +645,7 @@ AcpiDmDisassembleOneOp (
*/
if (!AcpiGbl_NoResourceDisassembly)
{
- Status = AcpiDmIsResourceTemplate (Op);
+ Status = AcpiDmIsResourceTemplate (WalkState, Op);
if (ACPI_SUCCESS (Status))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c
index 470be9505090..bf2a4d4da496 100644
--- a/source/components/disassembler/dmresrc.c
+++ b/source/components/disassembler/dmresrc.c
@@ -279,7 +279,7 @@ AcpiDmResourceTemplate (
/* Validate the Resource Type and Resource Length */
- Status = AcpiUtValidateResource (Aml, &ResourceIndex);
+ Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
@@ -366,7 +366,8 @@ AcpiDmResourceTemplate (
*
* FUNCTION: AcpiDmIsResourceTemplate
*
- * PARAMETERS: Op - Buffer Op to be examined
+ * PARAMETERS: WalkState - Current walk info
+ * Op - Buffer Op to be examined
*
* RETURN: Status. AE_OK if valid template
*
@@ -377,6 +378,7 @@ AcpiDmResourceTemplate (
ACPI_STATUS
AcpiDmIsResourceTemplate (
+ ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
@@ -396,6 +398,12 @@ AcpiDmIsResourceTemplate (
/* Get the ByteData list and length */
NextOp = Op->Common.Value.Arg;
+ if (!NextOp)
+ {
+ AcpiOsPrintf ("NULL byte list in buffer\n");
+ return (AE_TYPE);
+ }
+
NextOp = NextOp->Common.Next;
if (!NextOp)
{
@@ -407,7 +415,7 @@ AcpiDmIsResourceTemplate (
/* Walk the byte list, abort on any invalid descriptor type or length */
- Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml);
+ Status = AcpiUtWalkAmlResources (WalkState, Aml, Length, NULL, &EndAml);
if (ACPI_FAILURE (Status))
{
return (AE_TYPE);
diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c
index ed78b31c707b..dfd8e781bdaa 100644
--- a/source/components/disassembler/dmresrcl.c
+++ b/source/components/disassembler/dmresrcl.c
@@ -318,7 +318,7 @@ AcpiDmAddressCommon (
/* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
- AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
+ AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
/* Decode the general and type-specific flags */
@@ -331,7 +331,7 @@ AcpiDmAddressCommon (
AcpiDmIoFlags (Flags);
if (ResourceType == ACPI_IO_RANGE)
{
- AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
+ AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
}
}
}
@@ -383,10 +383,10 @@ AcpiDmSpaceFlags (
{
AcpiOsPrintf ("%s, %s, %s, %s,",
- AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
- AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
- AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
+ AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
+ AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
+ AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
}
@@ -407,10 +407,10 @@ AcpiDmIoFlags (
UINT8 Flags)
{
AcpiOsPrintf ("%s, %s, %s, %s,",
- AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
- AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
+ AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
+ AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
+ AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
}
@@ -432,14 +432,14 @@ AcpiDmIoFlags2 (
{
AcpiOsPrintf (", %s",
- AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
+ AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
/* TRS is only used if TTP is TypeTranslation */
if (SpecificFlags & 0x10)
{
AcpiOsPrintf (", %s",
- AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
+ AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
}
}
@@ -464,12 +464,12 @@ AcpiDmMemoryFlags (
{
AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
- AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
- AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
- AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
- AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
+ AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
+ AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
+ AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
+ AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
+ AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
}
@@ -491,8 +491,8 @@ AcpiDmMemoryFlags2 (
{
AcpiOsPrintf (", %s, %s",
- AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
- AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
+ AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
+ AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
}
@@ -767,7 +767,7 @@ AcpiDmMemory24Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory24 (%s,\n",
- AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
+ AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
/* Dump the 4 contiguous WORD values */
@@ -806,7 +806,7 @@ AcpiDmMemory32Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory32 (%s,\n",
- AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
+ AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
/* Dump the 4 contiguous DWORD values */
@@ -845,7 +845,7 @@ AcpiDmFixedMemory32Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory32Fixed (%s,\n",
- AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
+ AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
AcpiDmIndent (Level + 1);
AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
@@ -942,10 +942,10 @@ AcpiDmInterruptDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
- AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
- AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
- AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
- AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
+ AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
+ AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
/*
* The ResourceSource fields are optional and appear after the interrupt
diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c
index afa1f5c40083..0615f5c399c5 100644
--- a/source/components/disassembler/dmresrcl2.c
+++ b/source/components/disassembler/dmresrcl2.c
@@ -201,7 +201,7 @@ AcpiDmGpioCommon (
AcpiOsPrintf (", ");
AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
AcpiOsPrintf ("%s, ",
- AcpiGbl_ConsumeDecode [(Resource->Gpio.Flags & 1)]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
/* Insert a descriptor name */
@@ -273,9 +273,9 @@ AcpiDmGpioIntDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
- AcpiGbl_HeDecode [(Resource->Gpio.IntFlags & 1)],
- AcpiGbl_LlDecode [(Resource->Gpio.IntFlags >> 1) & 1],
- AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
+ AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
+ AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Gpio.IntFlags, 1)],
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
/* PinConfig, DebounceTimeout */
@@ -306,7 +306,7 @@ AcpiDmGpioIntDescriptor (
*
* RETURN: None
*
- * DESCRIPTION: Decode a GPIO Interrupt descriptor
+ * DESCRIPTION: Decode a GPIO I/O descriptor
*
******************************************************************************/
@@ -323,7 +323,7 @@ AcpiDmGpioIoDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("GpioIo (%s, ",
- AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
if (Resource->Gpio.PinConfig <= 3)
{
@@ -340,7 +340,7 @@ AcpiDmGpioIoDescriptor (
AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
AcpiOsPrintf ("%s,\n",
- AcpiGbl_IorDecode [Resource->Gpio.IntFlags & 3]);
+ AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
/* Dump the GpioInt/GpioIo common portion of the descriptor */
@@ -480,12 +480,12 @@ AcpiDmI2cSerialBusDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n",
Resource->I2cSerialBus.SlaveAddress,
- AcpiGbl_SmDecode [(Resource->I2cSerialBus.Flags & 1)],
+ AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
Resource->I2cSerialBus.ConnectionSpeed);
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("%s, ",
- AcpiGbl_AmDecode [(Resource->I2cSerialBus.TypeSpecificFlags & 1)]);
+ AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
/* ResourceSource is a required field */
@@ -503,7 +503,7 @@ AcpiDmI2cSerialBusDescriptor (
AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
AcpiOsPrintf ("%s, ",
- AcpiGbl_ConsumeDecode [(Resource->I2cSerialBus.Flags >> 1) & 1]);
+ AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
/* Insert a descriptor name */
@@ -546,21 +546,21 @@ AcpiDmSpiSerialBusDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n",
Resource->SpiSerialBus.DeviceSelection,
- AcpiGbl_DpDecode [(Resource->SpiSerialBus.TypeSpecificFlags >> 1) & 1],
- AcpiGbl_WmDecode [(Resource->SpiSerialBus.TypeSpecificFlags & 1)],
+ AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
+ AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
Resource->SpiSerialBus.DataBitLength);
/* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
- AcpiGbl_SmDecode [(Resource->SpiSerialBus.Flags & 1)],
+ AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
Resource->SpiSerialBus.ConnectionSpeed,
- AcpiGbl_CpoDecode [(Resource->SpiSerialBus.ClockPolarity & 1)]);
+ AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("%s, ",
- AcpiGbl_CphDecode [(Resource->SpiSerialBus.ClockPhase & 1)]);
+ AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
/* ResourceSource is a required field */
@@ -578,7 +578,7 @@ AcpiDmSpiSerialBusDescriptor (
AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
AcpiOsPrintf ("%s, ",
- AcpiGbl_ConsumeDecode [(Resource->SpiSerialBus.Flags >> 1) & 1]);
+ AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
/* Insert a descriptor name */
@@ -621,17 +621,17 @@ AcpiDmUartSerialBusDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n",
Resource->UartSerialBus.DefaultBaudRate,
- AcpiGbl_BpbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 4) & 3],
- AcpiGbl_SbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 2) & 3]);
+ AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
+ AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
/* LinesInUse, IsBigEndian, Parity, FlowControl */
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
Resource->UartSerialBus.LinesEnabled,
- AcpiGbl_EdDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 7) & 1],
- AcpiGbl_PtDecode [Resource->UartSerialBus.Parity & 7],
- AcpiGbl_FcDecode [Resource->UartSerialBus.TypeSpecificFlags & 3]);
+ AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
+ AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
+ AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
/* ReceiveBufferSize, TransmitBufferSize */
@@ -656,7 +656,7 @@ AcpiDmUartSerialBusDescriptor (
AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
AcpiOsPrintf ("%s, ",
- AcpiGbl_ConsumeDecode [(Resource->UartSerialBus.Flags >> 1) & 1]);
+ AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
/* Insert a descriptor name */
diff --git a/source/components/disassembler/dmresrcs.c b/source/components/disassembler/dmresrcs.c
index d3b1dd8dce9d..60eb558259a3 100644
--- a/source/components/disassembler/dmresrcs.c
+++ b/source/components/disassembler/dmresrcs.c
@@ -76,16 +76,16 @@ AcpiDmIrqDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("%s (",
- AcpiGbl_IrqDecode [Length & 1]);
+ AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]);
/* Decode flags byte if present */
if (Length & 1)
{
AcpiOsPrintf ("%s, %s, %s, ",
- AcpiGbl_HeDecode [Resource->Irq.Flags & 1],
- AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1],
- AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]);
+ AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Irq.Flags)],
+ AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Irq.Flags, 3)],
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Irq.Flags, 4)]);
}
/* Insert a descriptor name */
@@ -121,9 +121,9 @@ AcpiDmDmaDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("DMA (%s, %s, %s, ",
- AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
- AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1],
- AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
+ AcpiGbl_TypDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Dma.Flags, 5)],
+ AcpiGbl_BmDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Dma.Flags, 2)],
+ AcpiGbl_SizDecode [ACPI_GET_2BIT_FLAG (Resource->Dma.Flags)]);
/* Insert a descriptor name */
@@ -201,7 +201,7 @@ AcpiDmIoDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("IO (%s,\n",
- AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]);
+ AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
AcpiDmIndent (Level + 1);
AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
@@ -287,8 +287,8 @@ AcpiDmStartDependentDescriptor (
if (Length & 1)
{
AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
- (UINT32) Resource->StartDpf.Flags & 3,
- (UINT32) (Resource->StartDpf.Flags >> 2) & 3);
+ (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags),
+ (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2));
}
else
{
diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c
index 4f7901070282..97d52b87f4eb 100644
--- a/source/components/dispatcher/dsmethod.c
+++ b/source/components/dispatcher/dsmethod.c
@@ -409,7 +409,8 @@ AcpiDsCallControlMethod (
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
Info->Parameters = &ThisWalkState->Operands[0];
diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c
index f3120465be49..a64645dfbba0 100644
--- a/source/components/executer/exregion.c
+++ b/source/components/executer/exregion.c
@@ -257,19 +257,19 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
- ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
+ ACPI_SET8 (LogicalAddrPtr, *Value);
break;
case 16:
- ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
+ ACPI_SET16 (LogicalAddrPtr, *Value);
break;
case 32:
- ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
+ ACPI_SET32 (LogicalAddrPtr, *Value);
break;
case 64:
- ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
+ ACPI_SET64 (LogicalAddrPtr, *Value);
break;
default:
diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c
index 6370dab2a693..68a3f9c2a622 100644
--- a/source/components/namespace/nsutils.c
+++ b/source/components/namespace/nsutils.c
@@ -777,18 +777,18 @@ UINT32
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_ENTRY ();
- if (!AcpiUtValidObjectType (Type))
+ if (Type > ACPI_TYPE_LOCAL_MAX)
{
/* type code out of range */
ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
- return_UINT32 (ACPI_NS_NORMAL);
+ return (ACPI_NS_NORMAL);
}
- return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
+ return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c
index 1d5aeecb940b..8b4d686065df 100644
--- a/source/components/namespace/nsxfname.c
+++ b/source/components/namespace/nsxfname.c
@@ -325,7 +325,7 @@ AcpiGetObjectInfo (
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ return (Status);
}
Node = AcpiNsValidateHandle (Handle);
diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c
index 12af85ea30ce..06426670e6b6 100644
--- a/source/components/resources/rscalc.c
+++ b/source/components/resources/rscalc.c
@@ -430,7 +430,7 @@ AcpiRsGetListLength (
{
/* Validate the Resource Type and Resource Length */
- Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex);
+ Status = AcpiUtValidateResource (NULL, AmlBuffer, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
/*
diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c
index 4c444cedd60d..afac008cb4d4 100644
--- a/source/components/resources/rscreate.c
+++ b/source/components/resources/rscreate.c
@@ -106,7 +106,7 @@ AcpiBufferToResource (
/* Perform the AML-to-Resource conversion */
- Status = AcpiUtWalkAmlResources (AmlBuffer, AmlBufferLength,
+ Status = AcpiUtWalkAmlResources (NULL, AmlBuffer, AmlBufferLength,
AcpiRsConvertAmlToResources, &CurrentResourcePtr);
if (Status == AE_AML_NO_RESOURCE_END_TAG)
{
@@ -192,7 +192,7 @@ AcpiRsCreateResourceList (
/* Do the conversion */
Resource = OutputBuffer->Pointer;
- Status = AcpiUtWalkAmlResources (AmlStart, AmlBufferLength,
+ Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength,
AcpiRsConvertAmlToResources, &Resource);
if (ACPI_FAILURE (Status))
{
diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c
index 6e2013253e71..8ac320c78151 100644
--- a/source/components/resources/rsdump.c
+++ b/source/components/resources/rsdump.c
@@ -139,7 +139,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] =
{ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL}
};
@@ -278,7 +278,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] =
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL}
@@ -301,7 +301,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] =
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharable", AcpiGbl_ShrDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode},
diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c
index c5aeb1b91797..a4f1daee1d3b 100644
--- a/source/components/resources/rslist.c
+++ b/source/components/resources/rslist.c
@@ -241,7 +241,7 @@ AcpiRsConvertResourcesToAml (
/* Perform final sanity check on the new AML resource descriptor */
- Status = AcpiUtValidateResource (
+ Status = AcpiUtValidateResource (NULL,
ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL);
if (ACPI_FAILURE (Status))
{
diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c
index 673492887d70..10afe4d0fe2f 100644
--- a/source/components/resources/rsmisc.c
+++ b/source/components/resources/rsmisc.c
@@ -152,8 +152,8 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bit
*/
- ACPI_SET8 (Destination) = (UINT8)
- ((ACPI_GET8 (Source) >> Info->Value) & 0x01);
+ ACPI_SET8 (Destination,
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x01));
break;
@@ -161,8 +161,8 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bits
*/
- ACPI_SET8 (Destination) = (UINT8)
- ((ACPI_GET8 (Source) >> Info->Value) & 0x03);
+ ACPI_SET8 (Destination,
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x03));
break;
@@ -170,15 +170,15 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bits
*/
- ACPI_SET8 (Destination) = (UINT8)
- ((ACPI_GET8 (Source) >> Info->Value) & 0x07);
+ ACPI_SET8 (Destination,
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x07));
break;
case ACPI_RSC_COUNT:
ItemCount = ACPI_GET8 (Source);
- ACPI_SET8 (Destination) = (UINT8) ItemCount;
+ ACPI_SET8 (Destination, ItemCount);
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@@ -188,7 +188,7 @@ AcpiRsConvertAmlToResource (
case ACPI_RSC_COUNT16:
ItemCount = AmlResourceLength;
- ACPI_SET16 (Destination) = ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@@ -202,14 +202,14 @@ AcpiRsConvertAmlToResource (
Resource->Length = Resource->Length + ItemCount;
ItemCount = ItemCount / 2;
- ACPI_SET16 (Destination) = ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
break;
case ACPI_RSC_COUNT_GPIO_VEN:
ItemCount = ACPI_GET8 (Source);
- ACPI_SET8 (Destination) = (UINT8) ItemCount;
+ ACPI_SET8 (Destination, ItemCount);
Resource->Length = Resource->Length +
(Info->Value * ItemCount);
@@ -240,7 +240,7 @@ AcpiRsConvertAmlToResource (
}
Resource->Length = Resource->Length + ItemCount;
- ACPI_SET16 (Destination) = ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
break;
@@ -249,7 +249,7 @@ AcpiRsConvertAmlToResource (
ItemCount = ACPI_GET16 (Source) - Info->Value;
Resource->Length = Resource->Length + ItemCount;
- ACPI_SET16 (Destination) = ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
break;
@@ -260,7 +260,7 @@ AcpiRsConvertAmlToResource (
ACPI_GET16 (Source) - Info->Value;
Resource->Length = Resource->Length + ItemCount;
- ACPI_SET16 (Destination) = ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
break;
@@ -406,7 +406,7 @@ AcpiRsConvertAmlToResource (
}
Target = ACPI_ADD_PTR (char, Resource, Info->Value);
- ACPI_SET8 (Target) = (UINT8) ItemCount;
+ ACPI_SET8 (Target, ItemCount);
break;
@@ -423,7 +423,7 @@ AcpiRsConvertAmlToResource (
}
Target = ACPI_ADD_PTR (char, Resource, Info->Value);
- ACPI_SET8 (Target) = (UINT8) ItemCount;
+ ACPI_SET8 (Target, ItemCount);
break;
@@ -547,7 +547,7 @@ AcpiRsConvertResourceToAml (
/*
* Clear the flag byte
*/
- ACPI_SET8 (Destination) = 0;
+ ACPI_SET8 (Destination, 0);
break;
@@ -555,8 +555,8 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bit
*/
- ACPI_SET8 (Destination) |= (UINT8)
- ((ACPI_GET8 (Source) & 0x01) << Info->Value);
+ ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
+ ((ACPI_GET8 (Source) & 0x01) << Info->Value));
break;
@@ -564,8 +564,8 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bits
*/
- ACPI_SET8 (Destination) |= (UINT8)
- ((ACPI_GET8 (Source) & 0x03) << Info->Value);
+ ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
+ ((ACPI_GET8 (Source) & 0x03) << Info->Value));
break;
@@ -573,15 +573,15 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bits
*/
- ACPI_SET8 (Destination) |= (UINT8)
- ((ACPI_GET8 (Source) & 0x07) << Info->Value);
+ ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8)
+ ((ACPI_GET8 (Source) & 0x07) << Info->Value));
break;
case ACPI_RSC_COUNT:
ItemCount = ACPI_GET8 (Source);
- ACPI_SET8 (Destination) = (UINT8) ItemCount;
+ ACPI_SET8 (Destination, ItemCount);
AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1)));
break;
@@ -598,11 +598,11 @@ AcpiRsConvertResourceToAml (
case ACPI_RSC_COUNT_GPIO_PIN:
ItemCount = ACPI_GET16 (Source);
- ACPI_SET16 (Destination) = (UINT16) AmlLength;
+ ACPI_SET16 (Destination, AmlLength);
AmlLength = (UINT16) (AmlLength + ItemCount * 2);
Target = ACPI_ADD_PTR (void, Aml, Info->Value);
- ACPI_SET16 (Target) = (UINT16) AmlLength;
+ ACPI_SET16 (Target, AmlLength);
AcpiRsSetResourceLength (AmlLength, Aml);
break;
@@ -610,7 +610,7 @@ AcpiRsConvertResourceToAml (
case ACPI_RSC_COUNT_GPIO_VEN:
ItemCount = ACPI_GET16 (Source);
- ACPI_SET16 (Destination) = (UINT16) ItemCount;
+ ACPI_SET16 (Destination, ItemCount);
AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount));
AcpiRsSetResourceLength (AmlLength, Aml);
@@ -622,7 +622,7 @@ AcpiRsConvertResourceToAml (
/* Set resource source string length */
ItemCount = ACPI_GET16 (Source);
- ACPI_SET16 (Destination) = (UINT16) AmlLength;
+ ACPI_SET16 (Destination, AmlLength);
/* Compute offset for the Vendor Data */
@@ -633,7 +633,7 @@ AcpiRsConvertResourceToAml (
if (Resource->Data.Gpio.VendorLength)
{
- ACPI_SET16 (Target) = (UINT16) AmlLength;
+ ACPI_SET16 (Target, AmlLength);
}
AcpiRsSetResourceLength (AmlLength, Aml);
@@ -643,7 +643,7 @@ AcpiRsConvertResourceToAml (
case ACPI_RSC_COUNT_SERIAL_VEN:
ItemCount = ACPI_GET16 (Source);
- ACPI_SET16 (Destination) = ItemCount + Info->Value;
+ ACPI_SET16 (Destination, ItemCount + Info->Value);
AmlLength = (UINT16) (AmlLength + ItemCount);
AcpiRsSetResourceLength (AmlLength, Aml);
break;
@@ -746,9 +746,9 @@ AcpiRsConvertResourceToAml (
/*
* 8-bit encoded bitmask (DMA macro)
*/
- ACPI_SET8 (Destination) = (UINT8)
+ ACPI_SET8 (Destination,
AcpiRsEncodeBitmask (Source,
- *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
+ *ACPI_ADD_PTR (UINT8, Resource, Info->Value)));
break;
diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c
index d8c3938b31bc..8ff94db1ba00 100644
--- a/source/components/resources/rsxface.c
+++ b/source/components/resources/rsxface.c
@@ -679,7 +679,7 @@ AcpiWalkResources (
/* Get the next resource descriptor */
- Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
+ Resource = ACPI_NEXT_RESOURCE (Resource);
}
ACPI_FREE (Buffer.Pointer);
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c
index 4ed629762768..d526e0d27891 100644
--- a/source/components/utilities/utdelete.c
+++ b/source/components/utilities/utdelete.c
@@ -368,7 +368,7 @@ AcpiUtDeleteInternalObjectList (
ACPI_OPERAND_OBJECT **InternalObj;
- ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList);
+ ACPI_FUNCTION_NAME (UtDeleteInternalObjectList);
/* Walk the null-terminated internal list */
@@ -381,7 +381,7 @@ AcpiUtDeleteInternalObjectList (
/* Free the combined parameter pointer list and object array */
ACPI_FREE (ObjList);
- return_VOID;
+ return;
}
@@ -528,7 +528,7 @@ AcpiUtUpdateObjectReference (
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
+ ACPI_FUNCTION_NAME (UtUpdateObjectReference);
while (Object)
@@ -539,7 +539,7 @@ AcpiUtUpdateObjectReference (
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
"Object %p is NS handle\n", Object));
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
}
/*
@@ -577,17 +577,43 @@ AcpiUtUpdateObjectReference (
for (i = 0; i < Object->Package.Count; i++)
{
/*
- * Push each element onto the stack for later processing.
- * Note: There can be null elements within the package,
- * these are simply ignored
+ * Null package elements are legal and can be simply
+ * ignored.
*/
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->Package.Elements[i], Action, &StateList);
- if (ACPI_FAILURE (Status))
+ NextObject = Object->Package.Elements[i];
+ if (!NextObject)
+ {
+ continue;
+ }
+
+ switch (NextObject->Common.Type)
{
- goto ErrorExit;
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ /*
+ * For these very simple sub-objects, we can just
+ * update the reference count here and continue.
+ * Greatly increases performance of this operation.
+ */
+ AcpiUtUpdateRefCount (NextObject, Action);
+ break;
+
+ default:
+ /*
+ * For complex sub-objects, push them onto the stack
+ * for later processing (this eliminates recursion.)
+ */
+ Status = AcpiUtCreateUpdateStateAndPush (
+ NextObject, Action, &StateList);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+ break;
}
}
+ NextObject = NULL;
break;
case ACPI_TYPE_BUFFER_FIELD:
@@ -663,7 +689,7 @@ AcpiUtUpdateObjectReference (
}
}
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
ErrorExit:
@@ -679,7 +705,7 @@ ErrorExit:
AcpiUtDeleteGenericState (State);
}
- return_ACPI_STATUS (Status);
+ return (Status);
}
@@ -701,14 +727,14 @@ AcpiUtAddReference (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object);
+ ACPI_FUNCTION_NAME (UtAddReference);
/* Ensure that we have a valid object */
if (!AcpiUtValidInternalObject (Object))
{
- return_VOID;
+ return;
}
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
@@ -718,7 +744,7 @@ AcpiUtAddReference (
/* Increment the reference count */
(void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
- return_VOID;
+ return;
}
@@ -739,7 +765,7 @@ AcpiUtRemoveReference (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object);
+ ACPI_FUNCTION_NAME (UtRemoveReference);
/*
@@ -751,14 +777,14 @@ AcpiUtRemoveReference (
(ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
{
- return_VOID;
+ return;
}
/* Ensure that we have a valid object */
if (!AcpiUtValidInternalObject (Object))
{
- return_VOID;
+ return;
}
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
@@ -771,5 +797,5 @@ AcpiUtRemoveReference (
* of all subobjects!)
*/
(void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
- return_VOID;
+ return;
}
diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c
index a1a6c5bfbcc3..0caec2033d75 100644
--- a/source/components/utilities/utresrc.c
+++ b/source/components/utilities/utresrc.c
@@ -148,7 +148,9 @@ const char *AcpiGbl_RwDecode[] =
const char *AcpiGbl_ShrDecode[] =
{
"Exclusive",
- "Shared"
+ "Shared",
+ "ExclusiveAndWake", /* ACPI 5.0 */
+ "SharedAndWake" /* ACPI 5.0 */
};
const char *AcpiGbl_SizDecode[] =
@@ -429,27 +431,17 @@ static const UINT8 AcpiGbl_ResourceTypes[] =
ACPI_VARIABLE_LENGTH /* 0E *SerialBus */
};
-/*
- * For the iASL compiler/disassembler, we don't want any error messages
- * because the disassembler uses the resource validation code to determine
- * if Buffer objects are actually Resource Templates.
- */
-#ifdef ACPI_ASL_COMPILER
-#define ACPI_RESOURCE_ERROR(plist)
-#else
-#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist)
-#endif
-
/*******************************************************************************
*
* FUNCTION: AcpiUtWalkAmlResources
*
- * PARAMETERS: Aml - Pointer to the raw AML resource template
- * AmlLength - Length of the entire template
- * UserFunction - Called once for each descriptor found. If
- * NULL, a pointer to the EndTag is returned
- * Context - Passed to UserFunction
+ * PARAMETERS: WalkState - Current walk info
+ * PARAMETERS: Aml - Pointer to the raw AML resource template
+ * AmlLength - Length of the entire template
+ * UserFunction - Called once for each descriptor found. If
+ * NULL, a pointer to the EndTag is returned
+ * Context - Passed to UserFunction
*
* RETURN: Status
*
@@ -460,6 +452,7 @@ static const UINT8 AcpiGbl_ResourceTypes[] =
ACPI_STATUS
AcpiUtWalkAmlResources (
+ ACPI_WALK_STATE *WalkState,
UINT8 *Aml,
ACPI_SIZE AmlLength,
ACPI_WALK_AML_CALLBACK UserFunction,
@@ -493,7 +486,7 @@ AcpiUtWalkAmlResources (
{
/* Validate the Resource Type and Resource Length */
- Status = AcpiUtValidateResource (Aml, &ResourceIndex);
+ Status = AcpiUtValidateResource (WalkState, Aml, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
/*
@@ -553,7 +546,7 @@ AcpiUtWalkAmlResources (
{
/* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */
- (void) AcpiUtValidateResource (EndTag, &ResourceIndex);
+ (void) AcpiUtValidateResource (WalkState, EndTag, &ResourceIndex);
Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context);
if (ACPI_FAILURE (Status))
{
@@ -569,9 +562,10 @@ AcpiUtWalkAmlResources (
*
* FUNCTION: AcpiUtValidateResource
*
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- * ReturnIndex - Where the resource index is returned. NULL
- * if the index is not required.
+ * PARAMETERS: WalkState - Current walk info
+ * Aml - Pointer to the raw AML resource descriptor
+ * ReturnIndex - Where the resource index is returned. NULL
+ * if the index is not required.
*
* RETURN: Status, and optionally the Index into the global resource tables
*
@@ -583,6 +577,7 @@ AcpiUtWalkAmlResources (
ACPI_STATUS
AcpiUtValidateResource (
+ ACPI_WALK_STATE *WalkState,
void *Aml,
UINT8 *ReturnIndex)
{
@@ -696,9 +691,12 @@ AcpiUtValidateResource (
if ((AmlResource->CommonSerialBus.Type == 0) ||
(AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE))
{
- ACPI_RESOURCE_ERROR ((AE_INFO,
- "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
- AmlResource->CommonSerialBus.Type));
+ if (WalkState)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
+ AmlResource->CommonSerialBus.Type));
+ }
return (AE_AML_INVALID_RESOURCE_TYPE);
}
}
@@ -715,17 +713,23 @@ AcpiUtValidateResource (
InvalidResource:
- ACPI_RESOURCE_ERROR ((AE_INFO,
- "Invalid/unsupported resource descriptor: Type 0x%2.2X",
- ResourceType));
+ if (WalkState)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid/unsupported resource descriptor: Type 0x%2.2X",
+ ResourceType));
+ }
return (AE_AML_INVALID_RESOURCE_TYPE);
BadResourceLength:
- ACPI_RESOURCE_ERROR ((AE_INFO,
- "Invalid resource descriptor length: Type "
- "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
- ResourceType, ResourceLength, MinimumResourceLength));
+ if (WalkState)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid resource descriptor length: Type "
+ "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
+ ResourceType, ResourceLength, MinimumResourceLength));
+ }
return (AE_AML_BAD_RESOURCE_LENGTH);
}
@@ -914,7 +918,7 @@ AcpiUtGetResourceEndTag (
/* Validate the template and get a pointer to the EndTag */
- Status = AcpiUtWalkAmlResources (ObjDesc->Buffer.Pointer,
+ Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer,
ObjDesc->Buffer.Length, NULL, EndTag);
return_ACPI_STATUS (Status);
diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c
index f144bca2fde4..7ce39e7c9b1a 100644
--- a/source/components/utilities/utstate.c
+++ b/source/components/utilities/utstate.c
@@ -107,15 +107,14 @@ AcpiUtPushGenericState (
ACPI_GENERIC_STATE **ListHead,
ACPI_GENERIC_STATE *State)
{
- ACPI_FUNCTION_TRACE (UtPushGenericState);
+ ACPI_FUNCTION_ENTRY ();
/* Push the state object onto the front of the list (stack) */
State->Common.Next = *ListHead;
*ListHead = State;
-
- return_VOID;
+ return;
}
@@ -138,7 +137,7 @@ AcpiUtPopGenericState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE (UtPopGenericState);
+ ACPI_FUNCTION_ENTRY ();
/* Remove the state object at the head of the list (stack) */
@@ -151,7 +150,7 @@ AcpiUtPopGenericState (
*ListHead = State->Common.Next;
}
- return_PTR (State);
+ return (State);
}
@@ -209,7 +208,7 @@ AcpiUtCreateThreadState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE (UtCreateThreadState);
+ ACPI_FUNCTION_ENTRY ();
/* Create the generic state object */
@@ -217,7 +216,7 @@ AcpiUtCreateThreadState (
State = AcpiUtCreateGenericState ();
if (!State)
{
- return_PTR (NULL);
+ return (NULL);
}
/* Init fields specific to the update struct */
@@ -233,7 +232,7 @@ AcpiUtCreateThreadState (
State->Thread.ThreadId = (ACPI_THREAD_ID) 1;
}
- return_PTR ((ACPI_THREAD_STATE *) State);
+ return ((ACPI_THREAD_STATE *) State);
}
@@ -260,7 +259,7 @@ AcpiUtCreateUpdateState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR (UtCreateUpdateState, Object);
+ ACPI_FUNCTION_ENTRY ();
/* Create the generic state object */
@@ -268,7 +267,7 @@ AcpiUtCreateUpdateState (
State = AcpiUtCreateGenericState ();
if (!State)
{
- return_PTR (NULL);
+ return (NULL);
}
/* Init fields specific to the update struct */
@@ -276,8 +275,7 @@ AcpiUtCreateUpdateState (
State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE;
State->Update.Object = Object;
State->Update.Value = Action;
-
- return_PTR (State);
+ return (State);
}
@@ -303,7 +301,7 @@ AcpiUtCreatePkgState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR (UtCreatePkgState, InternalObject);
+ ACPI_FUNCTION_ENTRY ();
/* Create the generic state object */
@@ -311,7 +309,7 @@ AcpiUtCreatePkgState (
State = AcpiUtCreateGenericState ();
if (!State)
{
- return_PTR (NULL);
+ return (NULL);
}
/* Init fields specific to the update struct */
@@ -321,8 +319,7 @@ AcpiUtCreatePkgState (
State->Pkg.DestObject = ExternalObject;
State->Pkg.Index= Index;
State->Pkg.NumPackages = 1;
-
- return_PTR (State);
+ return (State);
}
@@ -346,7 +343,7 @@ AcpiUtCreateControlState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE (UtCreateControlState);
+ ACPI_FUNCTION_ENTRY ();
/* Create the generic state object */
@@ -354,15 +351,14 @@ AcpiUtCreateControlState (
State = AcpiUtCreateGenericState ();
if (!State)
{
- return_PTR (NULL);
+ return (NULL);
}
/* Init fields specific to the control struct */
State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL;
State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
-
- return_PTR (State);
+ return (State);
}
@@ -383,7 +379,7 @@ void
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State)
{
- ACPI_FUNCTION_TRACE (UtDeleteGenericState);
+ ACPI_FUNCTION_ENTRY ();
/* Ignore null state */
@@ -392,5 +388,5 @@ AcpiUtDeleteGenericState (
{
(void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
}
- return_VOID;
+ return;
}
diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c
index 2e37aebba1e2..b995db4fe24e 100644
--- a/source/components/utilities/uttrack.c
+++ b/source/components/utilities/uttrack.c
@@ -490,12 +490,12 @@ AcpiUtRemoveAllocation (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE (UtRemoveAllocation);
+ ACPI_FUNCTION_NAME (UtRemoveAllocation);
if (AcpiGbl_DisableMemTracking)
{
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
}
MemList = AcpiGbl_GlobalList;
@@ -506,13 +506,13 @@ AcpiUtRemoveAllocation (
ACPI_ERROR ((Module, Line,
"Empty allocation list, nothing to free!"));
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ return (Status);
}
/* Unlink */
@@ -531,15 +531,15 @@ AcpiUtRemoveAllocation (
(Allocation->Next)->Previous = Allocation->Previous;
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n",
+ &Allocation->UserSpace, Allocation->Size));
+
/* Mark the segment as deleted */
ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
- Allocation->Size));
-
Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (Status);
+ return (Status);
}
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
index bb66fbbf2a21..3c0b798af9a0 100644
--- a/source/include/acdisasm.h
+++ b/source/include/acdisasm.h
@@ -634,9 +634,16 @@ AcpiDmIsPldBuffer (
/*
- * dmextern
+ * dmdeferred
*/
+ACPI_STATUS
+AcpiDmParseDeferredOps (
+ ACPI_PARSE_OBJECT *Root);
+
+/*
+ * dmextern
+ */
ACPI_STATUS
AcpiDmAddToExternalFileList (
char *PathList);
@@ -701,6 +708,7 @@ AcpiDmResourceTemplate (
ACPI_STATUS
AcpiDmIsResourceTemplate (
+ ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op);
void
diff --git a/source/include/acmacros.h b/source/include/acmacros.h
index 8a0e3842a1a9..9b446719dfa3 100644
--- a/source/include/acmacros.h
+++ b/source/include/acmacros.h
@@ -50,14 +50,18 @@
* get into potential aligment issues -- see the STORE macros below.
* Use with care.
*/
-#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
-#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
-#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
-#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
-#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
-#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
-#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
-#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
+#define ACPI_CAST8(ptr) ACPI_CAST_PTR (UINT8, (ptr))
+#define ACPI_CAST16(ptr) ACPI_CAST_PTR (UINT16, (ptr))
+#define ACPI_CAST32(ptr) ACPI_CAST_PTR (UINT32, (ptr))
+#define ACPI_CAST64(ptr) ACPI_CAST_PTR (UINT64, (ptr))
+#define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr))
+#define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr))
+#define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr))
+#define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr))
+#define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (UINT8) (val))
+#define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (UINT16) (val))
+#define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (UINT32) (val))
+#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val))
/*
* printf() format helpers
@@ -296,6 +300,20 @@
#define ACPI_16BIT_MASK 0x0000FFFF
#define ACPI_24BIT_MASK 0x00FFFFFF
+/* Macros to extract flag bits from position zero */
+
+#define ACPI_GET_1BIT_FLAG(Value) ((Value) & ACPI_1BIT_MASK)
+#define ACPI_GET_2BIT_FLAG(Value) ((Value) & ACPI_2BIT_MASK)
+#define ACPI_GET_3BIT_FLAG(Value) ((Value) & ACPI_3BIT_MASK)
+#define ACPI_GET_4BIT_FLAG(Value) ((Value) & ACPI_4BIT_MASK)
+
+/* Macros to extract flag bits from position one and above */
+
+#define ACPI_EXTRACT_1BIT_FLAG(Field, Position) (ACPI_GET_1BIT_FLAG ((Field) >> Position))
+#define ACPI_EXTRACT_2BIT_FLAG(Field, Position) (ACPI_GET_2BIT_FLAG ((Field) >> Position))
+#define ACPI_EXTRACT_3BIT_FLAG(Field, Position) (ACPI_GET_3BIT_FLAG ((Field) >> Position))
+#define ACPI_EXTRACT_4BIT_FLAG(Field, Position) (ACPI_GET_4BIT_FLAG ((Field) >> Position))
+
/*
* An object of type ACPI_NAMESPACE_NODE can appear in some contexts
* where a pointer to an object of type ACPI_OPERAND_OBJECT can also
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index dfc3165c57da..fde6744142e0 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -47,7 +47,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20121018
+#define ACPI_CA_VERSION 0x20121114
#include "acconfig.h"
#include "actypes.h"
diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h
index c2ce4f08b886..07a6076dcf26 100644
--- a/source/include/acrestyp.h
+++ b/source/include/acrestyp.h
@@ -675,7 +675,10 @@ typedef struct acpi_resource
#define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
-#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
+/* Macro for walking resource templates with multiple descriptors */
+
+#define ACPI_NEXT_RESOURCE(Res) \
+ ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
typedef struct acpi_pci_routing_table
diff --git a/source/include/acutils.h b/source/include/acutils.h
index 239126075200..f663a1ecc12e 100644
--- a/source/include/acutils.h
+++ b/source/include/acutils.h
@@ -803,6 +803,7 @@ AcpiUtDisplayInitPathname (
*/
ACPI_STATUS
AcpiUtWalkAmlResources (
+ ACPI_WALK_STATE *WalkState,
UINT8 *Aml,
ACPI_SIZE AmlLength,
ACPI_WALK_AML_CALLBACK UserFunction,
@@ -810,6 +811,7 @@ AcpiUtWalkAmlResources (
ACPI_STATUS
AcpiUtValidateResource (
+ ACPI_WALK_STATE *WalkState,
void *Aml,
UINT8 *ReturnIndex);
diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c
index a0b241f5c4fd..5cbc80f18258 100644
--- a/source/tools/acpibin/abcompare.c
+++ b/source/tools/acpibin/abcompare.c
@@ -48,7 +48,6 @@ FILE *File1;
FILE *File2;
ACPI_TABLE_HEADER Header1;
ACPI_TABLE_HEADER Header2;
-struct stat Gbl_StatBuf;
#define BUFFER_SIZE 256
char Buffer[BUFFER_SIZE];
@@ -74,6 +73,11 @@ static void
AbPrintHeaderInfo (
ACPI_TABLE_HEADER *Header);
+static void
+AbPrintHeadersInfo (
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_HEADER *Header2);
+
ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
void);
@@ -233,6 +237,26 @@ AbPrintHeaderInfo (
printf ("\n");
}
+static void
+AbPrintHeadersInfo (
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_HEADER *Header2)
+{
+
+ /* Display header information for both headers */
+
+ printf ("Signature %8.4s : %4.4s\n", Header->Signature, Header2->Signature);
+ printf ("Length %8.8X : %8.8X\n", Header->Length, Header2->Length);
+ printf ("Revision %8.2X : %2.2X\n", Header->Revision, Header2->Revision);
+ printf ("Checksum %8.2X : %2.2X\n", Header->Checksum, Header2->Checksum);
+ printf ("OEM ID %8.6s : %6.6s\n", Header->OemId, Header2->OemId);
+ printf ("OEM Table ID %8.8s : %8.8s\n", Header->OemTableId, Header2->OemTableId);
+ printf ("OEM Revision %8.8X : %8.8X\n", Header->OemRevision, Header2->OemRevision);
+ printf ("ASL Compiler ID %8.4s : %4.4s\n", Header->AslCompilerId, Header2->AslCompilerId);
+ printf ("Compiler Revision %8.8X : %8.8X\n", Header->AslCompilerRevision, Header2->AslCompilerRevision);
+ printf ("\n");
+}
+
/******************************************************************************
*
@@ -246,7 +270,7 @@ void
AbDisplayHeader (
char *File1Path)
{
- UINT32 Actual1;
+ UINT32 Actual;
File1 = fopen (File1Path, "rb");
@@ -256,8 +280,8 @@ AbDisplayHeader (
return;
}
- Actual1 = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
- if (Actual1 < sizeof (ACPI_TABLE_HEADER))
+ Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
+ if (Actual != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
return;
@@ -284,7 +308,7 @@ void
AbComputeChecksum (
char *File1Path)
{
- UINT32 Actual1;
+ UINT32 Actual;
ACPI_TABLE_HEADER *Table;
UINT8 Checksum;
@@ -296,8 +320,8 @@ AbComputeChecksum (
return;
}
- Actual1 = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
- if (Actual1 < sizeof (ACPI_TABLE_HEADER))
+ Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
+ if (Actual < sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
return;
@@ -325,10 +349,10 @@ AbComputeChecksum (
/* Read the entire table, including header */
fseek (File1, 0, SEEK_SET);
- Actual1 = fread (Table, 1, Header1.Length, File1);
- if (Actual1 < Header1.Length)
+ Actual = fread (Table, 1, Header1.Length, File1);
+ if (Actual != Header1.Length)
{
- printf ("could not read table\n");
+ printf ("could not read table, length %u\n", Header1.Length);
return;
}
@@ -359,8 +383,8 @@ AbComputeChecksum (
Header1.Checksum = Checksum;
- Actual1 = fwrite (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
- if (Actual1 < sizeof (ACPI_TABLE_HEADER))
+ Actual = fwrite (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
+ if (Actual != sizeof (ACPI_TABLE_HEADER))
{
printf ("Could not write updated table header\n");
return;
@@ -410,14 +434,14 @@ AbCompareAmlFiles (
/* Read the ACPI header from each file */
Actual1 = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
- if (Actual1 < sizeof (ACPI_TABLE_HEADER))
+ if (Actual1 != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
return (-1);
}
Actual2 = fread (&Header2, 1, sizeof (ACPI_TABLE_HEADER), File2);
- if (Actual2 < sizeof (ACPI_TABLE_HEADER))
+ if (Actual2 != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File2Path);
return (-1);
@@ -441,8 +465,7 @@ AbCompareAmlFiles (
{
/* Display header information */
- AbPrintHeaderInfo (&Header1);
- AbPrintHeaderInfo (&Header2);
+ AbPrintHeadersInfo (&Header1, &Header2);
}
if (memcmp (&Header1, &Header2, sizeof (ACPI_TABLE_HEADER)))
@@ -457,7 +480,7 @@ AbCompareAmlFiles (
Actual2 = fread (&Char2, 1, 1, File2);
Offset = sizeof (ACPI_TABLE_HEADER);
- while (Actual1 && Actual2)
+ while ((Actual1 == 1) && (Actual2 == 1))
{
if (Char1 != Char2)
{
@@ -505,7 +528,7 @@ AbCompareAmlFiles (
/******************************************************************************
*
- * FUNCTION: AsGetFile
+ * FUNCTION: AbGetFile
*
* DESCRIPTION: Open a file and read it entirely into a new buffer
*
@@ -516,31 +539,37 @@ AbGetFile (
char *Filename,
UINT32 *FileSize)
{
- int FileHandle;
+ FILE *File;
UINT32 Size;
char *Buffer = NULL;
+ int Seek1;
+ int Seek2;
+ size_t Actual;
/* Binary mode does not alter CR/LF pairs */
- FileHandle = open (Filename, O_BINARY | O_RDONLY);
- if (!FileHandle)
+ File = fopen (Filename, "rb");
+ if (!File)
{
- printf ("Could not open %s\n", Filename);
+ printf ("Could not open file %s\n", Filename);
return (NULL);
}
/* Need file size to allocate a buffer */
- if (fstat (FileHandle, &Gbl_StatBuf))
+ Seek1 = fseek (File, 0L, SEEK_END);
+ Size = ftell (File);
+ Seek2 = fseek (File, 0L, SEEK_SET);
+
+ if (Seek1 || Seek2 || (Size == -1))
{
- printf ("Could not get file status for %s\n", Filename);
+ printf ("Could not get file size (seek) for %s\n", Filename);
goto ErrorExit;
}
/* Allocate a buffer for the entire file */
- Size = Gbl_StatBuf.st_size;
Buffer = calloc (Size, 1);
if (!Buffer)
{
@@ -550,8 +579,8 @@ AbGetFile (
/* Read the entire file */
- Size = read (FileHandle, Buffer, Size);
- if (Size == -1)
+ Actual = fread (Buffer, 1, Size, File);
+ if (Actual != Size)
{
printf ("Could not read the input file %s\n", Filename);
free (Buffer);
@@ -562,8 +591,7 @@ AbGetFile (
*FileSize = Size;
ErrorExit:
- close (FileHandle);
-
+ fclose (File);
return (Buffer);
}
@@ -594,7 +622,7 @@ AbDumpAmlFile (
FileOutHandle = fopen (File2Path, "wb");
if (!FileOutHandle)
{
- printf ("Could not open %s\n", File2Path);
+ printf ("Could not open file %s\n", File2Path);
return (-1);
}
@@ -608,7 +636,9 @@ AbDumpAmlFile (
AcpiGbl_DebugFile = FileOutHandle;
AcpiGbl_DbOutputFlags = ACPI_DB_REDIRECTABLE_OUTPUT;
- AcpiOsPrintf ("%4.4s\n", ((ACPI_TABLE_HEADER *) FileBuffer)->Signature);
+ AcpiOsPrintf ("%4.4s @ 0x%8.8X\n",
+ ((ACPI_TABLE_HEADER *) FileBuffer)->Signature, 0);
+
AcpiDbgLevel = ACPI_UINT32_MAX;
AcpiUtDebugDumpBuffer ((UINT8 *) FileBuffer, FileSize,
DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
@@ -622,7 +652,7 @@ AbDumpAmlFile (
* FUNCTION: AbExtractAmlFile
*
* DESCRIPTION: Extract a binary AML file from a text file (as produced by the
- * DumpAmlFile procedure or the "acpidmp" table utility.
+ * DumpAmlFile procedure or the "acpidump" table utility.
*
******************************************************************************/
@@ -646,14 +676,14 @@ AbExtractAmlFile (
FileHandle = fopen (File1Path, "rt");
if (!FileHandle)
{
- printf ("Could not open %s\n", File1Path);
+ printf ("Could not open file %s\n", File1Path);
return (-1);
}
FileOutHandle = fopen (File2Path, "w+b");
if (!FileOutHandle)
{
- printf ("Could not open %s\n", File2Path);
+ printf ("Could not open file %s\n", File2Path);
return (-1);
}
@@ -709,7 +739,7 @@ AbExtractAmlFile (
/* Write the converted (binary) byte */
- if (fwrite (&Value, 1, 1, FileOutHandle) < 1)
+ if (fwrite (&Value, 1, 1, FileOutHandle) != 1)
{
printf ("Error writing byte %u to output file: %s\n",
Count, File2Path);
diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c
index b09ab846747f..c022688f66b6 100644
--- a/source/tools/acpibin/abmain.c
+++ b/source/tools/acpibin/abmain.c
@@ -73,9 +73,9 @@ AbDisplayUsage (
ACPI_USAGE_HEADER ("acpibin [options]");
- ACPI_OPTION ("-c <File1><File2>", "Compare two AML files");
+ 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 AcpiDmp 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");
diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h
index e831f5109873..abb8f210d791 100644
--- a/source/tools/acpibin/acpibin.h
+++ b/source/tools/acpibin/acpibin.h
@@ -45,30 +45,15 @@
#include "accommon.h"
#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <fcntl.h>
-#include <ctype.h>
#include <errno.h>
-#ifdef WIN32
-#include <stdlib.h>
-#include <io.h>
-#include <direct.h>
-#endif
-
-/* O_BINARY is not always defined */
-#ifndef O_BINARY
-#define O_BINARY 0x0
-#endif
-
#define DB_CONSOLE_OUTPUT 0x02
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
/*
* Global variables. Defined in main.c only, externed in all other files
*/
-
#ifdef _DECLARE_GLOBALS
#define EXTERN
#define INIT_GLOBAL(a,b) a=b
diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h
index 1d2e8dc50124..e628f34ae702 100644
--- a/source/tools/acpisrc/acpisrc.h
+++ b/source/tools/acpisrc/acpisrc.h
@@ -41,35 +41,19 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define LINES_IN_LEGAL_HEADER 105 /* See above */
-#define LEGAL_HEADER_SIGNATURE " * 2.1. This is your license from Intel Corp. under its intellectual property"
-#define LINES_IN_LINUX_HEADER 34
-#define LINUX_HEADER_SIGNATURE " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"
-#define LINES_IN_ASL_HEADER 29 /* Header as output from disassembler */
-
#include "acpi.h"
#include "accommon.h"
#include <stdio.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <ctype.h>
-#ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#endif
#include <errno.h>
+/* mkdir/strlwr support */
-/* O_BINARY is not always defined */
-#ifndef O_BINARY
-#define O_BINARY 0x0
-#endif
+#ifdef WIN32
+#include <direct.h>
-/* Fixups for non-Win32 compilation */
-#ifndef WIN32
+#else
#define mkdir(x) mkdir(x, 0770)
char * strlwr(char* str);
#endif
@@ -77,6 +61,12 @@ char * strlwr(char* str);
/* Constants */
+#define LINES_IN_LEGAL_HEADER 105 /* See above */
+#define LEGAL_HEADER_SIGNATURE " * 2.1. This is your license from Intel Corp. under its intellectual property"
+#define LINES_IN_LINUX_HEADER 34
+#define LINUX_HEADER_SIGNATURE " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"
+#define LINES_IN_ASL_HEADER 29 /* Header as output from disassembler */
+
#define ASRC_MAX_FILE_SIZE (1024 * 100)
#define FILE_TYPE_SOURCE 1
diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c
index 70be229928ea..f5b09338e5ec 100644
--- a/source/tools/acpisrc/asfile.c
+++ b/source/tools/acpisrc/asfile.c
@@ -698,24 +698,32 @@ AsGetFile (
char **FileBuffer,
UINT32 *FileSize)
{
-
- int FileHandle;
+ FILE *File;
UINT32 Size;
char *Buffer;
+ int Seek1;
+ int Seek2;
+ size_t Actual;
/* Binary mode leaves CR/LF pairs */
- FileHandle = open (Filename, O_BINARY | O_RDONLY);
- if (!FileHandle)
+ File = fopen (Filename, "rb");
+ if (!File)
{
- printf ("Could not open %s\n", Filename);
+ printf ("Could not open file %s\n", Filename);
return (-1);
}
- if (fstat (FileHandle, &Gbl_StatBuf))
+ /* Need file size to allocate a buffer */
+
+ Seek1 = fseek (File, 0L, SEEK_END);
+ Size = ftell (File);
+ Seek2 = fseek (File, 0L, SEEK_SET);
+
+ if (Seek1 || Seek2 || (Size == -1))
{
- printf ("Could not get file status for %s\n", Filename);
+ printf ("Could not get file size for %s\n", Filename);
goto ErrorExit;
}
@@ -723,7 +731,6 @@ AsGetFile (
* Create a buffer for the entire file
* Add plenty extra buffer to accommodate string replacements
*/
- Size = Gbl_StatBuf.st_size;
Gbl_TotalSize += Size;
Buffer = calloc (Size * 2, 1);
@@ -735,15 +742,16 @@ AsGetFile (
/* Read the entire file */
- Size = read (FileHandle, Buffer, Size);
- if (Size == -1)
+ Actual = fread (Buffer, 1, Size, File);
+ if (Actual != Size)
{
- printf ("Could not read the input file %s\n", Filename);
+ printf ("Could not read the input file %s (%u bytes)\n",
+ Filename, Size);
goto ErrorExit;
}
Buffer [Size] = 0; /* Null terminate the buffer */
- close (FileHandle);
+ fclose (File);
/* Check for unix contamination */
@@ -757,13 +765,12 @@ AsGetFile (
*FileBuffer = Buffer;
*FileSize = Size;
-
return (0);
ErrorExit:
- close (FileHandle);
+ fclose (File);
return (-1);
}
@@ -783,15 +790,14 @@ AsPutFile (
char *FileBuffer,
UINT32 SystemFlags)
{
+ FILE *File;
UINT32 FileSize;
- int DestHandle;
- int OpenFlags;
+ size_t Actual;
+ int Status = 0;
/* Create the target file */
- OpenFlags = O_TRUNC | O_CREAT | O_WRONLY | O_BINARY;
-
if (!(SystemFlags & FLG_NO_CARRIAGE_RETURNS))
{
/* Put back the CR before each LF */
@@ -799,8 +805,8 @@ AsPutFile (
AsInsertCarriageReturns (FileBuffer);
}
- DestHandle = open (Pathname, OpenFlags, S_IREAD | S_IWRITE);
- if (DestHandle == -1)
+ File = fopen (Pathname, "w+b");
+ if (!File)
{
perror ("Could not create destination file");
printf ("Could not create destination file \"%s\"\n", Pathname);
@@ -810,9 +816,13 @@ AsPutFile (
/* Write the buffer to the file */
FileSize = strlen (FileBuffer);
- write (DestHandle, FileBuffer, FileSize);
-
- close (DestHandle);
+ Actual = fwrite (FileBuffer, 1, FileSize, File);
+ if (Actual != FileSize)
+ {
+ printf ("Error writing output file \"%s\"\n", Pathname);
+ Status = -1;
+ }
- return (0);
+ fclose (File);
+ return (Status);
}
diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c
index ef5b28a1d91b..e7a60dc20dde 100644
--- a/source/tools/acpixtract/acpixtract.c
+++ b/source/tools/acpixtract/acpixtract.c
@@ -335,7 +335,7 @@ AxCountTableInstances (
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
- printf ("Could not open %s\n", InputPathname);
+ printf ("Could not open file %s\n", InputPathname);
return (0);
}
@@ -465,7 +465,7 @@ AxExtractTables (
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
- printf ("Could not open %s\n", InputPathname);
+ printf ("Could not open file %s\n", InputPathname);
return (-1);
}
@@ -560,7 +560,7 @@ AxExtractTables (
OutputFile = fopen (Filename, "w+b");
if (!OutputFile)
{
- printf ("Could not open %s\n", Filename);
+ printf ("Could not open file %s\n", Filename);
Status = -1;
goto CleanupAndExit;
}
@@ -595,7 +595,7 @@ AxExtractTables (
BytesWritten = fwrite (Data, 1, BytesConverted, OutputFile);
if (BytesWritten != BytesConverted)
{
- printf ("Write error on %s\n", Filename);
+ printf ("Error when writing file %s\n", Filename);
fclose (OutputFile);
OutputFile = NULL;
Status = -1;
@@ -665,7 +665,7 @@ AxListTables (
InputFile = fopen (InputPathname, "rt");
if (!InputFile)
{
- printf ("Could not open %s\n", InputPathname);
+ printf ("Could not open file %s\n", InputPathname);
return (-1);
}