aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbinstal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/tbinstal.c')
-rw-r--r--drivers/acpi/acpica/tbinstal.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 7ec02b0f69e0..83d7af8d0905 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -137,7 +137,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
137 137
138 /* Check if table is already registered */ 138 /* Check if table is already registered */
139 139
140 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { 140 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
141 if (!acpi_gbl_root_table_list.tables[i].pointer) { 141 if (!acpi_gbl_root_table_list.tables[i].pointer) {
142 status = 142 status =
143 acpi_tb_verify_table(&acpi_gbl_root_table_list. 143 acpi_tb_verify_table(&acpi_gbl_root_table_list.
@@ -273,7 +273,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
273 /* Increase the Table Array size */ 273 /* Increase the Table Array size */
274 274
275 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. 275 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list.
276 size + 276 max_table_count +
277 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 277 ACPI_ROOT_TABLE_SIZE_INCREMENT) *
278 sizeof(struct acpi_table_desc)); 278 sizeof(struct acpi_table_desc));
279 if (!tables) { 279 if (!tables) {
@@ -286,8 +286,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
286 286
287 if (acpi_gbl_root_table_list.tables) { 287 if (acpi_gbl_root_table_list.tables) {
288 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, 288 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
289 (acpi_size) acpi_gbl_root_table_list.size * 289 (acpi_size) acpi_gbl_root_table_list.
290 sizeof(struct acpi_table_desc)); 290 max_table_count * sizeof(struct acpi_table_desc));
291 291
292 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 292 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
293 ACPI_FREE(acpi_gbl_root_table_list.tables); 293 ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -295,8 +295,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
295 } 295 }
296 296
297 acpi_gbl_root_table_list.tables = tables; 297 acpi_gbl_root_table_list.tables = tables;
298 acpi_gbl_root_table_list.size += ACPI_ROOT_TABLE_SIZE_INCREMENT; 298 acpi_gbl_root_table_list.max_table_count +=
299 acpi_gbl_root_table_list.flags |= (u8) ACPI_ROOT_ORIGIN_ALLOCATED; 299 ACPI_ROOT_TABLE_SIZE_INCREMENT;
300 acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED;
300 301
301 return_ACPI_STATUS(AE_OK); 302 return_ACPI_STATUS(AE_OK);
302} 303}
@@ -321,38 +322,36 @@ acpi_tb_store_table(acpi_physical_address address,
321 struct acpi_table_header *table, 322 struct acpi_table_header *table,
322 u32 length, u8 flags, u32 *table_index) 323 u32 length, u8 flags, u32 *table_index)
323{ 324{
324 acpi_status status = AE_OK; 325 acpi_status status;
326 struct acpi_table_desc *new_table;
325 327
326 /* Ensure that there is room for the table in the Root Table List */ 328 /* Ensure that there is room for the table in the Root Table List */
327 329
328 if (acpi_gbl_root_table_list.count >= acpi_gbl_root_table_list.size) { 330 if (acpi_gbl_root_table_list.current_table_count >=
331 acpi_gbl_root_table_list.max_table_count) {
329 status = acpi_tb_resize_root_table_list(); 332 status = acpi_tb_resize_root_table_list();
330 if (ACPI_FAILURE(status)) { 333 if (ACPI_FAILURE(status)) {
331 return (status); 334 return (status);
332 } 335 }
333 } 336 }
334 337
338 new_table =
339 &acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.
340 current_table_count];
341
335 /* Initialize added table */ 342 /* Initialize added table */
336 343
337 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. 344 new_table->address = address;
338 address = address; 345 new_table->pointer = table;
339 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. 346 new_table->length = length;
340 pointer = table; 347 new_table->owner_id = 0;
341 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count].length = 348 new_table->flags = flags;
342 length; 349
343 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. 350 ACPI_MOVE_32_TO_32(&new_table->signature, table->signature);
344 owner_id = 0; 351
345 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count].flags = 352 *table_index = acpi_gbl_root_table_list.current_table_count;
346 flags; 353 acpi_gbl_root_table_list.current_table_count++;
347 354 return (AE_OK);
348 ACPI_MOVE_32_TO_32(&
349 (acpi_gbl_root_table_list.
350 tables[acpi_gbl_root_table_list.count].signature),
351 table->signature);
352
353 *table_index = acpi_gbl_root_table_list.count;
354 acpi_gbl_root_table_list.count++;
355 return (status);
356} 355}
357 356
358/******************************************************************************* 357/*******************************************************************************
@@ -408,7 +407,7 @@ void acpi_tb_terminate(void)
408 407
409 /* Delete the individual tables */ 408 /* Delete the individual tables */
410 409
411 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { 410 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) {
412 acpi_tb_delete_table(&acpi_gbl_root_table_list.tables[i]); 411 acpi_tb_delete_table(&acpi_gbl_root_table_list.tables[i]);
413 } 412 }
414 413
@@ -422,7 +421,7 @@ void acpi_tb_terminate(void)
422 421
423 acpi_gbl_root_table_list.tables = NULL; 422 acpi_gbl_root_table_list.tables = NULL;
424 acpi_gbl_root_table_list.flags = 0; 423 acpi_gbl_root_table_list.flags = 0;
425 acpi_gbl_root_table_list.count = 0; 424 acpi_gbl_root_table_list.current_table_count = 0;
426 425
427 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); 426 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
428 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 427 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
@@ -452,7 +451,7 @@ acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index)
452 return_ACPI_STATUS(status); 451 return_ACPI_STATUS(status);
453 } 452 }
454 453
455 if (table_index >= acpi_gbl_root_table_list.count) { 454 if (table_index >= acpi_gbl_root_table_list.current_table_count) {
456 455
457 /* The table index does not exist */ 456 /* The table index does not exist */
458 457
@@ -505,7 +504,7 @@ acpi_status acpi_tb_allocate_owner_id(u32 table_index)
505 ACPI_FUNCTION_TRACE(tb_allocate_owner_id); 504 ACPI_FUNCTION_TRACE(tb_allocate_owner_id);
506 505
507 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 506 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
508 if (table_index < acpi_gbl_root_table_list.count) { 507 if (table_index < acpi_gbl_root_table_list.current_table_count) {
509 status = acpi_ut_allocate_owner_id 508 status = acpi_ut_allocate_owner_id
510 (&(acpi_gbl_root_table_list.tables[table_index].owner_id)); 509 (&(acpi_gbl_root_table_list.tables[table_index].owner_id));
511 } 510 }
@@ -533,7 +532,7 @@ acpi_status acpi_tb_release_owner_id(u32 table_index)
533 ACPI_FUNCTION_TRACE(tb_release_owner_id); 532 ACPI_FUNCTION_TRACE(tb_release_owner_id);
534 533
535 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 534 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
536 if (table_index < acpi_gbl_root_table_list.count) { 535 if (table_index < acpi_gbl_root_table_list.current_table_count) {
537 acpi_ut_release_owner_id(& 536 acpi_ut_release_owner_id(&
538 (acpi_gbl_root_table_list. 537 (acpi_gbl_root_table_list.
539 tables[table_index].owner_id)); 538 tables[table_index].owner_id));
@@ -564,7 +563,7 @@ acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id)
564 ACPI_FUNCTION_TRACE(tb_get_owner_id); 563 ACPI_FUNCTION_TRACE(tb_get_owner_id);
565 564
566 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 565 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
567 if (table_index < acpi_gbl_root_table_list.count) { 566 if (table_index < acpi_gbl_root_table_list.current_table_count) {
568 *owner_id = 567 *owner_id =
569 acpi_gbl_root_table_list.tables[table_index].owner_id; 568 acpi_gbl_root_table_list.tables[table_index].owner_id;
570 status = AE_OK; 569 status = AE_OK;
@@ -589,7 +588,7 @@ u8 acpi_tb_is_table_loaded(u32 table_index)
589 u8 is_loaded = FALSE; 588 u8 is_loaded = FALSE;
590 589
591 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 590 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
592 if (table_index < acpi_gbl_root_table_list.count) { 591 if (table_index < acpi_gbl_root_table_list.current_table_count) {
593 is_loaded = (u8) 592 is_loaded = (u8)
594 (acpi_gbl_root_table_list.tables[table_index].flags & 593 (acpi_gbl_root_table_list.tables[table_index].flags &
595 ACPI_TABLE_IS_LOADED); 594 ACPI_TABLE_IS_LOADED);
@@ -616,7 +615,7 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded)
616{ 615{
617 616
618 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 617 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
619 if (table_index < acpi_gbl_root_table_list.count) { 618 if (table_index < acpi_gbl_root_table_list.current_table_count) {
620 if (is_loaded) { 619 if (is_loaded) {
621 acpi_gbl_root_table_list.tables[table_index].flags |= 620 acpi_gbl_root_table_list.tables[table_index].flags |=
622 ACPI_TABLE_IS_LOADED; 621 ACPI_TABLE_IS_LOADED;