mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
ArmPkg/CpuDxe: set DmaBufferAlignment according to CWG
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>
This commit is contained in:
parent
a8f37449c7
commit
756a514aa4
@ -225,9 +225,18 @@ EFI_CPU_ARCH_PROTOCOL mCpu = {
|
|||||||
CpuGetTimerValue,
|
CpuGetTimerValue,
|
||||||
CpuSetMemoryAttributes,
|
CpuSetMemoryAttributes,
|
||||||
0, // NumberOfTimers
|
0, // NumberOfTimers
|
||||||
4, // DmaBufferAlignment
|
2048, // DmaBufferAlignment
|
||||||
};
|
};
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
InitializeDma (
|
||||||
|
IN OUT EFI_CPU_ARCH_PROTOCOL *CpuArchProtocol
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CpuArchProtocol->DmaBufferAlignment = ArmCacheWritebackGranule ();
|
||||||
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
CpuDxeInitialize (
|
CpuDxeInitialize (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
@ -239,6 +248,8 @@ CpuDxeInitialize (
|
|||||||
|
|
||||||
InitializeExceptions (&mCpu);
|
InitializeExceptions (&mCpu);
|
||||||
|
|
||||||
|
InitializeDma (&mCpu);
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&mCpuHandle,
|
&mCpuHandle,
|
||||||
&gEfiCpuArchProtocolGuid, &mCpu,
|
&gEfiCpuArchProtocolGuid, &mCpu,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user