diff options
Diffstat (limited to 'drivers/acpi/executer/exconfig.c')
-rw-r--r-- | drivers/acpi/executer/exconfig.c | 85 |
1 files changed, 35 insertions, 50 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index c8341fa5fe01..dd43b00e18b5 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("exconfig") | |||
54 | 54 | ||
55 | /* Local prototypes */ | 55 | /* Local prototypes */ |
56 | static acpi_status | 56 | static acpi_status |
57 | acpi_ex_add_table(struct acpi_table_header *table, | 57 | acpi_ex_add_table(acpi_native_uint table_index, |
58 | struct acpi_namespace_node *parent_node, | 58 | struct acpi_namespace_node *parent_node, |
59 | union acpi_operand_object **ddb_handle); | 59 | union acpi_operand_object **ddb_handle); |
60 | 60 | ||
@@ -74,12 +74,11 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
74 | ******************************************************************************/ | 74 | ******************************************************************************/ |
75 | 75 | ||
76 | static acpi_status | 76 | static acpi_status |
77 | acpi_ex_add_table(struct acpi_table_header *table, | 77 | acpi_ex_add_table(acpi_native_uint table_index, |
78 | struct acpi_namespace_node *parent_node, | 78 | struct acpi_namespace_node *parent_node, |
79 | union acpi_operand_object **ddb_handle) | 79 | union acpi_operand_object **ddb_handle) |
80 | { | 80 | { |
81 | acpi_status status; | 81 | acpi_status status; |
82 | struct acpi_table_desc table_info; | ||
83 | union acpi_operand_object *obj_desc; | 82 | union acpi_operand_object *obj_desc; |
84 | 83 | ||
85 | ACPI_FUNCTION_TRACE(ex_add_table); | 84 | ACPI_FUNCTION_TRACE(ex_add_table); |
@@ -98,42 +97,16 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
98 | 97 | ||
99 | /* Install the new table into the local data structures */ | 98 | /* Install the new table into the local data structures */ |
100 | 99 | ||
101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); | 100 | obj_desc->reference.object = ACPI_CAST_PTR(void, table_index); |
102 | |||
103 | table_info.type = ACPI_TABLE_ID_SSDT; | ||
104 | table_info.pointer = table; | ||
105 | table_info.length = (acpi_size) table->length; | ||
106 | table_info.allocation = ACPI_MEM_ALLOCATED; | ||
107 | |||
108 | status = acpi_tb_install_table(&table_info); | ||
109 | obj_desc->reference.object = table_info.installed_desc; | ||
110 | |||
111 | if (ACPI_FAILURE(status)) { | ||
112 | if (status == AE_ALREADY_EXISTS) { | ||
113 | |||
114 | /* Table already exists, just return the handle */ | ||
115 | |||
116 | return_ACPI_STATUS(AE_OK); | ||
117 | } | ||
118 | goto cleanup; | ||
119 | } | ||
120 | 101 | ||
121 | /* Add the table to the namespace */ | 102 | /* Add the table to the namespace */ |
122 | 103 | ||
123 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); | 104 | status = acpi_ns_load_table(table_index, parent_node); |
124 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
125 | 106 | acpi_ut_remove_reference(obj_desc); | |
126 | /* Uninstall table on error */ | 107 | *ddb_handle = NULL; |
127 | |||
128 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | ||
129 | goto cleanup; | ||
130 | } | 108 | } |
131 | 109 | ||
132 | return_ACPI_STATUS(AE_OK); | ||
133 | |||
134 | cleanup: | ||
135 | acpi_ut_remove_reference(obj_desc); | ||
136 | *ddb_handle = NULL; | ||
137 | return_ACPI_STATUS(status); | 110 | return_ACPI_STATUS(status); |
138 | } | 111 | } |
139 | 112 | ||
@@ -156,11 +129,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
156 | { | 129 | { |
157 | acpi_status status; | 130 | acpi_status status; |
158 | union acpi_operand_object **operand = &walk_state->operands[0]; | 131 | union acpi_operand_object **operand = &walk_state->operands[0]; |
159 | struct acpi_table_header *table; | 132 | acpi_native_uint table_index; |
160 | struct acpi_namespace_node *parent_node; | 133 | struct acpi_namespace_node *parent_node; |
161 | struct acpi_namespace_node *start_node; | 134 | struct acpi_namespace_node *start_node; |
162 | struct acpi_namespace_node *parameter_node = NULL; | 135 | struct acpi_namespace_node *parameter_node = NULL; |
163 | union acpi_operand_object *ddb_handle; | 136 | union acpi_operand_object *ddb_handle; |
137 | struct acpi_table_header *table; | ||
164 | 138 | ||
165 | ACPI_FUNCTION_TRACE(ex_load_table_op); | 139 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
166 | 140 | ||
@@ -182,7 +156,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
182 | 156 | ||
183 | status = acpi_tb_find_table(operand[0]->string.pointer, | 157 | status = acpi_tb_find_table(operand[0]->string.pointer, |
184 | operand[1]->string.pointer, | 158 | operand[1]->string.pointer, |
185 | operand[2]->string.pointer, &table); | 159 | operand[2]->string.pointer, &table_index); |
186 | if (ACPI_FAILURE(status)) { | 160 | if (ACPI_FAILURE(status)) { |
187 | if (status != AE_NOT_FOUND) { | 161 | if (status != AE_NOT_FOUND) { |
188 | return_ACPI_STATUS(status); | 162 | return_ACPI_STATUS(status); |
@@ -245,7 +219,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
245 | 219 | ||
246 | /* Load the table into the namespace */ | 220 | /* Load the table into the namespace */ |
247 | 221 | ||
248 | status = acpi_ex_add_table(table, parent_node, &ddb_handle); | 222 | status = acpi_ex_add_table(table_index, parent_node, &ddb_handle); |
249 | if (ACPI_FAILURE(status)) { | 223 | if (ACPI_FAILURE(status)) { |
250 | return_ACPI_STATUS(status); | 224 | return_ACPI_STATUS(status); |
251 | } | 225 | } |
@@ -266,9 +240,13 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
266 | } | 240 | } |
267 | } | 241 | } |
268 | 242 | ||
269 | ACPI_INFO((AE_INFO, | 243 | status = acpi_get_table_by_index(table_index, &table); |
270 | "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", | 244 | if (ACPI_SUCCESS(status)) { |
271 | table->signature, table->oem_id, table->oem_table_id)); | 245 | ACPI_INFO((AE_INFO, |
246 | "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", | ||
247 | table->signature, table->oem_id, | ||
248 | table->oem_table_id)); | ||
249 | } | ||
272 | 250 | ||
273 | *return_desc = ddb_handle; | 251 | *return_desc = ddb_handle; |
274 | return_ACPI_STATUS(status); | 252 | return_ACPI_STATUS(status); |
@@ -298,6 +276,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
298 | union acpi_operand_object *ddb_handle; | 276 | union acpi_operand_object *ddb_handle; |
299 | union acpi_operand_object *buffer_desc = NULL; | 277 | union acpi_operand_object *buffer_desc = NULL; |
300 | struct acpi_table_header *table_ptr = NULL; | 278 | struct acpi_table_header *table_ptr = NULL; |
279 | acpi_native_uint table_index; | ||
301 | acpi_physical_address address; | 280 | acpi_physical_address address; |
302 | struct acpi_table_header table_header; | 281 | struct acpi_table_header table_header; |
303 | acpi_integer temp; | 282 | acpi_integer temp; |
@@ -420,8 +399,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
420 | 399 | ||
421 | /* The table must be either an SSDT or a PSDT */ | 400 | /* The table must be either an SSDT or a PSDT */ |
422 | 401 | ||
423 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && | 402 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, ACPI_SIG_PSDT)) && |
424 | (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { | 403 | (!ACPI_COMPARE_NAME(table_ptr->signature, ACPI_SIG_SSDT))) { |
425 | ACPI_ERROR((AE_INFO, | 404 | ACPI_ERROR((AE_INFO, |
426 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 405 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", |
427 | table_ptr->signature)); | 406 | table_ptr->signature)); |
@@ -429,9 +408,16 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
429 | goto cleanup; | 408 | goto cleanup; |
430 | } | 409 | } |
431 | 410 | ||
432 | /* Install the new table into the local data structures */ | 411 | /* |
412 | * Install the new table into the local data structures | ||
413 | */ | ||
414 | status = acpi_tb_add_table(table_ptr, &table_index); | ||
415 | if (ACPI_FAILURE(status)) { | ||
416 | return_ACPI_STATUS(status); | ||
417 | } | ||
433 | 418 | ||
434 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); | 419 | status = |
420 | acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle); | ||
435 | if (ACPI_FAILURE(status)) { | 421 | if (ACPI_FAILURE(status)) { |
436 | 422 | ||
437 | /* On error, table_ptr was deallocated above */ | 423 | /* On error, table_ptr was deallocated above */ |
@@ -477,7 +463,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
477 | { | 463 | { |
478 | acpi_status status = AE_OK; | 464 | acpi_status status = AE_OK; |
479 | union acpi_operand_object *table_desc = ddb_handle; | 465 | union acpi_operand_object *table_desc = ddb_handle; |
480 | struct acpi_table_desc *table_info; | 466 | acpi_native_uint table_index; |
481 | 467 | ||
482 | ACPI_FUNCTION_TRACE(ex_unload_table); | 468 | ACPI_FUNCTION_TRACE(ex_unload_table); |
483 | 469 | ||
@@ -493,19 +479,18 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
493 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 479 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
494 | } | 480 | } |
495 | 481 | ||
496 | /* Get the actual table descriptor from the ddb_handle */ | 482 | /* Get the table index from the ddb_handle */ |
497 | 483 | ||
498 | table_info = (struct acpi_table_desc *)table_desc->reference.object; | 484 | table_index = (acpi_native_uint) table_desc->reference.object; |
499 | 485 | ||
500 | /* | 486 | /* |
501 | * Delete the entire namespace under this table Node | 487 | * Delete the entire namespace under this table Node |
502 | * (Offset contains the table_id) | 488 | * (Offset contains the table_id) |
503 | */ | 489 | */ |
504 | acpi_ns_delete_namespace_by_owner(table_info->owner_id); | 490 | acpi_tb_delete_namespace_by_owner(table_index); |
505 | 491 | acpi_tb_release_owner_id(table_index); | |
506 | /* Delete the table itself */ | ||
507 | 492 | ||
508 | (void)acpi_tb_uninstall_table(table_info->installed_desc); | 493 | acpi_tb_set_table_loaded_flag(table_index, FALSE); |
509 | 494 | ||
510 | /* Delete the table descriptor (ddb_handle) */ | 495 | /* Delete the table descriptor (ddb_handle) */ |
511 | 496 | ||