/****************************************************************************** * * FUNCTION: acpi_tb_verify_table * * PARAMETERS: table_desc - table * * RETURN: Status * * DESCRIPTION: this function is called to verify and map table * *****************************************************************************/ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(tb_verify_table); /* Map the table if necessary */ if (!table_desc->pointer) { if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { table_desc->pointer = acpi_os_map_memory(table_desc->address, table_desc->length); } if (!table_desc->pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } } /* FACS is the odd table, has no standard ACPI header and no checksum */ if (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_FACS)) { /* Always calculate checksum, ignore bad checksum if requested */ status = acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); } return_ACPI_STATUS(status); }
acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(tb_verify_table); if (!table_desc->pointer) { if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { table_desc->pointer = acpi_os_map_memory(table_desc->address, table_desc->length); } if (!table_desc->pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } } if (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_FACS)) { status = acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); } return_ACPI_STATUS(status); }
void acpi_tb_parse_fadt(u32 table_index) { u32 length; struct acpi_table_header *table; length = acpi_gbl_root_table_list.tables[table_index].length; table = acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. address, length); if (!table) { return; } (void)acpi_tb_verify_checksum(table, length); acpi_tb_create_local_fadt(table, length); acpi_os_unmap_memory(table, length); acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); }
/****************************************************************************** * * FUNCTION: acpi_tb_verify_table * * PARAMETERS: table_desc - table * * RETURN: Status * * DESCRIPTION: this function is called to verify and map table * *****************************************************************************/ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(tb_verify_table); /* Map the table if necessary */ if (!table_desc->pointer) { if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { table_desc->pointer = acpi_os_map_memory(table_desc->address, table_desc->length); } if (!table_desc->pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } } /* Always calculate checksum, ignore bad checksum if requested */ status = acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); return_ACPI_STATUS(status); }
void acpi_tb_parse_fadt(u32 table_index) { u32 length; struct acpi_table_header *table; /* * The FADT has multiple versions with different lengths, * and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page. */ length = acpi_gbl_root_table_list.tables[table_index].length; table = acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. address, length); if (!table) { return; } /* * Validate the FADT checksum before we copy the table. Ignore * checksum error as we want to try to get the DSDT and FACS. */ (void)acpi_tb_verify_checksum(table, length); /* Create a local copy of the FADT in common ACPI 2.0+ format */ acpi_tb_create_local_fadt(table, length); /* All done with the real FADT, unmap it */ acpi_os_unmap_memory(table, length); /* Obtain the DSDT and FACS tables via their addresses within the FADT */ acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, ACPI_SIG_DSDT, &acpi_gbl_dsdt_index); /* If Hardware Reduced flag is set, there is no FACS */ if (!acpi_gbl_reduced_hardware) { if (acpi_gbl_FADT.facs) { acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.facs, ACPI_SIG_FACS, &acpi_gbl_facs_index); } if (acpi_gbl_FADT.Xfacs) { acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS, &acpi_gbl_xfacs_index); } } }
acpi_status acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(tb_verify_temp_table); /* Validate the table */ status = acpi_tb_validate_temp_table(table_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(AE_NO_MEMORY); } /* If a particular signature is expected (DSDT/FACS), it must match */ if (signature && !ACPI_COMPARE_NAME(&table_desc->signature, signature)) { ACPI_BIOS_ERROR((AE_INFO, "Invalid signature 0x%X for ACPI table, expected [%s]", table_desc->signature.integer, signature)); status = AE_BAD_SIGNATURE; goto invalidate_and_exit; } /* Verify the checksum */ if (acpi_gbl_verify_table_checksum) { status = acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", acpi_ut_valid_nameseg(table_desc-> signature. ascii) ? table_desc->signature.ascii : "????", ACPI_FORMAT_UINT64(table_desc-> address))); goto invalidate_and_exit; } } return_ACPI_STATUS(AE_OK); invalidate_and_exit: acpi_tb_invalidate_table(table_desc); return_ACPI_STATUS(status); }
void __init acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) { u32 length; struct acpi_table_header *table; /* * The FADT has multiple versions with different lengths, * and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page. */ length = acpi_gbl_root_table_list.tables[table_index].length; table = acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. address, length); if (!table) { return; } /* * Validate the FADT checksum before we copy the table. Ignore * checksum error as we want to try to get the DSDT and FACS. */ (void)acpi_tb_verify_checksum(table, length); /* Obtain a local copy of the FADT in common ACPI 2.0+ format */ acpi_tb_create_local_fadt(table, length); /* All done with the real FADT, unmap it */ acpi_os_unmap_memory(table, length); /* Obtain the DSDT and FACS tables via their addresses within the FADT */ acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); }
void acpi_tb_parse_fadt(void) { u32 length; struct acpi_table_header *table; struct acpi_table_desc *fadt_desc; acpi_status status; /* * The FADT has multiple versions with different lengths, * and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page. */ fadt_desc = &acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index]; status = acpi_tb_get_table(fadt_desc, &table); if (ACPI_FAILURE(status)) { return; } length = fadt_desc->length; /* * Validate the FADT checksum before we copy the table. Ignore * checksum error as we want to try to get the DSDT and FACS. */ (void)acpi_tb_verify_checksum(table, length); /* Create a local copy of the FADT in common ACPI 2.0+ format */ acpi_tb_create_local_fadt(table, length); /* All done with the real FADT, unmap it */ acpi_tb_put_table(fadt_desc); /* Obtain the DSDT and FACS tables via their addresses within the FADT */ acpi_tb_install_standard_table((acpi_physical_address)acpi_gbl_FADT. Xdsdt, ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &acpi_gbl_dsdt_index); /* If Hardware Reduced flag is set, there is no FACS */ if (!acpi_gbl_reduced_hardware) { if (acpi_gbl_FADT.facs) { acpi_tb_install_standard_table((acpi_physical_address) acpi_gbl_FADT.facs, ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &acpi_gbl_facs_index); } if (acpi_gbl_FADT.Xfacs) { acpi_tb_install_standard_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &acpi_gbl_xfacs_index); } } }