diff options
Diffstat (limited to 'drivers/acpi/executer/exconfig.c')
-rw-r--r-- | drivers/acpi/executer/exconfig.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index a29782fe3ecf..823352435e08 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
82 | struct acpi_table_desc table_info; | 82 | struct acpi_table_desc table_info; |
83 | union acpi_operand_object *obj_desc; | 83 | union acpi_operand_object *obj_desc; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE("ex_add_table"); | 85 | ACPI_FUNCTION_TRACE(ex_add_table); |
86 | 86 | ||
87 | /* Create an object to be the table handle */ | 87 | /* Create an object to be the table handle */ |
88 | 88 | ||
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
100 | 100 | ||
101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); | 101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); |
102 | 102 | ||
103 | table_info.type = ACPI_TABLE_SSDT; | 103 | table_info.type = ACPI_TABLE_ID_SSDT; |
104 | table_info.pointer = table; | 104 | table_info.pointer = table; |
105 | table_info.length = (acpi_size) table->length; | 105 | table_info.length = (acpi_size) table->length; |
106 | table_info.allocation = ACPI_MEM_ALLOCATED; | 106 | table_info.allocation = ACPI_MEM_ALLOCATED; |
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
110 | 110 | ||
111 | if (ACPI_FAILURE(status)) { | 111 | if (ACPI_FAILURE(status)) { |
112 | if (status == AE_ALREADY_EXISTS) { | 112 | if (status == AE_ALREADY_EXISTS) { |
113 | |||
113 | /* Table already exists, just return the handle */ | 114 | /* Table already exists, just return the handle */ |
114 | 115 | ||
115 | return_ACPI_STATUS(AE_OK); | 116 | return_ACPI_STATUS(AE_OK); |
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
121 | 122 | ||
122 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); | 123 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); |
123 | if (ACPI_FAILURE(status)) { | 124 | if (ACPI_FAILURE(status)) { |
125 | |||
124 | /* Uninstall table on error */ | 126 | /* Uninstall table on error */ |
125 | 127 | ||
126 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 128 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
160 | struct acpi_namespace_node *parameter_node = NULL; | 162 | struct acpi_namespace_node *parameter_node = NULL; |
161 | union acpi_operand_object *ddb_handle; | 163 | union acpi_operand_object *ddb_handle; |
162 | 164 | ||
163 | ACPI_FUNCTION_TRACE("ex_load_table_op"); | 165 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
164 | 166 | ||
165 | #if 0 | 167 | #if 0 |
166 | /* | 168 | /* |
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
169 | */ | 171 | */ |
170 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); | 172 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); |
171 | if (status == AE_OK) { | 173 | if (status == AE_OK) { |
174 | |||
172 | /* Signature matched -- don't allow override */ | 175 | /* Signature matched -- don't allow override */ |
173 | 176 | ||
174 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 177 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
211 | * location within the namespace where the table will be loaded. | 214 | * location within the namespace where the table will be loaded. |
212 | */ | 215 | */ |
213 | status = | 216 | status = |
214 | acpi_ns_get_node_by_path(operand[3]->string.pointer, | 217 | acpi_ns_get_node(start_node, operand[3]->string.pointer, |
215 | start_node, ACPI_NS_SEARCH_PARENT, | 218 | ACPI_NS_SEARCH_PARENT, &parent_node); |
216 | &parent_node); | ||
217 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
218 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
219 | } | 221 | } |
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
234 | /* Find the node referenced by the parameter_path_string */ | 236 | /* Find the node referenced by the parameter_path_string */ |
235 | 237 | ||
236 | status = | 238 | status = |
237 | acpi_ns_get_node_by_path(operand[4]->string.pointer, | 239 | acpi_ns_get_node(start_node, operand[4]->string.pointer, |
238 | start_node, ACPI_NS_SEARCH_PARENT, | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
239 | ¶meter_node); | ||
240 | if (ACPI_FAILURE(status)) { | 241 | if (ACPI_FAILURE(status)) { |
241 | return_ACPI_STATUS(status); | 242 | return_ACPI_STATUS(status); |
242 | } | 243 | } |
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
252 | /* Parameter Data (optional) */ | 253 | /* Parameter Data (optional) */ |
253 | 254 | ||
254 | if (parameter_node) { | 255 | if (parameter_node) { |
256 | |||
255 | /* Store the parameter data into the optional parameter object */ | 257 | /* Store the parameter data into the optional parameter object */ |
256 | 258 | ||
257 | status = acpi_ex_store(operand[5], | 259 | status = acpi_ex_store(operand[5], |
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
294 | struct acpi_table_header *table_ptr = NULL; | 296 | struct acpi_table_header *table_ptr = NULL; |
295 | acpi_physical_address address; | 297 | acpi_physical_address address; |
296 | struct acpi_table_header table_header; | 298 | struct acpi_table_header table_header; |
299 | acpi_integer temp; | ||
297 | u32 i; | 300 | u32 i; |
298 | 301 | ||
299 | ACPI_FUNCTION_TRACE("ex_load_op"); | 302 | ACPI_FUNCTION_TRACE(ex_load_op); |
300 | 303 | ||
301 | /* Object can be either an op_region or a Field */ | 304 | /* Object can be either an op_region or a Field */ |
302 | 305 | ||
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
322 | 325 | ||
323 | address = obj_desc->region.address; | 326 | address = obj_desc->region.address; |
324 | 327 | ||
325 | /* Get the table length from the table header */ | 328 | /* Get part of the table header to get the table length */ |
326 | 329 | ||
327 | table_header.length = 0; | 330 | table_header.length = 0; |
328 | for (i = 0; i < 8; i++) { | 331 | for (i = 0; i < 8; i++) { |
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
330 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 333 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
331 | (acpi_physical_address) | 334 | (acpi_physical_address) |
332 | (i + address), 8, | 335 | (i + address), 8, |
333 | ((u8 *) & | 336 | &temp); |
334 | table_header) + i); | ||
335 | if (ACPI_FAILURE(status)) { | 337 | if (ACPI_FAILURE(status)) { |
336 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
337 | } | 339 | } |
340 | |||
341 | /* Get the one valid byte of the returned 64-bit value */ | ||
342 | |||
343 | ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; | ||
338 | } | 344 | } |
339 | 345 | ||
340 | /* Sanity check the table length */ | 346 | /* Sanity check the table length */ |
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
345 | 351 | ||
346 | /* Allocate a buffer for the entire table */ | 352 | /* Allocate a buffer for the entire table */ |
347 | 353 | ||
348 | table_ptr = ACPI_MEM_ALLOCATE(table_header.length); | 354 | table_ptr = ACPI_ALLOCATE(table_header.length); |
349 | if (!table_ptr) { | 355 | if (!table_ptr) { |
350 | return_ACPI_STATUS(AE_NO_MEMORY); | 356 | return_ACPI_STATUS(AE_NO_MEMORY); |
351 | } | 357 | } |
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
357 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 363 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
358 | (acpi_physical_address) | 364 | (acpi_physical_address) |
359 | (i + address), 8, | 365 | (i + address), 8, |
360 | ((u8 *) table_ptr + | 366 | &temp); |
361 | i)); | ||
362 | if (ACPI_FAILURE(status)) { | 367 | if (ACPI_FAILURE(status)) { |
363 | goto cleanup; | 368 | goto cleanup; |
364 | } | 369 | } |
370 | |||
371 | /* Get the one valid byte of the returned 64-bit value */ | ||
372 | |||
373 | ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; | ||
365 | } | 374 | } |
366 | break; | 375 | break; |
367 | 376 | ||
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
407 | 416 | ||
408 | /* The table must be either an SSDT or a PSDT */ | 417 | /* The table must be either an SSDT or a PSDT */ |
409 | 418 | ||
410 | if ((!ACPI_STRNCMP(table_ptr->signature, | 419 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && |
411 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, | 420 | (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { |
412 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && | ||
413 | (!ACPI_STRNCMP(table_ptr->signature, | ||
414 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, | ||
415 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { | ||
416 | ACPI_ERROR((AE_INFO, | 421 | ACPI_ERROR((AE_INFO, |
417 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 422 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", |
418 | table_ptr->signature)); | 423 | table_ptr->signature)); |
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
424 | 429 | ||
425 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); | 430 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); |
426 | if (ACPI_FAILURE(status)) { | 431 | if (ACPI_FAILURE(status)) { |
432 | |||
427 | /* On error, table_ptr was deallocated above */ | 433 | /* On error, table_ptr was deallocated above */ |
428 | 434 | ||
429 | return_ACPI_STATUS(status); | 435 | return_ACPI_STATUS(status); |
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
442 | 448 | ||
443 | cleanup: | 449 | cleanup: |
444 | if (ACPI_FAILURE(status)) { | 450 | if (ACPI_FAILURE(status)) { |
445 | ACPI_MEM_FREE(table_ptr); | 451 | ACPI_FREE(table_ptr); |
446 | } | 452 | } |
447 | return_ACPI_STATUS(status); | 453 | return_ACPI_STATUS(status); |
448 | } | 454 | } |
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
465 | union acpi_operand_object *table_desc = ddb_handle; | 471 | union acpi_operand_object *table_desc = ddb_handle; |
466 | struct acpi_table_desc *table_info; | 472 | struct acpi_table_desc *table_info; |
467 | 473 | ||
468 | ACPI_FUNCTION_TRACE("ex_unload_table"); | 474 | ACPI_FUNCTION_TRACE(ex_unload_table); |
469 | 475 | ||
470 | /* | 476 | /* |
471 | * Validate the handle | 477 | * Validate the handle |