diff options
Diffstat (limited to 'drivers/acpi/executer/excreate.c')
-rw-r--r-- | drivers/acpi/executer/excreate.c | 117 |
1 files changed, 16 insertions, 101 deletions
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 6e9a23e47fef..60e62c4f0577 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -96,6 +96,9 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
96 | * to the original Node. | 96 | * to the original Node. |
97 | */ | 97 | */ |
98 | switch (target_node->type) { | 98 | switch (target_node->type) { |
99 | |||
100 | /* For these types, the sub-object can change dynamically via a Store */ | ||
101 | |||
99 | case ACPI_TYPE_INTEGER: | 102 | case ACPI_TYPE_INTEGER: |
100 | case ACPI_TYPE_STRING: | 103 | case ACPI_TYPE_STRING: |
101 | case ACPI_TYPE_BUFFER: | 104 | case ACPI_TYPE_BUFFER: |
@@ -103,9 +106,18 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
103 | case ACPI_TYPE_BUFFER_FIELD: | 106 | case ACPI_TYPE_BUFFER_FIELD: |
104 | 107 | ||
105 | /* | 108 | /* |
109 | * These types open a new scope, so we need the NS node in order to access | ||
110 | * any children. | ||
111 | */ | ||
112 | case ACPI_TYPE_DEVICE: | ||
113 | case ACPI_TYPE_POWER: | ||
114 | case ACPI_TYPE_PROCESSOR: | ||
115 | case ACPI_TYPE_THERMAL: | ||
116 | case ACPI_TYPE_LOCAL_SCOPE: | ||
117 | |||
118 | /* | ||
106 | * The new alias has the type ALIAS and points to the original | 119 | * The new alias has the type ALIAS and points to the original |
107 | * NS node, not the object itself. This is because for these | 120 | * NS node, not the object itself. |
108 | * types, the object can change dynamically via a Store. | ||
109 | */ | 121 | */ |
110 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; | 122 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; |
111 | alias_node->object = | 123 | alias_node->object = |
@@ -115,9 +127,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
115 | case ACPI_TYPE_METHOD: | 127 | case ACPI_TYPE_METHOD: |
116 | 128 | ||
117 | /* | 129 | /* |
118 | * The new alias has the type ALIAS and points to the original | 130 | * Control method aliases need to be differentiated |
119 | * NS node, not the object itself. This is because for these | ||
120 | * types, the object can change dynamically via a Store. | ||
121 | */ | 131 | */ |
122 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; | 132 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; |
123 | alias_node->object = | 133 | alias_node->object = |
@@ -342,101 +352,6 @@ acpi_ex_create_region(u8 * aml_start, | |||
342 | 352 | ||
343 | /******************************************************************************* | 353 | /******************************************************************************* |
344 | * | 354 | * |
345 | * FUNCTION: acpi_ex_create_table_region | ||
346 | * | ||
347 | * PARAMETERS: walk_state - Current state | ||
348 | * | ||
349 | * RETURN: Status | ||
350 | * | ||
351 | * DESCRIPTION: Create a new data_table_region object | ||
352 | * | ||
353 | ******************************************************************************/ | ||
354 | |||
355 | acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | ||
356 | { | ||
357 | acpi_status status; | ||
358 | union acpi_operand_object **operand = &walk_state->operands[0]; | ||
359 | union acpi_operand_object *obj_desc; | ||
360 | struct acpi_namespace_node *node; | ||
361 | union acpi_operand_object *region_obj2; | ||
362 | acpi_native_uint table_index; | ||
363 | struct acpi_table_header *table; | ||
364 | |||
365 | ACPI_FUNCTION_TRACE(ex_create_table_region); | ||
366 | |||
367 | /* Get the Node from the object stack */ | ||
368 | |||
369 | node = walk_state->op->common.node; | ||
370 | |||
371 | /* | ||
372 | * If the region object is already attached to this node, | ||
373 | * just return | ||
374 | */ | ||
375 | if (acpi_ns_get_attached_object(node)) { | ||
376 | return_ACPI_STATUS(AE_OK); | ||
377 | } | ||
378 | |||
379 | /* Find the ACPI table */ | ||
380 | |||
381 | status = acpi_tb_find_table(operand[1]->string.pointer, | ||
382 | operand[2]->string.pointer, | ||
383 | operand[3]->string.pointer, &table_index); | ||
384 | if (ACPI_FAILURE(status)) { | ||
385 | return_ACPI_STATUS(status); | ||
386 | } | ||
387 | |||
388 | /* Create the region descriptor */ | ||
389 | |||
390 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); | ||
391 | if (!obj_desc) { | ||
392 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
393 | } | ||
394 | |||
395 | region_obj2 = obj_desc->common.next_object; | ||
396 | region_obj2->extra.region_context = NULL; | ||
397 | |||
398 | status = acpi_get_table_by_index(table_index, &table); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | return_ACPI_STATUS(status); | ||
401 | } | ||
402 | |||
403 | /* Init the region from the operands */ | ||
404 | |||
405 | obj_desc->region.space_id = REGION_DATA_TABLE; | ||
406 | obj_desc->region.address = | ||
407 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
408 | obj_desc->region.length = table->length; | ||
409 | obj_desc->region.node = node; | ||
410 | obj_desc->region.flags = AOPOBJ_DATA_VALID; | ||
411 | |||
412 | /* Install the new region object in the parent Node */ | ||
413 | |||
414 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); | ||
415 | if (ACPI_FAILURE(status)) { | ||
416 | goto cleanup; | ||
417 | } | ||
418 | |||
419 | status = acpi_ev_initialize_region(obj_desc, FALSE); | ||
420 | if (ACPI_FAILURE(status)) { | ||
421 | if (status == AE_NOT_EXIST) { | ||
422 | status = AE_OK; | ||
423 | } else { | ||
424 | goto cleanup; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; | ||
429 | |||
430 | cleanup: | ||
431 | |||
432 | /* Remove local reference to the object */ | ||
433 | |||
434 | acpi_ut_remove_reference(obj_desc); | ||
435 | return_ACPI_STATUS(status); | ||
436 | } | ||
437 | |||
438 | /******************************************************************************* | ||
439 | * | ||
440 | * FUNCTION: acpi_ex_create_processor | 355 | * FUNCTION: acpi_ex_create_processor |
441 | * | 356 | * |
442 | * PARAMETERS: walk_state - Current state | 357 | * PARAMETERS: walk_state - Current state |