\r
typedef struct {\r
EFI_PHYSICAL_ADDRESS HostAddress;\r
- EFI_PHYSICAL_ADDRESS DeviceAddress;\r
+ VOID *BufferAddress;\r
UINTN NumberOfBytes;\r
DMA_MAP_OPERATION Operation;\r
BOOLEAN DoubleBuffer;\r
((*NumberOfBytes & (mCpu->DmaBufferAlignment - 1)) != 0)) {\r
\r
// Get the cacheability of the region\r
- Status = gDS->GetMemorySpaceDescriptor (*DeviceAddress, &GcdDescriptor);\r
+ Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor);\r
if (EFI_ERROR(Status)) {\r
goto FreeMapInfo;\r
}\r
}\r
\r
*DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer);\r
+ Map->BufferAddress = Buffer;\r
} else {\r
Map->DoubleBuffer = FALSE;\r
}\r
// So duplicate the check here when running in DEBUG mode, just to assert\r
// that we are not trying to create a consistent mapping for cached memory.\r
//\r
- Status = gDS->GetMemorySpaceDescriptor (*DeviceAddress, &GcdDescriptor);\r
+ Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor);\r
ASSERT_EFI_ERROR(Status);\r
\r
ASSERT (Operation != MapOperationBusMasterCommonBuffer ||\r
DEBUG_CODE_END ();\r
\r
// Flush the Data Cache (should not have any effect if the memory region is uncached)\r
- mCpu->FlushDataCache (mCpu, *DeviceAddress, *NumberOfBytes,\r
+ mCpu->FlushDataCache (mCpu, (UINTN)HostAddress, *NumberOfBytes,\r
EfiCpuFlushTypeWriteBackInvalidate);\r
}\r
\r
Map->HostAddress = (UINTN)HostAddress;\r
- Map->DeviceAddress = *DeviceAddress;\r
Map->NumberOfBytes = *NumberOfBytes;\r
Map->Operation = Operation;\r
\r
if (Map->Operation == MapOperationBusMasterCommonBuffer) {\r
Status = EFI_INVALID_PARAMETER;\r
} else if (Map->Operation == MapOperationBusMasterWrite) {\r
- CopyMem ((VOID *)(UINTN)Map->HostAddress, (VOID *)(UINTN)Map->DeviceAddress, Map->NumberOfBytes);\r
+ CopyMem ((VOID *)(UINTN)Map->HostAddress, Map->BufferAddress,\r
+ Map->NumberOfBytes);\r
}\r
\r
- DmaFreeBuffer (EFI_SIZE_TO_PAGES (Map->NumberOfBytes), (VOID *)(UINTN)Map->DeviceAddress);\r
+ DmaFreeBuffer (EFI_SIZE_TO_PAGES (Map->NumberOfBytes), Map->BufferAddress);\r
\r
} else {\r
if (Map->Operation == MapOperationBusMasterWrite) {\r