diff options
Diffstat (limited to 'drivers/acpi/tables')
-rw-r--r-- | drivers/acpi/tables/tbconvrt.c | 105 | ||||
-rw-r--r-- | drivers/acpi/tables/tbget.c | 63 | ||||
-rw-r--r-- | drivers/acpi/tables/tbgetall.c | 45 | ||||
-rw-r--r-- | drivers/acpi/tables/tbinstal.c | 31 | ||||
-rw-r--r-- | drivers/acpi/tables/tbrsdt.c | 19 | ||||
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 97 | ||||
-rw-r--r-- | drivers/acpi/tables/tbxface.c | 39 | ||||
-rw-r--r-- | drivers/acpi/tables/tbxfroot.c | 123 |
8 files changed, 324 insertions, 198 deletions
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 334327c1f66..92e0c31539b 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -50,6 +50,24 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbconvrt") +/* Local prototypes */ + +static void +acpi_tb_init_generic_address ( + struct acpi_generic_address *new_gas_struct, + u8 register_bit_width, + acpi_physical_address address); + +static void +acpi_tb_convert_fadt1 ( + struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev1 *original_fadt); + +static void +acpi_tb_convert_fadt2 ( + struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev2 *original_fadt); + u8 acpi_fadt_is_v1; EXPORT_SYMBOL(acpi_fadt_is_v1); @@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt ( for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { if (acpi_gbl_RSDP->revision < 2) { ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], - (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); + (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, + table_info->pointer))->table_offset_entry[i]); } else { new_table->table_offset_entry[i] = - (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; + (ACPI_CAST_PTR (XSDT_DESCRIPTOR, + table_info->pointer))->table_offset_entry[i]; } } @@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: acpi_tb_init_generic_address * @@ -201,7 +221,7 @@ acpi_tb_init_generic_address ( * PARAMETERS: local_fadt - Pointer to new FADT * original_fadt - Pointer to old FADT * - * RETURN: Populates local_fadt + * RETURN: None, populates local_fadt * * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format * @@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 ( struct fadt_descriptor_rev1 *original_fadt) { - /* ACPI 1.0 FACS */ /* The BIOS stored FADT should agree with Revision 1.0 */ acpi_fadt_is_v1 = 1; @@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 ( ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); /* - * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) + * System Interrupt Model isn't used in ACPI 2.0 + * (local_fadt->Reserved1 = 0;) */ /* @@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 ( * that immediately follows. */ ACPI_MEMCPY (&local_fadt->reset_register, - &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, + &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, + original_fadt))->reset_register, sizeof (struct acpi_generic_address) + 1); } else { @@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 ( acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + + (acpi_physical_address) + (local_fadt->xpm1a_evt_blk.address + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); /* PM1B is optional; leave null if not present */ @@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 ( if (local_fadt->xpm1b_evt_blk.address) { acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + + (acpi_physical_address) + (local_fadt->xpm1b_evt_blk.address + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); } } @@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 ( * PARAMETERS: local_fadt - Pointer to new FADT * original_fadt - Pointer to old FADT * - * RETURN: Populates local_fadt + * RETURN: None, populates local_fadt * * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. * Handles optional "X" fields. @@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 ( * is zero. */ if (!(local_fadt->xfirmware_ctrl)) { - ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); + ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, + local_fadt->V1_firmware_ctrl); } if (!(local_fadt->Xdsdt)) { @@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 ( if (!(local_fadt->xpm1a_evt_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, - local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); + local_fadt->pm1_evt_len, + (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); } if (!(local_fadt->xpm1b_evt_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, - local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); + local_fadt->pm1_evt_len, + (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); } if (!(local_fadt->xpm1a_cnt_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, - local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); + local_fadt->pm1_cnt_len, + (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); } if (!(local_fadt->xpm1b_cnt_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, - local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); + local_fadt->pm1_cnt_len, + (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); } if (!(local_fadt->xpm2_cnt_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, - local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); + local_fadt->pm2_cnt_len, + (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); } if (!(local_fadt->xpm_tmr_blk.address)) { acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, - local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); + local_fadt->pm_tm_len, + (acpi_physical_address) local_fadt->V1_pm_tmr_blk); } if (!(local_fadt->xgpe0_blk.address)) { @@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 ( acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + + (acpi_physical_address) + (local_fadt->xpm1a_evt_blk.address + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); - acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; + + acpi_gbl_xpm1a_enable.address_space_id = + local_fadt->xpm1a_evt_blk.address_space_id; /* PM1B is optional; leave null if not present */ if (local_fadt->xpm1b_evt_blk.address) { acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + + (acpi_physical_address) + (local_fadt->xpm1b_evt_blk.address + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); - acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; + + acpi_gbl_xpm1b_enable.address_space_id = + local_fadt->xpm1b_evt_blk.address_space_id; } } @@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 ( ******************************************************************************/ acpi_status -acpi_tb_convert_table_fadt (void) +acpi_tb_convert_table_fadt ( + void) { struct fadt_descriptor_rev2 *local_fadt; struct acpi_table_desc *table_desc; @@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void) * at least as long as the version 1.0 FADT */ if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { - ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); + ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", + acpi_gbl_FADT->length)); return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); } @@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void) if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { /* Length is too short to be a V2.0 table */ - ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", - acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); + ACPI_REPORT_WARNING (( + "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", + acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); } @@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void) acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); } - /* - * Global FADT pointer will point to the new common V2.0 FADT - */ + /* Global FADT pointer will point to the new common V2.0 FADT */ + acpi_gbl_FADT = local_fadt; acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); @@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void) /******************************************************************************* * - * FUNCTION: acpi_tb_convert_table_facs + * FUNCTION: acpi_tb_build_common_facs * * PARAMETERS: table_info - Info for currently installed FACS * @@ -530,12 +568,14 @@ acpi_tb_build_common_facs ( /* Absolute minimum length is 24, but the ACPI spec says 64 */ if (acpi_gbl_FACS->length < 24) { - ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); + ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", + acpi_gbl_FACS->length)); return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); } if (acpi_gbl_FACS->length < 64) { - ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", + ACPI_REPORT_WARNING (( + "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length)); } @@ -548,7 +588,8 @@ acpi_tb_build_common_facs ( (!(acpi_gbl_FACS->xfirmware_waking_vector))) { /* ACPI 1.0 FACS or short table or optional X_ field is zero */ - acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); + acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, + &(acpi_gbl_FACS->firmware_waking_vector)); acpi_gbl_common_fACS.vector_width = 32; } else { diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 896f3ddda62..4ab2aadc613 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -49,6 +49,19 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbget") +/* Local prototypes */ + +static acpi_status +acpi_tb_get_this_table ( + struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info); + +static acpi_status +acpi_tb_table_override ( + struct acpi_table_header *header, + struct acpi_table_desc *table_info); + /******************************************************************************* * @@ -76,9 +89,8 @@ acpi_tb_get_table ( ACPI_FUNCTION_TRACE ("tb_get_table"); - /* - * Get the header in order to get signature and table size - */ + /* Get the header in order to get signature and table size */ + status = acpi_tb_get_table_header (address, &header); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -127,8 +139,8 @@ acpi_tb_get_table_header ( /* - * Flags contains the current processor mode (Virtual or Physical addressing) - * The pointer_type is either Logical or Physical + * Flags contains the current processor mode (Virtual or Physical + * addressing) The pointer_type is either Logical or Physical */ switch (address->pointer_type) { case ACPI_PHYSMODE_PHYSPTR: @@ -136,7 +148,8 @@ acpi_tb_get_table_header ( /* Pointer matches processor mode, copy the header */ - ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); + ACPI_MEMCPY (return_header, address->pointer.logical, + sizeof (struct acpi_table_header)); break; @@ -144,10 +157,11 @@ acpi_tb_get_table_header ( /* Create a logical address for the physical pointer*/ - status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), - (void *) &header); + status = acpi_os_map_memory (address->pointer.physical, + sizeof (struct acpi_table_header), (void *) &header); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", + ACPI_REPORT_ERROR (( + "Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64 (address->pointer.physical), sizeof (struct acpi_table_header))); return_ACPI_STATUS (status); @@ -210,9 +224,8 @@ acpi_tb_get_table_body ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Attempt table override. - */ + /* Attempt table override. */ + status = acpi_tb_table_override (header, table_info); if (ACPI_SUCCESS (status)) { /* Table was overridden by the host OS */ @@ -241,7 +254,7 @@ acpi_tb_get_table_body ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_table_override ( struct acpi_table_header *header, struct acpi_table_desc *table_info) @@ -315,7 +328,7 @@ acpi_tb_table_override ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_get_this_table ( struct acpi_pointer *address, struct acpi_table_header *header, @@ -330,8 +343,8 @@ acpi_tb_get_this_table ( /* - * Flags contains the current processor mode (Virtual or Physical addressing) - * The pointer_type is either Logical or Physical + * Flags contains the current processor mode (Virtual or Physical + * addressing) The pointer_type is either Logical or Physical */ switch (address->pointer_type) { case ACPI_PHYSMODE_PHYSPTR: @@ -341,7 +354,8 @@ acpi_tb_get_this_table ( full_table = ACPI_MEM_ALLOCATE (header->length); if (!full_table) { - ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", + ACPI_REPORT_ERROR (( + "Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length)); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -362,12 +376,14 @@ acpi_tb_get_this_table ( * Just map the table's physical memory * into our address space. */ - status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, - (void *) &full_table); + status = acpi_os_map_memory (address->pointer.physical, + (acpi_size) header->length, (void *) &full_table); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", + ACPI_REPORT_ERROR (( + "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", header->signature, - ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); + ACPI_FORMAT_UINT64 (address->pointer.physical), + header->length)); return (status); } @@ -465,9 +481,8 @@ acpi_tb_get_table_ptr ( return_ACPI_STATUS (AE_OK); } - /* - * Check for instance out of range - */ + /* Check for instance out of range */ + if (instance > acpi_gbl_table_lists[table_type].count) { return_ACPI_STATUS (AE_NOT_EXIST); } diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index adc4270988b..eea5b8cb5eb 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -49,6 +49,19 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbgetall") +/* Local prototypes */ + +static acpi_status +acpi_tb_get_primary_table ( + struct acpi_pointer *address, + struct acpi_table_desc *table_info); + +static acpi_status +acpi_tb_get_secondary_table ( + struct acpi_pointer *address, + acpi_string signature, + struct acpi_table_desc *table_info); + /******************************************************************************* * @@ -63,7 +76,7 @@ * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_get_primary_table ( struct acpi_pointer *address, struct acpi_table_desc *table_info) @@ -81,9 +94,8 @@ acpi_tb_get_primary_table ( return_ACPI_STATUS (AE_OK); } - /* - * Get the header in order to get signature and table size - */ + /* Get the header in order to get signature and table size */ + status = acpi_tb_get_table_header (address, &header); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); @@ -130,7 +142,7 @@ acpi_tb_get_primary_table ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_get_secondary_table ( struct acpi_pointer *address, acpi_string signature, @@ -153,7 +165,8 @@ acpi_tb_get_secondary_table ( /* Signature must match request */ if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { - ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", + ACPI_REPORT_ERROR (( + "Incorrect table signature - wanted [%s] found [%4.4s]\n", signature, header.signature)); return_ACPI_STATUS (AE_BAD_SIGNATURE); } @@ -230,7 +243,8 @@ acpi_tb_get_required_tables ( for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { /* Get the table address from the common internal XSDT */ - address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; + address.pointer.value = + acpi_gbl_XSDT->table_offset_entry[i]; /* * Get the tables needed by this subsystem (FADT and any SSDTs). @@ -252,18 +266,18 @@ acpi_tb_get_required_tables ( } /* - * Convert the FADT to a common format. This allows earlier revisions of the - * table to coexist with newer versions, using common access code. + * Convert the FADT to a common format. This allows earlier revisions of + * the table to coexist with newer versions, using common access code. */ status = acpi_tb_convert_table_fadt (); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n")); + ACPI_REPORT_ERROR (( + "Could not convert FADT to internal common format\n")); return_ACPI_STATUS (status); } - /* - * Get the FACS (Pointed to by the FADT) - */ + /* Get the FACS (Pointed to by the FADT) */ + address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); @@ -282,9 +296,8 @@ acpi_tb_get_required_tables ( return_ACPI_STATUS (status); } - /* - * Get/install the DSDT (Pointed to by the FADT) - */ + /* Get/install the DSDT (Pointed to by the FADT) */ + address.pointer.value = acpi_gbl_FADT->Xdsdt; status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 85d5bb01022..629b64c8193 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -49,6 +49,14 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbinstal") +/* Local prototypes */ + +static acpi_status +acpi_tb_match_signature ( + char *signature, + struct acpi_table_desc *table_info, + u8 search_type); + /******************************************************************************* * @@ -56,6 +64,7 @@ * * PARAMETERS: Signature - Table signature to match * table_info - Return data + * search_type - Table type to match (primary/secondary) * * RETURN: Status * @@ -64,7 +73,7 @@ * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_match_signature ( char *signature, struct acpi_table_desc *table_info, @@ -76,9 +85,8 @@ acpi_tb_match_signature ( ACPI_FUNCTION_TRACE ("tb_match_signature"); - /* - * Search for a signature match among the known table types - */ + /* Search for a signature match among the known table types */ + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { if (!(acpi_gbl_table_data[i].flags & search_type)) { continue; @@ -161,6 +169,7 @@ acpi_tb_install_table ( * FUNCTION: acpi_tb_recognize_table * * PARAMETERS: table_info - Return value from acpi_tb_get_table_body + * search_type - Table type to match (primary/secondary) * * RETURN: Status * @@ -203,7 +212,8 @@ acpi_tb_recognize_table ( * This can be any one of many valid ACPI tables, it just isn't one of * the tables that is consumed by the core subsystem */ - status = acpi_tb_match_signature (table_header->signature, table_info, search_type); + status = acpi_tb_match_signature (table_header->signature, + table_info, search_type); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -253,9 +263,8 @@ acpi_tb_init_table_descriptor ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* - * Install the table into the global data structure - */ + /* Install the table into the global data structure */ + list_head = &acpi_gbl_table_lists[table_type]; /* @@ -316,7 +325,8 @@ acpi_tb_init_table_descriptor ( table_desc->aml_start = (u8 *) (table_desc->pointer + 1), table_desc->aml_length = (u32) (table_desc->length - (u32) sizeof (struct acpi_table_header)); - table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE); + table_desc->table_id = acpi_ut_allocate_owner_id ( + ACPI_OWNER_TYPE_TABLE); table_desc->loaded_into_namespace = FALSE; /* @@ -349,7 +359,8 @@ acpi_tb_init_table_descriptor ( ******************************************************************************/ void -acpi_tb_delete_all_tables (void) +acpi_tb_delete_all_tables ( + void) { acpi_table_type type; diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 9c6913238d5..b7ffe39c362 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -84,8 +84,9 @@ acpi_tb_verify_rsdp ( /* * Obtain access to the RSDP structure */ - status = acpi_os_map_memory (address->pointer.physical, sizeof (struct rsdp_descriptor), - (void *) &rsdp); + status = acpi_os_map_memory (address->pointer.physical, + sizeof (struct rsdp_descriptor), + (void *) &rsdp); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -154,9 +155,9 @@ cleanup: * * FUNCTION: acpi_tb_get_rsdt_address * - * PARAMETERS: None + * PARAMETERS: out_address - Where the address is returned * - * RETURN: RSDT physical address + * RETURN: None, Address * * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the * version of the RSDP @@ -181,7 +182,8 @@ acpi_tb_get_rsdt_address ( out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; } else { - out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; + out_address->pointer.value = + acpi_gbl_RSDP->xsdt_physical_address; } } @@ -224,7 +226,8 @@ acpi_tb_validate_rsdt ( if (no_match) { /* Invalid RSDT or XSDT signature */ - ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); + ACPI_REPORT_ERROR (( + "Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); @@ -282,6 +285,7 @@ acpi_tb_get_table_rsdt ( if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", acpi_format_exception (status))); + return_ACPI_STATUS (status); } @@ -299,7 +303,8 @@ acpi_tb_get_table_rsdt ( /* Get the number of tables defined in the RSDT or XSDT */ - acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); + acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, + table_info.pointer); /* Convert and/or copy to an XSDT structure */ diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index fede5804c78..e69d01d443d 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -49,48 +49,14 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbutils") +/* Local prototypes */ -/******************************************************************************* - * - * FUNCTION: acpi_tb_handle_to_object - * - * PARAMETERS: table_id - Id for which the function is searching - * table_desc - Pointer to return the matching table - * descriptor. - * - * RETURN: Search the tables to find one with a matching table_id and - * return a pointer to that table descriptor. - * - ******************************************************************************/ -#ifdef ACPI_FUTURE_USAGE +#ifdef ACPI_OBSOLETE_FUNCTIONS acpi_status acpi_tb_handle_to_object ( u16 table_id, - struct acpi_table_desc **return_table_desc) -{ - u32 i; - struct acpi_table_desc *table_desc; - - - ACPI_FUNCTION_NAME ("tb_handle_to_object"); - - - for (i = 0; i < ACPI_TABLE_MAX; i++) { - table_desc = acpi_gbl_table_lists[i].next; - while (table_desc) { - if (table_desc->table_id == table_id) { - *return_table_desc = table_desc; - return (AE_OK); - } - - table_desc = table_desc->next; - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); - return (AE_BAD_PARAMETER); -} -#endif /* ACPI_FUTURE_USAGE */ + struct acpi_table_desc **table_desc); +#endif /******************************************************************************* @@ -128,6 +94,7 @@ acpi_tb_validate_table_header ( if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Cannot read table header at %p\n", table_header)); + return (AE_BAD_ADDRESS); } @@ -141,6 +108,7 @@ acpi_tb_validate_table_header ( ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &signature)); + ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); return (AE_BAD_SIGNATURE); } @@ -154,6 +122,7 @@ acpi_tb_validate_table_header ( ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", (u32) table_header->length)); + ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); return (AE_BAD_HEADER); } @@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum ( /* Return the appropriate exception */ if (checksum) { - ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", - table_header->signature, (u32) table_header->checksum, (u32) checksum)); + ACPI_REPORT_WARNING (( + "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", + table_header->signature, (u32) table_header->checksum, + (u32) checksum)); status = AE_BAD_CHECKSUM; } @@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum ( * PARAMETERS: Buffer - Buffer to checksum * Length - Size of the buffer * - * RETURNS 8 bit checksum of buffer + * RETURN: 8 bit checksum of buffer * * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. * @@ -238,3 +209,47 @@ acpi_tb_checksum ( } +#ifdef ACPI_OBSOLETE_FUNCTIONS +/******************************************************************************* + * + * FUNCTION: acpi_tb_handle_to_object + * + * PARAMETERS: table_id - Id for which the function is searching + * table_desc - Pointer to return the matching table + * descriptor. + * + * RETURN: Search the tables to find one with a matching table_id and + * return a pointer to that table descriptor. + * + ******************************************************************************/ + +acpi_status +acpi_tb_handle_to_object ( + u16 table_id, + struct acpi_table_desc **return_table_desc) +{ + u32 i; + struct acpi_table_desc *table_desc; + + + ACPI_FUNCTION_NAME ("tb_handle_to_object"); + + + for (i = 0; i < ACPI_TABLE_MAX; i++) { + table_desc = acpi_gbl_table_lists[i].next; + while (table_desc) { + if (table_desc->table_id == table_id) { + *return_table_desc = table_desc; + return (AE_OK); + } + + table_desc = table_desc->next; + } + } + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); + return (AE_BAD_PARAMETER); +} +#endif + + diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 7715043461c..0c0b9085dbe 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -67,7 +67,8 @@ ******************************************************************************/ acpi_status -acpi_load_tables (void) +acpi_load_tables ( + void) { struct acpi_pointer rsdp_address; acpi_status status; @@ -82,7 +83,7 @@ acpi_load_tables (void) &rsdp_address); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", - acpi_format_exception (status))); + acpi_format_exception (status))); goto error_exit; } @@ -93,7 +94,7 @@ acpi_load_tables (void) status = acpi_tb_verify_rsdp (&rsdp_address); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", - acpi_format_exception (status))); + acpi_format_exception (status))); goto error_exit; } @@ -102,7 +103,7 @@ acpi_load_tables (void) status = acpi_tb_get_table_rsdt (); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", - acpi_format_exception (status))); + acpi_format_exception (status))); goto error_exit; } @@ -110,20 +111,20 @@ acpi_load_tables (void) status = acpi_tb_get_required_tables (); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", - acpi_format_exception (status))); + ACPI_REPORT_ERROR (( + "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", + acpi_format_exception (status))); goto error_exit; } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); - /* Load the namespace from the tables */ status = acpi_ns_load_namespace (); if (ACPI_FAILURE (status)) { ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", - acpi_format_exception (status))); + acpi_format_exception (status))); goto error_exit; } @@ -139,7 +140,6 @@ error_exit: #ifdef ACPI_FUTURE_USAGE - /******************************************************************************* * * FUNCTION: acpi_load_table @@ -250,7 +250,6 @@ acpi_unload_table ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Find all tables of the requested type */ table_desc = acpi_gbl_table_lists[table_type].next; @@ -321,7 +320,6 @@ acpi_get_table_header ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); @@ -329,23 +327,20 @@ acpi_get_table_header ( return_ACPI_STATUS (status); } - /* - * The function will return a NULL pointer if the table is not loaded - */ + /* The function will return a NULL pointer if the table is not loaded */ + if (tbl_ptr == NULL) { return_ACPI_STATUS (AE_NOT_EXIST); } - /* - * Copy the header to the caller's buffer - */ + /* Copy the header to the caller's buffer */ + ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, - sizeof (struct acpi_table_header)); + sizeof (struct acpi_table_header)); return_ACPI_STATUS (status); } - #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -404,7 +399,6 @@ acpi_get_table ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); @@ -423,9 +417,8 @@ acpi_get_table ( /* Get the table length */ if (table_type == ACPI_TABLE_RSDP) { - /* - * RSD PTR is the only "table" without a header - */ + /* RSD PTR is the only "table" without a header */ + table_length = sizeof (struct rsdp_descriptor); } else { diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 6e8072ebbac..dc3c3f6a9f6 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -50,6 +50,18 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbxfroot") +/* Local prototypes */ + +static acpi_status +acpi_tb_find_rsdp ( + struct acpi_table_desc *table_info, + u32 flags); + +static u8 * +acpi_tb_scan_memory_for_rsdp ( + u8 *start_address, + u32 length); + /******************************************************************************* * @@ -57,7 +69,8 @@ * * PARAMETERS: Signature - String with ACPI table signature * oem_id - String with the table OEM ID - * oem_table_id - String with the OEM Table ID. + * oem_table_id - String with the OEM Table ID + * table_ptr - Where the table pointer is returned * * RETURN: Status * @@ -99,14 +112,13 @@ acpi_tb_find_table ( if (!acpi_gbl_DSDT) { return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - table = acpi_gbl_DSDT; } else { /* Find the table */ status = acpi_get_firmware_table (signature, 1, - ACPI_LOGICAL_ADDRESSING, &table); + ACPI_LOGICAL_ADDRESSING, &table); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -114,14 +126,19 @@ acpi_tb_find_table ( /* Check oem_id and oem_table_id */ - if ((oem_id[0] && ACPI_STRNCMP ( - oem_id, table->oem_id, sizeof (table->oem_id))) || + if ((oem_id[0] && ACPI_STRNCMP ( + oem_id, table->oem_id, + sizeof (table->oem_id))) || + (oem_table_id[0] && ACPI_STRNCMP ( - oem_table_id, table->oem_table_id, sizeof (table->oem_table_id)))) { + oem_table_id, table->oem_table_id, + sizeof (table->oem_table_id)))) { return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); } - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", + table->signature)); + *table_ptr = table; return_ACPI_STATUS (AE_OK); } @@ -191,8 +208,8 @@ acpi_get_firmware_table ( /* Map and validate the RSDP */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { - status = acpi_os_map_memory (address.pointer.physical, sizeof (struct rsdp_descriptor), - (void *) &acpi_gbl_RSDP); + status = acpi_os_map_memory (address.pointer.physical, + sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -203,7 +220,8 @@ acpi_get_firmware_table ( /* The signature and checksum must both be correct */ - if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, + sizeof (RSDP_SIG)-1) != 0) { /* Nope, BAD Signature */ return_ACPI_STATUS (AE_BAD_SIGNATURE); @@ -313,7 +331,8 @@ acpi_get_firmware_table ( cleanup: - acpi_os_unmap_memory (rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); + acpi_os_unmap_memory (rsdt_info->pointer, + (acpi_size) rsdt_info->pointer->length); ACPI_MEM_FREE (rsdt_info); if (header) { @@ -335,8 +354,8 @@ EXPORT_SYMBOL(acpi_get_firmware_table); * * FUNCTION: acpi_find_root_pointer * - * PARAMETERS: **rsdp_address - Where to place the RSDP address - * Flags - Logical/Physical addressing + * PARAMETERS: Flags - Logical/Physical addressing + * rsdp_address - Where to place the RSDP address * * RETURN: Status, Physical address of the RSDP * @@ -363,6 +382,7 @@ acpi_find_root_pointer ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n", acpi_format_exception (status), flags)); + return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -385,7 +405,7 @@ acpi_find_root_pointer ( * ******************************************************************************/ -u8 * +static u8 * acpi_tb_scan_memory_for_rsdp ( u8 *start_address, u32 length) @@ -406,7 +426,8 @@ acpi_tb_scan_memory_for_rsdp ( mem_rover += ACPI_RSDP_SCAN_STEP) { /* The signature and checksum must both be correct */ - if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + if (ACPI_STRNCMP ((char *) mem_rover, + RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { /* No signature match, keep looking */ continue; @@ -450,7 +471,7 @@ acpi_tb_scan_memory_for_rsdp ( * * FUNCTION: acpi_tb_find_rsdp * - * PARAMETERS: *table_info - Where the table info is returned + * PARAMETERS: table_info - Where the table info is returned * Flags - Current memory mode (logical vs. * physical addressing) * @@ -468,7 +489,7 @@ acpi_tb_scan_memory_for_rsdp ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_tb_find_rsdp ( struct acpi_table_desc *table_info, u32 flags) @@ -483,43 +504,49 @@ acpi_tb_find_rsdp ( /* - * Scan supports either 1) Logical addressing or 2) Physical addressing + * Scan supports either logical addressing or physical addressing */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { - /* - * 1a) Get the location of the EBDA - */ - status = acpi_os_map_memory ((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH, - (void *) &table_ptr); + /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ + + status = acpi_os_map_memory ( + (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); + return_ACPI_STATUS (status); } ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); - physical_address <<= 4; /* Convert segment to physical address */ + + /* Convert segment part to physical address */ + + physical_address <<= 4; acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); /* EBDA present? */ if (physical_address > 0x400) { /* - * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) + * 1b) Search EBDA paragraphs (EBDa is required to be a + * minimum of 1_k length) */ - status = acpi_os_map_memory ((acpi_physical_address) physical_address, - ACPI_EBDA_WINDOW_SIZE, - (void *) &table_ptr); + status = acpi_os_map_memory ( + (acpi_physical_address) physical_address, + ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); + return_ACPI_STATUS (status); } - mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_EBDA_WINDOW_SIZE); + mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, + ACPI_EBDA_WINDOW_SIZE); acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { @@ -527,7 +554,8 @@ acpi_tb_find_rsdp ( physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); - table_info->physical_address = (acpi_physical_address) physical_address; + table_info->physical_address = + (acpi_physical_address) physical_address; return_ACPI_STATUS (AE_OK); } } @@ -535,13 +563,15 @@ acpi_tb_find_rsdp ( /* * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ - status = acpi_os_map_memory ((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE, - (void *) &table_ptr); + status = acpi_os_map_memory ( + (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); + if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); + return_ACPI_STATUS (status); } @@ -551,9 +581,11 @@ acpi_tb_find_rsdp ( if (mem_rover) { /* Found it, return the physical address */ - physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); + physical_address = + ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); - table_info->physical_address = (acpi_physical_address) physical_address; + table_info->physical_address = + (acpi_physical_address) physical_address; return_ACPI_STATUS (AE_OK); } } @@ -562,9 +594,8 @@ acpi_tb_find_rsdp ( * Physical addressing */ else { - /* - * 1a) Get the location of the EBDA - */ + /* 1a) Get the location of the EBDA */ + ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); physical_address <<= 4; /* Convert segment to physical address */ @@ -572,9 +603,11 @@ acpi_tb_find_rsdp ( if (physical_address > 0x400) { /* - * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) + * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of + * 1_k length) */ - mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (physical_address), + mem_rover = acpi_tb_scan_memory_for_rsdp ( + ACPI_PHYSADDR_TO_PTR (physical_address), ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Found it, return the physical address */ @@ -584,10 +617,10 @@ acpi_tb_find_rsdp ( } } - /* - * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh - */ - mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), + /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ + + mem_rover = acpi_tb_scan_memory_for_rsdp ( + ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Found it, return the physical address */ |