diff options
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 416953a42510..9316dfc19cea 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -433,10 +433,45 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size) } EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); +/******************************************************************************* + * + * acpi_get_table_with_size()/early_acpi_os_unmap_memory(): + * + * These 2 functions are traditionally used by Linux to map/unmap physical + * addressed ACPI tables during the early stage. + * They are deprectated now. Do not use them in the new code, but use + * acpi_get_table()/acpi_put_table() instead. + * + ******************************************************************************/ +acpi_status +acpi_get_table_with_size(char *signature, + u32 instance, struct acpi_table_header **out_table, + acpi_size *tbl_size) +{ + acpi_status status; + + status = acpi_get_table(signature, instance, out_table); + if (ACPI_SUCCESS(status)) { + /* + * "tbl_size" is no longer used by + * early_acpi_os_unmap_memory(), but is still used by the + * ACPI table drivers. So sets it to the length of the + * table when the tbl_size is requested. + * "out_table" is not sanity checked as AE_BAD_PARAMETER + * is returned if it is NULL. + */ + if (tbl_size && *out_table) + *tbl_size = (*out_table)->length; + } + + return (status); +} + +ACPI_EXPORT_SYMBOL(acpi_get_table_with_size) + void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size) { - if (!acpi_gbl_permanent_mmap) - __acpi_unmap_table(virt, size); + acpi_put_table(ACPI_CAST_PTR(struct acpi_table_header, virt)); } int acpi_os_map_generic_address(struct acpi_generic_address *gas) |