diff options
Diffstat (limited to 'drivers/acpi/executer/exoparg6.c')
-rw-r--r-- | drivers/acpi/executer/exoparg6.c | 127 |
1 files changed, 58 insertions, 69 deletions
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 17f81d42ee41..5dee77139576 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.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 ("exoparg6") | 51 | ACPI_MODULE_NAME("exoparg6") |
54 | |||
55 | 52 | ||
56 | /*! | 53 | /*! |
57 | * Naming convention for AML interpreter execution routines. | 54 | * Naming convention for AML interpreter execution routines. |
@@ -74,15 +71,11 @@ | |||
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 | /* Local prototypes */ | 74 | /* Local prototypes */ |
79 | |||
80 | static u8 | 75 | static u8 |
81 | acpi_ex_do_match ( | 76 | acpi_ex_do_match(u32 match_op, |
82 | u32 match_op, | 77 | union acpi_operand_object *package_obj, |
83 | union acpi_operand_object *package_obj, | 78 | union acpi_operand_object *match_obj); |
84 | union acpi_operand_object *match_obj); | ||
85 | |||
86 | 79 | ||
87 | /******************************************************************************* | 80 | /******************************************************************************* |
88 | * | 81 | * |
@@ -101,14 +94,12 @@ acpi_ex_do_match ( | |||
101 | ******************************************************************************/ | 94 | ******************************************************************************/ |
102 | 95 | ||
103 | static u8 | 96 | static u8 |
104 | acpi_ex_do_match ( | 97 | acpi_ex_do_match(u32 match_op, |
105 | u32 match_op, | 98 | union acpi_operand_object *package_obj, |
106 | union acpi_operand_object *package_obj, | 99 | union acpi_operand_object *match_obj) |
107 | union acpi_operand_object *match_obj) | ||
108 | { | 100 | { |
109 | u8 logical_result = TRUE; | 101 | u8 logical_result = TRUE; |
110 | acpi_status status; | 102 | acpi_status status; |
111 | |||
112 | 103 | ||
113 | /* | 104 | /* |
114 | * Note: Since the package_obj/match_obj ordering is opposite to that of | 105 | * Note: Since the package_obj/match_obj ordering is opposite to that of |
@@ -133,9 +124,10 @@ acpi_ex_do_match ( | |||
133 | * True if equal: (P[i] == M) | 124 | * True if equal: (P[i] == M) |
134 | * Change to: (M == P[i]) | 125 | * Change to: (M == P[i]) |
135 | */ | 126 | */ |
136 | status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj, | 127 | status = |
137 | &logical_result); | 128 | acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj, |
138 | if (ACPI_FAILURE (status)) { | 129 | &logical_result); |
130 | if (ACPI_FAILURE(status)) { | ||
139 | return (FALSE); | 131 | return (FALSE); |
140 | } | 132 | } |
141 | break; | 133 | break; |
@@ -146,12 +138,13 @@ acpi_ex_do_match ( | |||
146 | * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) | 138 | * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) |
147 | * Change to: (M >= P[i]) (M not_less than P[i]) | 139 | * Change to: (M >= P[i]) (M not_less than P[i]) |
148 | */ | 140 | */ |
149 | status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, | 141 | status = |
150 | &logical_result); | 142 | acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, |
151 | if (ACPI_FAILURE (status)) { | 143 | &logical_result); |
144 | if (ACPI_FAILURE(status)) { | ||
152 | return (FALSE); | 145 | return (FALSE); |
153 | } | 146 | } |
154 | logical_result = (u8) !logical_result; | 147 | logical_result = (u8) ! logical_result; |
155 | break; | 148 | break; |
156 | 149 | ||
157 | case MATCH_MLT: | 150 | case MATCH_MLT: |
@@ -160,9 +153,10 @@ acpi_ex_do_match ( | |||
160 | * True if less than: (P[i] < M) | 153 | * True if less than: (P[i] < M) |
161 | * Change to: (M > P[i]) | 154 | * Change to: (M > P[i]) |
162 | */ | 155 | */ |
163 | status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, | 156 | status = |
164 | &logical_result); | 157 | acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, |
165 | if (ACPI_FAILURE (status)) { | 158 | package_obj, &logical_result); |
159 | if (ACPI_FAILURE(status)) { | ||
166 | return (FALSE); | 160 | return (FALSE); |
167 | } | 161 | } |
168 | break; | 162 | break; |
@@ -173,12 +167,13 @@ acpi_ex_do_match ( | |||
173 | * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) | 167 | * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) |
174 | * Change to: (M <= P[i]) (M not_greater than P[i]) | 168 | * Change to: (M <= P[i]) (M not_greater than P[i]) |
175 | */ | 169 | */ |
176 | status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, | 170 | status = |
177 | &logical_result); | 171 | acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, |
178 | if (ACPI_FAILURE (status)) { | 172 | package_obj, &logical_result); |
173 | if (ACPI_FAILURE(status)) { | ||
179 | return (FALSE); | 174 | return (FALSE); |
180 | } | 175 | } |
181 | logical_result = (u8)!logical_result; | 176 | logical_result = (u8) ! logical_result; |
182 | break; | 177 | break; |
183 | 178 | ||
184 | case MATCH_MGT: | 179 | case MATCH_MGT: |
@@ -187,9 +182,10 @@ acpi_ex_do_match ( | |||
187 | * True if greater than: (P[i] > M) | 182 | * True if greater than: (P[i] > M) |
188 | * Change to: (M < P[i]) | 183 | * Change to: (M < P[i]) |
189 | */ | 184 | */ |
190 | status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, | 185 | status = |
191 | &logical_result); | 186 | acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, |
192 | if (ACPI_FAILURE (status)) { | 187 | &logical_result); |
188 | if (ACPI_FAILURE(status)) { | ||
193 | return (FALSE); | 189 | return (FALSE); |
194 | } | 190 | } |
195 | break; | 191 | break; |
@@ -204,7 +200,6 @@ acpi_ex_do_match ( | |||
204 | return logical_result; | 200 | return logical_result; |
205 | } | 201 | } |
206 | 202 | ||
207 | |||
208 | /******************************************************************************* | 203 | /******************************************************************************* |
209 | * | 204 | * |
210 | * FUNCTION: acpi_ex_opcode_6A_0T_1R | 205 | * FUNCTION: acpi_ex_opcode_6A_0T_1R |
@@ -217,20 +212,16 @@ acpi_ex_do_match ( | |||
217 | * | 212 | * |
218 | ******************************************************************************/ | 213 | ******************************************************************************/ |
219 | 214 | ||
220 | acpi_status | 215 | acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) |
221 | acpi_ex_opcode_6A_0T_1R ( | ||
222 | struct acpi_walk_state *walk_state) | ||
223 | { | 216 | { |
224 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
225 | union acpi_operand_object *return_desc = NULL; | 218 | union acpi_operand_object *return_desc = NULL; |
226 | acpi_status status = AE_OK; | 219 | acpi_status status = AE_OK; |
227 | acpi_integer index; | 220 | acpi_integer index; |
228 | union acpi_operand_object *this_element; | 221 | union acpi_operand_object *this_element; |
229 | |||
230 | |||
231 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", | ||
232 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
233 | 222 | ||
223 | ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", | ||
224 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
234 | 225 | ||
235 | switch (walk_state->opcode) { | 226 | switch (walk_state->opcode) { |
236 | case AML_MATCH_OP: | 227 | case AML_MATCH_OP: |
@@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R ( | |||
242 | /* Validate both Match Term Operators (MTR, MEQ, etc.) */ | 233 | /* Validate both Match Term Operators (MTR, MEQ, etc.) */ |
243 | 234 | ||
244 | if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || | 235 | if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || |
245 | (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { | 236 | (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { |
246 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n")); | 237 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
238 | "Match operator out of range\n")); | ||
247 | status = AE_AML_OPERAND_VALUE; | 239 | status = AE_AML_OPERAND_VALUE; |
248 | goto cleanup; | 240 | goto cleanup; |
249 | } | 241 | } |
@@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R ( | |||
252 | 244 | ||
253 | index = operand[5]->integer.value; | 245 | index = operand[5]->integer.value; |
254 | if (index >= operand[0]->package.count) { | 246 | if (index >= operand[0]->package.count) { |
255 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 247 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
256 | "Index (%X%8.8X) beyond package end (%X)\n", | 248 | "Index (%X%8.8X) beyond package end (%X)\n", |
257 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); | 249 | ACPI_FORMAT_UINT64(index), |
250 | operand[0]->package.count)); | ||
258 | status = AE_AML_PACKAGE_LIMIT; | 251 | status = AE_AML_PACKAGE_LIMIT; |
259 | goto cleanup; | 252 | goto cleanup; |
260 | } | 253 | } |
261 | 254 | ||
262 | /* Create an integer for the return value */ | 255 | /* Create an integer for the return value */ |
263 | 256 | ||
264 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 257 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
265 | if (!return_desc) { | 258 | if (!return_desc) { |
266 | status = AE_NO_MEMORY; | 259 | status = AE_NO_MEMORY; |
267 | goto cleanup; | 260 | goto cleanup; |
@@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R ( | |||
283 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no | 276 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no |
284 | * match was found. | 277 | * match was found. |
285 | */ | 278 | */ |
286 | for ( ; index < operand[0]->package.count; index++) { | 279 | for (; index < operand[0]->package.count; index++) { |
287 | /* Get the current package element */ | 280 | /* Get the current package element */ |
288 | 281 | ||
289 | this_element = operand[0]->package.elements[index]; | 282 | this_element = operand[0]->package.elements[index]; |
@@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R ( | |||
299 | * (proceed to next iteration of enclosing for loop) signifies a | 292 | * (proceed to next iteration of enclosing for loop) signifies a |
300 | * non-match. | 293 | * non-match. |
301 | */ | 294 | */ |
302 | if (!acpi_ex_do_match ((u32) operand[1]->integer.value, | 295 | if (!acpi_ex_do_match((u32) operand[1]->integer.value, |
303 | this_element, operand[2])) { | 296 | this_element, operand[2])) { |
304 | continue; | 297 | continue; |
305 | } | 298 | } |
306 | 299 | ||
307 | if (!acpi_ex_do_match ((u32) operand[3]->integer.value, | 300 | if (!acpi_ex_do_match((u32) operand[3]->integer.value, |
308 | this_element, operand[4])) { | 301 | this_element, operand[4])) { |
309 | continue; | 302 | continue; |
310 | } | 303 | } |
311 | 304 | ||
@@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R ( | |||
316 | } | 309 | } |
317 | break; | 310 | break; |
318 | 311 | ||
319 | |||
320 | case AML_LOAD_TABLE_OP: | 312 | case AML_LOAD_TABLE_OP: |
321 | 313 | ||
322 | status = acpi_ex_load_table_op (walk_state, &return_desc); | 314 | status = acpi_ex_load_table_op(walk_state, &return_desc); |
323 | break; | 315 | break; |
324 | 316 | ||
325 | |||
326 | default: | 317 | default: |
327 | 318 | ||
328 | ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", | 319 | ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
329 | walk_state->opcode)); | ||
330 | status = AE_AML_BAD_OPCODE; | 320 | status = AE_AML_BAD_OPCODE; |
331 | goto cleanup; | 321 | goto cleanup; |
332 | } | 322 | } |
333 | 323 | ||
334 | walk_state->result_obj = return_desc; | 324 | walk_state->result_obj = return_desc; |
335 | 325 | ||
336 | 326 | cleanup: | |
337 | cleanup: | ||
338 | 327 | ||
339 | /* Delete return object on error */ | 328 | /* Delete return object on error */ |
340 | 329 | ||
341 | if (ACPI_FAILURE (status)) { | 330 | if (ACPI_FAILURE(status)) { |
342 | acpi_ut_remove_reference (return_desc); | 331 | acpi_ut_remove_reference(return_desc); |
343 | } | 332 | } |
344 | 333 | ||
345 | return_ACPI_STATUS (status); | 334 | return_ACPI_STATUS(status); |
346 | } | 335 | } |