[ACPICA]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 10 Nov 2015 16:56:46 +0000 (16:56 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 10 Nov 2015 16:56:46 +0000 (16:56 +0000)
- Update to version 20150930
CORE-10509 #resolve

svn path=/trunk/; revision=69870

137 files changed:
reactos/drivers/bus/acpi/CMakeLists.txt
reactos/drivers/bus/acpi/acpica/dispatcher/dsargs.c
reactos/drivers/bus/acpi/acpica/dispatcher/dscontrol.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsdebug.c [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/dispatcher/dsfield.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsinit.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsmethod.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsobject.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsopcode.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsutils.c
reactos/drivers/bus/acpi/acpica/dispatcher/dswload.c
reactos/drivers/bus/acpi/acpica/dispatcher/dswload2.c
reactos/drivers/bus/acpi/acpica/events/evgpe.c
reactos/drivers/bus/acpi/acpica/events/evgpeinit.c
reactos/drivers/bus/acpi/acpica/events/evregion.c
reactos/drivers/bus/acpi/acpica/executer/exconfig.c
reactos/drivers/bus/acpi/acpica/executer/exconvrt.c
reactos/drivers/bus/acpi/acpica/executer/excreate.c
reactos/drivers/bus/acpi/acpica/executer/exdebug.c
reactos/drivers/bus/acpi/acpica/executer/exdump.c
reactos/drivers/bus/acpi/acpica/executer/exfield.c
reactos/drivers/bus/acpi/acpica/executer/exfldio.c
reactos/drivers/bus/acpi/acpica/executer/exmisc.c
reactos/drivers/bus/acpi/acpica/executer/exnames.c
reactos/drivers/bus/acpi/acpica/executer/exoparg2.c
reactos/drivers/bus/acpi/acpica/executer/exoparg3.c
reactos/drivers/bus/acpi/acpica/executer/exregion.c
reactos/drivers/bus/acpi/acpica/executer/exresnte.c
reactos/drivers/bus/acpi/acpica/executer/exresolv.c
reactos/drivers/bus/acpi/acpica/executer/exresop.c
reactos/drivers/bus/acpi/acpica/executer/exstore.c
reactos/drivers/bus/acpi/acpica/executer/exstoren.c
reactos/drivers/bus/acpi/acpica/executer/exstorob.c
reactos/drivers/bus/acpi/acpica/executer/exutils.c
reactos/drivers/bus/acpi/acpica/hardware/hwgpe.c
reactos/drivers/bus/acpi/acpica/hardware/hwpci.c
reactos/drivers/bus/acpi/acpica/hardware/hwxfsleep.c
reactos/drivers/bus/acpi/acpica/include/acapps.h
reactos/drivers/bus/acpi/acpica/include/acbuffer.h
reactos/drivers/bus/acpi/acpica/include/acclib.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/include/accommon.h
reactos/drivers/bus/acpi/acpica/include/acconfig.h
reactos/drivers/bus/acpi/acpica/include/acdebug.h
reactos/drivers/bus/acpi/acpica/include/acdisasm.h
reactos/drivers/bus/acpi/acpica/include/acdispat.h
reactos/drivers/bus/acpi/acpica/include/acexcep.h
reactos/drivers/bus/acpi/acpica/include/acglobal.h
reactos/drivers/bus/acpi/acpica/include/acinterp.h
reactos/drivers/bus/acpi/acpica/include/aclocal.h
reactos/drivers/bus/acpi/acpica/include/acmacros.h
reactos/drivers/bus/acpi/acpica/include/acnames.h
reactos/drivers/bus/acpi/acpica/include/acnamesp.h
reactos/drivers/bus/acpi/acpica/include/acobject.h
reactos/drivers/bus/acpi/acpica/include/acopcode.h
reactos/drivers/bus/acpi/acpica/include/acoutput.h
reactos/drivers/bus/acpi/acpica/include/acparser.h
reactos/drivers/bus/acpi/acpica/include/acpiosxf.h
reactos/drivers/bus/acpi/acpica/include/acpixf.h
reactos/drivers/bus/acpi/acpica/include/acpredef.h
reactos/drivers/bus/acpi/acpica/include/acstruct.h
reactos/drivers/bus/acpi/acpica/include/actables.h
reactos/drivers/bus/acpi/acpica/include/actbl.h
reactos/drivers/bus/acpi/acpica/include/actbl1.h
reactos/drivers/bus/acpi/acpica/include/actbl2.h
reactos/drivers/bus/acpi/acpica/include/actbl3.h
reactos/drivers/bus/acpi/acpica/include/actypes.h
reactos/drivers/bus/acpi/acpica/include/acutils.h
reactos/drivers/bus/acpi/acpica/include/acuuid.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/include/amlcode.h
reactos/drivers/bus/acpi/acpica/include/platform/acefi.h
reactos/drivers/bus/acpi/acpica/include/platform/acefiex.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/include/platform/acenv.h
reactos/drivers/bus/acpi/acpica/include/platform/acenvex.h
reactos/drivers/bus/acpi/acpica/include/platform/acgcc.h
reactos/drivers/bus/acpi/acpica/include/platform/acmsvc.h
reactos/drivers/bus/acpi/acpica/include/platform/acmsvcex.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/include/platform/acwinex.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/namespace/nsaccess.c
reactos/drivers/bus/acpi/acpica/namespace/nsconvert.c
reactos/drivers/bus/acpi/acpica/namespace/nsdump.c
reactos/drivers/bus/acpi/acpica/namespace/nseval.c
reactos/drivers/bus/acpi/acpica/namespace/nsinit.c
reactos/drivers/bus/acpi/acpica/namespace/nsload.c
reactos/drivers/bus/acpi/acpica/namespace/nsnames.c
reactos/drivers/bus/acpi/acpica/namespace/nsparse.c
reactos/drivers/bus/acpi/acpica/namespace/nspredef.c
reactos/drivers/bus/acpi/acpica/namespace/nsprepkg.c
reactos/drivers/bus/acpi/acpica/namespace/nsrepair.c
reactos/drivers/bus/acpi/acpica/namespace/nsrepair2.c
reactos/drivers/bus/acpi/acpica/namespace/nssearch.c
reactos/drivers/bus/acpi/acpica/namespace/nsutils.c
reactos/drivers/bus/acpi/acpica/namespace/nsxfeval.c
reactos/drivers/bus/acpi/acpica/namespace/nsxfname.c
reactos/drivers/bus/acpi/acpica/parser/psargs.c
reactos/drivers/bus/acpi/acpica/parser/psloop.c
reactos/drivers/bus/acpi/acpica/parser/psobject.c
reactos/drivers/bus/acpi/acpica/parser/psopinfo.c
reactos/drivers/bus/acpi/acpica/parser/psparse.c
reactos/drivers/bus/acpi/acpica/parser/psutils.c
reactos/drivers/bus/acpi/acpica/parser/psxface.c
reactos/drivers/bus/acpi/acpica/resources/rscreate.c
reactos/drivers/bus/acpi/acpica/resources/rsdump.c
reactos/drivers/bus/acpi/acpica/resources/rsmisc.c
reactos/drivers/bus/acpi/acpica/resources/rsutils.c
reactos/drivers/bus/acpi/acpica/resources/rsxface.c
reactos/drivers/bus/acpi/acpica/tables/tbdata.c
reactos/drivers/bus/acpi/acpica/tables/tbfadt.c
reactos/drivers/bus/acpi/acpica/tables/tbfind.c
reactos/drivers/bus/acpi/acpica/tables/tbinstal.c
reactos/drivers/bus/acpi/acpica/tables/tbprint.c
reactos/drivers/bus/acpi/acpica/tables/tbutils.c
reactos/drivers/bus/acpi/acpica/tables/tbxface.c
reactos/drivers/bus/acpi/acpica/tables/tbxfload.c
reactos/drivers/bus/acpi/acpica/utilities/utalloc.c
reactos/drivers/bus/acpi/acpica/utilities/utbuffer.c
reactos/drivers/bus/acpi/acpica/utilities/utcache.c
reactos/drivers/bus/acpi/acpica/utilities/utclib.c
reactos/drivers/bus/acpi/acpica/utilities/utcopy.c
reactos/drivers/bus/acpi/acpica/utilities/utdebug.c
reactos/drivers/bus/acpi/acpica/utilities/utdecode.c
reactos/drivers/bus/acpi/acpica/utilities/utdelete.c
reactos/drivers/bus/acpi/acpica/utilities/utfileio.c
reactos/drivers/bus/acpi/acpica/utilities/uthex.c
reactos/drivers/bus/acpi/acpica/utilities/utids.c
reactos/drivers/bus/acpi/acpica/utilities/utinit.c
reactos/drivers/bus/acpi/acpica/utilities/utmisc.c
reactos/drivers/bus/acpi/acpica/utilities/utmutex.c
reactos/drivers/bus/acpi/acpica/utilities/utnonansi.c [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/utilities/utosi.c
reactos/drivers/bus/acpi/acpica/utilities/utpredef.c
reactos/drivers/bus/acpi/acpica/utilities/utprint.c
reactos/drivers/bus/acpi/acpica/utilities/utstring.c
reactos/drivers/bus/acpi/acpica/utilities/uttrack.c
reactos/drivers/bus/acpi/acpica/utilities/utxface.c
reactos/drivers/bus/acpi/acpica/utilities/utxferror.c
reactos/drivers/bus/acpi/acpica/utilities/utxfinit.c
reactos/drivers/bus/acpi/busmgr/system.c

index fcf9329..a4dc55d 100644 (file)
@@ -10,6 +10,7 @@ endif()
 list(APPEND ACPICA_SOURCE
     acpica/dispatcher/dsargs.c
     acpica/dispatcher/dscontrol.c
+    acpica/dispatcher/dsdebug.c
     acpica/dispatcher/dsfield.c
     acpica/dispatcher/dsinit.c
     acpica/dispatcher/dsmethod.c
@@ -146,6 +147,7 @@ list(APPEND ACPICA_SOURCE
     acpica/utilities/utmath.c
     acpica/utilities/utmisc.c
     acpica/utilities/utmutex.c
+    acpica/utilities/utnonansi.c
     acpica/utilities/utobject.c
     acpica/utilities/utosi.c
     acpica/utilities/utownerid.c
index 8acb5dc..344e55e 100644 (file)
@@ -166,7 +166,7 @@ AcpiDsExecuteArguments (
 
     /* Allocate a new parser op to be the root of the parsed tree */
 
-    Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+    Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
     if (!Op)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
@@ -213,7 +213,7 @@ AcpiDsExecuteArguments (
 
     /* Evaluate the deferred arguments */
 
-    Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+    Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
     if (!Op)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
index 218cbe9..a069ed5 100644 (file)
@@ -293,7 +293,7 @@ AcpiDsExecEndControlOp (
              * loop does not implement a timeout.
              */
             ControlState->Control.LoopCount++;
-            if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
+            if (ControlState->Control.LoopCount > AcpiGbl_MaxLoopIterations)
             {
                 Status = AE_AML_INFINITE_LOOP;
                 break;
diff --git a/reactos/drivers/bus/acpi/acpica/dispatcher/dsdebug.c b/reactos/drivers/bus/acpi/acpica/dispatcher/dsdebug.c
new file mode 100644 (file)
index 0000000..80b3e0c
--- /dev/null
@@ -0,0 +1,321 @@
+/******************************************************************************
+ *
+ * Module Name: dsdebug - Parser/Interpreter interface - debugging
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acdisasm.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT          ACPI_DISPATCHER
+        ACPI_MODULE_NAME    ("dsdebug")
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/* Local prototypes */
+
+static void
+AcpiDsPrintNodePathname (
+    ACPI_NAMESPACE_NODE     *Node,
+    const char              *Message);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDsPrintNodePathname
+ *
+ * PARAMETERS:  Node            - Object
+ *              Message         - Prefix message
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ *              Manages allocation/freeing of a pathname buffer
+ *
+ ******************************************************************************/
+
+static void
+AcpiDsPrintNodePathname (
+    ACPI_NAMESPACE_NODE     *Node,
+    const char              *Message)
+{
+    ACPI_BUFFER             Buffer;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (DsPrintNodePathname);
+
+    if (!Node)
+    {
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]"));
+        return_VOID;
+    }
+
+    /* Convert handle to full pathname and print it (with supplied message) */
+
+    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+    Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE);
+    if (ACPI_SUCCESS (Status))
+    {
+        if (Message)
+        {
+            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message));
+        }
+
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)",
+            (char *) Buffer.Pointer, Node));
+        ACPI_FREE (Buffer.Pointer);
+    }
+
+    return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDsDumpMethodStack
+ *
+ * PARAMETERS:  Status          - Method execution status
+ *              WalkState       - Current state of the parse tree walk
+ *              Op              - Executing parse op
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Called when a method has been aborted because of an error.
+ *              Dumps the method execution stack.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsDumpMethodStack (
+    ACPI_STATUS             Status,
+    ACPI_WALK_STATE         *WalkState,
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *Next;
+    ACPI_THREAD_STATE       *Thread;
+    ACPI_WALK_STATE         *NextWalkState;
+    ACPI_NAMESPACE_NODE     *PreviousMethod = NULL;
+    ACPI_OPERAND_OBJECT     *MethodDesc;
+
+
+    ACPI_FUNCTION_TRACE (DsDumpMethodStack);
+
+    /* Ignore control codes, they are not errors */
+
+    if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
+    {
+        return_VOID;
+    }
+
+    /* We may be executing a deferred opcode */
+
+    if (WalkState->DeferredNode)
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+            "Executing subtree for Buffer/Package/Region\n"));
+        return_VOID;
+    }
+
+    /*
+     * If there is no Thread, we are not actually executing a method.
+     * This can happen when the iASL compiler calls the interpreter
+     * to perform constant folding.
+     */
+    Thread = WalkState->Thread;
+    if (!Thread)
+    {
+        return_VOID;
+    }
+
+    /* Display exception and method name */
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+        "\n**** Exception %s during execution of method ",
+        AcpiFormatException (Status)));
+    AcpiDsPrintNodePathname (WalkState->MethodNode, NULL);
+
+    /* Display stack of executing methods */
+
+    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH,
+        "\n\nMethod Execution Stack:\n"));
+    NextWalkState = Thread->WalkStateList;
+
+    /* Walk list of linked walk states */
+
+    while (NextWalkState)
+    {
+        MethodDesc = NextWalkState->MethodDesc;
+        if (MethodDesc)
+        {
+            AcpiExStopTraceMethod (
+                    (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
+                    MethodDesc, WalkState);
+        }
+
+        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+            "    Method [%4.4s] executing: ",
+            AcpiUtGetNodeName (NextWalkState->MethodNode)));
+
+        /* First method is the currently executing method */
+
+        if (NextWalkState == WalkState)
+        {
+            if (Op)
+            {
+                /* Display currently executing ASL statement */
+
+                Next = Op->Common.Next;
+                Op->Common.Next = NULL;
+
+#ifdef ACPI_DISASSEMBLER
+                AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+#endif
+                Op->Common.Next = Next;
+            }
+        }
+        else
+        {
+            /*
+             * This method has called another method
+             * NOTE: the method call parse subtree is already deleted at this
+             * point, so we cannot disassemble the method invocation.
+             */
+            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method "));
+            AcpiDsPrintNodePathname (PreviousMethod, NULL);
+        }
+
+        PreviousMethod = NextWalkState->MethodNode;
+        NextWalkState = NextWalkState->Next;
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n"));
+    }
+
+    return_VOID;
+}
+
+#else
+
+void
+AcpiDsDumpMethodStack (
+    ACPI_STATUS             Status,
+    ACPI_WALK_STATE         *WalkState,
+    ACPI_PARSE_OBJECT       *Op)
+{
+    return;
+}
+
+#endif
index 37d4cc1..cf8c189 100644 (file)
@@ -602,7 +602,7 @@ AcpiDsCreateField (
         }
     }
 
-    ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
+    memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
 
     /* Second arg is the field flags */
 
index 585e127..d24cc01 100644 (file)
@@ -296,7 +296,7 @@ AcpiDsInitializeObjects (
 
     /* Set all init info to zero */
 
-    ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
+    memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 
     Info.OwnerId = OwnerId;
     Info.TableIndex = TableIndex;
@@ -327,10 +327,19 @@ AcpiDsInitializeObjects (
         return_ACPI_STATUS (Status);
     }
 
+    /* DSDT is always the first AML table */
+
+    if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
+    {
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\nInitializing Namespace objects:\n"));
+    }
+
+    /* Summary of objects initialized */
+
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, "
-        "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n",
-        Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount,
+        "Table [%4.4s:%8.8s] (id %.2X) - %4u Objects with %3u Devices, "
+        "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n",
+        Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, Info.DeviceCount,
         Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount,
         Info.NonSerialMethodCount, Info.SerializedMethodCount));
 
index 43ee55d..10c3548 100644 (file)
 #include "acdispat.h"
 #include "acinterp.h"
 #include "acnamesp.h"
-#include "acdisasm.h"
 #include "acparser.h"
 #include "amlcode.h"
+#include "acdebug.h"
 
 
 #define _COMPONENT          ACPI_DISPATCHER
@@ -181,7 +181,7 @@ AcpiDsAutoSerializeMethod (
 
     /* Create/Init a root op for the method parse tree */
 
-    Op = AcpiPsAllocOp (AML_METHOD_OP);
+    Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
     if (!Op)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
@@ -195,6 +195,7 @@ AcpiDsAutoSerializeMethod (
     WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL);
     if (!WalkState)
     {
+        AcpiPsFreeOp (Op);
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
@@ -203,6 +204,7 @@ AcpiDsAutoSerializeMethod (
     if (ACPI_FAILURE (Status))
     {
         AcpiDsDeleteWalkState (WalkState);
+        AcpiPsFreeOp (Op);
         return_ACPI_STATUS (Status);
     }
 
@@ -211,10 +213,6 @@ AcpiDsAutoSerializeMethod (
     /* Parse the method, scan for creation of named objects */
 
     Status = AcpiPsParseAml (WalkState);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
 
     AcpiPsDeleteParseTree (Op);
     return_ACPI_STATUS (Status);
@@ -287,7 +285,7 @@ AcpiDsDetectNamedOpcodes (
  * RETURN:      Status
  *
  * DESCRIPTION: Called on method error. Invoke the global exception handler if
- *              present, dump the method data if the disassembler is configured
+ *              present, dump the method data if the debugger is configured
  *
  *              Note: Allows the exception handler to change the status code
  *
@@ -298,6 +296,9 @@ AcpiDsMethodError (
     ACPI_STATUS             Status,
     ACPI_WALK_STATE         *WalkState)
 {
+    UINT32                  AmlOffset;
+
+
     ACPI_FUNCTION_ENTRY ();
 
 
@@ -321,23 +322,28 @@ AcpiDsMethodError (
          * Handler can map the exception code to anything it wants, including
          * AE_OK, in which case the executing method will not be aborted.
          */
+        AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+                        WalkState->ParserState.AmlStart);
+
         Status = AcpiGbl_ExceptionHandler (Status,
                     WalkState->MethodNode ?
                         WalkState->MethodNode->Name.Integer : 0,
-                    WalkState->Opcode, WalkState->AmlOffset, NULL);
+                    WalkState->Opcode, AmlOffset, NULL);
         AcpiExEnterInterpreter ();
     }
 
     AcpiDsClearImplicitReturn (WalkState);
 
-#ifdef ACPI_DISASSEMBLER
     if (ACPI_FAILURE (Status))
     {
-        /* Display method locals/args if disassembler is present */
+        AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op);
 
-        AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op);
-    }
+        /* Display method locals/args if debugger is present */
+
+#ifdef ACPI_DEBUGGER
+        AcpiDbDumpMethodInfo (Status, WalkState);
 #endif
+    }
 
     return (Status);
 }
@@ -423,6 +429,8 @@ AcpiDsBeginMethodExecution (
         return_ACPI_STATUS (AE_NULL_ENTRY);
     }
 
+    AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState);
+
     /* Prevent wraparound of thread count */
 
     if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
@@ -684,10 +692,7 @@ Cleanup:
     /* On error, we must terminate the method properly */
 
     AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
-    if (NextWalkState)
-    {
-        AcpiDsDeleteWalkState (NextWalkState);
-    }
+    AcpiDsDeleteWalkState (NextWalkState);
 
     return_ACPI_STATUS (Status);
 }
@@ -944,5 +949,8 @@ AcpiDsTerminateControlMethod (
         }
     }
 
+    AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
+            MethodDesc, WalkState);
+
     return_VOID;
 }
index b5cad38..0eb2f44 100644 (file)
@@ -420,7 +420,7 @@ AcpiDsBuildInternalBufferObj (
 
         if (ByteList)
         {
-            ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
+            memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
                          ByteListLength);
         }
     }
@@ -847,7 +847,7 @@ AcpiDsInitObjectFromOp (
     case ACPI_TYPE_STRING:
 
         ObjDesc->String.Pointer = Op->Common.Value.String;
-        ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String);
+        ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String);
 
         /*
          * The string is contained in the ACPI table, don't ever try
index 6a7a559..6e2c784 100644 (file)
@@ -585,8 +585,8 @@ AcpiDsEvalTableRegionOperands (
     ACPI_OPERAND_OBJECT     **Operand;
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_PARSE_OBJECT       *NextOp;
-    UINT32                  TableIndex;
     ACPI_TABLE_HEADER       *Table;
+    UINT32                  TableIndex;
 
 
     ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
@@ -612,6 +612,8 @@ AcpiDsEvalTableRegionOperands (
         return_ACPI_STATUS (Status);
     }
 
+    Operand = &WalkState->Operands[0];
+
     /*
      * Resolve the Signature string, OemId string,
      * and OemTableId string operands
@@ -620,49 +622,57 @@ AcpiDsEvalTableRegionOperands (
                 ACPI_WALK_OPERANDS, WalkState);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        goto Cleanup;
     }
 
-    Operand = &WalkState->Operands[0];
-
     /* Find the ACPI table */
 
-    Status = AcpiTbFindTable (Operand[0]->String.Pointer,
-                Operand[1]->String.Pointer, Operand[2]->String.Pointer,
-                &TableIndex);
+    Status = AcpiTbFindTable (
+                Operand[0]->String.Pointer,
+                Operand[1]->String.Pointer,
+                Operand[2]->String.Pointer, &TableIndex);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        if (Status == AE_NOT_FOUND)
+        {
+            ACPI_ERROR ((AE_INFO,
+                "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
+                Operand[0]->String.Pointer,
+                Operand[1]->String.Pointer,
+                Operand[2]->String.Pointer));
+        }
+        goto Cleanup;
     }
 
-    AcpiUtRemoveReference (Operand[0]);
-    AcpiUtRemoveReference (Operand[1]);
-    AcpiUtRemoveReference (Operand[2]);
-
     Status = AcpiGetTableByIndex (TableIndex, &Table);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        goto Cleanup;
     }
 
     ObjDesc = AcpiNsGetAttachedObject (Node);
     if (!ObjDesc)
     {
-        return_ACPI_STATUS (AE_NOT_EXIST);
+        Status = AE_NOT_EXIST;
+        goto Cleanup;
     }
 
     ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
     ObjDesc->Region.Length = Table->Length;
 
     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
-        ObjDesc,
-        ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
+        ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
         ObjDesc->Region.Length));
 
     /* Now the address and length are valid for this opregion */
 
     ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
 
+Cleanup:
+    AcpiUtRemoveReference (Operand[0]);
+    AcpiUtRemoveReference (Operand[1]);
+    AcpiUtRemoveReference (Operand[2]);
+
     return_ACPI_STATUS (Status);
 }
 
index 0269916..0ba26fa 100644 (file)
@@ -677,7 +677,7 @@ AcpiDsCreateOperand (
 
                     ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength);
 
-                    ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength);
+                    strncpy (ObjDesc->String.Pointer, NameString, NameLength);
                     Status = AE_OK;
                 }
                 else
index be090fc..a984075 100644 (file)
@@ -397,9 +397,18 @@ AcpiDsLoad1BeginOp (
         if ((WalkState->Opcode != AML_SCOPE_OP) &&
             (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
         {
-            Flags |= ACPI_NS_ERROR_IF_FOUND;
-            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
-                    AcpiUtGetTypeName (ObjectType)));
+            if (WalkState->NamespaceOverride)
+            {
+                Flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+                ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n",
+                        AcpiUtGetTypeName (ObjectType)));
+            }
+            else
+            {
+                Flags |= ACPI_NS_ERROR_IF_FOUND;
+                ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
+                        AcpiUtGetTypeName (ObjectType)));
+            }
         }
         else
         {
@@ -461,7 +470,7 @@ AcpiDsLoad1BeginOp (
     {
         /* Create a new op */
 
-        Op = AcpiPsAllocOp (WalkState->Opcode);
+        Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
         if (!Op)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
index 312b2cd..d5f9b1c 100644 (file)
@@ -416,7 +416,7 @@ AcpiDsLoad2BeginOp (
     {
         /* Create a new op */
 
-        Op = AcpiPsAllocOp (WalkState->Opcode);
+        Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
         if (!Op)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
index 16428d6..4dceaa4 100644 (file)
@@ -176,6 +176,7 @@ AcpiEvUpdateGpeEnableMask (
     {
         ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit);
     }
+    GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun;
 
     return_ACPI_STATUS (AE_OK);
 }
@@ -213,7 +214,7 @@ AcpiEvEnableGpe (
 
     /* Enable the requested GPE */
 
-    Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE_SAVE);
+    Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
     return_ACPI_STATUS (Status);
 }
 
@@ -303,7 +304,7 @@ AcpiEvRemoveGpeReference (
         Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
         if (ACPI_SUCCESS (Status))
         {
-            Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE_SAVE);
+            Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
         }
 
         if (ACPI_FAILURE (Status))
index 5848b75..bf3c6e5 100644 (file)
@@ -467,7 +467,7 @@ AcpiEvMatchGpeMethod (
 
     /* 4) The last two characters of the name are the hex GPE Number */
 
-    GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
+    GpeNumber = strtoul (&Name[2], NULL, 16);
     if (GpeNumber == ACPI_UINT32_MAX)
     {
         /* Conversion failed; invalid method, just ignore it */
index 25a7900..24848db 100644 (file)
@@ -732,10 +732,17 @@ AcpiEvExecuteRegMethods (
     ACPI_ADR_SPACE_TYPE     SpaceId)
 {
     ACPI_STATUS             Status;
+    ACPI_REG_WALK_INFO      Info;
 
 
     ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
 
+    Info.SpaceId = SpaceId;
+    Info.RegRunCount = 0;
+
+    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES,
+        "    Running _REG methods for SpaceId %s\n",
+        AcpiUtGetRegionName (Info.SpaceId)));
 
     /*
      * Run all _REG methods for all Operation Regions for this space ID. This
@@ -744,8 +751,7 @@ AcpiEvExecuteRegMethods (
      * regions of this Space ID before we can run any _REG methods)
      */
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
-                ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL,
-                &SpaceId, NULL);
+        ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL);
 
     /* Special case for EC: handle "orphan" _REG methods with no region */
 
@@ -754,6 +760,10 @@ AcpiEvExecuteRegMethods (
         AcpiEvOrphanEcRegMethod (Node);
     }
 
+    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES,
+        "    Executed %u _REG methods for SpaceId %s\n",
+        Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId)));
+
     return_ACPI_STATUS (Status);
 }
 
@@ -777,11 +787,11 @@ AcpiEvRegRun (
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
     ACPI_NAMESPACE_NODE     *Node;
-    ACPI_ADR_SPACE_TYPE     SpaceId;
     ACPI_STATUS             Status;
+    ACPI_REG_WALK_INFO      *Info;
 
 
-    SpaceId = *ACPI_CAST_PTR (ACPI_ADR_SPACE_TYPE, Context);
+    Info = ACPI_CAST_PTR (ACPI_REG_WALK_INFO, Context);
 
     /* Convert and validate the device handle */
 
@@ -813,13 +823,14 @@ AcpiEvRegRun (
 
     /* Object is a Region */
 
-    if (ObjDesc->Region.SpaceId != SpaceId)
+    if (ObjDesc->Region.SpaceId != Info->SpaceId)
     {
         /* This region is for a different address space, just ignore it */
 
         return (AE_OK);
     }
 
+    Info->RegRunCount++;
     Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT);
     return (Status);
 }
index c311a69..d4f7087 100644 (file)
@@ -251,15 +251,6 @@ AcpiExLoadTableOp (
     ACPI_FUNCTION_TRACE (ExLoadTableOp);
 
 
-    /* Validate lengths for the Signature, OemId, and OemTableId strings */
-
-    if ((Operand[0]->String.Length > ACPI_NAME_SIZE) ||
-        (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) ||
-        (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE))
-    {
-        return_ACPI_STATUS (AE_AML_STRING_LIMIT);
-    }
-
     /* Find the ACPI table in the RSDT/XSDT */
 
     Status = AcpiTbFindTable (
@@ -588,7 +579,7 @@ AcpiExLoadOp (
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
 
-        ACPI_MEMCPY (Table, TableHeader, Length);
+        memcpy (Table, TableHeader, Length);
         break;
 
     default:
index 1cf54e2..019a490 100644 (file)
@@ -323,7 +323,7 @@ AcpiExConvertToBuffer (
         /* Copy the integer to the buffer, LSB first */
 
         NewBuf = ReturnDesc->Buffer.Pointer;
-        ACPI_MEMCPY (NewBuf,
+        memcpy (NewBuf,
                         &ObjDesc->Integer.Value,
                         AcpiGbl_IntegerByteWidth);
         break;
@@ -348,7 +348,7 @@ AcpiExConvertToBuffer (
         /* Copy the string to the buffer */
 
         NewBuf = ReturnDesc->Buffer.Pointer;
-        ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
+        strncpy ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
             ObjDesc->String.Length);
         break;
 
@@ -745,6 +745,7 @@ AcpiExConvertToTargetType (
         break;
 
     case ARGI_TARGETREF:
+    case ARGI_STORE_TARGET:
 
         switch (DestinationType)
         {
index 90a3632..9c7ffc1 100644 (file)
@@ -599,6 +599,7 @@ AcpiExCreateMethod (
 
     ObjDesc->Method.AmlStart = AmlStart;
     ObjDesc->Method.AmlLength = AmlLength;
+    ObjDesc->Method.Node = Operand[0];
 
     /*
      * Disassemble the method flags. Split off the ArgCount, Serialized
index 64fef55..00ec43f 100644 (file)
 
 #include "acpi.h"
 #include "accommon.h"
+#include "acnamesp.h"
 #include "acinterp.h"
+#include "acparser.h"
 
 
 #define _COMPONENT          ACPI_EXECUTER
         ACPI_MODULE_NAME    ("exdebug")
 
 
+static ACPI_OPERAND_OBJECT  *AcpiGbl_TraceMethodObject = NULL;
+
+/* Local prototypes */
+
+#ifdef ACPI_DEBUG_OUTPUT
+static const char *
+AcpiExGetTraceEventName (
+    ACPI_TRACE_EVENT_TYPE   Type);
+#endif
+
+
 #ifndef ACPI_NO_ERROR_MESSAGES
 /*******************************************************************************
  *
@@ -153,6 +166,8 @@ AcpiExDoDebugObject (
 {
     UINT32                  i;
     UINT32                  Timer;
+    ACPI_OPERAND_OBJECT     *ObjectDesc;
+    UINT32                  Value;
 
 
     ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
@@ -339,8 +354,37 @@ AcpiExDoDebugObject (
             }
             else
             {
-                AcpiExDoDebugObject (SourceDesc->Reference.Object,
-                    Level+4, 0);
+                ObjectDesc = SourceDesc->Reference.Object;
+                Value = SourceDesc->Reference.Value;
+
+                switch (ObjectDesc->Common.Type)
+                {
+                case ACPI_TYPE_BUFFER:
+
+                    AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n",
+                        Value, *SourceDesc->Reference.IndexPointer);
+                    break;
+
+                case ACPI_TYPE_STRING:
+
+                    AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n",
+                        Value, *SourceDesc->Reference.IndexPointer,
+                        *SourceDesc->Reference.IndexPointer);
+                    break;
+
+                case ACPI_TYPE_PACKAGE:
+
+                    AcpiOsPrintf ("Package[%u] = ", Value);
+                    AcpiExDoDebugObject (*SourceDesc->Reference.Where,
+                        Level+4, 0);
+                    break;
+
+                default:
+
+                    AcpiOsPrintf ("Unknown Reference object type %X\n",
+                        ObjectDesc->Common.Type);
+                    break;
+                }
             }
         }
         break;
@@ -355,3 +399,362 @@ AcpiExDoDebugObject (
     return_VOID;
 }
 #endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExInterpreterTraceEnabled
+ *
+ * PARAMETERS:  Name                - Whether method name should be matched,
+ *                                    this should be checked before starting
+ *                                    the tracer
+ *
+ * RETURN:      TRUE if interpreter trace is enabled.
+ *
+ * DESCRIPTION: Check whether interpreter trace is enabled
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiExInterpreterTraceEnabled (
+    char                    *Name)
+{
+
+    /* Check if tracing is enabled */
+
+    if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED))
+    {
+        return (FALSE);
+    }
+
+    /*
+     * Check if tracing is filtered:
+     *
+     * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have
+     *    been filled by the trace starter
+     * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be
+     *    matched if it is specified
+     * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should
+     *    not be cleared by the trace stopper during the first match
+     */
+    if (AcpiGbl_TraceMethodObject)
+    {
+        return (TRUE);
+    }
+    if (Name &&
+        (AcpiGbl_TraceMethodName &&
+         strcmp (AcpiGbl_TraceMethodName, Name)))
+    {
+        return (FALSE);
+    }
+    if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) &&
+        !AcpiGbl_TraceMethodName)
+    {
+        return (FALSE);
+    }
+
+    return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExGetTraceEventName
+ *
+ * PARAMETERS:  Type            - Trace event type
+ *
+ * RETURN:      Trace event name.
+ *
+ * DESCRIPTION: Used to obtain the full trace event name.
+ *
+ ******************************************************************************/
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+static const char *
+AcpiExGetTraceEventName (
+    ACPI_TRACE_EVENT_TYPE   Type)
+{
+    switch (Type)
+    {
+    case ACPI_TRACE_AML_METHOD:
+
+        return "Method";
+
+    case ACPI_TRACE_AML_OPCODE:
+
+        return "Opcode";
+
+    case ACPI_TRACE_AML_REGION:
+
+        return "Region";
+
+    default:
+
+        return "";
+    }
+}
+
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExTracePoint
+ *
+ * PARAMETERS:  Type                - Trace event type
+ *              Begin               - TRUE if before execution
+ *              Aml                 - Executed AML address
+ *              Pathname            - Object path
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Internal interpreter execution trace.
+ *
+ ******************************************************************************/
+
+void
+AcpiExTracePoint (
+    ACPI_TRACE_EVENT_TYPE   Type,
+    BOOLEAN                 Begin,
+    UINT8                   *Aml,
+    char                    *Pathname)
+{
+
+    ACPI_FUNCTION_NAME (ExTracePoint);
+
+
+    if (Pathname)
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT,
+                "%s %s [0x%p:%s] execution.\n",
+                AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End",
+                Aml, Pathname));
+    }
+    else
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT,
+                "%s %s [0x%p] execution.\n",
+                AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End",
+                Aml));
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExStartTraceMethod
+ *
+ * PARAMETERS:  MethodNode          - Node of the method
+ *              ObjDesc             - The method object
+ *              WalkState           - current state, NULL if not yet executing
+ *                                    a method.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Start control method execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStartTraceMethod (
+    ACPI_NAMESPACE_NODE     *MethodNode,
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_WALK_STATE         *WalkState)
+{
+    ACPI_STATUS             Status;
+    char                    *Pathname = NULL;
+    BOOLEAN                 Enabled = FALSE;
+
+
+    ACPI_FUNCTION_NAME (ExStartTraceMethod);
+
+
+    if (MethodNode)
+    {
+        Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
+    }
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        goto Exit;
+    }
+
+    Enabled = AcpiExInterpreterTraceEnabled (Pathname);
+    if (Enabled && !AcpiGbl_TraceMethodObject)
+    {
+        AcpiGbl_TraceMethodObject = ObjDesc;
+        AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
+        AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;
+        AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL;
+        AcpiDbgLayer = ACPI_TRACE_LAYER_ALL;
+
+        if (AcpiGbl_TraceDbgLevel)
+        {
+            AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
+        }
+        if (AcpiGbl_TraceDbgLayer)
+        {
+            AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
+        }
+    }
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+Exit:
+    if (Enabled)
+    {
+        ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE,
+                ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
+    }
+    if (Pathname)
+    {
+        ACPI_FREE (Pathname);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExStopTraceMethod
+ *
+ * PARAMETERS:  MethodNode          - Node of the method
+ *              ObjDesc             - The method object
+ *              WalkState           - current state, NULL if not yet executing
+ *                                    a method.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Stop control method execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStopTraceMethod (
+    ACPI_NAMESPACE_NODE     *MethodNode,
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_WALK_STATE         *WalkState)
+{
+    ACPI_STATUS             Status;
+    char                    *Pathname = NULL;
+    BOOLEAN                 Enabled;
+
+
+    ACPI_FUNCTION_NAME (ExStopTraceMethod);
+
+
+    if (MethodNode)
+    {
+        Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
+    }
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ExitPath;
+    }
+
+    Enabled = AcpiExInterpreterTraceEnabled (NULL);
+
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+    if (Enabled)
+    {
+        ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE,
+                ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
+    }
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ExitPath;
+    }
+
+    /* Check whether the tracer should be stopped */
+
+    if (AcpiGbl_TraceMethodObject == ObjDesc)
+    {
+        /* Disable further tracing if type is one-shot */
+
+        if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT)
+        {
+            AcpiGbl_TraceMethodName = NULL;
+        }
+
+        AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
+        AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;
+        AcpiGbl_TraceMethodObject = NULL;
+    }
+
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ExitPath:
+    if (Pathname)
+    {
+        ACPI_FREE (Pathname);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExStartTraceOpcode
+ *
+ * PARAMETERS:  Op                  - The parser opcode object
+ *              WalkState           - current state, NULL if not yet executing
+ *                                    a method.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Start opcode execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStartTraceOpcode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_WALK_STATE         *WalkState)
+{
+
+    ACPI_FUNCTION_NAME (ExStartTraceOpcode);
+
+
+    if (AcpiExInterpreterTraceEnabled (NULL) &&
+        (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE))
+    {
+        ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE,
+                Op->Common.Aml, Op->Common.AmlOpName);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExStopTraceOpcode
+ *
+ * PARAMETERS:  Op                  - The parser opcode object
+ *              WalkState           - current state, NULL if not yet executing
+ *                                    a method.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Stop opcode execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStopTraceOpcode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_WALK_STATE         *WalkState)
+{
+
+    ACPI_FUNCTION_NAME (ExStopTraceOpcode);
+
+
+    if (AcpiExInterpreterTraceEnabled (NULL) &&
+        (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE))
+    {
+        ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE,
+                Op->Common.Aml, Op->Common.AmlOpName);
+    }
+}
index 09930ed..c682777 100644 (file)
@@ -310,7 +310,7 @@ static ACPI_EXDUMP_INFO     AcpiExDumpIndexField[5] =
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
 };
 
-static ACPI_EXDUMP_INFO     AcpiExDumpReference[8] =
+static ACPI_EXDUMP_INFO     AcpiExDumpReference[9] =
 {
     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.Class),              "Class"},
@@ -319,6 +319,7 @@ static ACPI_EXDUMP_INFO     AcpiExDumpReference[8] =
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Object),             "Object Desc"},
     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Reference.Node),               "Node"},
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Where),              "Where"},
+    {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.IndexPointer),       "Index Pointer"},
     {ACPI_EXD_REFERENCE,0,                                              NULL}
 };
 
@@ -1110,7 +1111,8 @@ AcpiExDumpReferenceObj (
     {
         AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
 
-        Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
+        Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node,
+            &RetBuf, TRUE);
         if (ACPI_FAILURE (Status))
         {
             AcpiOsPrintf (" Could not convert name to pathname\n");
@@ -1125,16 +1127,18 @@ AcpiExDumpReferenceObj (
     {
         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
         {
-            AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
+            AcpiOsPrintf ("%22s %p", "Target :",
+                ObjDesc->Reference.Object);
             if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
             {
-                AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
+                AcpiOsPrintf (" Table Index: %X\n",
+                    ObjDesc->Reference.Value);
             }
             else
             {
-                AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
+                AcpiOsPrintf (" [%s]\n",
                     AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
-                        ObjDesc->Reference.Object)->Common.Type));
+                    ObjDesc->Reference.Object)->Common.Type));
             }
         }
         else
index 3083985..dbd294b 100644 (file)
@@ -532,7 +532,7 @@ AcpiExWriteDataToField (
         }
 
         Buffer = BufferDesc->Buffer.Pointer;
-        ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length);
+        memcpy (Buffer, SourceDesc->Buffer.Pointer, Length);
 
         /* Lock entire transaction if requested */
 
index cd0233d..39a0f37 100644 (file)
@@ -528,7 +528,7 @@ AcpiExFieldDatumIo (
              * Copy the data from the source buffer.
              * Length is the field width in bytes.
              */
-            ACPI_MEMCPY (Value,
+            memcpy (Value,
                 (ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
                     ObjDesc->BufferField.BaseByteOffset +
                     FieldDatumByteOffset,
@@ -540,7 +540,7 @@ AcpiExFieldDatumIo (
              * Copy the data to the target buffer.
              * Length is the field width in bytes.
              */
-            ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
+            memcpy ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
                 ObjDesc->BufferField.BaseByteOffset +
                 FieldDatumByteOffset,
                 Value, ObjDesc->CommonField.AccessByteWidth);
@@ -820,7 +820,7 @@ AcpiExExtractFromField (
         return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
     }
 
-    ACPI_MEMSET (Buffer, 0, BufferLength);
+    memset (Buffer, 0, BufferLength);
     AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
 
     /* Handle the simple case here */
@@ -837,7 +837,7 @@ AcpiExExtractFromField (
             /* Use RawDatum (UINT64) to handle buffers < 64 bits */
 
             Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ);
-            ACPI_MEMCPY (Buffer, &RawDatum, BufferLength);
+            memcpy (Buffer, &RawDatum, BufferLength);
         }
 
         return_ACPI_STATUS (Status);
@@ -907,7 +907,7 @@ AcpiExExtractFromField (
 
         /* Write merged datum to target buffer */
 
-        ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
+        memcpy (((char *) Buffer) + BufferOffset, &MergedDatum,
             ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
                 BufferLength - BufferOffset));
 
@@ -925,7 +925,7 @@ AcpiExExtractFromField (
 
     /* Write the last datum to the buffer */
 
-    ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
+    memcpy (((char *) Buffer) + BufferOffset, &MergedDatum,
         ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
             BufferLength - BufferOffset));
 
@@ -998,7 +998,7 @@ AcpiExInsertIntoField (
          * at Byte zero. All unused (upper) bytes of the
          * buffer will be 0.
          */
-        ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength);
+        memcpy ((char *) NewBuffer, (char *) Buffer, BufferLength);
         Buffer = NewBuffer;
         BufferLength = RequiredLength;
     }
@@ -1041,7 +1041,7 @@ AcpiExInsertIntoField (
 
     /* Get initial Datum from the input buffer */
 
-    ACPI_MEMCPY (&RawDatum, Buffer,
+    memcpy (&RawDatum, Buffer,
         ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
             BufferLength - BufferOffset));
 
@@ -1093,7 +1093,7 @@ AcpiExInsertIntoField (
         /* Get the next input datum from the buffer */
 
         BufferOffset += ObjDesc->CommonField.AccessByteWidth;
-        ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset,
+        memcpy (&RawDatum, ((char *) Buffer) + BufferOffset,
             ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
                  BufferLength - BufferOffset));
 
index d92b271..f678670 100644 (file)
@@ -298,8 +298,8 @@ AcpiExConcatTemplate (
      * EndTag descriptor is copied from Operand1.
      */
     NewBuf = ReturnDesc->Buffer.Pointer;
-    ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0);
-    ACPI_MEMCPY (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
+    memcpy (NewBuf, Operand0->Buffer.Pointer, Length0);
+    memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
 
     /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
 
@@ -413,12 +413,12 @@ AcpiExDoConcatenate (
 
         /* Copy the first integer, LSB first */
 
-        ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value,
+        memcpy (NewBuf, &Operand0->Integer.Value,
                         AcpiGbl_IntegerByteWidth);
 
         /* Copy the second integer (LSB first) after the first */
 
-        ACPI_MEMCPY (NewBuf + AcpiGbl_IntegerByteWidth,
+        memcpy (NewBuf + AcpiGbl_IntegerByteWidth,
                         &LocalOperand1->Integer.Value,
                         AcpiGbl_IntegerByteWidth);
         break;
@@ -440,8 +440,8 @@ AcpiExDoConcatenate (
 
         /* Concatenate the strings */
 
-        ACPI_STRCPY (NewBuf, Operand0->String.Pointer);
-        ACPI_STRCPY (NewBuf + Operand0->String.Length,
+        strcpy (NewBuf, Operand0->String.Pointer);
+        strcpy (NewBuf + Operand0->String.Length,
                         LocalOperand1->String.Pointer);
         break;
 
@@ -462,9 +462,9 @@ AcpiExDoConcatenate (
 
         /* Concatenate the buffers */
 
-        ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer,
+        memcpy (NewBuf, Operand0->Buffer.Pointer,
                         Operand0->Buffer.Length);
-        ACPI_MEMCPY (NewBuf + Operand0->Buffer.Length,
+        memcpy (NewBuf + Operand0->Buffer.Length,
                         LocalOperand1->Buffer.Pointer,
                         LocalOperand1->Buffer.Length);
         break;
@@ -785,7 +785,7 @@ AcpiExDoLogicalOp (
 
         /* Lexicographic compare: compare the data bytes */
 
-        Compare = ACPI_MEMCMP (Operand0->Buffer.Pointer,
+        Compare = memcmp (Operand0->Buffer.Pointer,
                     LocalOperand1->Buffer.Pointer,
                     (Length0 > Length1) ? Length1 : Length0);
 
index b402d3b..38ceba0 100644 (file)
@@ -293,7 +293,7 @@ AcpiExNameSegment (
 
         if (NameString)
         {
-            ACPI_STRCAT (NameString, CharBuf);
+            strcat (NameString, CharBuf);
             ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
                 "Appended to - %s\n", NameString));
         }
index 399b259..f1ab706 100644 (file)
@@ -440,7 +440,7 @@ AcpiExOpcode_2A_1T_1R (
          * Copy the raw buffer data with no transform.
          * (NULL terminated already)
          */
-        ACPI_MEMCPY (ReturnDesc->String.Pointer,
+        memcpy (ReturnDesc->String.Pointer,
             Operand[0]->Buffer.Pointer, Length);
         break;
 
@@ -484,6 +484,8 @@ AcpiExOpcode_2A_1T_1R (
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
+            ReturnDesc->Reference.IndexPointer =
+                &(Operand[0]->Buffer.Pointer [Index]);
             break;
 
         case ACPI_TYPE_BUFFER:
@@ -495,6 +497,8 @@ AcpiExOpcode_2A_1T_1R (
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
+            ReturnDesc->Reference.IndexPointer =
+                &(Operand[0]->Buffer.Pointer [Index]);
             break;
 
         case ACPI_TYPE_PACKAGE:
@@ -506,7 +510,8 @@ AcpiExOpcode_2A_1T_1R (
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
-            ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
+            ReturnDesc->Reference.Where =
+                &Operand[0]->Package.Elements [Index];
             break;
 
         default:
index b0928af..b2c49be 100644 (file)
@@ -334,7 +334,7 @@ AcpiExOpcode_3A_1T_1R (
         {
             /* We have a buffer, copy the portion requested */
 
-            ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
+            memcpy (Buffer, Operand[0]->String.Pointer + Index,
                          Length);
         }
 
index 31bbb60..cf60500 100644 (file)
@@ -630,13 +630,13 @@ AcpiExDataTableSpaceHandler (
     {
     case ACPI_READ:
 
-        ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
+        memcpy (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
             ACPI_DIV_8 (BitWidth));
         break;
 
     case ACPI_WRITE:
 
-        ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
+        memcpy (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
             ACPI_DIV_8 (BitWidth));
         break;
 
index d72ec55..6967bbb 100644 (file)
@@ -206,7 +206,7 @@ AcpiExResolveNodeToValue (
     {
         ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p",
             Node->Name.Ascii, Node));
-        return_ACPI_STATUS (AE_AML_NO_OPERAND);
+        return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE);
     }
 
     /*
index e874342..a273a71 100644 (file)
@@ -297,7 +297,6 @@ AcpiExResolveObjectToValue (
                      * (i.e., dereference the package index)
                      * Delete the ref object, increment the returned object
                      */
-                    AcpiUtRemoveReference (StackDesc);
                     AcpiUtAddReference (ObjDesc);
                     *StackPtr = ObjDesc;
                 }
@@ -423,8 +422,8 @@ AcpiExResolveMultiple (
     ACPI_OBJECT_TYPE        *ReturnType,
     ACPI_OPERAND_OBJECT     **ReturnDesc)
 {
-    ACPI_OPERAND_OBJECT     *ObjDesc = (void *) Operand;
-    ACPI_NAMESPACE_NODE     *Node;
+    ACPI_OPERAND_OBJECT     *ObjDesc = ACPI_CAST_PTR (void, Operand);
+    ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand);
     ACPI_OBJECT_TYPE        Type;
     ACPI_STATUS             Status;
 
@@ -444,7 +443,7 @@ AcpiExResolveMultiple (
     case ACPI_DESC_TYPE_NAMED:
 
         Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
-        ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
+        ObjDesc = AcpiNsGetAttachedObject (Node);
 
         /* If we had an Alias node, use the attached object for type info */
 
@@ -453,6 +452,14 @@ AcpiExResolveMultiple (
             Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
             ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
         }
+
+        if (!ObjDesc)
+        {
+            ACPI_ERROR ((AE_INFO,
+                "[%4.4s] Node is unresolved or uninitialized",
+                AcpiUtGetNodeName (Node)));
+            return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE);
+        }
         break;
 
     default:
index fab4993..3cfe472 100644 (file)
@@ -392,6 +392,8 @@ AcpiExResolveOperands (
         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
+        case ARGI_STORE_TARGET:
+
             /*
              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
              * A Namespace Node is OK as-is
index 47c212d..cb6ebc0 100644 (file)
@@ -219,7 +219,7 @@ AcpiExStore (
         /* Destination is not a Reference object */
 
         ACPI_ERROR ((AE_INFO,
-            "Target is not a Reference or Constant object - %s [%p]",
+            "Target is not a Reference or Constant object - [%s] %p",
             AcpiUtGetObjectTypeName (DestDesc), DestDesc));
 
         return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -266,7 +266,7 @@ AcpiExStore (
          * displayed and otherwise has no effect -- see ACPI Specification
          */
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "**** Write to Debug Object: Object %p %s ****:\n\n",
+            "**** Write to Debug Object: Object %p [%s] ****:\n\n",
             SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
 
         ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
@@ -428,7 +428,7 @@ AcpiExStoreObjectToIndex (
             /* All other types are invalid */
 
             ACPI_ERROR ((AE_INFO,
-                "Source must be Integer/Buffer/String type, not %s",
+                "Source must be type [Integer/Buffer/String], found [%s]",
                 AcpiUtGetObjectTypeName (SourceDesc)));
             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
         }
@@ -440,8 +440,8 @@ AcpiExStoreObjectToIndex (
 
     default:
         ACPI_ERROR ((AE_INFO,
-            "Target is not a Package or BufferField"));
-        Status = AE_AML_OPERAND_TYPE;
+            "Target is not of type [Package/BufferField]"));
+        Status = AE_AML_TARGET_TYPE;
         break;
     }
 
@@ -462,20 +462,20 @@ AcpiExStoreObjectToIndex (
  *
  * DESCRIPTION: Store the object to the named object.
  *
- *              The Assignment of an object to a named object is handled here
- *              The value passed in will replace the current value (if any)
- *              with the input value.
+ * The assignment of an object to a named object is handled here.
+ * The value passed in will replace the current value (if any)
+ * with the input value.
  *
- *              When storing into an object the data is converted to the
- *              target object type then stored in the object. This means
- *              that the target object type (for an initialized target) will
- *              not be changed by a store operation. A CopyObject can change
- *              the target type, however.
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation. A CopyObject can change
+ * the target type, however.
  *
- *              The ImplicitConversion flag is set to NO/FALSE only when
- *              storing to an ArgX -- as per the rules of the ACPI spec.
+ * The ImplicitConversion flag is set to NO/FALSE only when
+ * storing to an ArgX -- as per the rules of the ACPI spec.
  *
- *              Assumes parameters are already validated.
+ * Assumes parameters are already validated.
  *
  ******************************************************************************/
 
@@ -500,9 +500,74 @@ AcpiExStoreObjectToNode (
     TargetType = AcpiNsGetType (Node);
     TargetDesc = AcpiNsGetAttachedObject (Node);
 
-    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
+    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n",
         SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
-              Node, AcpiUtGetTypeName (TargetType)));
+        Node, AcpiUtGetTypeName (TargetType)));
+
+    /* Only limited target types possible for everything except CopyObject */
+
+    if (WalkState->Opcode != AML_COPY_OP)
+    {
+        /*
+         * Only CopyObject allows all object types to be overwritten. For
+         * TargetRef(s), there are restrictions on the object types that
+         * are allowed.
+         *
+         * Allowable operations/typing for Store:
+         *
+         * 1) Simple Store
+         *      Integer     --> Integer (Named/Local/Arg)
+         *      String      --> String  (Named/Local/Arg)
+         *      Buffer      --> Buffer  (Named/Local/Arg)
+         *      Package     --> Package (Named/Local/Arg)
+         *
+         * 2) Store with implicit conversion
+         *      Integer     --> String or Buffer  (Named)
+         *      String      --> Integer or Buffer (Named)
+         *      Buffer      --> Integer or String (Named)
+         */
+        switch (TargetType)
+        {
+        case ACPI_TYPE_PACKAGE:
+            /*
+             * Here, can only store a package to an existing package.
+             * Storing a package to a Local/Arg is OK, and handled
+             * elsewhere.
+             */
+            if (WalkState->Opcode == AML_STORE_OP)
+            {
+                if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
+                {
+                    ACPI_ERROR ((AE_INFO,
+                        "Cannot assign type [%s] to [Package] "
+                        "(source must be type Pkg)",
+                        AcpiUtGetObjectTypeName (SourceDesc)));
+
+                    return_ACPI_STATUS (AE_AML_TARGET_TYPE);
+                }
+                break;
+            }
+
+        /* Fallthrough */
+
+        case ACPI_TYPE_DEVICE:
+        case ACPI_TYPE_EVENT:
+        case ACPI_TYPE_MUTEX:
+        case ACPI_TYPE_REGION:
+        case ACPI_TYPE_POWER:
+        case ACPI_TYPE_PROCESSOR:
+        case ACPI_TYPE_THERMAL:
+
+            ACPI_ERROR ((AE_INFO,
+                "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)",
+                AcpiUtGetTypeName (Node->Type), Node->Name.Ascii));
+
+            return_ACPI_STATUS (AE_AML_TARGET_TYPE);
+
+        default:
+            break;
+        }
+    }
 
     /*
      * Resolve the source object to an actual value
@@ -518,13 +583,13 @@ AcpiExStoreObjectToNode (
 
     switch (TargetType)
     {
-    case ACPI_TYPE_INTEGER:
-    case ACPI_TYPE_STRING:
-    case ACPI_TYPE_BUFFER:
         /*
          * The simple data types all support implicit source operand
          * conversion before the store.
          */
+    case ACPI_TYPE_INTEGER:
+    case ACPI_TYPE_STRING:
+    case ACPI_TYPE_BUFFER:
 
         if ((WalkState->Opcode == AML_COPY_OP) ||
             !ImplicitConversion)
@@ -563,7 +628,7 @@ AcpiExStoreObjectToNode (
                 NewDesc->Common.Type);
 
             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                "Store %s into %s via Convert/Attach\n",
+                "Store type [%s] into [%s] via Convert/Attach\n",
                 AcpiUtGetObjectTypeName (SourceDesc),
                 AcpiUtGetObjectTypeName (NewDesc)));
         }
@@ -585,15 +650,12 @@ AcpiExStoreObjectToNode (
 
     default:
         /*
-         * No conversions for all other types. Directly store a copy of
-         * the source object. This is the ACPI spec-defined behavior for
-         * the CopyObject operator.
+         * CopyObject operator: No conversions for all other types.
+         * Instead, directly store a copy of the source object.
          *
-         * NOTE: For the Store operator, this is a departure from the
-         * ACPI spec, which states "If conversion is impossible, abort
-         * the running control method". Instead, this code implements
-         * "If conversion is impossible, treat the Store operation as
-         * a CopyObject".
+         * This is the ACPI spec-defined behavior for the CopyObject
+         * operator. (Note, for this default case, all normal
+         * Store/Target operations exited above with an error).
          */
         Status = AcpiExStoreDirectToNode (SourceDesc, Node,
             WalkState);
index c1879b4..6a1be4c 100644 (file)
@@ -201,9 +201,10 @@ AcpiExResolveObject (
             /* Conversion successful but still not a valid type */
 
             ACPI_ERROR ((AE_INFO,
-                "Cannot assign type %s to %s (must be type Int/Str/Buf)",
+                "Cannot assign type [%s] to [%s] (must be type Int/Str/Buf)",
                 AcpiUtGetObjectTypeName (SourceDesc),
                 AcpiUtGetTypeName (TargetType)));
+
             Status = AE_AML_OPERAND_TYPE;
         }
         break;
@@ -356,7 +357,7 @@ AcpiExStoreObjectToObject (
         /*
          * All other types come here.
          */
-        ACPI_WARNING ((AE_INFO, "Store into type %s not implemented",
+        ACPI_WARNING ((AE_INFO, "Store into type [%s] not implemented",
             AcpiUtGetObjectTypeName (DestDesc)));
 
         Status = AE_NOT_IMPLEMENTED;
index 48c3440..8c23aee 100644 (file)
@@ -181,8 +181,8 @@ AcpiExStoreBufferToBuffer (
     {
         /* Clear existing buffer and copy in the new one */
 
-        ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
-        ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
+        memset (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
+        memcpy (TargetDesc->Buffer.Pointer, Buffer, Length);
 
 #ifdef ACPI_OBSOLETE_BEHAVIOR
         /*
@@ -211,7 +211,7 @@ AcpiExStoreBufferToBuffer (
     {
         /* Truncate the source, copy only what will fit */
 
-        ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer,
+        memcpy (TargetDesc->Buffer.Pointer, Buffer,
             TargetDesc->Buffer.Length);
 
         ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
@@ -275,9 +275,9 @@ AcpiExStoreStringToString (
          * String will fit in existing non-static buffer.
          * Clear old string and copy in the new one
          */
-        ACPI_MEMSET (TargetDesc->String.Pointer, 0,
+        memset (TargetDesc->String.Pointer, 0,
             (ACPI_SIZE) TargetDesc->String.Length + 1);
-        ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+        memcpy (TargetDesc->String.Pointer, Buffer, Length);
     }
     else
     {
@@ -301,7 +301,7 @@ AcpiExStoreStringToString (
         }
 
         TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
-        ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+        memcpy (TargetDesc->String.Pointer, Buffer, Length);
     }
 
     /* Set the new target length */
index b432cba..90a791d 100644 (file)
@@ -503,6 +503,43 @@ AcpiExIntegerToString (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExPciClsToString
+ *
+ * PARAMETERS:  OutString       - Where to put the converted string (7 bytes)
+ * PARAMETERS:  ClassCode       - PCI class code to be converted (3 bytes)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
+ *              Return buffer must be large enough to hold the string. The
+ *              string returned is always exactly of length
+ *              ACPI_PCICLS_STRING_SIZE (includes null terminator).
+ *
+ ******************************************************************************/
+
+void
+AcpiExPciClsToString (
+    char                    *OutString,
+    UINT8                   ClassCode[3])
+{
+
+    ACPI_FUNCTION_ENTRY ();
+
+
+    /* All 3 bytes are hexadecimal */
+
+    OutString[0] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 4);
+    OutString[1] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 0);
+    OutString[2] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 4);
+    OutString[3] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 0);
+    OutString[4] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 4);
+    OutString[5] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 0);
+    OutString[6] = 0;
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiIsValidSpaceId
index c532689..1ab6965 100644 (file)
@@ -169,6 +169,8 @@ AcpiHwGetGpeRegisterBit (
  * RETURN:      Status
  *
  * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
+ *              The EnableMask field of the involved GPE register must be
+ *              updated by the caller if necessary.
  *
  ******************************************************************************/
 
@@ -205,7 +207,7 @@ AcpiHwLowSetGpe (
     /* Set or clear just the bit that corresponds to this GPE */
 
     RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
-    switch (Action & ~ACPI_GPE_SAVE_MASK)
+    switch (Action)
     {
     case ACPI_GPE_CONDITIONAL_ENABLE:
 
@@ -237,10 +239,6 @@ AcpiHwLowSetGpe (
     /* Write the updated enable mask */
 
     Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
-    if (ACPI_SUCCESS (Status) && (Action & ACPI_GPE_SAVE_MASK))
-    {
-        GpeRegisterInfo->EnableMask = (UINT8) EnableMask;
-    }
     return (Status);
 }
 
@@ -406,11 +404,8 @@ AcpiHwGpeEnableWrite (
     ACPI_STATUS             Status;
 
 
+    GpeRegisterInfo->EnableMask = EnableMask;
     Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
-    if (ACPI_SUCCESS (Status))
-    {
-        GpeRegisterInfo->EnableMask = EnableMask;
-    }
 
     return (Status);
 }
index da7674c..0d07fe1 100644 (file)
@@ -212,7 +212,7 @@ AcpiHwDerivePciId (
     ACPI_HANDLE             PciRegion)
 {
     ACPI_STATUS             Status;
-    ACPI_PCI_DEVICE         *ListHead = NULL;
+    ACPI_PCI_DEVICE         *ListHead;
 
 
     ACPI_FUNCTION_TRACE (HwDerivePciId);
@@ -270,7 +270,6 @@ AcpiHwBuildPciList (
     ACPI_HANDLE             ParentDevice;
     ACPI_STATUS             Status;
     ACPI_PCI_DEVICE         *ListElement;
-    ACPI_PCI_DEVICE         *ListHead = NULL;
 
 
     /*
@@ -278,6 +277,7 @@ AcpiHwBuildPciList (
      * a list of device nodes. Loop will exit when either the PCI device is
      * found, or the root of the namespace is reached.
      */
+    *ReturnListHead = NULL;
     CurrentDevice = PciRegion;
     while (1)
     {
@@ -294,7 +294,6 @@ AcpiHwBuildPciList (
 
         if (ParentDevice == RootPciDevice)
         {
-            *ReturnListHead = ListHead;
             return (AE_OK);
         }
 
@@ -309,9 +308,9 @@ AcpiHwBuildPciList (
 
         /* Put new element at the head of the list */
 
-        ListElement->Next = ListHead;
+        ListElement->Next = *ReturnListHead;
         ListElement->Device = ParentDevice;
-        ListHead = ListElement;
+        *ReturnListHead = ListElement;
 
         CurrentDevice = ParentDevice;
     }
index 2c7066b..ce6e8ee 100644 (file)
 
 /* Local prototypes */
 
+#if (!ACPI_REDUCED_HARDWARE)
+static ACPI_STATUS
+AcpiHwSetFirmwareWakingVector (
+    ACPI_TABLE_FACS         *Facs,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress64);
+#endif
+
 static ACPI_STATUS
 AcpiHwSleepDispatch (
     UINT8                   SleepState,
@@ -149,29 +157,33 @@ static ACPI_SLEEP_FUNCTIONS         AcpiSleepDispatch[] =
 /*
  * These functions are removed for the ACPI_REDUCED_HARDWARE case:
  *      AcpiSetFirmwareWakingVector
- *      AcpiSetFirmwareWakingVector64
  *      AcpiEnterSleepStateS4bios
  */
 
 #if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
- * FUNCTION:    AcpiSetFirmwareWakingVector
+ * FUNCTION:    AcpiHwSetFirmwareWakingVector
  *
- * PARAMETERS:  PhysicalAddress     - 32-bit physical address of ACPI real mode
- *                                    entry point.
+ * PARAMETERS:  Facs                - Pointer to FACS table
+ *              PhysicalAddress     - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              PhysicalAddress64   - 64-bit physical address of ACPI protected
+ *                                    entry point
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS
+ * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS
  *
  ******************************************************************************/
 
-ACPI_STATUS
-AcpiSetFirmwareWakingVector (
-    UINT32                  PhysicalAddress)
+static ACPI_STATUS
+AcpiHwSetFirmwareWakingVector (
+    ACPI_TABLE_FACS         *Facs,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress64)
 {
-    ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
+    ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector);
 
 
     /*
@@ -184,60 +196,61 @@ AcpiSetFirmwareWakingVector (
 
     /* Set the 32-bit vector */
 
-    AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
-
-    /* Clear the 64-bit vector if it exists */
+    Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
 
-    if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1))
+    if (Facs->Length > 32)
     {
-        AcpiGbl_FACS->XFirmwareWakingVector = 0;
+        if (Facs->Version >= 1)
+        {
+            /* Set the 64-bit vector */
+
+            Facs->XFirmwareWakingVector = PhysicalAddress64;
+        }
+        else
+        {
+            /* Clear the 64-bit vector if it exists */
+
+            Facs->XFirmwareWakingVector = 0;
+        }
     }
 
     return_ACPI_STATUS (AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
 
-
-#if ACPI_MACHINE_WIDTH == 64
 /*******************************************************************************
  *
- * FUNCTION:    AcpiSetFirmwareWakingVector64
+ * FUNCTION:    AcpiSetFirmwareWakingVector
  *
- * PARAMETERS:  PhysicalAddress     - 64-bit physical address of ACPI protected
- *                                    mode entry point.
+ * PARAMETERS:  PhysicalAddress     - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              PhysicalAddress64   - 64-bit physical address of ACPI protected
+ *                                    entry point
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if
- *              it exists in the table. This function is intended for use with
- *              64-bit host operating systems.
+ * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiSetFirmwareWakingVector64 (
-    UINT64                  PhysicalAddress)
+AcpiSetFirmwareWakingVector (
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress64)
 {
-    ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64);
-
 
-    /* Determine if the 64-bit vector actually exists */
+    ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
 
-    if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1))
+    if (AcpiGbl_FACS)
     {
-        return_ACPI_STATUS (AE_NOT_EXIST);
+        (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_FACS,
+                    PhysicalAddress, PhysicalAddress64);
     }
 
-    /* Clear 32-bit vector, set the 64-bit X_ vector */
-
-    AcpiGbl_FACS->FirmwareWakingVector = 0;
-    AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress;
     return_ACPI_STATUS (AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64)
-#endif
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
 
 
 /*******************************************************************************
index 1153642..1c2004d 100644 (file)
 
 
 #define FILE_SUFFIX_DISASSEMBLY     "dsl"
-#define ACPI_TABLE_FILE_SUFFIX      ".dat"
+#define FILE_SUFFIX_BINARY_TABLE    ".dat" /* Needs the dot */
 
 
 /*
index bbcff57..881b0f9 100644 (file)
@@ -229,6 +229,7 @@ typedef struct acpi_pld_info
  *        (Intended for BIOS use only)
  */
 #define ACPI_PLD_REV1_BUFFER_SIZE               16 /* For Revision 1 of the buffer (From ACPI spec) */
+#define ACPI_PLD_REV2_BUFFER_SIZE               20 /* For Revision 2 of the buffer (From ACPI spec) */
 #define ACPI_PLD_BUFFER_SIZE                    20 /* For Revision 2 of the buffer (From ACPI spec) */
 
 /* First 32-bit dword, bits 0:32 */
diff --git a/reactos/drivers/bus/acpi/acpica/include/acclib.h b/reactos/drivers/bus/acpi/acpica/include/acclib.h
new file mode 100644 (file)
index 0000000..5579e24
--- /dev/null
@@ -0,0 +1,254 @@
+/******************************************************************************
+ *
+ * Name: acclib.h -- C library support. Prototypes for the (optional) local
+ *                   implementations of required C library functions.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef _ACCLIB_H
+#define _ACCLIB_H
+
+
+/*
+ * Prototypes and macros for local implementations of C library functions
+ */
+
+/* is* functions. The AcpiGbl_Ctypes array is defined in utclib.c */
+
+extern const UINT8 AcpiGbl_Ctypes[];
+
+#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
+#define _ACPI_XS     0x40    /* extra space */
+#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
+#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
+#define _ACPI_DI     0x04    /* '0'-'9' */
+#define _ACPI_LO     0x02    /* 'a'-'z' */
+#define _ACPI_PU     0x10    /* punctuation */
+#define _ACPI_SP     0x08    /* space, tab, CR, LF, VT, FF */
+#define _ACPI_UP     0x01    /* 'A'-'Z' */
+#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
+
+#define isdigit(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_DI))
+#define isspace(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_SP))
+#define isxdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_XD))
+#define isupper(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_UP))
+#define islower(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO))
+#define isprint(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
+#define isalpha(c)  (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+
+
+/* Strings */
+
+char *
+strcat (
+    char                    *DstString,
+    const char              *SrcString);
+
+char *
+strchr (
+    const char              *String,
+    int                     ch);
+
+char *
+strcpy (
+    char                    *DstString,
+    const char              *SrcString);
+
+int
+strcmp (
+    const char              *String1,
+    const char              *String2);
+
+ACPI_SIZE
+strlen (
+    const char              *String);
+
+char *
+strncat (
+    char                    *DstString,
+    const char              *SrcString,
+    ACPI_SIZE               Count);
+
+int
+strncmp (
+    const char              *String1,
+    const char              *String2,
+    ACPI_SIZE               Count);
+
+char *
+strncpy (
+    char                    *DstString,
+    const char              *SrcString,
+    ACPI_SIZE               Count);
+
+#ifdef __REACTOS__
+char *
+strstr (
+    const char              *String1,
+    const char              *String2);
+#else /* __REACTOS__ */
+char *
+strstr (
+    char                    *String1,
+    char                    *String2);
+#endif /* __REACTOS__ */
+
+
+/* Conversion */
+
+UINT32
+strtoul (
+    const char              *String,
+    char                    **Terminator,
+    UINT32                  Base);
+
+
+/* Memory */
+
+#ifdef __REACTOS__
+int
+memcmp (
+    const void              *Buffer1,
+    const void              *Buffer2,
+    ACPI_SIZE               Count);
+#else /* __REACTOS__ */
+int
+memcmp (
+    void                    *Buffer1,
+    void                    *Buffer2,
+    ACPI_SIZE               Count);
+#endif /* __REACTOS__ */
+
+void *
+memcpy (
+    void                    *Dest,
+    const void              *Src,
+    ACPI_SIZE               Count);
+
+void *
+memset (
+    void                    *Dest,
+    int                     Value,
+    ACPI_SIZE               Count);
+
+
+/* upper/lower case */
+
+int
+tolower (
+    int                     c);
+
+int
+toupper (
+    int                     c);
+
+#endif /* _ACCLIB_H */
index 76dc38a..333fa8c 100644 (file)
 #include "acglobal.h"           /* All global variables */
 #include "achware.h"            /* Hardware defines and interfaces */
 #include "acutils.h"            /* Utility interfaces */
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#include "acclib.h"             /* C library interfaces */
+#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
 
 
 #endif /* __ACCOMMON_H__ */
index 41fa33d..e49862c 100644 (file)
 
 #define ACPI_ROOT_TABLE_SIZE_INCREMENT  4
 
-/* Maximum number of While() loop iterations before forced abort */
-
-#define ACPI_MAX_LOOP_ITERATIONS        0xFFFF
-
 /* Maximum sleep allowed via Sleep() operator */
 
 #define ACPI_MAX_SLEEP                  2000    /* 2000 millisec == two seconds */
index 3c823e8..3b245b0 100644 (file)
 #ifndef __ACDEBUG_H__
 #define __ACDEBUG_H__
 
+/* The debugger is used in conjunction with the disassembler most of time */
+
+#ifdef ACPI_DISASSEMBLER
+#include "acdisasm.h"
+#endif
+
 
 #define ACPI_DEBUG_BUFFER_SIZE  0x4000      /* 16K buffer for return objects */
 
@@ -149,9 +155,6 @@ typedef struct acpi_db_execute_walk
 
 
 #define PARAM_LIST(pl)                  pl
-#define DBTEST_OUTPUT_LEVEL(lvl)        if (AcpiGbl_DbOpt_Verbose)
-#define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
-                                            AcpiOsPrintf PARAM_LIST(fp);}
 
 #define EX_NO_SINGLE_STEP               1
 #define EX_SINGLE_STEP                  2
@@ -161,14 +164,6 @@ typedef struct acpi_db_execute_walk
  * dbxface - external debugger interfaces
  */
 ACPI_STATUS
-AcpiDbInitialize (
-    void);
-
-void
-AcpiDbTerminate (
-    void);
-
-ACPI_STATUS
 AcpiDbSingleStep (
     ACPI_WALK_STATE         *WalkState,
     ACPI_PARSE_OBJECT       *Op,
@@ -208,6 +203,12 @@ ACPI_STATUS
 AcpiDbSleep (
     char                    *ObjectArg);
 
+void
+AcpiDbTrace (
+    char                    *EnableArg,
+    char                    *MethodArg,
+    char                    *OnceArg);
+
 void
 AcpiDbDisplayLocks (
     void);
@@ -447,7 +448,8 @@ AcpiDbLoadAcpiTable (
 ACPI_STATUS
 AcpiDbGetTableFromFile (
     char                    *Filename,
-    ACPI_TABLE_HEADER       **Table);
+    ACPI_TABLE_HEADER       **Table,
+    BOOLEAN                 MustBeAmlTable);
 
 
 /*
@@ -495,6 +497,32 @@ AcpiDbGetNextToken (
     ACPI_OBJECT_TYPE        *ReturnType);
 
 
+/*
+ * dbobject
+ */
+void
+AcpiDbDecodeInternalObject (
+    ACPI_OPERAND_OBJECT     *ObjDesc);
+
+void
+AcpiDbDisplayInternalObject (
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiDbDecodeArguments (
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiDbDecodeLocals (
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiDbDumpMethodInfo (
+    ACPI_STATUS             Status,
+    ACPI_WALK_STATE         *WalkState);
+
+
 /*
  * dbstats - Generation and display of ACPI table statistics
  */
index 5776d5d..d448b9f 100644 (file)
 #define ACPI_RAW_TABLE_DATA_HEADER      "Raw Table Data"
 
 
-typedef const struct acpi_dmtable_info
+typedef struct acpi_dmtable_info
 {
     UINT8                       Opcode;
     UINT16                      Offset;
@@ -220,9 +220,11 @@ typedef enum
     ACPI_DMT_HEST,
     ACPI_DMT_HESTNTFY,
     ACPI_DMT_HESTNTYP,
+    ACPI_DMT_IORTMEM,
     ACPI_DMT_IVRS,
     ACPI_DMT_LPIT,
     ACPI_DMT_MADT,
+    ACPI_DMT_NFIT,
     ACPI_DMT_PCCT,
     ACPI_DMT_PMTT,
     ACPI_DMT_SLIC,
@@ -250,20 +252,22 @@ typedef struct acpi_dmtable_data
     ACPI_DMTABLE_HANDLER    TableHandler;
     ACPI_CMTABLE_HANDLER    CmTableHandler;
     const unsigned char     *Template;
-    char                    *Name;
 
 } ACPI_DMTABLE_DATA;
 
 
 typedef struct acpi_op_walk_info
 {
+    ACPI_WALK_STATE         *WalkState;
+    ACPI_PARSE_OBJECT       *MappingOp;
+    UINT8                   *PreviousAml;
+    UINT8                   *StartAml;
     UINT32                  Level;
     UINT32                  LastLevel;
     UINT32                  Count;
     UINT32                  BitOffset;
     UINT32                  Flags;
-    ACPI_WALK_STATE         *WalkState;
-    ACPI_PARSE_OBJECT       *MappingOp;
+    UINT32                  AmlOffset;
 
 } ACPI_OP_WALK_INFO;
 
@@ -318,6 +322,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt1[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt2[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt2a[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Device[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Addr[];
@@ -334,6 +339,11 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDmar2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDmar3[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDmar4[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm0a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm1[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm1a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDrtm2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoEcdt[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoEinj[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoEinj0[];
@@ -344,6 +354,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt1[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt3[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt5[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt6[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFpdt[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFpdtHdr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFpdt0[];
@@ -369,6 +380,20 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHpet[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoLpitHdr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoLpit0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoLpit1[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort0a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort1[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort1a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort2[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3b[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3c[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortAcc[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortHdr[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortMap[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortPad[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIvrs[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIvrs0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIvrs1[];
@@ -393,6 +418,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt11[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt12[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt13[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt14[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt15[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadtHdr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMcfg[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMcfg0[];
@@ -407,6 +433,18 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMsct[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMsct0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMtmr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMtmr0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfitHdr[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit1[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit2[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit2a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit3[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit3a[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit4[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit5[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit6[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoNfit6a[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt1[];
@@ -434,7 +472,11 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat1[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat3[];
-extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpa[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoStao[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoStaoStr[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpaHdr[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpaClient[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpaServer[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTpm2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoUefi[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoVrtc[];
@@ -444,14 +486,17 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdat[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdat0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWddt[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdrt[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWpbt[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWpbt0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoXenv[];
 
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoGeneric[][2];
 
-
 /*
- * dmtable
+ * dmtable and ahtable
  */
-extern ACPI_DMTABLE_DATA        AcpiDmTableData[];
+extern const ACPI_DMTABLE_DATA  AcpiDmTableData[];
+extern const AH_TABLE           AcpiSupportedTables[];
 
 UINT8
 AcpiDmGenerateChecksum (
@@ -459,7 +504,7 @@ AcpiDmGenerateChecksum (
     UINT32                  Length,
     UINT8                   OriginalChecksum);
 
-ACPI_DMTABLE_DATA *
+const ACPI_DMTABLE_DATA *
 AcpiDmGetTableData (
     char                    *Signature);
 
@@ -498,8 +543,13 @@ AcpiDmDumpBuffer (
     UINT32                  BufferOffset,
     UINT32                  Length,
     UINT32                  AbsoluteOffset,
-    char                    *Header,
-    BOOLEAN                 MultiLine);
+    char                    *Header);
+
+void
+AcpiDmDumpUnicode (
+    void                    *Table,
+    UINT32                  BufferOffset,
+    UINT32                  ByteLength);
 
 void
 AcpiDmDumpAsf (
@@ -521,6 +571,10 @@ void
 AcpiDmDumpDmar (
     ACPI_TABLE_HEADER       *Table);
 
+void
+AcpiDmDumpDrtm (
+    ACPI_TABLE_HEADER       *Table);
+
 void
 AcpiDmDumpEinj (
     ACPI_TABLE_HEADER       *Table);
@@ -545,6 +599,10 @@ void
 AcpiDmDumpHest (
     ACPI_TABLE_HEADER       *Table);
 
+void
+AcpiDmDumpIort (
+    ACPI_TABLE_HEADER       *Table);
+
 void
 AcpiDmDumpIvrs (
     ACPI_TABLE_HEADER       *Table);
@@ -573,6 +631,10 @@ void
 AcpiDmDumpMtmr (
     ACPI_TABLE_HEADER       *Table);
 
+void
+AcpiDmDumpNfit (
+    ACPI_TABLE_HEADER       *Table);
+
 void
 AcpiDmDumpPcct (
     ACPI_TABLE_HEADER       *Table);
@@ -605,6 +667,14 @@ void
 AcpiDmDumpSrat (
     ACPI_TABLE_HEADER       *Table);
 
+void
+AcpiDmDumpStao (
+    ACPI_TABLE_HEADER       *Table);
+
+void
+AcpiDmDumpTcpa (
+    ACPI_TABLE_HEADER       *Table);
+
 void
 AcpiDmDumpVrtc (
     ACPI_TABLE_HEADER       *Table);
@@ -613,6 +683,10 @@ void
 AcpiDmDumpWdat (
     ACPI_TABLE_HEADER       *Table);
 
+void
+AcpiDmDumpWpbt (
+    ACPI_TABLE_HEADER       *Table);
+
 void
 AcpiDmDumpXsdt (
     ACPI_TABLE_HEADER       *Table);
@@ -644,10 +718,6 @@ AcpiDmDisassembleOneOp (
     ACPI_OP_WALK_INFO       *Info,
     ACPI_PARSE_OBJECT       *Op);
 
-void
-AcpiDmDecodeInternalObject (
-    ACPI_OPERAND_OBJECT     *ObjDesc);
-
 UINT32
 AcpiDmListType (
     ACPI_PARSE_OBJECT       *Op);
@@ -706,29 +776,6 @@ AcpiDmNamestring (
     char                    *Name);
 
 
-/*
- * dmobject
- */
-void
-AcpiDmDisplayInternalObject (
-    ACPI_OPERAND_OBJECT     *ObjDesc,
-    ACPI_WALK_STATE         *WalkState);
-
-void
-AcpiDmDisplayArguments (
-    ACPI_WALK_STATE         *WalkState);
-
-void
-AcpiDmDisplayLocals (
-    ACPI_WALK_STATE         *WalkState);
-
-void
-AcpiDmDumpMethodInfo (
-    ACPI_STATUS             Status,
-    ACPI_WALK_STATE         *WalkState,
-    ACPI_PARSE_OBJECT       *Op);
-
-
 /*
  * dmbuffer
  */
index 238cdde..2fac6ee 100644 (file)
@@ -533,4 +533,14 @@ AcpiDsResultPush (
     ACPI_OPERAND_OBJECT     *Object,
     ACPI_WALK_STATE         *WalkState);
 
+
+/*
+ * dsdebug - parser debugging routines
+ */
+void
+AcpiDsDumpMethodStack (
+    ACPI_STATUS             Status,
+    ACPI_WALK_STATE         *WalkState,
+    ACPI_PARSE_OBJECT       *Op);
+
 #endif /* _ACDISPAT_H_ */
index 90511b2..ca09e6b 100644 (file)
@@ -269,8 +269,10 @@ typedef struct acpi_exception_info
 #define AE_AML_BAD_RESOURCE_LENGTH      EXCEP_AML (0x001F)
 #define AE_AML_ILLEGAL_ADDRESS          EXCEP_AML (0x0020)
 #define AE_AML_INFINITE_LOOP            EXCEP_AML (0x0021)
+#define AE_AML_UNINITIALIZED_NODE       EXCEP_AML (0x0022)
+#define AE_AML_TARGET_TYPE              EXCEP_AML (0x0023)
 
-#define AE_CODE_AML_MAX                 0x0021
+#define AE_CODE_AML_MAX                 0x0023
 
 
 /*
@@ -394,7 +396,9 @@ static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Aml[] =
     EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE",     "Two references refer to each other"),
     EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH",    "The length of a Resource Descriptor in the AML is incorrect"),
     EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS",        "A memory, I/O, or PCI configuration address is invalid"),
-    EXCEP_TXT ("AE_AML_INFINITE_LOOP",          "An apparent infinite AML While loop, method was aborted")
+    EXCEP_TXT ("AE_AML_INFINITE_LOOP",          "An apparent infinite AML While loop, method was aborted"),
+    EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE",     "A namespace node is uninitialized or unresolved"),
+    EXCEP_TXT ("AE_AML_TARGET_TYPE",            "A target operand of an incorrect type was encountered")
 };
 
 static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Ctrl[] =
index 1610799..2733f39 100644 (file)
@@ -131,6 +131,9 @@ ACPI_GLOBAL (ACPI_TABLE_LIST,           AcpiGbl_RootTableList);
 
 ACPI_GLOBAL (ACPI_TABLE_HEADER *,       AcpiGbl_DSDT);
 ACPI_GLOBAL (ACPI_TABLE_HEADER,         AcpiGbl_OriginalDsdtHeader);
+ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX);
+ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX);
+ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL (ACPI_TABLE_FACS *,         AcpiGbl_FACS);
@@ -310,6 +313,10 @@ ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_NestingLevel, 0);
 
 ACPI_GLOBAL (ACPI_THREAD_STATE *,       AcpiGbl_CurrentWalkList);
 
+/* Maximum number of While() loop iterations before forced abort */
+
+ACPI_GLOBAL (UINT16,                    AcpiGbl_MaxLoopIterations);
+
 /* Control method single step flag */
 
 ACPI_GLOBAL (UINT8,                     AcpiGbl_CmSingleStep);
@@ -363,8 +370,6 @@ ACPI_GLOBAL (UINT32,                    AcpiFixedEventCount[ACPI_NUM_FIXED_EVENT
 
 ACPI_GLOBAL (UINT32,                    AcpiGbl_OriginalDbgLevel);
 ACPI_GLOBAL (UINT32,                    AcpiGbl_OriginalDbgLayer);
-ACPI_GLOBAL (UINT32,                    AcpiGbl_TraceDbgLevel);
-ACPI_GLOBAL (UINT32,                    AcpiGbl_TraceDbgLayer);
 
 
 /*****************************************************************************
@@ -383,9 +388,10 @@ ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_NoResourceDisassembly, FALSE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_IgnoreNoopOperator, FALSE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_CstyleDisassembly, TRUE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_ForceAmlDisassembly, FALSE);
+ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_DmOpt_Verbose, TRUE);
 
-ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_Disasm);
-ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_Verbose);
+ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DmOpt_Disasm);
+ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DmOpt_Listing);
 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_NumExternalMethods);
 ACPI_GLOBAL (UINT32,                    AcpiGbl_ResolvedExternalMethods);
 ACPI_GLOBAL (ACPI_EXTERNAL_LIST *,      AcpiGbl_ExternalList);
@@ -420,13 +426,16 @@ ACPI_GLOBAL (char,                      AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUF
 /*
  * Statistic globals
  */
-ACPI_GLOBAL (UINT16,                    AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]);
-ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]);
+ACPI_GLOBAL (UINT16,                    AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]);
+ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]);
 ACPI_GLOBAL (UINT16,                    AcpiGbl_ObjTypeCountMisc);
 ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCountMisc);
 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumNodes);
 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumObjects);
 
+ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_DbCommandReady);
+ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_DbCommandComplete);
+
 #endif /* ACPI_DEBUGGER */
 
 
index f0edcb1..77d6953 100644 (file)
@@ -215,6 +215,35 @@ AcpiExDoDebugObject (
     UINT32                  Level,
     UINT32                  Index);
 
+void
+AcpiExStartTraceMethod (
+    ACPI_NAMESPACE_NODE     *MethodNode,
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiExStopTraceMethod (
+    ACPI_NAMESPACE_NODE     *MethodNode,
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiExStartTraceOpcode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiExStopTraceOpcode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_WALK_STATE         *WalkState);
+
+void
+AcpiExTracePoint (
+    ACPI_TRACE_EVENT_TYPE   Type,
+    BOOLEAN                 Begin,
+    UINT8                   *Aml,
+    char                    *Pathname);
+
 
 /*
  * exfield - ACPI AML (p-code) execution - field manipulation
@@ -710,6 +739,11 @@ AcpiExIntegerToString (
     char                    *Dest,
     UINT64                  Value);
 
+void
+AcpiExPciClsToString (
+    char                    *Dest,
+    UINT8                   ClassCode[3]);
+
 BOOLEAN
 AcpiIsValidSpaceId (
     UINT8                   SpaceId);
index 9e0d08d..fdeafff 100644 (file)
@@ -159,10 +159,8 @@ union acpi_parse_object;
 #define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
 #define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
 #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
-#define ACPI_MTX_DEBUG_CMD_COMPLETE     6   /* AML debugger */
-#define ACPI_MTX_DEBUG_CMD_READY        7   /* AML debugger */
 
-#define ACPI_MAX_MUTEX                  7
+#define ACPI_MAX_MUTEX                  5
 #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
 
 
@@ -265,8 +263,12 @@ typedef struct acpi_namespace_node
      */
 #ifdef ACPI_LARGE_NAMESPACE_NODE
     union acpi_parse_object         *Op;
+    void                            *MethodLocals;
+    void                            *MethodArgs;
     UINT32                          Value;
     UINT32                          Length;
+    UINT8                           ArgCount;
+
 #endif
 
 } ACPI_NAMESPACE_NODE;
@@ -306,10 +308,9 @@ typedef struct acpi_table_list
 #define ACPI_ROOT_ALLOW_RESIZE          (2)
 
 
-/* Predefined (fixed) table indexes */
+/* Predefined table indexes */
 
-#define ACPI_TABLE_INDEX_DSDT           (0)
-#define ACPI_TABLE_INDEX_FACS           (1)
+#define ACPI_INVALID_TABLE_INDEX        (0xFFFFFFFF)
 
 
 typedef struct acpi_find_context
@@ -397,13 +398,17 @@ ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
-#define ACPI_BTYPE_REFERENCE            0x00010000
+#define ACPI_BTYPE_REFERENCE_OBJECT     0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */
 #define ACPI_BTYPE_RESOURCE             0x00020000
+#define ACPI_BTYPE_NAMED_REFERENCE      0x00040000 /* Generic unresolved Name or Namepath */
 
 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
 
 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
-#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+
+    /* Used by Copy, DeRefOf, Store, Printf, Fprintf */
+
+#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
@@ -473,12 +478,24 @@ typedef struct acpi_package_info3
 
 } ACPI_PACKAGE_INFO3;
 
+typedef struct acpi_package_info4
+{
+    UINT8                       Type;
+    UINT8                       ObjectType1;
+    UINT8                       Count1;
+    UINT8                       SubObjectTypes;
+    UINT8                       PkgCount;
+    UINT16                      Reserved;
+
+} ACPI_PACKAGE_INFO4;
+
 typedef union acpi_predefined_info
 {
     ACPI_NAME_INFO              Info;
     ACPI_PACKAGE_INFO           RetInfo;
     ACPI_PACKAGE_INFO2          RetInfo2;
     ACPI_PACKAGE_INFO3          RetInfo3;
+    ACPI_PACKAGE_INFO4          RetInfo4;
 
 } ACPI_PREDEFINED_INFO;
 
@@ -520,6 +537,16 @@ typedef struct acpi_simple_repair_info
 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
 
 
+/* Info for running the _REG methods */
+
+typedef struct acpi_reg_walk_info
+{
+    ACPI_ADR_SPACE_TYPE     SpaceId;
+    UINT32                  RegRunCount;
+
+} ACPI_REG_WALK_INFO;
+
+
 /*****************************************************************************
  *
  * Event typedefs and structs
@@ -923,7 +950,7 @@ typedef union acpi_parse_value
 } ACPI_PARSE_VALUE;
 
 
-#ifdef ACPI_DISASSEMBLER
+#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
 #else
 #define ACPI_DISASM_ONLY_MEMBERS(a)
@@ -934,7 +961,7 @@ typedef union acpi_parse_value
     UINT8                           DescriptorType; /* To differentiate various internal objs */\
     UINT8                           Flags;          /* Type of Op */\
     UINT16                          AmlOpcode;      /* AML opcode */\
-    UINT32                          AmlOffset;      /* Offset of declaration in AML */\
+    UINT8                           *Aml;           /* Address of declaration in AML */\
     union acpi_parse_object         *Next;          /* Next op */\
     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
@@ -1064,7 +1091,7 @@ typedef struct acpi_parse_state
 #define ACPI_PARSEOP_PARAMLIST          0x02
 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
 #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
-#define ACPI_PARSEOP_SPECIAL            0x10
+#define ACPI_PARSEOP_CLOSING_PAREN      0x10
 #define ACPI_PARSEOP_COMPOUND           0x20
 #define ACPI_PARSEOP_ASSIGNMENT         0x40
 
@@ -1350,7 +1377,9 @@ typedef struct acpi_db_method_info
      *   Index of current thread inside all them created.
      */
     char                            InitArgs;
+#ifdef ACPI_DEBUGGER
     ACPI_OBJECT_TYPE                ArgTypes[4];
+#endif
     char                            *Arguments[4];
     char                            NumThreadsStr[11];
     char                            IdOfThreadStr[11];
@@ -1372,6 +1401,13 @@ typedef struct acpi_integrity_info
 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
 
 
+typedef struct acpi_object_info
+{
+    UINT32                  Types[ACPI_TOTAL_TYPES];
+
+} ACPI_OBJECT_INFO;
+
+
 /*****************************************************************************
  *
  * Debug
@@ -1443,4 +1479,11 @@ typedef struct ah_uuid
 
 } AH_UUID;
 
+typedef struct ah_table
+{
+    char                    *Signature;
+    char                    *Description;
+
+} AH_TABLE;
+
 #endif /* __ACLOCAL_H__ */
index c1f5f81..f8dfffb 100644 (file)
 #define ACPI_MUL_32(a)                  _ACPI_MUL(a, 5)
 #define ACPI_MOD_32(a)                  _ACPI_MOD(a, 32)
 
+/* Test for ASCII character */
+
+#define ACPI_IS_ASCII(c)                ((c) < 0x80)
+
+/* Signed integers */
+
+#define ACPI_SIGN_POSITIVE              0
+#define ACPI_SIGN_NEGATIVE              1
+
+
 /*
  * Rounding macros (Power of two boundaries only)
  */
index e87f927..7c5ef64 100644 (file)
 #define METHOD_NAME__BBN        "_BBN"
 #define METHOD_NAME__CBA        "_CBA"
 #define METHOD_NAME__CID        "_CID"
+#define METHOD_NAME__CLS        "_CLS"
 #define METHOD_NAME__CRS        "_CRS"
 #define METHOD_NAME__DDN        "_DDN"
 #define METHOD_NAME__HID        "_HID"
index b66d3e4..db7f114 100644 (file)
 #define ACPI_NS_PREFIX_IS_SCOPE     0x10
 #define ACPI_NS_EXTERNAL            0x20
 #define ACPI_NS_TEMPORARY           0x40
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
 
 /* Flags for AcpiNsWalkNamespace */
 
@@ -421,16 +422,22 @@ UINT32
 AcpiNsOpensScope (
     ACPI_OBJECT_TYPE        Type);
 
-ACPI_STATUS
-AcpiNsBuildExternalPath (
-    ACPI_NAMESPACE_NODE     *Node,
-    ACPI_SIZE               Size,
-    char                    *NameBuffer);
-
 char *
 AcpiNsGetExternalPathname (
     ACPI_NAMESPACE_NODE     *Node);
 
+UINT32
+AcpiNsBuildNormalizedPath (
+    ACPI_NAMESPACE_NODE     *Node,
+    char                    *FullPath,
+    UINT32                  PathSize,
+    BOOLEAN                 NoTrailing);
+
+char *
+AcpiNsGetNormalizedPathname (
+    ACPI_NAMESPACE_NODE     *Node,
+    BOOLEAN                 NoTrailing);
+
 char *
 AcpiNsNameOfCurrentScope (
     ACPI_WALK_STATE         *WalkState);
@@ -438,7 +445,8 @@ AcpiNsNameOfCurrentScope (
 ACPI_STATUS
 AcpiNsHandleToPathname (
     ACPI_HANDLE             TargetHandle,
-    ACPI_BUFFER             *Buffer);
+    ACPI_BUFFER             *Buffer,
+    BOOLEAN                 NoTrailing);
 
 BOOLEAN
 AcpiNsPatternMatch (
index 0712e75..feaa9d1 100644 (file)
@@ -285,6 +285,7 @@ typedef struct acpi_object_method
     UINT8                           ParamCount;
     UINT8                           SyncLevel;
     union acpi_operand_object       *Mutex;
+    union acpi_operand_object       *Node;
     UINT8                           *AmlStart;
     union
     {
@@ -502,13 +503,14 @@ typedef struct acpi_object_addr_handler
 typedef struct acpi_object_reference
 {
     ACPI_OBJECT_COMMON_HEADER
-     UINT8                           Class;              /* Reference Class */
-     UINT8                           TargetType;         /* Used for Index Op */
-     UINT8                           Reserved;
-     void                            *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
-     ACPI_NAMESPACE_NODE             *Node;              /* RefOf or Namepath */
-     union acpi_operand_object       **Where;            /* Target of Index */
-     UINT32                          Value;              /* Used for Local/Arg/Index/DdbHandle */
+    UINT8                           Class;              /* Reference Class */
+    UINT8                           TargetType;         /* Used for Index Op */
+    UINT8                           Reserved;
+    void                            *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
+    ACPI_NAMESPACE_NODE             *Node;              /* RefOf or Namepath */
+    union acpi_operand_object       **Where;            /* Target of Index */
+    UINT8                           *IndexPointer;      /* Used for Buffers and Strings */
+    UINT32                          Value;              /* Used for Local/Arg/Index/DdbHandle */
 
 } ACPI_OBJECT_REFERENCE;
 
index 133e134..50bac80 100644 (file)
 #define ARGI_ARG4                       ARG_NONE
 #define ARGI_ARG5                       ARG_NONE
 #define ARGI_ARG6                       ARG_NONE
-#define ARGI_BANK_FIELD_OP              ARGI_INVALID_OPCODE
+#define ARGI_BANK_FIELD_OP              ARGI_LIST1 (ARGI_INTEGER)
 #define ARGI_BIT_AND_OP                 ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_BIT_NAND_OP                ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_BIT_NOR_OP                 ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_SLEEP_OP                   ARGI_LIST1 (ARGI_INTEGER)
 #define ARGI_STALL_OP                   ARGI_LIST1 (ARGI_INTEGER)
 #define ARGI_STATICSTRING_OP            ARGI_INVALID_OPCODE
-#define ARGI_STORE_OP                   ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
+#define ARGI_STORE_OP                   ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_STORE_TARGET)
 #define ARGI_STRING_OP                  ARGI_INVALID_OPCODE
 #define ARGI_SUBTRACT_OP                ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_THERMAL_ZONE_OP            ARGI_INVALID_OPCODE
index f0cd27a..a9c73b9 100644 (file)
 #define ACPI_LV_DEBUG_OBJECT        0x00000002
 #define ACPI_LV_INFO                0x00000004
 #define ACPI_LV_REPAIR              0x00000008
-#define ACPI_LV_ALL_EXCEPTIONS      0x0000000F
+#define ACPI_LV_TRACE_POINT         0x00000010
+#define ACPI_LV_ALL_EXCEPTIONS      0x0000001F
 
 /* Trace verbosity level 1 [Standard Trace Level] */
 
 #define ACPI_DB_DEBUG_OBJECT        ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
 #define ACPI_DB_INFO                ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
 #define ACPI_DB_REPAIR              ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR)
+#define ACPI_DB_TRACE_POINT         ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT)
 #define ACPI_DB_ALL_EXCEPTIONS      ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
 
 /* Trace level -- also used in the global "DebugLevel" */
 #define ACPI_DEBUG_ALL              (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
 
+/*
+ * Global trace flags
+ */
+#define ACPI_TRACE_ENABLED          ((UINT32) 4)
+#define ACPI_TRACE_ONESHOT          ((UINT32) 2)
+#define ACPI_TRACE_OPCODE           ((UINT32) 1)
+
+/* Defaults for trace debugging level/layer */
+
+#define ACPI_TRACE_LEVEL_ALL        ACPI_LV_ALL
+#define ACPI_TRACE_LAYER_ALL        0x000001FF
+#define ACPI_TRACE_LEVEL_DEFAULT    ACPI_LV_TRACE_POINT
+#define ACPI_TRACE_LAYER_DEFAULT    ACPI_EXECUTER
+
+
 #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
 /*
  * The module name is used primarily for error and debug messages.
 
 /* DEBUG_PRINT functions */
 
-#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+#ifndef COMPILER_VA_MACRO
+
+#define ACPI_DEBUG_PRINT(plist)         AcpiDebugPrint plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     AcpiDebugPrintRaw plist
+
+#else
 
 /* Helper macros for DEBUG_PRINT */
 
     ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \
         Filename, Modulename, Component, __VA_ARGS__)
 
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+#endif
+
 
 /*
  * Function entry tracing
 #define ACPI_DUMP_PATHNAME(a, b, c, d)  AcpiNsDumpPathname(a, b, c, d)
 #define ACPI_DUMP_BUFFER(a, b)          AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
 
+#define ACPI_TRACE_POINT(a, b, c, d)    AcpiTracePoint (a, b, c, d)
+
 #else /* ACPI_DEBUG_OUTPUT */
 /*
  * This is the non-debug case -- make everything go away,
 #define ACPI_DUMP_PATHNAME(a, b, c, d)
 #define ACPI_DUMP_BUFFER(a, b)
 #define ACPI_IS_DEBUG_ENABLED(Level, Component) 0
+#define ACPI_TRACE_POINT(a, b, c, d)
 
 /* Return macros must have a return statement at the minimum */
 
index abbde50..c525dd3 100644 (file)
  *
  *****************************************************************************/
 
+extern const UINT8      AcpiGbl_ShortOpIndex[];
+extern const UINT8      AcpiGbl_LongOpIndex[];
+
 
 /*
  * psxface - Parser external interfaces
@@ -375,7 +378,7 @@ AcpiPsDeleteParseTree (
  */
 ACPI_PARSE_OBJECT *
 AcpiPsCreateScopeOp (
-    void);
+    UINT8                   *Aml);
 
 void
 AcpiPsInitOp (
@@ -384,7 +387,8 @@ AcpiPsInitOp (
 
 ACPI_PARSE_OBJECT *
 AcpiPsAllocOp (
-    UINT16                  opcode);
+    UINT16                  Opcode,
+    UINT8                   *Aml);
 
 void
 AcpiPsFreeOp (
index 68d79c7..45cec74 100644 (file)
@@ -671,5 +671,14 @@ AcpiOsSetFileOffset (
     UINT8                   From);
 #endif
 
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
+void
+AcpiOsTracePoint (
+    ACPI_TRACE_EVENT_TYPE   Type,
+    BOOLEAN                 Begin,
+    UINT8                   *Aml,
+    char                    *Pathname);
+#endif
+
 
 #endif /* __ACPIOSXF_H__ */
index 74de05e..55412c8 100644 (file)
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20150410
+#define ACPI_CA_VERSION                 0x20150930
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -273,6 +273,15 @@ ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DoNotUseXsdt, FALSE);
  */
 ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_Use32BitFadtAddresses, FALSE);
 
+/*
+ * Optionally use 32-bit FACS table addresses.
+ * It is reported that some platforms fail to resume from system suspending
+ * if 64-bit FACS table address is selected:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=74021
+ * Default is TRUE, favor the 32-bit addresses.
+ */
+ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_Use32BitFacsAddresses, TRUE);
+
 /*
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  * with other ACPI implementations. NOTE: During ACPICA initialization,
@@ -293,6 +302,11 @@ ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DisableAutoRepair, FALSE);
  */
 ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DisableSsdtTableInstall, FALSE);
 
+/*
+ * Optionally enable runtime namespace override.
+ */
+ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_RuntimeNamespaceOverride, TRUE);
+
 /*
  * We keep track of the latest version of Windows that has been requested by
  * the BIOS. ACPI 5.0.
@@ -311,7 +325,9 @@ ACPI_INIT_GLOBAL (BOOLEAN,          AcpiGbl_ReducedHardware, FALSE);
  * traced each time it is executed.
  */
 ACPI_INIT_GLOBAL (UINT32,           AcpiGbl_TraceFlags, 0);
-ACPI_INIT_GLOBAL (ACPI_NAME,        AcpiGbl_TraceMethodName, 0);
+ACPI_INIT_GLOBAL (const char *,     AcpiGbl_TraceMethodName, NULL);
+ACPI_INIT_GLOBAL (UINT32,           AcpiGbl_TraceDbgLevel, ACPI_TRACE_LEVEL_DEFAULT);
+ACPI_INIT_GLOBAL (UINT32,           AcpiGbl_TraceDbgLayer, ACPI_TRACE_LAYER_DEFAULT);
 
 /*
  * Runtime configuration of debug output control masks. We want the debug
@@ -668,7 +684,7 @@ AcpiGetData (
 ACPI_EXTERNAL_RETURN_STATUS (
 ACPI_STATUS
 AcpiDebugTrace (
-    char                    *Name,
+    const char              *Name,
     UINT32                  DebugLevel,
     UINT32                  DebugLayer,
     UINT32                  Flags))
@@ -1138,14 +1154,8 @@ AcpiLeaveSleepState (
 ACPI_HW_DEPENDENT_RETURN_STATUS (
 ACPI_STATUS
 AcpiSetFirmwareWakingVector (
-    UINT32                  PhysicalAddress))
-
-#if ACPI_MACHINE_WIDTH == 64
-ACPI_HW_DEPENDENT_RETURN_STATUS (
-ACPI_STATUS
-AcpiSetFirmwareWakingVector64 (
-    UINT64                  PhysicalAddress))
-#endif
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
+    ACPI_PHYSICAL_ADDRESS   PhysicalAddress64))
 
 
 /*
@@ -1255,6 +1265,14 @@ AcpiDebugPrintRaw (
     const char              *Format,
     ...))
 
+ACPI_DBG_DEPENDENT_RETURN_VOID (
+void
+AcpiTracePoint (
+    ACPI_TRACE_EVENT_TYPE   Type,
+    BOOLEAN                 Begin,
+    UINT8                   *Aml,
+    char                    *Pathname))
+
 ACPI_APP_DEPENDENT_RETURN_VOID (
 ACPI_PRINTF_LIKE(1)
 void ACPI_INTERNAL_VAR_XFACE
@@ -1262,4 +1280,12 @@ AcpiLogError (
     const char              *Format,
     ...))
 
+ACPI_STATUS
+AcpiInitializeDebugger (
+    void);
+
+void
+AcpiTerminateDebugger (
+    void);
+
 #endif /* __ACXFACE_H__ */
index b03f64b..37f0244 100644 (file)
  *      count = 0 (optional)
  *      (Used for _DLM)
  *
+ * ACPI_PTYPE2_VAR_VAR: Variable number of subpackages, each of either a
+ *      constant or variable length. The subpackages are preceded by a
+ *      constant number of objects.
+ *      (Used for _LPI, _RDI)
+ *
  * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID
  *      defines the format of the package. Zero-length parent package is
  *      allowed.
@@ -197,7 +202,8 @@ enum AcpiReturnPackageTypes
     ACPI_PTYPE2_MIN         = 8,
     ACPI_PTYPE2_REV_FIXED   = 9,
     ACPI_PTYPE2_FIX_VAR     = 10,
-    ACPI_PTYPE2_UUID_PAIR   = 11
+    ACPI_PTYPE2_VAR_VAR     = 11,
+    ACPI_PTYPE2_UUID_PAIR   = 12
 };
 
 
@@ -249,7 +255,7 @@ enum AcpiReturnPackageTypes
  * These are the names that can actually be evaluated via AcpiEvaluateObject.
  * Not present in this table are the following:
  *
- *      1) Predefined/Reserved names that are never evaluated via
+ *      1) Predefined/Reserved names that are not usually evaluated via
  *         AcpiEvaluateObject:
  *              _Lxx and _Exx GPE methods
  *              _Qxx EC methods
@@ -435,6 +441,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
                     PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0),
 
+    {{"_BTH",   METHOD_1ARGS (ACPI_TYPE_INTEGER),      /* ACPI 6.0 */
+                METHOD_NO_RETURN_VALUE}},
+
     {{"_BTM",   METHOD_1ARGS (ACPI_TYPE_INTEGER),
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
@@ -462,6 +471,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */
                     PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0,0,0),
 
+    {{"_CR3",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
+
     {{"_CRS",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},
 
@@ -515,7 +527,7 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_DOS",   METHOD_1ARGS (ACPI_TYPE_INTEGER),
                 METHOD_NO_RETURN_VALUE}},
 
-    {{"_DSD",   METHOD_0ARGS,
+    {{"_DSD",   METHOD_0ARGS,                          /* ACPI 6.0 */
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */
                     PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0),
 
@@ -669,6 +681,11 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */
                     PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0),
 
+    {{"_LPI",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (3 Int, n Pkg (10 Int/Buf) */
+                    PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3,
+                    ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING, 10,0),
+
     {{"_MAT",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},
 
@@ -686,6 +703,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_MSM",   METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
+    {{"_MTL",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
+
     {{"_NTT",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
@@ -773,6 +793,10 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
                     PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0),
 
+    {{"_PRR",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Ref) */
+                    PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_REFERENCE, 1,0,0,0),
+
     {{"_PRS",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},
 
@@ -850,6 +874,11 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_PXM",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
+    {{"_RDI",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int, n Pkg (m Ref)) */
+                    PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 1,
+                    ACPI_RTYPE_REFERENCE,0,0),
+
     {{"_REG",   METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
                 METHOD_NO_RETURN_VALUE}},
 
@@ -862,6 +891,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_ROM",   METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
                 METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},
 
+    {{"_RST",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_NO_RETURN_VALUE}},
+
     {{"_RTV",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
@@ -988,6 +1020,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_TDL",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
+    {{"_TFP",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
+
     {{"_TIP",   METHOD_1ARGS (ACPI_TYPE_INTEGER),
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
@@ -1011,6 +1046,9 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */
                     PACKAGE_INFO (ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0,0,0),
 
+    {{"_TSN",   METHOD_0ARGS,                          /* ACPI 6.0 */
+                METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}},
+
     {{"_TSP",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},
 
index ad43d6c..f8443d6 100644 (file)
@@ -157,9 +157,10 @@ typedef struct acpi_walk_state
     UINT8                           ReturnUsed;
     UINT8                           ScopeDepth;
     UINT8                           PassNumber;         /* Parse pass during table load */
+    BOOLEAN                         NamespaceOverride;  /* Override existing objects */
     UINT8                           ResultSize;         /* Total elements for the result stack */
     UINT8                           ResultCount;        /* Current number of occupied elements of result stack */
-    UINT32                          AmlOffset;
+    UINT8                           *Aml;
     UINT32                          ArgTypes;
     UINT32                          MethodBreakpoint;   /* For single stepping */
     UINT32                          UserBreakpoint;     /* User AML breakpoint */
index 5a79540..10fb56d 100644 (file)
@@ -308,18 +308,30 @@ AcpiTbCopyDsdt (
 
 void
 AcpiTbInstallTableWithOverride (
-    UINT32                  TableIndex,
     ACPI_TABLE_DESC         *NewTableDesc,
-    BOOLEAN                 Override);
+    BOOLEAN                 Override,
+    UINT32                  *TableIndex);
 
 ACPI_STATUS
 AcpiTbInstallFixedTable (
     ACPI_PHYSICAL_ADDRESS   Address,
     char                    *Signature,
-    UINT32                  TableIndex);
+    UINT32                  *TableIndex);
 
 ACPI_STATUS
 AcpiTbParseRootTable (
     ACPI_PHYSICAL_ADDRESS   RsdpAddress);
 
+BOOLEAN
+AcpiIsValidSignature (
+    char                    *Signature);
+
+
+/*
+ * tbxfload
+ */
+ACPI_STATUS
+AcpiTbLoadNamespace (
+    void);
+
 #endif /* __ACTABLES_H__ */
index 68bbed4..7ec5f62 100644 (file)
 #define ACPI_SIG_DSDT           "DSDT"      /* Differentiated System Description Table */
 #define ACPI_SIG_FADT           "FACP"      /* Fixed ACPI Description Table */
 #define ACPI_SIG_FACS           "FACS"      /* Firmware ACPI Control Structure */
+#define ACPI_SIG_OSDT           "OSDT"      /* Override System Description Table */
 #define ACPI_SIG_PSDT           "PSDT"      /* Persistent System Description Table */
 #define ACPI_SIG_RSDP           "RSD PTR "  /* Root System Description Pointer */
 #define ACPI_SIG_RSDT           "RSDT"      /* Root System Description Table */
@@ -382,6 +383,7 @@ typedef struct acpi_table_fadt
     ACPI_GENERIC_ADDRESS    XGpe1Block;         /* 64-bit Extended General Purpose Event 1 Reg Blk address */
     ACPI_GENERIC_ADDRESS    SleepControl;       /* 64-bit Sleep Control register (ACPI 5.0) */
     ACPI_GENERIC_ADDRESS    SleepStatus;        /* 64-bit Sleep Status register (ACPI 5.0) */
+    UINT64                  HypervisorId;       /* Hypervisor Vendor ID (ACPI 6.0) */
 
 } ACPI_TABLE_FADT;
 
@@ -441,7 +443,7 @@ enum AcpiPreferredPmProfiles
     PM_TABLET               = 8
 };
 
-/* Values for SleepStatus and SleepControl registers (V5 FADT) */
+/* Values for SleepStatus and SleepControl registers (V5+ FADT) */
 
 #define ACPI_X_WAKE_STATUS          0x80
 #define ACPI_X_SLEEP_TYPE_MASK      0x1C
@@ -506,15 +508,17 @@ typedef struct acpi_table_desc
  * FADT is the bottom line as to what the version really is.
  *
  * For reference, the values below are as follows:
- *     FADT V1  size: 0x074
- *     FADT V2  size: 0x084
- *     FADT V3  size: 0x0F4
- *     FADT V4  size: 0x0F4
- *     FADT V5  size: 0x10C
+ *     FADT V1 size: 0x074
+ *     FADT V2 size: 0x084
+ *     FADT V3 size: 0x0F4
+ *     FADT V4 size: 0x0F4
+ *     FADT V5 size: 0x10C
+ *     FADT V6 size: 0x114
  */
 #define ACPI_FADT_V1_SIZE       (UINT32) (ACPI_FADT_OFFSET (Flags) + 4)
 #define ACPI_FADT_V2_SIZE       (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1)
 #define ACPI_FADT_V3_SIZE       (UINT32) (ACPI_FADT_OFFSET (SleepControl))
-#define ACPI_FADT_V5_SIZE       (UINT32) (sizeof (ACPI_TABLE_FADT))
+#define ACPI_FADT_V5_SIZE       (UINT32) (ACPI_FADT_OFFSET (HypervisorId))
+#define ACPI_FADT_V6_SIZE       (UINT32) (sizeof (ACPI_TABLE_FADT))
 
 #endif /* __ACTBL_H__ */
index 2c8b0ed..dd00f20 100644 (file)
 #define ACPI_SIG_SBST           "SBST"      /* Smart Battery Specification Table */
 #define ACPI_SIG_SLIT           "SLIT"      /* System Locality Distance Information Table */
 #define ACPI_SIG_SRAT           "SRAT"      /* System Resource Affinity Table */
+#define ACPI_SIG_NFIT           "NFIT"      /* NVDIMM Firmware Interface Table */
 
 
 /*
@@ -849,7 +850,8 @@ enum AcpiMadtType
     ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR      = 12,
     ACPI_MADT_TYPE_GENERIC_MSI_FRAME        = 13,
     ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR    = 14,
-    ACPI_MADT_TYPE_RESERVED                 = 15    /* 15 and greater are reserved */
+    ACPI_MADT_TYPE_GENERIC_TRANSLATOR       = 15,
+    ACPI_MADT_TYPE_RESERVED                 = 16    /* 16 and greater are reserved */
 };
 
 
@@ -1004,7 +1006,7 @@ typedef struct acpi_madt_local_x2apic_nmi
 } ACPI_MADT_LOCAL_X2APIC_NMI;
 
 
-/* 11: Generic Interrupt (ACPI 5.0) */
+/* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
 
 typedef struct acpi_madt_generic_interrupt
 {
@@ -1022,6 +1024,8 @@ typedef struct acpi_madt_generic_interrupt
     UINT32                  VgicInterrupt;
     UINT64                  GicrBaseAddress;
     UINT64                  ArmMpidr;
+    UINT8                   EfficiencyClass;
+    UINT8                   Reserved2[3];
 
 } ACPI_MADT_GENERIC_INTERRUPT;
 
@@ -1032,7 +1036,7 @@ typedef struct acpi_madt_generic_interrupt
 #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)  /* 02: VGIC Maintenance Interrupt mode */
 
 
-/* 12: Generic Distributor (ACPI 5.0) */
+/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
 
 typedef struct acpi_madt_generic_distributor
 {
@@ -1041,10 +1045,23 @@ typedef struct acpi_madt_generic_distributor
     UINT32                  GicId;
     UINT64                  BaseAddress;
     UINT32                  GlobalIrqBase;
-    UINT32                  Reserved2;          /* Reserved - must be zero */
+    UINT8                   Version;
+    UINT8                   Reserved2[3];       /* Reserved - must be zero */
 
 } ACPI_MADT_GENERIC_DISTRIBUTOR;
 
+/* Values for Version field above */
+
+enum AcpiMadtGicVersion
+{
+    ACPI_MADT_GIC_VERSION_NONE          = 0,
+    ACPI_MADT_GIC_VERSION_V1            = 1,
+    ACPI_MADT_GIC_VERSION_V2            = 2,
+    ACPI_MADT_GIC_VERSION_V3            = 3,
+    ACPI_MADT_GIC_VERSION_V4            = 4,
+    ACPI_MADT_GIC_VERSION_RESERVED      = 5     /* 5 and greater are reserved */
+};
+
 
 /* 13: Generic MSI Frame (ACPI 5.1) */
 
@@ -1077,6 +1094,19 @@ typedef struct acpi_madt_generic_redistributor
 } ACPI_MADT_GENERIC_REDISTRIBUTOR;
 
 
+/* 15: Generic Translator (ACPI 6.0) */
+
+typedef struct acpi_madt_generic_translator
+{
+    ACPI_SUBTABLE_HEADER    Header;
+    UINT16                  Reserved;           /* reserved - must be zero */
+    UINT32                  TranslationId;
+    UINT64                  BaseAddress;
+    UINT32                  Reserved2;
+
+} ACPI_MADT_GENERIC_TRANSLATOR;
+
+
 /*
  * Common flags fields for MADT subtables
  */
@@ -1135,6 +1165,186 @@ typedef struct acpi_msct_proximity
 } ACPI_MSCT_PROXIMITY;
 
 
+/*******************************************************************************
+ *
+ * NFIT - NVDIMM Interface Table (ACPI 6.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_nfit
+{
+    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
+    UINT32                  Reserved;           /* Reserved, must be zero */
+
+} ACPI_TABLE_NFIT;
+
+/* Subtable header for NFIT */
+
+typedef struct acpi_nfit_header
+{
+    UINT16                   Type;
+    UINT16                   Length;
+
+} ACPI_NFIT_HEADER;
+
+
+/* Values for subtable type in ACPI_NFIT_HEADER */
+
+enum AcpiNfitType
+{
+    ACPI_NFIT_TYPE_SYSTEM_ADDRESS       = 0,
+    ACPI_NFIT_TYPE_MEMORY_MAP           = 1,
+    ACPI_NFIT_TYPE_INTERLEAVE           = 2,
+    ACPI_NFIT_TYPE_SMBIOS               = 3,
+    ACPI_NFIT_TYPE_CONTROL_REGION       = 4,
+    ACPI_NFIT_TYPE_DATA_REGION          = 5,
+    ACPI_NFIT_TYPE_FLUSH_ADDRESS        = 6,
+    ACPI_NFIT_TYPE_RESERVED             = 7     /* 7 and greater are reserved */
+};
+
+/*
+ * NFIT Subtables
+ */
+
+/* 0: System Physical Address Range Structure */
+
+typedef struct acpi_nfit_system_address
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT16                  RangeIndex;
+    UINT16                  Flags;
+    UINT32                  Reserved;           /* Reseved, must be zero */
+    UINT32                  ProximityDomain;
+    UINT8                   RangeGuid[16];
+    UINT64                  Address;
+    UINT64                  Length;
+    UINT64                  MemoryMapping;
+
+} ACPI_NFIT_SYSTEM_ADDRESS;
+
+/* Flags */
+
+#define ACPI_NFIT_ADD_ONLINE_ONLY       (1)     /* 00: Add/Online Operation Only */
+#define ACPI_NFIT_PROXIMITY_VALID       (1<<1)  /* 01: Proximity Domain Valid */
+
+/* Range Type GUIDs appear in the include/acuuid.h file */
+
+
+/* 1: Memory Device to System Address Range Map Structure */
+
+typedef struct acpi_nfit_memory_map
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT32                  DeviceHandle;
+    UINT16                  PhysicalId;
+    UINT16                  RegionId;
+    UINT16                  RangeIndex;
+    UINT16                  RegionIndex;
+    UINT64                  RegionSize;
+    UINT64                  RegionOffset;
+    UINT64                  Address;
+    UINT16                  InterleaveIndex;
+    UINT16                  InterleaveWays;
+    UINT16                  Flags;
+    UINT16                  Reserved;           /* Reserved, must be zero */
+
+} ACPI_NFIT_MEMORY_MAP;
+
+/* Flags */
+
+#define ACPI_NFIT_MEM_SAVE_FAILED       (1)     /* 00: Last SAVE to Memory Device failed */
+#define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)  /* 01: Last RESTORE from Memory Device failed */
+#define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)  /* 02: Platform flush failed */
+#define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)  /* 03: Memory Device is not armed */
+#define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)  /* 04: Memory Device observed SMART/health events */
+#define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)  /* 05: SMART/health events enabled */
+
+
+/* 2: Interleave Structure */
+
+typedef struct acpi_nfit_interleave
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT16                  InterleaveIndex;
+    UINT16                  Reserved;           /* Reserved, must be zero */
+    UINT32                  LineCount;
+    UINT32                  LineSize;
+    UINT32                  LineOffset[1];      /* Variable length */
+
+} ACPI_NFIT_INTERLEAVE;
+
+
+/* 3: SMBIOS Management Information Structure */
+
+typedef struct acpi_nfit_smbios
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT32                  Reserved;           /* Reserved, must be zero */
+    UINT8                   Data[1];            /* Variable length */
+
+} ACPI_NFIT_SMBIOS;
+
+
+/* 4: NVDIMM Control Region Structure */
+
+typedef struct acpi_nfit_control_region
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT16                  RegionIndex;
+    UINT16                  VendorId;
+    UINT16                  DeviceId;
+    UINT16                  RevisionId;
+    UINT16                  SubsystemVendorId;
+    UINT16                  SubsystemDeviceId;
+    UINT16                  SubsystemRevisionId;
+    UINT8                   Reserved[6];        /* Reserved, must be zero */
+    UINT32                  SerialNumber;
+    UINT16                  Code;
+    UINT16                  Windows;
+    UINT64                  WindowSize;
+    UINT64                  CommandOffset;
+    UINT64                  CommandSize;
+    UINT64                  StatusOffset;
+    UINT64                  StatusSize;
+    UINT16                  Flags;
+    UINT8                   Reserved1[6];       /* Reserved, must be zero */
+
+} ACPI_NFIT_CONTROL_REGION;
+
+/* Flags */
+
+#define ACPI_NFIT_CONTROL_BUFFERED      (1)     /* Block Data Windows implementation is buffered */
+
+
+/* 5: NVDIMM Block Data Window Region Structure */
+
+typedef struct acpi_nfit_data_region
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT16                  RegionIndex;
+    UINT16                  Windows;
+    UINT64                  Offset;
+    UINT64                  Size;
+    UINT64                  Capacity;
+    UINT64                  StartAddress;
+
+} ACPI_NFIT_DATA_REGION;
+
+
+/* 6: Flush Hint Address Structure */
+
+typedef struct acpi_nfit_flush_address
+{
+    ACPI_NFIT_HEADER        Header;
+    UINT32                  DeviceHandle;
+    UINT16                  HintCount;
+    UINT8                   Reserved[6];        /* Reserved, must be zero */
+    UINT64                  HintAddress[1];     /* Variable length */
+
+} ACPI_NFIT_FLUSH_ADDRESS;
+
+
 /*******************************************************************************
  *
  * SBST - Smart Battery Specification Table
@@ -1274,6 +1484,7 @@ typedef struct acpi_srat_gicc_affinity
 
 #define ACPI_SRAT_GICC_ENABLED     (1)         /* 00: Use affinity structure */
 
+
 /* Reset to default packing */
 
 #pragma pack()
index df0cfb1..ab92589 100644 (file)
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are defined by third-party specifications, and are
- * not defined directly by the ACPI specification itself.
+ * Generally, the tables in this file are defined by third-party specifications,
+ * and are not defined directly by the ACPI specification itself.
  *
  ******************************************************************************/
 
 #define ACPI_SIG_DMAR           "DMAR"      /* DMA Remapping table */
 #define ACPI_SIG_HPET           "HPET"      /* High Precision Event Timer table */
 #define ACPI_SIG_IBFT           "IBFT"      /* iSCSI Boot Firmware Table */
+#define ACPI_SIG_IORT           "IORT"      /* IO Remapping Table */
 #define ACPI_SIG_IVRS           "IVRS"      /* I/O Virtualization Reporting Structure */
 #define ACPI_SIG_LPIT           "LPIT"      /* Low Power Idle Table */
 #define ACPI_SIG_MCFG           "MCFG"      /* PCI Memory Mapped Configuration table */
 #define ACPI_SIG_SPCR           "SPCR"      /* Serial Port Console Redirection table */
 #define ACPI_SIG_SPMI           "SPMI"      /* Server Platform Management Interface table */
 #define ACPI_SIG_TCPA           "TCPA"      /* Trusted Computing Platform Alliance table */
+#define ACPI_SIG_TPM2           "TPM2"      /* Trusted Platform Module 2.0 H/W interface table */
 #define ACPI_SIG_UEFI           "UEFI"      /* Uefi Boot Optimization Table */
 #define ACPI_SIG_VRTC           "VRTC"      /* Virtual Real Time Clock Table */
 #define ACPI_SIG_WAET           "WAET"      /* Windows ACPI Emulated devices Table */
@@ -822,6 +824,156 @@ typedef struct acpi_ibft_target
 } ACPI_IBFT_TARGET;
 
 
+/*******************************************************************************
+ *
+ * IORT - IO Remapping Table
+ *
+ * Conforms to "IO Remapping Table System Software on ARM Platforms",
+ * Document number: ARM DEN 0049A, 2015
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_iort
+{
+    ACPI_TABLE_HEADER       Header;
+    UINT32                  NodeCount;
+    UINT32                  NodeOffset;
+    UINT32                  Reserved;
+
+} ACPI_TABLE_IORT;
+
+
+/*
+ * IORT subtables
+ */
+typedef struct acpi_iort_node
+{
+    UINT8                   Type;
+    UINT16                  Length;
+    UINT8                   Revision;
+    UINT32                  Reserved;
+    UINT32                  MappingCount;
+    UINT32                  MappingOffset;
+    char                    NodeData[1];
+
+} ACPI_IORT_NODE;
+
+/* Values for subtable Type above */
+
+enum AcpiIortNodeType
+{
+    ACPI_IORT_NODE_ITS_GROUP            = 0x00,
+    ACPI_IORT_NODE_NAMED_COMPONENT      = 0x01,
+    ACPI_IORT_NODE_PCI_ROOT_COMPLEX     = 0x02,
+    ACPI_IORT_NODE_SMMU                 = 0x03
+};
+
+
+typedef struct acpi_iort_id_mapping
+{
+    UINT32                  InputBase;          /* Lowest value in input range */
+    UINT32                  IdCount;            /* Number of IDs */
+    UINT32                  OutputBase;         /* Lowest value in output range */
+    UINT32                  OutputReference;    /* A reference to the output node */
+    UINT32                  Flags;
+
+} ACPI_IORT_ID_MAPPING;
+
+/* Masks for Flags field above for IORT subtable */
+
+#define ACPI_IORT_ID_SINGLE_MAPPING (1)
+
+
+typedef struct acpi_iort_memory_access
+{
+    UINT32                  CacheCoherency;
+    UINT8                   Hints;
+    UINT16                  Reserved;
+    UINT8                   MemoryFlags;
+
+} ACPI_IORT_MEMORY_ACCESS;
+
+/* Values for CacheCoherency field above */
+
+#define ACPI_IORT_NODE_COHERENT         0x00000001  /* The device node is fully coherent */
+#define ACPI_IORT_NODE_NOT_COHERENT     0x00000000  /* The device node is not coherent */
+
+/* Masks for Hints field above */
+
+#define ACPI_IORT_HT_TRANSIENT          (1)
+#define ACPI_IORT_HT_WRITE              (1<<1)
+#define ACPI_IORT_HT_READ               (1<<2)
+#define ACPI_IORT_HT_OVERRIDE           (1<<3)
+
+/* Masks for MemoryFlags field above */
+
+#define ACPI_IORT_MF_COHERENCY          (1)
+#define ACPI_IORT_MF_ATTRIBUTES         (1<<1)
+
+
+/*
+ * IORT node specific subtables
+ */
+typedef struct acpi_iort_its_group
+{
+    UINT32                  ItsCount;
+    UINT32                  Identifiers[1];         /* GIC ITS identifier arrary */
+
+} ACPI_IORT_ITS_GROUP;
+
+
+typedef struct acpi_iort_named_component
+{
+    UINT32                  NodeFlags;
+    UINT64                  MemoryProperties;       /* Memory access properties */
+    UINT8                   MemoryAddressLimit;     /* Memory address size limit */
+    char                    DeviceName[1];          /* Path of namespace object */
+
+} ACPI_IORT_NAMED_COMPONENT;
+
+
+typedef struct acpi_iort_root_complex
+{
+    UINT64                  MemoryProperties;       /* Memory access properties */
+    UINT32                  AtsAttribute;
+    UINT32                  PciSegmentNumber;
+
+} ACPI_IORT_ROOT_COMPLEX;
+
+/* Values for AtsAttribute field above */
+
+#define ACPI_IORT_ATS_SUPPORTED         0x00000001  /* The root complex supports ATS */
+#define ACPI_IORT_ATS_UNSUPPORTED       0x00000000  /* The root complex doesn't support ATS */
+
+
+typedef struct acpi_iort_smmu
+{
+    UINT64                  BaseAddress;            /* SMMU base address */
+    UINT64                  Span;                   /* Length of memory range */
+    UINT32                  Model;
+    UINT32                  Flags;
+    UINT32                  GlobalInterruptOffset;
+    UINT32                  ContextInterruptCount;
+    UINT32                  ContextInterruptOffset;
+    UINT32                  PmuInterruptCount;
+    UINT32                  PmuInterruptOffset;
+    UINT64                  Interrupts[1];          /* Interrupt array */
+
+} ACPI_IORT_SMMU;
+
+/* Values for Model field above */
+
+#define ACPI_IORT_SMMU_V1               0x00000000  /* Generic SMMUv1 */
+#define ACPI_IORT_SMMU_V2               0x00000001  /* Generic SMMUv2 */
+#define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002  /* ARM Corelink MMU-400 */
+#define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003  /* ARM Corelink MMU-500 */
+
+/* Masks for Flags field above */
+
+#define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
+#define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
+
+
 /*******************************************************************************
  *
  * IVRS - I/O Virtualization Reporting Structure
@@ -1024,7 +1176,7 @@ typedef struct acpi_ivrs_memory
  *
  * LPIT - Low Power Idle Table
  *
- * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)"
+ * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
  *
  ******************************************************************************/
 
@@ -1052,8 +1204,7 @@ typedef struct acpi_lpit_header
 enum AcpiLpitType
 {
     ACPI_LPIT_TYPE_NATIVE_CSTATE    = 0x00,
-    ACPI_LPIT_TYPE_SIMPLE_IO        = 0x01,
-    ACPI_LPIT_TYPE_RESERVED         = 0x02      /* 2 and above are reserved */
+    ACPI_LPIT_TYPE_RESERVED         = 0x01      /* 1 and above are reserved */
 };
 
 /* Masks for Flags field above  */
@@ -1079,24 +1230,6 @@ typedef struct acpi_lpit_native
 } ACPI_LPIT_NATIVE;
 
 
-/* 0x01: Simple I/O based LPI structure */
-
-typedef struct acpi_lpit_io
-{
-    ACPI_LPIT_HEADER        Header;
-    ACPI_GENERIC_ADDRESS    EntryTrigger;
-    UINT32                  TriggerAction;
-    UINT64                  TriggerValue;
-    UINT64                  TriggerMask;
-    ACPI_GENERIC_ADDRESS    MinimumIdleState;
-    UINT32                  Residency;
-    UINT32                  Latency;
-    ACPI_GENERIC_ADDRESS    ResidencyCounter;
-    UINT64                  CounterFrequency;
-
-} ACPI_LPIT_IO;
-
-
 /*******************************************************************************
  *
  * MCFG - PCI Memory Mapped Configuration table and subtable
@@ -1308,21 +1441,103 @@ enum AcpiSpmiInterfaceTypes
 /*******************************************************************************
  *
  * TCPA - Trusted Computing Platform Alliance table
- *        Version 1
+ *        Version 2
  *
- * Conforms to "TCG PC Specific Implementation Specification",
- * Version 1.1, August 18, 2003
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
+ *
+ * NOTE: There are two versions of the table with the same signature --
+ * the client version and the server version. The common PlatformClass
+ * field is used to differentiate the two types of tables.
  *
  ******************************************************************************/
 
-typedef struct acpi_table_tcpa
+typedef struct acpi_table_tcpa_hdr
 {
     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
+    UINT16                  PlatformClass;
+
+} ACPI_TABLE_TCPA_HDR;
+
+/*
+ * Values for PlatformClass above.
+ * This is how the client and server subtables are differentiated
+ */
+#define ACPI_TCPA_CLIENT_TABLE          0
+#define ACPI_TCPA_SERVER_TABLE          1
+
+
+typedef struct acpi_table_tcpa_client
+{
+    UINT32                  MinimumLogLength;   /* Minimum length for the event log area */
+    UINT64                  LogAddress;         /* Address of the event log area */
+
+} ACPI_TABLE_TCPA_CLIENT;
+
+typedef struct acpi_table_tcpa_server
+{
     UINT16                  Reserved;
-    UINT32                  MaxLogLength;       /* Maximum length for the event log area */
+    UINT64                  MinimumLogLength;   /* Minimum length for the event log area */
     UINT64                  LogAddress;         /* Address of the event log area */
+    UINT16                  SpecRevision;
+    UINT8                   DeviceFlags;
+    UINT8                   InterruptFlags;
+    UINT8                   GpeNumber;
+    UINT8                   Reserved2[3];
+    UINT32                  GlobalInterrupt;
+    ACPI_GENERIC_ADDRESS    Address;
+    UINT32                  Reserved3;
+    ACPI_GENERIC_ADDRESS    ConfigAddress;
+    UINT8                   Group;
+    UINT8                   Bus;                /* PCI Bus/Segment/Function numbers */
+    UINT8                   Device;
+    UINT8                   Function;
+
+} ACPI_TABLE_TCPA_SERVER;
+
+/* Values for DeviceFlags above */
+
+#define ACPI_TCPA_PCI_DEVICE            (1)
+#define ACPI_TCPA_BUS_PNP               (1<<1)
+#define ACPI_TCPA_ADDRESS_VALID         (1<<2)
+
+/* Values for InterruptFlags above */
+
+#define ACPI_TCPA_INTERRUPT_MODE        (1)
+#define ACPI_TCPA_INTERRUPT_POLARITY    (1<<1)
+#define ACPI_TCPA_SCI_VIA_GPE           (1<<2)
+#define ACPI_TCPA_GLOBAL_INTERRUPT      (1<<3)
+
+
+/*******************************************************************************
+ *
+ * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
+ *        Version 4
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_tpm2
+{
+    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
+    UINT16                  PlatformClass;
+    UINT16                  Reserved;
+    UINT64                  ControlAddress;
+    UINT32                  StartMethod;
+
+    /* Platform-specific data follows */
+
+} ACPI_TABLE_TPM2;
+
+/* Values for StartMethod above */
 
-} ACPI_TABLE_TCPA;
+#define ACPI_TPM2_NOT_ALLOWED                       0
+#define ACPI_TPM2_START_METHOD                      2
+#define ACPI_TPM2_MEMORY_MAPPED                     6
+#define ACPI_TPM2_COMMAND_BUFFER                    7
+#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
 
 
 /*******************************************************************************
index b4ce8af..bfc18d7 100644 (file)
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are fully defined within the ACPI specification.
+ * In general, the tables in this file are fully defined within the ACPI
+ * specification.
  *
  ******************************************************************************/
 
 #define ACPI_SIG_PCCT           "PCCT"      /* Platform Communications Channel Table */
 #define ACPI_SIG_PMTT           "PMTT"      /* Platform Memory Topology Table */
 #define ACPI_SIG_RASF           "RASF"      /* RAS Feature table */
-#define ACPI_SIG_TPM2           "TPM2"      /* Trusted Platform Module 2.0 H/W interface table */
+#define ACPI_SIG_STAO           "STAO"      /* Status Override table */
+#define ACPI_SIG_WPBT           "WPBT"      /* Windows Platform Binary Table */
+#define ACPI_SIG_XENV           "XENV"      /* Xen Environment table */
 
 #define ACPI_SIG_S3PT           "S3PT"      /* S3 Performance (sub)Table */
 #define ACPI_SIG_PCCS           "PCC"       /* PCC Shared Memory Region */
 
 #define ACPI_SIG_MATR           "MATR"      /* Memory Address Translation Table */
 #define ACPI_SIG_MSDM           "MSDM"      /* Microsoft Data Management Table */
-#define ACPI_SIG_WPBT           "WPBT"      /* Windows Platform Binary Table */
 
 /*
  * All tables must be byte-packed to match the ACPI specification, since
@@ -195,6 +197,8 @@ typedef struct acpi_table_bgrt
 /*******************************************************************************
  *
  * DRTM - Dynamic Root of Trust for Measurement table
+ * Conforms to "TCG D-RTM Architecture" June 17 2013, Version 1.0.0
+ * Table version 1
  *
  ******************************************************************************/
 
@@ -213,29 +217,50 @@ typedef struct acpi_table_drtm
 
 } ACPI_TABLE_DRTM;
 
-/* 1) Validated Tables List */
+/* Flag Definitions for above */
+
+#define ACPI_DRTM_ACCESS_ALLOWED            (1)
+#define ACPI_DRTM_ENABLE_GAP_CODE           (1<<1)
+#define ACPI_DRTM_INCOMPLETE_MEASUREMENTS   (1<<2)
+#define ACPI_DRTM_AUTHORITY_ORDER           (1<<3)
+
+
+/* 1) Validated Tables List (64-bit addresses) */
 
-typedef struct acpi_drtm_vtl_list
+typedef struct acpi_drtm_vtable_list
 {
-    UINT32                  ValidatedTableListCount;
+    UINT32                  ValidatedTableCount;
+    UINT64                  ValidatedTables[1];
 
-} ACPI_DRTM_VTL_LIST;
+} ACPI_DRTM_VTABLE_LIST;
+
+/* 2) Resources List (of Resource Descriptors) */
+
+/* Resource Descriptor */
+
+typedef struct acpi_drtm_resource
+{
+    UINT8                   Size[7];
+    UINT8                   Type;
+    UINT64                  Address;
 
-/* 2) Resources List */
+} ACPI_DRTM_RESOURCE;
 
 typedef struct acpi_drtm_resource_list
 {
-    UINT32                  ResourceListCount;
+    UINT32                  ResourceCount;
+    ACPI_DRTM_RESOURCE      Resources[1];
 
 } ACPI_DRTM_RESOURCE_LIST;
 
 /* 3) Platform-specific Identifiers List */
 
-typedef struct acpi_drtm_id_list
+typedef struct acpi_drtm_dps_id
 {
-    UINT32                  IdListCount;
+    UINT32                  DpsIdLength;
+    UINT8                   DpsId[16];
 
-} ACPI_DRTM_ID_LIST;
+} ACPI_DRTM_DPS_ID;
 
 
 /*******************************************************************************
@@ -877,37 +902,61 @@ enum AcpiRasfStatus
 
 /*******************************************************************************
  *
- * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
- *        Version 3
+ * STAO - Status Override Table (_STA override) - ACPI 6.0
+ *        Version 1
  *
- * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
+ * Conforms to "ACPI Specification for Status Override Table"
+ * 6 January 2015
  *
  ******************************************************************************/
 
-typedef struct acpi_table_tpm2
+typedef struct acpi_table_stao
 {
     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
-    UINT32                  Flags;
-    UINT64                  ControlAddress;
-    UINT32                  StartMethod;
+    UINT8                   IgnoreUart;
+
+} ACPI_TABLE_STAO;
+
+
+/*******************************************************************************
+ *
+ * WPBT - Windows Platform Environment Table (ACPI 6.0)
+ *        Version 1
+ *
+ * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_wpbt
+{
+    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
+    UINT32                  HandoffSize;
+    UINT64                  HandoffAddress;
+    UINT8                   Layout;
+    UINT8                   Type;
+    UINT16                  ArgumentsLength;
+
+} ACPI_TABLE_WPBT;
 
-} ACPI_TABLE_TPM2;
 
-/* Control area structure (not part of table, pointed to by ControlAddress) */
+/*******************************************************************************
+ *
+ * XENV - Xen Environment Table (ACPI 6.0)
+ *        Version 1
+ *
+ * Conforms to "ACPI Specification for Xen Environment Table" 4 January 2015
+ *
+ ******************************************************************************/
 
-typedef struct acpi_tpm2_control
+typedef struct acpi_table_xenv
 {
-    UINT32                  Reserved;
-    UINT32                  Error;
-    UINT32                  Cancel;
-    UINT32                  Start;
-    UINT64                  InterruptControl;
-    UINT32                  CommandSize;
-    UINT64                  CommandAddress;
-    UINT32                  ResponseSize;
-    UINT64                  ResponseAddress;
-
-} ACPI_TPM2_CONTROL;
+    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
+    UINT64                  GrantTableAddress;
+    UINT64                  GrantTableSize;
+    UINT32                  EventInterrupt;
+    UINT8                   EventFlags;
+
+} ACPI_TABLE_XENV;
 
 
 /* Reset to default packing */
index 2c7d1bb..e9e765d 100644 (file)
@@ -610,6 +610,7 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
 #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
+#define ACPI_SUB_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
 #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
 
 /* Pointer/Integer type conversions */
@@ -626,14 +627,14 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
 #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
 #else
-#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
-#define ACPI_MOVE_NAME(dest,src)        (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
+#define ACPI_COMPARE_NAME(a,b)          (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
+#define ACPI_MOVE_NAME(dest,src)        (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
 #endif
 
 /* Support for the special RSDP signature (8 characters) */
 
-#define ACPI_VALIDATE_RSDP_SIG(a)       (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
-#define ACPI_MAKE_RSDP_SIG(dest)        (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
+#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
+#define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 
 
 /*******************************************************************************
@@ -653,6 +654,7 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_NO_ACPI_ENABLE             0x10
 #define ACPI_NO_DEVICE_INIT             0x20
 #define ACPI_NO_OBJECT_INIT             0x40
+#define ACPI_NO_FACS_INIT               0x80
 
 /*
  * Initialization state
@@ -744,6 +746,7 @@ typedef UINT32                          ACPI_OBJECT_TYPE;
 #define ACPI_TYPE_DEBUG_OBJECT          0x10
 
 #define ACPI_TYPE_EXTERNAL_MAX          0x10
+#define ACPI_NUM_TYPES                  (ACPI_TYPE_EXTERNAL_MAX + 1)
 
 /*
  * These are object types that do not map directly to the ACPI
@@ -765,6 +768,7 @@ typedef UINT32                          ACPI_OBJECT_TYPE;
 #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
 
 #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
+#define ACPI_TOTAL_TYPES                (ACPI_TYPE_NS_NODE_MAX + 1)
 
 /*
  * These are special object types that never appear in
@@ -838,10 +842,6 @@ typedef UINT32                          ACPI_EVENT_STATUS;
 #define ACPI_GPE_ENABLE                 0
 #define ACPI_GPE_DISABLE                1
 #define ACPI_GPE_CONDITIONAL_ENABLE     2
-#define ACPI_GPE_SAVE_MASK              4
-
-#define ACPI_GPE_ENABLE_SAVE            (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK)
-#define ACPI_GPE_DISABLE_SAVE           (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK)
 
 /*
  * GPE info flags - Per GPE
@@ -1096,7 +1096,8 @@ typedef struct acpi_buffer
  */
 #define ACPI_FULL_PATHNAME              0
 #define ACPI_SINGLE_NAME                1
-#define ACPI_NAME_TYPE_MAX              1
+#define ACPI_FULL_PATHNAME_NO_TRAILING  2
+#define ACPI_NAME_TYPE_MAX              2
 
 
 /*
@@ -1298,6 +1299,10 @@ UINT32 (*ACPI_INTERFACE_HANDLER) (
 
 #define ACPI_UUID_LENGTH                16
 
+/* Length of 3-byte PCI class code values when converted back to a string */
+
+#define ACPI_PCICLS_STRING_SIZE         7   /* Includes null terminator */
+
 
 /* Structures used for device/processor HID, UID, CID, and SUB */
 
@@ -1326,7 +1331,7 @@ typedef struct acpi_device_info
     UINT32                          Name;               /* ACPI object Name */
     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
     UINT8                           ParamCount;         /* If a method, required parameter count */
-    UINT                          Valid;              /* Indicates which optional fields are valid */
+    UINT16                          Valid;              /* Indicates which optional fields are valid */
     UINT8                           Flags;              /* Miscellaneous info */
     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
@@ -1335,6 +1340,7 @@ typedef struct acpi_device_info
     ACPI_PNP_DEVICE_ID              HardwareId;         /* _HID value */
     ACPI_PNP_DEVICE_ID              UniqueId;           /* _UID value */
     ACPI_PNP_DEVICE_ID              SubsystemId;        /* _SUB value */
+    ACPI_PNP_DEVICE_ID              ClassCode;          /* _CLS value */
     ACPI_PNP_DEVICE_ID_LIST         CompatibleIdList;   /* _CID list <must be last> */
 
 } ACPI_DEVICE_INFO;
@@ -1345,14 +1351,15 @@ typedef struct acpi_device_info
 
 /* Flags for Valid field above (AcpiGetObjectInfo) */
 
-#define ACPI_VALID_STA                  0x01
-#define ACPI_VALID_ADR                  0x02
-#define ACPI_VALID_HID                  0x04
-#define ACPI_VALID_UID                  0x08
-#define ACPI_VALID_SUB                  0x10
-#define ACPI_VALID_CID                  0x20
-#define ACPI_VALID_SXDS                 0x40
-#define ACPI_VALID_SXWS                 0x80
+#define ACPI_VALID_STA                  0x0001
+#define ACPI_VALID_ADR                  0x0002
+#define ACPI_VALID_HID                  0x0004
+#define ACPI_VALID_UID                  0x0008
+#define ACPI_VALID_SUB                  0x0010
+#define ACPI_VALID_CID                  0x0020
+#define ACPI_VALID_CLS                  0x0040
+#define ACPI_VALID_SXDS                 0x0100
+#define ACPI_VALID_SXWS                 0x0200
 
 /* Flags for _STA return value (CurrentStatus above) */
 
@@ -1413,6 +1420,17 @@ typedef struct acpi_memory_list
 } ACPI_MEMORY_LIST;
 
 
+/* Definitions of trace event types */
+
+typedef enum
+{
+    ACPI_TRACE_AML_METHOD,
+    ACPI_TRACE_AML_OPCODE,
+    ACPI_TRACE_AML_REGION
+
+} ACPI_TRACE_EVENT_TYPE;
+
+
 /* Definitions of _OSI support */
 
 #define ACPI_VENDOR_STRINGS                 0x01
index 2b3dad4..4fc44ff 100644 (file)
@@ -245,6 +245,30 @@ typedef struct acpi_pkg_info
 #define DB_DWORD_DISPLAY    4
 #define DB_QWORD_DISPLAY    8
 
+
+/*
+ * utnonansi - Non-ANSI C library functions
+ */
+void
+AcpiUtStrupr (
+    char                    *SrcString);
+
+void
+AcpiUtStrlwr (
+    char                    *SrcString);
+
+int
+AcpiUtStricmp (
+    char                    *String1,
+    char                    *String2);
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+    char                    *String,
+    UINT32                  Base,
+    UINT64                  *RetInteger);
+
+
 /*
  * utglobal - Global data structures and procedures
  */
@@ -318,116 +342,6 @@ AcpiUtSubsystemShutdown (
     void);
 
 
-/*
- * utclib - Local implementations of C library functions
- */
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
-
-ACPI_SIZE
-AcpiUtStrlen (
-    const char              *String);
-
-char *
-AcpiUtStrchr (
-    const char              *String,
-    int                     ch);
-
-char *
-AcpiUtStrcpy (
-    char                    *DstString,
-    const char              *SrcString);
-
-char *
-AcpiUtStrncpy (
-    char                    *DstString,
-    const char              *SrcString,
-    ACPI_SIZE               Count);
-
-int
-AcpiUtMemcmp (
-    const char              *Buffer1,
-    const char              *Buffer2,
-    ACPI_SIZE               Count);
-
-int
-AcpiUtStrncmp (
-    const char              *String1,
-    const char              *String2,
-    ACPI_SIZE               Count);
-
-int
-AcpiUtStrcmp (
-    const char              *String1,
-    const char              *String2);
-
-char *
-AcpiUtStrcat (
-    char                    *DstString,
-    const char              *SrcString);
-
-char *
-AcpiUtStrncat (
-    char                    *DstString,
-    const char              *SrcString,
-    ACPI_SIZE               Count);
-
-UINT32
-AcpiUtStrtoul (
-    const char              *String,
-    char                    **Terminator,
-    UINT32                  Base);
-
-char *
-AcpiUtStrstr (
-    char                    *String1,
-    char                    *String2);
-
-void *
-AcpiUtMemcpy (
-    void                    *Dest,
-    const void              *Src,
-    ACPI_SIZE               Count);
-
-void *
-AcpiUtMemset (
-    void                    *Dest,
-    UINT8                   Value,
-    ACPI_SIZE               Count);
-
-int
-AcpiUtToUpper (
-    int                     c);
-
-int
-AcpiUtToLower (
-    int                     c);
-
-extern const UINT8 _acpi_ctype[];
-
-#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
-#define _ACPI_XS     0x40    /* extra space */
-#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
-#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
-#define _ACPI_DI     0x04    /* '0'-'9' */
-#define _ACPI_LO     0x02    /* 'a'-'z' */
-#define _ACPI_PU     0x10    /* punctuation */
-#define _ACPI_SP     0x08    /* space */
-#define _ACPI_UP     0x01    /* 'A'-'Z' */
-#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
-
-#define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-#define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
-#define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
-
-#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
-
-#define ACPI_IS_ASCII(c)  ((c) < 0x80)
-
-
 /*
  * utcopy - Object construction and conversion interfaces
  */
@@ -587,6 +501,7 @@ AcpiUtReportWarning (
     char                    *ModuleName,
     UINT32                  LineNumber);
 
+
 /*
  * utdelete - Object deletion and reference counts
  */
@@ -674,6 +589,11 @@ AcpiUtExecute_CID (
     ACPI_NAMESPACE_NODE     *DeviceNode,
     ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
 
+ACPI_STATUS
+AcpiUtExecute_CLS (
+    ACPI_NAMESPACE_NODE     *DeviceNode,
+    ACPI_PNP_DEVICE_ID      **ReturnId);
+
 
 /*
  * utlock - reader/writer locks
@@ -894,7 +814,7 @@ BOOLEAN
 AcpiUtIsPciRootBridge (
     char                    *Id);
 
-#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP)
+#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
 BOOLEAN
 AcpiUtIsAmlTable (
     ACPI_TABLE_HEADER       *Table);
@@ -907,11 +827,11 @@ AcpiUtWalkPackageTree (
     ACPI_PKG_CALLBACK       WalkCallback,
     void                    *Context);
 
-
 /* Values for Base above (16=Hex, 10=Decimal) */
 
 #define ACPI_ANY_BASE        0
 
+
 UINT32
 AcpiUtDwordByteSwap (
     UINT32                  Value);
@@ -984,27 +904,6 @@ AcpiUtGetResourceEndTag (
  * utstring - String and character utilities
  */
 void
-AcpiUtStrupr (
-    char                    *SrcString);
-
-#ifdef ACPI_ASL_COMPILER
-void
-AcpiUtStrlwr (
-    char                    *SrcString);
-
-int
-AcpiUtStricmp (
-    char                    *String1,
-    char                    *String2);
-#endif
-
-ACPI_STATUS
-AcpiUtStrtoul64 (
-    char                    *String,
-    UINT32                  Base,
-    UINT64                  *RetInteger);
-
-void
 AcpiUtPrintString (
     char                    *String,
     UINT16                  MaxLength);
@@ -1129,6 +1028,7 @@ AcpiUtCreateList (
 
 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 
+
 /*
  * utaddress - address range check
  */
@@ -1155,6 +1055,7 @@ void
 AcpiUtDeleteAddressLists (
     void);
 
+
 /*
  * utxferror - various error/warning output functions
  */
@@ -1201,6 +1102,7 @@ AcpiUtMethodError (
     const char              *Path,
     ACPI_STATUS             LookupStatus);
 
+
 /*
  * Utility functions for ACPI names and IDs
  */
@@ -1216,6 +1118,7 @@ const char *
 AcpiAhMatchUuid (
     UINT8                   *Data);
 
+
 /*
  * utprint - printf/vprintf output functions
  */
@@ -1257,6 +1160,7 @@ AcpiUtFilePrintf (
     ...);
 #endif
 
+
 /*
  * utuuid -- UUID support functions
  */
diff --git a/reactos/drivers/bus/acpi/acpica/include/acuuid.h b/reactos/drivers/bus/acpi/acpica/include/acuuid.h
new file mode 100644 (file)
index 0000000..f43ec22
--- /dev/null
@@ -0,0 +1,162 @@
+/******************************************************************************
+ *
+ * Name: acuuid.h - ACPI-related UUID/GUID definitions
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACUUID_H__
+#define __ACUUID_H__
+
+/*
+ * Note1: UUIDs and GUIDs are defined to be identical in ACPI.
+ *
+ * Note2: This file is standalone and should remain that way.
+ */
+
+/* Controllers */
+
+#define UUID_GPIO_CONTROLLER            "4f248f40-d5e2-499f-834c-27758ea1cd3f"
+#define UUID_USB_CONTROLLER             "ce2ee385-00e6-48cb-9f05-2edb927c4899"
+#define UUID_SATA_CONTROLLER            "e4db149b-fcfe-425b-a6d8-92357d78fc7f"
+
+/* Devices */
+
+#define UUID_PCI_HOST_BRIDGE            "33db4d5b-1ff7-401c-9657-7441c03dd766"
+#define UUID_I2C_DEVICE                 "3cdff6f7-4267-4555-ad05-b30a3d8938de"
+#define UUID_POWER_BUTTON               "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c"
+
+/* Interfaces */
+
+#define UUID_DEVICE_LABELING            "e5c937d0-3553-4d7a-9117-ea4d19c3434d"
+#define UUID_PHYSICAL_PRESENCE          "3dddfaa6-361b-4eb4-a424-8d10089d1653"
+
+/* NVDIMM - NFIT table */
+
+#define UUID_VOLATILE_MEMORY            "7305944f-fdda-44e3-b16c-3f22d252e5d0"
+#define UUID_PERSISTENT_MEMORY          "66f0d379-b4f3-4074-ac43-0d3318b78cdb"
+#define UUID_CONTROL_REGION             "92f701f6-13b4-405d-910b-299367e8234c"
+#define UUID_DATA_REGION                "91af0530-5d86-470e-a6b0-0a2db9408249"
+#define UUID_VOLATILE_VIRTUAL_DISK      "77ab535a-45fc-624b-5560-f7b281d1f96e"
+#define UUID_VOLATILE_VIRTUAL_CD        "3d5abd30-4175-87ce-6d64-d2ade523c4bb"
+#define UUID_PERSISTENT_VIRTUAL_DISK    "5cea02c9-4d07-69d3-269f-4496fbe096f9"
+#define UUID_PERSISTENT_VIRTUAL_CD      "08018188-42cd-bb48-100f-5387d53ded3d"
+
+/* Miscellaneous */
+
+#define UUID_PLATFORM_CAPABILITIES      "0811b06e-4a27-44f9-8d60-3cbbc22e7b48"
+#define UUID_DYNAMIC_ENUMERATION        "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf"
+#define UUID_BATTERY_THERMAL_LIMIT      "4c2067e3-887d-475c-9720-4af1d3ed602e"
+#define UUID_THERMAL_EXTENSIONS         "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500"
+#define UUID_DEVICE_PROPERTIES          "daffd814-6eba-4d8c-8a91-bc9bbf4aa301"
+
+
+#endif /* __AUUID_H__ */
index 34ac987..6940b7a 100644 (file)
 #define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
 #define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
 #define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
+#define ARGI_STORE_TARGET           0x12    /* Target for store is TARGETREF + package objects */
 
 /* Multiple/complex types */
 
-#define ARGI_DATAOBJECT             0x12    /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
-#define ARGI_COMPLEXOBJ             0x13    /* Buffer, String, or package (Used by INDEX op only) */
-#define ARGI_REF_OR_STRING          0x14    /* Reference or String (Used by DEREFOF op only) */
-#define ARGI_REGION_OR_BUFFER       0x15    /* Used by LOAD op only */
-#define ARGI_DATAREFOBJ             0x16
+#define ARGI_DATAOBJECT             0x13    /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
+#define ARGI_COMPLEXOBJ             0x14    /* Buffer, String, or package (Used by INDEX op only) */
+#define ARGI_REF_OR_STRING          0x15    /* Reference or String (Used by DEREFOF op only) */
+#define ARGI_REGION_OR_BUFFER       0x16    /* Used by LOAD op only */
+#define ARGI_DATAREFOBJ             0x17
 
 /* Note: types above can expand to 0x1F maximum */
 
index c2c5bd5..b7e8d6a 100644 (file)
 #include <stdint.h>
 #include <unistd.h>
 #endif
-#include <efi.h>
-#include <efistdarg.h>
-#include <efilib.h>
 
+#if defined(__x86_64__)
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+#define USE_MS_ABI 1
+#endif
+#endif
+
+#ifdef _MSC_EXTENSIONS
+#define EFIAPI __cdecl
+#elif USE_MS_ABI
+#define EFIAPI __attribute__((ms_abi))
+#else
+#define EFIAPI
+#endif
+
+typedef uint8_t     UINT8;
+typedef uint16_t    UINT16;
+typedef int16_t     INT16;
+typedef uint32_t    UINT32;
+typedef int32_t     INT32;
+typedef uint64_t    UINT64;
+typedef int64_t     INT64;
+typedef uint8_t     BOOLEAN;
+typedef uint16_t    CHAR16;
+
+#define VOID        void
+
+#if defined(__ia64__) || defined(__x86_64__)
+
+#define ACPI_MACHINE_WIDTH          64
+
+#if defined(__x86_64__)
+
+/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
+
+#ifndef USE_MS_ABI
+#define USE_EFI_FUNCTION_WRAPPER
+#endif
+
+#ifdef _MSC_EXTENSIONS
+#pragma warning ( disable : 4731 )  /* Suppress warnings about modification of EBP */
+#endif
+
+#endif
+
+typedef uint64_t    UINTN;
+typedef int64_t     INTN;
+
+#define EFIERR(a)           (0x8000000000000000 | a)
+
+#else
+
+#define ACPI_MACHINE_WIDTH          32
+#define ACPI_USE_NATIVE_DIVIDE
+
+typedef uint32_t UINTN;
+typedef int32_t INTN;
+
+#define EFIERR(a)           (0x80000000 | a)
+
+#endif
+
+
+#ifdef USE_EFI_FUNCTION_WRAPPER
+#define __VA_NARG__(...)                        \
+  __VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N())
+#define __VA_NARG_(...)                         \
+  __VA_ARG_N(__VA_ARGS__)
+#define __VA_ARG_N(                             \
+  _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N
+#define __RSEQ_N()                              \
+  10, 9,  8,  7,  6,  5,  4,  3,  2,  1,  0
+
+#define __VA_ARG_NSUFFIX__(prefix,...)                  \
+  __VA_ARG_NSUFFIX_N(prefix, __VA_NARG__(__VA_ARGS__))
+#define __VA_ARG_NSUFFIX_N(prefix,nargs)        \
+  __VA_ARG_NSUFFIX_N_(prefix, nargs)
+#define __VA_ARG_NSUFFIX_N_(prefix,nargs)       \
+  prefix ## nargs
+
+/* Prototypes of EFI cdecl -> stdcall trampolines */
+
+UINT64 efi_call0(void *func);
+UINT64 efi_call1(void *func, UINT64 arg1);
+UINT64 efi_call2(void *func, UINT64 arg1, UINT64 arg2);
+UINT64 efi_call3(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3);
+UINT64 efi_call4(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4);
+UINT64 efi_call5(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4, UINT64 arg5);
+UINT64 efi_call6(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4, UINT64 arg5, UINT64 arg6);
+UINT64 efi_call7(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7);
+UINT64 efi_call8(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+                 UINT64 arg8);
+UINT64 efi_call9(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                 UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+                 UINT64 arg8, UINT64 arg9);
+UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+                  UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+                  UINT64 arg8, UINT64 arg9, UINT64 arg10);
+
+/* Front-ends to efi_callX to avoid compiler warnings */
+
+#define _cast64_efi_call0(f) \
+  efi_call0(f)
+#define _cast64_efi_call1(f,a1) \
+  efi_call1(f, (UINT64)(a1))
+#define _cast64_efi_call2(f,a1,a2) \
+  efi_call2(f, (UINT64)(a1), (UINT64)(a2))
+#define _cast64_efi_call3(f,a1,a2,a3) \
+  efi_call3(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3))
+#define _cast64_efi_call4(f,a1,a2,a3,a4) \
+  efi_call4(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4))
+#define _cast64_efi_call5(f,a1,a2,a3,a4,a5) \
+  efi_call5(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+            (UINT64)(a5))
+#define _cast64_efi_call6(f,a1,a2,a3,a4,a5,a6) \
+  efi_call6(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+            (UINT64)(a5), (UINT64)(a6))
+#define _cast64_efi_call7(f,a1,a2,a3,a4,a5,a6,a7) \
+  efi_call7(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+            (UINT64)(a5), (UINT64)(a6), (UINT64)(a7))
+#define _cast64_efi_call8(f,a1,a2,a3,a4,a5,a6,a7,a8) \
+  efi_call8(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+            (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8))
+#define _cast64_efi_call9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
+  efi_call9(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+            (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \
+            (UINT64)(a9))
+#define _cast64_efi_call10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
+  efi_call10(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+             (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \
+             (UINT64)(a9), (UINT64)(a10))
+
+/* main wrapper (va_num ignored) */
+
+#define uefi_call_wrapper(func,va_num,...)                        \
+  __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__)
+
+#else
+
+#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+
+#endif
 
 /* AED EFI definitions */
 
 #undef ACPI_USE_NATIVE_DIVIDE
 #define ACPI_USE_SYSTEM_INTTYPES
 
-#define ACPI_FILE           SIMPLE_TEXT_OUTPUT_INTERFACE *
-#define ACPI_FILE_OUT       ST->ConOut
-#define ACPI_FILE_ERR       ST->ConOut
-
 /*
  * Math helpers
  */
         (n_hi) >>= 1;                   \
     } while (0)
 
-/*
- * EFI specific prototypes
- */
-EFI_STATUS
-efi_main (
-    EFI_HANDLE              Image,
-    EFI_SYSTEM_TABLE        *SystemTab);
 
-int
-acpi_main (
-    int                     argc,
-    char                    *argv[]);
+#endif
 
+struct _SIMPLE_TEXT_OUTPUT_INTERFACE;
+struct _SIMPLE_INPUT_INTERFACE;
+struct _EFI_FILE_IO_INTERFACE;
+struct _EFI_FILE_HANDLE;
+struct _EFI_BOOT_SERVICES;
+struct _EFI_SYSTEM_TABLE;
 
-#endif
+extern struct _EFI_SYSTEM_TABLE         *ST;
+extern struct _EFI_BOOT_SERVICES        *BS;
 
+#define ACPI_FILE           struct _SIMPLE_TEXT_OUTPUT_INTERFACE *
+#define ACPI_FILE_OUT       ST->ConOut
+#define ACPI_FILE_ERR       ST->ConOut
 
 #endif /* __ACEFI_H__ */
diff --git a/reactos/drivers/bus/acpi/acpica/include/platform/acefiex.h b/reactos/drivers/bus/acpi/acpica/include/platform/acefiex.h
new file mode 100644 (file)
index 0000000..0b31ac6
--- /dev/null
@@ -0,0 +1,927 @@
+/******************************************************************************
+ *
+ * Name: acefiex.h - Extra OS specific defines, etc. for EFI
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACEFIEX_H__
+#define __ACEFIEX_H__
+
+
+#define EFI_ERROR(a)              (((INTN) a) < 0)
+#define EFI_SUCCESS                             0
+#define EFI_LOAD_ERROR                  EFIERR(1)
+#define EFI_INVALID_PARAMETER           EFIERR(2)
+#define EFI_UNSUPPORTED                 EFIERR(3)
+#define EFI_BAD_BUFFER_SIZE             EFIERR(4)
+#define EFI_BUFFER_TOO_SMALL            EFIERR(5)
+#define EFI_NOT_READY                   EFIERR(6)
+#define EFI_DEVICE_ERROR                EFIERR(7)
+#define EFI_WRITE_PROTECTED             EFIERR(8)
+#define EFI_OUT_OF_RESOURCES            EFIERR(9)
+#define EFI_VOLUME_CORRUPTED            EFIERR(10)
+#define EFI_VOLUME_FULL                 EFIERR(11)
+#define EFI_NO_MEDIA                    EFIERR(12)
+#define EFI_MEDIA_CHANGED               EFIERR(13)
+#define EFI_NOT_FOUND                   EFIERR(14)
+#define EFI_ACCESS_DENIED               EFIERR(15)
+#define EFI_NO_RESPONSE                 EFIERR(16)
+#define EFI_NO_MAPPING                  EFIERR(17)
+#define EFI_TIMEOUT                     EFIERR(18)
+#define EFI_NOT_STARTED                 EFIERR(19)
+#define EFI_ALREADY_STARTED             EFIERR(20)
+#define EFI_ABORTED                     EFIERR(21)
+#define EFI_PROTOCOL_ERROR              EFIERR(24)
+
+
+typedef UINTN EFI_STATUS;
+typedef VOID *EFI_HANDLE;
+typedef VOID *EFI_EVENT;
+
+typedef struct {
+    UINT32  Data1;
+    UINT16  Data2;
+    UINT16  Data3;
+    UINT8   Data4[8];
+} EFI_GUID;
+
+typedef struct _EFI_DEVICE_PATH {
+        UINT8                           Type;
+        UINT8                           SubType;
+        UINT8                           Length[2];
+} EFI_DEVICE_PATH;
+
+typedef UINT64          EFI_PHYSICAL_ADDRESS;
+typedef UINT64          EFI_VIRTUAL_ADDRESS;
+
+typedef enum {
+    AllocateAnyPages,
+    AllocateMaxAddress,
+    AllocateAddress,
+    MaxAllocateType
+} EFI_ALLOCATE_TYPE;
+
+typedef enum {
+    EfiReservedMemoryType,
+    EfiLoaderCode,
+    EfiLoaderData,
+    EfiBootServicesCode,
+    EfiBootServicesData,
+    EfiRuntimeServicesCode,
+    EfiRuntimeServicesData,
+    EfiConventionalMemory,
+    EfiUnusableMemory,
+    EfiACPIReclaimMemory,
+    EfiACPIMemoryNVS,
+    EfiMemoryMappedIO,
+    EfiMemoryMappedIOPortSpace,
+    EfiPalCode,
+    EfiMaxMemoryType
+} EFI_MEMORY_TYPE;
+
+/* possible caching types for the memory range */
+#define EFI_MEMORY_UC           0x0000000000000001
+#define EFI_MEMORY_WC           0x0000000000000002
+#define EFI_MEMORY_WT           0x0000000000000004
+#define EFI_MEMORY_WB           0x0000000000000008
+#define EFI_MEMORY_UCE          0x0000000000000010
+
+/* physical memory protection on range */
+#define EFI_MEMORY_WP           0x0000000000001000
+#define EFI_MEMORY_RP           0x0000000000002000
+#define EFI_MEMORY_XP           0x0000000000004000
+
+/* range requires a runtime mapping */
+#define EFI_MEMORY_RUNTIME      0x8000000000000000
+
+#define EFI_MEMORY_DESCRIPTOR_VERSION  1
+typedef struct {
+    UINT32                          Type;
+    UINT32                          Pad;
+    EFI_PHYSICAL_ADDRESS            PhysicalStart;
+    EFI_VIRTUAL_ADDRESS             VirtualStart;
+    UINT64                          NumberOfPages;
+    UINT64                          Attribute;
+} EFI_MEMORY_DESCRIPTOR;
+
+typedef struct _EFI_TABLE_HEARDER {
+    UINT64                      Signature;
+    UINT32                      Revision;
+    UINT32                      HeaderSize;
+    UINT32                      CRC32;
+    UINT32                      Reserved;
+} EFI_TABLE_HEADER;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNKNOWN_INTERFACE) (
+    void);
+
+
+/*
+ * Text output protocol
+ */
+#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
+    { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_RESET) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    BOOLEAN                                 ExtendedVerification);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_OUTPUT_STRING) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    CHAR16                                  *String);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_TEST_STRING) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    CHAR16                                  *String);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_QUERY_MODE) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    UINTN                                   ModeNumber,
+    UINTN                                   *Columns,
+    UINTN                                   *Rows);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_SET_MODE) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    UINTN                                   ModeNumber);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    UINTN                                   Attribute);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    UINTN                                   Column,
+    UINTN                                   Row);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
+    struct _SIMPLE_TEXT_OUTPUT_INTERFACE    *This,
+    BOOLEAN                                 Enable);
+
+typedef struct {
+    INT32                           MaxMode;
+    INT32                           Mode;
+    INT32                           Attribute;
+    INT32                           CursorColumn;
+    INT32                           CursorRow;
+    BOOLEAN                         CursorVisible;
+} SIMPLE_TEXT_OUTPUT_MODE;
+
+typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
+    EFI_TEXT_RESET                  Reset;
+
+    EFI_TEXT_OUTPUT_STRING          OutputString;
+    EFI_TEXT_TEST_STRING            TestString;
+
+    EFI_TEXT_QUERY_MODE             QueryMode;
+    EFI_TEXT_SET_MODE               SetMode;
+    EFI_TEXT_SET_ATTRIBUTE          SetAttribute;
+
+    EFI_TEXT_CLEAR_SCREEN           ClearScreen;
+    EFI_TEXT_SET_CURSOR_POSITION    SetCursorPosition;
+    EFI_TEXT_ENABLE_CURSOR          EnableCursor;
+
+    SIMPLE_TEXT_OUTPUT_MODE         *Mode;
+} SIMPLE_TEXT_OUTPUT_INTERFACE;
+
+/*
+ * Text input protocol
+ */
+#define SIMPLE_TEXT_INPUT_PROTOCOL  \
+    { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
+
+typedef struct {
+    UINT16                              ScanCode;
+    CHAR16                              UnicodeChar;
+} EFI_INPUT_KEY;
+
+/*
+ * Baseline unicode control chars
+ */
+#define CHAR_NULL                       0x0000
+#define CHAR_BACKSPACE                  0x0008
+#define CHAR_TAB                        0x0009
+#define CHAR_LINEFEED                   0x000A
+#define CHAR_CARRIAGE_RETURN            0x000D
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INPUT_RESET) (
+    struct _SIMPLE_INPUT_INTERFACE              *This,
+    BOOLEAN                                     ExtendedVerification);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INPUT_READ_KEY) (
+    struct _SIMPLE_INPUT_INTERFACE              *This,
+    EFI_INPUT_KEY                               *Key);
+
+typedef struct _SIMPLE_INPUT_INTERFACE {
+    EFI_INPUT_RESET                     Reset;
+    EFI_INPUT_READ_KEY                  ReadKeyStroke;
+    EFI_EVENT                           WaitForKey;
+} SIMPLE_INPUT_INTERFACE;
+
+
+/*
+ * Simple file system protocol
+ */
+#define SIMPLE_FILE_SYSTEM_PROTOCOL \
+    { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_VOLUME_OPEN) (
+    struct _EFI_FILE_IO_INTERFACE               *This,
+    struct _EFI_FILE_HANDLE                     **Root);
+
+#define EFI_FILE_IO_INTERFACE_REVISION   0x00010000
+
+typedef struct _EFI_FILE_IO_INTERFACE {
+    UINT64                  Revision;
+    EFI_VOLUME_OPEN         OpenVolume;
+} EFI_FILE_IO_INTERFACE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_OPEN) (
+    struct _EFI_FILE_HANDLE                     *File,
+    struct _EFI_FILE_HANDLE                     **NewHandle,
+    CHAR16                                      *FileName,
+    UINT64                                      OpenMode,
+    UINT64                                      Attributes);
+
+/* Values for OpenMode used above */
+
+#define EFI_FILE_MODE_READ      0x0000000000000001
+#define EFI_FILE_MODE_WRITE     0x0000000000000002
+#define EFI_FILE_MODE_CREATE    0x8000000000000000
+
+/* Values for Attribute used above */
+
+#define EFI_FILE_READ_ONLY      0x0000000000000001
+#define EFI_FILE_HIDDEN         0x0000000000000002
+#define EFI_FILE_SYSTEM         0x0000000000000004
+#define EFI_FILE_RESERVIED      0x0000000000000008
+#define EFI_FILE_DIRECTORY      0x0000000000000010
+#define EFI_FILE_ARCHIVE        0x0000000000000020
+#define EFI_FILE_VALID_ATTR     0x0000000000000037
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_CLOSE) (
+    struct _EFI_FILE_HANDLE                     *File);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_DELETE) (
+    struct _EFI_FILE_HANDLE                     *File);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_READ) (
+    struct _EFI_FILE_HANDLE                     *File,
+    UINTN                                       *BufferSize,
+    VOID                                        *Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_WRITE) (
+    struct _EFI_FILE_HANDLE                     *File,
+    UINTN                                       *BufferSize,
+    VOID                                        *Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_SET_POSITION) (
+    struct _EFI_FILE_HANDLE                     *File,
+    UINT64                                      Position);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_GET_POSITION) (
+    struct _EFI_FILE_HANDLE                     *File,
+    UINT64                                      *Position);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_GET_INFO) (
+    struct _EFI_FILE_HANDLE                     *File,
+    EFI_GUID                                    *InformationType,
+    UINTN                                       *BufferSize,
+    VOID                                        *Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_SET_INFO) (
+    struct _EFI_FILE_HANDLE                     *File,
+    EFI_GUID                                    *InformationType,
+    UINTN                                       BufferSize,
+    VOID                                        *Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_FLUSH) (
+    struct _EFI_FILE_HANDLE                     *File);
+
+
+#define EFI_FILE_HANDLE_REVISION         0x00010000
+
+typedef struct _EFI_FILE_HANDLE {
+    UINT64                  Revision;
+    EFI_FILE_OPEN           Open;
+    EFI_FILE_CLOSE          Close;
+    EFI_FILE_DELETE         Delete;
+    EFI_FILE_READ           Read;
+    EFI_FILE_WRITE          Write;
+    EFI_FILE_GET_POSITION   GetPosition;
+    EFI_FILE_SET_POSITION   SetPosition;
+    EFI_FILE_GET_INFO       GetInfo;
+    EFI_FILE_SET_INFO       SetInfo;
+    EFI_FILE_FLUSH          Flush;
+} EFI_FILE, *EFI_FILE_HANDLE;
+
+
+/*
+ * Loaded image protocol
+ */
+#define LOADED_IMAGE_PROTOCOL      \
+    { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
+    EFI_HANDLE                              ImageHandle,
+    struct _EFI_SYSTEM_TABLE                *SystemTable);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IMAGE_LOAD) (
+    BOOLEAN                         BootPolicy,
+    EFI_HANDLE                      ParentImageHandle,
+    EFI_DEVICE_PATH                 *FilePath,
+    VOID                            *SourceBuffer,
+    UINTN                           SourceSize,
+    EFI_HANDLE                      *ImageHandle);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IMAGE_START) (
+    EFI_HANDLE                      ImageHandle,
+    UINTN                           *ExitDataSize,
+    CHAR16                          **ExitData);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_EXIT) (
+    EFI_HANDLE                      ImageHandle,
+    EFI_STATUS                      ExitStatus,
+    UINTN                           ExitDataSize,
+    CHAR16                          *ExitData);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IMAGE_UNLOAD) (
+    EFI_HANDLE                      ImageHandle);
+
+
+#define EFI_IMAGE_INFORMATION_REVISION      0x1000
+typedef struct {
+    UINT32                          Revision;
+    EFI_HANDLE                      ParentHandle;
+    struct _EFI_SYSTEM_TABLE        *SystemTable;
+    EFI_HANDLE                      DeviceHandle;
+    EFI_DEVICE_PATH                 *FilePath;
+    VOID                            *Reserved;
+    UINT32                          LoadOptionsSize;
+    VOID                            *LoadOptions;
+    VOID                            *ImageBase;
+    UINT64                          ImageSize;
+    EFI_MEMORY_TYPE                 ImageCodeType;
+    EFI_MEMORY_TYPE                 ImageDataType;
+    EFI_IMAGE_UNLOAD                Unload;
+
+} EFI_LOADED_IMAGE;
+
+
+/*
+ * EFI Memory
+ */
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALLOCATE_PAGES) (
+    EFI_ALLOCATE_TYPE               Type,
+    EFI_MEMORY_TYPE                 MemoryType,
+    UINTN                           NoPages,
+    EFI_PHYSICAL_ADDRESS            *Memory);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FREE_PAGES) (
+    EFI_PHYSICAL_ADDRESS            Memory,
+    UINTN                           NoPages);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GET_MEMORY_MAP) (
+    UINTN                           *MemoryMapSize,
+    EFI_MEMORY_DESCRIPTOR           *MemoryMap,
+    UINTN                           *MapKey,
+    UINTN                           *DescriptorSize,
+    UINT32                          *DescriptorVersion);
+
+#define NextMemoryDescriptor(Ptr,Size)  ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALLOCATE_POOL) (
+    EFI_MEMORY_TYPE                 PoolType,
+    UINTN                           Size,
+    VOID                            **Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FREE_POOL) (
+    VOID                            *Buffer);
+
+
+/*
+ * Protocol handler functions
+ */
+typedef enum {
+    EFI_NATIVE_INTERFACE,
+    EFI_PCODE_INTERFACE
+} EFI_INTERFACE_TYPE;
+
+typedef enum {
+    AllHandles,
+    ByRegisterNotify,
+    ByProtocol
+} EFI_LOCATE_SEARCH_TYPE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
+    EFI_HANDLE                      *Handle,
+    EFI_GUID                        *Protocol,
+    EFI_INTERFACE_TYPE              InterfaceType,
+    VOID                            *Interface);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    VOID                            *OldInterface,
+    VOID                            *NewInterface);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    VOID                            *Interface);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HANDLE_PROTOCOL) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    VOID                            **Interface);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
+    EFI_GUID                        *Protocol,
+    EFI_EVENT                       Event,
+    VOID                            **Registration);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_HANDLE) (
+    EFI_LOCATE_SEARCH_TYPE          SearchType,
+    EFI_GUID                        *Protocol,
+    VOID                            *SearchKey,
+    UINTN                           *BufferSize,
+    EFI_HANDLE                      *Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
+    EFI_GUID                        *Protocol,
+    EFI_DEVICE_PATH                 **DevicePath,
+    EFI_HANDLE                      *Device);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
+    EFI_GUID                        *Guid,
+    VOID                            *Table);
+
+#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
+#define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
+#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
+#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
+#define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
+#define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    VOID                            **Interface,
+    EFI_HANDLE                      AgentHandle,
+    EFI_HANDLE                      ControllerHandle,
+    UINT32                          Attributes);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CLOSE_PROTOCOL) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    EFI_HANDLE                      AgentHandle,
+    EFI_HANDLE                      ControllerHandle);
+
+typedef struct {
+    EFI_HANDLE                  AgentHandle;
+    EFI_HANDLE                  ControllerHandle;
+    UINT32                      Attributes;
+    UINT32                      OpenCount;
+} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        *Protocol,
+    EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+    UINTN                           *EntryCount);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
+    EFI_HANDLE                      Handle,
+    EFI_GUID                        ***ProtocolBuffer,
+    UINTN                           *ProtocolBufferCount);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
+    EFI_LOCATE_SEARCH_TYPE          SearchType,
+    EFI_GUID                        *Protocol,
+    VOID                            *SearchKey,
+    UINTN                           *NoHandles,
+    EFI_HANDLE                      **Buffer);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_PROTOCOL) (
+    EFI_GUID                        *Protocol,
+    VOID                            *Registration,
+    VOID                            **Interface);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+    EFI_HANDLE                      *Handle,
+    ...);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+    EFI_HANDLE                      Handle,
+    ...);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CALCULATE_CRC32) (
+    VOID                            *Data,
+    UINTN                           DataSize,
+    UINT32                          *Crc32);
+
+typedef
+VOID
+(EFIAPI *EFI_COPY_MEM) (
+    VOID                            *Destination,
+    VOID                            *Source,
+    UINTN                           Length);
+
+typedef
+VOID
+(EFIAPI *EFI_SET_MEM) (
+    VOID                            *Buffer,
+    UINTN                           Size,
+    UINT8                           Value);
+
+/*
+ * EFI Boot Services Table
+ */
+#define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
+#define EFI_BOOT_SERVICES_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
+
+typedef struct _EFI_BOOT_SERVICES {
+    EFI_TABLE_HEADER                Hdr;
+
+#if 0
+    EFI_RAISE_TPL                   RaiseTPL;
+    EFI_RESTORE_TPL                 RestoreTPL;
+#else
+    EFI_UNKNOWN_INTERFACE           RaiseTPL;
+    EFI_UNKNOWN_INTERFACE           RestoreTPL;
+#endif
+
+    EFI_ALLOCATE_PAGES              AllocatePages;
+    EFI_FREE_PAGES                  FreePages;
+    EFI_GET_MEMORY_MAP              GetMemoryMap;
+    EFI_ALLOCATE_POOL               AllocatePool;
+    EFI_FREE_POOL                   FreePool;
+
+#if 0
+    EFI_CREATE_EVENT                CreateEvent;
+    EFI_SET_TIMER                   SetTimer;
+    EFI_WAIT_FOR_EVENT              WaitForEvent;
+    EFI_SIGNAL_EVENT                SignalEvent;
+    EFI_CLOSE_EVENT                 CloseEvent;
+    EFI_CHECK_EVENT                 CheckEvent;
+#else
+    EFI_UNKNOWN_INTERFACE           CreateEvent;
+    EFI_UNKNOWN_INTERFACE           SetTimer;
+    EFI_UNKNOWN_INTERFACE           WaitForEvent;
+    EFI_UNKNOWN_INTERFACE           SignalEvent;
+    EFI_UNKNOWN_INTERFACE           CloseEvent;
+    EFI_UNKNOWN_INTERFACE           CheckEvent;
+#endif
+
+    EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
+    EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
+    EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
+    EFI_HANDLE_PROTOCOL             HandleProtocol;
+    EFI_HANDLE_PROTOCOL             PCHandleProtocol;
+    EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
+    EFI_LOCATE_HANDLE               LocateHandle;
+    EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
+    EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
+
+    EFI_IMAGE_LOAD                  LoadImage;
+    EFI_IMAGE_START                 StartImage;
+    EFI_EXIT                        Exit;
+    EFI_IMAGE_UNLOAD                UnloadImage;
+
+#if 0
+    EFI_EXIT_BOOT_SERVICES          ExitBootServices;
+    EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
+    EFI_STALL                       Stall;
+    EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
+#else
+    EFI_UNKNOWN_INTERFACE           ExitBootServices;
+    EFI_UNKNOWN_INTERFACE           GetNextMonotonicCount;
+    EFI_UNKNOWN_INTERFACE           Stall;
+    EFI_UNKNOWN_INTERFACE           SetWatchdogTimer;
+#endif
+
+#if 0
+    EFI_CONNECT_CONTROLLER          ConnectController;
+    EFI_DISCONNECT_CONTROLLER       DisconnectController;
+#else
+    EFI_UNKNOWN_INTERFACE           ConnectController;
+    EFI_UNKNOWN_INTERFACE           DisconnectController;
+#endif
+
+    EFI_OPEN_PROTOCOL               OpenProtocol;
+    EFI_CLOSE_PROTOCOL              CloseProtocol;
+    EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
+    EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
+    EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
+    EFI_LOCATE_PROTOCOL             LocateProtocol;
+    EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
+    EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
+
+    EFI_CALCULATE_CRC32             CalculateCrc32;
+
+    EFI_COPY_MEM                    CopyMem;
+    EFI_SET_MEM                     SetMem;
+
+#if 0
+    EFI_CREATE_EVENT_EX             CreateEventEx;
+#else
+    EFI_UNKNOWN_INTERFACE           CreateEventEx;
+#endif
+} EFI_BOOT_SERVICES;
+
+
+/*
+ * EFI System Table
+ */
+
+/*
+ * EFI Configuration Table and GUID definitions
+ */
+#define ACPI_TABLE_GUID    \
+    { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+#define ACPI_20_TABLE_GUID  \
+    { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
+
+typedef struct _EFI_CONFIGURATION_TABLE {
+    EFI_GUID                VendorGuid;
+    VOID                    *VendorTable;
+} EFI_CONFIGURATION_TABLE;
+
+
+#define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
+#define EFI_SYSTEM_TABLE_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
+
+typedef struct _EFI_SYSTEM_TABLE {
+    EFI_TABLE_HEADER                Hdr;
+
+    CHAR16                          *FirmwareVendor;
+    UINT32                          FirmwareRevision;
+
+    EFI_HANDLE                      ConsoleInHandle;
+    SIMPLE_INPUT_INTERFACE          *ConIn;
+
+    EFI_HANDLE                      ConsoleOutHandle;
+    SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
+
+    EFI_HANDLE                      StandardErrorHandle;
+    SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
+
+#if 0
+    EFI_RUNTIME_SERVICES            *RuntimeServices;
+#else
+    EFI_HANDLE                      *RuntimeServices;
+#endif
+    EFI_BOOT_SERVICES               *BootServices;
+
+    UINTN                           NumberOfTableEntries;
+    EFI_CONFIGURATION_TABLE         *ConfigurationTable;
+
+} EFI_SYSTEM_TABLE;
+
+
+/* GNU EFI definitions */
+
+#if defined(_GNU_EFI)
+
+/*
+ * This is needed to hide platform specific code from ACPICA
+ */
+UINT64
+DivU64x32 (
+    UINT64                  Dividend,
+    UINTN                   Divisor,
+    UINTN                   *Remainder);
+
+/*
+ * EFI specific prototypes
+ */
+EFI_STATUS
+efi_main (
+    EFI_HANDLE              Image,
+    EFI_SYSTEM_TABLE        *SystemTab);
+
+int
+acpi_main (
+    int                     argc,
+    char                    *argv[]);
+
+
+#endif
+
+extern EFI_GUID AcpiGbl_LoadedImageProtocol;
+extern EFI_GUID AcpiGbl_TextInProtocol;
+extern EFI_GUID AcpiGbl_TextOutProtocol;
+extern EFI_GUID AcpiGbl_FileSystemProtocol;
+
+#endif /* __ACEFIEX_H__ */
index 361bd80..c08eee6 100644 (file)
 
 #ifdef ACPI_ASL_COMPILER
 #define ACPI_APPLICATION
-#define ACPI_DISASSEMBLER
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_CONSTANT_EVAL_ONLY
 #define ACPI_LARGE_NAMESPACE_NODE
 #define ACPI_DATA_TABLE_DISASSEMBLY
 #define ACPI_SINGLE_THREADED
 #define ACPI_32BIT_PHYSICAL_ADDRESS
+
+#define ACPI_DISASSEMBLER 1
 #endif
 
 /* AcpiExec configuration. Multithreaded with full AML debugger */
 #endif
 
 /*
- * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration.
- * All single threaded.
+ * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example
+ * configuration. All single threaded.
  */
 #if (defined ACPI_BIN_APP)      || \
     (defined ACPI_DUMP_APP)     || \
 #define ACPI_USE_NATIVE_RSDP_POINTER
 #endif
 
-/* AcpiDump configuration. Native mapping used if provied by OSPMs */
+/* AcpiDump configuration. Native mapping used if provided by the host */
 
 #ifdef ACPI_DUMP_APP
 #define ACPI_USE_NATIVE_MEMORY_MAPPING
 
 #ifdef ACPI_LIBRARY
 #define ACPI_USE_LOCAL_CACHE
+#define ACPI_FULL_DEBUG
 #endif
 
 /* Common for all ACPICA applications */
 #define ACPI_USE_LOCAL_CACHE
 #endif
 
-/* Common debug support */
+/* Common debug/disassembler support */
 
 #ifdef ACPI_FULL_DEBUG
-#define ACPI_DEBUGGER
 #define ACPI_DEBUG_OUTPUT
-#define ACPI_DISASSEMBLER
+#define ACPI_DEBUGGER 1
+#define ACPI_DISASSEMBLER 1
 #endif
 
-
 /*! [Begin] no source code translation */
 
 /******************************************************************************
 #elif defined(_APPLE) || defined(__APPLE__)
 #include "acmacosx.h"
 
+#elif defined(__DragonFly__)
+#include "acdragonfly.h"
+
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include "acfreebsd.h"
 
 #define ACPI_INTERNAL_VAR_XFACE
 #endif
 
+
 /*
  * Debugger threading model
  * Use single threaded if the entire subsystem is contained in an application
  * multi-threaded if ACPI_APPLICATION is not set.
  */
 #ifndef DEBUGGER_THREADING
-#ifdef ACPI_APPLICATION
-#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
+#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)
+#define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
 
 #else
-#define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
+#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
 #endif
 #endif /* !DEBUGGER_THREADING */
 
  * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
  *      the standard header files may be used.
  *
- * The ACPICA subsystem only uses low level C library functions that do not call
- * operating system services and may therefore be inlined in the code.
+ * The ACPICA subsystem only uses low level C library functions that do not
+ * call operating system services and may therefore be inlined in the code.
  *
  * It may be necessary to tailor these include files to the target
  * generation environment.
 
 /* We will be linking to the standard Clib functions */
 
-#define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
-#define ACPI_STRCHR(s1,c)       strchr((s1), (c))
-#define ACPI_STRLEN(s)          (ACPI_SIZE) strlen((s))
-#define ACPI_STRCPY(d,s)        (void) strcpy((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) strncpy((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRCMP(d,s)        strcmp((d), (s))
-#define ACPI_STRCAT(d,s)        (void) strcat((d), (s))
-#define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (ACPI_SIZE)(n))
-#define ACPI_TOUPPER(i)         toupper((int) (i))
-#define ACPI_TOLOWER(i)         tolower((int) (i))
-#define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
-#define ACPI_IS_DIGIT(i)        isdigit((int) (i))
-#define ACPI_IS_SPACE(i)        isspace((int) (i))
-#define ACPI_IS_UPPER(i)        isupper((int) (i))
-#define ACPI_IS_PRINT(i)        isprint((int) (i))
-#define ACPI_IS_ALPHA(i)        isalpha((int) (i))
-
 #else
 
 /******************************************************************************
@@ -481,22 +464,6 @@ typedef char *va_list;
 
 /* Use the local (ACPICA) definitions of the clib functions */
 
-#define ACPI_STRSTR(s1,s2)      AcpiUtStrstr ((s1), (s2))
-#define ACPI_STRCHR(s1,c)       AcpiUtStrchr ((s1), (c))
-#define ACPI_STRLEN(s)          (ACPI_SIZE) AcpiUtStrlen ((s))
-#define ACPI_STRCPY(d,s)        (void) AcpiUtStrcpy ((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRNCMP(d,s,n)     AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRCMP(d,s)        AcpiUtStrcmp ((d), (s))
-#define ACPI_STRCAT(d,s)        (void) AcpiUtStrcat ((d), (s))
-#define ACPI_STRNCAT(d,s,n)     AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRTOUL(d,s,n)     AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMCMP(s1,s2,n)    AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMSET(d,v,n)      (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
-#define ACPI_TOUPPER(c)         AcpiUtToUpper ((int) (c))
-#define ACPI_TOLOWER(c)         AcpiUtToLower ((int) (c))
-
 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
 
 #ifndef ACPI_FILE
index 6c59337..3daf77e 100644 (file)
 #if defined(_LINUX) || defined(__linux__)
 #include "aclinuxex.h"
 
+#elif defined(WIN32)
+#include "acwinex.h"
+
+#elif defined(_AED_EFI)
+#include "acefiex.h"
+
+#elif defined(_GNU_EFI)
+#include "acefiex.h"
+
+#elif defined(__DragonFly__)
+#include "acdragonflyex.h"
+
 #endif
 
 /*! [End] no source code translation !*/
index 2f49912..726838e 100644 (file)
 #undef strchr
 #endif
 
+/* GCC supports __VA_ARGS__ in macros */
+
+#define COMPILER_VA_MACRO               1
+
+
 #ifdef __REACTOS__
 /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
 
index 9285c8a..17914d1 100644 (file)
 #ifndef __ACMSVC_H__
 #define __ACMSVC_H__
 
+/* Note: do not include any C library headers here */
+
+/*
+ * Note: MSVC project files should define ACPI_DEBUGGER and ACPI_DISASSEMBLER
+ * as appropriate to enable editor functions like "Find all references".
+ * The editor isn't smart enough to dig through the include files to find
+ * out if these are actually defined.
+ */
 
 /*
  * Map low I/O functions for MS. This allows us to disable MS language
 #define stat            _stat
 #define fstat           _fstat
 #define mkdir           _mkdir
-#define strlwr          _strlwr
 #define O_RDONLY        _O_RDONLY
 #define O_BINARY        _O_BINARY
 #define O_CREAT         _O_CREAT
 #endif
 
 
-/* Debug support. Must be last in this file, do not move. */
+/* Debug support. */
 
 #ifdef _DEBUG
-#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
-
-#include <stdlib.h>
-#include <malloc.h>
-#include <crtdbg.h>
 
 /*
  * Debugging memory corruption issues with windows:
@@ -320,4 +322,9 @@ _CrtSetBreakAlloc (937);
 
 #endif
 
+#if _MSC_VER > 1200 /* Versions above VC++ 6 */
+#define COMPILER_VA_MACRO               1
+#else
+#endif
+
 #endif /* __ACMSVC_H__ */
diff --git a/reactos/drivers/bus/acpi/acpica/include/platform/acmsvcex.h b/reactos/drivers/bus/acpi/acpica/include/platform/acmsvcex.h
new file mode 100644 (file)
index 0000000..a89d3f9
--- /dev/null
@@ -0,0 +1,126 @@
+/******************************************************************************
+ *
+ * Name: acmsvcex.h - Extra VC specific defines, etc.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACMSVCEX_H__
+#define __ACMSVCEX_H__
+
+/* Debug support. */
+
+#ifdef _DEBUG
+#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
+#include <crtdbg.h>
+#endif
+
+#endif /* __ACMSVCEX_H__ */
diff --git a/reactos/drivers/bus/acpi/acpica/include/platform/acwinex.h b/reactos/drivers/bus/acpi/acpica/include/platform/acwinex.h
new file mode 100644 (file)
index 0000000..6c22da2
--- /dev/null
@@ -0,0 +1,124 @@
+/******************************************************************************
+ *
+ * Name: acwinex.h - Extra OS specific defines, etc.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACWINEX_H__
+#define __ACWINEX_H__
+
+/* Windows uses VC */
+#ifdef _MSC_VER
+#include "acmsvcex.h"
+#endif
+
+#endif /* __ACWINEX_H__ */
index 58d56e5..6667308 100644 (file)
@@ -183,7 +183,7 @@ AcpiNsRootInitialize (
     {
         /* _OSI is optional for now, will be permanent later */
 
-        if (!ACPI_STRCMP (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
+        if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
         {
             continue;
         }
@@ -263,7 +263,7 @@ AcpiNsRootInitialize (
 
                 /* Build an object around the static string */
 
-                ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val);
+                ObjDesc->String.Length = (UINT32) strlen (Val);
                 ObjDesc->String.Pointer = Val;
                 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
                 break;
@@ -284,7 +284,7 @@ AcpiNsRootInitialize (
 
                 /* Special case for ACPI Global Lock */
 
-                if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
+                if (strcmp (InitVal->Name, "_GL_") == 0)
                 {
                     AcpiGbl_GlobalLockMutex = ObjDesc;
 
@@ -391,7 +391,9 @@ AcpiNsLookup (
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
 
-    LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
+    LocalFlags = Flags &
+        ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND |
+          ACPI_NS_SEARCH_PARENT);
     *ReturnNode = ACPI_ENTRY_NOT_FOUND;
     AcpiGbl_NsLookupCount++;
 
@@ -643,6 +645,13 @@ AcpiNsLookup (
             {
                 LocalFlags |= ACPI_NS_ERROR_IF_FOUND;
             }
+
+            /* Set override flag according to caller */
+
+            if (Flags & ACPI_NS_OVERRIDE_IF_FOUND)
+            {
+                LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND;
+            }
         }
 
         /* Extract one ACPI name from the front of the pathname */
index be20f43..b79458e 100644 (file)
@@ -274,7 +274,7 @@ AcpiNsConvertToString (
          * Copy the raw buffer data with no transform. String is already NULL
          * terminated at Length+1.
          */
-        ACPI_MEMCPY (NewObject->String.Pointer,
+        memcpy (NewObject->String.Pointer,
             OriginalObject->Buffer.Pointer, Length);
         break;
 
@@ -341,7 +341,7 @@ AcpiNsConvertToBuffer (
             return (AE_NO_MEMORY);
         }
 
-        ACPI_MEMCPY (NewObject->Buffer.Pointer,
+        memcpy (NewObject->Buffer.Pointer,
             OriginalObject->String.Pointer, OriginalObject->String.Length);
         break;
 
index 8b6c8ce..0d3b57e 100644 (file)
@@ -195,7 +195,7 @@ AcpiNsPrintPathname (
     {
         for (i = 0; i < 4; i++)
         {
-            ACPI_IS_PRINT (Pathname[i]) ?
+            isprint ((int) Pathname[i]) ?
                 AcpiOsPrintf ("%c", Pathname[i]) :
                 AcpiOsPrintf ("?");
         }
index b6d662b..7c8d6fd 100644 (file)
@@ -136,15 +136,14 @@ AcpiNsExecModuleCode (
  *
  * FUNCTION:    AcpiNsEvaluate
  *
- * PARAMETERS:  Info            - Evaluation info block, contains:
+ * PARAMETERS:  Info            - Evaluation info block, contains these fields
+ *                                and more:
  *                  PrefixNode      - Prefix or Method/Object Node to execute
  *                  RelativePath    - Name of method to execute, If NULL, the
  *                                    Node is the object to execute
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
- *                  ReturnObject    - Where to put method's return value (if
- *                                    any). If NULL, no value is returned.
  *                  ParameterType   - Type of Parameter list
  *                  ReturnObject    - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
@@ -358,6 +357,7 @@ AcpiNsEvaluate (
 
         if (ACPI_FAILURE (Status))
         {
+            Info->ReturnObject = NULL;
             goto Cleanup;
         }
 
@@ -536,7 +536,7 @@ AcpiNsExecModuleCode (
 
     /* Initialize the evaluation information block */
 
-    ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO));
+    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
     Info->PrefixNode = ParentNode;
 
     /*
@@ -563,7 +563,8 @@ AcpiNsExecModuleCode (
 
     Status = AcpiNsEvaluate (Info);
 
-    ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n",
+    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
+        "Executed module-level code at %p\n",
         MethodObj->Method.AmlStart));
 
     /* Delete a possible implicit return value (in slack mode) */
index 279b409..6bedef9 100644 (file)
@@ -177,7 +177,7 @@ AcpiNsInitializeObjects (
 
     /* Set all init info to zero */
 
-    ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
+    memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 
     /* Walk entire namespace from the supplied root */
 
@@ -686,7 +686,7 @@ AcpiNsInitOneDevice (
     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
         ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
 
-    ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO));
+    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
     Info->PrefixNode = DeviceNode;
     Info->RelativePathname = METHOD_NAME__INI;
     Info->Parameters = NULL;
index 590be03..8e1a0c2 100644 (file)
@@ -200,7 +200,21 @@ AcpiNsLoadTable (
     }
     else
     {
-        (void) AcpiTbReleaseOwnerId (TableIndex);
+        /*
+         * On error, delete any namespace objects created by this table.
+         * We cannot initialize these objects, so delete them. There are
+         * a couple of expecially bad cases:
+         * AE_ALREADY_EXISTS - namespace collision.
+         * AE_NOT_FOUND - the target of a Scope operator does not
+         * exist. This target of Scope must already exist in the
+         * namespace, as per the ACPI specification.
+         */
+        (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+        AcpiNsDeleteNamespaceByOwner (
+            AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
+            AcpiTbReleaseOwnerId (TableIndex);
+
+        return_ACPI_STATUS (Status);
     }
 
 Unlock:
index 2c7d9b9..3ca04f0 100644 (file)
         ACPI_MODULE_NAME    ("nsnames")
 
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsBuildExternalPath
- *
- * PARAMETERS:  Node            - NS node whose pathname is needed
- *              Size            - Size of the pathname
- *              *NameBuffer     - Where to return the pathname
- *
- * RETURN:      Status
- *              Places the pathname into the NameBuffer, in external format
- *              (name segments separated by path separators)
- *
- * DESCRIPTION: Generate a full pathaname
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsBuildExternalPath (
-    ACPI_NAMESPACE_NODE     *Node,
-    ACPI_SIZE               Size,
-    char                    *NameBuffer)
-{
-    ACPI_SIZE               Index;
-    ACPI_NAMESPACE_NODE     *ParentNode;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    /* Special case for root */
-
-    Index = Size - 1;
-    if (Index < ACPI_NAME_SIZE)
-    {
-        NameBuffer[0] = AML_ROOT_PREFIX;
-        NameBuffer[1] = 0;
-        return (AE_OK);
-    }
-
-    /* Store terminator byte, then build name backwards */
-
-    ParentNode = Node;
-    NameBuffer[Index] = 0;
-
-    while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode))
-    {
-        Index -= ACPI_NAME_SIZE;
-
-        /* Put the name into the buffer */
-
-        ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
-        ParentNode = ParentNode->Parent;
-
-        /* Prefix name with the path separator */
-
-        Index--;
-        NameBuffer[Index] = ACPI_PATH_SEPARATOR;
-    }
-
-    /* Overwrite final separator with the root prefix character */
-
-    NameBuffer[Index] = AML_ROOT_PREFIX;
-
-    if (Index != 0)
-    {
-        ACPI_ERROR ((AE_INFO,
-            "Could not construct external pathname; index=%u, size=%u, Path=%s",
-            (UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
-
-        return (AE_BAD_PARAMETER);
-    }
-
-    return (AE_OK);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiNsGetExternalPathname
@@ -218,39 +142,13 @@ char *
 AcpiNsGetExternalPathname (
     ACPI_NAMESPACE_NODE     *Node)
 {
-    ACPI_STATUS             Status;
     char                    *NameBuffer;
-    ACPI_SIZE               Size;
 
 
     ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
 
 
-    /* Calculate required buffer size based on depth below root */
-
-    Size = AcpiNsGetPathnameLength (Node);
-    if (!Size)
-    {
-        return_PTR (NULL);
-    }
-
-    /* Allocate a buffer to be returned to caller */
-
-    NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
-    if (!NameBuffer)
-    {
-        ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size));
-        return_PTR (NULL);
-    }
-
-    /* Build the path in the allocated buffer */
-
-    Status = AcpiNsBuildExternalPath (Node, Size, NameBuffer);
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_FREE (NameBuffer);
-        return_PTR (NULL);
-    }
+    NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE);
 
     return_PTR (NameBuffer);
 }
@@ -273,38 +171,14 @@ AcpiNsGetPathnameLength (
     ACPI_NAMESPACE_NODE     *Node)
 {
     ACPI_SIZE               Size;
-    ACPI_NAMESPACE_NODE     *NextNode;
 
 
     ACPI_FUNCTION_ENTRY ();
 
 
-    /*
-     * Compute length of pathname as 5 * number of name segments.
-     * Go back up the parent tree to the root
-     */
-    Size = 0;
-    NextNode = Node;
+    Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE);
 
-    while (NextNode && (NextNode != AcpiGbl_RootNode))
-    {
-        if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED)
-        {
-            ACPI_ERROR ((AE_INFO,
-                "Invalid Namespace Node (%p) while traversing namespace",
-                NextNode));
-            return (0);
-        }
-        Size += ACPI_PATH_SEGMENT_LENGTH;
-        NextNode = NextNode->Parent;
-    }
-
-    if (!Size)
-    {
-        Size = 1; /* Root node case */
-    }
-
-    return (Size + 1);  /* +1 for null string terminator */
+    return (Size);
 }
 
 
@@ -315,6 +189,8 @@ AcpiNsGetPathnameLength (
  * PARAMETERS:  TargetHandle            - Handle of named object whose name is
  *                                        to be found
  *              Buffer                  - Where the pathname is returned
+ *              NoTrailing              - Remove trailing '_' for each name
+ *                                        segment
  *
  * RETURN:      Status, Buffer is filled with pathname if status is AE_OK
  *
@@ -325,7 +201,8 @@ AcpiNsGetPathnameLength (
 ACPI_STATUS
 AcpiNsHandleToPathname (
     ACPI_HANDLE             TargetHandle,
-    ACPI_BUFFER             *Buffer)
+    ACPI_BUFFER             *Buffer,
+    BOOLEAN                 NoTrailing)
 {
     ACPI_STATUS             Status;
     ACPI_NAMESPACE_NODE     *Node;
@@ -343,7 +220,7 @@ AcpiNsHandleToPathname (
 
     /* Determine size required for the caller buffer */
 
-    RequiredSize = AcpiNsGetPathnameLength (Node);
+    RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
     if (!RequiredSize)
     {
         return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -359,7 +236,8 @@ AcpiNsHandleToPathname (
 
     /* Build the path in the caller buffer */
 
-    Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
+    (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer,
+            RequiredSize, NoTrailing);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -369,3 +247,169 @@ AcpiNsHandleToPathname (
         (char *) Buffer->Pointer, (UINT32) RequiredSize));
     return_ACPI_STATUS (AE_OK);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsBuildNormalizedPath
+ *
+ * PARAMETERS:  Node        - Namespace node
+ *              FullPath    - Where the path name is returned
+ *              PathSize    - Size of returned path name buffer
+ *              NoTrailing  - Remove trailing '_' from each name segment
+ *
+ * RETURN:      Return 1 if the AML path is empty, otherwise returning (length
+ *              of pathname + 1) which means the 'FullPath' contains a trailing
+ *              null.
+ *
+ * DESCRIPTION: Build and return a full namespace pathname.
+ *              Note that if the size of 'FullPath' isn't large enough to
+ *              contain the namespace node's path name, the actual required
+ *              buffer length is returned, and it should be greater than
+ *              'PathSize'. So callers are able to check the returning value
+ *              to determine the buffer size of 'FullPath'.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiNsBuildNormalizedPath (
+    ACPI_NAMESPACE_NODE     *Node,
+    char                    *FullPath,
+    UINT32                  PathSize,
+    BOOLEAN                 NoTrailing)
+{
+    UINT32                  Length = 0, i;
+    char                    Name[ACPI_NAME_SIZE];
+    BOOLEAN                 DoNoTrailing;
+    char                    c, *Left, *Right;
+    ACPI_NAMESPACE_NODE     *NextNode;
+
+
+    ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node);
+
+
+#define ACPI_PATH_PUT8(Path, Size, Byte, Length)    \
+    do {                                            \
+        if ((Length) < (Size))                      \
+        {                                           \
+            (Path)[(Length)] = (Byte);              \
+        }                                           \
+        (Length)++;                                 \
+    } while (0)
+
+    /*
+     * Make sure the PathSize is correct, so that we don't need to
+     * validate both FullPath and PathSize.
+     */
+    if (!FullPath)
+    {
+        PathSize = 0;
+    }
+
+    if (!Node)
+    {
+        goto BuildTrailingNull;
+    }
+
+    NextNode = Node;
+    while (NextNode && NextNode != AcpiGbl_RootNode)
+    {
+        if (NextNode != Node)
+        {
+            ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
+        }
+        ACPI_MOVE_32_TO_32 (Name, &NextNode->Name);
+        DoNoTrailing = NoTrailing;
+        for (i = 0; i < 4; i++)
+        {
+            c = Name[4-i-1];
+            if (DoNoTrailing && c != '_')
+            {
+                DoNoTrailing = FALSE;
+            }
+            if (!DoNoTrailing)
+            {
+                ACPI_PATH_PUT8(FullPath, PathSize, c, Length);
+            }
+        }
+        NextNode = NextNode->Parent;
+    }
+    ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length);
+
+    /* Reverse the path string */
+
+    if (Length <= PathSize)
+    {
+        Left = FullPath;
+        Right = FullPath+Length-1;
+        while (Left < Right)
+        {
+            c = *Left;
+            *Left++ = *Right;
+            *Right-- = c;
+        }
+    }
+
+    /* Append the trailing null */
+
+BuildTrailingNull:
+    ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length);
+
+#undef ACPI_PATH_PUT8
+
+    return_UINT32 (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsGetNormalizedPathname
+ *
+ * PARAMETERS:  Node            - Namespace node whose pathname is needed
+ *              NoTrailing      - Remove trailing '_' from each name segment
+ *
+ * RETURN:      Pointer to storage containing the fully qualified name of
+ *              the node, In external format (name segments separated by path
+ *              separators.)
+ *
+ * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually
+ *              for error and debug statements. All trailing '_' will be
+ *              removed from the full pathname if 'NoTrailing' is specified..
+ *
+ ******************************************************************************/
+
+char *
+AcpiNsGetNormalizedPathname (
+    ACPI_NAMESPACE_NODE     *Node,
+    BOOLEAN                 NoTrailing)
+{
+    char                    *NameBuffer;
+    ACPI_SIZE               Size;
+
+
+    ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node);
+
+
+    /* Calculate required buffer size based on depth below root */
+
+    Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
+    if (!Size)
+    {
+        return_PTR (NULL);
+    }
+
+    /* Allocate a buffer to be returned to caller */
+
+    NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
+    if (!NameBuffer)
+    {
+        ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size));
+        return_PTR (NULL);
+    }
+
+    /* Build the path in the allocated buffer */
+
+    (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing);
+
+    return_PTR (NameBuffer);
+}
index da137e8..26dd9f3 100644 (file)
@@ -156,6 +156,22 @@ AcpiNsOneCompleteParse (
     ACPI_FUNCTION_TRACE (NsOneCompleteParse);
 
 
+    Status = AcpiGetTableByIndex (TableIndex, &Table);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Table must consist of at least a complete header */
+
+    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+    {
+        return_ACPI_STATUS (AE_BAD_HEADER);
+    }
+
+    AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+
     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
     if (ACPI_FAILURE (Status))
     {
@@ -164,7 +180,7 @@ AcpiNsOneCompleteParse (
 
     /* Create and init a Root Node */
 
-    ParseRoot = AcpiPsCreateScopeOp ();
+    ParseRoot = AcpiPsCreateScopeOp (AmlStart);
     if (!ParseRoot)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
@@ -179,32 +195,20 @@ AcpiNsOneCompleteParse (
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
-    Status = AcpiGetTableByIndex (TableIndex, &Table);
+    Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
+                AmlStart, AmlLength, NULL, (UINT8) PassNumber);
     if (ACPI_FAILURE (Status))
     {
         AcpiDsDeleteWalkState (WalkState);
-        AcpiPsFreeOp (ParseRoot);
-        return_ACPI_STATUS (Status);
+        goto Cleanup;
     }
 
-    /* Table must consist of at least a complete header */
+    /* Found OSDT table, enable the namespace override feature */
 
-    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
-    {
-        Status = AE_BAD_HEADER;
-    }
-    else
+    if (ACPI_COMPARE_NAME(Table->Signature, ACPI_SIG_OSDT) &&
+        PassNumber == ACPI_IMODE_LOAD_PASS1)
     {
-        AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
-        AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
-        Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
-                    AmlStart, AmlLength, NULL, (UINT8) PassNumber);
-    }
-
-    if (ACPI_FAILURE (Status))
-    {
-        AcpiDsDeleteWalkState (WalkState);
-        goto Cleanup;
+        WalkState->NamespaceOverride = TRUE;
     }
 
     /* StartNode is the default location to load the table  */
index 8a522d2..85793f9 100644 (file)
@@ -321,7 +321,7 @@ AcpiNsCheckObjectType (
 {
     ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;
     ACPI_STATUS                 Status = AE_OK;
-    char                        TypeBuffer[48]; /* Room for 5 types */
+    char                        TypeBuffer[96]; /* Room for 10 types */
 
 
     /* A Namespace node should not get here, but make sure */
index 085ccd2..627ee3e 100644 (file)
@@ -393,6 +393,13 @@ AcpiNsCheckPackage (
         Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
         break;
 
+    case ACPI_PTYPE2_VAR_VAR:
+        /*
+         * Returns a variable list of packages, each with a variable list
+         * of objects.
+         */
+        break;
+
     case ACPI_PTYPE2_UUID_PAIR:
 
         /* The package must contain pairs of (UUID + type) */
@@ -562,6 +569,12 @@ AcpiNsCheckPackageList (
             }
             break;
 
+        case ACPI_PTYPE2_VAR_VAR:
+            /*
+             * Each subpackage has a fixed or variable number of elements
+             */
+            break;
+
         case ACPI_PTYPE2_FIXED:
 
             /* Each subpackage has a fixed length */
index 736933a..fbb9c7e 100644 (file)
@@ -595,10 +595,10 @@ AcpiNsRemoveNullElements (
     case ACPI_PTYPE2_MIN:
     case ACPI_PTYPE2_REV_FIXED:
     case ACPI_PTYPE2_FIX_VAR:
-
         break;
 
     default:
+    case ACPI_PTYPE2_VAR_VAR:
     case ACPI_PTYPE1_FIXED:
     case ACPI_PTYPE1_OPTION:
         return;
index 3300819..a252d41 100644 (file)
@@ -709,7 +709,7 @@ AcpiNsRepair_HID (
      */
     for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
     {
-        *Dest = (char) ACPI_TOUPPER (*Source);
+        *Dest = (char) toupper ((int) *Source);
     }
 
     AcpiUtRemoveReference (ReturnObject);
index 81cac95..060b10c 100644 (file)
@@ -410,10 +410,42 @@ AcpiNsSearchAndEnter (
          * If we found it AND the request specifies that a find is an error,
          * return the error
          */
-        if ((Status == AE_OK) &&
-            (Flags & ACPI_NS_ERROR_IF_FOUND))
+        if (Status == AE_OK)
         {
-            Status = AE_ALREADY_EXISTS;
+            /* The node was found in the namespace */
+
+            /*
+             * If the namespace override feature is enabled for this node,
+             * delete any existing attached sub-object and make the node
+             * look like a new node that is owned by the override table.
+             */
+            if (Flags & ACPI_NS_OVERRIDE_IF_FOUND)
+            {
+                ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                    "Namespace override: %4.4s pass %u type %X Owner %X\n",
+                    ACPI_CAST_PTR(char, &TargetName), InterpreterMode,
+                    (*ReturnNode)->Type, WalkState->OwnerId));
+
+                AcpiNsDeleteChildren (*ReturnNode);
+                if (AcpiGbl_RuntimeNamespaceOverride)
+                {
+                    AcpiUtRemoveReference ((*ReturnNode)->Object);
+                    (*ReturnNode)->Object = NULL;
+                    (*ReturnNode)->OwnerId = WalkState->OwnerId;
+                }
+                else
+                {
+                    AcpiNsRemoveNode (*ReturnNode);
+                    *ReturnNode = ACPI_ENTRY_NOT_FOUND;
+                }
+            }
+
+            /* Return an error if we don't expect to find the object */
+
+            else if (Flags & ACPI_NS_ERROR_IF_FOUND)
+            {
+                Status = AE_ALREADY_EXISTS;
+            }
         }
 
 #ifdef ACPI_ASL_COMPILER
index 220c447..acee749 100644 (file)
@@ -162,7 +162,7 @@ AcpiNsPrintNodePathname (
 
     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
-    Status = AcpiNsHandleToPathname (Node, &Buffer);
+    Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE);
     if (ACPI_SUCCESS (Status))
     {
         if (Message)
@@ -419,7 +419,7 @@ AcpiNsBuildInternalName (
             {
                 /* Convert the character to uppercase and save it */
 
-                Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName);
+                Result[i] = (char) toupper ((int) *ExternalName);
                 ExternalName++;
             }
         }
@@ -769,6 +769,24 @@ AcpiNsTerminate (
     ACPI_FUNCTION_TRACE (NsTerminate);
 
 
+#ifdef ACPI_EXEC_APP
+    {
+        ACPI_OPERAND_OBJECT     *Prev;
+        ACPI_OPERAND_OBJECT     *Next;
+
+        /* Delete any module-level code blocks */
+
+        Next = AcpiGbl_ModuleCodeList;
+        while (Next)
+        {
+            Prev = Next;
+            Next = Next->Method.Mutex;
+            Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
+            AcpiUtRemoveReference (Prev);
+        }
+    }
+#endif
+
     /*
      * Free the entire namespace -- all nodes and all objects
      * attached to the nodes
index 7e23365..06328a6 100644 (file)
@@ -830,7 +830,7 @@ AcpiNsGetDeviceCallback (
             return (AE_CTRL_DEPTH);
         }
 
-        NoMatch = ACPI_STRCMP (Hid->String, Info->Hid);
+        NoMatch = strcmp (Hid->String, Info->Hid);
         ACPI_FREE (Hid);
 
         if (NoMatch)
@@ -854,7 +854,7 @@ AcpiNsGetDeviceCallback (
             Found = FALSE;
             for (i = 0; i < Cid->Count; i++)
             {
-                if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0)
+                if (strcmp (Cid->Ids[i].String, Info->Hid) == 0)
                 {
                     /* Found a matching CID */
 
index 4c71e37..51cc4f4 100644 (file)
@@ -198,7 +198,7 @@ AcpiGetHandle (
 
         /* Special case for root-only, since we can't search for it */
 
-        if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH))
+        if (!strcmp (Pathname, ACPI_NS_ROOT_PATH))
         {
             *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode);
             return (AE_OK);
@@ -265,11 +265,13 @@ AcpiGetName (
         return (Status);
     }
 
-    if (NameType == ACPI_FULL_PATHNAME)
+    if (NameType == ACPI_FULL_PATHNAME ||
+        NameType == ACPI_FULL_PATHNAME_NO_TRAILING)
     {
         /* Get the full pathname (From the namespace root) */
 
-        Status = AcpiNsHandleToPathname (Handle, Buffer);
+        Status = AcpiNsHandleToPathname (Handle, Buffer,
+                    NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE);
         return (Status);
     }
 
@@ -343,7 +345,7 @@ AcpiNsCopyDeviceId (
 
     /* Copy actual string and return a pointer to the next string area */
 
-    ACPI_MEMCPY (StringArea, Source->String, Source->Length);
+    memcpy (StringArea, Source->String, Source->Length);
     return (StringArea + Source->Length);
 }
 
@@ -362,7 +364,7 @@ AcpiNsCopyDeviceId (
  *              control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _SxW, and _SxD methods.
+ * _CLS, _STA, _ADR, _SxW, and _SxD methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -379,11 +381,12 @@ AcpiGetObjectInfo (
     ACPI_PNP_DEVICE_ID      *Hid = NULL;
     ACPI_PNP_DEVICE_ID      *Uid = NULL;
     ACPI_PNP_DEVICE_ID      *Sub = NULL;
+    ACPI_PNP_DEVICE_ID      *Cls = NULL;
     char                    *NextIdString;
     ACPI_OBJECT_TYPE        Type;
     ACPI_NAME               Name;
     UINT8                   ParamCount= 0;
-    UINT                  Valid = 0;
+    UINT16                  Valid = 0;
     UINT32                  InfoSize;
     UINT32                  i;
     ACPI_STATUS             Status;
@@ -431,7 +434,7 @@ AcpiGetObjectInfo (
     {
         /*
          * Get extra info for ACPI Device/Processor objects only:
-         * Run the Device _HID, _UID, _SUB, and _CID methods.
+         * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods.
          *
          * Note: none of these methods are required, so they may or may
          * not be present for this device. The Info->Valid bitfield is used
@@ -475,6 +478,15 @@ AcpiGetObjectInfo (
             InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST));
             Valid |= ACPI_VALID_CID;
         }
+
+        /* Execute the Device._CLS method */
+
+        Status = AcpiUtExecute_CLS (Node, &Cls);
+        if (ACPI_SUCCESS (Status))
+        {
+            InfoSize += Cls->Length;
+            Valid |= ACPI_VALID_CLS;
+        }
     }
 
     /*
@@ -606,6 +618,12 @@ AcpiGetObjectInfo (
         }
     }
 
+    if (Cls)
+    {
+        NextIdString = AcpiNsCopyDeviceId (&Info->ClassCode,
+            Cls, NextIdString);
+    }
+
     /* Copy the fixed-length data */
 
     Info->InfoSize = InfoSize;
@@ -635,6 +653,10 @@ Cleanup:
     {
         ACPI_FREE (CidList);
     }
+    if (Cls)
+    {
+        ACPI_FREE (Cls);
+    }
     return (Status);
 }
 
@@ -756,7 +778,7 @@ AcpiInstallMethod (
 
     /* Copy the method AML to the local buffer */
 
-    ACPI_MEMCPY (AmlBuffer, AmlStart, AmlLength);
+    memcpy (AmlBuffer, AmlStart, AmlLength);
 
     /* Initialize the method object with the new method's information */
 
index 2453ab1..cbb24a9 100644 (file)
@@ -388,7 +388,7 @@ AcpiPsGetNextNamepath (
         ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
             "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path));
 
-        NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+        NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Start);
         if (!NameOp)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
@@ -596,7 +596,7 @@ static ACPI_PARSE_OBJECT *
 AcpiPsGetNextField (
     ACPI_PARSE_STATE        *ParserState)
 {
-    UINT32                  AmlOffset;
+    UINT8                   *Aml;
     ACPI_PARSE_OBJECT       *Field;
     ACPI_PARSE_OBJECT       *Arg = NULL;
     UINT16                  Opcode;
@@ -612,8 +612,7 @@ AcpiPsGetNextField (
     ACPI_FUNCTION_TRACE (PsGetNextField);
 
 
-    AmlOffset = (UINT32) ACPI_PTR_DIFF (
-        ParserState->Aml, ParserState->AmlStart);
+    Aml = ParserState->Aml;
 
     /* Determine field type */
 
@@ -651,14 +650,12 @@ AcpiPsGetNextField (
 
     /* Allocate a new field op */
 
-    Field = AcpiPsAllocOp (Opcode);
+    Field = AcpiPsAllocOp (Opcode, Aml);
     if (!Field)
     {
         return_PTR (NULL);
     }
 
-    Field->Common.AmlOffset = AmlOffset;
-
     /* Decode the field type */
 
     switch (Opcode)
@@ -722,6 +719,7 @@ AcpiPsGetNextField (
          * Argument for Connection operator can be either a Buffer
          * (resource descriptor), or a NameString.
          */
+        Aml = ParserState->Aml;
         if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
         {
             ParserState->Aml++;
@@ -734,7 +732,7 @@ AcpiPsGetNextField (
             {
                 /* Non-empty list */
 
-                Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+                Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, Aml);
                 if (!Arg)
                 {
                     AcpiPsFreeOp (Field);
@@ -784,7 +782,7 @@ AcpiPsGetNextField (
         }
         else
         {
-            Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+            Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Aml);
             if (!Arg)
             {
                 AcpiPsFreeOp (Field);
@@ -856,7 +854,7 @@ AcpiPsGetNextArg (
 
         /* Constants, strings, and namestrings are all the same size */
 
-        Arg = AcpiPsAllocOp (AML_BYTE_OP);
+        Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml);
         if (!Arg)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
@@ -908,7 +906,8 @@ AcpiPsGetNextArg (
         {
             /* Non-empty list */
 
-            Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+            Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP,
+                    ParserState->Aml);
             if (!Arg)
             {
                 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -938,7 +937,7 @@ AcpiPsGetNextArg (
         {
             /* NullName or NameString */
 
-            Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+            Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml);
             if (!Arg)
             {
                 return_ACPI_STATUS (AE_NO_MEMORY);
index d75ac83..bd7166f 100644 (file)
 
 #include "acpi.h"
 #include "accommon.h"
+#include "acinterp.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "amlcode.h"
@@ -206,8 +207,7 @@ AcpiPsGetArguments (
          */
         while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount)
         {
-            WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
-                WalkState->ParserState.AmlStart);
+            WalkState->Aml = WalkState->ParserState.Aml;
 
             Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
                         GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
@@ -218,7 +218,6 @@ AcpiPsGetArguments (
 
             if (Arg)
             {
-                Arg->Common.AmlOffset = WalkState->AmlOffset;
                 AcpiPsAppendArg (Op, Arg);
             }
 
@@ -391,6 +390,9 @@ AcpiPsLinkModuleCode (
     ACPI_NAMESPACE_NODE     *ParentNode;
 
 
+    ACPI_FUNCTION_TRACE (PsLinkModuleCode);
+
+
     /* Get the tail of the list */
 
     Prev = Next = AcpiGbl_ModuleCodeList;
@@ -412,9 +414,12 @@ AcpiPsLinkModuleCode (
         MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
         if (!MethodObj)
         {
-            return;
+            return_VOID;
         }
 
+        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+            "Create/Link new code block: %p\n", MethodObj));
+
         if (ParentOp->Common.Node)
         {
             ParentNode = ParentOp->Common.Node;
@@ -447,8 +452,13 @@ AcpiPsLinkModuleCode (
     }
     else
     {
+        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+            "Appending to existing code block: %p\n", Prev));
+
         Prev->Method.AmlLength += AmlLength;
     }
+
+    return_VOID;
 }
 
 /*******************************************************************************
@@ -574,15 +584,7 @@ AcpiPsParseLoop (
                 continue;
             }
 
-            Op->Common.AmlOffset = WalkState->AmlOffset;
-
-            if (WalkState->OpInfo)
-            {
-                ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                    "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
-                     (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
-                     Op, ParserState->Aml, Op->Common.AmlOffset));
-            }
+            AcpiExStartTraceOpcode (Op, WalkState);
         }
 
 
index a236ff5..77e9434 100644 (file)
@@ -145,12 +145,13 @@ static ACPI_STATUS
 AcpiPsGetAmlOpcode (
     ACPI_WALK_STATE         *WalkState)
 {
+    UINT32                  AmlOffset;
+
 
     ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
 
 
-    WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
-                                WalkState->ParserState.AmlStart);
+    WalkState->Aml = WalkState->ParserState.Aml;
     WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
 
     /*
@@ -179,10 +180,13 @@ AcpiPsGetAmlOpcode (
 
         if (WalkState->PassNumber == 2)
         {
+            AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+                            WalkState->ParserState.AmlStart);
+
             ACPI_ERROR ((AE_INFO,
                 "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
                 WalkState->Opcode,
-                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));
+                (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))));
 
             ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);
 
@@ -194,13 +198,13 @@ AcpiPsGetAmlOpcode (
             AcpiOsPrintf (
                 "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
                 WalkState->Opcode,
-                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));
+                (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)));
 
             /* Dump the context surrounding the invalid opcode */
 
             AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
                 48, DB_BYTE_DISPLAY,
-                (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
+                (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
             AcpiOsPrintf (" */\n");
 #endif
         }
@@ -385,7 +389,7 @@ AcpiPsCreateOp (
     /* Create Op structure and append to parent's argument list */
 
     WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
-    Op = AcpiPsAllocOp (WalkState->Opcode);
+    Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart);
     if (!Op)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
index e0fbd89..4a26ae7 100644 (file)
         ACPI_MODULE_NAME    ("psopinfo")
 
 
-extern const UINT8      AcpiGbl_ShortOpIndex[];
-extern const UINT8      AcpiGbl_LongOpIndex[];
-
 static const UINT8      AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6};
 
 
index 71c3fa0..599a766 100644 (file)
@@ -233,6 +233,8 @@ AcpiPsCompleteThisOp (
         return_ACPI_STATUS (AE_OK);  /* OK for now */
     }
 
+    AcpiExStopTraceOpcode (Op, WalkState);
+
     /* Delete this op and the subtree below it if asked to */
 
     if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
@@ -270,7 +272,8 @@ AcpiPsCompleteThisOp (
              * These opcodes contain TermArg operands. The current
              * op must be replaced by a placeholder return op
              */
-            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+                                Op->Common.Aml);
             if (!ReplacementOp)
             {
                 Status = AE_NO_MEMORY;
@@ -289,7 +292,8 @@ AcpiPsCompleteThisOp (
                 (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)   ||
                 (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
             {
-                ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+                ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+                                    Op->Common.Aml);
                 if (!ReplacementOp)
                 {
                     Status = AE_NO_MEMORY;
@@ -302,7 +306,8 @@ AcpiPsCompleteThisOp (
                     (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
                     (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
                 {
-                    ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
+                    ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode,
+                                        Op->Common.Aml);
                     if (!ReplacementOp)
                     {
                         Status = AE_NO_MEMORY;
@@ -318,7 +323,8 @@ AcpiPsCompleteThisOp (
 
         default:
 
-            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+                                Op->Common.Aml);
             if (!ReplacementOp)
             {
                 Status = AE_NO_MEMORY;
index 328ff5b..3aa4954 100644 (file)
 
 ACPI_PARSE_OBJECT *
 AcpiPsCreateScopeOp (
-    void)
+    UINT8                   *Aml)
 {
     ACPI_PARSE_OBJECT       *ScopeOp;
 
 
-    ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP);
+    ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP, Aml);
     if (!ScopeOp)
     {
         return (NULL);
@@ -176,7 +176,7 @@ AcpiPsInitOp (
     Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER;
     Op->Common.AmlOpcode = Opcode;
 
-    ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
+    ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName,
             (AcpiPsGetOpcodeInfo (Opcode))->Name,
                 sizeof (Op->Common.AmlOpName)));
 }
@@ -187,6 +187,7 @@ AcpiPsInitOp (
  * FUNCTION:    AcpiPsAllocOp
  *
  * PARAMETERS:  Opcode          - Opcode that will be stored in the new Op
+ *              Aml             - Address of the opcode
  *
  * RETURN:      Pointer to the new Op, null on failure
  *
@@ -198,7 +199,8 @@ AcpiPsInitOp (
 
 ACPI_PARSE_OBJECT*
 AcpiPsAllocOp (
-    UINT16                  Opcode)
+    UINT16                  Opcode,
+    UINT8                   *Aml)
 {
     ACPI_PARSE_OBJECT       *Op;
     const ACPI_OPCODE_INFO  *OpInfo;
@@ -245,6 +247,7 @@ AcpiPsAllocOp (
     if (Op)
     {
         AcpiPsInitOp (Op, Opcode);
+        Op->Common.Aml = Aml;
         Op->Common.Flags = Flags;
     }
 
index 09833b6..eb5c018 100644 (file)
 #include "acdispat.h"
 #include "acinterp.h"
 #include "actables.h"
+#include "acnamesp.h"
 
 
 #define _COMPONENT          ACPI_PARSER
 
 /* Local Prototypes */
 
-static void
-AcpiPsStartTrace (
-    ACPI_EVALUATE_INFO      *Info);
-
-static void
-AcpiPsStopTrace (
-    ACPI_EVALUATE_INFO      *Info);
-
 static void
 AcpiPsUpdateParameterList (
     ACPI_EVALUATE_INFO      *Info,
@@ -158,7 +151,7 @@ AcpiPsUpdateParameterList (
 
 ACPI_STATUS
 AcpiDebugTrace (
-    char                    *Name,
+    const char              *Name,
     UINT32                  DebugLevel,
     UINT32                  DebugLayer,
     UINT32                  Flags)
@@ -172,128 +165,14 @@ AcpiDebugTrace (
         return (Status);
     }
 
-    /* TBDs: Validate name, allow full path or just nameseg */
-
-    AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name);
+    AcpiGbl_TraceMethodName = Name;
     AcpiGbl_TraceFlags = Flags;
-
-    if (DebugLevel)
-    {
-        AcpiGbl_TraceDbgLevel = DebugLevel;
-    }
-    if (DebugLayer)
-    {
-        AcpiGbl_TraceDbgLayer = DebugLayer;
-    }
+    AcpiGbl_TraceDbgLevel = DebugLevel;
+    AcpiGbl_TraceDbgLayer = DebugLayer;
+    Status = AE_OK;
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiPsStartTrace
- *
- * PARAMETERS:  Info        - Method info struct
- *
- * RETURN:      None
- *
- * DESCRIPTION: Start control method execution trace
- *
- ******************************************************************************/
-
-static void
-AcpiPsStartTrace (
-    ACPI_EVALUATE_INFO      *Info)
-{
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        return;
-    }
-
-    if ((!AcpiGbl_TraceMethodName) ||
-        (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
-    {
-        goto Exit;
-    }
-
-    AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
-    AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;
-
-    AcpiDbgLevel = 0x00FFFFFF;
-    AcpiDbgLayer = ACPI_UINT32_MAX;
-
-    if (AcpiGbl_TraceDbgLevel)
-    {
-        AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
-    }
-    if (AcpiGbl_TraceDbgLayer)
-    {
-        AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
-    }
-
-
-Exit:
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiPsStopTrace
- *
- * PARAMETERS:  Info        - Method info struct
- *
- * RETURN:      None
- *
- * DESCRIPTION: Stop control method execution trace
- *
- ******************************************************************************/
-
-static void
-AcpiPsStopTrace (
-    ACPI_EVALUATE_INFO      *Info)
-{
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        return;
-    }
-
-    if ((!AcpiGbl_TraceMethodName) ||
-        (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
-    {
-        goto Exit;
-    }
-
-    /* Disable further tracing if type is one-shot */
-
-    if (AcpiGbl_TraceFlags & 1)
-    {
-        AcpiGbl_TraceMethodName = 0;
-        AcpiGbl_TraceDbgLevel = 0;
-        AcpiGbl_TraceDbgLayer = 0;
-    }
-
-    AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
-    AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;
-
-Exit:
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+    return (Status);
 }
 
 
@@ -356,10 +235,6 @@ AcpiPsExecuteMethod (
      */
     AcpiPsUpdateParameterList (Info, REF_INCREMENT);
 
-    /* Begin tracing if requested */
-
-    AcpiPsStartTrace (Info);
-
     /*
      * Execute the method. Performs parse simultaneously
      */
@@ -369,7 +244,7 @@ AcpiPsExecuteMethod (
 
     /* Create and init a Root Node */
 
-    Op = AcpiPsCreateScopeOp ();
+    Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
     if (!Op)
     {
         Status = AE_NO_MEMORY;
@@ -442,10 +317,6 @@ AcpiPsExecuteMethod (
 Cleanup:
     AcpiPsDeleteParseTree (Op);
 
-    /* End optional tracing */
-
-    AcpiPsStopTrace (Info);
-
     /* Take away the extra reference that we gave the parameters above */
 
     AcpiPsUpdateParameterList (Info, REF_DECREMENT);
index dd430ef..8cf00d3 100644 (file)
@@ -442,16 +442,17 @@ AcpiRsCreatePciRoutingTable (
                                     (UINT8 *) OutputBuffer->Pointer);
                 PathBuffer.Pointer = UserPrt->Source;
 
-                Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+                Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node,
+                            &PathBuffer, FALSE);
 
                 /* +1 to include null terminator */
 
-                UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
+                UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1;
                 break;
 
             case ACPI_TYPE_STRING:
 
-                ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
+                strcpy (UserPrt->Source, ObjDesc->String.Pointer);
 
                 /*
                  * Add to the Length field the length of the string
index 6237118..07d308a 100644 (file)
 /*
  * All functions in this module are used by the AML Debugger only
  */
-#if defined(ACPI_DEBUGGER)
 
 /* Local prototypes */
 
@@ -739,5 +738,3 @@ AcpiRsDumpWordList (
             "Word", i, Data[i]);
     }
 }
-
-#endif
index 7871715..1a5512e 100644 (file)
@@ -202,7 +202,7 @@ AcpiRsConvertAmlToResource (
             /*
              * Get the resource type and the initial (minimum) length
              */
-            ACPI_MEMSET (Resource, 0, INIT_RESOURCE_LENGTH (Info));
+            memset (Resource, 0, INIT_RESOURCE_LENGTH (Info));
             Resource->Type = INIT_RESOURCE_TYPE (Info);
             Resource->Length = INIT_RESOURCE_LENGTH (Info);
             break;
@@ -398,13 +398,13 @@ AcpiRsConvertAmlToResource (
 
         case ACPI_RSC_SET8:
 
-            ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value);
+            memset (Destination, Info->AmlOffset, Info->Value);
             break;
 
         case ACPI_RSC_DATA8:
 
             Target = ACPI_ADD_PTR (char, Resource, Info->Value);
-            ACPI_MEMCPY (Destination, Source,  ACPI_GET16 (Target));
+            memcpy (Destination, Source,  ACPI_GET16 (Target));
             break;
 
         case ACPI_RSC_ADDRESS:
@@ -577,7 +577,7 @@ AcpiRsConvertResourceToAml (
         {
         case ACPI_RSC_INITSET:
 
-            ACPI_MEMSET (Aml, 0, INIT_RESOURCE_LENGTH (Info));
+            memset (Aml, 0, INIT_RESOURCE_LENGTH (Info));
             AmlLength = INIT_RESOURCE_LENGTH (Info);
             AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml);
             break;
index 55445b0..a7dc215 100644 (file)
@@ -246,7 +246,7 @@ AcpiRsMoveData (
         case ACPI_RSC_MOVE_SERIAL_VEN:
         case ACPI_RSC_MOVE_SERIAL_RES:
 
-            ACPI_MEMCPY (Destination, Source, ItemCount);
+            memcpy (Destination, Source, ItemCount);
             return;
 
         /*
@@ -480,11 +480,11 @@ AcpiRsGetResourceSource (
          *
          * Zero the entire area of the buffer.
          */
-        TotalLength = (UINT32) ACPI_STRLEN (
+        TotalLength = (UINT32) strlen (
             ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
         TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
 
-        ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
+        memset (ResourceSource->StringPtr, 0, TotalLength);
 
         /* Copy the ResourceSource string to the destination */
 
@@ -549,7 +549,7 @@ AcpiRsSetResourceSource (
 
         /* Copy the ResourceSource string */
 
-        ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
+        strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
             ResourceSource->StringPtr);
 
         /*
index 834ae9c..9aea3dc 100644 (file)
@@ -519,7 +519,7 @@ AcpiResourceToAddress64 (
 
         /* Simple copy for 64 bit source */
 
-        ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
+        memcpy (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
         break;
 
     default:
@@ -630,7 +630,7 @@ AcpiRsMatchVendorResource (
      */
     if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) ||
         (Vendor->UuidSubtype != Info->Uuid->Subtype)  ||
-        (ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
+        (memcmp (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
     {
         return (AE_OK);
     }
@@ -646,7 +646,7 @@ AcpiRsMatchVendorResource (
 
     /* Found the correct resource, copy and return it */
 
-    ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
+    memcpy (Buffer->Pointer, Resource, Resource->Length);
     Buffer->Length = Resource->Length;
 
     /* Found the desired descriptor, terminate resource walk */
index b89f6e8..daacf41 100644 (file)
@@ -149,7 +149,7 @@ AcpiTbInitTableDescriptor (
      * Initialize the table descriptor. Set the pointer to NULL, since the
      * table is not fully mapped at this time.
      */
-    ACPI_MEMSET (TableDesc, 0, sizeof (ACPI_TABLE_DESC));
+    memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC));
     TableDesc->Address = Address;
     TableDesc->Length = Table->Length;
     TableDesc->Flags = Flags;
@@ -583,7 +583,7 @@ AcpiTbResizeRootTableList (
 
     if (AcpiGbl_RootTableList.Tables)
     {
-        ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
+        memcpy (Tables, AcpiGbl_RootTableList.Tables,
             (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC));
 
         if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
index 93d76da..4f82733 100644 (file)
@@ -448,14 +448,22 @@ AcpiTbParseFadt (
     /* Obtain the DSDT and FACS tables via their addresses within the FADT */
 
     AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
-        ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
+        ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex);
 
     /* If Hardware Reduced flag is set, there is no FACS */
 
     if (!AcpiGbl_ReducedHardware)
     {
-        AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
-            ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
+        if (AcpiGbl_FADT.Facs)
+        {
+            AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
+                ACPI_SIG_FACS, &AcpiGbl_FacsIndex);
+        }
+        if (AcpiGbl_FADT.XFacs)
+        {
+            AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
+                ACPI_SIG_FACS, &AcpiGbl_XFacsIndex);
+        }
     }
 }
 
@@ -497,11 +505,11 @@ AcpiTbCreateLocalFadt (
 
     /* Clear the entire local FADT */
 
-    ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
+    memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
 
     /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
 
-    ACPI_MEMCPY (&AcpiGbl_FADT, Table,
+    memcpy (&AcpiGbl_FADT, Table,
         ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
 
     /* Take a copy of the Hardware Reduced flag */
@@ -605,12 +613,9 @@ AcpiTbConvertFadt (
     AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
 
     /*
-     * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+     * Expand the 32-bit DSDT addresses to 64-bit as necessary.
      * Later ACPICA code will always use the X 64-bit field.
      */
-    AcpiGbl_FADT.XFacs = AcpiTbSelectAddress ("FACS",
-        AcpiGbl_FADT.Facs, AcpiGbl_FADT.XFacs);
-
     AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
         AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
 
index c7acd1c..bf692b8 100644 (file)
@@ -145,26 +145,41 @@ AcpiTbFindTable (
     char                    *OemTableId,
     UINT32                  *TableIndex)
 {
-    UINT32                  i;
     ACPI_STATUS             Status;
     ACPI_TABLE_HEADER       Header;
+    UINT32                  i;
 
 
     ACPI_FUNCTION_TRACE (TbFindTable);
 
 
+    /* Validate the input table signature */
+
+    if (!AcpiIsValidSignature (Signature))
+    {
+        return_ACPI_STATUS (AE_BAD_SIGNATURE);
+    }
+
+    /* Don't allow the OEM strings to be too long */
+
+    if ((strlen (OemId) > ACPI_OEM_ID_SIZE) ||
+        (strlen (OemTableId) > ACPI_OEM_TABLE_ID_SIZE))
+    {
+        return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+    }
+
     /* Normalize the input strings */
 
-    ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER));
+    memset (&Header, 0, sizeof (ACPI_TABLE_HEADER));
     ACPI_MOVE_NAME (Header.Signature, Signature);
-    ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
-    ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
+    strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
+    strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
 
     /* Search for the table */
 
     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
     {
-        if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
+        if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
                             Header.Signature, ACPI_NAME_SIZE))
         {
             /* Not the requested table */
@@ -192,13 +207,13 @@ AcpiTbFindTable (
 
         /* Check for table match on all IDs */
 
-        if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
+        if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
                             Header.Signature, ACPI_NAME_SIZE) &&
             (!OemId[0] ||
-             !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
+             !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
                              Header.OemId, ACPI_OEM_ID_SIZE)) &&
             (!OemTableId[0] ||
-             !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
+             !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
                              Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE)))
         {
             *TableIndex = i;
index 8833ef3..2d7bb94 100644 (file)
@@ -166,7 +166,7 @@ AcpiTbCompareTables (
      * not just the header.
      */
     IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength ||
-        ACPI_MEMCMP (TableDesc->Pointer, Table, TableLength)) ?
+        memcmp (TableDesc->Pointer, Table, TableLength)) ?
         FALSE : TRUE);
 
     /* Release the acquired table */
@@ -180,9 +180,9 @@ AcpiTbCompareTables (
  *
  * FUNCTION:    AcpiTbInstallTableWithOverride
  *
- * PARAMETERS:  TableIndex              - Index into root table array
- *              NewTableDesc            - New table descriptor to install
+ * PARAMETERS:  NewTableDesc            - New table descriptor to install
  *              Override                - Whether override should be performed
+ *              TableIndex              - Where the table index is returned
  *
  * RETURN:      None
  *
@@ -195,12 +195,16 @@ AcpiTbCompareTables (
 
 void
 AcpiTbInstallTableWithOverride (
-    UINT32                  TableIndex,
     ACPI_TABLE_DESC         *NewTableDesc,
-    BOOLEAN                 Override)
+    BOOLEAN                 Override,
+    UINT32                  *TableIndex)
 {
+    UINT32                  i;
+    ACPI_STATUS             Status;
+
 
-    if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
+    Status = AcpiTbGetNextTableDescriptor (&i, NULL);
+    if (ACPI_FAILURE (Status))
     {
         return;
     }
@@ -217,14 +221,18 @@ AcpiTbInstallTableWithOverride (
         AcpiTbOverrideTable (NewTableDesc);
     }
 
-    AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[TableIndex],
+    AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i],
         NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer);
 
     AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer);
 
+    /* This synchronizes AcpiGbl_DsdtIndex */
+
+    *TableIndex = i;
+
     /* Set the global integer width (based upon revision of the DSDT) */
 
-    if (TableIndex == ACPI_TABLE_INDEX_DSDT)
+    if (i == AcpiGbl_DsdtIndex)
     {
         AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision);
     }
@@ -238,7 +246,7 @@ AcpiTbInstallTableWithOverride (
  * PARAMETERS:  Address                 - Physical address of DSDT or FACS
  *              Signature               - Table signature, NULL if no need to
  *                                        match
- *              TableIndex              - Index into root table array
+ *              TableIndex              - Where the table index is returned
  *
  * RETURN:      Status
  *
@@ -251,7 +259,7 @@ ACPI_STATUS
 AcpiTbInstallFixedTable (
     ACPI_PHYSICAL_ADDRESS   Address,
     char                    *Signature,
-    UINT32                  TableIndex)
+    UINT32                  *TableIndex)
 {
     ACPI_TABLE_DESC         NewTableDesc;
     ACPI_STATUS             Status;
@@ -286,7 +294,9 @@ AcpiTbInstallFixedTable (
         goto ReleaseAndExit;
     }
 
-    AcpiTbInstallTableWithOverride (TableIndex, &NewTableDesc, TRUE);
+    /* Add the table to the global root table list */
+
+    AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex);
 
 ReleaseAndExit:
 
@@ -381,7 +391,7 @@ AcpiTbInstallStandardTable (
          */
         if ((NewTableDesc.Signature.Ascii[0] != 0x00) &&
            (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) &&
-           (ACPI_STRNCMP (NewTableDesc.Signature.Ascii, "OEM", 3)))
+           (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3)))
         {
             ACPI_BIOS_ERROR ((AE_INFO,
                 "Table has invalid signature [%4.4s] (0x%8.8X), "
@@ -447,14 +457,7 @@ AcpiTbInstallStandardTable (
 
     /* Add the table to the global root table list */
 
-    Status = AcpiTbGetNextTableDescriptor (&i, NULL);
-    if (ACPI_FAILURE (Status))
-    {
-        goto ReleaseAndExit;
-    }
-
-    *TableIndex = i;
-    AcpiTbInstallTableWithOverride (i, &NewTableDesc, Override);
+    AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
 
 ReleaseAndExit:
 
index 105925b..e958041 100644 (file)
@@ -156,7 +156,7 @@ AcpiTbFixString (
 
     while (Length && *String)
     {
-        if (!ACPI_IS_PRINT (*String))
+        if (!isprint ((int) *String))
         {
             *String = '?';
         }
@@ -186,7 +186,7 @@ AcpiTbCleanupTableHeader (
     ACPI_TABLE_HEADER       *Header)
 {
 
-    ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));
+    memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));
 
     AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE);
     AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE);
@@ -228,7 +228,7 @@ AcpiTbPrintTableHeader (
     {
         /* RSDP has no common fields */
 
-        ACPI_MEMCPY (LocalHeader.OemId,
+        memcpy (LocalHeader.OemId,
             ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE);
         AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
 
index b2fdb91..0570425 100644 (file)
@@ -147,7 +147,7 @@ ACPI_STATUS
 AcpiTbInitializeFacs (
     void)
 {
-    ACPI_STATUS             Status;
+    ACPI_TABLE_FACS         *Facs;
 
 
     /* If Hardware Reduced flag is set, there is no FACS */
@@ -157,10 +157,23 @@ AcpiTbInitializeFacs (
         AcpiGbl_FACS = NULL;
         return (AE_OK);
     }
+    else if (AcpiGbl_FADT.XFacs &&
+             (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses))
+    {
+        (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex,
+                    ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
+        AcpiGbl_FACS = Facs;
+    }
+    else if (AcpiGbl_FADT.Facs)
+    {
+        (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex,
+                    ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
+        AcpiGbl_FACS = Facs;
+    }
 
-    Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
-                ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
-    return (Status);
+    /* If there is no FACS, just continue. There was already an error msg */
+
+    return (AE_OK);
 }
 #endif /* !ACPI_REDUCED_HARDWARE */
 
@@ -183,7 +196,7 @@ AcpiTbTablesLoaded (
     void)
 {
 
-    if (AcpiGbl_RootTableList.CurrentTableCount >= 3)
+    if (AcpiGbl_RootTableList.CurrentTableCount >= 4)
     {
         return (TRUE);
     }
@@ -262,11 +275,11 @@ AcpiTbCopyDsdt (
         return (NULL);
     }
 
-    ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length);
+    memcpy (NewTable, TableDesc->Pointer, TableDesc->Length);
     AcpiTbUninstallTable (TableDesc);
 
     AcpiTbInitTableDescriptor (
-        &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT],
+        &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex],
         ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
         NewTable);
 
@@ -460,13 +473,6 @@ AcpiTbParseRootTable (
         TableEntrySize);
     TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));
 
-    /*
-     * First two entries in the table array are reserved for the DSDT
-     * and FACS, which are not actually present in the RSDT/XSDT - they
-     * come from the FADT
-     */
-    AcpiGbl_RootTableList.CurrentTableCount = 2;
-
     /* Initialize the root table array from the RSDT/XSDT */
 
     for (i = 0; i < TableCount; i++)
@@ -501,3 +507,43 @@ NextTable:
 
     return_ACPI_STATUS (AE_OK);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiIsValidSignature
+ *
+ * PARAMETERS:  Signature           - Sig string to be validated
+ *
+ * RETURN:      TRUE if signature is correct length and has valid characters
+ *
+ * DESCRIPTION: Validate an ACPI table signature.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiIsValidSignature (
+    char                    *Signature)
+{
+    UINT32                  i;
+
+
+    /* Validate the signature length */
+
+    if (strlen (Signature) != ACPI_NAME_SIZE)
+    {
+        return (FALSE);
+    }
+
+    /* Validate each character in the signature */
+
+    for (i = 0; i < ACPI_NAME_SIZE; i++)
+    {
+        if (!AcpiUtValidAcpiChar (Signature[i], i))
+        {
+            return (FALSE);
+        }
+    }
+
+    return (TRUE);
+}
index d2351d3..25e1405 100644 (file)
@@ -204,7 +204,7 @@ AcpiInitializeTables (
     {
         /* Root Table Array has been statically allocated by the host */
 
-        ACPI_MEMSET (InitialTableArray, 0,
+        memset (InitialTableArray, 0,
             (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC));
 
         AcpiGbl_RootTableList.Tables = InitialTableArray;
@@ -343,7 +343,7 @@ AcpiGetTableHeader (
                     return (AE_NO_MEMORY);
                 }
 
-                ACPI_MEMCPY (OutTableHeader, Header,
+                memcpy (OutTableHeader, Header,
                     sizeof (ACPI_TABLE_HEADER));
                 AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER));
             }
@@ -354,7 +354,7 @@ AcpiGetTableHeader (
         }
         else
         {
-            ACPI_MEMCPY (OutTableHeader,
+            memcpy (OutTableHeader,
                 AcpiGbl_RootTableList.Tables[i].Pointer,
                 sizeof (ACPI_TABLE_HEADER));
         }
index 83f6420..1d51c91 100644 (file)
 #define _COMPONENT          ACPI_TABLES
         ACPI_MODULE_NAME    ("tbxfload")
 
-/* Local prototypes */
-
-static ACPI_STATUS
-AcpiTbLoadNamespace (
-    void);
-
 
 /*******************************************************************************
  *
@@ -155,6 +149,14 @@ AcpiLoadTables (
     /* Load the namespace from the tables */
 
     Status = AcpiTbLoadNamespace ();
+
+    /* Don't let single failures abort the load */
+
+    if (Status == AE_CTRL_TERMINATE)
+    {
+        Status = AE_OK;
+    }
+
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status,
@@ -180,13 +182,16 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+ACPI_STATUS
 AcpiTbLoadNamespace (
     void)
 {
     ACPI_STATUS             Status;
     UINT32                  i;
     ACPI_TABLE_HEADER       *NewDsdt;
+    ACPI_TABLE_DESC         *Table;
+    UINT32                  TablesLoaded = 0;
+    UINT32                  TablesFailed = 0;
 
 
     ACPI_FUNCTION_TRACE (TbLoadNamespace);
@@ -198,12 +203,11 @@ AcpiTbLoadNamespace (
      * Load the namespace. The DSDT is required, but any SSDT and
      * PSDT tables are optional. Verify the DSDT.
      */
+    Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
+
     if (!AcpiGbl_RootTableList.CurrentTableCount ||
-        !ACPI_COMPARE_NAME (
-            &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
-            ACPI_SIG_DSDT) ||
-         ACPI_FAILURE (AcpiTbValidateTable (
-            &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
+        !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
+         ACPI_FAILURE (AcpiTbValidateTable (Table)))
     {
         Status = AE_NO_ACPI_TABLES;
         goto UnlockAndExit;
@@ -215,7 +219,7 @@ AcpiTbLoadNamespace (
      * array can change dynamically as tables are loaded at run-time. Note:
      * .Pointer field is not validated until after call to AcpiTbValidateTable.
      */
-    AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer;
+    AcpiGbl_DSDT = Table->Pointer;
 
     /*
      * Optionally copy the entire DSDT to local memory (instead of simply
@@ -225,7 +229,7 @@ AcpiTbLoadNamespace (
      */
     if (AcpiGbl_CopyDsdtLocally)
     {
-        NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT);
+        NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex);
         if (NewDsdt)
         {
             AcpiGbl_DSDT = NewDsdt;
@@ -236,17 +240,22 @@ AcpiTbLoadNamespace (
      * Save the original DSDT header for detection of table corruption
      * and/or replacement of the DSDT from outside the OS.
      */
-    ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
+    memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
         sizeof (ACPI_TABLE_HEADER));
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
 
     /* Load and parse tables */
 
-    Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
+    Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
+        TablesFailed++;
+    }
+    else
+    {
+        TablesLoaded++;
     }
 
     /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
@@ -254,12 +263,13 @@ AcpiTbLoadNamespace (
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
     {
-        if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
-                    ACPI_SIG_SSDT) &&
-             !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
-                    ACPI_SIG_PSDT)) ||
-             ACPI_FAILURE (AcpiTbValidateTable (
-                &AcpiGbl_RootTableList.Tables[i])))
+        Table = &AcpiGbl_RootTableList.Tables[i];
+
+        if (!AcpiGbl_RootTableList.Tables[i].Address ||
+            (!ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_SSDT) &&
+             !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_PSDT) &&
+             !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_OSDT)) ||
+             ACPI_FAILURE (AcpiTbValidateTable (Table)))
         {
             continue;
         }
@@ -267,11 +277,41 @@ AcpiTbLoadNamespace (
         /* Ignore errors while loading tables, get as many as possible */
 
         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-        (void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
+        Status =  AcpiNsLoadTable (i, AcpiGbl_RootNode);
+        if (ACPI_FAILURE (Status))
+        {
+            ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
+                Table->Signature.Ascii, Table->Pointer->OemTableId));
+            TablesFailed++;
+
+            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+                "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n",
+                Table->Signature.Ascii, Table->Pointer->OemTableId));
+        }
+        else
+        {
+            TablesLoaded++;
+        }
+
         (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     }
 
-    ACPI_INFO ((AE_INFO, "All ACPI Tables successfully acquired"));
+    if (!TablesFailed)
+    {
+        ACPI_INFO ((AE_INFO,
+            "%u ACPI AML tables successfully acquired and loaded",
+            TablesLoaded));
+    }
+    else
+    {
+        ACPI_ERROR ((AE_INFO,
+            "%u table load failures, %u successful",
+            TablesFailed, TablesLoaded));
+
+        /* Indicate at least one failure */
+
+        Status = AE_CTRL_TERMINATE;
+    }
 
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
@@ -310,11 +350,11 @@ AcpiInstallTable (
 
     if (Physical)
     {
-        Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
+        Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
     }
     else
     {
-        Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
+        Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
     }
 
     Status = AcpiTbInstallStandardTable (Address, Flags,
index 0c8c928..62c3e28 100644 (file)
@@ -151,7 +151,7 @@ AcpiOsAllocateZeroed (
     {
         /* Clear the memory block */
 
-        ACPI_MEMSET (Allocation, 0, Size);
+        memset (Allocation, 0, Size);
     }
 
     return (Allocation);
@@ -261,7 +261,7 @@ AcpiUtDeleteCaches (
 
     if (AcpiGbl_DisplayFinalMemStats)
     {
-        ACPI_STRCPY (Buffer, "MEMORY");
+        strcpy (Buffer, "MEMORY");
         (void) AcpiDbDisplayStatistics (Buffer);
     }
 #endif
@@ -431,6 +431,6 @@ AcpiUtInitializeBuffer (
 
     /* Have a valid buffer, clear it */
 
-    ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+    memset (Buffer->Pointer, 0, RequiredLength);
     return (AE_OK);
 }
index 65110fb..79aff33 100644 (file)
@@ -240,7 +240,7 @@ AcpiUtDumpBuffer (
             }
 
             BufChar = Buffer[(ACPI_SIZE) i + j];
-            if (ACPI_IS_PRINT (BufChar))
+            if (isprint (BufChar))
             {
                 AcpiOsPrintf ("%c", BufChar);
             }
@@ -413,7 +413,7 @@ AcpiUtDumpBufferToFile (
             }
 
             BufChar = Buffer[(ACPI_SIZE) i + j];
-            if (ACPI_IS_PRINT (BufChar))
+            if (isprint (BufChar))
             {
                 AcpiUtFilePrintf (File, "%c", BufChar);
             }
index 25c8e0e..5cf5250 100644 (file)
@@ -164,7 +164,7 @@ AcpiOsCreateCache (
 
     /* Populate the cache object and return it */
 
-    ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
+    memset (Cache, 0, sizeof (ACPI_MEMORY_LIST));
     Cache->ListName   = CacheName;
     Cache->ObjectSize = ObjectSize;
     Cache->MaxDepth   = MaxDepth;
@@ -314,7 +314,7 @@ AcpiOsReleaseObject (
 
         /* Mark the object as cached */
 
-        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
+        memset (Object, 0xCA, Cache->ObjectSize);
         ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
 
         /* Put the object at the head of the cache list */
@@ -390,7 +390,7 @@ AcpiOsAcquireObject (
 
         /* Clear (zero) the previously used Object */
 
-        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
+        memset (Object, 0, Cache->ObjectSize);
     }
     else
     {
index 009332f..2a64185 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: cmclib - Local implementation of C library functions
+ * Module Name: utclib - ACPICA implementations of C library functions
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
+#define ACPI_CLIBRARY
 #include "acpi.h"
 #include "accommon.h"
 
 /*
- * These implementations of standard C Library routines can optionally be
- * used if a C library is not available. In general, they are less efficient
- * than an inline or assembly implementation
+ * This module contains implementations of the standard C library functions
+ * that are required by the ACPICA code at both application level and kernel
+ * level.
+ *
+ * The module is an optional feature that can be used if a local/system
+ * C library is not available. Some operating system kernels may not have
+ * an internal C library.
+ *
+ * In general, these functions are less efficient than an inline or assembly
+ * code implementation.
+ *
+ * These C functions and the associated prototypes are enabled by default
+ * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually
+ * automatically defined for the ACPICA applications such as iASL and
+ * AcpiExec, so that these user-level applications use the local C library
+ * instead of the functions in this module.
  */
 
-#define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("cmclib")
+/*******************************************************************************
+ *
+ * Functions implemented in this module:
+ *
+ * FUNCTION:    memcmp
+ * FUNCTION:    memcpy
+ * FUNCTION:    memset
+ * FUNCTION:    strlen
+ * FUNCTION:    strcpy
+ * FUNCTION:    strncpy
+ * FUNCTION:    strcmp
+ * FUNCTION:    strchr
+ * FUNCTION:    strncmp
+ * FUNCTION:    strcat
+ * FUNCTION:    strncat
+ * FUNCTION:    strstr
+ * FUNCTION:    strtoul
+ * FUNCTION:    toupper
+ * FUNCTION:    tolower
+ * FUNCTION:    is* functions
+ *
+ ******************************************************************************/
 
+#define _COMPONENT          ACPI_UTILITIES
+        ACPI_MODULE_NAME    ("utclib")
 
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
 
-#define NEGATIVE    1
-#define POSITIVE    0
+#ifndef ACPI_USE_SYSTEM_CLIBRARY    /* Entire module */
 
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtMemcmp (memcmp)
+ * FUNCTION:    memcmp
  *
  * PARAMETERS:  Buffer1         - First Buffer
  *              Buffer2         - Second Buffer
  * DESCRIPTION: Compare two Buffers, with a maximum length
  *
  ******************************************************************************/
-
+#ifdef __REACTOS__
 int
-AcpiUtMemcmp (
-    const char              *Buffer1,
-    const char              *Buffer2,
+memcmp (
+    const void              *VBuffer1,
+    const void              *VBuffer2,
     ACPI_SIZE               Count)
+#else /* __REACTOS__ */
+int
+memcmp (
+    void                    *VBuffer1,
+    void                    *VBuffer2,
+    ACPI_SIZE               Count)
+#endif /* __REACTOS__ */
 {
+    char                    *Buffer1 = (char *) VBuffer1;
+    char                    *Buffer2 = (char *) VBuffer2;
+
 
     for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
     {
@@ -164,7 +208,7 @@ AcpiUtMemcmp (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtMemcpy (memcpy)
+ * FUNCTION:    memcpy
  *
  * PARAMETERS:  Dest        - Target of the copy
  *              Src         - Source buffer to copy
@@ -177,7 +221,7 @@ AcpiUtMemcmp (
  ******************************************************************************/
 
 void *
-AcpiUtMemcpy (
+memcpy (
     void                    *Dest,
     const void              *Src,
     ACPI_SIZE               Count)
@@ -200,7 +244,7 @@ AcpiUtMemcpy (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtMemset (memset)
+ * FUNCTION:    memset
  *
  * PARAMETERS:  Dest        - Buffer to set
  *              Value       - Value to set each byte of memory
@@ -213,9 +257,9 @@ AcpiUtMemcpy (
  ******************************************************************************/
 
 void *
-AcpiUtMemset (
+memset (
     void                    *Dest,
-    UINT8                   Value,
+    int                     Value,
     ACPI_SIZE               Count)
 {
     char                    *New = (char *) Dest;
@@ -234,7 +278,7 @@ AcpiUtMemset (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrlen (strlen)
+ * FUNCTION:    strlen
  *
  * PARAMETERS:  String              - Null terminated string
  *
@@ -246,7 +290,7 @@ AcpiUtMemset (
 
 
 ACPI_SIZE
-AcpiUtStrlen (
+strlen (
     const char              *String)
 {
     UINT32                  Length = 0;
@@ -266,7 +310,7 @@ AcpiUtStrlen (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrcpy (strcpy)
+ * FUNCTION:    strcpy
  *
  * PARAMETERS:  DstString       - Target of the copy
  *              SrcString       - The source string to copy
@@ -278,7 +322,7 @@ AcpiUtStrlen (
  ******************************************************************************/
 
 char *
-AcpiUtStrcpy (
+strcpy (
     char                    *DstString,
     const char              *SrcString)
 {
@@ -304,7 +348,7 @@ AcpiUtStrcpy (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrncpy (strncpy)
+ * FUNCTION:    strncpy
  *
  * PARAMETERS:  DstString       - Target of the copy
  *              SrcString       - The source string to copy
@@ -317,7 +361,7 @@ AcpiUtStrcpy (
  ******************************************************************************/
 
 char *
-AcpiUtStrncpy (
+strncpy (
     char                    *DstString,
     const char              *SrcString,
     ACPI_SIZE               Count)
@@ -347,7 +391,7 @@ AcpiUtStrncpy (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrcmp (strcmp)
+ * FUNCTION:    strcmp
  *
  * PARAMETERS:  String1         - First string
  *              String2         - Second string
@@ -359,7 +403,7 @@ AcpiUtStrncpy (
  ******************************************************************************/
 
 int
-AcpiUtStrcmp (
+strcmp (
     const char              *String1,
     const char              *String2)
 {
@@ -379,7 +423,7 @@ AcpiUtStrcmp (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrchr (strchr)
+ * FUNCTION:    strchr
  *
  * PARAMETERS:  String          - Search string
  *              ch              - character to search for
@@ -391,7 +435,7 @@ AcpiUtStrcmp (
  ******************************************************************************/
 
 char *
-AcpiUtStrchr (
+strchr (
     const char              *String,
     int                     ch)
 {
@@ -411,7 +455,7 @@ AcpiUtStrchr (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrncmp (strncmp)
+ * FUNCTION:    strncmp
  *
  * PARAMETERS:  String1         - First string
  *              String2         - Second string
@@ -424,7 +468,7 @@ AcpiUtStrchr (
  ******************************************************************************/
 
 int
-AcpiUtStrncmp (
+strncmp (
     const char              *String1,
     const char              *String2,
     ACPI_SIZE               Count)
@@ -446,7 +490,7 @@ AcpiUtStrncmp (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrcat (Strcat)
+ * FUNCTION:    strcat
  *
  * PARAMETERS:  DstString       - Target of the copy
  *              SrcString       - The source string to copy
@@ -458,7 +502,7 @@ AcpiUtStrncmp (
  ******************************************************************************/
 
 char *
-AcpiUtStrcat (
+strcat (
     char                    *DstString,
     const char              *SrcString)
 {
@@ -481,7 +525,7 @@ AcpiUtStrcat (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrncat (strncat)
+ * FUNCTION:    strncat
  *
  * PARAMETERS:  DstString       - Target of the copy
  *              SrcString       - The source string to copy
@@ -495,7 +539,7 @@ AcpiUtStrcat (
  ******************************************************************************/
 
 char *
-AcpiUtStrncat (
+strncat (
     char                    *DstString,
     const char              *SrcString,
     ACPI_SIZE               Count)
@@ -529,7 +573,7 @@ AcpiUtStrncat (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrstr (strstr)
+ * FUNCTION:    strstr
  *
  * PARAMETERS:  String1         - Target string
  *              String2         - Substring to search for
@@ -542,25 +586,40 @@ AcpiUtStrncat (
  *
  ******************************************************************************/
 
+#ifdef __REACTOS__
 char *
-AcpiUtStrstr (
+strstr (
+    const char              *String1,
+    const char              *String2)
+#else /* __REACTOS **/
+char *
+strstr (
     char                    *String1,
     char                    *String2)
+#endif /* __REACTOS__ */
 {
     UINT32                  Length;
 
 
-    Length = AcpiUtStrlen (String2);
+    Length = strlen (String2);
     if (!Length)
     {
+#ifdef __REACTOS__
+        return (char *)(String1);
+#else /* __REACTOS__ */
         return (String1);
+#endif /* __REACTOS__ */
     }
 
-    while (AcpiUtStrlen (String1) >= Length)
+    while (strlen (String1) >= Length)
     {
-        if (AcpiUtMemcmp (String1, String2, Length) == 0)
+        if (memcmp (String1, String2, Length) == 0)
         {
+#ifdef __REACTOS__
+            return (char *)(String1);
+#else /* __REACTOS__ */
             return (String1);
+#endif /* __REACTOS__ */
         }
         String1++;
     }
@@ -571,7 +630,7 @@ AcpiUtStrstr (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtStrtoul (strtoul)
+ * FUNCTION:    strtoul
  *
  * PARAMETERS:  String          - Null terminated string
  *              Terminater      - Where a pointer to the terminating byte is
@@ -581,12 +640,12 @@ AcpiUtStrstr (
  * RETURN:      Converted value
  *
  * DESCRIPTION: Convert a string into a 32-bit unsigned value.
- *              Note: use AcpiUtStrtoul64 for 64-bit integers.
+ *              Note: use strtoul64 for 64-bit integers.
  *
  ******************************************************************************/
 
 UINT32
-AcpiUtStrtoul (
+strtoul (
     const char              *String,
     char                    **Terminator,
     UINT32                  Base)
@@ -605,7 +664,7 @@ AcpiUtStrtoul (
      * skip over any white space in the buffer:
      */
     StringStart = String;
-    while (ACPI_IS_SPACE (*String) || *String == '\t')
+    while (isspace (*String) || *String == '\t')
     {
         ++String;
     }
@@ -616,17 +675,17 @@ AcpiUtStrtoul (
      */
     if (*String == '-')
     {
-        sign = NEGATIVE;
+        sign = ACPI_SIGN_NEGATIVE;
         ++String;
     }
     else if (*String == '+')
     {
         ++String;
-        sign = POSITIVE;
+        sign = ACPI_SIGN_POSITIVE;
     }
     else
     {
-        sign = POSITIVE;
+        sign = ACPI_SIGN_POSITIVE;
     }
 
     /*
@@ -637,7 +696,7 @@ AcpiUtStrtoul (
     {
         if (*String == '0')
         {
-            if (AcpiUtToLower (*(++String)) == 'x')
+            if (tolower (*(++String)) == 'x')
             {
                 Base = 16;
                 ++String;
@@ -672,7 +731,7 @@ AcpiUtStrtoul (
 
     if (Base == 16 &&
         *String == '0' &&
-        AcpiUtToLower (*(++String)) == 'x')
+        tolower (*(++String)) == 'x')
     {
         String++;
     }
@@ -682,14 +741,14 @@ AcpiUtStrtoul (
      */
     while (*String)
     {
-        if (ACPI_IS_DIGIT (*String))
+        if (isdigit (*String))
         {
             index = (UINT32) ((UINT8) *String - '0');
         }
         else
         {
-            index = (UINT32) AcpiUtToUpper (*String);
-            if (ACPI_IS_UPPER (index))
+            index = (UINT32) toupper (*String);
+            if (isupper (index))
             {
                 index = index - 'A' + 10;
             }
@@ -749,7 +808,7 @@ done:
     /*
      * If a minus sign was present, then "the conversion is negated":
      */
-    if (sign == NEGATIVE)
+    if (sign == ACPI_SIGN_NEGATIVE)
     {
         ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
     }
@@ -760,7 +819,7 @@ done:
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtToUpper (TOUPPER)
+ * FUNCTION:    toupper
  *
  * PARAMETERS:  c           - Character to convert
  *
@@ -771,17 +830,17 @@ done:
  ******************************************************************************/
 
 int
-AcpiUtToUpper (
+toupper (
     int                     c)
 {
 
-    return (ACPI_IS_LOWER(c) ? ((c)-0x20) : (c));
+    return (islower(c) ? ((c)-0x20) : (c));
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtToLower (TOLOWER)
+ * FUNCTION:    tolower
  *
  * PARAMETERS:  c           - Character to convert
  *
@@ -792,23 +851,23 @@ AcpiUtToUpper (
  ******************************************************************************/
 
 int
-AcpiUtToLower (
+tolower (
     int                     c)
 {
 
-    return (ACPI_IS_UPPER(c) ? ((c)+0x20) : (c));
+    return (isupper(c) ? ((c)+0x20) : (c));
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    is* functions
+ * FUNCTION:    is* function array
  *
  * DESCRIPTION: is* functions use the ctype table below
  *
  ******************************************************************************/
 
-const UINT8 _acpi_ctype[257] = {
+const UINT8 AcpiGbl_Ctypes[257] = {
     _ACPI_CN,            /* 0x00     0 NUL */
     _ACPI_CN,            /* 0x01     1 SOH */
     _ACPI_CN,            /* 0x02     2 STX */
index 7dfc104..bc77787 100644 (file)
@@ -218,7 +218,7 @@ AcpiUtCopyIsimpleToEsimple (
 
     /* Always clear the external object */
 
-    ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
+    memset (ExternalObject, 0, sizeof (ACPI_OBJECT));
 
     /*
      * In general, the external object will be the same type as
@@ -237,7 +237,7 @@ AcpiUtCopyIsimpleToEsimple (
         *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
                             (ACPI_SIZE) InternalObject->String.Length + 1);
 
-        ACPI_MEMCPY ((void *) DataSpace,
+        memcpy ((void *) DataSpace,
             (void *) InternalObject->String.Pointer,
             (ACPI_SIZE) InternalObject->String.Length + 1);
         break;
@@ -249,7 +249,7 @@ AcpiUtCopyIsimpleToEsimple (
         *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
                             InternalObject->String.Length);
 
-        ACPI_MEMCPY ((void *) DataSpace,
+        memcpy ((void *) DataSpace,
             (void *) InternalObject->Buffer.Pointer,
             InternalObject->Buffer.Length);
         break;
@@ -600,7 +600,7 @@ AcpiUtCopyEsimpleToIsimple (
             goto ErrorExit;
         }
 
-        ACPI_MEMCPY (InternalObject->String.Pointer,
+        memcpy (InternalObject->String.Pointer,
                      ExternalObject->String.Pointer,
                      ExternalObject->String.Length);
 
@@ -616,7 +616,7 @@ AcpiUtCopyEsimpleToIsimple (
             goto ErrorExit;
         }
 
-        ACPI_MEMCPY (InternalObject->Buffer.Pointer,
+        memcpy (InternalObject->Buffer.Pointer,
                      ExternalObject->Buffer.Pointer,
                      ExternalObject->Buffer.Length);
 
@@ -804,7 +804,7 @@ AcpiUtCopySimpleObject (
         CopySize = sizeof (ACPI_NAMESPACE_NODE);
     }
 
-    ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc),
+    memcpy (ACPI_CAST_PTR (char, DestDesc),
         ACPI_CAST_PTR (char, SourceDesc), CopySize);
 
     /* Restore the saved fields */
@@ -838,7 +838,7 @@ AcpiUtCopySimpleObject (
 
             /* Copy the actual buffer data */
 
-            ACPI_MEMCPY (DestDesc->Buffer.Pointer,
+            memcpy (DestDesc->Buffer.Pointer,
                 SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length);
         }
         break;
@@ -860,7 +860,7 @@ AcpiUtCopySimpleObject (
 
             /* Copy the actual string data */
 
-            ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
+            memcpy (DestDesc->String.Pointer, SourceDesc->String.Pointer,
                 (ACPI_SIZE) SourceDesc->String.Length + 1);
         }
         break;
index 60c6067..df52d17 100644 (file)
 
 #include "acpi.h"
 #include "accommon.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utdebug")
@@ -706,6 +707,42 @@ AcpiUtPtrExit (
     }
 }
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiTracePoint
+ *
+ * PARAMETERS:  Type                - Trace event type
+ *              Begin               - TRUE if before execution
+ *              Aml                 - Executed AML address
+ *              Pathname            - Object path
+ *              Pointer             - Pointer to the related object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Interpreter execution trace.
+ *
+ ******************************************************************************/
+
+void
+AcpiTracePoint (
+    ACPI_TRACE_EVENT_TYPE   Type,
+    BOOLEAN                 Begin,
+    UINT8                   *Aml,
+    char                    *Pathname)
+{
+
+    ACPI_FUNCTION_ENTRY ();
+
+    AcpiExTracePoint (Type, Begin, Aml, Pathname);
+
+#ifdef ACPI_USE_SYSTEM_TRACER
+    AcpiOsTracePoint (Type, Begin, Aml, Pathname);
+#endif
+}
+
+ACPI_EXPORT_SYMBOL (AcpiTracePoint)
+
 #endif
 
 
index eb0dc9f..99468d5 100644 (file)
@@ -333,13 +333,29 @@ char *
 AcpiUtGetObjectTypeName (
     ACPI_OPERAND_OBJECT     *ObjDesc)
 {
+    ACPI_FUNCTION_TRACE (UtGetObjectTypeName);
+
 
     if (!ObjDesc)
     {
-        return ("[NULL Object Descriptor]");
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
+        return_PTR ("[NULL Object Descriptor]");
+    }
+
+    /* These descriptor types share a common area */
+
+    if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) &&
+        (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_NAMED))
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+            "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n",
+            ACPI_GET_DESCRIPTOR_TYPE (ObjDesc),
+            AcpiUtGetDescriptorName (ObjDesc), ObjDesc));
+
+        return_PTR ("Invalid object");
     }
 
-    return (AcpiUtGetTypeName (ObjDesc->Common.Type));
+    return_PTR (AcpiUtGetTypeName (ObjDesc->Common.Type));
 }
 
 
@@ -533,8 +549,6 @@ static char                 *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
     "ACPI_MTX_Events",
     "ACPI_MTX_Caches",
     "ACPI_MTX_Memory",
-    "ACPI_MTX_CommandComplete",
-    "ACPI_MTX_CommandReady"
 };
 
 char *
index 80b8f98..8a55c8e 100644 (file)
@@ -292,6 +292,10 @@ AcpiUtDeleteInternalObj (
             AcpiUtDeleteObjectDesc (Object->Method.Mutex);
             Object->Method.Mutex = NULL;
         }
+        if (Object->Method.Node)
+        {
+            Object->Method.Node = NULL;
+        }
         break;
 
     case ACPI_TYPE_REGION:
index e24e81f..756c14b 100644 (file)
 #include "accommon.h"
 #include "actables.h"
 #include "acapps.h"
+#include "errno.h"
 
 #ifdef ACPI_ASL_COMPILER
 #include "aslcompiler.h"
@@ -300,11 +301,8 @@ AcpiUtReadTable (
                 TableHeader.Length, FileSize);
 
 #ifdef ACPI_ASL_COMPILER
-            Status = FlCheckForAscii (fp, NULL, FALSE);
-            if (ACPI_SUCCESS (Status))
-            {
-                AcpiOsPrintf ("File appears to be ASCII only, must be binary\n");
-            }
+            AcpiOsPrintf ("File is corrupt or is ASCII text -- "
+                "it must be a binary file\n");
 #endif
             return (AE_BAD_HEADER);
         }
@@ -405,6 +403,12 @@ AcpiUtReadTableFromFile (
     if (!File)
     {
         perror ("Could not open input file");
+
+        if (errno == ENOENT)
+        {
+            return (AE_NOT_EXIST);
+        }
+
         return (Status);
     }
 
@@ -416,7 +420,8 @@ AcpiUtReadTableFromFile (
 
     /* Get the entire file */
 
-    fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n",
+    fprintf (stderr,
+        "Reading ACPI table from file %12s - Length %.8u (0x%06X)\n",
         Filename, FileSize, FileSize);
 
     Status = AcpiUtReadTable (File, Table, &TableLength);
index 500ab40..c652f6a 100644 (file)
@@ -154,9 +154,9 @@ AcpiUtHexToAsciiChar (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtHexCharToValue
+ * FUNCTION:    AcpiUtAsciiCharToHex
  *
- * PARAMETERS:  AsciiChar             - Hex character in Ascii
+ * PARAMETERS:  HexChar                 - Hex character in Ascii
  *
  * RETURN:      The binary value of the ascii/hex character
  *
index f611997..3bb12f0 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: utids - support for device IDs - HID, UID, CID
+ * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS
  *
  *****************************************************************************/
 
@@ -193,7 +193,7 @@ AcpiUtExecute_HID (
     }
     else
     {
-        ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer);
+        strcpy (Hid->String, ObjDesc->String.Pointer);
     }
 
     Hid->Length = Length;
@@ -266,7 +266,7 @@ AcpiUtExecute_SUB (
 
     /* Simply copy existing string */
 
-    ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer);
+    strcpy (Sub->String, ObjDesc->String.Pointer);
     Sub->Length = Length;
     *ReturnId = Sub;
 
@@ -351,7 +351,7 @@ AcpiUtExecute_UID (
     }
     else
     {
-        ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer);
+        strcpy (Uid->String, ObjDesc->String.Pointer);
     }
 
     Uid->Length = Length;
@@ -498,7 +498,7 @@ AcpiUtExecute_CID (
         {
             /* Copy the String CID from the returned object */
 
-            ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer);
+            strcpy (NextIdString, CidObjects[i]->String.Pointer);
             Length = CidObjects[i]->String.Length + 1;
         }
 
@@ -521,3 +521,97 @@ Cleanup:
     AcpiUtRemoveReference (ObjDesc);
     return_ACPI_STATUS (Status);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtExecute_CLS
+ *
+ * PARAMETERS:  DeviceNode          - Node for the device
+ *              ReturnId            - Where the _CLS is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Executes the _CLS control method that returns PCI-defined
+ *              class code of the device. The _CLS value is always a package
+ *              containing PCI class information as a list of integers.
+ *              The returned string has format "BBSSPP", where:
+ *                BB = Base-class code
+ *                SS = Sub-class code
+ *                PP = Programming Interface code
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_CLS (
+    ACPI_NAMESPACE_NODE     *DeviceNode,
+    ACPI_PNP_DEVICE_ID      **ReturnId)
+{
+    ACPI_OPERAND_OBJECT     *ObjDesc;
+    ACPI_OPERAND_OBJECT     **ClsObjects;
+    UINT32                  Count;
+    ACPI_PNP_DEVICE_ID      *Cls;
+    UINT32                  Length;
+    ACPI_STATUS             Status;
+    UINT8                   ClassCode[3] = {0, 0, 0};
+
+
+    ACPI_FUNCTION_TRACE (UtExecute_CLS);
+
+
+    Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS,
+                ACPI_BTYPE_PACKAGE, &ObjDesc);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Get the size of the String to be returned, includes null terminator */
+
+    Length = ACPI_PCICLS_STRING_SIZE;
+    ClsObjects = ObjDesc->Package.Elements;
+    Count = ObjDesc->Package.Count;
+
+    if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
+    {
+        if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER)
+        {
+            ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value;
+        }
+        if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER)
+        {
+            ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value;
+        }
+        if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER)
+        {
+            ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value;
+        }
+    }
+
+    /* Allocate a buffer for the CLS */
+
+    Cls = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length);
+    if (!Cls)
+    {
+        Status = AE_NO_MEMORY;
+        goto Cleanup;
+    }
+
+    /* Area for the string starts after PNP_DEVICE_ID struct */
+
+    Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID));
+
+    /* Simply copy existing string */
+
+    AcpiExPciClsToString (Cls->String, ClassCode);
+    Cls->Length = Length;
+    *ReturnId = Cls;
+
+
+Cleanup:
+
+    /* On exit, we must delete the return object */
+
+    AcpiUtRemoveReference (ObjDesc);
+    return_ACPI_STATUS (Status);
+}
index 6f701ad..ed090f1 100644 (file)
@@ -296,11 +296,10 @@ AcpiUtInitGlobals (
     AcpiGbl_AcpiHardwarePresent         = TRUE;
     AcpiGbl_LastOwnerIdIndex            = 0;
     AcpiGbl_NextOwnerIdOffset           = 0;
-    AcpiGbl_TraceDbgLevel               = 0;
-    AcpiGbl_TraceDbgLayer               = 0;
     AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
     AcpiGbl_OsiMutex                    = NULL;
     AcpiGbl_RegMethodsExecuted          = FALSE;
+    AcpiGbl_MaxLoopIterations           = 0xFFFF;
 
     /* Hardware oriented */
 
index 32ce271..ecf22db 100644 (file)
@@ -143,10 +143,10 @@ AcpiUtIsPciRootBridge (
      * Check if this is a PCI root bridge.
      * ACPI 3.0+: check for a PCI Express root also.
      */
-    if (!(ACPI_STRCMP (Id,
+    if (!(strcmp (Id,
             PCI_ROOT_HID_STRING)) ||
 
-        !(ACPI_STRCMP (Id,
+        !(strcmp (Id,
             PCI_EXPRESS_ROOT_HID_STRING)))
     {
         return (TRUE);
@@ -156,7 +156,7 @@ AcpiUtIsPciRootBridge (
 }
 
 
-#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP)
+#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtIsAmlTable
@@ -180,7 +180,8 @@ AcpiUtIsAmlTable (
 
     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) ||
         ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) ||
-        ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
+        ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) ||
+        ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_OSDT))
     {
         return (TRUE);
     }
@@ -489,7 +490,7 @@ AcpiUtDisplayInitPathname (
     /* Get the full pathname to the node */
 
     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-    Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+    Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
     if (ACPI_FAILURE (Status))
     {
         return;
index f5b864f..0fa4c36 100644 (file)
@@ -196,6 +196,24 @@ AcpiUtMutexInitialize (
     /* Create the reader/writer lock for namespace access */
 
     Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+#ifdef ACPI_DEBUGGER
+
+    /* Debugger Support */
+
+    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
+#endif
+
     return_ACPI_STATUS (Status);
 }
 
@@ -241,6 +259,12 @@ AcpiUtMutexTerminate (
     /* Delete the reader/writer lock */
 
     AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
+
+#ifdef ACPI_DEBUGGER
+    AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+    AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+#endif
+
     return_VOID;
 }
 
diff --git a/reactos/drivers/bus/acpi/acpica/utilities/utnonansi.c b/reactos/drivers/bus/acpi/acpica/utilities/utnonansi.c
new file mode 100644 (file)
index 0000000..01a4361
--- /dev/null
@@ -0,0 +1,525 @@
+/*******************************************************************************
+ *
+ * Module Name: utnonansi - Non-ansi C library functions
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+        ACPI_MODULE_NAME    ("utnonansi")
+
+
+/*
+ * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
+ * version of strtoul.
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrlwr (strlwr)
+ *
+ * PARAMETERS:  SrcString       - The source string to convert
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert a string to lowercase
+ *
+ ******************************************************************************/
+
+void
+AcpiUtStrlwr (
+    char                    *SrcString)
+{
+    char                    *String;
+
+
+    ACPI_FUNCTION_ENTRY ();
+
+
+    if (!SrcString)
+    {
+        return;
+    }
+
+    /* Walk entire string, lowercasing the letters */
+
+    for (String = SrcString; *String; String++)
+    {
+        *String = (char) tolower ((int) *String);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrupr (strupr)
+ *
+ * PARAMETERS:  SrcString       - The source string to convert
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert a string to uppercase
+ *
+ ******************************************************************************/
+
+void
+AcpiUtStrupr (
+    char                    *SrcString)
+{
+    char                    *String;
+
+
+    ACPI_FUNCTION_ENTRY ();
+
+
+    if (!SrcString)
+    {
+        return;
+    }
+
+    /* Walk entire string, uppercasing the letters */
+
+    for (String = SrcString; *String; String++)
+    {
+        *String = (char) toupper ((int) *String);
+    }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStricmp (stricmp)
+ *
+ * PARAMETERS:  String1             - first string to compare
+ *              String2             - second string to compare
+ *
+ * RETURN:      int that signifies string relationship. Zero means strings
+ *              are equal.
+ *
+ * DESCRIPTION: Case-insensitive string compare. Implementation of the
+ *              non-ANSI stricmp function.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtStricmp (
+    char                    *String1,
+    char                    *String2)
+{
+    int                     c1;
+    int                     c2;
+
+
+    do
+    {
+        c1 = tolower ((int) *String1);
+        c2 = tolower ((int) *String2);
+
+        String1++;
+        String2++;
+    }
+    while ((c1 == c2) && (c1));
+
+    return (c1 - c2);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrtoul64
+ *
+ * PARAMETERS:  String          - Null terminated string
+ *              Base            - Radix of the string: 16 or ACPI_ANY_BASE;
+ *                                ACPI_ANY_BASE means 'in behalf of ToInteger'
+ *              RetInteger      - Where the converted integer is returned
+ *
+ * RETURN:      Status and Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value. Performs either a
+ *              32-bit or 64-bit conversion, depending on the current mode
+ *              of the interpreter.
+ *
+ * NOTE:        Does not support Octal strings, not needed.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+    char                    *String,
+    UINT32                  Base,
+    UINT64                  *RetInteger)
+{
+    UINT32                  ThisDigit = 0;
+    UINT64                  ReturnValue = 0;
+    UINT64                  Quotient;
+    UINT64                  Dividend;
+    UINT32                  ToIntegerOp = (Base == ACPI_ANY_BASE);
+    UINT32                  Mode32 = (AcpiGbl_IntegerByteWidth == 4);
+    UINT8                   ValidDigits = 0;
+    UINT8                   SignOf0x = 0;
+    UINT8                   Term = 0;
+
+
+    ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
+
+
+    switch (Base)
+    {
+    case ACPI_ANY_BASE:
+    case 16:
+
+        break;
+
+    default:
+
+        /* Invalid Base */
+
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    if (!String)
+    {
+        goto ErrorExit;
+    }
+
+    /* Skip over any white space in the buffer */
+
+    while ((*String) && (isspace ((int) *String) || *String == '\t'))
+    {
+        String++;
+    }
+
+    if (ToIntegerOp)
+    {
+        /*
+         * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+         * We need to determine if it is decimal or hexadecimal.
+         */
+        if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
+        {
+            SignOf0x = 1;
+            Base = 16;
+
+            /* Skip over the leading '0x' */
+            String += 2;
+        }
+        else
+        {
+            Base = 10;
+        }
+    }
+
+    /* Any string left? Check that '0x' is not followed by white space. */
+
+    if (!(*String) || isspace ((int) *String) || *String == '\t')
+    {
+        if (ToIntegerOp)
+        {
+            goto ErrorExit;
+        }
+        else
+        {
+            goto AllDone;
+        }
+    }
+
+    /*
+     * Perform a 32-bit or 64-bit conversion, depending upon the current
+     * execution mode of the interpreter
+     */
+    Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+
+    /* Main loop: convert the string to a 32- or 64-bit integer */
+
+    while (*String)
+    {
+        if (isdigit ((int) *String))
+        {
+            /* Convert ASCII 0-9 to Decimal value */
+
+            ThisDigit = ((UINT8) *String) - '0';
+        }
+        else if (Base == 10)
+        {
+            /* Digit is out of range; possible in ToInteger case only */
+
+            Term = 1;
+        }
+        else
+        {
+            ThisDigit = (UINT8) toupper ((int) *String);
+            if (isxdigit ((int) ThisDigit))
+            {
+                /* Convert ASCII Hex char to value */
+
+                ThisDigit = ThisDigit - 'A' + 10;
+            }
+            else
+            {
+                Term = 1;
+            }
+        }
+
+        if (Term)
+        {
+            if (ToIntegerOp)
+            {
+                goto ErrorExit;
+            }
+            else
+            {
+                break;
+            }
+        }
+        else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
+        {
+            /* Skip zeros */
+            String++;
+            continue;
+        }
+
+        ValidDigits++;
+
+        if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
+        {
+            /*
+             * This is ToInteger operation case.
+             * No any restrictions for string-to-integer conversion,
+             * see ACPI spec.
+             */
+            goto ErrorExit;
+        }
+
+        /* Divide the digit into the correct position */
+
+        (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit),
+                    Base, &Quotient, NULL);
+
+        if (ReturnValue > Quotient)
+        {
+            if (ToIntegerOp)
+            {
+                goto ErrorExit;
+            }
+            else
+            {
+                break;
+            }
+        }
+
+        ReturnValue *= Base;
+        ReturnValue += ThisDigit;
+        String++;
+    }
+
+    /* All done, normal exit */
+
+AllDone:
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+        ACPI_FORMAT_UINT64 (ReturnValue)));
+
+    *RetInteger = ReturnValue;
+    return_ACPI_STATUS (AE_OK);
+
+
+ErrorExit:
+    /* Base was set/validated above */
+
+    if (Base == 10)
+    {
+        return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
+    }
+    else
+    {
+        return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
+    }
+}
+
+
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
+ *
+ * PARAMETERS:  Adds a "DestSize" parameter to each of the standard string
+ *              functions. This is the size of the Destination buffer.
+ *
+ * RETURN:      TRUE if the operation would overflow the destination buffer.
+ *
+ * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
+ *              the result of the operation will not overflow the output string
+ *              buffer.
+ *
+ * NOTE:        These functions are typically only helpful for processing
+ *              user input and command lines. For most ACPICA code, the
+ *              required buffer length is precisely calculated before buffer
+ *              allocation, so the use of these functions is unnecessary.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtSafeStrcpy (
+    char                    *Dest,
+    ACPI_SIZE               DestSize,
+    char                    *Source)
+{
+
+    if (strlen (Source) >= DestSize)
+    {
+        return (TRUE);
+    }
+
+    strcpy (Dest, Source);
+    return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrcat (
+    char                    *Dest,
+    ACPI_SIZE               DestSize,
+    char                    *Source)
+{
+
+    if ((strlen (Dest) + strlen (Source)) >= DestSize)
+    {
+        return (TRUE);
+    }
+
+    strcat (Dest, Source);
+    return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrncat (
+    char                    *Dest,
+    ACPI_SIZE               DestSize,
+    char                    *Source,
+    ACPI_SIZE               MaxTransferLength)
+{
+    ACPI_SIZE               ActualTransferLength;
+
+
+    ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source));
+
+    if ((strlen (Dest) + ActualTransferLength) >= DestSize)
+    {
+        return (TRUE);
+    }
+
+    strncat (Dest, Source, MaxTransferLength);
+    return (FALSE);
+}
+#endif
index d88fe8f..b4d8a71 100644 (file)
@@ -328,7 +328,7 @@ AcpiUtInstallInterface (
         return (AE_NO_MEMORY);
     }
 
-    InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1);
+    InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1);
     if (!InterfaceInfo->Name)
     {
         ACPI_FREE (InterfaceInfo);
@@ -337,7 +337,7 @@ AcpiUtInstallInterface (
 
     /* Initialize new info and insert at the head of the global list */
 
-    ACPI_STRCPY (InterfaceInfo->Name, InterfaceName);
+    strcpy (InterfaceInfo->Name, InterfaceName);
     InterfaceInfo->Flags = ACPI_OSI_DYNAMIC;
     InterfaceInfo->Next = AcpiGbl_SupportedInterfaces;
 
@@ -370,7 +370,7 @@ AcpiUtRemoveInterface (
     PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces;
     while (NextInterface)
     {
-        if (!ACPI_STRCMP (InterfaceName, NextInterface->Name))
+        if (!strcmp (InterfaceName, NextInterface->Name))
         {
             /* Found: name is in either the static list or was added at runtime */
 
@@ -491,7 +491,7 @@ AcpiUtGetInterface (
     NextInterface = AcpiGbl_SupportedInterfaces;
     while (NextInterface)
     {
-        if (!ACPI_STRCMP (InterfaceName, NextInterface->Name))
+        if (!strcmp (InterfaceName, NextInterface->Name))
         {
             return (NextInterface);
         }
index 19561be..11471c7 100644 (file)
@@ -238,7 +238,7 @@ AcpiUtGetExpectedReturnTypes (
 
     if (!ExpectedBtypes)
     {
-        ACPI_STRCPY (Buffer, "NONE");
+        strcpy (Buffer, "NONE");
         return;
     }
 
@@ -252,7 +252,7 @@ AcpiUtGetExpectedReturnTypes (
 
         if (ExpectedBtypes & ThisRtype)
         {
-            ACPI_STRCAT (Buffer, &UtRtypeNames[i][j]);
+            strcat (Buffer, &UtRtypeNames[i][j]);
             j = 0;              /* Use name separator from now on */
         }
 
index 13bf94a..b3e8fd2 100644 (file)
@@ -299,7 +299,7 @@ AcpiUtScanNumber (
     UINT64                  Number = 0;
 
 
-    while (ACPI_IS_DIGIT (*String))
+    while (isdigit ((int) *String))
     {
         Number *= 10;
         Number += *(String++) - '0';
@@ -577,7 +577,7 @@ AcpiUtVsnprintf (
         /* Process width */
 
         Width = -1;
-        if (ACPI_IS_DIGIT (*Format))
+        if (isdigit ((int) *Format))
         {
             Format = AcpiUtScanNumber (Format, &Number);
             Width = (INT32) Number;
@@ -599,7 +599,7 @@ AcpiUtVsnprintf (
         if (*Format == '.')
         {
             ++Format;
-            if (ACPI_IS_DIGIT(*Format))
+            if (isdigit ((int) *Format))
             {
                 Format = AcpiUtScanNumber (Format, &Number);
                 Precision = (INT32) Number;
index 953f304..3660cbb 100644 (file)
         ACPI_MODULE_NAME    ("utstring")
 
 
-/*
- * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
- * version of strtoul.
- */
-
-#ifdef ACPI_ASL_COMPILER
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrlwr (strlwr)
- *
- * PARAMETERS:  SrcString       - The source string to convert
- *
- * RETURN:      None
- *
- * DESCRIPTION: Convert string to lowercase
- *
- * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
- *
- ******************************************************************************/
-
-void
-AcpiUtStrlwr (
-    char                    *SrcString)
-{
-    char                    *String;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    if (!SrcString)
-    {
-        return;
-    }
-
-    /* Walk entire string, lowercasing the letters */
-
-    for (String = SrcString; *String; String++)
-    {
-        *String = (char) ACPI_TOLOWER (*String);
-    }
-
-    return;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    AcpiUtStricmp (stricmp)
- *
- * PARAMETERS:  String1             - first string to compare
- *              String2             - second string to compare
- *
- * RETURN:      int that signifies string relationship. Zero means strings
- *              are equal.
- *
- * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
- *              strings with no case sensitivity)
- *
- ******************************************************************************/
-
-int
-AcpiUtStricmp (
-    char                    *String1,
-    char                    *String2)
-{
-    int                     c1;
-    int                     c2;
-
-
-    do
-    {
-        c1 = tolower ((int) *String1);
-        c2 = tolower ((int) *String2);
-
-        String1++;
-        String2++;
-    }
-    while ((c1 == c2) && (c1));
-
-    return (c1 - c2);
-}
-#endif
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrupr (strupr)
- *
- * PARAMETERS:  SrcString       - The source string to convert
- *
- * RETURN:      None
- *
- * DESCRIPTION: Convert string to uppercase
- *
- * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
- *
- ******************************************************************************/
-
-void
-AcpiUtStrupr (
-    char                    *SrcString)
-{
-    char                    *String;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    if (!SrcString)
-    {
-        return;
-    }
-
-    /* Walk entire string, uppercasing the letters */
-
-    for (String = SrcString; *String; String++)
-    {
-        *String = (char) ACPI_TOUPPER (*String);
-    }
-
-    return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrtoul64
- *
- * PARAMETERS:  String          - Null terminated string
- *              Base            - Radix of the string: 16 or ACPI_ANY_BASE;
- *                                ACPI_ANY_BASE means 'in behalf of ToInteger'
- *              RetInteger      - Where the converted integer is returned
- *
- * RETURN:      Status and Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- *              32-bit or 64-bit conversion, depending on the current mode
- *              of the interpreter.
- *              NOTE: Does not support Octal strings, not needed.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtStrtoul64 (
-    char                    *String,
-    UINT32                  Base,
-    UINT64                  *RetInteger)
-{
-    UINT32                  ThisDigit = 0;
-    UINT64                  ReturnValue = 0;
-    UINT64                  Quotient;
-    UINT64                  Dividend;
-    UINT32                  ToIntegerOp = (Base == ACPI_ANY_BASE);
-    UINT32                  Mode32 = (AcpiGbl_IntegerByteWidth == 4);
-    UINT8                   ValidDigits = 0;
-    UINT8                   SignOf0x = 0;
-    UINT8                   Term = 0;
-
-
-    ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
-
-
-    switch (Base)
-    {
-    case ACPI_ANY_BASE:
-    case 16:
-
-        break;
-
-    default:
-
-        /* Invalid Base */
-
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    if (!String)
-    {
-        goto ErrorExit;
-    }
-
-    /* Skip over any white space in the buffer */
-
-    while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t'))
-    {
-        String++;
-    }
-
-    if (ToIntegerOp)
-    {
-        /*
-         * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
-         * We need to determine if it is decimal or hexadecimal.
-         */
-        if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x'))
-        {
-            SignOf0x = 1;
-            Base = 16;
-
-            /* Skip over the leading '0x' */
-            String += 2;
-        }
-        else
-        {
-            Base = 10;
-        }
-    }
-
-    /* Any string left? Check that '0x' is not followed by white space. */
-
-    if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t')
-    {
-        if (ToIntegerOp)
-        {
-            goto ErrorExit;
-        }
-        else
-        {
-            goto AllDone;
-        }
-    }
-
-    /*
-     * Perform a 32-bit or 64-bit conversion, depending upon the current
-     * execution mode of the interpreter
-     */
-    Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
-
-    /* Main loop: convert the string to a 32- or 64-bit integer */
-
-    while (*String)
-    {
-        if (ACPI_IS_DIGIT (*String))
-        {
-            /* Convert ASCII 0-9 to Decimal value */
-
-            ThisDigit = ((UINT8) *String) - '0';
-        }
-        else if (Base == 10)
-        {
-            /* Digit is out of range; possible in ToInteger case only */
-
-            Term = 1;
-        }
-        else
-        {
-            ThisDigit = (UINT8) ACPI_TOUPPER (*String);
-            if (ACPI_IS_XDIGIT ((char) ThisDigit))
-            {
-                /* Convert ASCII Hex char to value */
-
-                ThisDigit = ThisDigit - 'A' + 10;
-            }
-            else
-            {
-                Term = 1;
-            }
-        }
-
-        if (Term)
-        {
-            if (ToIntegerOp)
-            {
-                goto ErrorExit;
-            }
-            else
-            {
-                break;
-            }
-        }
-        else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
-        {
-            /* Skip zeros */
-            String++;
-            continue;
-        }
-
-        ValidDigits++;
-
-        if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
-        {
-            /*
-             * This is ToInteger operation case.
-             * No any restrictions for string-to-integer conversion,
-             * see ACPI spec.
-             */
-            goto ErrorExit;
-        }
-
-        /* Divide the digit into the correct position */
-
-        (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit),
-                    Base, &Quotient, NULL);
-
-        if (ReturnValue > Quotient)
-        {
-            if (ToIntegerOp)
-            {
-                goto ErrorExit;
-            }
-            else
-            {
-                break;
-            }
-        }
-
-        ReturnValue *= Base;
-        ReturnValue += ThisDigit;
-        String++;
-    }
-
-    /* All done, normal exit */
-
-AllDone:
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
-        ACPI_FORMAT_UINT64 (ReturnValue)));
-
-    *RetInteger = ReturnValue;
-    return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
-    /* Base was set/validated above */
-
-    if (Base == 10)
-    {
-        return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
-    }
-    else
-    {
-        return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
-    }
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtPrintString
@@ -541,7 +204,7 @@ AcpiUtPrintString (
 
             /* Check for printable character or hex escape */
 
-            if (ACPI_IS_PRINT (String[i]))
+            if (isprint ((int) String[i]))
             {
                 /* This is a normal character */
 
@@ -754,78 +417,3 @@ UtConvertBackslashes (
     }
 }
 #endif
-
-#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
- *
- * PARAMETERS:  Adds a "DestSize" parameter to each of the standard string
- *              functions. This is the size of the Destination buffer.
- *
- * RETURN:      TRUE if the operation would overflow the destination buffer.
- *
- * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
- *              the result of the operation will not overflow the output string
- *              buffer.
- *
- * NOTE:        These functions are typically only helpful for processing
- *              user input and command lines. For most ACPICA code, the
- *              required buffer length is precisely calculated before buffer
- *              allocation, so the use of these functions is unnecessary.
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiUtSafeStrcpy (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source)
-{
-
-    if (ACPI_STRLEN (Source) >= DestSize)
-    {
-        return (TRUE);
-    }
-
-    ACPI_STRCPY (Dest, Source);
-    return (FALSE);
-}
-
-BOOLEAN
-AcpiUtSafeStrcat (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source)
-{
-
-    if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize)
-    {
-        return (TRUE);
-    }
-
-    ACPI_STRCAT (Dest, Source);
-    return (FALSE);
-}
-
-BOOLEAN
-AcpiUtSafeStrncat (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source,
-    ACPI_SIZE               MaxTransferLength)
-{
-    ACPI_SIZE               ActualTransferLength;
-
-
-    ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source));
-
-    if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize)
-    {
-        return (TRUE);
-    }
-
-    ACPI_STRNCAT (Dest, Source, MaxTransferLength);
-    return (FALSE);
-}
-#endif
index 284bee0..f7f0bce 100644 (file)
@@ -185,7 +185,7 @@ AcpiUtCreateList (
         return (AE_NO_MEMORY);
     }
 
-    ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
+    memset (Cache, 0, sizeof (ACPI_MEMORY_LIST));
 
     Cache->ListName   = ListName;
     Cache->ObjectSize = ObjectSize;
@@ -517,7 +517,7 @@ AcpiUtTrackAllocation (
     Allocation->Component = Component;
     Allocation->Line      = Line;
 
-    ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
+    strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
     Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
 
     if (!Element)
@@ -628,7 +628,7 @@ AcpiUtRemoveAllocation (
 
     /* Mark the segment as deleted */
 
-    ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
+    memset (&Allocation->UserSpace, 0xEA, Allocation->Size);
 
     Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
     return (Status);
@@ -739,7 +739,7 @@ AcpiUtDumpAllocations (
     while (Element)
     {
         if ((Element->Component & Component) &&
-            ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
+            ((Module == NULL) || (0 == strcmp (Module, Element->Module))))
         {
             Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
 
index e01c4d5..a34970e 100644 (file)
@@ -171,14 +171,6 @@ AcpiTerminate (
 
     AcpiUtMutexTerminate ();
 
-
-#ifdef ACPI_DEBUGGER
-
-    /* Shut down the debugger */
-
-    AcpiDbTerminate ();
-#endif
-
     /* Now we can shutdown the OS-dependent layer */
 
     Status = AcpiOsTerminate ();
@@ -335,7 +327,7 @@ AcpiGetStatistics (
     Stats->SciCount = AcpiSciCount;
     Stats->GpeCount = AcpiGpeCount;
 
-    ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount,
+    memcpy (Stats->FixedEventCount, AcpiFixedEventCount,
         sizeof (AcpiFixedEventCount));
 
 
@@ -439,7 +431,7 @@ AcpiInstallInterface (
 
     /* Parameter validation */
 
-    if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
+    if (!InterfaceName || (strlen (InterfaceName) == 0))
     {
         return (AE_BAD_PARAMETER);
     }
@@ -504,7 +496,7 @@ AcpiRemoveInterface (
 
     /* Parameter validation */
 
-    if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
+    if (!InterfaceName || (strlen (InterfaceName) == 0))
     {
         return (AE_BAD_PARAMETER);
     }
@@ -676,7 +668,7 @@ AcpiDecodePldBuffer (
 
     /* Parameter validation */
 
-    if (!InBuffer || !ReturnBuffer || (Length < 16))
+    if (!InBuffer || !ReturnBuffer || (Length < ACPI_PLD_REV1_BUFFER_SIZE))
     {
         return (AE_BAD_PARAMETER);
     }
@@ -728,7 +720,7 @@ AcpiDecodePldBuffer (
     PldInfo->Rotation =             ACPI_PLD_GET_ROTATION (&Dword);
     PldInfo->Order =                ACPI_PLD_GET_ORDER (&Dword);
 
-    if (Length >= ACPI_PLD_BUFFER_SIZE)
+    if (Length >= ACPI_PLD_REV2_BUFFER_SIZE)
     {
         /* Fifth 32-bit DWord (Revision 2 of _PLD) */
 
index bdbab99..b62e5df 100644 (file)
@@ -195,8 +195,18 @@ AcpiException (
 
 
     ACPI_MSG_REDIRECT_BEGIN;
-    AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
 
+    /* For AE_OK, just print the message */
+
+    if (ACPI_SUCCESS (Status))
+    {
+        AcpiOsPrintf (ACPI_MSG_EXCEPTION);
+
+    }
+    else
+    {
+        AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
+    }
     va_start (ArgList, Format);
     AcpiOsVprintf (Format, ArgList);
     ACPI_MSG_SUFFIX;
index 91feda7..4703dc1 100644 (file)
@@ -204,17 +204,6 @@ AcpiInitializeSubsystem (
         return_ACPI_STATUS (Status);
     }
 
-    /* If configured, initialize the AML debugger */
-
-#ifdef ACPI_DEBUGGER
-    Status = AcpiDbInitialize ();
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_EXCEPTION ((AE_INFO, Status, "During Debugger initialization"));
-        return_ACPI_STATUS (Status);
-    }
-#endif
-
     return_ACPI_STATUS (AE_OK);
 }
 
@@ -266,11 +255,14 @@ AcpiEnableSubsystem (
      * Obtain a permanent mapping for the FACS. This is required for the
      * Global Lock and the Firmware Waking Vector
      */
-    Status = AcpiTbInitializeFacs ();
-    if (ACPI_FAILURE (Status))
+    if (!(Flags & ACPI_NO_FACS_INIT))
     {
-        ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
-        return_ACPI_STATUS (Status);
+        Status = AcpiTbInitializeFacs ();
+        if (ACPI_FAILURE (Status))
+        {
+            ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
+            return_ACPI_STATUS (Status);
+        }
     }
 
 #endif /* !ACPI_REDUCED_HARDWARE */
index 859f4d1..c5a952c 100644 (file)
@@ -394,7 +394,7 @@ acpi_suspend (
        _enable();
 
        /* reset firmware waking vector */
-       AcpiSetFirmwareWakingVector((ACPI_PHYSICAL_ADDRESS) 0);
+       AcpiSetFirmwareWakingVector(0, 0);
 
        return status;
 }