[ACPICA]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 12 Apr 2016 15:44:33 +0000 (15:44 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 12 Apr 2016 15:44:33 +0000 (15:44 +0000)
- Update to version 20160318
CORE-11114 #resolve

svn path=/trunk/; revision=71151

67 files changed:
reactos/drivers/bus/acpi/CMakeLists.txt
reactos/drivers/bus/acpi/acpica/dispatcher/dsmethod.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsobject.c
reactos/drivers/bus/acpi/acpica/events/evgpeblk.c
reactos/drivers/bus/acpi/acpica/events/evgpeinit.c
reactos/drivers/bus/acpi/acpica/events/evregion.c
reactos/drivers/bus/acpi/acpica/events/evrgnini.c
reactos/drivers/bus/acpi/acpica/executer/exconcat.c [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/executer/exconfig.c
reactos/drivers/bus/acpi/acpica/executer/exconvrt.c
reactos/drivers/bus/acpi/acpica/executer/exdump.c
reactos/drivers/bus/acpi/acpica/executer/exmisc.c
reactos/drivers/bus/acpi/acpica/executer/exoparg3.c
reactos/drivers/bus/acpi/acpica/executer/exsystem.c
reactos/drivers/bus/acpi/acpica/executer/exutils.c
reactos/drivers/bus/acpi/acpica/hardware/hwregs.c
reactos/drivers/bus/acpi/acpica/hardware/hwxface.c
reactos/drivers/bus/acpi/acpica/hardware/hwxfsleep.c
reactos/drivers/bus/acpi/acpica/include/acdebug.h
reactos/drivers/bus/acpi/acpica/include/acdisasm.h
reactos/drivers/bus/acpi/acpica/include/acevents.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/acnamesp.h
reactos/drivers/bus/acpi/acpica/include/acoutput.h
reactos/drivers/bus/acpi/acpica/include/acparser.h
reactos/drivers/bus/acpi/acpica/include/acpixf.h
reactos/drivers/bus/acpi/acpica/include/acpredef.h
reactos/drivers/bus/acpi/acpica/include/acresrc.h
reactos/drivers/bus/acpi/acpica/include/acstruct.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/platform/acenv.h
reactos/drivers/bus/acpi/acpica/include/platform/acqnx.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/nsprepkg.c
reactos/drivers/bus/acpi/acpica/parser/psargs.c
reactos/drivers/bus/acpi/acpica/parser/psopinfo.c
reactos/drivers/bus/acpi/acpica/resources/rsdump.c
reactos/drivers/bus/acpi/acpica/resources/rsutils.c
reactos/drivers/bus/acpi/acpica/tables/tbfadt.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/tbxfload.c
reactos/drivers/bus/acpi/acpica/utilities/utcache.c
reactos/drivers/bus/acpi/acpica/utilities/utdebug.c
reactos/drivers/bus/acpi/acpica/utilities/utdecode.c
reactos/drivers/bus/acpi/acpica/utilities/uteval.c
reactos/drivers/bus/acpi/acpica/utilities/utglobal.c
reactos/drivers/bus/acpi/acpica/utilities/utmisc.c
reactos/drivers/bus/acpi/acpica/utilities/utnonansi.c
reactos/drivers/bus/acpi/acpica/utilities/utprint.c
reactos/drivers/bus/acpi/acpica/utilities/uttrack.c
reactos/drivers/bus/acpi/acpica/utilities/utxferror.c
reactos/drivers/bus/acpi/acpica/utilities/utxfinit.c

index 2a78232..36628b7 100644 (file)
@@ -38,6 +38,7 @@ list(APPEND ACPICA_SOURCE
     acpica/events/evxfevnt.c
     acpica/events/evxfgpe.c
     acpica/events/evxfregn.c
+    acpica/executer/exconcat.c
     acpica/executer/exconfig.c
     acpica/executer/exconvrt.c
     acpica/executer/excreate.c
index 356739a..25d278c 100644 (file)
@@ -867,7 +867,7 @@ AcpiDsTerminateControlMethod (
         {
             if (WalkState)
             {
-                ACPI_INFO ((AE_INFO,
+                ACPI_INFO ((
                     "Marking method %4.4s as Serialized "
                     "because of AE_ALREADY_EXISTS error",
                     WalkState->MethodNode->Name.Ascii));
index 452c66b..3f7b540 100644 (file)
@@ -538,7 +538,7 @@ AcpiDsBuildInternalPackageObj (
             Arg = Arg->Common.Next;
         }
 
-        ACPI_INFO ((AE_INFO,
+        ACPI_INFO ((
             "Actual Package length (%u) is larger than "
             "NumElements field (%u), truncated",
             i, ElementCount));
index 21f0692..2e1d354 100644 (file)
@@ -542,7 +542,7 @@ AcpiEvInitializeGpeBlock (
 
     if (GpeEnabledCount)
     {
-        ACPI_INFO ((AE_INFO,
+        ACPI_INFO ((
             "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount,
             (UINT32) GpeBlock->BlockBaseNumber,
             (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1))));
index b62f91a..8e2fd34 100644 (file)
@@ -292,7 +292,7 @@ AcpiEvUpdateGpes (
 
     if (WalkInfo.Count)
     {
-        ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count));
+        ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count));
     }
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
index db4080a..673d44d 100644 (file)
@@ -99,7 +99,6 @@ AcpiEvInitializeOpRegions (
 
     /* Run the _REG methods for OpRegions in each default address space */
 
-    AcpiGbl_RegMethodsEnabled = TRUE;
     for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
     {
         /*
@@ -550,58 +549,6 @@ AcpiEvAttachRegion (
 }
 
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiEvAssociateRegMethod
- *
- * PARAMETERS:  RegionObj           - Region object
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Find and associate _REG method to a region
- *
- ******************************************************************************/
-
-void
-AcpiEvAssociateRegMethod (
-    ACPI_OPERAND_OBJECT     *RegionObj)
-{
-    ACPI_NAME               *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG;
-    ACPI_NAMESPACE_NODE     *MethodNode;
-    ACPI_NAMESPACE_NODE     *Node;
-    ACPI_OPERAND_OBJECT     *RegionObj2;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (EvAssociateRegMethod);
-
-
-    RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
-    if (!RegionObj2)
-    {
-        return_VOID;
-    }
-
-    Node = RegionObj->Region.Node->Parent;
-
-    /* Find any "_REG" method associated with this region definition */
-
-    Status = AcpiNsSearchOneScope (
-        *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
-    if (ACPI_SUCCESS (Status))
-    {
-        /*
-         * The _REG method is optional and there can be only one per region
-         * definition. This will be executed when the handler is attached
-         * or removed
-         */
-        RegionObj2->Extra.Method_REG = MethodNode;
-    }
-
-    return_VOID;
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiEvExecuteRegMethod
@@ -623,21 +570,45 @@ AcpiEvExecuteRegMethod (
     ACPI_EVALUATE_INFO      *Info;
     ACPI_OPERAND_OBJECT     *Args[3];
     ACPI_OPERAND_OBJECT     *RegionObj2;
+    const ACPI_NAME         *RegNamePtr = ACPI_CAST_PTR (ACPI_NAME, METHOD_NAME__REG);
+    ACPI_NAMESPACE_NODE     *MethodNode;
+    ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
 
 
+    if (!AcpiGbl_NamespaceInitialized ||
+        RegionObj->Region.Handler == NULL)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
+
     RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
     if (!RegionObj2)
     {
         return_ACPI_STATUS (AE_NOT_EXIST);
     }
 
-    if (RegionObj2->Extra.Method_REG == NULL ||
-        RegionObj->Region.Handler == NULL ||
-        !AcpiGbl_RegMethodsEnabled)
+    /*
+     * Find any "_REG" method associated with this region definition.
+     * The method should always be updated as this function may be
+     * invoked after a namespace change.
+     */
+    Node = RegionObj->Region.Node->Parent;
+    Status = AcpiNsSearchOneScope (
+        *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
+    if (ACPI_SUCCESS (Status))
+    {
+        /*
+         * The _REG method is optional and there can be only one per
+         * region definition. This will be executed when the handler is
+         * attached or removed.
+         */
+        RegionObj2->Extra.Method_REG = MethodNode;
+    }
+    if (RegionObj2->Extra.Method_REG == NULL)
     {
         return_ACPI_STATUS (AE_OK);
     }
index 5bb177a..a9e6be0 100644 (file)
@@ -582,7 +582,6 @@ AcpiEvInitializeRegion (
         return_ACPI_STATUS (AE_OK);
     }
 
-    AcpiEvAssociateRegMethod (RegionObj);
     RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
 
     Node = RegionObj->Region.Node->Parent;
diff --git a/reactos/drivers/bus/acpi/acpica/executer/exconcat.c b/reactos/drivers/bus/acpi/acpica/executer/exconcat.c
new file mode 100644 (file)
index 0000000..49b279a
--- /dev/null
@@ -0,0 +1,460 @@
+/******************************************************************************
+ *
+ * Module Name: exconcat - Concatenate-type AML operators
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlresrc.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+        ACPI_MODULE_NAME    ("exconcat")
+
+/* Local Prototypes */
+
+static ACPI_STATUS
+AcpiExConvertToObjectTypeString (
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_OPERAND_OBJECT     **ResultDesc);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExDoConcatenate
+ *
+ * PARAMETERS:  Operand0            - First source object
+ *              Operand1            - Second source object
+ *              ActualReturnDesc    - Where to place the return object
+ *              WalkState           - Current walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion
+ *              rules as necessary.
+ * NOTE:
+ * Per the ACPI spec (up to 6.1), Concatenate only supports Integer,
+ * String, and Buffer objects. However, we support all objects here
+ * as an extension. This improves the usefulness of both Concatenate
+ * and the Printf/Fprintf macros. The extension returns a string
+ * describing the object type for the other objects.
+ * 02/2016.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDoConcatenate (
+    ACPI_OPERAND_OBJECT     *Operand0,
+    ACPI_OPERAND_OBJECT     *Operand1,
+    ACPI_OPERAND_OBJECT     **ActualReturnDesc,
+    ACPI_WALK_STATE         *WalkState)
+{
+    ACPI_OPERAND_OBJECT     *LocalOperand0 = Operand0;
+    ACPI_OPERAND_OBJECT     *LocalOperand1 = Operand1;
+    ACPI_OPERAND_OBJECT     *TempOperand1 = NULL;
+    ACPI_OPERAND_OBJECT     *ReturnDesc;
+    char                    *Buffer;
+    ACPI_OBJECT_TYPE        Operand0Type;
+    ACPI_OBJECT_TYPE        Operand1Type;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (ExDoConcatenate);
+
+
+    /* Operand 0 preprocessing */
+
+    switch (Operand0->Common.Type)
+    {
+    case ACPI_TYPE_INTEGER:
+    case ACPI_TYPE_STRING:
+    case ACPI_TYPE_BUFFER:
+
+        Operand0Type = Operand0->Common.Type;
+        break;
+
+    default:
+
+        /* For all other types, get the "object type" string */
+
+        Status = AcpiExConvertToObjectTypeString (
+            Operand0, &LocalOperand0);
+        if (ACPI_FAILURE (Status))
+        {
+            goto Cleanup;
+        }
+
+        Operand0Type = ACPI_TYPE_STRING;
+        break;
+    }
+
+    /* Operand 1 preprocessing */
+
+    switch (Operand1->Common.Type)
+    {
+    case ACPI_TYPE_INTEGER:
+    case ACPI_TYPE_STRING:
+    case ACPI_TYPE_BUFFER:
+
+        Operand1Type = Operand1->Common.Type;
+        break;
+
+    default:
+
+        /* For all other types, get the "object type" string */
+
+        Status = AcpiExConvertToObjectTypeString (
+            Operand1, &LocalOperand1);
+        if (ACPI_FAILURE (Status))
+        {
+            goto Cleanup;
+        }
+
+        Operand1Type = ACPI_TYPE_STRING;
+        break;
+    }
+
+    /*
+     * Convert the second operand if necessary. The first operand (0)
+     * determines the type of the second operand (1) (See the Data Types
+     * section of the ACPI specification). Both object types are
+     * guaranteed to be either Integer/String/Buffer by the operand
+     * resolution mechanism.
+     */
+    switch (Operand0Type)
+    {
+    case ACPI_TYPE_INTEGER:
+
+        Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, 16);
+        break;
+
+    case ACPI_TYPE_BUFFER:
+
+        Status = AcpiExConvertToBuffer (LocalOperand1, &TempOperand1);
+        break;
+
+    case ACPI_TYPE_STRING:
+
+        switch (Operand1Type)
+        {
+        case ACPI_TYPE_INTEGER:
+        case ACPI_TYPE_STRING:
+        case ACPI_TYPE_BUFFER:
+
+            /* Other types have already been converted to string */
+
+            Status = AcpiExConvertToString (
+                LocalOperand1, &TempOperand1, ACPI_IMPLICIT_CONVERT_HEX);
+            break;
+
+        default:
+
+            Status = AE_OK;
+            break;
+        }
+        break;
+
+    default:
+
+        ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
+            Operand0->Common.Type));
+        Status = AE_AML_INTERNAL;
+    }
+
+    if (ACPI_FAILURE (Status))
+    {
+        goto Cleanup;
+    }
+
+    /* Take care with any newly created operand objects */
+
+    if ((LocalOperand1 != Operand1) &&
+        (LocalOperand1 != TempOperand1))
+    {
+        AcpiUtRemoveReference (LocalOperand1);
+    }
+
+    LocalOperand1 = TempOperand1;
+
+    /*
+     * Both operands are now known to be the same object type
+     * (Both are Integer, String, or Buffer), and we can now perform
+     * the concatenation.
+     *
+     * There are three cases to handle, as per the ACPI spec:
+     *
+     * 1) Two Integers concatenated to produce a new Buffer
+     * 2) Two Strings concatenated to produce a new String
+     * 3) Two Buffers concatenated to produce a new Buffer
+     */
+    switch (Operand0Type)
+    {
+    case ACPI_TYPE_INTEGER:
+
+        /* Result of two Integers is a Buffer */
+        /* Need enough buffer space for two integers */
+
+        ReturnDesc = AcpiUtCreateBufferObject (
+            (ACPI_SIZE) ACPI_MUL_2 (AcpiGbl_IntegerByteWidth));
+        if (!ReturnDesc)
+        {
+            Status = AE_NO_MEMORY;
+            goto Cleanup;
+        }
+
+        Buffer = (char *) ReturnDesc->Buffer.Pointer;
+
+        /* Copy the first integer, LSB first */
+
+        memcpy (Buffer, &Operand0->Integer.Value,
+            AcpiGbl_IntegerByteWidth);
+
+        /* Copy the second integer (LSB first) after the first */
+
+        memcpy (Buffer + AcpiGbl_IntegerByteWidth,
+            &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth);
+        break;
+
+    case ACPI_TYPE_STRING:
+
+        /* Result of two Strings is a String */
+
+        ReturnDesc = AcpiUtCreateStringObject (
+            ((ACPI_SIZE) LocalOperand0->String.Length +
+            LocalOperand1->String.Length));
+        if (!ReturnDesc)
+        {
+            Status = AE_NO_MEMORY;
+            goto Cleanup;
+        }
+
+        Buffer = ReturnDesc->String.Pointer;
+
+        /* Concatenate the strings */
+
+        strcpy (Buffer, LocalOperand0->String.Pointer);
+        strcat (Buffer, LocalOperand1->String.Pointer);
+        break;
+
+    case ACPI_TYPE_BUFFER:
+
+        /* Result of two Buffers is a Buffer */
+
+        ReturnDesc = AcpiUtCreateBufferObject (
+            ((ACPI_SIZE) Operand0->Buffer.Length +
+            LocalOperand1->Buffer.Length));
+        if (!ReturnDesc)
+        {
+            Status = AE_NO_MEMORY;
+            goto Cleanup;
+        }
+
+        Buffer = (char *) ReturnDesc->Buffer.Pointer;
+
+        /* Concatenate the buffers */
+
+        memcpy (Buffer, Operand0->Buffer.Pointer,
+            Operand0->Buffer.Length);
+        memcpy (Buffer + Operand0->Buffer.Length,
+            LocalOperand1->Buffer.Pointer,
+            LocalOperand1->Buffer.Length);
+        break;
+
+    default:
+
+        /* Invalid object type, should not happen here */
+
+        ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
+            Operand0->Common.Type));
+        Status = AE_AML_INTERNAL;
+        goto Cleanup;
+    }
+
+    *ActualReturnDesc = ReturnDesc;
+
+Cleanup:
+    if (LocalOperand0 != Operand0)
+    {
+        AcpiUtRemoveReference (LocalOperand0);
+    }
+
+    if (LocalOperand1 != Operand1)
+    {
+        AcpiUtRemoveReference (LocalOperand1);
+    }
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExConvertToObjectTypeString
+ *
+ * PARAMETERS:  ObjDesc             - Object to be converted
+ *              ReturnDesc          - Where to place the return object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an object of arbitrary type to a string object that
+ *              contains the namestring for the object. Used for the
+ *              concatenate operator.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiExConvertToObjectTypeString (
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    ACPI_OPERAND_OBJECT     **ResultDesc)
+{
+    ACPI_OPERAND_OBJECT     *ReturnDesc;
+    const char              *TypeString;
+
+
+    TypeString = AcpiUtGetTypeName (ObjDesc->Common.Type);
+
+    ReturnDesc = AcpiUtCreateStringObject (
+        ((ACPI_SIZE) strlen (TypeString) + 9)); /* 9 For "[ Object]" */
+    if (!ReturnDesc)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    strcpy (ReturnDesc->String.Pointer, "[");
+    strcat (ReturnDesc->String.Pointer, TypeString);
+    strcat (ReturnDesc->String.Pointer, " Object]");
+
+    *ResultDesc = ReturnDesc;
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiExConcatTemplate
+ *
+ * PARAMETERS:  Operand0            - First source object
+ *              Operand1            - Second source object
+ *              ActualReturnDesc    - Where to place the return object
+ *              WalkState           - Current walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConcatTemplate (
+    ACPI_OPERAND_OBJECT     *Operand0,
+    ACPI_OPERAND_OBJECT     *Operand1,
+    ACPI_OPERAND_OBJECT     **ActualReturnDesc,
+    ACPI_WALK_STATE         *WalkState)
+{
+    ACPI_STATUS             Status;
+    ACPI_OPERAND_OBJECT     *ReturnDesc;
+    UINT8                   *NewBuf;
+    UINT8                   *EndTag;
+    ACPI_SIZE               Length0;
+    ACPI_SIZE               Length1;
+    ACPI_SIZE               NewLength;
+
+
+    ACPI_FUNCTION_TRACE (ExConcatTemplate);
+
+
+    /*
+     * Find the EndTag descriptor in each resource template.
+     * Note1: returned pointers point TO the EndTag, not past it.
+     * Note2: zero-length buffers are allowed; treated like one EndTag
+     */
+
+    /* Get the length of the first resource template */
+
+    Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
+
+    /* Get the length of the second resource template */
+
+    Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
+
+    /* Combine both lengths, minimum size will be 2 for EndTag */
+
+    NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
+
+    /* Create a new buffer object for the result (with one EndTag) */
+
+    ReturnDesc = AcpiUtCreateBufferObject (NewLength);
+    if (!ReturnDesc)
+    {
+        return_ACPI_STATUS (AE_NO_MEMORY);
+    }
+
+    /*
+     * Copy the templates to the new buffer, 0 first, then 1 follows. One
+     * EndTag descriptor is copied from Operand1.
+     */
+    NewBuf = ReturnDesc->Buffer.Pointer;
+    memcpy (NewBuf, Operand0->Buffer.Pointer, Length0);
+    memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
+
+    /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
+
+    NewBuf[NewLength - 1] = 0;
+    NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
+
+    /* Return the completed resource template */
+
+    *ActualReturnDesc = ReturnDesc;
+    return_ACPI_STATUS (AE_OK);
+}
index 60aea38..bb0d2bb 100644 (file)
@@ -129,7 +129,10 @@ AcpiExAddTable (
     /* Execute any module-level code that was found in the table */
 
     AcpiExExitInterpreter ();
-    AcpiNsExecModuleCodeList ();
+    if (AcpiGbl_GroupModuleLevelCode)
+    {
+        AcpiNsExecModuleCodeList ();
+    }
     AcpiExEnterInterpreter ();
 
     /*
@@ -276,7 +279,7 @@ AcpiExLoadTableOp (
     Status = AcpiGetTableByIndex (TableIndex, &Table);
     if (ACPI_SUCCESS (Status))
     {
-        ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
+        ACPI_INFO (("Dynamic OEM Table Load:"));
         AcpiTbPrintTableHeader (0, Table);
     }
 
@@ -516,7 +519,7 @@ AcpiExLoadOp (
 
     /* Install the new table into the local data structures */
 
-    ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
+    ACPI_INFO (("Dynamic OEM Table Load:"));
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
 
     Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
index 6f756d7..ea6f826 100644 (file)
@@ -137,7 +137,8 @@ AcpiExConvertToInteger (
          * of ACPI 3.0) is that the ToInteger() operator allows both decimal
          * and hexadecimal strings (hex prefixed with "0x").
          */
-        Status = AcpiUtStrtoul64 ((char *) Pointer, Flags, &Result);
+        Status = AcpiUtStrtoul64 ((char *) Pointer, Flags,
+            AcpiGbl_IntegerByteWidth, &Result);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
index 5dae1f4..f5d5fd0 100644 (file)
 
 static void
 AcpiExOutString (
-    char                    *Title,
-    char                    *Value);
+    const char              *Title,
+    const char              *Value);
 
 static void
 AcpiExOutPointer (
-    char                    *Title,
-    void                    *Value);
+    const char              *Title,
+    const void              *Value);
 
 static void
 AcpiExDumpObject (
@@ -380,8 +380,7 @@ AcpiExDumpObject (
     ACPI_EXDUMP_INFO        *Info)
 {
     UINT8                   *Target;
-    char                    *Name;
-    const char              *ReferenceName;
+    const char              *Name;
     UINT8                   Count;
     ACPI_OPERAND_OBJECT     *Start;
     ACPI_OPERAND_OBJECT     *Data = NULL;
@@ -472,9 +471,7 @@ AcpiExDumpObject (
 
         case ACPI_EXD_REFERENCE:
 
-            ReferenceName = AcpiUtGetReferenceName (ObjDesc);
-            AcpiExOutString (
-                "Class Name", ACPI_CAST_PTR (char, ReferenceName));
+            AcpiExOutString ("Class Name", AcpiUtGetReferenceName (ObjDesc));
             AcpiExDumpReferenceObj (ObjDesc);
             break;
 
@@ -971,16 +968,16 @@ AcpiExDumpOperands (
 
 static void
 AcpiExOutString (
-    char                    *Title,
-    char                    *Value)
+    const char              *Title,
+    const char              *Value)
 {
     AcpiOsPrintf ("%20s : %s\n", Title, Value);
 }
 
 static void
 AcpiExOutPointer (
-    char                    *Title,
-    void                    *Value)
+    const char              *Title,
+    const void              *Value)
 {
     AcpiOsPrintf ("%20s : %p\n", Title, Value);
 }
index c1dd227..a8e5497 100644 (file)
@@ -45,7 +45,6 @@
 #include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
-#include "amlresrc.h"
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -148,307 +147,6 @@ AcpiExGetObjectReference (
 }
 
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiExConcatTemplate
- *
- * PARAMETERS:  Operand0            - First source object
- *              Operand1            - Second source object
- *              ActualReturnDesc    - Where to place the return object
- *              WalkState           - Current walk state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Concatenate two resource templates
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExConcatTemplate (
-    ACPI_OPERAND_OBJECT     *Operand0,
-    ACPI_OPERAND_OBJECT     *Operand1,
-    ACPI_OPERAND_OBJECT     **ActualReturnDesc,
-    ACPI_WALK_STATE         *WalkState)
-{
-    ACPI_STATUS             Status;
-    ACPI_OPERAND_OBJECT     *ReturnDesc;
-    UINT8                   *NewBuf;
-    UINT8                   *EndTag;
-    ACPI_SIZE               Length0;
-    ACPI_SIZE               Length1;
-    ACPI_SIZE               NewLength;
-
-
-    ACPI_FUNCTION_TRACE (ExConcatTemplate);
-
-
-    /*
-     * Find the EndTag descriptor in each resource template.
-     * Note1: returned pointers point TO the EndTag, not past it.
-     * Note2: zero-length buffers are allowed; treated like one EndTag
-     */
-
-    /* Get the length of the first resource template */
-
-    Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
-
-    /* Get the length of the second resource template */
-
-    Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
-
-    /* Combine both lengths, minimum size will be 2 for EndTag */
-
-    NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
-
-    /* Create a new buffer object for the result (with one EndTag) */
-
-    ReturnDesc = AcpiUtCreateBufferObject (NewLength);
-    if (!ReturnDesc)
-    {
-        return_ACPI_STATUS (AE_NO_MEMORY);
-    }
-
-    /*
-     * Copy the templates to the new buffer, 0 first, then 1 follows. One
-     * EndTag descriptor is copied from Operand1.
-     */
-    NewBuf = ReturnDesc->Buffer.Pointer;
-    memcpy (NewBuf, Operand0->Buffer.Pointer, Length0);
-    memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
-
-    /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
-
-    NewBuf[NewLength - 1] = 0;
-    NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
-
-    /* Return the completed resource template */
-
-    *ActualReturnDesc = ReturnDesc;
-    return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiExDoConcatenate
- *
- * PARAMETERS:  Operand0            - First source object
- *              Operand1            - Second source object
- *              ActualReturnDesc    - Where to place the return object
- *              WalkState           - Current walk state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExDoConcatenate (
-    ACPI_OPERAND_OBJECT     *Operand0,
-    ACPI_OPERAND_OBJECT     *Operand1,
-    ACPI_OPERAND_OBJECT     **ActualReturnDesc,
-    ACPI_WALK_STATE         *WalkState)
-{
-    ACPI_OPERAND_OBJECT     *LocalOperand1 = Operand1;
-    ACPI_OPERAND_OBJECT     *ReturnDesc;
-    char                    *NewBuf;
-    const char              *TypeString;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (ExDoConcatenate);
-
-
-    /*
-     * Convert the second operand if necessary. The first operand
-     * determines the type of the second operand, (See the Data Types
-     * section of the ACPI specification.)  Both object types are
-     * guaranteed to be either Integer/String/Buffer by the operand
-     * resolution mechanism.
-     */
-    switch (Operand0->Common.Type)
-    {
-    case ACPI_TYPE_INTEGER:
-
-        Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
-        break;
-
-    case ACPI_TYPE_STRING:
-        /*
-         * Per the ACPI spec, Concatenate only supports int/str/buf.
-         * However, we support all objects here as an extension.
-         * This improves the usefulness of the Printf() macro.
-         * 12/2015.
-         */
-        switch (Operand1->Common.Type)
-        {
-        case ACPI_TYPE_INTEGER:
-        case ACPI_TYPE_STRING:
-        case ACPI_TYPE_BUFFER:
-
-            Status = AcpiExConvertToString (
-                Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX);
-            break;
-
-        default:
-            /*
-             * Just emit a string containing the object type.
-             */
-            TypeString = AcpiUtGetTypeName (Operand1->Common.Type);
-
-            LocalOperand1 = AcpiUtCreateStringObject (
-                ((ACPI_SIZE) strlen (TypeString) + 9)); /* 9 For "[Object]" */
-            if (!LocalOperand1)
-            {
-                Status = AE_NO_MEMORY;
-                goto Cleanup;
-            }
-
-            strcpy (LocalOperand1->String.Pointer, "[");
-            strcat (LocalOperand1->String.Pointer, TypeString);
-            strcat (LocalOperand1->String.Pointer, " Object]");
-            Status = AE_OK;
-            break;
-        }
-        break;
-
-    case ACPI_TYPE_BUFFER:
-
-        Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
-        break;
-
-    default:
-
-        ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
-            Operand0->Common.Type));
-        Status = AE_AML_INTERNAL;
-    }
-
-    if (ACPI_FAILURE (Status))
-    {
-        goto Cleanup;
-    }
-
-    /*
-     * Both operands are now known to be the same object type
-     * (Both are Integer, String, or Buffer), and we can now perform the
-     * concatenation.
-     */
-
-    /*
-     * There are three cases to handle:
-     *
-     * 1) Two Integers concatenated to produce a new Buffer
-     * 2) Two Strings concatenated to produce a new String
-     * 3) Two Buffers concatenated to produce a new Buffer
-     */
-    switch (Operand0->Common.Type)
-    {
-    case ACPI_TYPE_INTEGER:
-
-        /* Result of two Integers is a Buffer */
-        /* Need enough buffer space for two integers */
-
-        ReturnDesc = AcpiUtCreateBufferObject (
-            (ACPI_SIZE) ACPI_MUL_2 (AcpiGbl_IntegerByteWidth));
-        if (!ReturnDesc)
-        {
-            Status = AE_NO_MEMORY;
-            goto Cleanup;
-        }
-
-        NewBuf = (char *) ReturnDesc->Buffer.Pointer;
-
-        /* Copy the first integer, LSB first */
-
-        memcpy (NewBuf, &Operand0->Integer.Value,
-            AcpiGbl_IntegerByteWidth);
-
-        /* Copy the second integer (LSB first) after the first */
-
-        memcpy (NewBuf + AcpiGbl_IntegerByteWidth,
-            &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth);
-        break;
-
-    case ACPI_TYPE_STRING:
-
-        /* Result of two Strings is a String */
-
-        ReturnDesc = AcpiUtCreateStringObject (
-            ((ACPI_SIZE) Operand0->String.Length +
-            LocalOperand1->String.Length));
-        if (!ReturnDesc)
-        {
-            Status = AE_NO_MEMORY;
-            goto Cleanup;
-        }
-
-        NewBuf = ReturnDesc->String.Pointer;
-
-        /* Concatenate the strings */
-
-        strcpy (NewBuf, Operand0->String.Pointer);
-        strcat (NewBuf, LocalOperand1->String.Pointer);
-        break;
-
-    case ACPI_TYPE_BUFFER:
-
-        /* Result of two Buffers is a Buffer */
-
-        ReturnDesc = AcpiUtCreateBufferObject (
-            ((ACPI_SIZE) Operand0->Buffer.Length +
-            LocalOperand1->Buffer.Length));
-        if (!ReturnDesc)
-        {
-            Status = AE_NO_MEMORY;
-            goto Cleanup;
-        }
-
-        NewBuf = (char *) ReturnDesc->Buffer.Pointer;
-
-        /* Concatenate the buffers */
-
-        memcpy (NewBuf, Operand0->Buffer.Pointer,
-            Operand0->Buffer.Length);
-        memcpy (NewBuf + Operand0->Buffer.Length,
-            LocalOperand1->Buffer.Pointer,
-            LocalOperand1->Buffer.Length);
-        break;
-
-    default:
-
-        /* Invalid object type, should not happen here */
-
-        ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
-            Operand0->Common.Type));
-        Status =AE_AML_INTERNAL;
-        goto Cleanup;
-    }
-
-    *ActualReturnDesc = ReturnDesc;
-
-Cleanup:
-    if (LocalOperand1 != Operand1)
-    {
-        AcpiUtRemoveReference (LocalOperand1);
-    }
-    return_ACPI_STATUS (Status);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiExDoMathOp
index db9fd11..de46a97 100644 (file)
@@ -134,8 +134,10 @@ AcpiExOpcode_3A_0T_0R (
          * op is intended for use by disassemblers in order to properly
          * disassemble control method invocations. The opcode or group of
          * opcodes should be surrounded by an "if (0)" clause to ensure that
-         * AML interpreters never see the opcode.
+         * AML interpreters never see the opcode. Thus, something is
+         * wrong if an external opcode ever gets here.
          */
+        ACPI_ERROR ((AE_INFO, "Executed External Op"));
         Status = AE_OK;
         goto Cleanup;
 
index 17eff66..a215e80 100644 (file)
@@ -94,7 +94,7 @@ AcpiExSystemWaitSemaphore (
 
         /* Reacquire the interpreter */
 
-       AcpiExEnterInterpreter ();
+        AcpiExEnterInterpreter ();
     }
 
     return_ACPI_STATUS (Status);
index a570ad6..4843a20 100644 (file)
@@ -341,8 +341,8 @@ AcpiExDigitsNeeded (
  *
  * FUNCTION:    AcpiExEisaIdToString
  *
- * PARAMETERS:  CompressedId    - EISAID to be converted
- *              OutString       - Where to put the converted string (8 bytes)
+ * PARAMETERS:  OutString       - Where to put the converted string (8 bytes)
+ *              CompressedId    - EISAID to be converted
  *
  * RETURN:      None
  *
@@ -400,7 +400,7 @@ AcpiExEisaIdToString (
  *                                possible 64-bit integer.
  *              Value           - Value to be converted
  *
- * RETURN:      None, string
+ * RETURN:      Converted string in OutString
  *
  * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
  *              Assumes string buffer is large enough to hold the string. The
@@ -437,9 +437,9 @@ AcpiExIntegerToString (
  * FUNCTION:    AcpiExPciClsToString
  *
  * PARAMETERS:  OutString       - Where to put the converted string (7 bytes)
- * PARAMETERS:  ClassCode       - PCI class code to be converted (3 bytes)
+ *              ClassCode       - PCI class code to be converted (3 bytes)
  *
- * RETURN:      None
+ * RETURN:      Converted string in OutString
  *
  * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
  *              Return buffer must be large enough to hold the string. The
@@ -475,7 +475,7 @@ AcpiExPciClsToString (
  *
  * PARAMETERS:  SpaceId             - ID to be validated
  *
- * RETURN:      TRUE if valid/supported ID.
+ * RETURN:      TRUE if SpaceId is a valid/supported ID.
  *
  * DESCRIPTION: Validate an operation region SpaceID.
  *
index bc85c96..55cdd07 100644 (file)
@@ -91,6 +91,9 @@ AcpiHwValidateRegister (
     UINT8                   MaxBitWidth,
     UINT64                  *Address)
 {
+    UINT8                   BitWidth;
+    UINT8                   AccessWidth;
+
 
     /* Must have a valid pointer to a GAS structure */
 
@@ -120,24 +123,26 @@ AcpiHwValidateRegister (
         return (AE_SUPPORT);
     }
 
-    /* Validate the BitWidth */
+    /* Validate the AccessWidth */
 
-    if ((Reg->BitWidth != 8) &&
-        (Reg->BitWidth != 16) &&
-        (Reg->BitWidth != 32) &&
-        (Reg->BitWidth != MaxBitWidth))
+    if (Reg->AccessWidth > 4)
     {
         ACPI_ERROR ((AE_INFO,
-            "Unsupported register bit width: 0x%X", Reg->BitWidth));
+            "Unsupported register access width: 0x%X", Reg->AccessWidth));
         return (AE_SUPPORT);
     }
 
-    /* Validate the BitOffset. Just a warning for now. */
+    /* Validate the BitWidth, convert AccessWidth into number of bits */
 
-    if (Reg->BitOffset != 0)
+    AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1;
+    AccessWidth = 1 << (AccessWidth + 2);
+    BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+    if (MaxBitWidth < BitWidth)
     {
         ACPI_WARNING ((AE_INFO,
-            "Unsupported register bit offset: 0x%X", Reg->BitOffset));
+            "Requested bit width 0x%X is smaller than register bit width 0x%X",
+            MaxBitWidth, BitWidth));
+        return (AE_SUPPORT);
     }
 
     return (AE_OK);
@@ -158,10 +163,7 @@ AcpiHwValidateRegister (
  *              64-bit values is not needed.
  *
  * LIMITATIONS: <These limitations also apply to AcpiHwWrite>
- *      BitWidth must be exactly 8, 16, or 32.
  *      SpaceID must be SystemMemory or SystemIO.
- *      BitOffset and AccessWidth are currently ignored, as there has
- *          not been a need to implement these.
  *
  ******************************************************************************/
 
@@ -171,7 +173,12 @@ AcpiHwRead (
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
     UINT64                  Value64;
+    UINT32                  Value32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -186,30 +193,65 @@ AcpiHwRead (
         return (Status);
     }
 
-    /* Initialize entire 32-bit return value to zero */
-
+    /*
+     * Initialize entire 32-bit return value to zero, convert AccessWidth
+     * into number of bits based
+     */
     *Value = 0;
+    AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1;
+    AccessWidth = 1 << (AccessWidth + 2);
+    BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+    BitOffset = Reg->BitOffset;
 
     /*
      * Two address spaces supported: Memory or IO. PCI_Config is
      * not supported here because the GAS structure is insufficient
      */
-    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+    Index = 0;
+    while (BitWidth)
     {
-        Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
-            Address, &Value64, Reg->BitWidth);
+        if (BitOffset > AccessWidth)
+        {
+            Value32 = 0;
+            BitOffset -= AccessWidth;
+        }
+        else
+        {
+            if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+            {
+                Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    &Value64, AccessWidth);
+                Value32 = (UINT32) Value64;
+            }
+            else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+            {
+                Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    &Value32, AccessWidth);
+            }
+
+            if (BitOffset)
+            {
+                Value32 &= ACPI_MASK_BITS_BELOW (BitOffset);
+                BitOffset = 0;
+            }
+            if (BitWidth < AccessWidth)
+            {
+                Value32 &= ACPI_MASK_BITS_ABOVE (BitWidth);
+            }
+        }
 
-        *Value = (UINT32) Value64;
-    }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
-            Address, Value, Reg->BitWidth);
+        ACPI_SET_BITS (Value, Index * AccessWidth,
+            ((1 << AccessWidth) - 1), Value32);
+
+        BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+        Index++;
     }
 
     ACPI_DEBUG_PRINT ((ACPI_DB_IO,
         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-        *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+        *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
         AcpiUtGetRegionName (Reg->SpaceId)));
 
     return (Status);
@@ -237,6 +279,12 @@ AcpiHwWrite (
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
+    UINT64                  Value64;
+    UINT32                  NewValue32, OldValue32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -251,24 +299,110 @@ AcpiHwWrite (
         return (Status);
     }
 
+    /* Convert AccessWidth into number of bits based */
+
+    AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1;
+    AccessWidth = 1 << (AccessWidth + 2);
+    BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+    BitOffset = Reg->BitOffset;
+
     /*
      * Two address spaces supported: Memory or IO. PCI_Config is
      * not supported here because the GAS structure is insufficient
      */
-    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+    Index = 0;
+    while (BitWidth)
     {
-        Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
-            Address, (UINT64) Value, Reg->BitWidth);
-    }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
-            Address, Value, Reg->BitWidth);
+        NewValue32 = ACPI_GET_BITS (&Value, (Index * AccessWidth),
+            ((1 << AccessWidth) - 1));
+
+        if (BitOffset > AccessWidth)
+        {
+            BitOffset -= AccessWidth;
+        }
+        else
+        {
+            if (BitOffset)
+            {
+                NewValue32 &= ACPI_MASK_BITS_BELOW (BitOffset);
+            }
+
+            if (BitWidth < AccessWidth)
+            {
+                NewValue32 &= ACPI_MASK_BITS_ABOVE (BitWidth);
+            }
+
+            if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+            {
+                if (BitOffset || BitWidth < AccessWidth)
+                {
+                    /*
+                     * Read old values in order not to modify the bits that
+                     * are beyond the register BitWidth/BitOffset setting.
+                     */
+                    Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
+                        Address + Index * ACPI_DIV_8 (AccessWidth),
+                        &Value64, AccessWidth);
+                    OldValue32 = (UINT32) Value64;
+
+                    if (BitOffset)
+                    {
+                        OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1);
+                        BitOffset = 0;
+                    }
+
+                    if (BitWidth < AccessWidth)
+                    {
+                        OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1);
+                    }
+
+                    NewValue32 |= OldValue32;
+                }
+
+                Value64 = (UINT64) NewValue32;
+                Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    Value64, AccessWidth);
+            }
+            else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+            {
+                if (BitOffset || BitWidth < AccessWidth)
+                {
+                    /*
+                     * Read old values in order not to modify the bits that
+                     * are beyond the register BitWidth/BitOffset setting.
+                     */
+                    Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
+                        Address + Index * ACPI_DIV_8 (AccessWidth),
+                        &OldValue32, AccessWidth);
+
+                    if (BitOffset)
+                    {
+                        OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1);
+                        BitOffset = 0;
+                    }
+
+                    if (BitWidth < AccessWidth)
+                    {
+                        OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1);
+                    }
+
+                    NewValue32 |= OldValue32;
+                }
+
+                Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    NewValue32, AccessWidth);
+            }
+        }
+
+        BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+        Index++;
     }
 
     ACPI_DEBUG_PRINT ((ACPI_DB_IO,
         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-        Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+        Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
         AcpiUtGetRegionName (Reg->SpaceId)));
 
     return (Status);
index e8b2fe6..f5d4fca 100644 (file)
@@ -565,8 +565,7 @@ AcpiGetSleepTypeData (
      * Evaluate the \_Sx namespace object containing the register values
      * for this state
      */
-    Info->RelativePathname = ACPI_CAST_PTR (char,
-        AcpiGbl_SleepStateNames[SleepState]);
+    Info->RelativePathname = AcpiGbl_SleepStateNames[SleepState];
 
     Status = AcpiNsEvaluate (Info);
     if (ACPI_FAILURE (Status))
index 1e43d98..7a0eaf5 100644 (file)
@@ -97,7 +97,7 @@ static ACPI_SLEEP_FUNCTIONS         AcpiSleepDispatch[] =
  *              PhysicalAddress     - 32-bit physical address of ACPI real mode
  *                                    entry point
  *              PhysicalAddress64   - 64-bit physical address of ACPI protected
- *                                    entry point
+ *                                    mode entry point
  *
  * RETURN:      Status
  *
@@ -153,7 +153,7 @@ AcpiHwSetFirmwareWakingVector (
  * PARAMETERS:  PhysicalAddress     - 32-bit physical address of ACPI real mode
  *                                    entry point
  *              PhysicalAddress64   - 64-bit physical address of ACPI protected
- *                                    entry point
+ *                                    mode entry point
  *
  * RETURN:      Status
  *
index 63b8be8..8f3f471 100644 (file)
@@ -55,7 +55,7 @@
 
 typedef struct acpi_db_command_info
 {
-    char                    *Name;          /* Command Name */
+    const char              *Name;          /* Command Name */
     UINT8                   MinArgs;        /* Minimum arguments required */
 
 } ACPI_DB_COMMAND_INFO;
@@ -70,7 +70,7 @@ typedef struct acpi_db_command_help
 
 typedef struct acpi_db_argument_info
 {
-    char                    *Name;          /* Argument Name */
+    const char              *Name;          /* Argument Name */
 
 } ACPI_DB_ARGUMENT_INFO;
 
index b6e250e..3a066c8 100644 (file)
@@ -302,6 +302,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest6[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest7[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest8[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest9[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest10[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHestNotify[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHestBank[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHpet[];
@@ -318,6 +319,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3a[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3b[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort3c[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIort4[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortAcc[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortHdr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoIortMap[];
@@ -807,22 +809,22 @@ AcpiDmGetExternalsFromFile (
 void
 AcpiDmDumpInteger8 (
     UINT8                   Value,
-    char                    *Name);
+    const char              *Name);
 
 void
 AcpiDmDumpInteger16 (
     UINT16                  Value,
-    char                    *Name);
+    const char              *Name);
 
 void
 AcpiDmDumpInteger32 (
     UINT32                  Value,
-    char                    *Name);
+    const char              *Name);
 
 void
 AcpiDmDumpInteger64 (
     UINT64                  Value,
-    char                    *Name);
+    const char              *Name);
 
 void
 AcpiDmResourceTemplate (
@@ -934,7 +936,7 @@ AcpiDmSerialBusDescriptor (
 
 void
 AcpiDmVendorCommon (
-    char                    *Name,
+    const char              *Name,
     UINT8                   *ByteData,
     UINT32                  Length,
     UINT32                  Level);
index 62bc0ed..a14dbe5 100644 (file)
@@ -272,10 +272,6 @@ AcpiEvDetachRegion (
     ACPI_OPERAND_OBJECT     *RegionObj,
     BOOLEAN                 AcpiNsIsLocked);
 
-void
-AcpiEvAssociateRegMethod (
-    ACPI_OPERAND_OBJECT     *RegionObj);
-
 void
 AcpiEvExecuteRegMethods (
     ACPI_NAMESPACE_NODE     *Node,
index 2fe04d4..1918e0c 100644 (file)
@@ -86,8 +86,6 @@ ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerBitWidth);
 ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerByteWidth);
 ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerNybbleWidth);
 
-ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_GroupModuleLevelCode, FALSE);
-
 
 /*****************************************************************************
  *
@@ -170,7 +168,7 @@ ACPI_GLOBAL (UINT8,                     AcpiGbl_NextOwnerIdOffset);
 
 /* Initialization sequencing */
 
-ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_RegMethodsEnabled, FALSE);
+ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_NamespaceInitialized, FALSE);
 
 /* Misc */
 
@@ -191,6 +189,8 @@ extern const char                      *AcpiGbl_SleepStateNames[ACPI_S_STATE_COU
 extern const char                      *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS];
 extern const char                      *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS];
 extern const char                      *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
+extern const char                       AcpiGbl_LowerHexDigits[];
+extern const char                       AcpiGbl_UpperHexDigits[];
 extern const ACPI_OPCODE_INFO           AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
 
 
@@ -372,6 +372,14 @@ ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_DbCommandComplete);
 
 #endif /* ACPI_DEBUGGER */
 
+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+ACPI_GLOBAL (const char,                *AcpiGbl_PldPanelList[]);
+ACPI_GLOBAL (const char,                *AcpiGbl_PldVerticalPositionList[]);
+ACPI_GLOBAL (const char,                *AcpiGbl_PldHorizontalPositionList[]);
+ACPI_GLOBAL (const char,                *AcpiGbl_PldShapeList[]);
+
+#endif
 
 /*****************************************************************************
  *
index 454e8ba..148e8d0 100644 (file)
@@ -69,7 +69,7 @@ typedef const struct acpi_exdump_info
 {
     UINT8                   Opcode;
     UINT8                   Offset;
-    char                    *Name;
+    const char              *Name;
 
 } ACPI_EXDUMP_INFO;
 
index 0866182..48cff57 100644 (file)
@@ -89,7 +89,7 @@ union acpi_parse_object;
 #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
 
 #define ACPI_MAX_MUTEX                  5
-#define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
+#define ACPI_NUM_MUTEX                  (ACPI_MAX_MUTEX+1)
 
 
 /* Lock structure for reader/writer interfaces */
@@ -111,12 +111,12 @@ typedef struct acpi_rw_lock
 #define ACPI_LOCK_HARDWARE              1
 
 #define ACPI_MAX_LOCK                   1
-#define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
+#define ACPI_NUM_LOCK                   (ACPI_MAX_LOCK+1)
 
 
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
-#define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
+#define ACPI_MUTEX_NOT_ACQUIRED         ((ACPI_THREAD_ID) -1)
 
 /* This Thread ID means an invalid thread ID */
 
@@ -1285,6 +1285,7 @@ typedef struct acpi_external_list
 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
 #define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
+#define ACPI_EXT_ORIGIN_FROM_OPCODE         0x10    /* External came from a External() opcode */
 
 
 typedef struct acpi_external_file
index 1393412..ecb8050 100644 (file)
 
 #define ACPI_IS_MISALIGNED(value)           (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1))
 
+/* Generic (power-of-two) rounding */
+
+#define ACPI_IS_POWER_OF_TWO(a)             (((a) & ((a) - 1)) == 0)
+
 /*
  * Bitmask creation
  * Bit positions start at zero.
index 492f187..11ee70d 100644 (file)
@@ -94,7 +94,7 @@ AcpiNsInitializeObjects (
 
 ACPI_STATUS
 AcpiNsInitializeDevices (
-    void);
+    UINT32                  Flags);
 
 
 /*
@@ -258,14 +258,14 @@ AcpiNsDumpEntry (
 void
 AcpiNsDumpPathname (
     ACPI_HANDLE             Handle,
-    char                    *Msg,
+    const char              *Msg,
     UINT32                  Level,
     UINT32                  Component);
 
 void
 AcpiNsPrintPathname (
     UINT32                  NumSegments,
-    char                    *Pathname);
+    const char              *Pathname);
 
 ACPI_STATUS
 AcpiNsDumpOneObject (
index 49dbc86..9c7e954 100644 (file)
 #define ACPI_GET_FUNCTION_NAME          _AcpiFunctionName
 
 /*
- * The Name parameter should be the procedure name as a quoted string.
+ * The Name parameter should be the procedure name as a non-quoted string.
  * The function name is also used by the function exit macros below.
  * Note: (const char) is used to be compatible with the debug interfaces
  * and macros such as __FUNCTION__.
index 2665128..dd27821 100644 (file)
@@ -171,7 +171,7 @@ const ACPI_OPCODE_INFO *
 AcpiPsGetOpcodeInfo (
     UINT16                  Opcode);
 
-char *
+const char *
 AcpiPsGetOpcodeName (
     UINT16                  Opcode);
 
index 408bdf9..0c7e021 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20160108
+#define ACPI_CA_VERSION                 0x20160318
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -192,9 +192,9 @@ ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_CopyDsdtLocally, FALSE);
 ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DoNotUseXsdt, FALSE);
 
 /*
- * Optionally allow default region handlers to be overridden.
+ * Optionally support group module level code.
  */
-ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_OverrideDefaultRegionHandlers, FALSE);
+ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_GroupModuleLevelCode, FALSE);
 
 /*
  * Optionally use 32-bit FADT addresses if and when there is a conflict
@@ -1172,11 +1172,9 @@ AcpiWarning (
     ...))
 
 ACPI_MSG_DEPENDENT_RETURN_VOID (
-ACPI_PRINTF_LIKE(3)
+ACPI_PRINTF_LIKE(1)
 void ACPI_INTERNAL_VAR_XFACE
 AcpiInfo (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
     const char              *Format,
     ...))
 
index 2e95223..c335645 100644 (file)
@@ -516,6 +516,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),
 
+    {{"_FIT",   METHOD_0ARGS,
+                METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},  /* ACPI 6.0 */
+
     {{"_FIX",   METHOD_0ARGS,
                 METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
                     PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0),
@@ -1030,6 +1033,12 @@ const ACPI_PREDEFINED_INFO          AcpiGbl_PredefinedMethods[] =
     {{"_WED",   METHOD_1ARGS (ACPI_TYPE_INTEGER),
                 METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER)}},
 
+    {{"_WPC",   METHOD_0ARGS,
+                METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},  /* ACPI 6.1 */
+
+    {{"_WPP",   METHOD_0ARGS,
+                METHOD_RETURNS (ACPI_RTYPE_INTEGER)}},  /* ACPI 6.1 */
+
     PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */
 };
 #else
@@ -1104,7 +1113,7 @@ const ACPI_PREDEFINED_INFO      AcpiGbl_ResourceNames[] =
     PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */
 };
 
-static const ACPI_PREDEFINED_INFO      AcpiGbl_ScopeNames[] = {
+const ACPI_PREDEFINED_INFO              AcpiGbl_ScopeNames[] = {
     {{"_GPE",     0,      0}},
     {{"_PR_",     0,      0}},
     {{"_SB_",     0,      0}},
@@ -1113,7 +1122,7 @@ static const ACPI_PREDEFINED_INFO      AcpiGbl_ScopeNames[] = {
     PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */
 };
 #else
-extern const ACPI_PREDEFINED_INFO      AcpiGbl_ResourceNames[];
+extern const ACPI_PREDEFINED_INFO       AcpiGbl_ResourceNames[];
 #endif
 
 #endif
index cbce5de..1d077ca 100644 (file)
@@ -130,7 +130,7 @@ typedef const struct acpi_rsdump_info
 {
     UINT8                   Opcode;
     UINT8                   Offset;
-    char                    *Name;
+    const char              *Name;
     const char              **Pointer;
 
 } ACPI_RSDUMP_INFO;
@@ -227,7 +227,7 @@ AcpiRsGetPrsMethodData (
 ACPI_STATUS
 AcpiRsGetMethodData (
     ACPI_HANDLE             Handle,
-    char                    *Path,
+    const char              *Path,
     ACPI_BUFFER             *RetBuffer);
 
 ACPI_STATUS
index e1d8fa5..f7538ad 100644 (file)
@@ -202,7 +202,7 @@ typedef struct acpi_evaluate_info
     /* The first 3 elements are passed by the caller to AcpiNsEvaluate */
 
     ACPI_NAMESPACE_NODE             *PrefixNode;        /* Input: starting node */
-    char                            *RelativePathname;  /* Input: path relative to PrefixNode */
+    const char                      *RelativePathname;  /* Input: path relative to PrefixNode */
     ACPI_OPERAND_OBJECT             **Parameters;       /* Input: argument list */
 
     ACPI_NAMESPACE_NODE             *Node;              /* Resolved node (PrefixNode:RelativePathname) */
index e868909..faeb744 100644 (file)
@@ -248,7 +248,7 @@ typedef struct acpi_table_facs
 /*******************************************************************************
  *
  * FADT - Fixed ACPI Description Table (Signature "FACP")
- *        Version 4
+ *        Version 6
  *
  ******************************************************************************/
 
@@ -449,4 +449,6 @@ typedef struct acpi_table_desc
 #define ACPI_FADT_V5_SIZE       (UINT32) (ACPI_FADT_OFFSET (HypervisorId))
 #define ACPI_FADT_V6_SIZE       (UINT32) (sizeof (ACPI_TABLE_FADT))
 
+#define ACPI_FADT_CONFORMANCE   "ACPI 6.1 (FADT version 6)"
+
 #endif /* __ACTBL_H__ */
index e789b9b..0fe925a 100644 (file)
@@ -268,7 +268,8 @@ enum AcpiEinjActions
     ACPI_EINJ_CHECK_BUSY_STATUS             = 6,
     ACPI_EINJ_GET_COMMAND_STATUS            = 7,
     ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS   = 8,
-    ACPI_EINJ_ACTION_RESERVED               = 9,     /* 9 and greater are reserved */
+    ACPI_EINJ_GET_EXECUTE_TIMINGS           = 9,
+    ACPI_EINJ_ACTION_RESERVED               = 10,    /* 10 and greater are reserved */
     ACPI_EINJ_TRIGGER_ERROR                 = 0xFF   /* Except for this value */
 };
 
@@ -397,7 +398,8 @@ enum AcpiErstActions
     ACPI_ERST_GET_ERROR_RANGE       = 13,
     ACPI_ERST_GET_ERROR_LENGTH      = 14,
     ACPI_ERST_GET_ERROR_ATTRIBUTES  = 15,
-    ACPI_ERST_ACTION_RESERVED       = 16    /* 16 and greater are reserved */
+    ACPI_ERST_EXECUTE_TIMINGS       = 16,
+    ACPI_ERST_ACTION_RESERVED       = 17    /* 17 and greater are reserved */
 };
 
 /* Values for Instruction field above */
@@ -489,7 +491,8 @@ enum AcpiHestTypes
     ACPI_HEST_TYPE_AER_ENDPOINT         = 7,
     ACPI_HEST_TYPE_AER_BRIDGE           = 8,
     ACPI_HEST_TYPE_GENERIC_ERROR        = 9,
-    ACPI_HEST_TYPE_RESERVED             = 10    /* 10 and greater are reserved */
+    ACPI_HEST_TYPE_GENERIC_ERROR_V2     = 10,
+    ACPI_HEST_TYPE_RESERVED             = 11    /* 11 and greater are reserved */
 };
 
 
@@ -578,7 +581,11 @@ enum AcpiHestNotifyTypes
     ACPI_HEST_NOTIFY_NMI        = 4,
     ACPI_HEST_NOTIFY_CMCI       = 5,    /* ACPI 5.0 */
     ACPI_HEST_NOTIFY_MCE        = 6,    /* ACPI 5.0 */
-    ACPI_HEST_NOTIFY_RESERVED   = 7     /* 7 and greater are reserved */
+    ACPI_HEST_NOTIFY_GPIO       = 7,    /* ACPI 6.0 */
+    ACPI_HEST_NOTIFY_SEA        = 8,    /* ACPI 6.1 */
+    ACPI_HEST_NOTIFY_SEI        = 9,    /* ACPI 6.1 */
+    ACPI_HEST_NOTIFY_GSIV       = 10,   /* ACPI 6.1 */
+    ACPI_HEST_NOTIFY_RESERVED   = 11    /* 11 and greater are reserved */
 };
 
 /* Values for ConfigWriteEnable bitfield above */
@@ -697,6 +704,27 @@ typedef struct acpi_hest_generic
 } ACPI_HEST_GENERIC;
 
 
+/* 10: Generic Hardware Error Source, version 2 */
+
+typedef struct acpi_hest_generic_v2
+{
+    ACPI_HEST_HEADER        Header;
+    UINT16                  RelatedSourceId;
+    UINT8                   Reserved;
+    UINT8                   Enabled;
+    UINT32                  RecordsToPreallocate;
+    UINT32                  MaxSectionsPerRecord;
+    UINT32                  MaxRawDataLength;
+    ACPI_GENERIC_ADDRESS    ErrorStatusAddress;
+    ACPI_HEST_NOTIFY        Notify;
+    UINT32                  ErrorBlockLength;
+    ACPI_GENERIC_ADDRESS    ReadAckRegister;
+    UINT64                  ReadAckPreserve;
+    UINT64                  ReadAckWrite;
+
+} ACPI_HEST_GENERIC_V2;
+
+
 /* Generic Error Status block */
 
 typedef struct acpi_hest_generic_status
@@ -733,6 +761,35 @@ typedef struct acpi_hest_generic_data
 
 } ACPI_HEST_GENERIC_DATA;
 
+/* Extension for revision 0x0300 */
+
+typedef struct acpi_hest_generic_data_v300
+{
+    UINT8                   SectionType[16];
+    UINT32                  ErrorSeverity;
+    UINT16                  Revision;
+    UINT8                   ValidationBits;
+    UINT8                   Flags;
+    UINT32                  ErrorDataLength;
+    UINT8                   FruId[16];
+    UINT8                   FruText[20];
+    UINT64                  TimeStamp;
+
+} ACPI_HEST_GENERIC_DATA_V300;
+
+/* Values for ErrorSeverity above */
+
+#define ACPI_HEST_GEN_ERROR_RECOVERABLE     0
+#define ACPI_HEST_GEN_ERROR_FATAL           1
+#define ACPI_HEST_GEN_ERROR_CORRECTED       2
+#define ACPI_HEST_GEN_ERROR_NONE            3
+
+/* Flags for ValidationBits above */
+
+#define ACPI_HEST_GEN_VALID_FRU_ID          (1)
+#define ACPI_HEST_GEN_VALID_FRU_STRING      (1<<1)
+#define ACPI_HEST_GEN_VALID_TIMESTAMP       (1<<2)
+
 
 /*******************************************************************************
  *
@@ -1095,7 +1152,7 @@ typedef struct acpi_msct_proximity
 
 /*******************************************************************************
  *
- * NFIT - NVDIMM Interface Table (ACPI 6.0)
+ * NFIT - NVDIMM Interface Table (ACPI 6.0+)
  *        Version 1
  *
  ******************************************************************************/
@@ -1187,6 +1244,7 @@ typedef struct acpi_nfit_memory_map
 #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 */
+#define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)  /* 06: Mapping to SPA failed */
 
 
 /* 2: Interleave Structure */
@@ -1226,7 +1284,10 @@ typedef struct acpi_nfit_control_region
     UINT16                  SubsystemVendorId;
     UINT16                  SubsystemDeviceId;
     UINT16                  SubsystemRevisionId;
-    UINT8                   Reserved[6];        /* Reserved, must be zero */
+    UINT8                   ValidFields;
+    UINT8                   ManufacturingLocation;
+    UINT16                  ManufacturingDate;
+    UINT8                   Reserved[2];        /* Reserved, must be zero */
     UINT32                  SerialNumber;
     UINT16                  Code;
     UINT16                  Windows;
@@ -1242,7 +1303,11 @@ typedef struct acpi_nfit_control_region
 
 /* Flags */
 
-#define ACPI_NFIT_CONTROL_BUFFERED      (1)     /* Block Data Windows implementation is buffered */
+#define ACPI_NFIT_CONTROL_BUFFERED          (1)     /* Block Data Windows implementation is buffered */
+
+/* ValidFields bits */
+
+#define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)     /* Manufacturing fields are valid */
 
 
 /* 5: NVDIMM Block Data Window Region Structure */
index 2a955ba..625d33f 100644 (file)
@@ -364,7 +364,7 @@ typedef struct acpi_csrt_descriptor
  * DBG2 - Debug Port Table 2
  *        Version 0 (Both main table and subtables)
  *
- * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
+ * Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015
  *
  ******************************************************************************/
 
@@ -421,6 +421,11 @@ typedef struct acpi_dbg2_device
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
+#define ACPI_DBG2_ARM_DCC           0x000F
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
@@ -453,7 +458,7 @@ typedef struct acpi_table_dbgp
  *        Version 1
  *
  * Conforms to "Intel Virtualization Technology for Directed I/O",
- * Version 2.2, Sept. 2013
+ * Version 2.3, October 2014
  *
  ******************************************************************************/
 
@@ -469,6 +474,8 @@ typedef struct acpi_table_dmar
 /* Masks for Flags field above */
 
 #define ACPI_DMAR_INTR_REMAP        (1)
+#define ACPI_DMAR_X2APIC_OPT_OUT    (1<<1)
+#define ACPI_DMAR_X2APIC_MODE       (1<<2)
 
 
 /* DMAR subtable header */
@@ -757,7 +764,7 @@ typedef struct acpi_ibft_target
  * IORT - IO Remapping Table
  *
  * Conforms to "IO Remapping Table System Software on ARM Platforms",
- * Document number: ARM DEN 0049A, 2015
+ * Document number: ARM DEN 0049B, October 2015
  *
  ******************************************************************************/
 
@@ -793,7 +800,8 @@ 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
+    ACPI_IORT_NODE_SMMU                 = 0x03,
+    ACPI_IORT_NODE_SMMU_V3              = 0x04
 };
 
 
@@ -902,6 +910,26 @@ typedef struct acpi_iort_smmu
 #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
 
 
+typedef struct acpi_iort_smmu_v3
+{
+    UINT64                  BaseAddress;            /* SMMUv3 base address */
+    UINT32                  Flags;
+    UINT32                  Reserved;
+    UINT64                  VatosAddress;
+    UINT32                  Model;                 /* O: generic SMMUv3 */
+    UINT32                  EventGsiv;
+    UINT32                  PriGsiv;
+    UINT32                  GerrGsiv;
+    UINT32                  SyncGsiv;
+
+} ACPI_IORT_SMMU_V3;
+
+/* Masks for Flags field above */
+
+#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
+#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (1<<1)
+
+
 /*******************************************************************************
  *
  * IVRS - I/O Virtualization Reporting Structure
@@ -1284,10 +1312,10 @@ typedef struct acpi_table_slic
 /*******************************************************************************
  *
  * SPCR - Serial Port Console Redirection table
- *        Version 1
+ *        Version 2
  *
  * Conforms to "Serial Port Console Redirection Table",
- * Version 1.00, January 11, 2002
+ * Version 1.03, August 10, 2015
  *
  ******************************************************************************/
 
@@ -1321,6 +1349,8 @@ typedef struct acpi_table_spcr
 
 #define ACPI_SPCR_DO_NOT_DISABLE    (1)
 
+/* Values for Interface Type: See the definition of the DBG2 table */
+
 
 /*******************************************************************************
  *
index c27bb96..bc876a9 100644 (file)
@@ -205,7 +205,7 @@ typedef struct acpi_table_fpdt
 } ACPI_TABLE_FPDT;
 
 
-/* FPDT subtable header */
+/* FPDT subtable header (Performance Record Structure) */
 
 typedef struct acpi_fpdt_header
 {
@@ -230,33 +230,29 @@ enum AcpiFpdtType
 
 /* 0: Firmware Basic Boot Performance Record */
 
-typedef struct acpi_fpdt_boot
+typedef struct acpi_fpdt_boot_pointer
 {
     ACPI_FPDT_HEADER        Header;
     UINT8                   Reserved[4];
-    UINT64                  ResetEnd;
-    UINT64                  LoadStart;
-    UINT64                  StartupStart;
-    UINT64                  ExitServicesEntry;
-    UINT64                  ExitServicesExit;
+    UINT64                  Address;
 
-} ACPI_FPDT_BOOT;
+} ACPI_FPDT_BOOT_POINTER;
 
 
 /* 1: S3 Performance Table Pointer Record */
 
-typedef struct acpi_fpdt_s3pt_ptr
+typedef struct acpi_fpdt_s3pt_pointer
 {
     ACPI_FPDT_HEADER        Header;
     UINT8                   Reserved[4];
     UINT64                  Address;
 
-} ACPI_FPDT_S3PT_PTR;
+} ACPI_FPDT_S3PT_POINTER;
 
 
 /*
  * S3PT - S3 Performance Table. This table is pointed to by the
- * FPDT S3 Pointer Record above.
+ * S3 Pointer Record above.
  */
 typedef struct acpi_table_s3pt
 {
@@ -267,27 +263,21 @@ typedef struct acpi_table_s3pt
 
 
 /*
- * S3PT Subtables
+ * S3PT Subtables (Not part of the actual FPDT)
  */
-typedef struct acpi_s3pt_header
-{
-    UINT16                  Type;
-    UINT8                   Length;
-    UINT8                   Revision;
 
-} ACPI_S3PT_HEADER;
-
-/* Values for Type field above */
+/* Values for Type field in S3PT header */
 
 enum AcpiS3ptType
 {
     ACPI_S3PT_TYPE_RESUME               = 0,
-    ACPI_S3PT_TYPE_SUSPEND              = 1
+    ACPI_S3PT_TYPE_SUSPEND              = 1,
+    ACPI_FPDT_BOOT_PERFORMANCE          = 2
 };
 
 typedef struct acpi_s3pt_resume
 {
-    ACPI_S3PT_HEADER        Header;
+    ACPI_FPDT_HEADER        Header;
     UINT32                  ResumeCount;
     UINT64                  FullResume;
     UINT64                  AverageResume;
@@ -296,13 +286,29 @@ typedef struct acpi_s3pt_resume
 
 typedef struct acpi_s3pt_suspend
 {
-    ACPI_S3PT_HEADER        Header;
+    ACPI_FPDT_HEADER        Header;
     UINT64                  SuspendStart;
     UINT64                  SuspendEnd;
 
 } ACPI_S3PT_SUSPEND;
 
 
+/*
+ * FPDT Boot Performance Record (Not part of the actual FPDT)
+ */
+typedef struct acpi_fpdt_boot
+{
+    ACPI_FPDT_HEADER        Header;
+    UINT8                   Reserved[4];
+    UINT64                  ResetEnd;
+    UINT64                  LoadStart;
+    UINT64                  StartupStart;
+    UINT64                  ExitServicesEntry;
+    UINT64                  ExitServicesExit;
+
+} ACPI_FPDT_BOOT;
+
+
 /*******************************************************************************
  *
  * GTDT - Generic Timer Description Table (ACPI 5.1)
index e43424a..395b915 100644 (file)
@@ -642,7 +642,8 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_NOTIFY_SHUTDOWN_REQUEST    (UINT8) 0x0C
 #define ACPI_NOTIFY_AFFINITY_UPDATE     (UINT8) 0x0D
 
-#define ACPI_NOTIFY_MAX                 0x0D
+#define ACPI_GENERIC_NOTIFY_MAX         0x0D
+#define ACPI_SPECIFIC_NOTIFY_MAX        0x84
 
 /*
  * Types associated with ACPI names and objects. The first group of
@@ -1033,7 +1034,7 @@ typedef struct acpi_buffer
  */
 typedef struct acpi_predefined_names
 {
-    char                            *Name;
+    const char                      *Name;
     UINT8                           Type;
     char                            *Val;
 
@@ -1324,7 +1325,7 @@ typedef struct acpi_mem_space_context
  */
 typedef struct acpi_memory_list
 {
-    char                            *ListName;
+    const char                      *ListName;
     void                            *ListHead;
     UINT16                          ObjectSize;
     UINT16                          MaxDepth;
index cbbf7c5..ed45ef8 100644 (file)
@@ -194,8 +194,14 @@ ACPI_STATUS
 AcpiUtStrtoul64 (
     char                    *String,
     UINT32                  Base,
+    UINT32                  MaxIntegerByteWidth,
     UINT64                  *RetInteger);
 
+/* Values for MaxIntegerByteWidth above */
+
+#define ACPI_MAX32_BYTE_WIDTH       4
+#define ACPI_MAX64_BYTE_WIDTH       8
+
 
 /*
  * utglobal - Global data structures and procedures
@@ -341,7 +347,7 @@ AcpiUtTracePtr (
     const char              *FunctionName,
     const char              *ModuleName,
     UINT32                  ComponentId,
-    void                    *Pointer);
+    const void              *Pointer);
 
 void
 AcpiUtTraceU32 (
@@ -357,7 +363,7 @@ AcpiUtTraceStr (
     const char              *FunctionName,
     const char              *ModuleName,
     UINT32                  ComponentId,
-    char                    *String);
+    const char              *String);
 
 void
 AcpiUtExit (
@@ -460,13 +466,13 @@ AcpiUtDeleteInternalObjectList (
 ACPI_STATUS
 AcpiUtEvaluateObject (
     ACPI_NAMESPACE_NODE     *PrefixNode,
-    char                    *Path,
+    const char              *Path,
     UINT32                  ExpectedReturnBtypes,
     ACPI_OPERAND_OBJECT     **ReturnDesc);
 
 ACPI_STATUS
 AcpiUtEvaluateNumericObject (
-    char                    *ObjectName,
+    const char              *ObjectName,
     ACPI_NAMESPACE_NODE     *DeviceNode,
     UINT64                  *Value);
 
@@ -757,7 +763,7 @@ void
 AcpiUtDisplayInitPathname (
     UINT8                   Type,
     ACPI_NAMESPACE_NODE     *ObjHandle,
-    char                    *Path);
+    const char              *Path);
 #endif
 
 
@@ -934,7 +940,7 @@ AcpiUtDumpAllocations (
 
 ACPI_STATUS
 AcpiUtCreateList (
-    char                    *ListName,
+    const char              *ListName,
     UINT16                  ObjectSize,
     ACPI_MEMORY_LIST        **ReturnCache);
 
index bb2b4e1..410e097 100644 (file)
  *
  *****************************************************************************/
 
+/* Common application configuration. All single threaded except for AcpiExec. */
+
+#if (defined ACPI_ASL_COMPILER) || \
+    (defined ACPI_BIN_APP)      || \
+    (defined ACPI_DUMP_APP)     || \
+    (defined ACPI_HELP_APP)     || \
+    (defined ACPI_NAMES_APP)    || \
+    (defined ACPI_SRC_APP)      || \
+    (defined ACPI_XTRACT_APP)   || \
+    (defined ACPI_EXAMPLE_APP)
+#define ACPI_APPLICATION
+#define ACPI_SINGLE_THREADED
+#endif
+
 /* iASL configuration */
 
 #ifdef ACPI_ASL_COMPILER
-#define ACPI_APPLICATION
 #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
 
 #define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 
-/*
- * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example
- * configuration. All single threaded.
- */
-#if (defined ACPI_BIN_APP)      || \
-    (defined ACPI_DUMP_APP)     || \
-    (defined ACPI_HELP_APP)     || \
-    (defined ACPI_NAMES_APP)    || \
-    (defined ACPI_SRC_APP)      || \
-    (defined ACPI_XTRACT_APP)   || \
-    (defined ACPI_EXAMPLE_APP)
-#define ACPI_APPLICATION
-#define ACPI_SINGLE_THREADED
-#endif
-
 /* AcpiHelp configuration. Error messages disabled. */
 
 #ifdef ACPI_HELP_APP
 #define ACPI_REDUCED_HARDWARE 1
 #endif
 
-/* Linkable ACPICA library */
+/* Linkable ACPICA library. Two versions, one with full debug. */
 
 #ifdef ACPI_LIBRARY
 #define ACPI_USE_LOCAL_CACHE
-#define ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER 1
+#define ACPI_DISASSEMBLER 1
+
+#ifdef _DEBUG
+#define ACPI_DEBUG_OUTPUT
+#endif
 #endif
 
 /* Common for all ACPICA applications */
 #elif defined(__HAIKU__)
 #include "achaiku.h"
 
+#elif defined(__QNX__)
+#include "acqnx.h"
+
 #else
 
 /* Unknown environment */
diff --git a/reactos/drivers/bus/acpi/acpica/include/platform/acqnx.h b/reactos/drivers/bus/acpi/acpica/include/platform/acqnx.h
new file mode 100644 (file)
index 0000000..76252f8
--- /dev/null
@@ -0,0 +1,74 @@
+/******************************************************************************
+ *
+ * Name: acqnx.h - OS specific defines, etc.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACQNX_H__
+#define __ACQNX_H__
+
+/* QNX uses GCC */
+
+#include "acgcc.h"
+
+#define ACPI_UINTPTR_T          uintptr_t
+#define ACPI_USE_LOCAL_CACHE
+#define ACPI_CAST_PTHREAD_T(x)  ((ACPI_THREAD_ID) ACPI_TO_INTEGER (x))
+
+/* At present time (QNX 6.6) all supported architectures are 32 bits. */
+#define ACPI_MACHINE_WIDTH      32
+
+#define COMPILER_DEPENDENT_INT64  int64_t
+#define COMPILER_DEPENDENT_UINT64 uint64_t
+
+#include <ctype.h>
+#include <stdint.h>
+#include <sys/neutrino.h>
+
+#define ACPI_USE_STANDARD_HEADERS
+
+#define __cli() InterruptDisable();
+#define __sti() InterruptEnable();
+#define __cdecl
+
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_NATIVE_DIVIDE
+
+#endif /* __ACQNX_H__ */
index 64db3a9..42a6d80 100644 (file)
@@ -116,7 +116,7 @@ AcpiNsRootInitialize (
             continue;
         }
 
-        Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type,
+        Status = AcpiNsLookup (NULL, (char *) InitVal->Name, InitVal->Type,
             ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
             NULL, &NewNode);
         if (ACPI_FAILURE (Status))
index 8cccf99..2fa182e 100644 (file)
@@ -84,7 +84,7 @@ AcpiNsConvertToInteger (
         /* String-to-Integer conversion */
 
         Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
-            ACPI_ANY_BASE, &Value);
+            ACPI_ANY_BASE, AcpiGbl_IntegerByteWidth, &Value);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
index 72ef07e..776653f 100644 (file)
@@ -99,7 +99,7 @@ AcpiNsGetMaxDepth (
 void
 AcpiNsPrintPathname (
     UINT32                  NumSegments,
-    char                    *Pathname)
+    const char              *Pathname)
 {
     UINT32                  i;
 
@@ -139,6 +139,9 @@ AcpiNsPrintPathname (
 }
 
 
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/* Not used at this time, perhaps later */
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiNsDumpPathname
@@ -158,7 +161,7 @@ AcpiNsPrintPathname (
 void
 AcpiNsDumpPathname (
     ACPI_HANDLE             Handle,
-    char                    *Msg,
+    const char              *Msg,
     UINT32                  Level,
     UINT32                  Component)
 {
@@ -179,7 +182,7 @@ AcpiNsDumpPathname (
     AcpiOsPrintf ("\n");
     return_VOID;
 }
-
+#endif
 
 /*******************************************************************************
  *
index 33a45c0..63051b8 100644 (file)
@@ -396,7 +396,7 @@ AcpiNsExecModuleCodeList (
         AcpiUtRemoveReference (Prev);
     }
 
-    ACPI_INFO ((AE_INFO,
+    ACPI_INFO ((
         "Executed %u blocks of module-level executable AML code",
         MethodCount));
 
index fc08197..067dffe 100644 (file)
@@ -46,6 +46,7 @@
 #include "acnamesp.h"
 #include "acdispat.h"
 #include "acinterp.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nsinit")
@@ -98,6 +99,8 @@ AcpiNsInitializeObjects (
     ACPI_FUNCTION_TRACE (NsInitializeObjects);
 
 
+    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+        "[Init] Completing Initialization of ACPI Objects\n"));
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "**** Starting initialization of namespace objects ****\n"));
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
@@ -151,84 +154,140 @@ AcpiNsInitializeObjects (
 
 ACPI_STATUS
 AcpiNsInitializeDevices (
-    void)
+    UINT32                  Flags)
 {
-    ACPI_STATUS             Status;
+    ACPI_STATUS             Status = AE_OK;
     ACPI_DEVICE_WALK_INFO   Info;
+    ACPI_HANDLE             Handle;
 
 
     ACPI_FUNCTION_TRACE (NsInitializeDevices);
 
 
-    /* Init counters */
+    if (!(Flags & ACPI_NO_DEVICE_INIT))
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+            "[Init] Initializing ACPI Devices\n"));
 
-    Info.DeviceCount = 0;
-    Info.Num_STA = 0;
-    Info.Num_INI = 0;
+        /* Init counters */
 
-    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Initializing Device/Processor/Thermal objects "
-        "and executing _INI/_STA methods:\n"));
+        Info.DeviceCount = 0;
+        Info.Num_STA = 0;
+        Info.Num_INI = 0;
 
-    /* Tree analysis: find all subtrees that contain _INI methods */
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+            "Initializing Device/Processor/Thermal objects "
+            "and executing _INI/_STA methods:\n"));
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL);
-    if (ACPI_FAILURE (Status))
-    {
-        goto ErrorExit;
-    }
-
-    /* Allocate the evaluation information block */
+        /* Tree analysis: find all subtrees that contain _INI methods */
 
-    Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
-    if (!Info.EvaluateInfo)
-    {
-        Status = AE_NO_MEMORY;
-        goto ErrorExit;
-    }
+        Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+            ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL);
+        if (ACPI_FAILURE (Status))
+        {
+            goto ErrorExit;
+        }
 
-    /*
-     * Execute the "global" _INI method that may appear at the root. This
-     * support is provided for Windows compatibility (Vista+) and is not
-     * part of the ACPI specification.
-     */
-    Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode;
-    Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
-    Info.EvaluateInfo->Parameters = NULL;
-    Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
+        /* Allocate the evaluation information block */
 
-    Status = AcpiNsEvaluate (Info.EvaluateInfo);
-    if (ACPI_SUCCESS (Status))
-    {
-        Info.Num_INI++;
-    }
+        Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+        if (!Info.EvaluateInfo)
+        {
+            Status = AE_NO_MEMORY;
+            goto ErrorExit;
+        }
 
-    /* Walk namespace to execute all _INIs on present devices */
+        /*
+         * Execute the "global" _INI method that may appear at the root.
+         * This support is provided for Windows compatibility (Vista+) and
+         * is not part of the ACPI specification.
+         */
+        Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode;
+        Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
+        Info.EvaluateInfo->Parameters = NULL;
+        Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
+
+        Status = AcpiNsEvaluate (Info.EvaluateInfo);
+        if (ACPI_SUCCESS (Status))
+        {
+            Info.Num_INI++;
+        }
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL);
+        /*
+         * Execute \_SB._INI.
+        * There appears to be a strict order requirement for \_SB._INI,
+         * which should be evaluated before any _REG evaluations.
+         */
+        Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
+        if (ACPI_SUCCESS (Status))
+        {
+            memset (Info.EvaluateInfo, 0, sizeof (ACPI_EVALUATE_INFO));
+            Info.EvaluateInfo->PrefixNode = Handle;
+            Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
+            Info.EvaluateInfo->Parameters = NULL;
+            Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
+
+            Status = AcpiNsEvaluate (Info.EvaluateInfo);
+            if (ACPI_SUCCESS (Status))
+            {
+                Info.Num_INI++;
+            }
+        }
+    }
 
     /*
-     * Any _OSI requests should be completed by now. If the BIOS has
-     * requested any Windows OSI strings, we will always truncate
-     * I/O addresses to 16 bits -- for Windows compatibility.
+     * Run all _REG methods
+     *
+     * Note: Any objects accessed by the _REG methods will be automatically
+     * initialized, even if they contain executable AML (see the call to
+     * AcpiNsInitializeObjects below).
+     *
+     * Note: According to the ACPI specification, we actually needn't execute
+     * _REG for SystemMemory/SystemIo operation regions, but for PCI_Config
+     * operation regions, it is required to evaluate _REG for those on a PCI
+     * root bus that doesn't contain _BBN object. So this code is kept here
+     * in order not to break things.
      */
-    if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000)
+    if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
     {
-        AcpiGbl_TruncateIoAddresses = TRUE;
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+            "[Init] Executing _REG OpRegion methods\n"));
+
+        Status = AcpiEvInitializeOpRegions ();
+        if (ACPI_FAILURE (Status))
+        {
+            goto ErrorExit;
+        }
     }
 
-    ACPI_FREE (Info.EvaluateInfo);
-    if (ACPI_FAILURE (Status))
+    if (!(Flags & ACPI_NO_DEVICE_INIT))
     {
-        goto ErrorExit;
-    }
+        /* Walk namespace to execute all _INIs on present devices */
 
-    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "    Executed %u _INI methods requiring %u _STA executions "
-        "(examined %u objects)\n",
-        Info.Num_INI, Info.Num_STA, Info.DeviceCount));
+        Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+            ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL);
+
+        /*
+         * Any _OSI requests should be completed by now. If the BIOS has
+         * requested any Windows OSI strings, we will always truncate
+         * I/O addresses to 16 bits -- for Windows compatibility.
+         */
+        if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000)
+        {
+            AcpiGbl_TruncateIoAddresses = TRUE;
+        }
+
+        ACPI_FREE (Info.EvaluateInfo);
+        if (ACPI_FAILURE (Status))
+        {
+            goto ErrorExit;
+        }
+
+        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
+            "    Executed %u _INI methods requiring %u _STA executions "
+            "(examined %u objects)\n",
+            Info.Num_INI, Info.Num_STA, Info.DeviceCount));
+    }
 
     return_ACPI_STATUS (Status);
 
@@ -611,33 +670,37 @@ AcpiNsInitOneDevice (
      * Note: We know there is an _INI within this subtree, but it may not be
      * under this particular device, it may be lower in the branch.
      */
-    ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
-        ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
+    if (!ACPI_COMPARE_NAME (DeviceNode->Name.Ascii, "_SB_") ||
+        DeviceNode->Parent != AcpiGbl_RootNode)
+    {
+        ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
+            ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
 
-    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
-    Info->PrefixNode = DeviceNode;
-    Info->RelativePathname = METHOD_NAME__INI;
-    Info->Parameters = NULL;
-    Info->Flags = ACPI_IGNORE_RETURN_VALUE;
+        memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
+        Info->PrefixNode = DeviceNode;
+        Info->RelativePathname = METHOD_NAME__INI;
+        Info->Parameters = NULL;
+        Info->Flags = ACPI_IGNORE_RETURN_VALUE;
 
-    Status = AcpiNsEvaluate (Info);
-    if (ACPI_SUCCESS (Status))
-    {
-        WalkInfo->Num_INI++;
-    }
+        Status = AcpiNsEvaluate (Info);
+        if (ACPI_SUCCESS (Status))
+        {
+            WalkInfo->Num_INI++;
+        }
 
 #ifdef ACPI_DEBUG_OUTPUT
-    else if (Status != AE_NOT_FOUND)
-    {
-        /* Ignore error and move on to next device */
+        else if (Status != AE_NOT_FOUND)
+        {
+            /* Ignore error and move on to next device */
 
-        char *ScopeName = AcpiNsGetNormalizedPathname (DeviceNode, TRUE);
+            char *ScopeName = AcpiNsGetNormalizedPathname (DeviceNode, TRUE);
 
-        ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
-            ScopeName));
-        ACPI_FREE (ScopeName);
-    }
+            ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
+                ScopeName));
+            ACPI_FREE (ScopeName);
+        }
 #endif
+    }
 
     /* Ignore errors from above */
 
index 5cfadf3..9c899e7 100644 (file)
@@ -140,8 +140,8 @@ AcpiNsLoadTable (
         (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
         AcpiNsDeleteNamespaceByOwner (
             AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
-            AcpiTbReleaseOwnerId (TableIndex);
 
+        AcpiTbReleaseOwnerId (TableIndex);
         return_ACPI_STATUS (Status);
     }
 
index 3cc9f53..141251f 100644 (file)
@@ -188,6 +188,7 @@ AcpiNsCheckPackage (
             {
                 return (Status);
             }
+
             Elements++;
         }
         break;
@@ -232,6 +233,7 @@ AcpiNsCheckPackage (
                     return (Status);
                 }
             }
+
             Elements++;
         }
         break;
@@ -342,7 +344,7 @@ AcpiNsCheckPackage (
         while (Count > 0)
         {
             Status = AcpiNsCheckObjectType(Info, Elements,
-                        Package->RetInfo.ObjectType1, 0);
+                Package->RetInfo.ObjectType1, 0);
             if (ACPI_FAILURE(Status))
             {
                 return (Status);
@@ -358,7 +360,7 @@ AcpiNsCheckPackage (
             }
 
             Status = AcpiNsCheckObjectType(Info, Elements + 1,
-                        Package->RetInfo.ObjectType2, 0);
+                Package->RetInfo.ObjectType2, 0);
             if (ACPI_FAILURE(Status))
             {
                 return (Status);
@@ -366,8 +368,8 @@ AcpiNsCheckPackage (
 
             Elements += 2;
             Count -= 2;
-         }
-         break;
+        }
+        break;
 
     default:
 
@@ -442,7 +444,7 @@ AcpiNsCheckPackageList (
         /* Each sub-object must be of type Package */
 
         Status = AcpiNsCheckObjectType (Info, &SubPackage,
-                    ACPI_RTYPE_PACKAGE, i);
+            ACPI_RTYPE_PACKAGE, i);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
@@ -466,10 +468,10 @@ AcpiNsCheckPackageList (
             }
 
             Status = AcpiNsCheckPackageElements (Info, SubElements,
-                        Package->RetInfo.ObjectType1,
-                        Package->RetInfo.Count1,
-                        Package->RetInfo.ObjectType2,
-                        Package->RetInfo.Count2, 0);
+                Package->RetInfo.ObjectType1,
+                Package->RetInfo.Count1,
+                Package->RetInfo.ObjectType2,
+                Package->RetInfo.Count2, 0);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -488,10 +490,10 @@ AcpiNsCheckPackageList (
             }
 
             Status = AcpiNsCheckPackageElements (Info, SubElements,
-                        Package->RetInfo.ObjectType1,
-                        Package->RetInfo.Count1,
-                        Package->RetInfo.ObjectType2,
-                        SubPackage->Package.Count - Package->RetInfo.Count1, 0);
+                Package->RetInfo.ObjectType1,
+                Package->RetInfo.Count1,
+                Package->RetInfo.ObjectType2,
+                SubPackage->Package.Count - Package->RetInfo.Count1, 0);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -519,7 +521,7 @@ AcpiNsCheckPackageList (
             for (j = 0; j < ExpectedCount; j++)
             {
                 Status = AcpiNsCheckObjectType (Info, &SubElements[j],
-                            Package->RetInfo2.ObjectType[j], j);
+                    Package->RetInfo2.ObjectType[j], j);
                 if (ACPI_FAILURE (Status))
                 {
                     return (Status);
@@ -540,8 +542,8 @@ AcpiNsCheckPackageList (
             /* Check the type of each subpackage element */
 
             Status = AcpiNsCheckPackageElements (Info, SubElements,
-                        Package->RetInfo.ObjectType1,
-                        SubPackage->Package.Count, 0, 0, 0);
+                Package->RetInfo.ObjectType1,
+                SubPackage->Package.Count, 0, 0, 0);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -554,7 +556,7 @@ AcpiNsCheckPackageList (
              * the count field (the ACPI name is NumElements)
              */
             Status = AcpiNsCheckObjectType (Info, SubElements,
-                        ACPI_RTYPE_INTEGER, 0);
+                ACPI_RTYPE_INTEGER, 0);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -569,11 +571,13 @@ AcpiNsCheckPackageList (
             {
                 goto PackageTooSmall;
             }
+
             if (SubPackage->Package.Count < Package->RetInfo.Count1)
             {
                 ExpectedCount = Package->RetInfo.Count1;
                 goto PackageTooSmall;
             }
+
             if (ExpectedCount == 0)
             {
                 /*
@@ -589,8 +593,8 @@ AcpiNsCheckPackageList (
             /* Check the type of each subpackage element */
 
             Status = AcpiNsCheckPackageElements (Info, (SubElements + 1),
-                        Package->RetInfo.ObjectType1,
-                        (ExpectedCount - 1), 0, 0, 1);
+                Package->RetInfo.ObjectType1,
+                (ExpectedCount - 1), 0, 0, 1);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -662,22 +666,24 @@ AcpiNsCheckPackageElements (
     for (i = 0; i < Count1; i++)
     {
         Status = AcpiNsCheckObjectType (Info, ThisElement,
-                    Type1, i + StartIndex);
+            Type1, i + StartIndex);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
         }
+
         ThisElement++;
     }
 
     for (i = 0; i < Count2; i++)
     {
         Status = AcpiNsCheckObjectType (Info, ThisElement,
-                    Type2, (i + Count1 + StartIndex));
+            Type2, (i + Count1 + StartIndex));
         if (ACPI_FAILURE (Status))
         {
             return (Status);
         }
+
         ThisElement++;
     }
 
index ccffb71..a4745c3 100644 (file)
@@ -298,7 +298,7 @@ AcpiPsGetNextNamepath (
         PossibleMethodCall &&
         (Node->Type == ACPI_TYPE_METHOD))
     {
-        if (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME)
+        if (WalkState->Opcode == AML_UNLOAD_OP)
         {
             /*
              * AcpiPsGetNextNamestring has increased the AML pointer,
@@ -744,7 +744,7 @@ AcpiPsGetNextField (
  *
  * PARAMETERS:  WalkState           - Current state
  *              ParserState         - Current parser state object
- *              ArgType             - The parser argument type (ARGP_*)
+ *              ArgType             - The argument type (AML_*_ARG)
  *              ReturnArg           - Where the next arg is returned
  *
  * RETURN:      Status, and an op object containing the next argument.
@@ -873,9 +873,9 @@ AcpiPsGetNextArg (
                 return_ACPI_STATUS (AE_NO_MEMORY);
             }
 
-            /* SuperName allows argument to be a method call */
+            /* To support SuperName arg of Unload */
 
-            if (ArgType == ARGP_SUPERNAME)
+            if (WalkState->Opcode == AML_UNLOAD_OP)
             {
                 Status = AcpiPsGetNextNamepath (WalkState, ParserState,
                     Arg, ACPI_POSSIBLE_METHOD_CALL);
index 28fa0ed..324d87a 100644 (file)
@@ -165,7 +165,7 @@ AcpiPsGetOpcodeInfo (
  *
  ******************************************************************************/
 
-char *
+const char *
 AcpiPsGetOpcodeName (
     UINT16                  Opcode)
 {
index c0421cd..e794885 100644 (file)
 
 static void
 AcpiRsOutString (
-    char                    *Title,
-    char                    *Value);
+    const char              *Title,
+    const char              *Value);
 
 static void
 AcpiRsOutInteger8 (
-    char                    *Title,
+    const char              *Title,
     UINT8                   Value);
 
 static void
 AcpiRsOutInteger16 (
-    char                    *Title,
+    const char              *Title,
     UINT16                  Value);
 
 static void
 AcpiRsOutInteger32 (
-    char                    *Title,
+    const char              *Title,
     UINT32                  Value);
 
 static void
 AcpiRsOutInteger64 (
-    char                    *Title,
+    const char              *Title,
     UINT64                  Value);
 
 static void
 AcpiRsOutTitle (
-    char                    *Title);
+    const char              *Title);
 
 static void
 AcpiRsDumpByteList (
@@ -263,8 +263,8 @@ AcpiRsDumpDescriptor (
 {
     UINT8                   *Target = NULL;
     UINT8                   *PreviousTarget;
-    char                    *Name;
-    UINT8                    Count;
+    const char              *Name;
+    UINT8                   Count;
 
 
     /* First table entry must contain the table length (# of table entries) */
@@ -307,8 +307,7 @@ AcpiRsDumpDescriptor (
 
             if (Table->Pointer)
             {
-                AcpiRsOutString (Name, ACPI_CAST_PTR (char,
-                    Table->Pointer [*Target]));
+                AcpiRsOutString (Name, Table->Pointer [*Target]);
             }
             else
             {
@@ -335,20 +334,17 @@ AcpiRsDumpDescriptor (
 
         case ACPI_RSD_1BITFLAG:
 
-            AcpiRsOutString (Name, ACPI_CAST_PTR (char,
-                Table->Pointer [*Target & 0x01]));
+            AcpiRsOutString (Name, Table->Pointer [*Target & 0x01]);
             break;
 
         case ACPI_RSD_2BITFLAG:
 
-            AcpiRsOutString (Name, ACPI_CAST_PTR (char,
-                Table->Pointer [*Target & 0x03]));
+            AcpiRsOutString (Name, Table->Pointer [*Target & 0x03]);
             break;
 
         case ACPI_RSD_3BITFLAG:
 
-            AcpiRsOutString (Name, ACPI_CAST_PTR (char,
-                Table->Pointer [*Target & 0x07]));
+            AcpiRsOutString (Name, Table->Pointer [*Target & 0x07]);
             break;
 
         case ACPI_RSD_SHORTLIST:
@@ -542,8 +538,8 @@ AcpiRsDumpAddressCommon (
 
 static void
 AcpiRsOutString (
-    char                    *Title,
-    char                    *Value)
+    const char              *Title,
+    const char              *Value)
 {
 
     AcpiOsPrintf ("%27s : %s", Title, Value);
@@ -556,7 +552,7 @@ AcpiRsOutString (
 
 static void
 AcpiRsOutInteger8 (
-    char                    *Title,
+    const char              *Title,
     UINT8                   Value)
 {
     AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
@@ -564,7 +560,7 @@ AcpiRsOutInteger8 (
 
 static void
 AcpiRsOutInteger16 (
-    char                    *Title,
+    const char              *Title,
     UINT16                  Value)
 {
 
@@ -573,7 +569,7 @@ AcpiRsOutInteger16 (
 
 static void
 AcpiRsOutInteger32 (
-    char                    *Title,
+    const char              *Title,
     UINT32                  Value)
 {
 
@@ -582,7 +578,7 @@ AcpiRsOutInteger32 (
 
 static void
 AcpiRsOutInteger64 (
-    char                    *Title,
+    const char              *Title,
     UINT64                  Value)
 {
 
@@ -592,7 +588,7 @@ AcpiRsOutInteger64 (
 
 static void
 AcpiRsOutTitle (
-    char                    *Title)
+    const char              *Title)
 {
 
     AcpiOsPrintf ("%27s : ", Title);
index fbd1c46..cec4180 100644 (file)
@@ -740,7 +740,7 @@ AcpiRsGetAeiMethodData (
 ACPI_STATUS
 AcpiRsGetMethodData (
     ACPI_HANDLE             Handle,
-    char                    *Path,
+    const char              *Path,
     ACPI_BUFFER             *RetBuffer)
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
index 2bceced..51eb49b 100644 (file)
@@ -56,7 +56,7 @@ AcpiTbInitGenericAddress (
     UINT8                   SpaceId,
     UINT8                   ByteWidth,
     UINT64                  Address,
-    char                    *RegisterName,
+    const char              *RegisterName,
     UINT8                   Flags);
 
 static void
@@ -78,7 +78,7 @@ AcpiTbSelectAddress (
 
 typedef struct acpi_fadt_info
 {
-    char                    *Name;
+    const char              *Name;
     UINT16                  Address64;
     UINT16                  Address32;
     UINT16                  Length;
@@ -212,7 +212,7 @@ AcpiTbInitGenericAddress (
     UINT8                   SpaceId,
     UINT8                   ByteWidth,
     UINT64                  Address,
-    char                    *RegisterName,
+    const char              *RegisterName,
     UINT8                   Flags)
 {
     UINT8                   BitWidth;
@@ -420,15 +420,16 @@ AcpiTbCreateLocalFadt (
 
     /*
      * Check if the FADT is larger than the largest table that we expect
-     * (the ACPI 5.0 version). If so, truncate the table, and issue
-     * a warning.
+     * (typically the current ACPI specification version). If so, truncate
+     * the table, and issue a warning.
      */
     if (Length > sizeof (ACPI_TABLE_FADT))
     {
         ACPI_BIOS_WARNING ((AE_INFO,
-            "FADT (revision %u) is longer than ACPI 5.0 version, "
+            "FADT (revision %u) is longer than %s length, "
             "truncating length %u to %u",
-            Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
+            Table->Revision, ACPI_FADT_CONFORMANCE, Length,
+            (UINT32) sizeof (ACPI_TABLE_FADT)));
     }
 
     /* Clear the entire local FADT */
@@ -506,7 +507,7 @@ static void
 AcpiTbConvertFadt (
     void)
 {
-    char                    *Name;
+    const char              *Name;
     ACPI_GENERIC_ADDRESS    *Address64;
     UINT32                  Address32;
     UINT8                   Length;
@@ -676,9 +677,11 @@ AcpiTbConvertFadt (
                 (!Address64->Address && Length))
             {
                 ACPI_BIOS_WARNING ((AE_INFO,
-                    "Optional FADT field %s has zero address or length: "
-                    "0x%8.8X%8.8X/0x%X",
-                    Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
+                    "Optional FADT field %s has valid %s but zero %s: "
+                    "0x%8.8X%8.8X/0x%X", Name,
+                    (Length ? "Length" : "Address"),
+                    (Length ? "Address": "Length"),
+                    ACPI_FORMAT_UINT64 (Address64->Address), Length));
             }
         }
     }
index d5ae920..32d63ee 100644 (file)
@@ -292,7 +292,7 @@ AcpiTbInstallStandardTable (
         AcpiGbl_DisableSsdtTableInstall &&
         ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT))
     {
-        ACPI_INFO ((AE_INFO,
+        ACPI_INFO ((
             "Ignoring installation of %4.4s at %8.8X%8.8X",
             NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address)));
         goto ReleaseAndExit;
@@ -464,7 +464,7 @@ FinishOverride:
         return;
     }
 
-    ACPI_INFO ((AE_INFO, "%4.4s 0x%8.8X%8.8X"
+    ACPI_INFO (("%4.4s 0x%8.8X%8.8X"
         " %s table override, new table: 0x%8.8X%8.8X",
         OldTableDesc->Signature.Ascii,
         ACPI_FORMAT_UINT64 (OldTableDesc->Address),
index 65ce709..9dab6d9 100644 (file)
@@ -149,7 +149,7 @@ AcpiTbPrintTableHeader (
     {
         /* FACS only has signature and length fields */
 
-        ACPI_INFO ((AE_INFO, "%-4.4s 0x%8.8X%8.8X %06X",
+        ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
             Header->Signature, ACPI_FORMAT_UINT64 (Address),
             Header->Length));
     }
@@ -161,7 +161,7 @@ AcpiTbPrintTableHeader (
             Header)->OemId, ACPI_OEM_ID_SIZE);
         AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
 
-        ACPI_INFO ((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
+        ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
             ACPI_FORMAT_UINT64 (Address),
             (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
                 ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
@@ -174,7 +174,7 @@ AcpiTbPrintTableHeader (
 
         AcpiTbCleanupTableHeader (&LocalHeader, Header);
 
-        ACPI_INFO ((AE_INFO,
+        ACPI_INFO ((
             "%-4.4s 0x%8.8X%8.8X"
             " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
             LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
index 0a34708..3e68d75 100644 (file)
@@ -185,7 +185,7 @@ AcpiTbCopyDsdt (
         ACPI_PTR_TO_PHYSADDR (NewTable),
         ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable);
 
-    ACPI_INFO ((AE_INFO,
+    ACPI_INFO ((
         "Forced DSDT copy: length 0x%05X copied locally, original unmapped",
         NewTable->Length));
 
index 3583e81..645b9d5 100644 (file)
@@ -47,6 +47,7 @@
 #include "accommon.h"
 #include "acnamesp.h"
 #include "actables.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_TABLES
         ACPI_MODULE_NAME    ("tbxfload")
@@ -74,6 +75,25 @@ AcpiLoadTables (
     ACPI_FUNCTION_TRACE (AcpiLoadTables);
 
 
+    /*
+     * Install the default operation region handlers. These are the
+     * handlers that are defined by the ACPI specification to be
+     * "always accessible" -- namely, SystemMemory, SystemIO, and
+     * PCI_Config. This also means that no _REG methods need to be
+     * run for these address spaces. We need to have these handlers
+     * installed before any AML code can be executed, especially any
+     * module-level code (11/2015).
+     * Note that we allow OSPMs to install their own region handlers
+     * between AcpiInitializeSubsystem() and AcpiLoadTables() to use
+     * their customized default region handlers.
+     */
+    Status = AcpiEvInstallRegionHandlers ();
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
+        return_ACPI_STATUS (Status);
+    }
+
     /* Load the namespace from the tables */
 
     Status = AcpiTbLoadNamespace ();
@@ -91,6 +111,22 @@ AcpiLoadTables (
             "While loading namespace from ACPI tables"));
     }
 
+    if (!AcpiGbl_GroupModuleLevelCode)
+    {
+        /*
+         * Initialize the objects that remain uninitialized. This
+         * runs the executable AML that may be part of the
+         * declaration of these objects:
+         * OperationRegions, BufferFields, Buffers, and Packages.
+         */
+        Status = AcpiNsInitializeObjects ();
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
+    }
+
+    AcpiGbl_NamespaceInitialized = TRUE;
     return_ACPI_STATUS (Status);
 }
 
@@ -227,7 +263,7 @@ AcpiTbLoadNamespace (
 
     if (!TablesFailed)
     {
-        ACPI_INFO ((AE_INFO,
+        ACPI_INFO ((
             "%u ACPI AML tables successfully acquired and loaded\n",
             TablesLoaded));
     }
@@ -340,7 +376,7 @@ AcpiLoadTable (
 
     /* Install the table and load it into the namespace */
 
-    ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
+    ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
 
     Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
index 66fa868..049dae8 100644 (file)
@@ -279,7 +279,7 @@ AcpiOsAcquireObject (
     void                    *Object;
 
 
-    ACPI_FUNCTION_NAME (OsAcquireObject);
+    ACPI_FUNCTION_TRACE (OsAcquireObject);
 
 
     if (!Cache)
index ccdca57..b6ae2c7 100644 (file)
 
 #ifdef ACPI_DEBUG_OUTPUT
 
-static ACPI_THREAD_ID       AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
-static char                 *AcpiGbl_FnEntryStr = "----Entry";
-static char                 *AcpiGbl_FnExitStr  = "----Exit-";
-
-/* Local prototypes */
-
-static const char *
-AcpiUtTrimFunctionName (
-    const char              *FunctionName);
+static ACPI_THREAD_ID       AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
+static const char           *AcpiGbl_FunctionEntryPrefix = "----Entry";
+static const char           *AcpiGbl_FunctionExitPrefix  = "----Exit-";
 
 
 /*******************************************************************************
@@ -201,16 +195,16 @@ AcpiDebugPrint (
      * Thread tracking and context switch notification
      */
     ThreadId = AcpiOsGetThreadId ();
-    if (ThreadId != AcpiGbl_PrevThreadId)
+    if (ThreadId != AcpiGbl_PreviousThreadId)
     {
         if (ACPI_LV_THREADS & AcpiDbgLevel)
         {
             AcpiOsPrintf (
                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
-                (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId);
+                (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
         }
 
-        AcpiGbl_PrevThreadId = ThreadId;
+        AcpiGbl_PreviousThreadId = ThreadId;
         AcpiGbl_NestingLevel = 0;
     }
 
@@ -325,7 +319,7 @@ AcpiUtTrace (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s\n", AcpiGbl_FnEntryStr);
+            "%s\n", AcpiGbl_FunctionEntryPrefix);
     }
 }
 
@@ -355,7 +349,7 @@ AcpiUtTracePtr (
     const char              *FunctionName,
     const char              *ModuleName,
     UINT32                  ComponentId,
-    void                    *Pointer)
+    const void              *Pointer)
 {
 
     AcpiGbl_NestingLevel++;
@@ -367,7 +361,7 @@ AcpiUtTracePtr (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
+            "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
     }
 }
 
@@ -395,7 +389,7 @@ AcpiUtTraceStr (
     const char              *FunctionName,
     const char              *ModuleName,
     UINT32                  ComponentId,
-    char                    *String)
+    const char              *String)
 {
 
     AcpiGbl_NestingLevel++;
@@ -407,7 +401,7 @@ AcpiUtTraceStr (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s %s\n", AcpiGbl_FnEntryStr, String);
+            "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
     }
 }
 
@@ -447,7 +441,7 @@ AcpiUtTraceU32 (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
+            "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
     }
 }
 
@@ -482,7 +476,7 @@ AcpiUtExit (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s\n", AcpiGbl_FnExitStr);
+            "%s\n", AcpiGbl_FunctionExitPrefix);
     }
 
     if (AcpiGbl_NestingLevel)
@@ -528,14 +522,14 @@ AcpiUtStatusExit (
         {
             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
                 LineNumber, FunctionName, ModuleName, ComponentId,
-                "%s %s\n", AcpiGbl_FnExitStr,
+                "%s %s\n", AcpiGbl_FunctionExitPrefix,
                 AcpiFormatException (Status));
         }
         else
         {
             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
                 LineNumber, FunctionName, ModuleName, ComponentId,
-                "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
+                "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
                 AcpiFormatException (Status));
         }
     }
@@ -581,7 +575,7 @@ AcpiUtValueExit (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
+            "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
             ACPI_FORMAT_UINT64 (Value));
     }
 
@@ -626,7 +620,7 @@ AcpiUtPtrExit (
     {
         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
-            "%s %p\n", AcpiGbl_FnExitStr, Ptr);
+            "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
     }
 
     if (AcpiGbl_NestingLevel)
index 06817ab..648cc5c 100644 (file)
@@ -506,7 +506,7 @@ AcpiUtGetMutexName (
 
 /* Names for Notify() values, used for debug output */
 
-static const char           *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] =
+static const char           *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] =
 {
     /* 00 */ "Bus Check",
     /* 01 */ "Device Check",
@@ -520,32 +520,35 @@ static const char           *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] =
     /* 09 */ "Device PLD Check",
     /* 0A */ "Reserved",
     /* 0B */ "System Locality Update",
-    /* 0C */ "Shutdown Request",
+    /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */
     /* 0D */ "System Resource Affinity Update"
 };
 
-static const char           *AcpiGbl_DeviceNotify[4] =
+static const char           *AcpiGbl_DeviceNotify[5] =
 {
     /* 80 */ "Status Change",
     /* 81 */ "Information Change",
     /* 82 */ "Device-Specific Change",
-    /* 83 */ "Device-Specific Change"
+    /* 83 */ "Device-Specific Change",
+    /* 84 */ "Reserved"
 };
 
-static const char           *AcpiGbl_ProcessorNotify[4] =
+static const char           *AcpiGbl_ProcessorNotify[5] =
 {
     /* 80 */ "Performance Capability Change",
     /* 81 */ "C-State Change",
     /* 82 */ "Throttling Capability Change",
-    /* 83 */ "Device-Specific Change"
+    /* 83 */ "Guaranteed Change",
+    /* 84 */ "Minimum Excursion"
 };
 
-static const char           *AcpiGbl_ThermalNotify[4] =
+static const char           *AcpiGbl_ThermalNotify[5] =
 {
     /* 80 */ "Thermal Status Change",
     /* 81 */ "Thermal Trip Point Change",
     /* 82 */ "Thermal Device List Change",
-    /* 83 */ "Thermal Relationship Change"
+    /* 83 */ "Thermal Relationship Change",
+    /* 84 */ "Reserved"
 };
 
 
@@ -555,23 +558,23 @@ AcpiUtGetNotifyName (
     ACPI_OBJECT_TYPE        Type)
 {
 
-    /* 00 - 0D are common to all object types */
+    /* 00 - 0D are "common to all object types" (from ACPI Spec) */
 
-    if (NotifyValue <= ACPI_NOTIFY_MAX)
+    if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX)
     {
         return (AcpiGbl_GenericNotify[NotifyValue]);
     }
 
-    /* 0D - 7F are reserved */
+    /* 0E - 7F are reserved */
 
     if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
     {
         return ("Reserved");
     }
 
-    /* 80 - 83 are per-object-type */
+    /* 80 - 84 are per-object-type */
 
-    if (NotifyValue <= 0x83)
+    if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX)
     {
         switch (Type)
         {
index bdde513..d4864f3 100644 (file)
@@ -72,7 +72,7 @@
 ACPI_STATUS
 AcpiUtEvaluateObject (
     ACPI_NAMESPACE_NODE     *PrefixNode,
-    char                    *Path,
+    const char              *Path,
     UINT32                  ExpectedReturnBtypes,
     ACPI_OPERAND_OBJECT     **ReturnDesc)
 {
@@ -219,7 +219,7 @@ Cleanup:
 
 ACPI_STATUS
 AcpiUtEvaluateNumericObject (
-    char                    *ObjectName,
+    const char              *ObjectName,
     ACPI_NAMESPACE_NODE     *DeviceNode,
     UINT64                  *Value)
 {
index ed3a171..0d8dff8 100644 (file)
@@ -87,6 +87,12 @@ const char                  *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] =
 };
 
 
+/* Hex-to-ascii */
+
+const char                  AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
+const char                  AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
+
+
 /*******************************************************************************
  *
  * Namespace globals
@@ -179,6 +185,55 @@ ACPI_FIXED_EVENT_INFO       AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
 };
 #endif /* !ACPI_REDUCED_HARDWARE */
 
+
+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+/* ToPld macro: compile/disassemble strings */
+
+const char              *AcpiGbl_PldPanelList[] =
+{
+    "TOP",
+    "BOTTOM",
+    "LEFT",
+    "RIGHT",
+    "FRONT",
+    "BACK",
+    "UNKNOWN",
+    NULL
+};
+
+const char              *AcpiGbl_PldVerticalPositionList[] =
+{
+    "UPPER",
+    "CENTER",
+    "LOWER",
+    NULL
+};
+
+const char              *AcpiGbl_PldHorizontalPositionList[] =
+{
+    "LEFT",
+    "CENTER",
+    "RIGHT",
+    NULL
+};
+
+const char              *AcpiGbl_PldShapeList[] =
+{
+    "ROUND",
+    "OVAL",
+    "SQUARE",
+    "VERTICALRECTANGLE",
+    "HORIZONTALRECTANGLE",
+    "VERTICALTRAPEZOID",
+    "HORIZONTALTRAPEZOID",
+    "UNKNOWN",
+    "CHAMFERED",
+    NULL
+};
+#endif
+
+
 /* Public globals */
 
 ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
index e35a0ef..ce8f254 100644 (file)
@@ -401,7 +401,7 @@ void
 AcpiUtDisplayInitPathname (
     UINT8                   Type,
     ACPI_NAMESPACE_NODE     *ObjHandle,
-    char                    *Path)
+    const char              *Path)
 {
     ACPI_STATUS             Status;
     ACPI_BUFFER             Buffer;
index 5f45aaa..70fb33e 100644 (file)
@@ -164,22 +164,110 @@ AcpiUtStricmp (
 }
 
 
+#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
+
+
 /*******************************************************************************
  *
  * 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
+ * PARAMETERS:  String                  - Null terminated string
+ *              Base                    - Radix of the string: 16 or 10 or
+ *                                        ACPI_ANY_BASE
+ *              MaxIntegerByteWidth     - Maximum allowable integer,in bytes:
+ *                                        4 or 8 (32 or 64 bits)
+ *              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.
+ *              32-bit or 64-bit conversion, depending on the input integer
+ *              size (often the current mode of the interpreter).
  *
- * NOTE:        Does not support Octal strings, not needed.
+ * NOTES:       Negative numbers are not supported, as they are not supported
+ *              by ACPI.
+ *
+ *              AcpiGbl_IntegerByteWidth should be set to the proper width.
+ *              For the core ACPICA code, this width depends on the DSDT
+ *              version. For iASL, the default byte width is always 8 for the
+ *              parser, but error checking is performed later to flag cases
+ *              where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
+ *
+ *              Does not support Octal strings, not needed at this time.
  *
  ******************************************************************************/
 
@@ -187,25 +275,25 @@ ACPI_STATUS
 AcpiUtStrtoul64 (
     char                    *String,
     UINT32                  Base,
+    UINT32                  MaxIntegerByteWidth,
     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);
+    ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
 
 
     switch (Base)
     {
     case ACPI_ANY_BASE:
+    case 10:
     case 16:
 
         break;
@@ -229,10 +317,10 @@ AcpiUtStrtoul64 (
         String++;
     }
 
-    if (ToIntegerOp)
+    if (Base == ACPI_ANY_BASE)
     {
         /*
-         * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+         * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
          * We need to determine if it is decimal or hexadecimal.
          */
         if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
@@ -253,7 +341,7 @@ AcpiUtStrtoul64 (
 
     if (!(*String) || isspace ((int) *String) || *String == '\t')
     {
-        if (ToIntegerOp)
+        if (Base == ACPI_ANY_BASE)
         {
             goto ErrorExit;
         }
@@ -264,10 +352,11 @@ AcpiUtStrtoul64 (
     }
 
     /*
-     * Perform a 32-bit or 64-bit conversion, depending upon the current
-     * execution mode of the interpreter
+     * Perform a 32-bit or 64-bit conversion, depending upon the input
+     * byte width
      */
-    Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+    Dividend = (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH) ?
+        ACPI_UINT32_MAX : ACPI_UINT64_MAX;
 
     /* Main loop: convert the string to a 32- or 64-bit integer */
 
@@ -302,7 +391,7 @@ AcpiUtStrtoul64 (
 
         if (Term)
         {
-            if (ToIntegerOp)
+            if (Base == ACPI_ANY_BASE)
             {
                 goto ErrorExit;
             }
@@ -320,11 +409,12 @@ AcpiUtStrtoul64 (
 
         ValidDigits++;
 
-        if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
+        if (SignOf0x && ((ValidDigits > 16) ||
+            ((ValidDigits > 8) && (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH))))
         {
             /*
              * This is ToInteger operation case.
-             * No any restrictions for string-to-integer conversion,
+             * No restrictions for string-to-integer conversion,
              * see ACPI spec.
              */
             goto ErrorExit;
@@ -337,7 +427,7 @@ AcpiUtStrtoul64 (
 
         if (ReturnValue > Quotient)
         {
-            if (ToIntegerOp)
+            if (Base == ACPI_ANY_BASE)
             {
                 goto ErrorExit;
             }
@@ -364,7 +454,8 @@ AllDone:
 
 
 ErrorExit:
-    /* Base was set/validated above */
+
+    /* Base was set/validated above (10 or 16) */
 
     if (Base == 10)
     {
@@ -377,77 +468,200 @@ ErrorExit:
 }
 
 
-#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+#ifdef _OBSOLETE_FUNCTIONS
+/* Removed: 01/2016 */
+
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
+ * FUNCTION:    strtoul64
  *
- * PARAMETERS:  Adds a "DestSize" parameter to each of the standard string
- *              functions. This is the size of the Destination buffer.
+ * PARAMETERS:  String              - Null terminated string
+ *              Terminater          - Where a pointer to the terminating byte
+ *                                    is returned
+ *              Base                - Radix of the string
  *
- * RETURN:      TRUE if the operation would overflow the destination buffer.
+ * RETURN:      Converted value
  *
- * 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.
+ * DESCRIPTION: Convert a string into an unsigned value.
  *
  ******************************************************************************/
 
-BOOLEAN
-AcpiUtSafeStrcpy (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source)
+ACPI_STATUS
+strtoul64 (
+    char                    *String,
+    UINT32                  Base,
+    UINT64                  *RetInteger)
 {
+    UINT32                  Index;
+    UINT32                  Sign;
+    UINT64                  ReturnValue = 0;
+    ACPI_STATUS             Status = AE_OK;
 
-    if (strlen (Source) >= DestSize)
+
+    *RetInteger = 0;
+
+    switch (Base)
     {
-        return (TRUE);
+    case 0:
+    case 8:
+    case 10:
+    case 16:
+
+        break;
+
+    default:
+        /*
+         * The specified Base parameter is not in the domain of
+         * this function:
+         */
+        return (AE_BAD_PARAMETER);
     }
 
-    strcpy (Dest, Source);
-    return (FALSE);
-}
+    /* Skip over any white space in the buffer: */
 
-BOOLEAN
-AcpiUtSafeStrcat (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source)
-{
+    while (isspace ((int) *String) || *String == '\t')
+    {
+        ++String;
+    }
 
-    if ((strlen (Dest) + strlen (Source)) >= DestSize)
+    /*
+     * The buffer may contain an optional plus or minus sign.
+     * If it does, then skip over it but remember what is was:
+     */
+    if (*String == '-')
     {
-        return (TRUE);
+        Sign = ACPI_SIGN_NEGATIVE;
+        ++String;
+    }
+    else if (*String == '+')
+    {
+        ++String;
+        Sign = ACPI_SIGN_POSITIVE;
+    }
+    else
+    {
+        Sign = ACPI_SIGN_POSITIVE;
     }
 
-    strcat (Dest, Source);
-    return (FALSE);
-}
+    /*
+     * If the input parameter Base is zero, then we need to
+     * determine if it is octal, decimal, or hexadecimal:
+     */
+    if (Base == 0)
+    {
+        if (*String == '0')
+        {
+            if (tolower ((int) *(++String)) == 'x')
+            {
+                Base = 16;
+                ++String;
+            }
+            else
+            {
+                Base = 8;
+            }
+        }
+        else
+        {
+            Base = 10;
+        }
+    }
 
-BOOLEAN
-AcpiUtSafeStrncat (
-    char                    *Dest,
-    ACPI_SIZE               DestSize,
-    char                    *Source,
-    ACPI_SIZE               MaxTransferLength)
-{
-    ACPI_SIZE               ActualTransferLength;
+    /*
+     * For octal and hexadecimal bases, skip over the leading
+     * 0 or 0x, if they are present.
+     */
+    if (Base == 8 && *String == '0')
+    {
+        String++;
+    }
 
+    if (Base == 16 &&
+        *String == '0' &&
+        tolower ((int) *(++String)) == 'x')
+    {
+        String++;
+    }
 
-    ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source));
+    /* Main loop: convert the string to an unsigned long */
 
-    if ((strlen (Dest) + ActualTransferLength) >= DestSize)
+    while (*String)
     {
-        return (TRUE);
+        if (isdigit ((int) *String))
+        {
+            Index = ((UINT8) *String) - '0';
+        }
+        else
+        {
+            Index = (UINT8) toupper ((int) *String);
+            if (isupper ((int) Index))
+            {
+                Index = Index - 'A' + 10;
+            }
+            else
+            {
+                goto ErrorExit;
+            }
+        }
+
+        if (Index >= Base)
+        {
+            goto ErrorExit;
+        }
+
+        /* Check to see if value is out of range: */
+
+        if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) /
+            (UINT64) Base))
+        {
+            goto ErrorExit;
+        }
+        else
+        {
+            ReturnValue *= Base;
+            ReturnValue += Index;
+        }
+
+        ++String;
     }
 
-    strncat (Dest, Source, MaxTransferLength);
-    return (FALSE);
+
+    /* If a minus sign was present, then "the conversion is negated": */
+
+    if (Sign == ACPI_SIGN_NEGATIVE)
+    {
+        ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
+    }
+
+    *RetInteger = ReturnValue;
+    return (Status);
+
+
+ErrorExit:
+    switch (Base)
+    {
+    case 8:
+
+        Status = AE_BAD_OCTAL_CONSTANT;
+        break;
+
+    case 10:
+
+        Status = AE_BAD_DECIMAL_CONSTANT;
+        break;
+
+    case 16:
+
+        Status = AE_BAD_HEX_CONSTANT;
+        break;
+
+    default:
+
+        /* Base validated above */
+
+        break;
+    }
+
+    return (Status);
 }
 #endif
index 7656924..e01f173 100644 (file)
@@ -88,12 +88,6 @@ AcpiUtPutNumber (
     BOOLEAN                 Upper);
 
 
-/* Module globals */
-
-static const char           AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
-static const char           AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtBoundStringLength
index b5383c8..9efa9d6 100644 (file)
@@ -100,7 +100,7 @@ AcpiUtRemoveAllocation (
 
 ACPI_STATUS
 AcpiUtCreateList (
-    char                    *ListName,
+    const char              *ListName,
     UINT16                  ObjectSize,
     ACPI_MEMORY_LIST        **ReturnCache)
 {
@@ -775,7 +775,7 @@ AcpiUtDumpAllocations (
 
     if (!NumOutstanding)
     {
-        ACPI_INFO ((AE_INFO, "No outstanding allocations"));
+        ACPI_INFO (("No outstanding allocations"));
     }
     else
     {
index 35efd52..e79ffc9 100644 (file)
@@ -205,8 +205,6 @@ ACPI_EXPORT_SYMBOL (AcpiWarning)
 
 void ACPI_INTERNAL_VAR_XFACE
 AcpiInfo (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
     const char              *Format,
     ...)
 {
index 898a75c..2a518bc 100644 (file)
@@ -132,25 +132,6 @@ AcpiInitializeSubsystem (
         return_ACPI_STATUS (Status);
     }
 
-    if (!AcpiGbl_OverrideDefaultRegionHandlers)
-    {
-        /*
-         * Install the default operation region handlers. These are the
-         * handlers that are defined by the ACPI specification to be
-         * "always accessible" -- namely, SystemMemory, SystemIO, and
-         * PCI_Config. This also means that no _REG methods need to be
-         * run for these address spaces. We need to have these handlers
-         * installed before any AML code can be executed, especially any
-         * module-level code (11/2015).
-         */
-        Status = AcpiEvInstallRegionHandlers ();
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
-            return_ACPI_STATUS (Status);
-        }
-    }
-
     return_ACPI_STATUS (AE_OK);
 }
 
@@ -187,26 +168,6 @@ AcpiEnableSubsystem (
      */
     AcpiGbl_EarlyInitialization = FALSE;
 
-    if (AcpiGbl_OverrideDefaultRegionHandlers)
-    {
-        /*
-         * Install the default operation region handlers. These are the
-         * handlers that are defined by the ACPI specification to be
-         * "always accessible" -- namely, SystemMemory, SystemIO, and
-         * PCI_Config. This also means that no _REG methods need to be
-         * run for these address spaces. We need to have these handlers
-         * installed before any AML code can be executed, especially any
-         * module-level code (11/2015).
-         */
-        Status = AcpiEvInstallRegionHandlers ();
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
-            return_ACPI_STATUS (Status);
-        }
-    }
-
-
 #if (!ACPI_REDUCED_HARDWARE)
 
     /* Enable ACPI mode */
@@ -312,25 +273,6 @@ AcpiInitializeObjects (
     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
 
 
-    /*
-     * Run all _REG methods
-     *
-     * Note: Any objects accessed by the _REG methods will be automatically
-     * initialized, even if they contain executable AML (see the call to
-     * AcpiNsInitializeObjects below).
-     */
-    if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
-    {
-        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "[Init] Executing _REG OpRegion methods\n"));
-
-        Status = AcpiEvInitializeOpRegions ();
-        if (ACPI_FAILURE (Status))
-        {
-            return_ACPI_STATUS (Status);
-        }
-    }
-
 #ifdef ACPI_EXEC_APP
     /*
      * This call implements the "initialization file" option for AcpiExec.
@@ -354,35 +296,30 @@ AcpiInitializeObjects (
     if (AcpiGbl_GroupModuleLevelCode)
     {
         AcpiNsExecModuleCodeList ();
-    }
 
-    /*
-     * Initialize the objects that remain uninitialized. This runs the
-     * executable AML that may be part of the declaration of these objects:
-     * OperationRegions, BufferFields, Buffers, and Packages.
-     */
-    if (!(Flags & ACPI_NO_OBJECT_INIT))
-    {
-        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "[Init] Completing Initialization of ACPI Objects\n"));
-
-        Status = AcpiNsInitializeObjects ();
-        if (ACPI_FAILURE (Status))
+        /*
+         * Initialize the objects that remain uninitialized. This
+         * runs the executable AML that may be part of the
+         * declaration of these objects:
+         * OperationRegions, BufferFields, Buffers, and Packages.
+         */
+        if (!(Flags & ACPI_NO_OBJECT_INIT))
         {
-            return_ACPI_STATUS (Status);
+            Status = AcpiNsInitializeObjects ();
+            if (ACPI_FAILURE (Status))
+            {
+                return_ACPI_STATUS (Status);
+            }
         }
     }
 
     /*
-     * Initialize all device objects in the namespace. This runs the device
-     * _STA and _INI methods.
+     * Initialize all device/region objects in the namespace. This runs
+     * the device _STA and _INI methods and region _REG methods.
      */
-    if (!(Flags & ACPI_NO_DEVICE_INIT))
+    if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT)))
     {
-        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "[Init] Initializing ACPI Devices\n"));
-
-        Status = AcpiNsInitializeDevices ();
+        Status = AcpiNsInitializeDevices (Flags);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);