Al Stone afae4e
Patch carried over from the prior iasl package and updated.  This allows
Al Stone f0defa
Al Stone f0defa
From: Al Stone <ahs3@redhat.com>
Al Stone f0defa
Al Stone afae4e
for builds on systems requiring aligned memory access. Please see
Al Stone afae4e
http://lists.acpica.org/pipermail/devel/2010-July/000159.html.  Resolves
Al Stone afae4e
BZ#865013 and BZ#856856.
Al Stone afae4e
--
Al Stone afae4e
Al Stone afae4e
Add more platforms to the list of the ones requiring aligned memory access.
Al Stone afae4e
Also fix callsites where wrong assumptions where made in terms of aligment.
Al Stone afae4e
Al Stone afae4e
Signed-off-by: Mattia Dongili <malattia@linux.it>
Al Stone afae4e
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Al Stone afae4e
---
Al Stone f0defa
 source/compiler/asltree.c             |   15 ++++++++++-----
Al Stone f0defa
 source/components/executer/exoparg2.c |   12 +++++++++---
Al Stone f0defa
 source/include/actypes.h              |   26 +++++++++++++-------------
Al Stone f0defa
 3 files changed, 32 insertions(+), 21 deletions(-)
Al Stone afae4e
Al Stone b8ecc8
Index: acpica-unix2-20160422/source/compiler/asltree.c
Al Stone 7d2a7f
===================================================================
Al Stone b8ecc8
--- acpica-unix2-20160422.orig/source/compiler/asltree.c
Al Stone b8ecc8
+++ acpica-unix2-20160422/source/compiler/asltree.c
Al Stone b8ecc8
@@ -913,28 +913,31 @@ TrCreateValuedLeafNode (
Al Stone 5f1097
         "Op %s  Value %8.8X%8.8X  ",
Al Stone afae4e
         Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
Al Stone afae4e
         ACPI_FORMAT_UINT64 (Value));
Al Stone afae4e
-    Op->Asl.Value.Integer = Value;
Al Stone afae4e
 
Al Stone afae4e
     switch (ParseOpcode)
Al Stone afae4e
     {
Al Stone afae4e
     case PARSEOP_STRING_LITERAL:
Al Stone 938de5
 
Al Stone afae4e
-        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
Al Stone afae4e
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
Al Stone afae4e
+        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Op->Asl.Value.String);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case PARSEOP_NAMESEG:
Al Stone 938de5
 
Al Stone afae4e
-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
Al Stone afae4e
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
Al Stone afae4e
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Op->Asl.Value.String);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case PARSEOP_NAMESTRING:
Al Stone 938de5
 
Al Stone afae4e
-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
Al Stone afae4e
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
Al Stone afae4e
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Op->Asl.Value.String);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case PARSEOP_EISAID:
Al Stone 938de5
 
Al Stone afae4e
-        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
Al Stone afae4e
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
Al Stone afae4e
+        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Op->Asl.Value.String);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case PARSEOP_METHOD:
Al Stone b8ecc8
@@ -944,12 +947,14 @@ TrCreateValuedLeafNode (
Al Stone afae4e
 
Al Stone afae4e
     case PARSEOP_INTEGER:
Al Stone 938de5
 
Al Stone afae4e
+        Op->Asl.Value.Integer = Value;
Al Stone 938de5
         DbgPrint (ASL_PARSE_OUTPUT, "INTEGER->%8.8X%8.8X",
Al Stone 938de5
             ACPI_FORMAT_UINT64 (Value));
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     default:
Al Stone 938de5
 
Al Stone afae4e
+        Op->Asl.Value.Integer = Value;
Al Stone afae4e
         break;
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone b8ecc8
Index: acpica-unix2-20160422/source/components/executer/exoparg2.c
Al Stone 7d2a7f
===================================================================
Al Stone b8ecc8
--- acpica-unix2-20160422.orig/source/components/executer/exoparg2.c
Al Stone b8ecc8
+++ acpica-unix2-20160422/source/components/executer/exoparg2.c
Al Stone 938de5
@@ -172,6 +172,8 @@ AcpiExOpcode_2A_2T_1R (
Al Stone afae4e
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
Al Stone afae4e
     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
Al Stone afae4e
     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
Al Stone afae4e
+    UINT64                  ReturnValue1 = 0;
Al Stone afae4e
+    UINT64                  ReturnValue2 = 0;
Al Stone afae4e
     ACPI_STATUS             Status;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 5f1097
@@ -206,8 +208,10 @@ AcpiExOpcode_2A_2T_1R (
Al Stone 5f1097
         Status = AcpiUtDivide (
Al Stone 5f1097
             Operand[0]->Integer.Value,
Al Stone 5f1097
             Operand[1]->Integer.Value,
Al Stone 5f1097
-            &ReturnDesc1->Integer.Value,
Al Stone 5f1097
-            &ReturnDesc2->Integer.Value);
Al Stone 5f1097
+            &ReturnValue1, &ReturnValue2);
Al Stone afae4e
+        ReturnDesc1->Integer.Value = ReturnValue1;
Al Stone afae4e
+        ReturnDesc2->Integer.Value = ReturnValue2;
Al Stone afae4e
+
Al Stone afae4e
         if (ACPI_FAILURE (Status))
Al Stone afae4e
         {
Al Stone afae4e
             goto Cleanup;
Al Stone 5f1097
@@ -282,6 +286,7 @@ AcpiExOpcode_2A_1T_1R (
Al Stone afae4e
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
Al Stone afae4e
     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
Al Stone afae4e
     UINT64                  Index;
Al Stone afae4e
+    UINT64                  ReturnValue = 0;
Al Stone afae4e
     ACPI_STATUS             Status = AE_OK;
Al Stone afae4e
     ACPI_SIZE               Length = 0;
Al Stone afae4e
 
Al Stone 5f1097
@@ -327,7 +332,8 @@ AcpiExOpcode_2A_1T_1R (
Al Stone 5f1097
             Operand[0]->Integer.Value,
Al Stone 5f1097
             Operand[1]->Integer.Value,
Al Stone 5f1097
             NULL,
Al Stone 5f1097
-            &ReturnDesc->Integer.Value);
Al Stone 5f1097
+            &ReturnValue);
Al Stone afae4e
+        ReturnDesc->Integer.Value = ReturnValue;
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
Al Stone b8ecc8
Index: acpica-unix2-20160422/source/include/actypes.h
Al Stone 7d2a7f
===================================================================
Al Stone b8ecc8
--- acpica-unix2-20160422.orig/source/include/actypes.h
Al Stone b8ecc8
+++ acpica-unix2-20160422/source/include/actypes.h
Al Stone dab6ca
@@ -143,6 +143,19 @@ typedef COMPILER_DEPENDENT_INT64
Al Stone afae4e
  */
Al Stone afae4e
 #define ACPI_THREAD_ID                  UINT64
Al Stone afae4e
 
Al Stone afae4e
+/*
Al Stone afae4e
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
Al Stone afae4e
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
Al Stone afae4e
+ * to indicate that special precautions must be taken to avoid alignment faults.
Al Stone afae4e
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
Al Stone afae4e
+ *
Al Stone afae4e
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
Al Stone afae4e
+ * so there is no need to define this flag.
Al Stone afae4e
+ */
Al Stone afae4e
+#if defined (__IA64__) || defined (__ia64__) || defined(__alpha__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__)
Al Stone afae4e
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
Al Stone afae4e
+#endif
Al Stone afae4e
+
Al Stone afae4e
 
Al Stone afae4e
 /*******************************************************************************
Al Stone afae4e
  *
Al Stone dab6ca
@@ -169,19 +182,6 @@ typedef UINT64
Al Stone afae4e
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
Al Stone afae4e
 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
Al Stone afae4e
 
Al Stone afae4e
-/*
Al Stone afae4e
- * In the case of the Itanium Processor Family (IPF), the hardware does not
Al Stone afae4e
- * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
Al Stone afae4e
- * to indicate that special precautions must be taken to avoid alignment faults.
Al Stone afae4e
- * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
Al Stone afae4e
- *
Al Stone afae4e
- * Note: EM64T and other X86-64 processors support misaligned transfers,
Al Stone afae4e
- * so there is no need to define this flag.
Al Stone afae4e
- */
Al Stone afae4e
-#if defined (__IA64__) || defined (__ia64__)
Al Stone afae4e
-#define ACPI_MISALIGNMENT_NOT_SUPPORTED
Al Stone afae4e
-#endif
Al Stone afae4e
-
Al Stone afae4e
 
Al Stone afae4e
 /*******************************************************************************
Al Stone afae4e
  *