Al Stone afae4e
Patch carried over from the prior iasl package and updated.  This allows
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 afae4e
 source/compiler/asltree.c             | 15 ++++++++++-----
Al Stone afae4e
 source/components/executer/exoparg2.c | 12 +++++++++---
Al Stone afae4e
 source/include/actypes.h              | 26 +++++++++++++-------------
Al Stone afae4e
 3 file modificati, 32 inserzioni(+), 21 rimozioni(-)
Al Stone afae4e
Al Stone d2e646
Index: acpica-unix2-20150930/source/compiler/asltree.c
Al Stone 938de5
===================================================================
Al Stone d2e646
--- acpica-unix2-20150930.orig/source/compiler/asltree.c
Al Stone d2e646
+++ acpica-unix2-20150930/source/compiler/asltree.c
Al Stone d2e646
@@ -863,28 +863,31 @@ TrCreateValuedLeafNode (
Al Stone afae4e
         "\nCreateValuedLeafNode  Ln/Col %u/%u NewNode %p  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 d2e646
@@ -894,12 +897,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 d2e646
Index: acpica-unix2-20150930/source/components/executer/exoparg2.c
Al Stone 938de5
===================================================================
Al Stone d2e646
--- acpica-unix2-20150930.orig/source/components/executer/exoparg2.c
Al Stone d2e646
+++ acpica-unix2-20150930/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 938de5
@@ -205,8 +207,10 @@ AcpiExOpcode_2A_2T_1R (
Al Stone afae4e
 
Al Stone afae4e
         Status = AcpiUtDivide (Operand[0]->Integer.Value,
Al Stone afae4e
                                Operand[1]->Integer.Value,
Al Stone afae4e
-                               &ReturnDesc1->Integer.Value,
Al Stone afae4e
-                               &ReturnDesc2->Integer.Value);
Al Stone afae4e
+                               &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 938de5
@@ -280,6 +284,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 938de5
@@ -323,7 +328,8 @@ AcpiExOpcode_2A_1T_1R (
Al Stone afae4e
         Status = AcpiUtDivide (Operand[0]->Integer.Value,
Al Stone afae4e
                                Operand[1]->Integer.Value,
Al Stone afae4e
                                NULL,
Al Stone afae4e
-                               &ReturnDesc->Integer.Value);
Al Stone afae4e
+                               &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 d2e646
Index: acpica-unix2-20150930/source/include/actypes.h
Al Stone 938de5
===================================================================
Al Stone d2e646
--- acpica-unix2-20150930.orig/source/include/actypes.h
Al Stone d2e646
+++ acpica-unix2-20150930/source/include/actypes.h
Al Stone 938de5
@@ -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 938de5
@@ -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
  *