aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/tables')
-rw-r--r--drivers/acpi/tables/tbget.c40
-rw-r--r--drivers/acpi/tables/tbrsdt.c11
2 files changed, 16 insertions, 35 deletions
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 3a4f46ca3884..99eacceff563 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -417,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
417 * 417 *
418 * PARAMETERS: table_type - one of the defined table types 418 * PARAMETERS: table_type - one of the defined table types
419 * Instance - Which table of this type 419 * Instance - Which table of this type
420 * table_ptr_loc - pointer to location to place the pointer for 420 * return_table - pointer to location to place the pointer for
421 * return 421 * return
422 * 422 *
423 * RETURN: Status 423 * RETURN: Status
@@ -428,58 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
428 428
429acpi_status 429acpi_status
430acpi_tb_get_table_ptr(acpi_table_type table_type, 430acpi_tb_get_table_ptr(acpi_table_type table_type,
431 u32 instance, struct acpi_table_header **table_ptr_loc) 431 u32 instance, struct acpi_table_header **return_table)
432{ 432{
433 struct acpi_table_desc *table_desc; 433 struct acpi_table_desc *table_desc;
434 u32 i; 434 u32 i;
435 435
436 ACPI_FUNCTION_TRACE(tb_get_table_ptr); 436 ACPI_FUNCTION_TRACE(tb_get_table_ptr);
437 437
438 if (!acpi_gbl_DSDT) {
439 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
440 }
441
442 if (table_type > ACPI_TABLE_ID_MAX) { 438 if (table_type > ACPI_TABLE_ID_MAX) {
443 return_ACPI_STATUS(AE_BAD_PARAMETER); 439 return_ACPI_STATUS(AE_BAD_PARAMETER);
444 } 440 }
445 441
446 /* 442 /* Check for instance out of range of the current table count */
447 * For all table types (Single/Multiple), the first
448 * instance is always in the list head.
449 */
450 if (instance == 1) {
451
452 /* Get the first */
453
454 *table_ptr_loc = NULL;
455 if (acpi_gbl_table_lists[table_type].next) {
456 *table_ptr_loc =
457 acpi_gbl_table_lists[table_type].next->pointer;
458 }
459 return_ACPI_STATUS(AE_OK);
460 }
461
462 /* Check for instance out of range */
463 443
464 if (instance > acpi_gbl_table_lists[table_type].count) { 444 if (instance > acpi_gbl_table_lists[table_type].count) {
465 return_ACPI_STATUS(AE_NOT_EXIST); 445 return_ACPI_STATUS(AE_NOT_EXIST);
466 } 446 }
467 447
468 /* Walk the list to get the desired table 448 /*
469 * Since the if (Instance == 1) check above checked for the 449 * Walk the list to get the desired table
470 * first table, setting table_desc equal to the .Next member 450 * Note: Instance is one-based
471 * is actually pointing to the second table. Therefore, we
472 * need to walk from the 2nd table until we reach the Instance
473 * that the user is looking for and return its table pointer.
474 */ 451 */
475 table_desc = acpi_gbl_table_lists[table_type].next; 452 table_desc = acpi_gbl_table_lists[table_type].next;
476 for (i = 2; i < instance; i++) { 453 for (i = 1; i < instance; i++) {
477 table_desc = table_desc->next; 454 table_desc = table_desc->next;
478 } 455 }
479 456
480 /* We are now pointing to the requested table's descriptor */ 457 /* We are now pointing to the requested table's descriptor */
481 458
482 *table_ptr_loc = table_desc->pointer; 459 *return_table = table_desc->pointer;
483
484 return_ACPI_STATUS(AE_OK); 460 return_ACPI_STATUS(AE_OK);
485} 461}
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 494965229fa2..abcb08c2592a 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
78 */ 78 */
79 status = acpi_os_map_memory(address->pointer.physical, 79 status = acpi_os_map_memory(address->pointer.physical,
80 sizeof(struct rsdp_descriptor), 80 sizeof(struct rsdp_descriptor),
81 (void *)&rsdp); 81 ACPI_CAST_PTR(void, &rsdp));
82 if (ACPI_FAILURE(status)) { 82 if (ACPI_FAILURE(status)) {
83 return_ACPI_STATUS(status); 83 return_ACPI_STATUS(status);
84 } 84 }
@@ -95,11 +95,16 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
95 goto cleanup; 95 goto cleanup;
96 } 96 }
97 97
98 /* The RSDP supplied is OK */ 98 /* RSDP is ok. Init the table info */
99 99
100 table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); 100 table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp);
101 table_info.length = sizeof(struct rsdp_descriptor); 101 table_info.length = sizeof(struct rsdp_descriptor);
102 table_info.allocation = ACPI_MEM_MAPPED; 102
103 if (address->pointer_type == ACPI_PHYSICAL_POINTER) {
104 table_info.allocation = ACPI_MEM_MAPPED;
105 } else {
106 table_info.allocation = ACPI_MEM_NOT_ALLOCATED;
107 }
103 108
104 /* Save the table pointers and allocation info */ 109 /* Save the table pointers and allocation info */
105 110