The DmaBufferAlignment currently defaults to 4, which is dangerously
small and may result in lost data on platforms that perform non-coherent
DMA. So instead, take the CWG value from the cache info registers.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
CpuGetTimerValue,\r
CpuSetMemoryAttributes,\r
0, // NumberOfTimers\r
- 4, // DmaBufferAlignment\r
+ 2048, // DmaBufferAlignment\r
};\r
\r
+STATIC\r
+VOID\r
+InitializeDma (\r
+ IN OUT EFI_CPU_ARCH_PROTOCOL *CpuArchProtocol\r
+ )\r
+{\r
+ CpuArchProtocol->DmaBufferAlignment = ArmCacheWritebackGranule ();\r
+}\r
+\r
EFI_STATUS\r
CpuDxeInitialize (\r
IN EFI_HANDLE ImageHandle,\r
\r
InitializeExceptions (&mCpu);\r
\r
+ InitializeDma (&mCpu);\r
+\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&mCpuHandle,\r
&gEfiCpuArchProtocolGuid, &mCpu,\r