diff options
Diffstat (limited to 'drivers/acpi/executer/exoparg3.c')
-rw-r--r-- | drivers/acpi/executer/exoparg3.c | 116 |
1 files changed, 48 insertions, 68 deletions
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 197890f443b5..483365777670 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -42,16 +42,13 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/acparser.h> | 47 | #include <acpi/acparser.h> |
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exoparg3") | 51 | ACPI_MODULE_NAME("exoparg3") |
54 | |||
55 | 52 | ||
56 | /*! | 53 | /*! |
57 | * Naming convention for AML interpreter execution routines. | 54 | * Naming convention for AML interpreter execution routines. |
@@ -74,8 +71,6 @@ | |||
74 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 71 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
75 | * fully resolved operands. | 72 | * fully resolved operands. |
76 | !*/ | 73 | !*/ |
77 | |||
78 | |||
79 | /******************************************************************************* | 74 | /******************************************************************************* |
80 | * | 75 | * |
81 | * FUNCTION: acpi_ex_opcode_3A_0T_0R | 76 | * FUNCTION: acpi_ex_opcode_3A_0T_0R |
@@ -87,61 +82,53 @@ | |||
87 | * DESCRIPTION: Execute Triadic operator (3 operands) | 82 | * DESCRIPTION: Execute Triadic operator (3 operands) |
88 | * | 83 | * |
89 | ******************************************************************************/ | 84 | ******************************************************************************/ |
90 | 85 | acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |
91 | acpi_status | ||
92 | acpi_ex_opcode_3A_0T_0R ( | ||
93 | struct acpi_walk_state *walk_state) | ||
94 | { | 86 | { |
95 | union acpi_operand_object **operand = &walk_state->operands[0]; | 87 | union acpi_operand_object **operand = &walk_state->operands[0]; |
96 | struct acpi_signal_fatal_info *fatal; | 88 | struct acpi_signal_fatal_info *fatal; |
97 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
98 | |||
99 | |||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", | ||
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
102 | 90 | ||
91 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", | ||
92 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
103 | 93 | ||
104 | switch (walk_state->opcode) { | 94 | switch (walk_state->opcode) { |
105 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
106 | 96 | ||
107 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
108 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
109 | (u32) operand[0]->integer.value, | 99 | (u32) operand[0]->integer.value, |
110 | (u32) operand[1]->integer.value, | 100 | (u32) operand[1]->integer.value, |
111 | (u32) operand[2]->integer.value)); | 101 | (u32) operand[2]->integer.value)); |
112 | 102 | ||
113 | fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info)); | 103 | fatal = |
104 | ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | ||
114 | if (fatal) { | 105 | if (fatal) { |
115 | fatal->type = (u32) operand[0]->integer.value; | 106 | fatal->type = (u32) operand[0]->integer.value; |
116 | fatal->code = (u32) operand[1]->integer.value; | 107 | fatal->code = (u32) operand[1]->integer.value; |
117 | fatal->argument = (u32) operand[2]->integer.value; | 108 | fatal->argument = (u32) operand[2]->integer.value; |
118 | } | 109 | } |
119 | 110 | ||
120 | /* Always signal the OS! */ | 111 | /* Always signal the OS! */ |
121 | 112 | ||
122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); | 113 | status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal); |
123 | 114 | ||
124 | /* Might return while OS is shutting down, just continue */ | 115 | /* Might return while OS is shutting down, just continue */ |
125 | 116 | ||
126 | ACPI_MEM_FREE (fatal); | 117 | ACPI_MEM_FREE(fatal); |
127 | break; | 118 | break; |
128 | 119 | ||
129 | |||
130 | default: | 120 | default: |
131 | 121 | ||
132 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 122 | ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
133 | walk_state->opcode)); | ||
134 | status = AE_AML_BAD_OPCODE; | 123 | status = AE_AML_BAD_OPCODE; |
135 | goto cleanup; | 124 | goto cleanup; |
136 | } | 125 | } |
137 | 126 | ||
127 | cleanup: | ||
138 | 128 | ||
139 | cleanup: | 129 | return_ACPI_STATUS(status); |
140 | |||
141 | return_ACPI_STATUS (status); | ||
142 | } | 130 | } |
143 | 131 | ||
144 | |||
145 | /******************************************************************************* | 132 | /******************************************************************************* |
146 | * | 133 | * |
147 | * FUNCTION: acpi_ex_opcode_3A_1T_1R | 134 | * FUNCTION: acpi_ex_opcode_3A_1T_1R |
@@ -154,31 +141,28 @@ cleanup: | |||
154 | * | 141 | * |
155 | ******************************************************************************/ | 142 | ******************************************************************************/ |
156 | 143 | ||
157 | acpi_status | 144 | acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) |
158 | acpi_ex_opcode_3A_1T_1R ( | ||
159 | struct acpi_walk_state *walk_state) | ||
160 | { | 145 | { |
161 | union acpi_operand_object **operand = &walk_state->operands[0]; | 146 | union acpi_operand_object **operand = &walk_state->operands[0]; |
162 | union acpi_operand_object *return_desc = NULL; | 147 | union acpi_operand_object *return_desc = NULL; |
163 | char *buffer = NULL; | 148 | char *buffer = NULL; |
164 | acpi_status status = AE_OK; | 149 | acpi_status status = AE_OK; |
165 | acpi_integer index; | 150 | acpi_integer index; |
166 | acpi_size length; | 151 | acpi_size length; |
167 | |||
168 | |||
169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", | ||
170 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
171 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", | ||
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
172 | 155 | ||
173 | switch (walk_state->opcode) { | 156 | switch (walk_state->opcode) { |
174 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ | 157 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ |
175 | 158 | ||
176 | /* | 159 | /* |
177 | * Create the return object. The Source operand is guaranteed to be | 160 | * Create the return object. The Source operand is guaranteed to be |
178 | * either a String or a Buffer, so just use its type. | 161 | * either a String or a Buffer, so just use its type. |
179 | */ | 162 | */ |
180 | return_desc = acpi_ut_create_internal_object ( | 163 | return_desc = |
181 | ACPI_GET_OBJECT_TYPE (operand[0])); | 164 | acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE |
165 | (operand[0])); | ||
182 | if (!return_desc) { | 166 | if (!return_desc) { |
183 | status = AE_NO_MEMORY; | 167 | status = AE_NO_MEMORY; |
184 | goto cleanup; | 168 | goto cleanup; |
@@ -201,17 +185,17 @@ acpi_ex_opcode_3A_1T_1R ( | |||
201 | 185 | ||
202 | else if ((index + length) > operand[0]->string.length) { | 186 | else if ((index + length) > operand[0]->string.length) { |
203 | length = (acpi_size) operand[0]->string.length - | 187 | length = (acpi_size) operand[0]->string.length - |
204 | (acpi_size) index; | 188 | (acpi_size) index; |
205 | } | 189 | } |
206 | 190 | ||
207 | /* Strings always have a sub-pointer, not so for buffers */ | 191 | /* Strings always have a sub-pointer, not so for buffers */ |
208 | 192 | ||
209 | switch (ACPI_GET_OBJECT_TYPE (operand[0])) { | 193 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
210 | case ACPI_TYPE_STRING: | 194 | case ACPI_TYPE_STRING: |
211 | 195 | ||
212 | /* Always allocate a new buffer for the String */ | 196 | /* Always allocate a new buffer for the String */ |
213 | 197 | ||
214 | buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); | 198 | buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); |
215 | if (!buffer) { | 199 | if (!buffer) { |
216 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
217 | goto cleanup; | 201 | goto cleanup; |
@@ -225,7 +209,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
225 | if (length > 0) { | 209 | if (length > 0) { |
226 | /* Allocate a new buffer for the Buffer */ | 210 | /* Allocate a new buffer for the Buffer */ |
227 | 211 | ||
228 | buffer = ACPI_MEM_CALLOCATE (length); | 212 | buffer = ACPI_MEM_CALLOCATE(length); |
229 | if (!buffer) { | 213 | if (!buffer) { |
230 | status = AE_NO_MEMORY; | 214 | status = AE_NO_MEMORY; |
231 | goto cleanup; | 215 | goto cleanup; |
@@ -233,7 +217,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
233 | } | 217 | } |
234 | break; | 218 | break; |
235 | 219 | ||
236 | default: /* Should not happen */ | 220 | default: /* Should not happen */ |
237 | 221 | ||
238 | status = AE_AML_OPERAND_TYPE; | 222 | status = AE_AML_OPERAND_TYPE; |
239 | goto cleanup; | 223 | goto cleanup; |
@@ -242,8 +226,8 @@ acpi_ex_opcode_3A_1T_1R ( | |||
242 | if (length > 0) { | 226 | if (length > 0) { |
243 | /* Copy the portion requested */ | 227 | /* Copy the portion requested */ |
244 | 228 | ||
245 | ACPI_MEMCPY (buffer, operand[0]->string.pointer + index, | 229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
246 | length); | 230 | length); |
247 | } | 231 | } |
248 | 232 | ||
249 | /* Set the length of the new String/Buffer */ | 233 | /* Set the length of the new String/Buffer */ |
@@ -256,25 +240,23 @@ acpi_ex_opcode_3A_1T_1R ( | |||
256 | return_desc->buffer.flags |= AOPOBJ_DATA_VALID; | 240 | return_desc->buffer.flags |= AOPOBJ_DATA_VALID; |
257 | break; | 241 | break; |
258 | 242 | ||
259 | |||
260 | default: | 243 | default: |
261 | 244 | ||
262 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 245 | ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
263 | walk_state->opcode)); | ||
264 | status = AE_AML_BAD_OPCODE; | 246 | status = AE_AML_BAD_OPCODE; |
265 | goto cleanup; | 247 | goto cleanup; |
266 | } | 248 | } |
267 | 249 | ||
268 | /* Store the result in the target */ | 250 | /* Store the result in the target */ |
269 | 251 | ||
270 | status = acpi_ex_store (return_desc, operand[3], walk_state); | 252 | status = acpi_ex_store(return_desc, operand[3], walk_state); |
271 | 253 | ||
272 | cleanup: | 254 | cleanup: |
273 | 255 | ||
274 | /* Delete return object on error */ | 256 | /* Delete return object on error */ |
275 | 257 | ||
276 | if (ACPI_FAILURE (status) || walk_state->result_obj) { | 258 | if (ACPI_FAILURE(status) || walk_state->result_obj) { |
277 | acpi_ut_remove_reference (return_desc); | 259 | acpi_ut_remove_reference(return_desc); |
278 | } | 260 | } |
279 | 261 | ||
280 | /* Set the return object and exit */ | 262 | /* Set the return object and exit */ |
@@ -282,7 +264,5 @@ cleanup: | |||
282 | else { | 264 | else { |
283 | walk_state->result_obj = return_desc; | 265 | walk_state->result_obj = return_desc; |
284 | } | 266 | } |
285 | return_ACPI_STATUS (status); | 267 | return_ACPI_STATUS(status); |
286 | } | 268 | } |
287 | |||
288 | |||