MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA

Add support for non-coherent DMA, either by performing explicit cache
maintenance when DMA mappings are aligned to the CPU's DMA buffer alignment,
or by bounce buffering via uncached mappings otherwise.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Ard Biesheuvel
2016-12-09 15:04:34 +00:00
parent aaa61995af
commit 16296a126c
4 changed files with 367 additions and 7 deletions

View File

@@ -16,6 +16,8 @@
#include <Protocol/DriverBinding.h>
EFI_CPU_ARCH_PROTOCOL *mCpu;
//
// We only support the following device types
//
@@ -69,14 +71,7 @@ NonDiscoverablePciDeviceSupported (
return Status;
}
//
// Restricted to DMA coherent for now
//
Status = EFI_UNSUPPORTED;
if (Device->DmaType != NonDiscoverableDeviceDmaTypeCoherent) {
goto CloseProtocol;
}
for (Idx = 0; Idx < ARRAY_SIZE (SupportedNonDiscoverableDevices); Idx++) {
if (CompareGuid (Device->Type, SupportedNonDiscoverableDevices [Idx])) {
Status = EFI_SUCCESS;
@@ -224,6 +219,11 @@ NonDiscoverablePciDeviceDxeEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);
ASSERT_EFI_ERROR(Status);
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,