[ACPICA] Update to version 20191213. CORE-16559
authorThomas Faber <thomas.faber@reactos.org>
Sat, 14 Dec 2019 08:04:07 +0000 (09:04 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 14 Dec 2019 08:48:11 +0000 (09:48 +0100)
drivers/bus/acpi/acpica/dispatcher/dsfield.c
drivers/bus/acpi/acpica/dispatcher/dsopcode.c
drivers/bus/acpi/acpica/dispatcher/dswload.c
drivers/bus/acpi/acpica/executer/exfield.c
drivers/bus/acpi/acpica/hardware/hwxfsleep.c
drivers/bus/acpi/acpica/include/acobject.h
drivers/bus/acpi/acpica/include/acpixf.h
drivers/bus/acpi/acpica/include/platform/acenv.h

index 4c3c7ff..4d7280a 100644 (file)
@@ -305,7 +305,7 @@ Cleanup:
  * FUNCTION:    AcpiDsGetFieldNames
  *
  * PARAMETERS:  Info            - CreateField info structure
- *  `           WalkState       - Current method state
+ *              WalkState       - Current method state
  *              Arg             - First parser arg for the field name list
  *
  * RETURN:      Status
index 1d35c5b..b680bb7 100644 (file)
@@ -266,6 +266,7 @@ AcpiDsInitBufferField (
     }
 
     ObjDesc->BufferField.BufferObj = BufferDesc;
+    ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
 
     /* Reference count for BufferDesc inherits ObjDesc count */
 
index bc99b2b..8badd9f 100644 (file)
@@ -459,6 +459,28 @@ AcpiDsLoad1EndOp (
     Op = WalkState->Op;
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
 
+    /*
+     * Disassembler: handle create field operators here.
+     *
+     * CreateBufferField is a deferred op that is typically processed in load
+     * pass 2. However, disassembly of control method contents walk the parse
+     * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed
+     * in a later walk. This is a problem when there is a control method that
+     * has the same name as the AML_CREATE object. In this case, any use of the
+     * name segment will be detected as a method call rather than a reference
+     * to a buffer field.
+     *
+     * This earlier creation during disassembly solves this issue by inserting
+     * the named object in the ACPI namespace so that references to this name
+     * would be a name string rather than a method call.
+     */
+    if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) &&
+        (WalkState->OpInfo->Flags & AML_CREATE))
+    {
+        Status = AcpiDsCreateBufferField (Op, WalkState);
+        return_ACPI_STATUS (Status);
+    }
+
     /* We are only interested in opcodes that have an associated name */
 
     if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
index f4c4139..70e73ba 100644 (file)
@@ -138,7 +138,8 @@ AcpiExGetProtocolBufferLength (
  * RETURN:      Status
  *
  * DESCRIPTION: Read from a named field. Returns either an Integer or a
- *              Buffer, depending on the size of the field.
+ *              Buffer, depending on the size of the field and whether if a
+ *              field is created by the CreateField() operator.
  *
  ******************************************************************************/
 
@@ -202,12 +203,17 @@ AcpiExReadDataFromField (
      * the use of arithmetic operators on the returned value if the
      * field size is equal or smaller than an Integer.
      *
+     * However, all buffer fields created by CreateField operator needs to
+     * remain as a buffer to match other AML interpreter implementations.
+     *
      * Note: Field.length is in bits.
      */
     BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (
         ObjDesc->Field.BitLength);
 
-    if (BufferLength > AcpiGbl_IntegerByteWidth)
+    if (BufferLength > AcpiGbl_IntegerByteWidth ||
+        (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD &&
+        ObjDesc->BufferField.IsCreateField))
     {
         /* Field is too large for an Integer, create a Buffer instead */
 
index d1c35c5..401ed18 100644 (file)
@@ -84,7 +84,7 @@ static ACPI_SLEEP_FUNCTIONS         AcpiSleepDispatch[] =
                        ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep)),
      ACPI_STRUCT_INIT (ExtendedFunction,
                        AcpiHwExtendedWakePrep) },
-    {ACPI_STRUCT_INIT (Legacy_function,
+    {ACPI_STRUCT_INIT (LegacyFunction,
                        ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake)),
      ACPI_STRUCT_INIT (ExtendedFunction,
                        AcpiHwExtendedWake) }
index 45f0983..8fe0897 100644 (file)
@@ -381,6 +381,7 @@ typedef struct acpi_object_buffer_field
 {
     ACPI_OBJECT_COMMON_HEADER
     ACPI_COMMON_FIELD_INFO
+    BOOLEAN                         IsCreateField;      /* Special case for objects created by CreateField() */
     union acpi_operand_object       *BufferObj;         /* Containing Buffer object */
 
 } ACPI_OBJECT_BUFFER_FIELD;
index bf88d56..c1d46e6 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20191018
+#define ACPI_CA_VERSION                 0x20191213
 
 #include "acconfig.h"
 #include "actypes.h"
index a6b5ab1..d81b91c 100644 (file)
 #define ACPI_DISASSEMBLER 1
 #endif
 
+/*
+ * acpisrc CR\LF support
+ * Unix file line endings do not include the carriage return.
+ * If the acpisrc utility is being built using a microsoft compiler, it means
+ * that it will be running on a windows machine which means that the output is
+ * expected to have CR/LF newlines. If the acpisrc utility is built with
+ * anything else, it will likely run on a system with LF newlines. This flag
+ * tells the acpisrc utility that newlines will be in the LF format.
+ */
+#if defined(ACPI_SRC_APP) && !defined(_MSC_VER)
+#define ACPI_SRC_OS_LF_ONLY 1
+#else
+#define ACPI_SRC_OS_LF_ONLY 0
+#endif
+
 /*! [Begin] no source code translation */
 
 /******************************************************************************