summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/executer/exmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/executer/exmisc.c')
-rw-r--r--sys/contrib/dev/acpica/components/executer/exmisc.c286
1 files changed, 8 insertions, 278 deletions
diff --git a/sys/contrib/dev/acpica/components/executer/exmisc.c b/sys/contrib/dev/acpica/components/executer/exmisc.c
index d4e1a3b..1ba30f4 100644
--- a/sys/contrib/dev/acpica/components/executer/exmisc.c
+++ b/sys/contrib/dev/acpica/components/executer/exmisc.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,6 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acinterp.h>
#include <contrib/dev/acpica/include/amlcode.h>
-#include <contrib/dev/acpica/include/amlresrc.h>
#define _COMPONENT ACPI_EXECUTER
@@ -107,9 +106,9 @@ AcpiExGetObjectReference (
default:
- ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
+ ACPI_ERROR ((AE_INFO, "Invalid Reference Class 0x%2.2X",
ObjDesc->Reference.Class));
- return_ACPI_STATUS (AE_AML_INTERNAL);
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
@@ -150,275 +149,6 @@ AcpiExGetObjectReference (
/*******************************************************************************
*
- * FUNCTION: AcpiExConcatTemplate
- *
- * PARAMETERS: Operand0 - First source object
- * Operand1 - Second source object
- * ActualReturnDesc - Where to place the return object
- * WalkState - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Concatenate two resource templates
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExConcatTemplate (
- ACPI_OPERAND_OBJECT *Operand0,
- ACPI_OPERAND_OBJECT *Operand1,
- ACPI_OPERAND_OBJECT **ActualReturnDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ReturnDesc;
- UINT8 *NewBuf;
- UINT8 *EndTag;
- ACPI_SIZE Length0;
- ACPI_SIZE Length1;
- ACPI_SIZE NewLength;
-
-
- ACPI_FUNCTION_TRACE (ExConcatTemplate);
-
-
- /*
- * Find the EndTag descriptor in each resource template.
- * Note1: returned pointers point TO the EndTag, not past it.
- * Note2: zero-length buffers are allowed; treated like one EndTag
- */
-
- /* Get the length of the first resource template */
-
- Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
-
- /* Get the length of the second resource template */
-
- Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
-
- /* Combine both lengths, minimum size will be 2 for EndTag */
-
- NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
-
- /* Create a new buffer object for the result (with one EndTag) */
-
- ReturnDesc = AcpiUtCreateBufferObject (NewLength);
- if (!ReturnDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Copy the templates to the new buffer, 0 first, then 1 follows. One
- * EndTag descriptor is copied from Operand1.
- */
- NewBuf = ReturnDesc->Buffer.Pointer;
- ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0);
- ACPI_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;
- 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:
-
- Status = AcpiExConvertToString (Operand1, &LocalOperand1,
- ACPI_IMPLICIT_CONVERT_HEX);
- 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 */
-
- ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value,
- AcpiGbl_IntegerByteWidth);
-
- /* Copy the second integer (LSB first) after the first */
-
- ACPI_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 */
-
- ACPI_STRCPY (NewBuf, Operand0->String.Pointer);
- ACPI_STRCPY (NewBuf + Operand0->String.Length,
- 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 */
-
- ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer,
- Operand0->Buffer.Length);
- ACPI_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
*
* PARAMETERS: Opcode - AML opcode
@@ -635,8 +365,8 @@ AcpiExDoLogicalOp (
case ACPI_TYPE_STRING:
- Status = AcpiExConvertToString (Operand1, &LocalOperand1,
- ACPI_IMPLICIT_CONVERT_HEX);
+ Status = AcpiExConvertToString (
+ Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX);
break;
case ACPI_TYPE_BUFFER:
@@ -712,9 +442,9 @@ AcpiExDoLogicalOp (
/* Lexicographic compare: compare the data bytes */
- Compare = ACPI_MEMCMP (Operand0->Buffer.Pointer,
- LocalOperand1->Buffer.Pointer,
- (Length0 > Length1) ? Length1 : Length0);
+ Compare = memcmp (Operand0->Buffer.Pointer,
+ LocalOperand1->Buffer.Pointer,
+ (Length0 > Length1) ? Length1 : Length0);
switch (Opcode)
{
OpenPOWER on IntegriCloud