@@ -479,6 +479,8 @@ void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
u8 acpi_is_valid_space_id(u8 space_id);
+void acpi_ex_unmap_region_memory(struct acpi_mem_space_context *mem_info);
+
/*
* exregion - default op_region handlers
*/
@@ -768,6 +768,8 @@ acpi_db_test_field_unit_type(union acpi_operand_object *obj_desc)
acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
+ acpi_release_unused_memory_mappings();
+
bit_length = obj_desc->common_field.bit_length;
byte_length = ACPI_ROUND_BITS_UP_TO_BYTES(bit_length);
@@ -49,10 +49,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
/* Delete a cached mapping if present */
if (local_region_context->mapped_length) {
- acpi_os_unmap_memory(local_region_context->
- mapped_logical_address,
- local_region_context->
- mapped_length);
+ acpi_ex_unmap_region_memory(local_region_context);
}
ACPI_FREE(local_region_context);
*region_context = NULL;
@@ -14,6 +14,32 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exregion")
+/*****************************************************************************
+ *
+ * FUNCTION: acpi_ex_unmap_region_memory
+ *
+ * PARAMETERS: mem_info - Region specific context
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Unmap memory associated with a memory operation region.
+ *
+ ****************************************************************************/
+void acpi_ex_unmap_region_memory(struct acpi_mem_space_context *mem_info)
+{
+ ACPI_FUNCTION_TRACE(acpi_ex_unmap_region_memory);
+
+#ifdef ACPI_USE_DEFERRED_UNMAPPING
+ acpi_os_unmap_deferred(mem_info->mapped_logical_address,
+ mem_info->mapped_length);
+#else
+ acpi_os_unmap_memory(mem_info->mapped_logical_address,
+ mem_info->mapped_length);
+#endif
+
+ return_VOID;
+}
+
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_memory_space_handler
@@ -108,8 +134,7 @@ acpi_ex_system_memory_space_handler(u32 function,
/* Valid mapping, delete it */
- acpi_os_unmap_memory(mem_info->mapped_logical_address,
- mem_info->mapped_length);
+ acpi_ex_unmap_region_memory(mem_info);
}
/*
@@ -106,6 +106,8 @@ void acpi_ex_exit_interpreter(void)
"Could not release AML Interpreter mutex"));
}
+ acpi_release_unused_memory_mappings();
+
return_VOID;
}
@@ -244,6 +244,30 @@ acpi_status acpi_purge_cached_objects(void)
ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
+/*****************************************************************************
+ *
+ * FUNCTION: acpi_release_unused_memory_mappings
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Remove memory mappings that are not used any more.
+ *
+ ****************************************************************************/
+void acpi_release_unused_memory_mappings(void)
+{
+ ACPI_FUNCTION_TRACE(acpi_release_unused_memory_mappings);
+
+#ifdef ACPI_USE_DEFERRED_UNMAPPING
+ acpi_os_release_unused_mappings();
+#endif
+
+ return_VOID;
+}
+
+ACPI_EXPORT_SYMBOL(acpi_release_unused_memory_mappings)
+
/*****************************************************************************
*
* FUNCTION: acpi_install_interface
@@ -449,6 +449,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_size length,
struct acpi_pld_info
**return_buffer))
+ACPI_EXTERNAL_RETURN_VOID(void acpi_release_unused_memory_mappings(void))
/*
* ACPI table load/unload interfaces