acpi_status acpi_tb_recognize_table ( acpi_table_header *table_ptr, acpi_table_desc *table_info) { acpi_table_header *table_header; acpi_status status; acpi_table_type table_type = 0; u32 i; FUNCTION_TRACE ("Tb_recognize_table"); /* Ensure that we have a valid table pointer */ table_header = (acpi_table_header *) table_info->pointer; if (!table_header) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * Search for a signature match among the known table types * Start at index one -> Skip the RSDP */ status = AE_SUPPORT; for (i = 1; i < NUM_ACPI_TABLES; i++) { if (!STRNCMP (table_header->signature, acpi_gbl_acpi_table_data[i].signature, acpi_gbl_acpi_table_data[i].sig_length)) { /* * Found a signature match, get the pertinent info from the * Table_data structure */ table_type = i; status = acpi_gbl_acpi_table_data[i].status; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found %4.4s\n", (char*)acpi_gbl_acpi_table_data[i].signature)); break; } } /* Return the table type and length via the info struct */ table_info->type = (u8) table_type; table_info->length = table_header->length; /* * Validate checksum for _most_ tables, * even the ones whose signature we don't recognize */ if (table_type != ACPI_TABLE_FACS) { /* But don't abort if the checksum is wrong */ /* TBD: [Future] make this a configuration option? */ acpi_tb_verify_table_checksum (table_header); } /* * An AE_SUPPORT means that the table was not recognized. * We basically ignore this; just print a debug message */ if (status == AE_SUPPORT) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unsupported table %s (Type %X) was found and discarded\n", acpi_gbl_acpi_table_data[table_type].name, table_type)); } return_ACPI_STATUS (status); }
static acpi_status acpi_tb_get_this_table ( struct acpi_pointer *address, struct acpi_table_header *header, struct acpi_table_desc *table_info) { struct acpi_table_header *full_table = NULL; u8 allocation; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE ("tb_get_this_table"); /* * 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: case ACPI_LOGMODE_LOGPTR: /* Pointer matches processor mode, copy the table to a new buffer */ full_table = ACPI_MEM_ALLOCATE (header->length); if (!full_table) { ACPI_REPORT_ERROR (( "Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length)); return_ACPI_STATUS (AE_NO_MEMORY); } /* Copy the entire table (including header) to the local buffer */ ACPI_MEMCPY (full_table, address->pointer.logical, header->length); /* Save allocation type */ allocation = ACPI_MEM_ALLOCATED; break; case ACPI_LOGMODE_PHYSPTR: /* * 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); if (ACPI_FAILURE (status)) { 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)); return (status); } /* Save allocation type */ allocation = ACPI_MEM_MAPPED; break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n", address->pointer_type)); return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * Validate checksum for _most_ tables, * even the ones whose signature we don't recognize */ if (table_info->type != ACPI_TABLE_FACS) { status = acpi_tb_verify_table_checksum (full_table); #if (!ACPI_CHECKSUM_ABORT) if (ACPI_FAILURE (status)) { /* Ignore the error if configuration says so */ status = AE_OK; } #endif } /* Return values */ table_info->pointer = full_table; table_info->length = (acpi_size) header->length; table_info->allocation = allocation; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", full_table->signature, ACPI_FORMAT_UINT64 (address->pointer.physical), full_table)); return_ACPI_STATUS (status); }