aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbget.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-05-26 16:36:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-14 02:44:35 -0400
commit4119532c95547821dbe72d6916dfa1b2148475b3 (patch)
tree564eb8f69924fb7dc72e93526faf1547acac7d30 /drivers/acpi/tables/tbget.c
parentb8d35192c55fb055792ff0641408eaaec7c88988 (diff)
ACPI: ACPICA 20060526
Restructured, flattened, and simplified the internal interfaces for namespace object evaluation - resulting in smaller code, less CPU stack use, and fewer interfaces. (With assistance from Mikhail Kouzmich) Fixed a problem with the CopyObject operator where the first parameter was not typed correctly for the parser, interpreter, compiler, and disassembler. Caused various errors and unexpected behavior. Fixed a problem where a ShiftLeft or ShiftRight of more than 64 bits produced incorrect results with some C compilers. Since the behavior of C compilers when the shift value is larger than the datatype width is apparently not well defined, the interpreter now detects this condition and simply returns zero as expected in all such cases. (BZ 395) Fixed problem reports (Valery Podrezov) integrated: - Update String-to-Integer conversion to match ACPI 3.0A spec http://bugzilla.kernel.org/show_bug.cgi?id=5329 Allow interpreter to handle nested method declarations http://bugzilla.kernel.org/show_bug.cgi?id=5361 Fixed problem reports (Fiodor Suietov) integrated: - acpi_terminate() doesn't free debug memory allocation list objects (BZ 355) - After Core Subsystem shutdown, acpi_subsystem_status() returns AE_OK (BZ 356) - acpi_os_unmap_memory() for RSDP can be invoked inconsistently (BZ 357) - Resource Manager should return AE_TYPE for non-device objects (BZ 358) - Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) - Use acpi_os_free() instead of ACPI_FREE in acpi_rs_set_srs_method_data (BZ 360) - Incomplete cleanup branch in acpi_ps_parse_aml (BZ 361) - Incomplete cleanup branch in acpi_ds_delete_walk_state (BZ 362) - acpi_get_table_header returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ 365) - Status of the Global Initialization Handler call not used (BZ 366) - Incorrect object parameter to Global Initialization Handler (BZ 367) Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbget.c')
-rw-r--r--drivers/acpi/tables/tbget.c40
1 files changed, 8 insertions, 32 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}