From df0a0e4b6fae7cef3a652e0d52f0e6753d1f3f54 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 5 Sep 2016 09:51:48 +0100 Subject: [PATCH] MdeModulePkg/SdMmcPciHcDxe: enable 64-bit PCI DMA PCI controller drivers must set the EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE attribute if the controller supports 64-bit DMA addressing. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Feng Tian --- .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 0be081dad0..5de1dd6fd9 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -527,6 +527,7 @@ SdMmcPciHcDriverBindingStart ( CARD_TYPE_DETECT_ROUTINE *Routine; UINT32 RoutineNum; BOOLEAN MediaPresent; + BOOLEAN Support64BitDma; DEBUG ((EFI_D_INFO, "SdMmcPciHcDriverBindingStart: Start\n")); @@ -600,6 +601,7 @@ SdMmcPciHcDriverBindingStart ( goto Done; } + Support64BitDma = TRUE; for (Slot = FirstBar; Slot < (FirstBar + SlotNum); Slot++) { Private->Slot[Slot].Enable = TRUE; @@ -609,6 +611,8 @@ SdMmcPciHcDriverBindingStart ( } DumpCapabilityReg (Slot, &Private->Capability[Slot]); + Support64BitDma &= Private->Capability[Slot].SysBus64; + Status = SdMmcHcGetMaxCurrent (PciIo, Slot, &Private->MaxCurrent[Slot]); if (EFI_ERROR (Status)) { continue; @@ -663,6 +667,22 @@ SdMmcPciHcDriverBindingStart ( } } + // + // Enable 64-bit DMA support in the PCI layer if this controller + // supports it. + // + if (Support64BitDma) { + Status = PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationEnable, + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "SdMmcPciHcDriverBindingStart: failed to enable 64-bit DMA (%r)\n", Status)); + } + } + // // Start the asynchronous I/O monitor // -- 2.39.5