diff options
author | Bob Moore <robert.moore@intel.com> | 2009-10-21 21:11:11 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-11-05 17:01:58 -0500 |
commit | d410ee5109a1633a686a5663c6743a92e1181f9b (patch) | |
tree | 02451f4ccfd8307f41181360d55b1126eea6d1bf /drivers/acpi/acpica/exregion.c | |
parent | b419148e567728f6af0c3b01965c1cc141e3e13a (diff) |
ACPICA: avoid "Info: mapping multiple BARs. Your kernel is fine."
Ensure that memory mappings created for operation regions
do not cross page boundaries. Crossing a page boundary
while mapping regions can cause warnings if the pages have different attributes.
Such regions are probably BIOS bugs, and this is the workaround.
http://bugzilla.kernel.org/show_bug.cgi?id=14445
[Kernel summit hacking hour]
Signed-off-by: Bob Moore <robert.moore@intel.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/exregion.c')
-rw-r--r-- | drivers/acpi/acpica/exregion.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 3a54b737d2da..2bd83ac57c3a 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -77,7 +77,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
77 | void *logical_addr_ptr = NULL; | 77 | void *logical_addr_ptr = NULL; |
78 | struct acpi_mem_space_context *mem_info = region_context; | 78 | struct acpi_mem_space_context *mem_info = region_context; |
79 | u32 length; | 79 | u32 length; |
80 | acpi_size window_size; | 80 | acpi_size map_length; |
81 | acpi_size page_boundary_map_length; | ||
81 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED | 82 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
82 | u32 remainder; | 83 | u32 remainder; |
83 | #endif | 84 | #endif |
@@ -144,25 +145,39 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
144 | } | 145 | } |
145 | 146 | ||
146 | /* | 147 | /* |
147 | * Don't attempt to map memory beyond the end of the region, and | 148 | * Attempt to map from the requested address to the end of the region. |
148 | * constrain the maximum mapping size to something reasonable. | 149 | * However, we will never map more than one page, nor will we cross |
150 | * a page boundary. | ||
149 | */ | 151 | */ |
150 | window_size = (acpi_size) | 152 | map_length = (acpi_size) |
151 | ((mem_info->address + mem_info->length) - address); | 153 | ((mem_info->address + mem_info->length) - address); |
152 | 154 | ||
153 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { | 155 | /* |
154 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; | 156 | * If mapping the entire remaining portion of the region will cross |
157 | * a page boundary, just map up to the page boundary, do not cross. | ||
158 | * On some systems, crossing a page boundary while mapping regions | ||
159 | * can cause warnings if the pages have different attributes | ||
160 | * due to resource management | ||
161 | */ | ||
162 | page_boundary_map_length = | ||
163 | ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address; | ||
164 | |||
165 | if (!page_boundary_map_length) { | ||
166 | page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE; | ||
167 | } | ||
168 | |||
169 | if (map_length > page_boundary_map_length) { | ||
170 | map_length = page_boundary_map_length; | ||
155 | } | 171 | } |
156 | 172 | ||
157 | /* Create a new mapping starting at the address given */ | 173 | /* Create a new mapping starting at the address given */ |
158 | 174 | ||
159 | mem_info->mapped_logical_address = | 175 | mem_info->mapped_logical_address = acpi_os_map_memory((acpi_physical_address) address, map_length); |
160 | acpi_os_map_memory((acpi_physical_address) address, window_size); | ||
161 | if (!mem_info->mapped_logical_address) { | 176 | if (!mem_info->mapped_logical_address) { |
162 | ACPI_ERROR((AE_INFO, | 177 | ACPI_ERROR((AE_INFO, |
163 | "Could not map memory at %8.8X%8.8X, size %X", | 178 | "Could not map memory at %8.8X%8.8X, size %X", |
164 | ACPI_FORMAT_NATIVE_UINT(address), | 179 | ACPI_FORMAT_NATIVE_UINT(address), |
165 | (u32) window_size)); | 180 | (u32) map_length)); |
166 | mem_info->mapped_length = 0; | 181 | mem_info->mapped_length = 0; |
167 | return_ACPI_STATUS(AE_NO_MEMORY); | 182 | return_ACPI_STATUS(AE_NO_MEMORY); |
168 | } | 183 | } |
@@ -170,7 +185,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
170 | /* Save the physical address and mapping size */ | 185 | /* Save the physical address and mapping size */ |
171 | 186 | ||
172 | mem_info->mapped_physical_address = address; | 187 | mem_info->mapped_physical_address = address; |
173 | mem_info->mapped_length = window_size; | 188 | mem_info->mapped_length = map_length; |
174 | } | 189 | } |
175 | 190 | ||
176 | /* | 191 | /* |