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
{
if (WalkState)
{
- ACPI_INFO ((AE_INFO,
+ ACPI_INFO ((
"Marking method %4.4s as Serialized "
"because of AE_ALREADY_EXISTS error",
WalkState->MethodNode->Name.Ascii));
Arg = Arg->Common.Next;
}
- ACPI_INFO ((AE_INFO,
+ ACPI_INFO ((
"Actual Package length (%u) is larger than "
"NumElements field (%u), truncated",
i, ElementCount));
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))));
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);
/* Run the _REG methods for OpRegions in each default address space */
- AcpiGbl_RegMethodsEnabled = TRUE;
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
/*
}
-/*******************************************************************************
- *
- * 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
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);
}
return_ACPI_STATUS (AE_OK);
}
- AcpiEvAssociateRegMethod (RegionObj);
RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
Node = RegionObj->Region.Node->Parent;
--- /dev/null
+/******************************************************************************
+ *
+ * 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);
+}
/* Execute any module-level code that was found in the table */
AcpiExExitInterpreter ();
- AcpiNsExecModuleCodeList ();
+ if (AcpiGbl_GroupModuleLevelCode)
+ {
+ AcpiNsExecModuleCodeList ();
+ }
AcpiExEnterInterpreter ();
/*
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);
}
/* 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),
* 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);
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 (
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;
case ACPI_EXD_REFERENCE:
- ReferenceName = AcpiUtGetReferenceName (ObjDesc);
- AcpiExOutString (
- "Class Name", ACPI_CAST_PTR (char, ReferenceName));
+ AcpiExOutString ("Class Name", AcpiUtGetReferenceName (ObjDesc));
AcpiExDumpReferenceObj (ObjDesc);
break;
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);
}
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "amlresrc.h"
#define _COMPONENT ACPI_EXECUTER
}
-/*******************************************************************************
- *
- * 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
* 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;
/* Reacquire the interpreter */
- AcpiExEnterInterpreter ();
+ AcpiExEnterInterpreter ();
}
return_ACPI_STATUS (Status);
*
* 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
*
* 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
* 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
*
* 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.
*
UINT8 MaxBitWidth,
UINT64 *Address)
{
+ UINT8 BitWidth;
+ UINT8 AccessWidth;
+
/* Must have a valid pointer to a GAS structure */
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);
* 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.
*
******************************************************************************/
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
+ UINT8 AccessWidth;
+ UINT32 BitWidth;
+ UINT8 BitOffset;
UINT64 Value64;
+ UINT32 Value32;
+ UINT8 Index;
ACPI_STATUS Status;
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);
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
+ UINT8 AccessWidth;
+ UINT32 BitWidth;
+ UINT8 BitOffset;
+ UINT64 Value64;
+ UINT32 NewValue32, OldValue32;
+ UINT8 Index;
ACPI_STATUS Status;
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);
* 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))
* 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
*
* 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
*
typedef struct acpi_db_command_info
{
- char *Name; /* Command Name */
+ const char *Name; /* Command Name */
UINT8 MinArgs; /* Minimum arguments required */
} ACPI_DB_COMMAND_INFO;
typedef struct acpi_db_argument_info
{
- char *Name; /* Argument Name */
+ const char *Name; /* Argument Name */
} ACPI_DB_ARGUMENT_INFO;
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[];
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[];
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 (
void
AcpiDmVendorCommon (
- char *Name,
+ const char *Name,
UINT8 *ByteData,
UINT32 Length,
UINT32 Level);
ACPI_OPERAND_OBJECT *RegionObj,
BOOLEAN AcpiNsIsLocked);
-void
-AcpiEvAssociateRegMethod (
- ACPI_OPERAND_OBJECT *RegionObj);
-
void
AcpiEvExecuteRegMethods (
ACPI_NAMESPACE_NODE *Node,
ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth);
ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth);
-ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE);
-
/*****************************************************************************
*
/* Initialization sequencing */
-ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_RegMethodsEnabled, FALSE);
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE);
/* Misc */
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];
#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
/*****************************************************************************
*
{
UINT8 Opcode;
UINT8 Offset;
- char *Name;
+ const char *Name;
} ACPI_EXDUMP_INFO;
#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 */
#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 */
#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
#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.
ACPI_STATUS
AcpiNsInitializeDevices (
- void);
+ UINT32 Flags);
/*
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 (
#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__.
AcpiPsGetOpcodeInfo (
UINT16 Opcode);
-char *
+const char *
AcpiPsGetOpcodeName (
UINT16 Opcode);
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20160108
+#define ACPI_CA_VERSION 0x20160318
#include "acconfig.h"
#include "actypes.h"
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
...))
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,
...))
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),
{{"_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
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}},
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
{
UINT8 Opcode;
UINT8 Offset;
- char *Name;
+ const char *Name;
const char **Pointer;
} ACPI_RSDUMP_INFO;
ACPI_STATUS
AcpiRsGetMethodData (
ACPI_HANDLE Handle,
- char *Path,
+ const char *Path,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
/* 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) */
/*******************************************************************************
*
* FADT - Fixed ACPI Description Table (Signature "FACP")
- * Version 4
+ * Version 6
*
******************************************************************************/
#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__ */
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 */
};
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 */
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 */
};
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 */
} 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
} 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)
+
/*******************************************************************************
*
/*******************************************************************************
*
- * NFIT - NVDIMM Interface Table (ACPI 6.0)
+ * NFIT - NVDIMM Interface Table (ACPI 6.0+)
* Version 1
*
******************************************************************************/
#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 */
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;
/* 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 */
* 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
*
******************************************************************************/
#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
* Version 1
*
* Conforms to "Intel Virtualization Technology for Directed I/O",
- * Version 2.2, Sept. 2013
+ * Version 2.3, October 2014
*
******************************************************************************/
/* 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 */
* 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
*
******************************************************************************/
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
};
#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
/*******************************************************************************
*
* 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
*
******************************************************************************/
#define ACPI_SPCR_DO_NOT_DISABLE (1)
+/* Values for Interface Type: See the definition of the DBG2 table */
+
/*******************************************************************************
*
} ACPI_TABLE_FPDT;
-/* FPDT subtable header */
+/* FPDT subtable header (Performance Record Structure) */
typedef struct acpi_fpdt_header
{
/* 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
{
/*
- * 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;
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)
#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
*/
typedef struct acpi_predefined_names
{
- char *Name;
+ const char *Name;
UINT8 Type;
char *Val;
*/
typedef struct acpi_memory_list
{
- char *ListName;
+ const char *ListName;
void *ListHead;
UINT16 ObjectSize;
UINT16 MaxDepth;
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
const char *FunctionName,
const char *ModuleName,
UINT32 ComponentId,
- void *Pointer);
+ const void *Pointer);
void
AcpiUtTraceU32 (
const char *FunctionName,
const char *ModuleName,
UINT32 ComponentId,
- char *String);
+ const char *String);
void
AcpiUtExit (
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);
AcpiUtDisplayInitPathname (
UINT8 Type,
ACPI_NAMESPACE_NODE *ObjHandle,
- char *Path);
+ const char *Path);
#endif
ACPI_STATUS
AcpiUtCreateList (
- char *ListName,
+ const char *ListName,
UINT16 ObjectSize,
ACPI_MEMORY_LIST **ReturnCache);
*
*****************************************************************************/
+/* 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 */
--- /dev/null
+/******************************************************************************
+ *
+ * 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__ */
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))
/* 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);
void
AcpiNsPrintPathname (
UINT32 NumSegments,
- char *Pathname)
+ const char *Pathname)
{
UINT32 i;
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/* Not used at this time, perhaps later */
+
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpPathname
void
AcpiNsDumpPathname (
ACPI_HANDLE Handle,
- char *Msg,
+ const char *Msg,
UINT32 Level,
UINT32 Component)
{
AcpiOsPrintf ("\n");
return_VOID;
}
-
+#endif
/*******************************************************************************
*
AcpiUtRemoveReference (Prev);
}
- ACPI_INFO ((AE_INFO,
+ ACPI_INFO ((
"Executed %u blocks of module-level executable AML code",
MethodCount));
#include "acnamesp.h"
#include "acdispat.h"
#include "acinterp.h"
+#include "acevents.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsinit")
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,
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);
* 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 */
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
AcpiNsDeleteNamespaceByOwner (
AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
- AcpiTbReleaseOwnerId (TableIndex);
+ AcpiTbReleaseOwnerId (TableIndex);
return_ACPI_STATUS (Status);
}
{
return (Status);
}
+
Elements++;
}
break;
return (Status);
}
}
+
Elements++;
}
break;
while (Count > 0)
{
Status = AcpiNsCheckObjectType(Info, Elements,
- Package->RetInfo.ObjectType1, 0);
+ Package->RetInfo.ObjectType1, 0);
if (ACPI_FAILURE(Status))
{
return (Status);
}
Status = AcpiNsCheckObjectType(Info, Elements + 1,
- Package->RetInfo.ObjectType2, 0);
+ Package->RetInfo.ObjectType2, 0);
if (ACPI_FAILURE(Status))
{
return (Status);
Elements += 2;
Count -= 2;
- }
- break;
+ }
+ break;
default:
/* 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);
}
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);
}
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);
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);
/* 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);
* 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);
{
goto PackageTooSmall;
}
+
if (SubPackage->Package.Count < Package->RetInfo.Count1)
{
ExpectedCount = Package->RetInfo.Count1;
goto PackageTooSmall;
}
+
if (ExpectedCount == 0)
{
/*
/* 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);
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++;
}
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,
*
* 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.
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);
*
******************************************************************************/
-char *
+const char *
AcpiPsGetOpcodeName (
UINT16 Opcode)
{
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 (
{
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) */
if (Table->Pointer)
{
- AcpiRsOutString (Name, ACPI_CAST_PTR (char,
- Table->Pointer [*Target]));
+ AcpiRsOutString (Name, Table->Pointer [*Target]);
}
else
{
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:
static void
AcpiRsOutString (
- char *Title,
- char *Value)
+ const char *Title,
+ const char *Value)
{
AcpiOsPrintf ("%27s : %s", Title, Value);
static void
AcpiRsOutInteger8 (
- char *Title,
+ const char *Title,
UINT8 Value)
{
AcpiOsPrintf ("%27s : %2.2X\n", Title, 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)
{
AcpiOsPrintf ("%27s : ", Title);
ACPI_STATUS
AcpiRsGetMethodData (
ACPI_HANDLE Handle,
- char *Path,
+ const char *Path,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
UINT8 SpaceId,
UINT8 ByteWidth,
UINT64 Address,
- char *RegisterName,
+ const char *RegisterName,
UINT8 Flags);
static void
typedef struct acpi_fadt_info
{
- char *Name;
+ const char *Name;
UINT16 Address64;
UINT16 Address32;
UINT16 Length;
UINT8 SpaceId,
UINT8 ByteWidth,
UINT64 Address,
- char *RegisterName,
+ const char *RegisterName,
UINT8 Flags)
{
UINT8 BitWidth;
/*
* 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 */
AcpiTbConvertFadt (
void)
{
- char *Name;
+ const char *Name;
ACPI_GENERIC_ADDRESS *Address64;
UINT32 Address32;
UINT8 Length;
(!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));
}
}
}
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;
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),
{
/* 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));
}
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,
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),
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));
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
+#include "acevents.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxfload")
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 ();
"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);
}
if (!TablesFailed)
{
- ACPI_INFO ((AE_INFO,
+ ACPI_INFO ((
"%u ACPI AML tables successfully acquired and loaded\n",
TablesLoaded));
}
/* 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),
void *Object;
- ACPI_FUNCTION_NAME (OsAcquireObject);
+ ACPI_FUNCTION_TRACE (OsAcquireObject);
if (!Cache)
#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-";
/*******************************************************************************
* 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;
}
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s\n", AcpiGbl_FnEntryStr);
+ "%s\n", AcpiGbl_FunctionEntryPrefix);
}
}
const char *FunctionName,
const char *ModuleName,
UINT32 ComponentId,
- void *Pointer)
+ const void *Pointer)
{
AcpiGbl_NestingLevel++;
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
+ "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
}
}
const char *FunctionName,
const char *ModuleName,
UINT32 ComponentId,
- char *String)
+ const char *String)
{
AcpiGbl_NestingLevel++;
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s %s\n", AcpiGbl_FnEntryStr, String);
+ "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
}
}
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
+ "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
}
}
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s\n", AcpiGbl_FnExitStr);
+ "%s\n", AcpiGbl_FunctionExitPrefix);
}
if (AcpiGbl_NestingLevel)
{
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));
}
}
{
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));
}
{
AcpiDebugPrint (ACPI_LV_FUNCTIONS,
LineNumber, FunctionName, ModuleName, ComponentId,
- "%s %p\n", AcpiGbl_FnExitStr, Ptr);
+ "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
}
if (AcpiGbl_NestingLevel)
/* 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",
/* 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"
};
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)
{
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)
{
};
+/* Hex-to-ascii */
+
+const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
+const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
+
+
/*******************************************************************************
*
* Namespace globals
};
#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)
AcpiUtDisplayInitPathname (
UINT8 Type,
ACPI_NAMESPACE_NODE *ObjHandle,
- char *Path)
+ const char *Path)
{
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
}
+#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.
*
******************************************************************************/
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;
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'))
if (!(*String) || isspace ((int) *String) || *String == '\t')
{
- if (ToIntegerOp)
+ if (Base == ACPI_ANY_BASE)
{
goto ErrorExit;
}
}
/*
- * 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 */
if (Term)
{
- if (ToIntegerOp)
+ if (Base == ACPI_ANY_BASE)
{
goto ErrorExit;
}
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;
if (ReturnValue > Quotient)
{
- if (ToIntegerOp)
+ if (Base == ACPI_ANY_BASE)
{
goto ErrorExit;
}
ErrorExit:
- /* Base was set/validated above */
+
+ /* Base was set/validated above (10 or 16) */
if (Base == 10)
{
}
-#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
BOOLEAN Upper);
-/* Module globals */
-
-static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
-static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
-
-
/*******************************************************************************
*
* FUNCTION: AcpiUtBoundStringLength
ACPI_STATUS
AcpiUtCreateList (
- char *ListName,
+ const char *ListName,
UINT16 ObjectSize,
ACPI_MEMORY_LIST **ReturnCache)
{
if (!NumOutstanding)
{
- ACPI_INFO ((AE_INFO, "No outstanding allocations"));
+ ACPI_INFO (("No outstanding allocations"));
}
else
{
void ACPI_INTERNAL_VAR_XFACE
AcpiInfo (
- const char *ModuleName,
- UINT32 LineNumber,
const char *Format,
...)
{
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);
}
*/
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 */
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.
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);