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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user