diff options
27 files changed, 775 insertions, 419 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 58ad00b31ee9..e7ce86b8d954 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -47,12 +47,70 @@ | |||
47 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acdisasm.h> | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsmethod") | 53 | ACPI_MODULE_NAME("dsmethod") |
53 | 54 | ||
54 | /******************************************************************************* | 55 | /******************************************************************************* |
55 | * | 56 | * |
57 | * FUNCTION: acpi_ds_method_error | ||
58 | * | ||
59 | * PARAMETERS: Status - Execution status | ||
60 | * walk_state - Current state | ||
61 | * | ||
62 | * RETURN: Status | ||
63 | * | ||
64 | * DESCRIPTION: Called on method error. Invoke the global exception handler if | ||
65 | * present, dump the method data if the disassembler is configured | ||
66 | * | ||
67 | * Note: Allows the exception handler to change the status code | ||
68 | * | ||
69 | ******************************************************************************/ | ||
70 | acpi_status | ||
71 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | ||
72 | { | ||
73 | ACPI_FUNCTION_ENTRY(); | ||
74 | |||
75 | /* Ignore AE_OK and control exception codes */ | ||
76 | |||
77 | if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) { | ||
78 | return (status); | ||
79 | } | ||
80 | |||
81 | /* Invoke the global exception handler */ | ||
82 | |||
83 | if (acpi_gbl_exception_handler) { | ||
84 | /* Exit the interpreter, allow handler to execute methods */ | ||
85 | |||
86 | acpi_ex_exit_interpreter(); | ||
87 | |||
88 | /* | ||
89 | * Handler can map the exception code to anything it wants, including | ||
90 | * AE_OK, in which case the executing method will not be aborted. | ||
91 | */ | ||
92 | status = acpi_gbl_exception_handler(status, | ||
93 | walk_state->method_node ? | ||
94 | walk_state->method_node-> | ||
95 | name.integer : 0, | ||
96 | walk_state->opcode, | ||
97 | walk_state->aml_offset, | ||
98 | NULL); | ||
99 | (void)acpi_ex_enter_interpreter(); | ||
100 | } | ||
101 | #ifdef ACPI_DISASSEMBLER | ||
102 | if (ACPI_FAILURE(status)) { | ||
103 | /* Display method locals/args if disassembler is present */ | ||
104 | |||
105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | ||
106 | } | ||
107 | #endif | ||
108 | |||
109 | return (status); | ||
110 | } | ||
111 | |||
112 | /******************************************************************************* | ||
113 | * | ||
56 | * FUNCTION: acpi_ds_begin_method_execution | 114 | * FUNCTION: acpi_ds_begin_method_execution |
57 | * | 115 | * |
58 | * PARAMETERS: method_node - Node of the method | 116 | * PARAMETERS: method_node - Node of the method |
@@ -66,10 +124,11 @@ ACPI_MODULE_NAME("dsmethod") | |||
66 | * for clearance to execute. | 124 | * for clearance to execute. |
67 | * | 125 | * |
68 | ******************************************************************************/ | 126 | ******************************************************************************/ |
127 | |||
69 | acpi_status | 128 | acpi_status |
70 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | 129 | acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, |
71 | union acpi_operand_object *obj_desc, | 130 | union acpi_operand_object * obj_desc, |
72 | struct acpi_namespace_node *calling_method_node) | 131 | struct acpi_namespace_node * calling_method_node) |
73 | { | 132 | { |
74 | acpi_status status = AE_OK; | 133 | acpi_status status = AE_OK; |
75 | 134 | ||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8ac0cd93adb5..905a84e4b145 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #define _COMPONENT ACPI_DISPATCHER | 51 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsobject") | 52 | ACPI_MODULE_NAME("dsobject") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
54 | static acpi_status | 55 | static acpi_status |
55 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | 56 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, |
56 | union acpi_parse_object *op, | 57 | union acpi_parse_object *op, |
@@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
85 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
86 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
87 | /* | 88 | /* |
88 | * This is an named object reference. If this name was | 89 | * This is a named object reference. If this name was |
89 | * previously looked up in the namespace, it was stored in this op. | 90 | * previously looked up in the namespace, it was stored in this op. |
90 | * Otherwise, go ahead and look it up now | 91 | * Otherwise, go ahead and look it up now |
91 | */ | 92 | */ |
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
96 | ACPI_IMODE_EXECUTE, | 97 | ACPI_IMODE_EXECUTE, |
97 | ACPI_NS_SEARCH_PARENT | | 98 | ACPI_NS_SEARCH_PARENT | |
98 | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 99 | ACPI_NS_DONT_OPEN_SCOPE, NULL, |
99 | (struct acpi_namespace_node **) | 100 | ACPI_CAST_INDIRECT_PTR(struct |
100 | &(op->common.node)); | 101 | acpi_namespace_node, |
101 | 102 | &(op-> | |
103 | common. | ||
104 | node))); | ||
102 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
103 | ACPI_REPORT_NSERROR(op->common.value.string, | 106 | /* Check if we are resolving a named reference within a package */ |
104 | status); | 107 | |
108 | if ((status == AE_NOT_FOUND) | ||
109 | && (acpi_gbl_enable_interpreter_slack) | ||
110 | && | ||
111 | ((op->common.parent->common.aml_opcode == | ||
112 | AML_PACKAGE_OP) | ||
113 | || (op->common.parent->common.aml_opcode == | ||
114 | AML_VAR_PACKAGE_OP))) { | ||
115 | /* | ||
116 | * We didn't find the target and we are populating elements | ||
117 | * of a package - ignore if slack enabled. Some ASL code | ||
118 | * contains dangling invalid references in packages and | ||
119 | * expects that no exception will be issued. Leave the | ||
120 | * element as a null element. It cannot be used, but it | ||
121 | * can be overwritten by subsequent ASL code - this is | ||
122 | * typically the case. | ||
123 | */ | ||
124 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
125 | "Ignoring unresolved reference in package [%4.4s]\n", | ||
126 | walk_state-> | ||
127 | scope_info->scope. | ||
128 | node->name.ascii)); | ||
129 | |||
130 | return_ACPI_STATUS(AE_OK); | ||
131 | } else { | ||
132 | ACPI_REPORT_NSERROR(op->common.value. | ||
133 | string, status); | ||
134 | } | ||
135 | |||
105 | return_ACPI_STATUS(status); | 136 | return_ACPI_STATUS(status); |
106 | } | 137 | } |
107 | } | 138 | } |
108 | } | 139 | } |
109 | 140 | ||
110 | /* Create and init the internal ACPI object */ | 141 | /* Create and init a new internal ACPI object */ |
111 | 142 | ||
112 | obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info | 143 | obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info |
113 | (op->common.aml_opcode))-> | 144 | (op->common.aml_opcode))-> |
@@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
157 | 188 | ||
158 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); |
159 | 190 | ||
191 | /* | ||
192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | ||
193 | * The buffer object already exists (from the NS node), otherwise it must | ||
194 | * be created. | ||
195 | */ | ||
160 | obj_desc = *obj_desc_ptr; | 196 | obj_desc = *obj_desc_ptr; |
161 | if (obj_desc) { | 197 | if (!obj_desc) { |
162 | /* | ||
163 | * We are evaluating a Named buffer object "Name (xxxx, Buffer)". | ||
164 | * The buffer object already exists (from the NS node) | ||
165 | */ | ||
166 | } else { | ||
167 | /* Create a new buffer object */ | 198 | /* Create a new buffer object */ |
168 | 199 | ||
169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
@@ -259,7 +290,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
259 | union acpi_operand_object *obj_desc = NULL; | 290 | union acpi_operand_object *obj_desc = NULL; |
260 | u32 package_list_length; | 291 | u32 package_list_length; |
261 | acpi_status status = AE_OK; | 292 | acpi_status status = AE_OK; |
262 | u32 i; | 293 | acpi_native_uint i; |
263 | 294 | ||
264 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 295 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); |
265 | 296 | ||
@@ -271,13 +302,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
271 | parent = parent->common.parent; | 302 | parent = parent->common.parent; |
272 | } | 303 | } |
273 | 304 | ||
305 | /* | ||
306 | * If we are evaluating a Named package object "Name (xxxx, Package)", | ||
307 | * the package object already exists, otherwise it must be created. | ||
308 | */ | ||
274 | obj_desc = *obj_desc_ptr; | 309 | obj_desc = *obj_desc_ptr; |
275 | if (obj_desc) { | 310 | if (!obj_desc) { |
276 | /* | ||
277 | * We are evaluating a Named package object "Name (xxxx, Package)". | ||
278 | * Get the existing package object from the NS node | ||
279 | */ | ||
280 | } else { | ||
281 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); | 311 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); |
282 | *obj_desc_ptr = obj_desc; | 312 | *obj_desc_ptr = obj_desc; |
283 | if (!obj_desc) { | 313 | if (!obj_desc) { |
@@ -291,11 +321,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
291 | 321 | ||
292 | /* Count the number of items in the package list */ | 322 | /* Count the number of items in the package list */ |
293 | 323 | ||
294 | package_list_length = 0; | ||
295 | arg = op->common.value.arg; | 324 | arg = op->common.value.arg; |
296 | arg = arg->common.next; | 325 | arg = arg->common.next; |
297 | while (arg) { | 326 | for (package_list_length = 0; arg; package_list_length++) { |
298 | package_list_length++; | ||
299 | arg = arg->common.next; | 327 | arg = arg->common.next; |
300 | } | 328 | } |
301 | 329 | ||
@@ -322,12 +350,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
322 | } | 350 | } |
323 | 351 | ||
324 | /* | 352 | /* |
325 | * Now init the elements of the package | 353 | * Initialize all elements of the package |
326 | */ | 354 | */ |
327 | i = 0; | ||
328 | arg = op->common.value.arg; | 355 | arg = op->common.value.arg; |
329 | arg = arg->common.next; | 356 | arg = arg->common.next; |
330 | while (arg) { | 357 | for (i = 0; arg; i++) { |
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 358 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 359 | /* Object (package or buffer) is already built */ |
333 | 360 | ||
@@ -340,8 +367,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
340 | package. | 367 | package. |
341 | elements[i]); | 368 | elements[i]); |
342 | } | 369 | } |
343 | |||
344 | i++; | ||
345 | arg = arg->common.next; | 370 | arg = arg->common.next; |
346 | } | 371 | } |
347 | 372 | ||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index e522763bb692..74f6996db2d7 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -314,12 +314,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
314 | 314 | ||
315 | case AML_CLASS_EXECUTE: | 315 | case AML_CLASS_EXECUTE: |
316 | case AML_CLASS_CREATE: | 316 | case AML_CLASS_CREATE: |
317 | |||
318 | /* | 317 | /* |
319 | * Most operators with arguments. | 318 | * Most operators with arguments. |
320 | * Start a new result/operand state | 319 | * Start a new result/operand state |
321 | */ | 320 | */ |
322 | status = acpi_ds_result_stack_push(walk_state); | 321 | if (walk_state->opcode != AML_CREATE_FIELD_OP) { |
322 | status = acpi_ds_result_stack_push(walk_state); | ||
323 | } | ||
323 | break; | 324 | break; |
324 | 325 | ||
325 | default: | 326 | default: |
@@ -723,20 +724,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
723 | 724 | ||
724 | cleanup: | 725 | cleanup: |
725 | 726 | ||
726 | /* Invoke exception handler on error */ | ||
727 | |||
728 | if (ACPI_FAILURE(status) && | ||
729 | acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { | ||
730 | acpi_ex_exit_interpreter(); | ||
731 | status = acpi_gbl_exception_handler(status, | ||
732 | walk_state->method_node-> | ||
733 | name.integer, | ||
734 | walk_state->opcode, | ||
735 | walk_state->aml_offset, | ||
736 | NULL); | ||
737 | (void)acpi_ex_enter_interpreter(); | ||
738 | } | ||
739 | |||
740 | if (walk_state->result_obj) { | 727 | if (walk_state->result_obj) { |
741 | /* Break to debugger to display result */ | 728 | /* Break to debugger to display result */ |
742 | 729 | ||
@@ -758,18 +745,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
758 | } | 745 | } |
759 | #endif | 746 | #endif |
760 | 747 | ||
761 | /* Always clear the object stack */ | 748 | /* Invoke exception handler on error */ |
762 | |||
763 | walk_state->num_operands = 0; | ||
764 | |||
765 | #ifdef ACPI_DISASSEMBLER | ||
766 | |||
767 | /* On error, display method locals/args */ | ||
768 | 749 | ||
769 | if (ACPI_FAILURE(status)) { | 750 | if (ACPI_FAILURE(status)) { |
770 | acpi_dm_dump_method_info(status, walk_state, op); | 751 | status = acpi_ds_method_error(status, walk_state); |
771 | } | 752 | } |
772 | #endif | ||
773 | 753 | ||
754 | /* Always clear the object stack */ | ||
755 | |||
756 | walk_state->num_operands = 0; | ||
774 | return_ACPI_STATUS(status); | 757 | return_ACPI_STATUS(status); |
775 | } | 758 | } |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 44d4f4bb2f92..441931cab08a 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -428,43 +428,54 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | if (op->common.aml_opcode == AML_METHOD_OP) { | 431 | /* |
432 | /* | 432 | * If we are executing a method, do not create any namespace objects |
433 | * method_op pkg_length name_string method_flags term_list | 433 | * during the load phase, only during execution. |
434 | * | 434 | */ |
435 | * Note: We must create the method node/object pair as soon as we | 435 | if (!walk_state->method_node) { |
436 | * see the method declaration. This allows later pass1 parsing | 436 | if (op->common.aml_opcode == AML_METHOD_OP) { |
437 | * of invocations of the method (need to know the number of | 437 | /* |
438 | * arguments.) | 438 | * method_op pkg_length name_string method_flags term_list |
439 | */ | 439 | * |
440 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 440 | * Note: We must create the method node/object pair as soon as we |
441 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 441 | * see the method declaration. This allows later pass1 parsing |
442 | walk_state, op, op->named.node)); | 442 | * of invocations of the method (need to know the number of |
443 | * arguments.) | ||
444 | */ | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
446 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | ||
447 | walk_state, op, op->named.node)); | ||
443 | 448 | ||
444 | if (!acpi_ns_get_attached_object(op->named.node)) { | 449 | if (!acpi_ns_get_attached_object(op->named.node)) { |
445 | walk_state->operands[0] = (void *)op->named.node; | 450 | walk_state->operands[0] = |
446 | walk_state->num_operands = 1; | 451 | ACPI_CAST_PTR(void, op->named.node); |
452 | walk_state->num_operands = 1; | ||
447 | 453 | ||
448 | status = | 454 | status = |
449 | acpi_ds_create_operands(walk_state, | 455 | acpi_ds_create_operands(walk_state, |
450 | op->common.value.arg); | 456 | op->common.value. |
451 | if (ACPI_SUCCESS(status)) { | 457 | arg); |
452 | status = acpi_ex_create_method(op->named.data, | 458 | if (ACPI_SUCCESS(status)) { |
453 | op->named.length, | 459 | status = |
454 | walk_state); | 460 | acpi_ex_create_method(op->named. |
455 | } | 461 | data, |
456 | walk_state->operands[0] = NULL; | 462 | op->named. |
457 | walk_state->num_operands = 0; | 463 | length, |
464 | walk_state); | ||
465 | } | ||
466 | walk_state->operands[0] = NULL; | ||
467 | walk_state->num_operands = 0; | ||
458 | 468 | ||
459 | if (ACPI_FAILURE(status)) { | 469 | if (ACPI_FAILURE(status)) { |
460 | return_ACPI_STATUS(status); | 470 | return_ACPI_STATUS(status); |
471 | } | ||
461 | } | 472 | } |
462 | } | 473 | } |
463 | } | 474 | } |
464 | 475 | ||
465 | /* Pop the scope stack */ | 476 | /* Pop the scope stack (only if loading a table) */ |
466 | 477 | ||
467 | if (acpi_ns_opens_scope(object_type)) { | 478 | if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) { |
468 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 479 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
469 | "(%s): Popping scope for Op %p\n", | 480 | "(%s): Popping scope for Op %p\n", |
470 | acpi_ut_get_type_name(object_type), op)); | 481 | acpi_ut_get_type_name(object_type), op)); |
@@ -1015,11 +1026,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1015 | 1026 | ||
1016 | status = acpi_ds_create_node(walk_state, node, op); | 1027 | status = acpi_ds_create_node(walk_state, node, op); |
1017 | break; | 1028 | break; |
1029 | |||
1030 | case AML_METHOD_OP: | ||
1031 | /* | ||
1032 | * method_op pkg_length name_string method_flags term_list | ||
1033 | * | ||
1034 | * Note: We must create the method node/object pair as soon as we | ||
1035 | * see the method declaration. This allows later pass1 parsing | ||
1036 | * of invocations of the method (need to know the number of | ||
1037 | * arguments.) | ||
1038 | */ | ||
1039 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1040 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | ||
1041 | walk_state, op, op->named.node)); | ||
1042 | |||
1043 | if (!acpi_ns_get_attached_object(op->named.node)) { | ||
1044 | walk_state->operands[0] = | ||
1045 | ACPI_CAST_PTR(void, op->named.node); | ||
1046 | walk_state->num_operands = 1; | ||
1047 | |||
1048 | status = | ||
1049 | acpi_ds_create_operands(walk_state, | ||
1050 | op->common.value. | ||
1051 | arg); | ||
1052 | if (ACPI_SUCCESS(status)) { | ||
1053 | status = | ||
1054 | acpi_ex_create_method(op->named. | ||
1055 | data, | ||
1056 | op->named. | ||
1057 | length, | ||
1058 | walk_state); | ||
1059 | } | ||
1060 | walk_state->operands[0] = NULL; | ||
1061 | walk_state->num_operands = 0; | ||
1062 | |||
1063 | if (ACPI_FAILURE(status)) { | ||
1064 | return_ACPI_STATUS(status); | ||
1065 | } | ||
1066 | } | ||
1067 | break; | ||
1068 | |||
1018 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 1069 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
1019 | 1070 | ||
1020 | default: | 1071 | default: |
1021 | /* All NAMED_COMPLEX opcodes must be handled above */ | 1072 | /* All NAMED_COMPLEX opcodes must be handled above */ |
1022 | /* Note: Method objects were already created in Pass 1 */ | ||
1023 | break; | 1073 | break; |
1024 | } | 1074 | } |
1025 | break; | 1075 | break; |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 483365777670..2ea1c322970b 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -223,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
223 | goto cleanup; | 223 | goto cleanup; |
224 | } | 224 | } |
225 | 225 | ||
226 | if (length > 0) { | 226 | if (buffer) { |
227 | /* Copy the portion requested */ | 227 | /* We have a buffer, copy the portion requested */ |
228 | 228 | ||
229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, | 229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
230 | length); | 230 | length); |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 536a7aea80c9..b243f20708b7 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -144,7 +144,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
144 | 144 | ||
145 | info.parameters = NULL; | 145 | info.parameters = NULL; |
146 | info.return_object = NULL; | 146 | info.return_object = NULL; |
147 | sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; | 147 | sleep_state_name = |
148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | ||
148 | 149 | ||
149 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 150 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); |
150 | if (ACPI_FAILURE(status)) { | 151 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 0a08d2f04a06..efa3f4233736 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -336,23 +336,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
336 | struct acpi_parameter_info pinfo; | 336 | struct acpi_parameter_info pinfo; |
337 | u32 flags; | 337 | u32 flags; |
338 | acpi_status status; | 338 | acpi_status status; |
339 | struct acpi_namespace_node *ini_node; | ||
340 | struct acpi_namespace_node *device_node; | ||
339 | 341 | ||
340 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 342 | ACPI_FUNCTION_TRACE("ns_init_one_device"); |
341 | 343 | ||
342 | pinfo.parameters = NULL; | 344 | device_node = acpi_ns_map_handle_to_node(obj_handle); |
343 | pinfo.parameter_type = ACPI_PARAM_ARGS; | 345 | if (!device_node) { |
344 | |||
345 | pinfo.node = acpi_ns_map_handle_to_node(obj_handle); | ||
346 | if (!pinfo.node) { | ||
347 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 346 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
348 | } | 347 | } |
349 | 348 | ||
350 | /* | 349 | /* |
351 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | 350 | * We will run _STA/_INI on Devices, Processors and thermal_zones only |
352 | */ | 351 | */ |
353 | if ((pinfo.node->type != ACPI_TYPE_DEVICE) && | 352 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
354 | (pinfo.node->type != ACPI_TYPE_PROCESSOR) && | 353 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
355 | (pinfo.node->type != ACPI_TYPE_THERMAL)) { | 354 | (device_node->type != ACPI_TYPE_THERMAL)) { |
356 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
357 | } | 356 | } |
358 | 357 | ||
@@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
364 | info->device_count++; | 363 | info->device_count++; |
365 | 364 | ||
366 | /* | 365 | /* |
367 | * Run _STA to determine if we can run _INI on the device. | 366 | * Check if the _INI method exists for this device - |
367 | * if _INI does not exist, there is no need to run _STA | ||
368 | * No _INI means device requires no initialization | ||
369 | */ | ||
370 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | ||
371 | device_node, ACPI_TYPE_METHOD, &ini_node); | ||
372 | if (ACPI_FAILURE(status)) { | ||
373 | /* No _INI method found - move on to next device */ | ||
374 | |||
375 | return_ACPI_STATUS(AE_OK); | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | * Run _STA to determine if we can run _INI on the device - | ||
380 | * the device must be present before _INI can be run. | ||
381 | * However, _STA is not required - assume device present if no _STA | ||
368 | */ | 382 | */ |
369 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 383 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
370 | pinfo.node, | 384 | device_node, |
371 | METHOD_NAME__STA)); | 385 | METHOD_NAME__STA)); |
372 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
373 | 386 | ||
387 | pinfo.node = device_node; | ||
388 | pinfo.parameters = NULL; | ||
389 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
390 | |||
391 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
374 | if (ACPI_FAILURE(status)) { | 392 | if (ACPI_FAILURE(status)) { |
375 | if (pinfo.node->type == ACPI_TYPE_DEVICE) { | 393 | /* Ignore error and move on to next device */ |
376 | /* Ignore error and move on to next device */ | ||
377 | 394 | ||
378 | return_ACPI_STATUS(AE_OK); | 395 | return_ACPI_STATUS(AE_OK); |
379 | } | 396 | } |
380 | 397 | ||
381 | /* _STA is not required for Processor or thermal_zone objects */ | 398 | if (flags != ACPI_UINT32_MAX) { |
382 | } else { | ||
383 | info->num_STA++; | 399 | info->num_STA++; |
400 | } | ||
384 | 401 | ||
385 | if (!(flags & 0x01)) { | 402 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
386 | /* Don't look at children of a not present device */ | 403 | /* Don't look at children of a not present device */ |
387 | 404 | ||
388 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 405 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
389 | } | ||
390 | } | 406 | } |
391 | 407 | ||
392 | /* | 408 | /* |
393 | * The device is present. Run _INI. | 409 | * The device is present and _INI exists. Run the _INI method. |
410 | * (We already have the _INI node from above) | ||
394 | */ | 411 | */ |
395 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 412 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
396 | pinfo.node, | 413 | pinfo.node, |
397 | METHOD_NAME__INI)); | 414 | METHOD_NAME__INI)); |
398 | status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | ||
401 | 415 | ||
402 | if (status != AE_NOT_FOUND) { | 416 | pinfo.node = ini_node; |
403 | /* Ignore error and move on to next device */ | 417 | status = acpi_ns_evaluate_by_handle(&pinfo); |
418 | if (ACPI_FAILURE(status)) { | ||
419 | /* Ignore error and move on to next device */ | ||
404 | 420 | ||
405 | #ifdef ACPI_DEBUG_OUTPUT | 421 | #ifdef ACPI_DEBUG_OUTPUT |
406 | char *scope_name = | 422 | char *scope_name = acpi_ns_get_external_pathname(ini_node); |
407 | acpi_ns_get_external_pathname(pinfo.node); | ||
408 | 423 | ||
409 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", | 424 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", |
410 | scope_name, | 425 | scope_name, acpi_format_exception(status))); |
411 | acpi_format_exception(status))); | ||
412 | 426 | ||
413 | ACPI_MEM_FREE(scope_name); | 427 | ACPI_MEM_FREE(scope_name); |
414 | #endif | 428 | #endif |
415 | } | ||
416 | |||
417 | status = AE_OK; | ||
418 | } else { | 429 | } else { |
419 | /* Delete any return object (especially if implicit_return is enabled) */ | 430 | /* Delete any return object (especially if implicit_return is enabled) */ |
420 | 431 | ||
@@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
434 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 445 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); |
435 | } | 446 | } |
436 | 447 | ||
437 | return_ACPI_STATUS(status); | 448 | return_ACPI_STATUS(AE_OK); |
438 | } | 449 | } |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 50a3ca5470ed..c1b1943d4670 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name, | |||
99 | if (scope_name) { | 99 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 101 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, | 102 | scope_name, node, ACPI_CAST_PTR(char, |
103 | (char *)&target_name, | 103 | &target_name), |
104 | acpi_ut_get_type_name(type))); | 104 | acpi_ut_get_type_name(type))); |
105 | 105 | ||
106 | ACPI_MEM_FREE(scope_name); | 106 | ACPI_MEM_FREE(scope_name); |
@@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name, | |||
131 | */ | 131 | */ |
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | (char *)&target_name, | 134 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 135 | acpi_ut_get_type_name(next_node-> |
136 | type), | 136 | type), |
137 | next_node, | 137 | next_node, |
@@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name, | |||
160 | 160 | ||
161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | (char *)&target_name, acpi_ut_get_type_name(type), | 163 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | ||
164 | acpi_ut_get_node_name(node), node, node->child)); | 165 | acpi_ut_get_node_name(node), node, node->child)); |
165 | 166 | ||
166 | return_ACPI_STATUS(AE_NOT_FOUND); | 167 | return_ACPI_STATUS(AE_NOT_FOUND); |
@@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
210 | */ | 211 | */ |
211 | if (!parent_node) { | 212 | if (!parent_node) { |
212 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", | 213 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", |
213 | (char *)&target_name)); | 214 | ACPI_CAST_PTR(char, &target_name))); |
214 | return_ACPI_STATUS(AE_NOT_FOUND); | 215 | return_ACPI_STATUS(AE_NOT_FOUND); |
215 | } | 216 | } |
216 | 217 | ||
217 | if (acpi_ns_local(type)) { | 218 | if (acpi_ns_local(type)) { |
218 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
219 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", | 220 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", |
220 | (char *)&target_name, | 221 | ACPI_CAST_PTR(char, &target_name), |
221 | acpi_ut_get_type_name(type))); | 222 | acpi_ut_get_type_name(type))); |
222 | return_ACPI_STATUS(AE_NOT_FOUND); | 223 | return_ACPI_STATUS(AE_NOT_FOUND); |
223 | } | 224 | } |
@@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
227 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 228 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
228 | "Searching parent [%4.4s] for [%4.4s]\n", | 229 | "Searching parent [%4.4s] for [%4.4s]\n", |
229 | acpi_ut_get_node_name(parent_node), | 230 | acpi_ut_get_node_name(parent_node), |
230 | (char *)&target_name)); | 231 | ACPI_CAST_PTR(char, &target_name))); |
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Search parents until target is found or we have backed up to the root | 234 | * Search parents until target is found or we have backed up to the root |
@@ -360,7 +361,7 @@ acpi_ns_search_and_enter(u32 target_name, | |||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 361 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 362 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 363 | "%4.4s Not found in %p [Not adding]\n", |
363 | (char *)&target_name, node)); | 364 | ACPI_CAST_PTR(char, &target_name), node)); |
364 | 365 | ||
365 | return_ACPI_STATUS(AE_NOT_FOUND); | 366 | return_ACPI_STATUS(AE_NOT_FOUND); |
366 | } | 367 | } |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 8167af1fa57b..75b137a6a3c9 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | return (AE_CTRL_DEPTH); | 473 | return (AE_CTRL_DEPTH); |
474 | } | 474 | } |
475 | 475 | ||
476 | if (!(flags & 0x01)) { | 476 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
477 | /* Don't return at the device or children of the device if not there */ | 477 | /* Don't examine children of the device if not present */ |
478 | 478 | ||
479 | return (AE_CTRL_DEPTH); | 479 | return (AE_CTRL_DEPTH); |
480 | } | 480 | } |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 6eae35febccd..e6d4cb9fd303 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <acpi/acparser.h> | 45 | #include <acpi/acparser.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acdispat.h> | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME("psargs") | 51 | ACPI_MODULE_NAME("psargs") |
@@ -211,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
211 | * Arg - Where the namepath will be stored | 212 | * Arg - Where the namepath will be stored |
212 | * arg_count - If the namepath points to a control method | 213 | * arg_count - If the namepath points to a control method |
213 | * the method's argument is returned here. | 214 | * the method's argument is returned here. |
214 | * method_call - Whether the namepath can possibly be the | 215 | * possible_method_call - Whether the namepath can possibly be the |
215 | * start of a method call | 216 | * start of a method call |
216 | * | 217 | * |
217 | * RETURN: Status | 218 | * RETURN: Status |
@@ -227,11 +228,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
227 | acpi_status | 228 | acpi_status |
228 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | 229 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, |
229 | struct acpi_parse_state *parser_state, | 230 | struct acpi_parse_state *parser_state, |
230 | union acpi_parse_object *arg, u8 method_call) | 231 | union acpi_parse_object *arg, u8 possible_method_call) |
231 | { | 232 | { |
232 | char *path; | 233 | char *path; |
233 | union acpi_parse_object *name_op; | 234 | union acpi_parse_object *name_op; |
234 | acpi_status status = AE_OK; | 235 | acpi_status status; |
235 | union acpi_operand_object *method_desc; | 236 | union acpi_operand_object *method_desc; |
236 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
237 | union acpi_generic_state scope_info; | 238 | union acpi_generic_state scope_info; |
@@ -239,114 +240,127 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
239 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); | 240 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); |
240 | 241 | ||
241 | path = acpi_ps_get_next_namestring(parser_state); | 242 | path = acpi_ps_get_next_namestring(parser_state); |
243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | ||
242 | 244 | ||
243 | /* Null path case is allowed */ | 245 | /* Null path case is allowed, just exit */ |
244 | 246 | ||
245 | if (path) { | 247 | if (!path) { |
246 | /* | 248 | arg->common.value.name = path; |
247 | * Lookup the name in the internal namespace | 249 | return_ACPI_STATUS(AE_OK); |
248 | */ | 250 | } |
249 | scope_info.scope.node = NULL; | ||
250 | node = parser_state->start_node; | ||
251 | if (node) { | ||
252 | scope_info.scope.node = node; | ||
253 | } | ||
254 | 251 | ||
255 | /* | 252 | /* Setup search scope info */ |
256 | * Lookup object. We don't want to add anything new to the namespace | 253 | |
257 | * here, however. So we use MODE_EXECUTE. Allow searching of the | 254 | scope_info.scope.node = NULL; |
258 | * parent tree, but don't open a new scope -- we just want to lookup the | 255 | node = parser_state->start_node; |
259 | * object (MUST BE mode EXECUTE to perform upsearch) | 256 | if (node) { |
260 | */ | 257 | scope_info.scope.node = node; |
261 | status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, | 258 | } |
262 | ACPI_IMODE_EXECUTE, | ||
263 | ACPI_NS_SEARCH_PARENT | | ||
264 | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); | ||
265 | if (ACPI_SUCCESS(status) && method_call) { | ||
266 | if (node->type == ACPI_TYPE_METHOD) { | ||
267 | /* This name is actually a control method invocation */ | ||
268 | |||
269 | method_desc = acpi_ns_get_attached_object(node); | ||
270 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
271 | "Control Method - %p Desc %p Path=%p\n", | ||
272 | node, method_desc, path)); | ||
273 | |||
274 | name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); | ||
275 | if (!name_op) { | ||
276 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
277 | } | ||
278 | 259 | ||
279 | /* Change arg into a METHOD CALL and attach name to it */ | 260 | /* |
261 | * Lookup the name in the internal namespace. We don't want to add | ||
262 | * anything new to the namespace here, however, so we use MODE_EXECUTE. | ||
263 | * Allow searching of the parent tree, but don't open a new scope - | ||
264 | * we just want to lookup the object (must be mode EXECUTE to perform | ||
265 | * the upsearch) | ||
266 | */ | ||
267 | status = | ||
268 | acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | ||
269 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
270 | NULL, &node); | ||
280 | 271 | ||
281 | acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); | 272 | /* |
282 | name_op->common.value.name = path; | 273 | * If this name is a control method invocation, we must |
274 | * setup the method call | ||
275 | */ | ||
276 | if (ACPI_SUCCESS(status) && | ||
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | ||
278 | /* This name is actually a control method invocation */ | ||
283 | 279 | ||
284 | /* Point METHODCALL/NAME to the METHOD Node */ | 280 | method_desc = acpi_ns_get_attached_object(node); |
281 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
282 | "Control Method - %p Desc %p Path=%p\n", node, | ||
283 | method_desc, path)); | ||
285 | 284 | ||
286 | name_op->common.node = node; | 285 | name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); |
287 | acpi_ps_append_arg(arg, name_op); | 286 | if (!name_op) { |
287 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
288 | } | ||
288 | 289 | ||
289 | if (!method_desc) { | 290 | /* Change Arg into a METHOD CALL and attach name to it */ |
290 | ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); | ||
291 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
292 | } | ||
293 | 291 | ||
294 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 292 | acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); |
295 | "Control Method - %p Args %X\n", | 293 | name_op->common.value.name = path; |
296 | node, | ||
297 | method_desc->method. | ||
298 | param_count)); | ||
299 | 294 | ||
300 | /* Get the number of arguments to expect */ | 295 | /* Point METHODCALL/NAME to the METHOD Node */ |
301 | 296 | ||
302 | walk_state->arg_count = | 297 | name_op->common.node = node; |
303 | method_desc->method.param_count; | 298 | acpi_ps_append_arg(arg, name_op); |
304 | return_ACPI_STATUS(AE_OK); | ||
305 | } | ||
306 | 299 | ||
307 | /* | 300 | if (!method_desc) { |
308 | * Else this is normal named object reference. | 301 | ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); |
309 | * Just init the NAMEPATH object with the pathname. | 302 | return_ACPI_STATUS(AE_AML_INTERNAL); |
310 | * (See code below) | ||
311 | */ | ||
312 | } | 303 | } |
313 | 304 | ||
314 | if (ACPI_FAILURE(status)) { | 305 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
315 | /* | 306 | "Control Method - %p Args %X\n", |
316 | * 1) Any error other than NOT_FOUND is always severe | 307 | node, method_desc->method.param_count)); |
317 | * 2) NOT_FOUND is only important if we are executing a method. | 308 | |
318 | * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. | 309 | /* Get the number of arguments to expect */ |
319 | */ | 310 | |
320 | if ((((walk_state-> | 311 | walk_state->arg_count = method_desc->method.param_count; |
321 | parse_flags & ACPI_PARSE_MODE_MASK) == | 312 | return_ACPI_STATUS(AE_OK); |
322 | ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND) | ||
323 | && (walk_state->op->common.aml_opcode != | ||
324 | AML_COND_REF_OF_OP)) | ||
325 | || (status != AE_NOT_FOUND)) { | ||
326 | ACPI_REPORT_NSERROR(path, status); | ||
327 | |||
328 | acpi_os_printf | ||
329 | ("search_node %p start_node %p return_node %p\n", | ||
330 | scope_info.scope.node, | ||
331 | parser_state->start_node, node); | ||
332 | } else { | ||
333 | /* | ||
334 | * We got a NOT_FOUND during table load or we encountered | ||
335 | * a cond_ref_of(x) where the target does not exist. | ||
336 | * Either case is ok | ||
337 | */ | ||
338 | status = AE_OK; | ||
339 | } | ||
340 | } | ||
341 | } | 313 | } |
342 | 314 | ||
343 | /* | 315 | /* |
344 | * Regardless of success/failure above, | 316 | * Special handling if the name was not found during the lookup - |
345 | * Just initialize the Op with the pathname. | 317 | * some not_found cases are allowed |
346 | */ | 318 | */ |
347 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 319 | if (status == AE_NOT_FOUND) { |
348 | arg->common.value.name = path; | 320 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ |
321 | |||
322 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != | ||
323 | ACPI_PARSE_EXECUTE) { | ||
324 | status = AE_OK; | ||
325 | } | ||
326 | |||
327 | /* 2) not_found during a cond_ref_of(x) is ok by definition */ | ||
328 | |||
329 | else if (walk_state->op->common.aml_opcode == | ||
330 | AML_COND_REF_OF_OP) { | ||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * 3) not_found while building a Package is ok at this point, we | ||
336 | * may flag as an error later if slack mode is not enabled. | ||
337 | * (Some ASL code depends on allowing this behavior) | ||
338 | */ | ||
339 | else if ((arg->common.parent) && | ||
340 | ((arg->common.parent->common.aml_opcode == | ||
341 | AML_PACKAGE_OP) | ||
342 | || (arg->common.parent->common.aml_opcode == | ||
343 | AML_VAR_PACKAGE_OP))) { | ||
344 | status = AE_OK; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | /* Final exception check (may have been changed from code above) */ | ||
349 | |||
350 | if (ACPI_FAILURE(status)) { | ||
351 | ACPI_REPORT_NSERROR(path, status); | ||
352 | |||
353 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | ||
354 | ACPI_PARSE_EXECUTE) { | ||
355 | /* Report a control method execution error */ | ||
349 | 356 | ||
357 | status = acpi_ds_method_error(status, walk_state); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | /* Save the namepath */ | ||
362 | |||
363 | arg->common.value.name = path; | ||
350 | return_ACPI_STATUS(status); | 364 | return_ACPI_STATUS(status); |
351 | } | 365 | } |
352 | 366 | ||
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 088d33999d90..e81e51b8b3ae 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -704,6 +704,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
704 | acpi_ps_pop_scope(parser_state, &op, | 704 | acpi_ps_pop_scope(parser_state, &op, |
705 | &walk_state->arg_types, | 705 | &walk_state->arg_types, |
706 | &walk_state->arg_count); | 706 | &walk_state->arg_count); |
707 | |||
708 | if (op->common.aml_opcode != AML_WHILE_OP) { | ||
709 | status2 = | ||
710 | acpi_ds_result_stack_pop | ||
711 | (walk_state); | ||
712 | if (ACPI_FAILURE(status2)) { | ||
713 | return_ACPI_STATUS(status2); | ||
714 | } | ||
715 | } | ||
707 | } | 716 | } |
708 | 717 | ||
709 | /* Close this iteration of the While loop */ | 718 | /* Close this iteration of the While loop */ |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 7cfa7eb0dfc7..f0979b2956f2 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -333,7 +333,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
333 | 333 | ||
334 | switch (callback_status) { | 334 | switch (callback_status) { |
335 | case AE_CTRL_TERMINATE: | 335 | case AE_CTRL_TERMINATE: |
336 | |||
337 | /* | 336 | /* |
338 | * A control method was terminated via a RETURN statement. | 337 | * A control method was terminated via a RETURN statement. |
339 | * The walk of this method is complete. | 338 | * The walk of this method is complete. |
@@ -346,13 +345,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
346 | 345 | ||
347 | parser_state->aml = walk_state->aml_last_while; | 346 | parser_state->aml = walk_state->aml_last_while; |
348 | walk_state->control_state->common.value = FALSE; | 347 | walk_state->control_state->common.value = FALSE; |
349 | status = AE_CTRL_BREAK; | 348 | status = acpi_ds_result_stack_pop(walk_state); |
349 | if (ACPI_SUCCESS(status)) { | ||
350 | status = AE_CTRL_BREAK; | ||
351 | } | ||
350 | break; | 352 | break; |
351 | 353 | ||
352 | case AE_CTRL_CONTINUE: | 354 | case AE_CTRL_CONTINUE: |
353 | 355 | ||
354 | parser_state->aml = walk_state->aml_last_while; | 356 | parser_state->aml = walk_state->aml_last_while; |
355 | status = AE_CTRL_CONTINUE; | 357 | status = acpi_ds_result_stack_pop(walk_state); |
358 | if (ACPI_SUCCESS(status)) { | ||
359 | status = AE_CTRL_CONTINUE; | ||
360 | } | ||
356 | break; | 361 | break; |
357 | 362 | ||
358 | case AE_CTRL_PENDING: | 363 | case AE_CTRL_PENDING: |
@@ -369,16 +374,18 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
369 | #endif | 374 | #endif |
370 | 375 | ||
371 | case AE_CTRL_TRUE: | 376 | case AE_CTRL_TRUE: |
372 | |||
373 | /* | 377 | /* |
374 | * Predicate of an IF was true, and we are at the matching ELSE. | 378 | * Predicate of an IF was true, and we are at the matching ELSE. |
375 | * Just close out this package | 379 | * Just close out this package |
376 | */ | 380 | */ |
377 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); | 381 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); |
382 | status = acpi_ds_result_stack_pop(walk_state); | ||
383 | if (ACPI_SUCCESS(status)) { | ||
384 | status = AE_CTRL_PENDING; | ||
385 | } | ||
378 | break; | 386 | break; |
379 | 387 | ||
380 | case AE_CTRL_FALSE: | 388 | case AE_CTRL_FALSE: |
381 | |||
382 | /* | 389 | /* |
383 | * Either an IF/WHILE Predicate was false or we encountered a BREAK | 390 | * Either an IF/WHILE Predicate was false or we encountered a BREAK |
384 | * opcode. In both cases, we do not execute the rest of the | 391 | * opcode. In both cases, we do not execute the rest of the |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index cebd890d3db5..c24e3eb658c3 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/acdisasm.h> | ||
47 | 46 | ||
48 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME("rsdump") | 48 | ACPI_MODULE_NAME("rsdump") |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index e04b6119a4d7..b11b7ed788c6 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -47,7 +47,7 @@ | |||
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | 49 | /* Local prototypes */ |
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | 51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); |
52 | 52 | ||
53 | static acpi_status | 53 | static acpi_status |
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | |||
58 | static acpi_status | 58 | static acpi_status |
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | 59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, |
60 | u32 component, char *module, u32 line); | 60 | u32 component, char *module, u32 line); |
61 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
62 | 61 | ||
63 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
64 | static acpi_status | 62 | static acpi_status |
65 | acpi_ut_create_list(char *list_name, | 63 | acpi_ut_create_list(char *list_name, |
66 | u16 object_size, struct acpi_memory_list **return_cache); | 64 | u16 object_size, struct acpi_memory_list **return_cache); |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 7b81d5ef3c32..cd63a2d93fe3 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -95,7 +95,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
95 | 95 | ||
96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { | 96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { |
97 | if (!ACPI_STRCMP(string_desc->string.pointer, | 97 | if (!ACPI_STRCMP(string_desc->string.pointer, |
98 | (char *)acpi_gbl_valid_osi_strings[i])) { | 98 | ACPI_CAST_PTR(char, |
99 | acpi_gbl_valid_osi_strings[i]))) | ||
100 | { | ||
99 | /* This string is supported */ | 101 | /* This string is supported */ |
100 | 102 | ||
101 | return_desc->integer.value = 0xFFFFFFFF; | 103 | return_desc->integer.value = 0xFFFFFFFF; |
@@ -592,7 +594,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
592 | "_STA on %4.4s was not found, assuming device is present\n", | 594 | "_STA on %4.4s was not found, assuming device is present\n", |
593 | acpi_ut_get_node_name(device_node))); | 595 | acpi_ut_get_node_name(device_node))); |
594 | 596 | ||
595 | *flags = 0x0F; | 597 | *flags = ACPI_UINT32_MAX; |
596 | status = AE_OK; | 598 | status = AE_OK; |
597 | } | 599 | } |
598 | 600 | ||
@@ -637,17 +639,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | |||
637 | for (i = 0; i < 4; i++) { | 639 | for (i = 0; i < 4; i++) { |
638 | highest[i] = 0xFF; | 640 | highest[i] = 0xFF; |
639 | status = acpi_ut_evaluate_object(device_node, | 641 | status = acpi_ut_evaluate_object(device_node, |
640 | (char *) | 642 | ACPI_CAST_PTR(char, |
641 | acpi_gbl_highest_dstate_names | 643 | acpi_gbl_highest_dstate_names |
642 | [i], ACPI_BTYPE_INTEGER, | 644 | [i]), |
643 | &obj_desc); | 645 | ACPI_BTYPE_INTEGER, &obj_desc); |
644 | if (ACPI_FAILURE(status)) { | 646 | if (ACPI_FAILURE(status)) { |
645 | if (status != AE_NOT_FOUND) { | 647 | if (status != AE_NOT_FOUND) { |
646 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 648 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
647 | "%s on Device %4.4s, %s\n", | 649 | "%s on Device %4.4s, %s\n", |
648 | (char *) | 650 | ACPI_CAST_PTR(char, |
649 | acpi_gbl_highest_dstate_names | 651 | acpi_gbl_highest_dstate_names |
650 | [i], | 652 | [i]), |
651 | acpi_ut_get_node_name | 653 | acpi_ut_get_node_name |
652 | (device_node), | 654 | (device_node), |
653 | acpi_format_exception | 655 | acpi_format_exception |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 6828c7aefa8a..7c59c2b0d953 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -485,7 +485,7 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
485 | return ("invalid_space_id"); | 485 | return ("invalid_space_id"); |
486 | } | 486 | } |
487 | 487 | ||
488 | return ((char *)acpi_gbl_region_types[space_id]); | 488 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
489 | } | 489 | } |
490 | 490 | ||
491 | /******************************************************************************* | 491 | /******************************************************************************* |
@@ -690,11 +690,12 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
690 | } | 690 | } |
691 | 691 | ||
692 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { | 692 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { |
693 | return ((char *)acpi_gbl_bad_type); | 693 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); |
694 | } | 694 | } |
695 | 695 | ||
696 | return ((char *) | 696 | return (ACPI_CAST_PTR(char, |
697 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); | 697 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE |
698 | (object)])); | ||
698 | 699 | ||
699 | } | 700 | } |
700 | 701 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 64dd64b1aa18..48d511d5c04b 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -179,7 +179,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
179 | 179 | ||
180 | /* Zero is not a valid owner_iD */ | 180 | /* Zero is not a valid owner_iD */ |
181 | 181 | ||
182 | if ((owner_id == 0) || (owner_id > 255)) { | 182 | if (owner_id == 0) { |
183 | ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); | 183 | ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); |
184 | return_VOID; | 184 | return_VOID; |
185 | } | 185 | } |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 6c0ce7b12194..eaf0edec6efe 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -47,6 +47,115 @@ | |||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utmisc") | 48 | ACPI_MODULE_NAME("utmisc") |
49 | 49 | ||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
51 | /* | ||
52 | * Strings used to decode resource descriptors. | ||
53 | * Used by both the disasssembler and the debugger resource dump routines | ||
54 | */ | ||
55 | const char *acpi_gbl_BMdecode[2] = { | ||
56 | "not_bus_master", | ||
57 | "bus_master" | ||
58 | }; | ||
59 | |||
60 | const char *acpi_gbl_config_decode[4] = { | ||
61 | "0 - Good Configuration", | ||
62 | "1 - Acceptable Configuration", | ||
63 | "2 - Suboptimal Configuration", | ||
64 | "3 - ***Invalid Configuration***", | ||
65 | }; | ||
66 | |||
67 | const char *acpi_gbl_consume_decode[2] = { | ||
68 | "resource_producer", | ||
69 | "resource_consumer" | ||
70 | }; | ||
71 | |||
72 | const char *acpi_gbl_DECdecode[2] = { | ||
73 | "pos_decode", | ||
74 | "sub_decode" | ||
75 | }; | ||
76 | |||
77 | const char *acpi_gbl_HEdecode[2] = { | ||
78 | "Level", | ||
79 | "Edge" | ||
80 | }; | ||
81 | |||
82 | const char *acpi_gbl_io_decode[2] = { | ||
83 | "Decode10", | ||
84 | "Decode16" | ||
85 | }; | ||
86 | |||
87 | const char *acpi_gbl_LLdecode[2] = { | ||
88 | "active_high", | ||
89 | "active_low" | ||
90 | }; | ||
91 | |||
92 | const char *acpi_gbl_max_decode[2] = { | ||
93 | "max_not_fixed", | ||
94 | "max_fixed" | ||
95 | }; | ||
96 | |||
97 | const char *acpi_gbl_MEMdecode[4] = { | ||
98 | "non_cacheable", | ||
99 | "Cacheable", | ||
100 | "write_combining", | ||
101 | "Prefetchable" | ||
102 | }; | ||
103 | |||
104 | const char *acpi_gbl_min_decode[2] = { | ||
105 | "min_not_fixed", | ||
106 | "min_fixed" | ||
107 | }; | ||
108 | |||
109 | const char *acpi_gbl_MTPdecode[4] = { | ||
110 | "address_range_memory", | ||
111 | "address_range_reserved", | ||
112 | "address_range_aCPI", | ||
113 | "address_range_nVS" | ||
114 | }; | ||
115 | |||
116 | const char *acpi_gbl_RNGdecode[4] = { | ||
117 | "invalid_ranges", | ||
118 | "non_iSAonly_ranges", | ||
119 | "ISAonly_ranges", | ||
120 | "entire_range" | ||
121 | }; | ||
122 | |||
123 | const char *acpi_gbl_RWdecode[2] = { | ||
124 | "read_only", | ||
125 | "read_write" | ||
126 | }; | ||
127 | |||
128 | const char *acpi_gbl_SHRdecode[2] = { | ||
129 | "Exclusive", | ||
130 | "Shared" | ||
131 | }; | ||
132 | |||
133 | const char *acpi_gbl_SIZdecode[4] = { | ||
134 | "Transfer8", | ||
135 | "Transfer8_16", | ||
136 | "Transfer16", | ||
137 | "invalid_size" | ||
138 | }; | ||
139 | |||
140 | const char *acpi_gbl_TRSdecode[2] = { | ||
141 | "dense_translation", | ||
142 | "sparse_translation" | ||
143 | }; | ||
144 | |||
145 | const char *acpi_gbl_TTPdecode[2] = { | ||
146 | "type_static", | ||
147 | "type_translation" | ||
148 | }; | ||
149 | |||
150 | const char *acpi_gbl_TYPdecode[4] = { | ||
151 | "Compatibility", | ||
152 | "type_a", | ||
153 | "type_b", | ||
154 | "type_f" | ||
155 | }; | ||
156 | |||
157 | #endif | ||
158 | |||
50 | /* | 159 | /* |
51 | * Base sizes of the raw AML resource descriptors, indexed by resource type. | 160 | * Base sizes of the raw AML resource descriptors, indexed by resource type. |
52 | * Zero indicates a reserved (and therefore invalid) resource type. | 161 | * Zero indicates a reserved (and therefore invalid) resource type. |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index f48b9ee9a876..1f2477eb95fe 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20051202 | 66 | #define ACPI_CA_VERSION 0x20051216 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 99250ee1b9d1..0a8f49f5d2f1 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -57,27 +57,11 @@ struct acpi_external_list { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | extern struct acpi_external_list *acpi_gbl_external_list; | 59 | extern struct acpi_external_list *acpi_gbl_external_list; |
60 | extern const char *acpi_gbl_io_decode[2]; | 60 | |
61 | /* Strings used for decoding flags to ASL keywords */ | ||
62 | |||
61 | extern const char *acpi_gbl_word_decode[4]; | 63 | extern const char *acpi_gbl_word_decode[4]; |
62 | extern const char *acpi_gbl_consume_decode[2]; | ||
63 | extern const char *acpi_gbl_config_decode[4]; | ||
64 | extern const char *acpi_gbl_min_decode[2]; | ||
65 | extern const char *acpi_gbl_max_decode[2]; | ||
66 | extern const char *acpi_gbl_DECdecode[2]; | ||
67 | extern const char *acpi_gbl_RNGdecode[4]; | ||
68 | extern const char *acpi_gbl_MEMdecode[4]; | ||
69 | extern const char *acpi_gbl_RWdecode[2]; | ||
70 | extern const char *acpi_gbl_irq_decode[2]; | 64 | extern const char *acpi_gbl_irq_decode[2]; |
71 | extern const char *acpi_gbl_HEdecode[2]; | ||
72 | extern const char *acpi_gbl_LLdecode[2]; | ||
73 | extern const char *acpi_gbl_SHRdecode[2]; | ||
74 | extern const char *acpi_gbl_TYPdecode[4]; | ||
75 | extern const char *acpi_gbl_BMdecode[2]; | ||
76 | extern const char *acpi_gbl_SIZdecode[4]; | ||
77 | extern const char *acpi_gbl_TTPdecode[2]; | ||
78 | extern const char *acpi_gbl_MTPdecode[4]; | ||
79 | extern const char *acpi_gbl_TRSdecode[2]; | ||
80 | |||
81 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; | 65 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; |
82 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; | 66 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; |
83 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; | 67 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; |
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 065f24a77cfc..cc6407eef701 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -201,6 +201,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
201 | union acpi_operand_object *obj_desc, | 201 | union acpi_operand_object *obj_desc, |
202 | struct acpi_namespace_node *calling_method_node); | 202 | struct acpi_namespace_node *calling_method_node); |
203 | 203 | ||
204 | acpi_status | ||
205 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); | ||
206 | |||
204 | /* | 207 | /* |
205 | * dsinit | 208 | * dsinit |
206 | */ | 209 | */ |
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 3f37560c26ab..dfb3b2493ae5 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -98,11 +98,15 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; | |||
98 | /* | 98 | /* |
99 | * Enable "slack" in the AML interpreter? Default is FALSE, and the | 99 | * Enable "slack" in the AML interpreter? Default is FALSE, and the |
100 | * interpreter strictly follows the ACPI specification. Setting to TRUE | 100 | * interpreter strictly follows the ACPI specification. Setting to TRUE |
101 | * allows the interpreter to forgive certain bad AML constructs. Currently: | 101 | * allows the interpreter to ignore certain errors and/or bad AML constructs. |
102 | * | ||
103 | * Currently, these features are enabled by this flag: | ||
104 | * | ||
102 | * 1) Allow "implicit return" of last value in a control method | 105 | * 1) Allow "implicit return" of last value in a control method |
103 | * 2) Allow access beyond end of operation region | 106 | * 2) Allow access beyond the end of an operation region |
104 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | 107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) |
105 | * 4) Allow ANY object type to be a source operand for the Store() operator | 108 | * 4) Allow ANY object type to be a source operand for the Store() operator |
109 | * 5) Allow unresolved references (invalid target name) in package objects | ||
106 | */ | 110 | */ |
107 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | 111 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); |
108 | 112 | ||
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 0cb61a72d971..da7f1cb96f5d 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -276,6 +276,37 @@ struct acpi_create_field_info { | |||
276 | u8 field_type; | 276 | u8 field_type; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | /* | ||
280 | * Bitmapped ACPI types. Used internally only | ||
281 | */ | ||
282 | #define ACPI_BTYPE_ANY 0x00000000 | ||
283 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
284 | #define ACPI_BTYPE_STRING 0x00000002 | ||
285 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
286 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
287 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
288 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
289 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
290 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
291 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
292 | #define ACPI_BTYPE_REGION 0x00000200 | ||
293 | #define ACPI_BTYPE_POWER 0x00000400 | ||
294 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
295 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
296 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
297 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
298 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
299 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
300 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
301 | |||
302 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
303 | |||
304 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
305 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
306 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
307 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
308 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
309 | |||
279 | /***************************************************************************** | 310 | /***************************************************************************** |
280 | * | 311 | * |
281 | * Event typedefs and structs | 312 | * Event typedefs and structs |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 65a1a5c1a689..0fa8f72dbace 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -60,7 +60,7 @@ | |||
60 | 60 | ||
61 | /* | 61 | /* |
62 | * For 16-bit addresses, we have to assume that the upper 32 bits | 62 | * For 16-bit addresses, we have to assume that the upper 32 bits |
63 | * are zero. | 63 | * (out of 64) are zero. |
64 | */ | 64 | */ |
65 | #define ACPI_LODWORD(l) ((u32)(l)) | 65 | #define ACPI_LODWORD(l) ((u32)(l)) |
66 | #define ACPI_HIDWORD(l) ((u32)(0)) | 66 | #define ACPI_HIDWORD(l) ((u32)(0)) |
@@ -104,8 +104,9 @@ | |||
104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | 104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Extract a byte of data using a pointer. Any more than a byte and we | 107 | * Extract data using a pointer. Any more than a byte and we |
108 | * get into potential aligment issues -- see the STORE macros below | 108 | * get into potential aligment issues -- see the STORE macros below. |
109 | * Use with care. | ||
109 | */ | 110 | */ |
110 | #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) | 111 | #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) |
111 | #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) | 112 | #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) |
@@ -116,16 +117,17 @@ | |||
116 | #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) | 117 | #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) |
117 | #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) | 118 | #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) |
118 | 119 | ||
119 | /* Pointer manipulation */ | 120 | /* |
120 | 121 | * Pointer manipulation | |
121 | #define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) | 122 | */ |
122 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) | 123 | #define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) |
123 | #define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_native_uint)(b))) | 124 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) |
124 | #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) | 125 | #define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_native_uint)(b))) |
126 | #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) | ||
125 | 127 | ||
126 | /* Pointer/Integer type conversions */ | 128 | /* Pointer/Integer type conversions */ |
127 | 129 | ||
128 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_native_uint)i) | 130 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) |
129 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | 131 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) |
130 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | 132 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) |
131 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) | 133 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) |
@@ -133,7 +135,7 @@ | |||
133 | #if ACPI_MACHINE_WIDTH == 16 | 135 | #if ACPI_MACHINE_WIDTH == 16 |
134 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) | 136 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) |
135 | #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) | 137 | #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) |
136 | #define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) | 138 | #define ACPI_PTR_TO_PHYSADDR(i) (u32) ACPI_CAST_PTR (u8,(i)) |
137 | #else | 139 | #else |
138 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) | 140 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) |
139 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 141 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index a46f406e1c94..ef2ddcadfe61 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -45,6 +45,12 @@ | |||
45 | #define __ACTBL_H__ | 45 | #define __ACTBL_H__ |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | ||
49 | * This is the only type that is even remotely portable. Anything else is not | ||
50 | * portable, so do not use any other bitfield types. | ||
51 | */ | ||
52 | |||
53 | /* | ||
48 | * Values for description table header signatures | 54 | * Values for description table header signatures |
49 | */ | 55 | */ |
50 | #define RSDP_NAME "RSDP" | 56 | #define RSDP_NAME "RSDP" |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 11847592ed1b..18e1338c5c7f 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -44,7 +44,15 @@ | |||
44 | #ifndef __ACTYPES_H__ | 44 | #ifndef __ACTYPES_H__ |
45 | #define __ACTYPES_H__ | 45 | #define __ACTYPES_H__ |
46 | 46 | ||
47 | /*! [Begin] no source code translation (keep the typedefs) */ | 47 | /* |
48 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header | ||
49 | * and must be either 16, 32, or 64 | ||
50 | */ | ||
51 | #ifndef ACPI_MACHINE_WIDTH | ||
52 | #error ACPI_MACHINE_WIDTH not defined | ||
53 | #endif | ||
54 | |||
55 | /*! [Begin] no source code translation */ | ||
48 | 56 | ||
49 | /* | 57 | /* |
50 | * Data type ranges | 58 | * Data type ranges |
@@ -58,154 +66,210 @@ | |||
58 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ | 66 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ |
59 | #define ACPI_ASCII_MAX 0x7F | 67 | #define ACPI_ASCII_MAX 0x7F |
60 | 68 | ||
61 | #ifdef DEFINE_ALTERNATE_TYPES | ||
62 | /* | 69 | /* |
63 | * Types used only in translated source, defined here to enable | 70 | * Architecture-specific ACPICA Subsystem Data Types |
64 | * cross-platform compilation only. | 71 | * |
72 | * The goal of these types is to provide source code portability across | ||
73 | * 16-bit, 32-bit, and 64-bit targets. | ||
74 | * | ||
75 | * 1) The following types are of fixed size for all targets (16/32/64): | ||
76 | * | ||
77 | * BOOLEAN Logical boolean | ||
78 | * | ||
79 | * UINT8 8-bit (1 byte) unsigned value | ||
80 | * UINT16 16-bit (2 byte) unsigned value | ||
81 | * UINT32 32-bit (4 byte) unsigned value | ||
82 | * UINT64 64-bit (8 byte) unsigned value | ||
83 | * | ||
84 | * INT16 16-bit (2 byte) signed value | ||
85 | * INT32 32-bit (4 byte) signed value | ||
86 | * INT64 64-bit (8 byte) signed value | ||
87 | * | ||
88 | * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the | ||
89 | * compiler-dependent header(s) and were introduced because there is no common | ||
90 | * 64-bit integer type across the various compilation models, as shown in | ||
91 | * the table below. | ||
92 | * | ||
93 | * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit | ||
94 | * char 8 8 8 8 8 8 | ||
95 | * short 16 16 16 16 16 16 | ||
96 | * _int32 32 | ||
97 | * int 32 64 32 32 16 16 | ||
98 | * long 64 64 32 32 32 32 | ||
99 | * long long 64 64 | ||
100 | * pointer 64 64 64 32 32 32 | ||
101 | * | ||
102 | * Note: ILP64 and LP32 are currently not supported. | ||
103 | * | ||
104 | * | ||
105 | * 2) These types represent the native word size of the target mode of the | ||
106 | * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are | ||
107 | * usually used for memory allocation, efficient loop counters, and array | ||
108 | * indexes. The types are similar to the size_t type in the C library and are | ||
109 | * required because there is no C type that consistently represents the native | ||
110 | * data width. | ||
111 | * | ||
112 | * ACPI_SIZE 16/32/64-bit unsigned value | ||
113 | * ACPI_NATIVE_UINT 16/32/64-bit unsigned value | ||
114 | * ACPI_NATIVE_INT 16/32/64-bit signed value | ||
115 | * | ||
65 | */ | 116 | */ |
66 | typedef int s32; | ||
67 | typedef unsigned char u8; | ||
68 | typedef unsigned short u16; | ||
69 | typedef unsigned int u32; | ||
70 | typedef COMPILER_DEPENDENT_UINT64 u64; | ||
71 | 117 | ||
72 | #endif | 118 | /******************************************************************************* |
73 | |||
74 | /* | ||
75 | * Data types - Fixed across all compilation models (16/32/64) | ||
76 | * | 119 | * |
77 | * BOOLEAN Logical Boolean. | 120 | * Common types for all compilers, all targets |
78 | * INT8 8-bit (1 byte) signed value | 121 | * |
79 | * UINT8 8-bit (1 byte) unsigned value | 122 | ******************************************************************************/ |
80 | * INT16 16-bit (2 byte) signed value | 123 | |
81 | * UINT16 16-bit (2 byte) unsigned value | 124 | typedef unsigned char BOOLEAN; |
82 | * INT32 32-bit (4 byte) signed value | 125 | typedef unsigned char UINT8; |
83 | * UINT32 32-bit (4 byte) unsigned value | 126 | typedef unsigned short UINT16; |
84 | * INT64 64-bit (8 byte) signed value | 127 | typedef COMPILER_DEPENDENT_UINT64 UINT64; |
85 | * UINT64 64-bit (8 byte) unsigned value | 128 | typedef COMPILER_DEPENDENT_INT64 INT64; |
86 | * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value | ||
87 | */ | ||
88 | 129 | ||
89 | typedef unsigned long acpi_native_uint; | 130 | /*! [End] no source code translation !*/ |
90 | 131 | ||
91 | #ifndef ACPI_MACHINE_WIDTH | 132 | /******************************************************************************* |
92 | #error ACPI_MACHINE_WIDTH not defined | 133 | * |
93 | #endif | 134 | * Types specific to 64-bit targets |
135 | * | ||
136 | ******************************************************************************/ | ||
94 | 137 | ||
95 | #if ACPI_MACHINE_WIDTH == 64 | 138 | #if ACPI_MACHINE_WIDTH == 64 |
96 | 139 | ||
97 | /*! [Begin] no source code translation (keep the typedefs) */ | 140 | /*! [Begin] no source code translation (keep the typedefs as-is) */ |
98 | 141 | ||
99 | /* | ||
100 | * 64-bit type definitions | ||
101 | */ | ||
102 | typedef unsigned char UINT8; | ||
103 | typedef unsigned char BOOLEAN; | ||
104 | typedef unsigned short UINT16; | ||
105 | typedef int INT32; | ||
106 | typedef unsigned int UINT32; | 142 | typedef unsigned int UINT32; |
107 | typedef COMPILER_DEPENDENT_INT64 INT64; | 143 | typedef int INT32; |
108 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
109 | 144 | ||
110 | /*! [End] no source code translation !*/ | 145 | /*! [End] no source code translation !*/ |
111 | 146 | ||
147 | typedef u64 acpi_native_uint; | ||
148 | typedef s64 acpi_native_int; | ||
149 | |||
112 | typedef u64 acpi_table_ptr; | 150 | typedef u64 acpi_table_ptr; |
113 | typedef u64 acpi_io_address; | 151 | typedef u64 acpi_io_address; |
114 | typedef u64 acpi_physical_address; | 152 | typedef u64 acpi_physical_address; |
115 | typedef u64 acpi_size; | ||
116 | 153 | ||
117 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ | ||
118 | #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ | ||
119 | #define ACPI_MAX_PTR ACPI_UINT64_MAX | 154 | #define ACPI_MAX_PTR ACPI_UINT64_MAX |
120 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | 155 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX |
121 | 156 | ||
157 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 | ||
158 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ | ||
159 | |||
122 | /* | 160 | /* |
123 | * In the case of the Itanium Processor Family (IPF), the hardware does not | 161 | * In the case of the Itanium Processor Family (IPF), the hardware does not |
124 | * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag | 162 | * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag |
125 | * to indicate that special precautions must be taken to avoid alignment faults. | 163 | * to indicate that special precautions must be taken to avoid alignment faults. |
126 | * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) | 164 | * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) |
127 | * | 165 | * |
128 | * Note: Em64_t and other X86-64 processors do support misaligned transfers, | 166 | * Note: Em64_t and other X86-64 processors support misaligned transfers, |
129 | * so there is no need to define this flag. | 167 | * so there is no need to define this flag. |
130 | */ | 168 | */ |
131 | #if defined (__IA64__) || defined (__ia64__) | 169 | #if defined (__IA64__) || defined (__ia64__) |
132 | #define ACPI_MISALIGNMENT_NOT_SUPPORTED | 170 | #define ACPI_MISALIGNMENT_NOT_SUPPORTED |
133 | #endif | 171 | #endif |
134 | 172 | ||
173 | /******************************************************************************* | ||
174 | * | ||
175 | * Types specific to 32-bit targets | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | #elif ACPI_MACHINE_WIDTH == 32 | ||
180 | |||
181 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | ||
182 | |||
183 | typedef unsigned int UINT32; | ||
184 | typedef int INT32; | ||
185 | |||
186 | /*! [End] no source code translation !*/ | ||
187 | |||
188 | typedef u32 acpi_native_uint; | ||
189 | typedef s32 acpi_native_int; | ||
190 | |||
191 | typedef u64 acpi_table_ptr; | ||
192 | typedef u32 acpi_io_address; | ||
193 | typedef u64 acpi_physical_address; | ||
194 | |||
195 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | ||
196 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | ||
197 | |||
198 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | ||
199 | |||
200 | /******************************************************************************* | ||
201 | * | ||
202 | * Types specific to 16-bit targets | ||
203 | * | ||
204 | ******************************************************************************/ | ||
205 | |||
135 | #elif ACPI_MACHINE_WIDTH == 16 | 206 | #elif ACPI_MACHINE_WIDTH == 16 |
136 | 207 | ||
137 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | 208 | /*! [Begin] no source code translation (keep the typedefs as-is) */ |
138 | 209 | ||
139 | /* | ||
140 | * 16-bit type definitions | ||
141 | */ | ||
142 | typedef unsigned char UINT8; | ||
143 | typedef unsigned char BOOLEAN; | ||
144 | typedef unsigned int UINT16; | ||
145 | typedef long INT32; | ||
146 | typedef int INT16; | ||
147 | typedef unsigned long UINT32; | 210 | typedef unsigned long UINT32; |
148 | 211 | typedef short INT16; | |
149 | struct { | 212 | typedef long INT32; |
150 | UINT32 Lo; | ||
151 | UINT32 Hi; | ||
152 | }; | ||
153 | 213 | ||
154 | /*! [End] no source code translation !*/ | 214 | /*! [End] no source code translation !*/ |
155 | 215 | ||
216 | typedef u16 acpi_native_uint; | ||
217 | typedef s16 acpi_native_int; | ||
218 | |||
156 | typedef u32 acpi_table_ptr; | 219 | typedef u32 acpi_table_ptr; |
157 | typedef u32 acpi_io_address; | 220 | typedef u32 acpi_io_address; |
158 | typedef char *acpi_physical_address; | 221 | typedef char *acpi_physical_address; |
159 | typedef u16 acpi_size; | ||
160 | 222 | ||
161 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | ||
162 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ | ||
163 | #define ACPI_MAX_PTR ACPI_UINT16_MAX | 223 | #define ACPI_MAX_PTR ACPI_UINT16_MAX |
164 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | 224 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX |
165 | 225 | ||
166 | /* | 226 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 |
167 | * (16-bit only) internal integers must be 32-bits, so | 227 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ |
168 | * 64-bit integers cannot be supported | ||
169 | */ | ||
170 | #define ACPI_NO_INTEGER64_SUPPORT | ||
171 | 228 | ||
172 | #elif ACPI_MACHINE_WIDTH == 32 | 229 | /* 64-bit integers cannot be supported */ |
173 | 230 | ||
174 | /*! [Begin] no source code translation (keep the typedefs) */ | 231 | #define ACPI_NO_INTEGER64_SUPPORT |
175 | 232 | ||
176 | /* | 233 | #else |
177 | * 32-bit type definitions (default) | ||
178 | */ | ||
179 | typedef unsigned char UINT8; | ||
180 | typedef unsigned char BOOLEAN; | ||
181 | typedef unsigned short UINT16; | ||
182 | typedef int INT32; | ||
183 | typedef unsigned int UINT32; | ||
184 | typedef COMPILER_DEPENDENT_INT64 INT64; | ||
185 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
186 | 234 | ||
187 | /*! [End] no source code translation !*/ | 235 | /* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ |
188 | 236 | ||
189 | typedef u64 acpi_table_ptr; | 237 | #error unknown ACPI_MACHINE_WIDTH |
190 | typedef u32 acpi_io_address; | 238 | #endif |
191 | typedef u64 acpi_physical_address; | ||
192 | typedef u32 acpi_size; | ||
193 | 239 | ||
194 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | 240 | /******************************************************************************* |
195 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | 241 | * |
196 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | 242 | * OS- or compiler-dependent types |
243 | * | ||
244 | ******************************************************************************/ | ||
197 | 245 | ||
198 | #else | 246 | /* |
199 | #error unknown ACPI_MACHINE_WIDTH | 247 | * If acpi_uintptr_t was not defined in the OS- or compiler-dependent header, |
248 | * define it now (use C99 uintptr_t for pointer casting if available, | ||
249 | * "void *" otherwise) | ||
250 | */ | ||
251 | #ifndef acpi_uintptr_t | ||
252 | #define acpi_uintptr_t void * | ||
200 | #endif | 253 | #endif |
201 | 254 | ||
202 | /* | 255 | /* |
203 | * This type is used for bitfields in ACPI tables. The only type that is | 256 | * If acpi_cache_t was not defined in the OS-dependent header, |
204 | * even remotely portable is u8. Anything else is not portable, so | 257 | * define it now. This is typically the case where the local cache |
205 | * do not add any more bitfield types. | 258 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) |
206 | */ | 259 | */ |
207 | typedef u8 UINT8_BIT; | 260 | #ifndef acpi_cache_t |
208 | typedef acpi_native_uint ACPI_PTRDIFF; | 261 | #define acpi_cache_t struct acpi_memory_list |
262 | #endif | ||
263 | |||
264 | /* Variable-width type, used instead of clib size_t */ | ||
265 | |||
266 | typedef acpi_native_uint acpi_size; | ||
267 | |||
268 | /******************************************************************************* | ||
269 | * | ||
270 | * Independent types | ||
271 | * | ||
272 | ******************************************************************************/ | ||
209 | 273 | ||
210 | /* | 274 | /* |
211 | * Pointer overlays to avoid lots of typecasting for | 275 | * Pointer overlays to avoid lots of typecasting for |
@@ -237,18 +301,8 @@ struct acpi_pointer { | |||
237 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | 301 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER |
238 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER | 302 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER |
239 | 303 | ||
240 | /* | 304 | /* Logical defines and NULL */ |
241 | * If acpi_cache_t was not defined in the OS-dependent header, | ||
242 | * define it now. This is typically the case where the local cache | ||
243 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | ||
244 | */ | ||
245 | #ifndef acpi_cache_t | ||
246 | #define acpi_cache_t struct acpi_memory_list | ||
247 | #endif | ||
248 | 305 | ||
249 | /* | ||
250 | * Useful defines | ||
251 | */ | ||
252 | #ifdef FALSE | 306 | #ifdef FALSE |
253 | #undef FALSE | 307 | #undef FALSE |
254 | #endif | 308 | #endif |
@@ -264,12 +318,12 @@ struct acpi_pointer { | |||
264 | #endif | 318 | #endif |
265 | 319 | ||
266 | /* | 320 | /* |
267 | * Local datatypes | 321 | * Mescellaneous types |
268 | */ | 322 | */ |
269 | typedef u32 acpi_status; /* All ACPI Exceptions */ | 323 | typedef u32 acpi_status; /* All ACPI Exceptions */ |
270 | typedef u32 acpi_name; /* 4-byte ACPI name */ | 324 | typedef u32 acpi_name; /* 4-byte ACPI name */ |
271 | typedef char *acpi_string; /* Null terminated ASCII string */ | 325 | typedef char *acpi_string; /* Null terminated ASCII string */ |
272 | typedef void *acpi_handle; /* Actually a ptr to an Node */ | 326 | typedef void *acpi_handle; /* Actually a ptr to a NS Node */ |
273 | 327 | ||
274 | struct uint64_struct { | 328 | struct uint64_struct { |
275 | u32 lo; | 329 | u32 lo; |
@@ -473,37 +527,6 @@ typedef u32 acpi_object_type; | |||
473 | #define ACPI_TYPE_NOT_FOUND 0xFF | 527 | #define ACPI_TYPE_NOT_FOUND 0xFF |
474 | 528 | ||
475 | /* | 529 | /* |
476 | * Bitmapped ACPI types. Used internally only | ||
477 | */ | ||
478 | #define ACPI_BTYPE_ANY 0x00000000 | ||
479 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
480 | #define ACPI_BTYPE_STRING 0x00000002 | ||
481 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
482 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
483 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
484 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
485 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
486 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
487 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
488 | #define ACPI_BTYPE_REGION 0x00000200 | ||
489 | #define ACPI_BTYPE_POWER 0x00000400 | ||
490 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
491 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
492 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
493 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
494 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
495 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
496 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
497 | |||
498 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
499 | |||
500 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
501 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
502 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
503 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
504 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
505 | |||
506 | /* | ||
507 | * All I/O | 530 | * All I/O |
508 | */ | 531 | */ |
509 | #define ACPI_READ 0 | 532 | #define ACPI_READ 0 |
@@ -856,6 +879,14 @@ struct acpi_compatible_id_list { | |||
856 | #define ACPI_VALID_CID 0x0010 | 879 | #define ACPI_VALID_CID 0x0010 |
857 | #define ACPI_VALID_SXDS 0x0020 | 880 | #define ACPI_VALID_SXDS 0x0020 |
858 | 881 | ||
882 | /* Flags for _STA method */ | ||
883 | |||
884 | #define ACPI_STA_DEVICE_PRESENT 0x01 | ||
885 | #define ACPI_STA_DEVICE_ENABLED 0x02 | ||
886 | #define ACPI_STA_DEVICE_UI 0x04 | ||
887 | #define ACPI_STA_DEVICE_OK 0x08 | ||
888 | #define ACPI_STA_BATTERY_PRESENT 0x10 | ||
889 | |||
859 | #define ACPI_COMMON_OBJ_INFO \ | 890 | #define ACPI_COMMON_OBJ_INFO \ |
860 | acpi_object_type type; /* ACPI object type */ \ | 891 | acpi_object_type type; /* ACPI object type */ \ |
861 | acpi_name name /* ACPI object Name */ | 892 | acpi_name name /* ACPI object Name */ |
@@ -921,7 +952,9 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 | |||
921 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | 952 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
922 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) | 953 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) |
923 | 954 | ||
924 | #define ACPI_SPARSE_TRANSLATION (u8) 0x03 | 955 | /* Type of translation - 1=Sparse, 0=Dense */ |
956 | |||
957 | #define ACPI_SPARSE_TRANSLATION (u8) 0x01 | ||
925 | 958 | ||
926 | /* | 959 | /* |
927 | * IO Port Descriptor Decode | 960 | * IO Port Descriptor Decode |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 4ff963323de3..5fa21e03a62f 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -46,6 +46,30 @@ | |||
46 | 46 | ||
47 | extern const u8 acpi_gbl_resource_aml_sizes[]; | 47 | extern const u8 acpi_gbl_resource_aml_sizes[]; |
48 | 48 | ||
49 | /* Strings used by the disassembler and debugger resource dump routines */ | ||
50 | |||
51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
52 | |||
53 | extern const char *acpi_gbl_BMdecode[2]; | ||
54 | extern const char *acpi_gbl_config_decode[4]; | ||
55 | extern const char *acpi_gbl_consume_decode[2]; | ||
56 | extern const char *acpi_gbl_DECdecode[2]; | ||
57 | extern const char *acpi_gbl_HEdecode[2]; | ||
58 | extern const char *acpi_gbl_io_decode[2]; | ||
59 | extern const char *acpi_gbl_LLdecode[2]; | ||
60 | extern const char *acpi_gbl_max_decode[2]; | ||
61 | extern const char *acpi_gbl_MEMdecode[4]; | ||
62 | extern const char *acpi_gbl_min_decode[2]; | ||
63 | extern const char *acpi_gbl_MTPdecode[4]; | ||
64 | extern const char *acpi_gbl_RNGdecode[4]; | ||
65 | extern const char *acpi_gbl_RWdecode[2]; | ||
66 | extern const char *acpi_gbl_SHRdecode[2]; | ||
67 | extern const char *acpi_gbl_SIZdecode[4]; | ||
68 | extern const char *acpi_gbl_TRSdecode[2]; | ||
69 | extern const char *acpi_gbl_TTPdecode[2]; | ||
70 | extern const char *acpi_gbl_TYPdecode[4]; | ||
71 | #endif | ||
72 | |||
49 | /* Types for Resource descriptor entries */ | 73 | /* Types for Resource descriptor entries */ |
50 | 74 | ||
51 | #define ACPI_INVALID_RESOURCE 0 | 75 | #define ACPI_INVALID_RESOURCE 0 |