aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro/recipes-extra/acpica/files/debian-unaligned.patch
blob: 31b9fe56e8f0a27c46b138c292e0dd9c6a565024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Patch carried over from the prior iasl package and updated.  This allows
for builds on systems requiring aligned memory access. Please see
http://lists.acpica.org/pipermail/devel/2010-July/000159.html.  Resolves
BZ#865013 and BZ#856856.
--

Add more platforms to the list of the ones requiring aligned memory access.
Also fix callsites where wrong assumptions where made in terms of aligment.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 source/compiler/asltree.c             | 15 ++++++++++-----
 source/components/executer/exoparg2.c | 12 +++++++++---
 source/include/actypes.h              | 26 +++++++++++++-------------
 3 file modificati, 32 inserzioni(+), 21 rimozioni(-)

diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c
index ebf87f3..fd859d7 100644
--- a/source/compiler/asltree.c
+++ b/source/compiler/asltree.c
@@ -577,28 +577,31 @@ TrCreateValuedLeafNode (
         "\nCreateValuedLeafNode  Ln/Col %u/%u NewNode %p  Op %s  Value %8.8X%8.8X  ",
         Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
         ACPI_FORMAT_UINT64 (Value));
-    Op->Asl.Value.Integer = Value;
 
     switch (ParseOpcode)
     {
     case PARSEOP_STRING_LITERAL:

-        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
+        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Op->Asl.Value.String);
         break;
 
     case PARSEOP_NAMESEG:

-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Op->Asl.Value.String);
         break;
 
     case PARSEOP_NAMESTRING:

-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Op->Asl.Value.String);
         break;
 
     case PARSEOP_EISAID:

-        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
+        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Op->Asl.Value.String);
         break;
 
     case PARSEOP_METHOD:
@@ -608,11 +610,13 @@ TrCreateValuedLeafNode (
 
     case PARSEOP_INTEGER:

+        Op->Asl.Value.Integer = Value;
         DbgPrint (ASL_PARSE_OUTPUT, "INTEGER");
         break;
 
     default:

+        Op->Asl.Value.Integer = Value;
         break;
     }
 
diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c
index e55f40c..ed5b1fd 100644
--- a/source/components/executer/exoparg2.c
+++ b/source/components/executer/exoparg2.c
@@ -175,6 +176,8 @@ AcpiExOpcode_2A_2T_1R (
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
+    UINT64                  ReturnValue1 = 0;
+    UINT64                  ReturnValue2 = 0;
     ACPI_STATUS             Status;
 
 
@@ -208,8 +211,10 @@ AcpiExOpcode_2A_2T_1R (
 
         Status = AcpiUtDivide (Operand[0]->Integer.Value,
                                Operand[1]->Integer.Value,
-                               &ReturnDesc1->Integer.Value,
-                               &ReturnDesc2->Integer.Value);
+                               &ReturnValue1, &ReturnValue2);
+        ReturnDesc1->Integer.Value = ReturnValue1;
+        ReturnDesc2->Integer.Value = ReturnValue2;
+
         if (ACPI_FAILURE (Status))
         {
             goto Cleanup;
@@ -283,6 +285,7 @@ AcpiExOpcode_2A_1T_1R (
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
     UINT64                  Index;
+    UINT64                  ReturnValue = 0;
     ACPI_STATUS             Status = AE_OK;
     ACPI_SIZE               Length = 0;
 
@@ -328,7 +333,8 @@ AcpiExOpcode_2A_1T_1R (
         Status = AcpiUtDivide (Operand[0]->Integer.Value,
                                Operand[1]->Integer.Value,
                                NULL,
-                               &ReturnDesc->Integer.Value);
+                               &ReturnValue);
+        ReturnDesc->Integer.Value = ReturnValue;
         break;
 
     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 07fb7d5..08bdf2f 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -142,6 +142,19 @@ typedef COMPILER_DEPENDENT_INT64        INT64;
  */
 #define ACPI_THREAD_ID                  UINT64
 
+/*
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
+ * to indicate that special precautions must be taken to avoid alignment faults.
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
+ *
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
+ * so there is no need to define this flag.
+ */
+#if defined (__IA64__) || defined (__ia64__) || defined(__alpha__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__)
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
+#endif
+
 
 /*******************************************************************************
  *
@@ -168,19 +181,6 @@ typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
 
-/*
- * In the case of the Itanium Processor Family (IPF), the hardware does not
- * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
- * to indicate that special precautions must be taken to avoid alignment faults.
- * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
- *
- * Note: EM64T and other X86-64 processors support misaligned transfers,
- * so there is no need to define this flag.
- */
-#if defined (__IA64__) || defined (__ia64__)
-#define ACPI_MISALIGNMENT_NOT_SUPPORTED
-#endif
-
 
 /*******************************************************************************
  *
-- 
1.7.12.1