diff mbox

[edk2,4/7] MdeModulePkg/SdMmcPciHcDxe: enable 64-bit PCI DMA

Message ID 1473067049-16252-5-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit df0a0e4b6fae7cef3a652e0d52f0e6753d1f3f54
Headers show

Commit Message

Ard Biesheuvel Sept. 5, 2016, 9:17 a.m. UTC
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 <ard.biesheuvel@linaro.org>

---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index 0be081dad0bc..5de1dd6fd9e6 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;
@@ -664,6 +668,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
   //
   Status = gBS->CreateEvent (