diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-01 16:09:26 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-01 16:09:26 -0400 |
commit | 08476907abf25315acb4c9a72a0e78bf61456696 (patch) | |
tree | 2f1c0f34771029458813c3015ef9b02b7333dfde /drivers/acpi | |
parent | 0ecfe310f4517d7505599be738158087c165be7c (diff) | |
parent | 08e1d7c0290aaef6bc6d68be8df753ffec02a6ae (diff) |
Merge branch 'acpica'
* acpica:
ACPICA: Enable auto-serialization as a default kernel behavior.
ACPICA: Ignore sync_level for methods that have been auto-serialized.
ACPICA: Add additional named objects for the auto-serialize method scan.
ACPICA: Add auto-serialization support for ill-behaved control methods.
ACPICA: Remove global option to serialize all control methods.
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acdispat.h | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/acglobal.h | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/acinterp.h | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/acobject.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/acstruct.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsinit.c | 59 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsmethod.c | 156 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload.c | 16 | ||||
-rw-r--r-- | drivers/acpi/acpica/exsystem.c | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/exutils.c | 80 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsinit.c | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsload.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/psloop.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/psobject.c | 7 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 16 |
15 files changed, 272 insertions, 121 deletions
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 5b472c43c31d..d3e2cc395d7f 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
@@ -139,20 +139,21 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
139 | struct acpi_walk_state *walk_state); | 139 | struct acpi_walk_state *walk_state); |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks | 142 | * dsload - Parser/Interpreter interface |
143 | */ | 143 | */ |
144 | acpi_status | 144 | acpi_status |
145 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | 145 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); |
146 | 146 | ||
147 | /* dsload - pass 1 namespace load callbacks */ | ||
148 | |||
147 | acpi_status | 149 | acpi_status |
148 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | 150 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, |
149 | union acpi_parse_object **out_op); | 151 | union acpi_parse_object **out_op); |
150 | 152 | ||
151 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); | 153 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); |
152 | 154 | ||
153 | /* | 155 | /* dsload - pass 2 namespace load callbacks */ |
154 | * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks | 156 | |
155 | */ | ||
156 | acpi_status | 157 | acpi_status |
157 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | 158 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, |
158 | union acpi_parse_object **out_op); | 159 | union acpi_parse_object **out_op); |
@@ -200,7 +201,9 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state); | |||
200 | /* | 201 | /* |
201 | * dsmethod - Parser/Interpreter interface - control method parsing | 202 | * dsmethod - Parser/Interpreter interface - control method parsing |
202 | */ | 203 | */ |
203 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node); | 204 | acpi_status |
205 | acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | ||
206 | union acpi_operand_object *obj_desc); | ||
204 | 207 | ||
205 | acpi_status | 208 | acpi_status |
206 | acpi_ds_call_control_method(struct acpi_thread_state *thread, | 209 | acpi_ds_call_control_method(struct acpi_thread_state *thread, |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 8f40bb972ae3..49bbc71fad54 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -93,12 +93,13 @@ | |||
93 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); | 93 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Automatically serialize ALL control methods? Default is FALSE, meaning | 96 | * Automatically serialize all methods that create named objects? Default |
97 | * to use the Serialized/not_serialized method flags on a per method basis. | 97 | * is TRUE, meaning that all non_serialized methods are scanned once at |
98 | * Only change this if the ASL code is poorly written and cannot handle | 98 | * table load time to determine those that create named objects. Methods |
99 | * reentrancy even though methods are marked "NotSerialized". | 99 | * that create named objects are marked Serialized in order to prevent |
100 | * possible run-time problems if they are entered by more than one thread. | ||
100 | */ | 101 | */ |
101 | ACPI_INIT_GLOBAL(u8, acpi_gbl_all_methods_serialized, FALSE); | 102 | ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); |
102 | 103 | ||
103 | /* | 104 | /* |
104 | * Create the predefined _OSI method in the namespace? Default is TRUE | 105 | * Create the predefined _OSI method in the namespace? Default is TRUE |
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index c54267748be5..b01f71ce0523 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -458,10 +458,6 @@ void acpi_ex_enter_interpreter(void); | |||
458 | 458 | ||
459 | void acpi_ex_exit_interpreter(void); | 459 | void acpi_ex_exit_interpreter(void); |
460 | 460 | ||
461 | void acpi_ex_reacquire_interpreter(void); | ||
462 | |||
463 | void acpi_ex_relinquish_interpreter(void); | ||
464 | |||
465 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); | 461 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); |
466 | 462 | ||
467 | void acpi_ex_acquire_global_lock(u32 rule); | 463 | void acpi_ex_acquire_global_lock(u32 rule); |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 1a4d61805ebc..22fb6449d3d6 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -193,7 +193,8 @@ struct acpi_object_method { | |||
193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ | 193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ |
194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ | 194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ |
195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ | 195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ |
196 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ | 196 | #define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */ |
197 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */ | ||
197 | 198 | ||
198 | /****************************************************************************** | 199 | /****************************************************************************** |
199 | * | 200 | * |
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index 5d2989a1b68c..cf7346110bd8 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
@@ -133,6 +133,9 @@ struct acpi_init_walk_info { | |||
133 | u32 table_index; | 133 | u32 table_index; |
134 | u32 object_count; | 134 | u32 object_count; |
135 | u32 method_count; | 135 | u32 method_count; |
136 | u32 serial_method_count; | ||
137 | u32 non_serial_method_count; | ||
138 | u32 serialized_method_count; | ||
136 | u32 device_count; | 139 | u32 device_count; |
137 | u32 op_region_count; | 140 | u32 op_region_count; |
138 | u32 field_count; | 141 | u32 field_count; |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 96644d5ac0e1..aee5e45f6d35 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
@@ -83,8 +83,8 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
83 | (struct acpi_init_walk_info *)context; | 83 | (struct acpi_init_walk_info *)context; |
84 | struct acpi_namespace_node *node = | 84 | struct acpi_namespace_node *node = |
85 | (struct acpi_namespace_node *)obj_handle; | 85 | (struct acpi_namespace_node *)obj_handle; |
86 | acpi_object_type type; | ||
87 | acpi_status status; | 86 | acpi_status status; |
87 | union acpi_operand_object *obj_desc; | ||
88 | 88 | ||
89 | ACPI_FUNCTION_ENTRY(); | 89 | ACPI_FUNCTION_ENTRY(); |
90 | 90 | ||
@@ -100,9 +100,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
100 | 100 | ||
101 | /* And even then, we are only interested in a few object types */ | 101 | /* And even then, we are only interested in a few object types */ |
102 | 102 | ||
103 | type = acpi_ns_get_type(obj_handle); | 103 | switch (acpi_ns_get_type(obj_handle)) { |
104 | |||
105 | switch (type) { | ||
106 | case ACPI_TYPE_REGION: | 104 | case ACPI_TYPE_REGION: |
107 | 105 | ||
108 | status = acpi_ds_initialize_region(obj_handle); | 106 | status = acpi_ds_initialize_region(obj_handle); |
@@ -117,8 +115,44 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
117 | break; | 115 | break; |
118 | 116 | ||
119 | case ACPI_TYPE_METHOD: | 117 | case ACPI_TYPE_METHOD: |
120 | 118 | /* | |
119 | * Auto-serialization support. We will examine each method that is | ||
120 | * not_serialized to determine if it creates any Named objects. If | ||
121 | * it does, it will be marked serialized to prevent problems if | ||
122 | * the method is entered by two or more threads and an attempt is | ||
123 | * made to create the same named object twice -- which results in | ||
124 | * an AE_ALREADY_EXISTS exception and method abort. | ||
125 | */ | ||
121 | info->method_count++; | 126 | info->method_count++; |
127 | obj_desc = acpi_ns_get_attached_object(node); | ||
128 | if (!obj_desc) { | ||
129 | break; | ||
130 | } | ||
131 | |||
132 | /* Ignore if already serialized */ | ||
133 | |||
134 | if (obj_desc->method.info_flags & ACPI_METHOD_SERIALIZED) { | ||
135 | info->serial_method_count++; | ||
136 | break; | ||
137 | } | ||
138 | |||
139 | if (acpi_gbl_auto_serialize_methods) { | ||
140 | |||
141 | /* Parse/scan method and serialize it if necessary */ | ||
142 | |||
143 | acpi_ds_auto_serialize_method(node, obj_desc); | ||
144 | if (obj_desc->method. | ||
145 | info_flags & ACPI_METHOD_SERIALIZED) { | ||
146 | |||
147 | /* Method was just converted to Serialized */ | ||
148 | |||
149 | info->serial_method_count++; | ||
150 | info->serialized_method_count++; | ||
151 | break; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | info->non_serial_method_count++; | ||
122 | break; | 156 | break; |
123 | 157 | ||
124 | case ACPI_TYPE_DEVICE: | 158 | case ACPI_TYPE_DEVICE: |
@@ -170,7 +204,6 @@ acpi_ds_initialize_objects(u32 table_index, | |||
170 | 204 | ||
171 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
172 | "**** Starting initialization of namespace objects ****\n")); | 206 | "**** Starting initialization of namespace objects ****\n")); |
173 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
174 | 207 | ||
175 | /* Set all init info to zero */ | 208 | /* Set all init info to zero */ |
176 | 209 | ||
@@ -205,14 +238,16 @@ acpi_ds_initialize_objects(u32 table_index, | |||
205 | } | 238 | } |
206 | 239 | ||
207 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 240 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
208 | "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", | 241 | "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " |
242 | "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", | ||
209 | table->signature, owner_id, info.object_count, | 243 | table->signature, owner_id, info.object_count, |
210 | info.device_count, info.method_count, | 244 | info.device_count, info.op_region_count, |
211 | info.op_region_count)); | 245 | info.method_count, info.serial_method_count, |
246 | info.non_serial_method_count, | ||
247 | info.serialized_method_count)); | ||
212 | 248 | ||
213 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 249 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", |
214 | "%u Methods, %u Regions\n", info.method_count, | 250 | info.method_count, info.op_region_count)); |
215 | info.op_region_count)); | ||
216 | 251 | ||
217 | return_ACPI_STATUS(AE_OK); | 252 | return_ACPI_STATUS(AE_OK); |
218 | } | 253 | } |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 2c6d42c2bc01..3c7f7378b94d 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -49,16 +49,155 @@ | |||
49 | #ifdef ACPI_DISASSEMBLER | 49 | #ifdef ACPI_DISASSEMBLER |
50 | #include "acdisasm.h" | 50 | #include "acdisasm.h" |
51 | #endif | 51 | #endif |
52 | #include "acparser.h" | ||
53 | #include "amlcode.h" | ||
52 | 54 | ||
53 | #define _COMPONENT ACPI_DISPATCHER | 55 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME("dsmethod") | 56 | ACPI_MODULE_NAME("dsmethod") |
55 | 57 | ||
56 | /* Local prototypes */ | 58 | /* Local prototypes */ |
57 | static acpi_status | 59 | static acpi_status |
60 | acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state, | ||
61 | union acpi_parse_object **out_op); | ||
62 | |||
63 | static acpi_status | ||
58 | acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); | 64 | acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); |
59 | 65 | ||
60 | /******************************************************************************* | 66 | /******************************************************************************* |
61 | * | 67 | * |
68 | * FUNCTION: acpi_ds_auto_serialize_method | ||
69 | * | ||
70 | * PARAMETERS: node - Namespace Node of the method | ||
71 | * obj_desc - Method object attached to node | ||
72 | * | ||
73 | * RETURN: Status | ||
74 | * | ||
75 | * DESCRIPTION: Parse a control method AML to scan for control methods that | ||
76 | * need serialization due to the creation of named objects. | ||
77 | * | ||
78 | * NOTE: It is a bit of overkill to mark all such methods serialized, since | ||
79 | * there is only a problem if the method actually blocks during execution. | ||
80 | * A blocking operation is, for example, a Sleep() operation, or any access | ||
81 | * to an operation region. However, it is probably not possible to easily | ||
82 | * detect whether a method will block or not, so we simply mark all suspicious | ||
83 | * methods as serialized. | ||
84 | * | ||
85 | * NOTE2: This code is essentially a generic routine for parsing a single | ||
86 | * control method. | ||
87 | * | ||
88 | ******************************************************************************/ | ||
89 | |||
90 | acpi_status | ||
91 | acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | ||
92 | union acpi_operand_object *obj_desc) | ||
93 | { | ||
94 | acpi_status status; | ||
95 | union acpi_parse_object *op = NULL; | ||
96 | struct acpi_walk_state *walk_state; | ||
97 | |||
98 | ACPI_FUNCTION_TRACE_PTR(ds_auto_serialize_method, node); | ||
99 | |||
100 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
101 | "Method auto-serialization parse [%4.4s] %p\n", | ||
102 | acpi_ut_get_node_name(node), node)); | ||
103 | |||
104 | /* Create/Init a root op for the method parse tree */ | ||
105 | |||
106 | op = acpi_ps_alloc_op(AML_METHOD_OP); | ||
107 | if (!op) { | ||
108 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
109 | } | ||
110 | |||
111 | acpi_ps_set_name(op, node->name.integer); | ||
112 | op->common.node = node; | ||
113 | |||
114 | /* Create and initialize a new walk state */ | ||
115 | |||
116 | walk_state = | ||
117 | acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL); | ||
118 | if (!walk_state) { | ||
119 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
120 | } | ||
121 | |||
122 | status = | ||
123 | acpi_ds_init_aml_walk(walk_state, op, node, | ||
124 | obj_desc->method.aml_start, | ||
125 | obj_desc->method.aml_length, NULL, 0); | ||
126 | if (ACPI_FAILURE(status)) { | ||
127 | acpi_ds_delete_walk_state(walk_state); | ||
128 | return_ACPI_STATUS(status); | ||
129 | } | ||
130 | |||
131 | walk_state->descending_callback = acpi_ds_detect_named_opcodes; | ||
132 | |||
133 | /* Parse the method, scan for creation of named objects */ | ||
134 | |||
135 | status = acpi_ps_parse_aml(walk_state); | ||
136 | if (ACPI_FAILURE(status)) { | ||
137 | return_ACPI_STATUS(status); | ||
138 | } | ||
139 | |||
140 | acpi_ps_delete_parse_tree(op); | ||
141 | return_ACPI_STATUS(status); | ||
142 | } | ||
143 | |||
144 | /******************************************************************************* | ||
145 | * | ||
146 | * FUNCTION: acpi_ds_detect_named_opcodes | ||
147 | * | ||
148 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
149 | * out_op - Unused, required for parser interface | ||
150 | * | ||
151 | * RETURN: Status | ||
152 | * | ||
153 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. | ||
154 | * Currently used to detect methods that must be marked serialized | ||
155 | * in order to avoid problems with the creation of named objects. | ||
156 | * | ||
157 | ******************************************************************************/ | ||
158 | |||
159 | static acpi_status | ||
160 | acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state, | ||
161 | union acpi_parse_object **out_op) | ||
162 | { | ||
163 | |||
164 | ACPI_FUNCTION_NAME(acpi_ds_detect_named_opcodes); | ||
165 | |||
166 | /* We are only interested in opcodes that create a new name */ | ||
167 | |||
168 | if (! | ||
169 | (walk_state->op_info-> | ||
170 | flags & (AML_NAMED | AML_CREATE | AML_FIELD))) { | ||
171 | return (AE_OK); | ||
172 | } | ||
173 | |||
174 | /* | ||
175 | * At this point, we know we have a Named object opcode. | ||
176 | * Mark the method as serialized. Later code will create a mutex for | ||
177 | * this method to enforce serialization. | ||
178 | * | ||
179 | * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the | ||
180 | * Sync Level mechanism for this method, even though it is now serialized. | ||
181 | * Otherwise, there can be conflicts with existing ASL code that actually | ||
182 | * uses sync levels. | ||
183 | */ | ||
184 | walk_state->method_desc->method.sync_level = 0; | ||
185 | walk_state->method_desc->method.info_flags |= | ||
186 | (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
187 | |||
188 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
189 | "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", | ||
190 | walk_state->method_node->name.ascii, | ||
191 | walk_state->method_node, walk_state->op_info->name, | ||
192 | walk_state->opcode)); | ||
193 | |||
194 | /* Abort the parse, no need to examine this method any further */ | ||
195 | |||
196 | return (AE_CTRL_TERMINATE); | ||
197 | } | ||
198 | |||
199 | /******************************************************************************* | ||
200 | * | ||
62 | * FUNCTION: acpi_ds_method_error | 201 | * FUNCTION: acpi_ds_method_error |
63 | * | 202 | * |
64 | * PARAMETERS: status - Execution status | 203 | * PARAMETERS: status - Execution status |
@@ -74,7 +213,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); | |||
74 | ******************************************************************************/ | 213 | ******************************************************************************/ |
75 | 214 | ||
76 | acpi_status | 215 | acpi_status |
77 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | 216 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state) |
78 | { | 217 | { |
79 | ACPI_FUNCTION_ENTRY(); | 218 | ACPI_FUNCTION_ENTRY(); |
80 | 219 | ||
@@ -217,13 +356,19 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
217 | /* | 356 | /* |
218 | * The current_sync_level (per-thread) must be less than or equal to | 357 | * The current_sync_level (per-thread) must be less than or equal to |
219 | * the sync level of the method. This mechanism provides some | 358 | * the sync level of the method. This mechanism provides some |
220 | * deadlock prevention | 359 | * deadlock prevention. |
360 | * | ||
361 | * If the method was auto-serialized, we just ignore the sync level | ||
362 | * mechanism, because auto-serialization of methods can interfere | ||
363 | * with ASL code that actually uses sync levels. | ||
221 | * | 364 | * |
222 | * Top-level method invocation has no walk state at this point | 365 | * Top-level method invocation has no walk state at this point |
223 | */ | 366 | */ |
224 | if (walk_state && | 367 | if (walk_state && |
225 | (walk_state->thread->current_sync_level > | 368 | (!(obj_desc->method. |
226 | obj_desc->method.mutex->mutex.sync_level)) { | 369 | info_flags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) |
370 | && (walk_state->thread->current_sync_level > | ||
371 | obj_desc->method.mutex->mutex.sync_level)) { | ||
227 | ACPI_ERROR((AE_INFO, | 372 | ACPI_ERROR((AE_INFO, |
228 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", | 373 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", |
229 | acpi_ut_get_node_name(method_node), | 374 | acpi_ut_get_node_name(method_node), |
@@ -668,7 +813,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
668 | method_desc->method.info_flags &= | 813 | method_desc->method.info_flags &= |
669 | ~ACPI_METHOD_SERIALIZED_PENDING; | 814 | ~ACPI_METHOD_SERIALIZED_PENDING; |
670 | method_desc->method.info_flags |= | 815 | method_desc->method.info_flags |= |
671 | ACPI_METHOD_SERIALIZED; | 816 | (ACPI_METHOD_SERIALIZED | |
817 | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
672 | method_desc->method.sync_level = 0; | 818 | method_desc->method.sync_level = 0; |
673 | } | 819 | } |
674 | 820 | ||
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index bd7811c64169..15623da26200 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -73,8 +73,20 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
73 | { | 73 | { |
74 | 74 | ||
75 | switch (pass_number) { | 75 | switch (pass_number) { |
76 | case 0: | ||
77 | |||
78 | /* Parse only - caller will setup callbacks */ | ||
79 | |||
80 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | ||
81 | ACPI_PARSE_DELETE_TREE | ACPI_PARSE_DISASSEMBLE; | ||
82 | walk_state->descending_callback = NULL; | ||
83 | walk_state->ascending_callback = NULL; | ||
84 | break; | ||
85 | |||
76 | case 1: | 86 | case 1: |
77 | 87 | ||
88 | /* Load pass 1 */ | ||
89 | |||
78 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 90 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
79 | ACPI_PARSE_DELETE_TREE; | 91 | ACPI_PARSE_DELETE_TREE; |
80 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 92 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
@@ -83,6 +95,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
83 | 95 | ||
84 | case 2: | 96 | case 2: |
85 | 97 | ||
98 | /* Load pass 2 */ | ||
99 | |||
86 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 100 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
87 | ACPI_PARSE_DELETE_TREE; | 101 | ACPI_PARSE_DELETE_TREE; |
88 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 102 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
@@ -91,6 +105,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
91 | 105 | ||
92 | case 3: | 106 | case 3: |
93 | 107 | ||
108 | /* Execution pass */ | ||
109 | |||
94 | #ifndef ACPI_NO_METHOD_EXECUTION | 110 | #ifndef ACPI_NO_METHOD_EXECUTION |
95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | | 111 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
96 | ACPI_PARSE_DELETE_TREE; | 112 | ACPI_PARSE_DELETE_TREE; |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 841caed11c08..f7da64123ed5 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -77,7 +77,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
77 | 77 | ||
78 | /* We must wait, so unlock the interpreter */ | 78 | /* We must wait, so unlock the interpreter */ |
79 | 79 | ||
80 | acpi_ex_relinquish_interpreter(); | 80 | acpi_ex_exit_interpreter(); |
81 | 81 | ||
82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
83 | 83 | ||
@@ -87,7 +87,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
87 | 87 | ||
88 | /* Reacquire the interpreter */ | 88 | /* Reacquire the interpreter */ |
89 | 89 | ||
90 | acpi_ex_reacquire_interpreter(); | 90 | acpi_ex_enter_interpreter(); |
91 | } | 91 | } |
92 | 92 | ||
93 | return_ACPI_STATUS(status); | 93 | return_ACPI_STATUS(status); |
@@ -123,7 +123,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
123 | 123 | ||
124 | /* We must wait, so unlock the interpreter */ | 124 | /* We must wait, so unlock the interpreter */ |
125 | 125 | ||
126 | acpi_ex_relinquish_interpreter(); | 126 | acpi_ex_exit_interpreter(); |
127 | 127 | ||
128 | status = acpi_os_acquire_mutex(mutex, timeout); | 128 | status = acpi_os_acquire_mutex(mutex, timeout); |
129 | 129 | ||
@@ -133,7 +133,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
133 | 133 | ||
134 | /* Reacquire the interpreter */ | 134 | /* Reacquire the interpreter */ |
135 | 135 | ||
136 | acpi_ex_reacquire_interpreter(); | 136 | acpi_ex_enter_interpreter(); |
137 | } | 137 | } |
138 | 138 | ||
139 | return_ACPI_STATUS(status); | 139 | return_ACPI_STATUS(status); |
@@ -198,7 +198,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
198 | 198 | ||
199 | /* Since this thread will sleep, we must release the interpreter */ | 199 | /* Since this thread will sleep, we must release the interpreter */ |
200 | 200 | ||
201 | acpi_ex_relinquish_interpreter(); | 201 | acpi_ex_exit_interpreter(); |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * For compatibility with other ACPI implementations and to prevent | 204 | * For compatibility with other ACPI implementations and to prevent |
@@ -212,7 +212,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
212 | 212 | ||
213 | /* And now we must get the interpreter again */ | 213 | /* And now we must get the interpreter again */ |
214 | 214 | ||
215 | acpi_ex_reacquire_interpreter(); | 215 | acpi_ex_enter_interpreter(); |
216 | return (AE_OK); | 216 | return (AE_OK); |
217 | } | 217 | } |
218 | 218 | ||
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 5b16c5484bee..d9d72dff2a76 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -100,37 +100,6 @@ void acpi_ex_enter_interpreter(void) | |||
100 | 100 | ||
101 | /******************************************************************************* | 101 | /******************************************************************************* |
102 | * | 102 | * |
103 | * FUNCTION: acpi_ex_reacquire_interpreter | ||
104 | * | ||
105 | * PARAMETERS: None | ||
106 | * | ||
107 | * RETURN: None | ||
108 | * | ||
109 | * DESCRIPTION: Reacquire the interpreter execution region from within the | ||
110 | * interpreter code. Failure to enter the interpreter region is a | ||
111 | * fatal system error. Used in conjunction with | ||
112 | * relinquish_interpreter | ||
113 | * | ||
114 | ******************************************************************************/ | ||
115 | |||
116 | void acpi_ex_reacquire_interpreter(void) | ||
117 | { | ||
118 | ACPI_FUNCTION_TRACE(ex_reacquire_interpreter); | ||
119 | |||
120 | /* | ||
121 | * If the global serialized flag is set, do not release the interpreter, | ||
122 | * since it was not actually released by acpi_ex_relinquish_interpreter. | ||
123 | * This forces the interpreter to be single threaded. | ||
124 | */ | ||
125 | if (!acpi_gbl_all_methods_serialized) { | ||
126 | acpi_ex_enter_interpreter(); | ||
127 | } | ||
128 | |||
129 | return_VOID; | ||
130 | } | ||
131 | |||
132 | /******************************************************************************* | ||
133 | * | ||
134 | * FUNCTION: acpi_ex_exit_interpreter | 103 | * FUNCTION: acpi_ex_exit_interpreter |
135 | * | 104 | * |
136 | * PARAMETERS: None | 105 | * PARAMETERS: None |
@@ -139,7 +108,16 @@ void acpi_ex_reacquire_interpreter(void) | |||
139 | * | 108 | * |
140 | * DESCRIPTION: Exit the interpreter execution region. This is the top level | 109 | * DESCRIPTION: Exit the interpreter execution region. This is the top level |
141 | * routine used to exit the interpreter when all processing has | 110 | * routine used to exit the interpreter when all processing has |
142 | * been completed. | 111 | * been completed, or when the method blocks. |
112 | * | ||
113 | * Cases where the interpreter is unlocked internally: | ||
114 | * 1) Method will be blocked on a Sleep() AML opcode | ||
115 | * 2) Method will be blocked on an Acquire() AML opcode | ||
116 | * 3) Method will be blocked on a Wait() AML opcode | ||
117 | * 4) Method will be blocked to acquire the global lock | ||
118 | * 5) Method will be blocked waiting to execute a serialized control | ||
119 | * method that is currently executing | ||
120 | * 6) About to invoke a user-installed opregion handler | ||
143 | * | 121 | * |
144 | ******************************************************************************/ | 122 | ******************************************************************************/ |
145 | 123 | ||
@@ -160,44 +138,6 @@ void acpi_ex_exit_interpreter(void) | |||
160 | 138 | ||
161 | /******************************************************************************* | 139 | /******************************************************************************* |
162 | * | 140 | * |
163 | * FUNCTION: acpi_ex_relinquish_interpreter | ||
164 | * | ||
165 | * PARAMETERS: None | ||
166 | * | ||
167 | * RETURN: None | ||
168 | * | ||
169 | * DESCRIPTION: Exit the interpreter execution region, from within the | ||
170 | * interpreter - before attempting an operation that will possibly | ||
171 | * block the running thread. | ||
172 | * | ||
173 | * Cases where the interpreter is unlocked internally | ||
174 | * 1) Method to be blocked on a Sleep() AML opcode | ||
175 | * 2) Method to be blocked on an Acquire() AML opcode | ||
176 | * 3) Method to be blocked on a Wait() AML opcode | ||
177 | * 4) Method to be blocked to acquire the global lock | ||
178 | * 5) Method to be blocked waiting to execute a serialized control method | ||
179 | * that is currently executing | ||
180 | * 6) About to invoke a user-installed opregion handler | ||
181 | * | ||
182 | ******************************************************************************/ | ||
183 | |||
184 | void acpi_ex_relinquish_interpreter(void) | ||
185 | { | ||
186 | ACPI_FUNCTION_TRACE(ex_relinquish_interpreter); | ||
187 | |||
188 | /* | ||
189 | * If the global serialized flag is set, do not release the interpreter. | ||
190 | * This forces the interpreter to be single threaded. | ||
191 | */ | ||
192 | if (!acpi_gbl_all_methods_serialized) { | ||
193 | acpi_ex_exit_interpreter(); | ||
194 | } | ||
195 | |||
196 | return_VOID; | ||
197 | } | ||
198 | |||
199 | /******************************************************************************* | ||
200 | * | ||
201 | * FUNCTION: acpi_ex_truncate_for32bit_table | 141 | * FUNCTION: acpi_ex_truncate_for32bit_table |
202 | * | 142 | * |
203 | * PARAMETERS: obj_desc - Object to be truncated | 143 | * PARAMETERS: obj_desc - Object to be truncated |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 5b74677bf74d..a3fb7e4c0809 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -111,9 +111,8 @@ acpi_status acpi_ns_initialize_objects(void) | |||
111 | info.object_count)); | 111 | info.object_count)); |
112 | 112 | ||
113 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
114 | "%u Control Methods found\n", info.method_count)); | 114 | "%u Control Methods found\n%u Op Regions found\n", |
115 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 115 | info.method_count, info.op_region_count)); |
116 | "%u Op Regions found\n", info.op_region_count)); | ||
117 | 116 | ||
118 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
119 | } | 118 | } |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 7ae521ce8d3f..7c9d0181f341 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
@@ -128,12 +128,12 @@ unlock: | |||
128 | * parse trees. | 128 | * parse trees. |
129 | */ | 129 | */ |
130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
131 | "**** Begin Table Method Parsing and Object Initialization\n")); | 131 | "**** Begin Table Object Initialization\n")); |
132 | 132 | ||
133 | status = acpi_ds_initialize_objects(table_index, node); | 133 | status = acpi_ds_initialize_objects(table_index, node); |
134 | 134 | ||
135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
136 | "**** Completed Table Method Parsing and Object Initialization\n")); | 136 | "**** Completed Table Object Initialization\n")); |
137 | 137 | ||
138 | return_ACPI_STATUS(status); | 138 | return_ACPI_STATUS(status); |
139 | } | 139 | } |
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 646d1a3f6e27..b058e2390fdd 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
@@ -480,6 +480,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
480 | status = AE_OK; | 480 | status = AE_OK; |
481 | } | 481 | } |
482 | 482 | ||
483 | if (status == AE_CTRL_TERMINATE) { | ||
484 | return_ACPI_STATUS(status); | ||
485 | } | ||
486 | |||
483 | status = | 487 | status = |
484 | acpi_ps_complete_op(walk_state, &op, | 488 | acpi_ps_complete_op(walk_state, &op, |
485 | status); | 489 | status); |
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c index af1f46cd37a5..a6885077d59e 100644 --- a/drivers/acpi/acpica/psobject.c +++ b/drivers/acpi/acpica/psobject.c | |||
@@ -219,7 +219,10 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
219 | 219 | ||
220 | status = walk_state->descending_callback(walk_state, op); | 220 | status = walk_state->descending_callback(walk_state, op); |
221 | if (ACPI_FAILURE(status)) { | 221 | if (ACPI_FAILURE(status)) { |
222 | ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog")); | 222 | if (status != AE_CTRL_TERMINATE) { |
223 | ACPI_EXCEPTION((AE_INFO, status, | ||
224 | "During name lookup/catalog")); | ||
225 | } | ||
223 | return_ACPI_STATUS(status); | 226 | return_ACPI_STATUS(status); |
224 | } | 227 | } |
225 | 228 | ||
@@ -230,7 +233,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
230 | status = acpi_ps_next_parse_state(walk_state, *op, status); | 233 | status = acpi_ps_next_parse_state(walk_state, *op, status); |
231 | if (ACPI_FAILURE(status)) { | 234 | if (ACPI_FAILURE(status)) { |
232 | if (status == AE_CTRL_PENDING) { | 235 | if (status == AE_CTRL_PENDING) { |
233 | return_ACPI_STATUS(AE_CTRL_PARSE_PENDING); | 236 | status = AE_CTRL_PARSE_PENDING; |
234 | } | 237 | } |
235 | return_ACPI_STATUS(status); | 238 | return_ACPI_STATUS(status); |
236 | } | 239 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 27f84af4e337..f7fd72ac69cf 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1537,17 +1537,21 @@ static int __init osi_setup(char *str) | |||
1537 | 1537 | ||
1538 | __setup("acpi_osi=", osi_setup); | 1538 | __setup("acpi_osi=", osi_setup); |
1539 | 1539 | ||
1540 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ | 1540 | /* |
1541 | static int __init acpi_serialize_setup(char *str) | 1541 | * Disable the auto-serialization of named objects creation methods. |
1542 | * | ||
1543 | * This feature is enabled by default. It marks the AML control methods | ||
1544 | * that contain the opcodes to create named objects as "Serialized". | ||
1545 | */ | ||
1546 | static int __init acpi_no_auto_serialize_setup(char *str) | ||
1542 | { | 1547 | { |
1543 | printk(KERN_INFO PREFIX "serialize enabled\n"); | 1548 | acpi_gbl_auto_serialize_methods = FALSE; |
1544 | 1549 | pr_info("ACPI: auto-serialization disabled\n"); | |
1545 | acpi_gbl_all_methods_serialized = TRUE; | ||
1546 | 1550 | ||
1547 | return 1; | 1551 | return 1; |
1548 | } | 1552 | } |
1549 | 1553 | ||
1550 | __setup("acpi_serialize", acpi_serialize_setup); | 1554 | __setup("acpi_no_auto_serialize", acpi_no_auto_serialize_setup); |
1551 | 1555 | ||
1552 | /* Check of resource interference between native drivers and ACPI | 1556 | /* Check of resource interference between native drivers and ACPI |
1553 | * OperationRegions (SystemIO and System Memory only). | 1557 | * OperationRegions (SystemIO and System Memory only). |