Deleted Added
full compact
exregion.c (193529) exregion.c (199337)
1
2/******************************************************************************
3 *
4 * Module Name: exregion - ACPI default OpRegion (address space) handlers
5 *
6 *****************************************************************************/
7
8/******************************************************************************

--- 143 unchanged lines hidden (view full) ---

152 ACPI_INTEGER *Value,
153 void *HandlerContext,
154 void *RegionContext)
155{
156 ACPI_STATUS Status = AE_OK;
157 void *LogicalAddrPtr = NULL;
158 ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
159 UINT32 Length;
1
2/******************************************************************************
3 *
4 * Module Name: exregion - ACPI default OpRegion (address space) handlers
5 *
6 *****************************************************************************/
7
8/******************************************************************************

--- 143 unchanged lines hidden (view full) ---

152 ACPI_INTEGER *Value,
153 void *HandlerContext,
154 void *RegionContext)
155{
156 ACPI_STATUS Status = AE_OK;
157 void *LogicalAddrPtr = NULL;
158 ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
159 UINT32 Length;
160 ACPI_SIZE WindowSize;
160 ACPI_SIZE MapLength;
161 ACPI_SIZE PageBoundaryMapLength;
161#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
162 UINT32 Remainder;
163#endif
164
165
166 ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
167
168

--- 53 unchanged lines hidden (view full) ---

222 {
223 /* Valid mapping, delete it */
224
225 AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
226 MemInfo->MappedLength);
227 }
228
229 /*
162#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
163 UINT32 Remainder;
164#endif
165
166
167 ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
168
169

--- 53 unchanged lines hidden (view full) ---

223 {
224 /* Valid mapping, delete it */
225
226 AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
227 MemInfo->MappedLength);
228 }
229
230 /*
230 * Don't attempt to map memory beyond the end of the region, and
231 * constrain the maximum mapping size to something reasonable.
231 * October 2009: Attempt to map from the requested address to the
232 * end of the region. However, we will never map more than one
233 * page, nor will we cross a page boundary.
232 */
234 */
233 WindowSize = (ACPI_SIZE)
235 MapLength = (ACPI_SIZE)
234 ((MemInfo->Address + MemInfo->Length) - Address);
235
236 ((MemInfo->Address + MemInfo->Length) - Address);
237
236 if (WindowSize > ACPI_SYSMEM_REGION_WINDOW_SIZE)
238 /*
239 * If mapping the entire remaining portion of the region will cross
240 * a page boundary, just map up to the page boundary, do not cross.
241 * On some systems, crossing a page boundary while mapping regions
242 * can cause warnings if the pages have different attributes
243 * due to resource management.
244 *
245 * This has the added benefit of constraining a single mapping to
246 * one page, which is similar to the original code that used a 4k
247 * maximum window.
248 */
249 PageBoundaryMapLength =
250 ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address;
251 if (PageBoundaryMapLength == 0)
237 {
252 {
238 WindowSize = ACPI_SYSMEM_REGION_WINDOW_SIZE;
253 PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE;
239 }
240
254 }
255
256 if (MapLength > PageBoundaryMapLength)
257 {
258 MapLength = PageBoundaryMapLength;
259 }
260
241 /* Create a new mapping starting at the address given */
242
243 MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
261 /* Create a new mapping starting at the address given */
262
263 MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
244 (ACPI_PHYSICAL_ADDRESS) Address, WindowSize);
264 (ACPI_PHYSICAL_ADDRESS) Address, MapLength);
245 if (!MemInfo->MappedLogicalAddress)
246 {
247 ACPI_ERROR ((AE_INFO,
248 "Could not map memory at %8.8X%8.8X, size %X",
265 if (!MemInfo->MappedLogicalAddress)
266 {
267 ACPI_ERROR ((AE_INFO,
268 "Could not map memory at %8.8X%8.8X, size %X",
249 ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize));
269 ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
250 MemInfo->MappedLength = 0;
251 return_ACPI_STATUS (AE_NO_MEMORY);
252 }
253
254 /* Save the physical address and mapping size */
255
256 MemInfo->MappedPhysicalAddress = Address;
270 MemInfo->MappedLength = 0;
271 return_ACPI_STATUS (AE_NO_MEMORY);
272 }
273
274 /* Save the physical address and mapping size */
275
276 MemInfo->MappedPhysicalAddress = Address;
257 MemInfo->MappedLength = WindowSize;
277 MemInfo->MappedLength = MapLength;
258 }
259
260 /*
261 * Generate a logical pointer corresponding to the address we want to
262 * access
263 */
264 LogicalAddrPtr = MemInfo->MappedLogicalAddress +
265 ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);

--- 345 unchanged lines hidden ---
278 }
279
280 /*
281 * Generate a logical pointer corresponding to the address we want to
282 * access
283 */
284 LogicalAddrPtr = MemInfo->MappedLogicalAddress +
285 ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);

--- 345 unchanged lines hidden ---