diff options
Diffstat (limited to 'drivers/acpi/executer/excreate.c')
-rw-r--r-- | drivers/acpi/executer/excreate.c | 342 |
1 files changed, 153 insertions, 189 deletions
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 812cdcb2e370..91c49188fb07 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
@@ -49,10 +48,8 @@ | |||
49 | #include <acpi/acevents.h> | 48 | #include <acpi/acevents.h> |
50 | #include <acpi/actables.h> | 49 | #include <acpi/actables.h> |
51 | 50 | ||
52 | |||
53 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
54 | ACPI_MODULE_NAME ("excreate") | 52 | ACPI_MODULE_NAME("excreate") |
55 | |||
56 | 53 | ||
57 | #ifndef ACPI_NO_METHOD_EXECUTION | 54 | #ifndef ACPI_NO_METHOD_EXECUTION |
58 | /******************************************************************************* | 55 | /******************************************************************************* |
@@ -66,33 +63,30 @@ | |||
66 | * DESCRIPTION: Create a new named alias | 63 | * DESCRIPTION: Create a new named alias |
67 | * | 64 | * |
68 | ******************************************************************************/ | 65 | ******************************************************************************/ |
69 | 66 | acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |
70 | acpi_status | ||
71 | acpi_ex_create_alias ( | ||
72 | struct acpi_walk_state *walk_state) | ||
73 | { | 67 | { |
74 | struct acpi_namespace_node *target_node; | 68 | struct acpi_namespace_node *target_node; |
75 | struct acpi_namespace_node *alias_node; | 69 | struct acpi_namespace_node *alias_node; |
76 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
77 | |||
78 | |||
79 | ACPI_FUNCTION_TRACE ("ex_create_alias"); | ||
80 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ex_create_alias"); | ||
81 | 73 | ||
82 | /* Get the source/alias operands (both namespace nodes) */ | 74 | /* Get the source/alias operands (both namespace nodes) */ |
83 | 75 | ||
84 | alias_node = (struct acpi_namespace_node *) walk_state->operands[0]; | 76 | alias_node = (struct acpi_namespace_node *)walk_state->operands[0]; |
85 | target_node = (struct acpi_namespace_node *) walk_state->operands[1]; | 77 | target_node = (struct acpi_namespace_node *)walk_state->operands[1]; |
86 | 78 | ||
87 | if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) || | 79 | if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) || |
88 | (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 80 | (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
89 | /* | 81 | /* |
90 | * Dereference an existing alias so that we don't create a chain | 82 | * Dereference an existing alias so that we don't create a chain |
91 | * of aliases. With this code, we guarantee that an alias is | 83 | * of aliases. With this code, we guarantee that an alias is |
92 | * always exactly one level of indirection away from the | 84 | * always exactly one level of indirection away from the |
93 | * actual aliased name. | 85 | * actual aliased name. |
94 | */ | 86 | */ |
95 | target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object); | 87 | target_node = |
88 | ACPI_CAST_PTR(struct acpi_namespace_node, | ||
89 | target_node->object); | ||
96 | } | 90 | } |
97 | 91 | ||
98 | /* | 92 | /* |
@@ -115,7 +109,8 @@ acpi_ex_create_alias ( | |||
115 | * types, the object can change dynamically via a Store. | 109 | * types, the object can change dynamically via a Store. |
116 | */ | 110 | */ |
117 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; | 111 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; |
118 | alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); | 112 | alias_node->object = |
113 | ACPI_CAST_PTR(union acpi_operand_object, target_node); | ||
119 | break; | 114 | break; |
120 | 115 | ||
121 | case ACPI_TYPE_METHOD: | 116 | case ACPI_TYPE_METHOD: |
@@ -126,7 +121,8 @@ acpi_ex_create_alias ( | |||
126 | * types, the object can change dynamically via a Store. | 121 | * types, the object can change dynamically via a Store. |
127 | */ | 122 | */ |
128 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; | 123 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; |
129 | alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); | 124 | alias_node->object = |
125 | ACPI_CAST_PTR(union acpi_operand_object, target_node); | ||
130 | break; | 126 | break; |
131 | 127 | ||
132 | default: | 128 | default: |
@@ -139,17 +135,18 @@ acpi_ex_create_alias ( | |||
139 | * additional reference to prevent deletion out from under either the | 135 | * additional reference to prevent deletion out from under either the |
140 | * target node or the alias Node | 136 | * target node or the alias Node |
141 | */ | 137 | */ |
142 | status = acpi_ns_attach_object (alias_node, | 138 | status = acpi_ns_attach_object(alias_node, |
143 | acpi_ns_get_attached_object (target_node), target_node->type); | 139 | acpi_ns_get_attached_object |
140 | (target_node), | ||
141 | target_node->type); | ||
144 | break; | 142 | break; |
145 | } | 143 | } |
146 | 144 | ||
147 | /* Since both operands are Nodes, we don't need to delete them */ | 145 | /* Since both operands are Nodes, we don't need to delete them */ |
148 | 146 | ||
149 | return_ACPI_STATUS (status); | 147 | return_ACPI_STATUS(status); |
150 | } | 148 | } |
151 | 149 | ||
152 | |||
153 | /******************************************************************************* | 150 | /******************************************************************************* |
154 | * | 151 | * |
155 | * FUNCTION: acpi_ex_create_event | 152 | * FUNCTION: acpi_ex_create_event |
@@ -162,18 +159,14 @@ acpi_ex_create_alias ( | |||
162 | * | 159 | * |
163 | ******************************************************************************/ | 160 | ******************************************************************************/ |
164 | 161 | ||
165 | acpi_status | 162 | acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) |
166 | acpi_ex_create_event ( | ||
167 | struct acpi_walk_state *walk_state) | ||
168 | { | 163 | { |
169 | acpi_status status; | 164 | acpi_status status; |
170 | union acpi_operand_object *obj_desc; | 165 | union acpi_operand_object *obj_desc; |
171 | |||
172 | |||
173 | ACPI_FUNCTION_TRACE ("ex_create_event"); | ||
174 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_create_event"); | ||
175 | 168 | ||
176 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); |
177 | if (!obj_desc) { | 170 | if (!obj_desc) { |
178 | status = AE_NO_MEMORY; | 171 | status = AE_NO_MEMORY; |
179 | goto cleanup; | 172 | goto cleanup; |
@@ -183,27 +176,27 @@ acpi_ex_create_event ( | |||
183 | * Create the actual OS semaphore, with zero initial units -- meaning | 176 | * Create the actual OS semaphore, with zero initial units -- meaning |
184 | * that the event is created in an unsignalled state | 177 | * that the event is created in an unsignalled state |
185 | */ | 178 | */ |
186 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, | 179 | status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, |
187 | &obj_desc->event.semaphore); | 180 | &obj_desc->event.semaphore); |
188 | if (ACPI_FAILURE (status)) { | 181 | if (ACPI_FAILURE(status)) { |
189 | goto cleanup; | 182 | goto cleanup; |
190 | } | 183 | } |
191 | 184 | ||
192 | /* Attach object to the Node */ | 185 | /* Attach object to the Node */ |
193 | 186 | ||
194 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], | 187 | status = |
195 | obj_desc, ACPI_TYPE_EVENT); | 188 | acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> |
189 | operands[0], obj_desc, ACPI_TYPE_EVENT); | ||
196 | 190 | ||
197 | cleanup: | 191 | cleanup: |
198 | /* | 192 | /* |
199 | * Remove local reference to the object (on error, will cause deletion | 193 | * Remove local reference to the object (on error, will cause deletion |
200 | * of both object and semaphore if present.) | 194 | * of both object and semaphore if present.) |
201 | */ | 195 | */ |
202 | acpi_ut_remove_reference (obj_desc); | 196 | acpi_ut_remove_reference(obj_desc); |
203 | return_ACPI_STATUS (status); | 197 | return_ACPI_STATUS(status); |
204 | } | 198 | } |
205 | 199 | ||
206 | |||
207 | /******************************************************************************* | 200 | /******************************************************************************* |
208 | * | 201 | * |
209 | * FUNCTION: acpi_ex_create_mutex | 202 | * FUNCTION: acpi_ex_create_mutex |
@@ -218,20 +211,16 @@ cleanup: | |||
218 | * | 211 | * |
219 | ******************************************************************************/ | 212 | ******************************************************************************/ |
220 | 213 | ||
221 | acpi_status | 214 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) |
222 | acpi_ex_create_mutex ( | ||
223 | struct acpi_walk_state *walk_state) | ||
224 | { | 215 | { |
225 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
226 | union acpi_operand_object *obj_desc; | 217 | union acpi_operand_object *obj_desc; |
227 | |||
228 | |||
229 | ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS); | ||
230 | 218 | ||
219 | ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); | ||
231 | 220 | ||
232 | /* Create the new mutex object */ | 221 | /* Create the new mutex object */ |
233 | 222 | ||
234 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX); | 223 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); |
235 | if (!obj_desc) { | 224 | if (!obj_desc) { |
236 | status = AE_NO_MEMORY; | 225 | status = AE_NO_MEMORY; |
237 | goto cleanup; | 226 | goto cleanup; |
@@ -242,30 +231,30 @@ acpi_ex_create_mutex ( | |||
242 | * One unit max to make it a mutex, with one initial unit to allow | 231 | * One unit max to make it a mutex, with one initial unit to allow |
243 | * the mutex to be acquired. | 232 | * the mutex to be acquired. |
244 | */ | 233 | */ |
245 | status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore); | 234 | status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore); |
246 | if (ACPI_FAILURE (status)) { | 235 | if (ACPI_FAILURE(status)) { |
247 | goto cleanup; | 236 | goto cleanup; |
248 | } | 237 | } |
249 | 238 | ||
250 | /* Init object and attach to NS node */ | 239 | /* Init object and attach to NS node */ |
251 | 240 | ||
252 | obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value; | 241 | obj_desc->mutex.sync_level = |
253 | obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 242 | (u8) walk_state->operands[1]->integer.value; |
254 | 243 | obj_desc->mutex.node = | |
255 | status = acpi_ns_attach_object (obj_desc->mutex.node, | 244 | (struct acpi_namespace_node *)walk_state->operands[0]; |
256 | obj_desc, ACPI_TYPE_MUTEX); | ||
257 | 245 | ||
246 | status = acpi_ns_attach_object(obj_desc->mutex.node, | ||
247 | obj_desc, ACPI_TYPE_MUTEX); | ||
258 | 248 | ||
259 | cleanup: | 249 | cleanup: |
260 | /* | 250 | /* |
261 | * Remove local reference to the object (on error, will cause deletion | 251 | * Remove local reference to the object (on error, will cause deletion |
262 | * of both object and semaphore if present.) | 252 | * of both object and semaphore if present.) |
263 | */ | 253 | */ |
264 | acpi_ut_remove_reference (obj_desc); | 254 | acpi_ut_remove_reference(obj_desc); |
265 | return_ACPI_STATUS (status); | 255 | return_ACPI_STATUS(status); |
266 | } | 256 | } |
267 | 257 | ||
268 | |||
269 | /******************************************************************************* | 258 | /******************************************************************************* |
270 | * | 259 | * |
271 | * FUNCTION: acpi_ex_create_region | 260 | * FUNCTION: acpi_ex_create_region |
@@ -282,20 +271,16 @@ cleanup: | |||
282 | ******************************************************************************/ | 271 | ******************************************************************************/ |
283 | 272 | ||
284 | acpi_status | 273 | acpi_status |
285 | acpi_ex_create_region ( | 274 | acpi_ex_create_region(u8 * aml_start, |
286 | u8 *aml_start, | 275 | u32 aml_length, |
287 | u32 aml_length, | 276 | u8 region_space, struct acpi_walk_state *walk_state) |
288 | u8 region_space, | ||
289 | struct acpi_walk_state *walk_state) | ||
290 | { | 277 | { |
291 | acpi_status status; | 278 | acpi_status status; |
292 | union acpi_operand_object *obj_desc; | 279 | union acpi_operand_object *obj_desc; |
293 | struct acpi_namespace_node *node; | 280 | struct acpi_namespace_node *node; |
294 | union acpi_operand_object *region_obj2; | 281 | union acpi_operand_object *region_obj2; |
295 | |||
296 | |||
297 | ACPI_FUNCTION_TRACE ("ex_create_region"); | ||
298 | 282 | ||
283 | ACPI_FUNCTION_TRACE("ex_create_region"); | ||
299 | 284 | ||
300 | /* Get the Namespace Node */ | 285 | /* Get the Namespace Node */ |
301 | 286 | ||
@@ -305,8 +290,8 @@ acpi_ex_create_region ( | |||
305 | * If the region object is already attached to this node, | 290 | * If the region object is already attached to this node, |
306 | * just return | 291 | * just return |
307 | */ | 292 | */ |
308 | if (acpi_ns_get_attached_object (node)) { | 293 | if (acpi_ns_get_attached_object(node)) { |
309 | return_ACPI_STATUS (AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
310 | } | 295 | } |
311 | 296 | ||
312 | /* | 297 | /* |
@@ -314,17 +299,18 @@ acpi_ex_create_region ( | |||
314 | * range | 299 | * range |
315 | */ | 300 | */ |
316 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && | 301 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && |
317 | (region_space < ACPI_USER_REGION_BEGIN)) { | 302 | (region_space < ACPI_USER_REGION_BEGIN)) { |
318 | ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space)); | 303 | ACPI_REPORT_ERROR(("Invalid address_space type %X\n", |
319 | return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); | 304 | region_space)); |
305 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); | ||
320 | } | 306 | } |
321 | 307 | ||
322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", | 308 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n", |
323 | acpi_ut_get_region_name (region_space), region_space)); | 309 | acpi_ut_get_region_name(region_space), region_space)); |
324 | 310 | ||
325 | /* Create the region descriptor */ | 311 | /* Create the region descriptor */ |
326 | 312 | ||
327 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); | 313 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); |
328 | if (!obj_desc) { | 314 | if (!obj_desc) { |
329 | status = AE_NO_MEMORY; | 315 | status = AE_NO_MEMORY; |
330 | goto cleanup; | 316 | goto cleanup; |
@@ -334,7 +320,7 @@ acpi_ex_create_region ( | |||
334 | * Remember location in AML stream of address & length | 320 | * Remember location in AML stream of address & length |
335 | * operands since they need to be evaluated at run time. | 321 | * operands since they need to be evaluated at run time. |
336 | */ | 322 | */ |
337 | region_obj2 = obj_desc->common.next_object; | 323 | region_obj2 = obj_desc->common.next_object; |
338 | region_obj2->extra.aml_start = aml_start; | 324 | region_obj2->extra.aml_start = aml_start; |
339 | region_obj2->extra.aml_length = aml_length; | 325 | region_obj2->extra.aml_length = aml_length; |
340 | 326 | ||
@@ -343,22 +329,20 @@ acpi_ex_create_region ( | |||
343 | obj_desc->region.space_id = region_space; | 329 | obj_desc->region.space_id = region_space; |
344 | obj_desc->region.address = 0; | 330 | obj_desc->region.address = 0; |
345 | obj_desc->region.length = 0; | 331 | obj_desc->region.length = 0; |
346 | obj_desc->region.node = node; | 332 | obj_desc->region.node = node; |
347 | 333 | ||
348 | /* Install the new region object in the parent Node */ | 334 | /* Install the new region object in the parent Node */ |
349 | 335 | ||
350 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); | 336 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); |
351 | 337 | ||
352 | 338 | cleanup: | |
353 | cleanup: | ||
354 | 339 | ||
355 | /* Remove local reference to the object */ | 340 | /* Remove local reference to the object */ |
356 | 341 | ||
357 | acpi_ut_remove_reference (obj_desc); | 342 | acpi_ut_remove_reference(obj_desc); |
358 | return_ACPI_STATUS (status); | 343 | return_ACPI_STATUS(status); |
359 | } | 344 | } |
360 | 345 | ||
361 | |||
362 | /******************************************************************************* | 346 | /******************************************************************************* |
363 | * | 347 | * |
364 | * FUNCTION: acpi_ex_create_table_region | 348 | * FUNCTION: acpi_ex_create_table_region |
@@ -371,20 +355,16 @@ cleanup: | |||
371 | * | 355 | * |
372 | ******************************************************************************/ | 356 | ******************************************************************************/ |
373 | 357 | ||
374 | acpi_status | 358 | acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) |
375 | acpi_ex_create_table_region ( | ||
376 | struct acpi_walk_state *walk_state) | ||
377 | { | 359 | { |
378 | acpi_status status; | 360 | acpi_status status; |
379 | union acpi_operand_object **operand = &walk_state->operands[0]; | 361 | union acpi_operand_object **operand = &walk_state->operands[0]; |
380 | union acpi_operand_object *obj_desc; | 362 | union acpi_operand_object *obj_desc; |
381 | struct acpi_namespace_node *node; | 363 | struct acpi_namespace_node *node; |
382 | struct acpi_table_header *table; | 364 | struct acpi_table_header *table; |
383 | union acpi_operand_object *region_obj2; | 365 | union acpi_operand_object *region_obj2; |
384 | |||
385 | |||
386 | ACPI_FUNCTION_TRACE ("ex_create_table_region"); | ||
387 | 366 | ||
367 | ACPI_FUNCTION_TRACE("ex_create_table_region"); | ||
388 | 368 | ||
389 | /* Get the Node from the object stack */ | 369 | /* Get the Node from the object stack */ |
390 | 370 | ||
@@ -394,66 +374,64 @@ acpi_ex_create_table_region ( | |||
394 | * If the region object is already attached to this node, | 374 | * If the region object is already attached to this node, |
395 | * just return | 375 | * just return |
396 | */ | 376 | */ |
397 | if (acpi_ns_get_attached_object (node)) { | 377 | if (acpi_ns_get_attached_object(node)) { |
398 | return_ACPI_STATUS (AE_OK); | 378 | return_ACPI_STATUS(AE_OK); |
399 | } | 379 | } |
400 | 380 | ||
401 | /* Find the ACPI table */ | 381 | /* Find the ACPI table */ |
402 | 382 | ||
403 | status = acpi_tb_find_table (operand[1]->string.pointer, | 383 | status = acpi_tb_find_table(operand[1]->string.pointer, |
404 | operand[2]->string.pointer, | 384 | operand[2]->string.pointer, |
405 | operand[3]->string.pointer, &table); | 385 | operand[3]->string.pointer, &table); |
406 | if (ACPI_FAILURE (status)) { | 386 | if (ACPI_FAILURE(status)) { |
407 | return_ACPI_STATUS (status); | 387 | return_ACPI_STATUS(status); |
408 | } | 388 | } |
409 | 389 | ||
410 | /* Create the region descriptor */ | 390 | /* Create the region descriptor */ |
411 | 391 | ||
412 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); | 392 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); |
413 | if (!obj_desc) { | 393 | if (!obj_desc) { |
414 | return_ACPI_STATUS (AE_NO_MEMORY); | 394 | return_ACPI_STATUS(AE_NO_MEMORY); |
415 | } | 395 | } |
416 | 396 | ||
417 | region_obj2 = obj_desc->common.next_object; | 397 | region_obj2 = obj_desc->common.next_object; |
418 | region_obj2->extra.region_context = NULL; | 398 | region_obj2->extra.region_context = NULL; |
419 | 399 | ||
420 | /* Init the region from the operands */ | 400 | /* Init the region from the operands */ |
421 | 401 | ||
422 | obj_desc->region.space_id = REGION_DATA_TABLE; | 402 | obj_desc->region.space_id = REGION_DATA_TABLE; |
423 | obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table); | 403 | obj_desc->region.address = |
404 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
424 | obj_desc->region.length = table->length; | 405 | obj_desc->region.length = table->length; |
425 | obj_desc->region.node = node; | 406 | obj_desc->region.node = node; |
426 | obj_desc->region.flags = AOPOBJ_DATA_VALID; | 407 | obj_desc->region.flags = AOPOBJ_DATA_VALID; |
427 | 408 | ||
428 | /* Install the new region object in the parent Node */ | 409 | /* Install the new region object in the parent Node */ |
429 | 410 | ||
430 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); | 411 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); |
431 | if (ACPI_FAILURE (status)) { | 412 | if (ACPI_FAILURE(status)) { |
432 | goto cleanup; | 413 | goto cleanup; |
433 | } | 414 | } |
434 | 415 | ||
435 | status = acpi_ev_initialize_region (obj_desc, FALSE); | 416 | status = acpi_ev_initialize_region(obj_desc, FALSE); |
436 | if (ACPI_FAILURE (status)) { | 417 | if (ACPI_FAILURE(status)) { |
437 | if (status == AE_NOT_EXIST) { | 418 | if (status == AE_NOT_EXIST) { |
438 | status = AE_OK; | 419 | status = AE_OK; |
439 | } | 420 | } else { |
440 | else { | ||
441 | goto cleanup; | 421 | goto cleanup; |
442 | } | 422 | } |
443 | } | 423 | } |
444 | 424 | ||
445 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; | 425 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; |
446 | 426 | ||
447 | 427 | cleanup: | |
448 | cleanup: | ||
449 | 428 | ||
450 | /* Remove local reference to the object */ | 429 | /* Remove local reference to the object */ |
451 | 430 | ||
452 | acpi_ut_remove_reference (obj_desc); | 431 | acpi_ut_remove_reference(obj_desc); |
453 | return_ACPI_STATUS (status); | 432 | return_ACPI_STATUS(status); |
454 | } | 433 | } |
455 | 434 | ||
456 | |||
457 | /******************************************************************************* | 435 | /******************************************************************************* |
458 | * | 436 | * |
459 | * FUNCTION: acpi_ex_create_processor | 437 | * FUNCTION: acpi_ex_create_processor |
@@ -468,43 +446,39 @@ cleanup: | |||
468 | * | 446 | * |
469 | ******************************************************************************/ | 447 | ******************************************************************************/ |
470 | 448 | ||
471 | acpi_status | 449 | acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) |
472 | acpi_ex_create_processor ( | ||
473 | struct acpi_walk_state *walk_state) | ||
474 | { | 450 | { |
475 | union acpi_operand_object **operand = &walk_state->operands[0]; | 451 | union acpi_operand_object **operand = &walk_state->operands[0]; |
476 | union acpi_operand_object *obj_desc; | 452 | union acpi_operand_object *obj_desc; |
477 | acpi_status status; | 453 | acpi_status status; |
478 | |||
479 | |||
480 | ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state); | ||
481 | 454 | ||
455 | ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); | ||
482 | 456 | ||
483 | /* Create the processor object */ | 457 | /* Create the processor object */ |
484 | 458 | ||
485 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR); | 459 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR); |
486 | if (!obj_desc) { | 460 | if (!obj_desc) { |
487 | return_ACPI_STATUS (AE_NO_MEMORY); | 461 | return_ACPI_STATUS(AE_NO_MEMORY); |
488 | } | 462 | } |
489 | 463 | ||
490 | /* Initialize the processor object from the operands */ | 464 | /* Initialize the processor object from the operands */ |
491 | 465 | ||
492 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 466 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
493 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; | 467 | obj_desc->processor.address = |
494 | obj_desc->processor.length = (u8) operand[3]->integer.value; | 468 | (acpi_io_address) operand[2]->integer.value; |
469 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
495 | 470 | ||
496 | /* Install the processor object in the parent Node */ | 471 | /* Install the processor object in the parent Node */ |
497 | 472 | ||
498 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 473 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
499 | obj_desc, ACPI_TYPE_PROCESSOR); | 474 | obj_desc, ACPI_TYPE_PROCESSOR); |
500 | 475 | ||
501 | /* Remove local reference to the object */ | 476 | /* Remove local reference to the object */ |
502 | 477 | ||
503 | acpi_ut_remove_reference (obj_desc); | 478 | acpi_ut_remove_reference(obj_desc); |
504 | return_ACPI_STATUS (status); | 479 | return_ACPI_STATUS(status); |
505 | } | 480 | } |
506 | 481 | ||
507 | |||
508 | /******************************************************************************* | 482 | /******************************************************************************* |
509 | * | 483 | * |
510 | * FUNCTION: acpi_ex_create_power_resource | 484 | * FUNCTION: acpi_ex_create_power_resource |
@@ -519,43 +493,39 @@ acpi_ex_create_processor ( | |||
519 | * | 493 | * |
520 | ******************************************************************************/ | 494 | ******************************************************************************/ |
521 | 495 | ||
522 | acpi_status | 496 | acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) |
523 | acpi_ex_create_power_resource ( | ||
524 | struct acpi_walk_state *walk_state) | ||
525 | { | 497 | { |
526 | union acpi_operand_object **operand = &walk_state->operands[0]; | 498 | union acpi_operand_object **operand = &walk_state->operands[0]; |
527 | acpi_status status; | 499 | acpi_status status; |
528 | union acpi_operand_object *obj_desc; | 500 | union acpi_operand_object *obj_desc; |
529 | |||
530 | |||
531 | ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state); | ||
532 | 501 | ||
502 | ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); | ||
533 | 503 | ||
534 | /* Create the power resource object */ | 504 | /* Create the power resource object */ |
535 | 505 | ||
536 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER); | 506 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER); |
537 | if (!obj_desc) { | 507 | if (!obj_desc) { |
538 | return_ACPI_STATUS (AE_NO_MEMORY); | 508 | return_ACPI_STATUS(AE_NO_MEMORY); |
539 | } | 509 | } |
540 | 510 | ||
541 | /* Initialize the power object from the operands */ | 511 | /* Initialize the power object from the operands */ |
542 | 512 | ||
543 | obj_desc->power_resource.system_level = (u8) operand[1]->integer.value; | 513 | obj_desc->power_resource.system_level = (u8) operand[1]->integer.value; |
544 | obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value; | 514 | obj_desc->power_resource.resource_order = |
515 | (u16) operand[2]->integer.value; | ||
545 | 516 | ||
546 | /* Install the power resource object in the parent Node */ | 517 | /* Install the power resource object in the parent Node */ |
547 | 518 | ||
548 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 519 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
549 | obj_desc, ACPI_TYPE_POWER); | 520 | obj_desc, ACPI_TYPE_POWER); |
550 | 521 | ||
551 | /* Remove local reference to the object */ | 522 | /* Remove local reference to the object */ |
552 | 523 | ||
553 | acpi_ut_remove_reference (obj_desc); | 524 | acpi_ut_remove_reference(obj_desc); |
554 | return_ACPI_STATUS (status); | 525 | return_ACPI_STATUS(status); |
555 | } | 526 | } |
556 | #endif | 527 | #endif |
557 | 528 | ||
558 | |||
559 | /******************************************************************************* | 529 | /******************************************************************************* |
560 | * | 530 | * |
561 | * FUNCTION: acpi_ex_create_method | 531 | * FUNCTION: acpi_ex_create_method |
@@ -571,25 +541,21 @@ acpi_ex_create_power_resource ( | |||
571 | ******************************************************************************/ | 541 | ******************************************************************************/ |
572 | 542 | ||
573 | acpi_status | 543 | acpi_status |
574 | acpi_ex_create_method ( | 544 | acpi_ex_create_method(u8 * aml_start, |
575 | u8 *aml_start, | 545 | u32 aml_length, struct acpi_walk_state *walk_state) |
576 | u32 aml_length, | ||
577 | struct acpi_walk_state *walk_state) | ||
578 | { | 546 | { |
579 | union acpi_operand_object **operand = &walk_state->operands[0]; | 547 | union acpi_operand_object **operand = &walk_state->operands[0]; |
580 | union acpi_operand_object *obj_desc; | 548 | union acpi_operand_object *obj_desc; |
581 | acpi_status status; | 549 | acpi_status status; |
582 | u8 method_flags; | 550 | u8 method_flags; |
583 | |||
584 | |||
585 | ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state); | ||
586 | 551 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); | ||
587 | 553 | ||
588 | /* Create a new method object */ | 554 | /* Create a new method object */ |
589 | 555 | ||
590 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD); | 556 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); |
591 | if (!obj_desc) { | 557 | if (!obj_desc) { |
592 | return_ACPI_STATUS (AE_NO_MEMORY); | 558 | return_ACPI_STATUS(AE_NO_MEMORY); |
593 | } | 559 | } |
594 | 560 | ||
595 | /* Save the method's AML pointer and length */ | 561 | /* Save the method's AML pointer and length */ |
@@ -603,8 +569,10 @@ acpi_ex_create_method ( | |||
603 | */ | 569 | */ |
604 | method_flags = (u8) operand[1]->integer.value; | 570 | method_flags = (u8) operand[1]->integer.value; |
605 | 571 | ||
606 | obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT); | 572 | obj_desc->method.method_flags = |
607 | obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT); | 573 | (u8) (method_flags & ~AML_METHOD_ARG_COUNT); |
574 | obj_desc->method.param_count = | ||
575 | (u8) (method_flags & AML_METHOD_ARG_COUNT); | ||
608 | 576 | ||
609 | /* | 577 | /* |
610 | * Get the concurrency count. If required, a semaphore will be | 578 | * Get the concurrency count. If required, a semaphore will be |
@@ -613,32 +581,28 @@ acpi_ex_create_method ( | |||
613 | if (acpi_gbl_all_methods_serialized) { | 581 | if (acpi_gbl_all_methods_serialized) { |
614 | obj_desc->method.concurrency = 1; | 582 | obj_desc->method.concurrency = 1; |
615 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; | 583 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; |
616 | } | 584 | } else if (method_flags & AML_METHOD_SERIALIZED) { |
617 | else if (method_flags & AML_METHOD_SERIALIZED) { | ||
618 | /* | 585 | /* |
619 | * ACPI 1.0: Concurrency = 1 | 586 | * ACPI 1.0: Concurrency = 1 |
620 | * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) | 587 | * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) |
621 | */ | 588 | */ |
622 | obj_desc->method.concurrency = (u8) | 589 | obj_desc->method.concurrency = (u8) |
623 | (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); | 590 | (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); |
624 | } | 591 | } else { |
625 | else { | ||
626 | obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; | 592 | obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; |
627 | } | 593 | } |
628 | 594 | ||
629 | /* Attach the new object to the method Node */ | 595 | /* Attach the new object to the method Node */ |
630 | 596 | ||
631 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 597 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
632 | obj_desc, ACPI_TYPE_METHOD); | 598 | obj_desc, ACPI_TYPE_METHOD); |
633 | 599 | ||
634 | /* Remove local reference to the object */ | 600 | /* Remove local reference to the object */ |
635 | 601 | ||
636 | acpi_ut_remove_reference (obj_desc); | 602 | acpi_ut_remove_reference(obj_desc); |
637 | 603 | ||
638 | /* Remove a reference to the operand */ | 604 | /* Remove a reference to the operand */ |
639 | 605 | ||
640 | acpi_ut_remove_reference (operand[1]); | 606 | acpi_ut_remove_reference(operand[1]); |
641 | return_ACPI_STATUS (status); | 607 | return_ACPI_STATUS(status); |
642 | } | 608 | } |
643 | |||
644 | |||