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 <ard.biesheuvel@linaro.org>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
This commit is contained in:
Ard Biesheuvel 2016-09-05 09:51:48 +01:00
parent 4e28ea2c29
commit df0a0e4b6f
1 changed files with 20 additions and 0 deletions

View File

@ -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
//