} else {\r
Map->DoubleBuffer = FALSE;\r
\r
+ DEBUG_CODE_BEGIN ();\r
+\r
+ //\r
+ // The operation type check above only executes if the buffer happens to be\r
+ // misaligned with respect to CWG, but even if it is aligned, we should not\r
+ // allow arbitrary buffers to be used for creating consistent mappings.\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
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ ASSERT (Operation != MapOperationBusMasterCommonBuffer ||\r
+ (GcdDescriptor.Attributes & (EFI_MEMORY_WB | EFI_MEMORY_WT)) == 0);\r
+\r
+ DEBUG_CODE_END ();\r
+\r
// Flush the Data Cache (should not have any effect if the memory region is uncached)\r
gCpu->FlushDataCache (gCpu, *DeviceAddress, *NumberOfBytes, EfiCpuFlushTypeWriteBackInvalidate);\r
}\r