aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbxface.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:45:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:45:38 -0400
commit04afb40593f9a3007e5ea817d009529ef10fb685 (patch)
treede5a16c2b1e5f2d97a7c2eccea4677719817f282 /drivers/acpi/acpica/tbxface.c
parent7f06a8b26aba1dc03b42272dc0089a800372c575 (diff)
parentcce4f632db200aef147c59084437168174b23f11 (diff)
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (22 commits) ACPI: fix early DSDT dmi check warnings on ia64 ACPICA: Update version to 20100428. ACPICA: Update/clarify some parameter names associated with acpi_handle ACPICA: Rename acpi_ex_system_do_suspend->acpi_ex_system_do_sleep ACPICA: Prevent possible allocation overrun during object copy ACPICA: Split large file, evgpeblk ACPICA: Add GPE support for dynamically loaded ACPI tables ACPICA: Clarify/rename some root table descriptor fields ACPICA: Update version to 20100331. ACPICA: Minimize the differences between linux GPE code and ACPICA code base ACPI: add boot option acpi=copy_dsdt to fix corrupt DSDT ACPICA: Update DSDT copy/detection. ACPICA: Add subsystem option to force copy of DSDT to local memory ACPICA: Add detection of corrupted/replaced DSDT ACPICA: Add write support for DataTable operation regions ACPICA: Fix for acpi_reallocate_root_table for incorrect root table copy ACPICA: Update comments/headers, no functional change ACPICA: Update version to 20100304 ACPICA: Fix for possible fault in acpi_ex_release_mutex ACPICA: Standardize integer output for ACPICA warnings/errors ...
Diffstat (limited to 'drivers/acpi/acpica/tbxface.c')
-rw-r--r--drivers/acpi/acpica/tbxface.c80
1 files changed, 58 insertions, 22 deletions
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 5217a6159a31..4a8b9e6ea57a 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -72,7 +72,7 @@ static int no_auto_ssdt;
72acpi_status acpi_allocate_root_table(u32 initial_table_count) 72acpi_status acpi_allocate_root_table(u32 initial_table_count)
73{ 73{
74 74
75 acpi_gbl_root_table_list.size = initial_table_count; 75 acpi_gbl_root_table_list.max_table_count = initial_table_count;
76 acpi_gbl_root_table_list.flags = ACPI_ROOT_ALLOW_RESIZE; 76 acpi_gbl_root_table_list.flags = ACPI_ROOT_ALLOW_RESIZE;
77 77
78 return (acpi_tb_resize_root_table_list()); 78 return (acpi_tb_resize_root_table_list());
@@ -130,7 +130,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
130 sizeof(struct acpi_table_desc)); 130 sizeof(struct acpi_table_desc));
131 131
132 acpi_gbl_root_table_list.tables = initial_table_array; 132 acpi_gbl_root_table_list.tables = initial_table_array;
133 acpi_gbl_root_table_list.size = initial_table_count; 133 acpi_gbl_root_table_list.max_table_count = initial_table_count;
134 acpi_gbl_root_table_list.flags = ACPI_ROOT_ORIGIN_UNKNOWN; 134 acpi_gbl_root_table_list.flags = ACPI_ROOT_ORIGIN_UNKNOWN;
135 if (allow_resize) { 135 if (allow_resize) {
136 acpi_gbl_root_table_list.flags |= 136 acpi_gbl_root_table_list.flags |=
@@ -172,6 +172,7 @@ acpi_status acpi_reallocate_root_table(void)
172{ 172{
173 struct acpi_table_desc *tables; 173 struct acpi_table_desc *tables;
174 acpi_size new_size; 174 acpi_size new_size;
175 acpi_size current_size;
175 176
176 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); 177 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
177 178
@@ -183,10 +184,17 @@ acpi_status acpi_reallocate_root_table(void)
183 return_ACPI_STATUS(AE_SUPPORT); 184 return_ACPI_STATUS(AE_SUPPORT);
184 } 185 }
185 186
186 new_size = ((acpi_size) acpi_gbl_root_table_list.count + 187 /*
187 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 188 * Get the current size of the root table and add the default
189 * increment to create the new table size.
190 */
191 current_size = (acpi_size)
192 acpi_gbl_root_table_list.current_table_count *
188 sizeof(struct acpi_table_desc); 193 sizeof(struct acpi_table_desc);
189 194
195 new_size = current_size +
196 (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc));
197
190 /* Create new array and copy the old array */ 198 /* Create new array and copy the old array */
191 199
192 tables = ACPI_ALLOCATE_ZEROED(new_size); 200 tables = ACPI_ALLOCATE_ZEROED(new_size);
@@ -194,10 +202,17 @@ acpi_status acpi_reallocate_root_table(void)
194 return_ACPI_STATUS(AE_NO_MEMORY); 202 return_ACPI_STATUS(AE_NO_MEMORY);
195 } 203 }
196 204
197 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, new_size); 205 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size);
198 206
199 acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count; 207 /*
208 * Update the root table descriptor. The new size will be the current
209 * number of tables plus the increment, independent of the reserved
210 * size of the original table list.
211 */
200 acpi_gbl_root_table_list.tables = tables; 212 acpi_gbl_root_table_list.tables = tables;
213 acpi_gbl_root_table_list.max_table_count =
214 acpi_gbl_root_table_list.current_table_count +
215 ACPI_ROOT_TABLE_SIZE_INCREMENT;
201 acpi_gbl_root_table_list.flags = 216 acpi_gbl_root_table_list.flags =
202 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; 217 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
203 218
@@ -278,7 +293,8 @@ acpi_get_table_header(char *signature,
278 293
279 /* Walk the root table list */ 294 /* Walk the root table list */
280 295
281 for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) { 296 for (i = 0, j = 0; i < acpi_gbl_root_table_list.current_table_count;
297 i++) {
282 if (!ACPI_COMPARE_NAME 298 if (!ACPI_COMPARE_NAME
283 (&(acpi_gbl_root_table_list.tables[i].signature), 299 (&(acpi_gbl_root_table_list.tables[i].signature),
284 signature)) { 300 signature)) {
@@ -341,7 +357,7 @@ acpi_status acpi_unload_table_id(acpi_owner_id id)
341 ACPI_FUNCTION_TRACE(acpi_unload_table_id); 357 ACPI_FUNCTION_TRACE(acpi_unload_table_id);
342 358
343 /* Find table in the global table list */ 359 /* Find table in the global table list */
344 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { 360 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
345 if (id != acpi_gbl_root_table_list.tables[i].owner_id) { 361 if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
346 continue; 362 continue;
347 } 363 }
@@ -391,7 +407,8 @@ acpi_get_table_with_size(char *signature,
391 407
392 /* Walk the root table list */ 408 /* Walk the root table list */
393 409
394 for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) { 410 for (i = 0, j = 0; i < acpi_gbl_root_table_list.current_table_count;
411 i++) {
395 if (!ACPI_COMPARE_NAME 412 if (!ACPI_COMPARE_NAME
396 (&(acpi_gbl_root_table_list.tables[i].signature), 413 (&(acpi_gbl_root_table_list.tables[i].signature),
397 signature)) { 414 signature)) {
@@ -459,7 +476,7 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table)
459 476
460 /* Validate index */ 477 /* Validate index */
461 478
462 if (table_index >= acpi_gbl_root_table_list.count) { 479 if (table_index >= acpi_gbl_root_table_list.current_table_count) {
463 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 480 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
464 return_ACPI_STATUS(AE_BAD_PARAMETER); 481 return_ACPI_STATUS(AE_BAD_PARAMETER);
465 } 482 }
@@ -500,16 +517,17 @@ static acpi_status acpi_tb_load_namespace(void)
500{ 517{
501 acpi_status status; 518 acpi_status status;
502 u32 i; 519 u32 i;
520 struct acpi_table_header *new_dsdt;
503 521
504 ACPI_FUNCTION_TRACE(tb_load_namespace); 522 ACPI_FUNCTION_TRACE(tb_load_namespace);
505 523
506 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 524 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
507 525
508 /* 526 /*
509 * Load the namespace. The DSDT is required, but any SSDT and PSDT tables 527 * Load the namespace. The DSDT is required, but any SSDT and
510 * are optional. 528 * PSDT tables are optional. Verify the DSDT.
511 */ 529 */
512 if (!acpi_gbl_root_table_list.count || 530 if (!acpi_gbl_root_table_list.current_table_count ||
513 !ACPI_COMPARE_NAME(& 531 !ACPI_COMPARE_NAME(&
514 (acpi_gbl_root_table_list. 532 (acpi_gbl_root_table_list.
515 tables[ACPI_TABLE_INDEX_DSDT].signature), 533 tables[ACPI_TABLE_INDEX_DSDT].signature),
@@ -522,17 +540,35 @@ static acpi_status acpi_tb_load_namespace(void)
522 goto unlock_and_exit; 540 goto unlock_and_exit;
523 } 541 }
524 542
525 /* A valid DSDT is required */ 543 /*
526 544 * Save the DSDT pointer for simple access. This is the mapped memory
527 status = 545 * address. We must take care here because the address of the .Tables
528 acpi_tb_verify_table(&acpi_gbl_root_table_list. 546 * array can change dynamically as tables are loaded at run-time. Note:
529 tables[ACPI_TABLE_INDEX_DSDT]); 547 * .Pointer field is not validated until after call to acpi_tb_verify_table.
530 if (ACPI_FAILURE(status)) { 548 */
549 acpi_gbl_DSDT =
550 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;
531 551
532 status = AE_NO_ACPI_TABLES; 552 /*
533 goto unlock_and_exit; 553 * Optionally copy the entire DSDT to local memory (instead of simply
554 * mapping it.) There are some BIOSs that corrupt or replace the original
555 * DSDT, creating the need for this option. Default is FALSE, do not copy
556 * the DSDT.
557 */
558 if (acpi_gbl_copy_dsdt_locally) {
559 new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
560 if (new_dsdt) {
561 acpi_gbl_DSDT = new_dsdt;
562 }
534 } 563 }
535 564
565 /*
566 * Save the original DSDT header for detection of table corruption
567 * and/or replacement of the DSDT from outside the OS.
568 */
569 ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
570 sizeof(struct acpi_table_header));
571
536 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 572 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
537 573
538 /* Load and parse tables */ 574 /* Load and parse tables */
@@ -545,7 +581,7 @@ static acpi_status acpi_tb_load_namespace(void)
545 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ 581 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
546 582
547 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 583 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
548 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { 584 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
549 if ((!ACPI_COMPARE_NAME 585 if ((!ACPI_COMPARE_NAME
550 (&(acpi_gbl_root_table_list.tables[i].signature), 586 (&(acpi_gbl_root_table_list.tables[i].signature),
551 ACPI_SIG_SSDT) 587 ACPI_SIG_SSDT)