Add a little more code for SD Card DMA, but make sure it is turned off until it is debugged.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10546 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish 2010-05-28 00:29:31 +00:00
parent 9e04898b6d
commit d744b79c0f
1 changed files with 37 additions and 1 deletions

View File

@ -748,6 +748,8 @@ DmaBlocks (
EFI_PHYSICAL_ADDRESS BufferAddress;
OMAP_DMA4 Dma4;
DMA_MAP_OPERATION DmaOperation;
EFI_STATUS MmcStatus;
UINTN RetryCount = 0;
CpuDeadLoop ();
// Map passed in buffer for DMA xfer
@ -834,9 +836,42 @@ CpuDeadLoop ();
return Status;
}
//Check for the Transfer completion.
while (RetryCount < MAX_RETRY_COUNT) {
//Read Status
do {
MmcStatus = MmioRead32 (MMCHS_STAT);
} while (MmcStatus == 0);
//Check if Transfer complete (TC) bit is set?
if (MmcStatus & TC) {
break;
} else {
DEBUG ((EFI_D_ERROR, "MmcStatus for TC: %x\n", MmcStatus));
//Check if DEB, DCRC or DTO interrupt occured.
if ((MmcStatus & DEB) | (MmcStatus & DCRC) | (MmcStatus & DTO)) {
//There was an error during the data transfer.
//Set SRD bit to 1 and wait until it return to 0x0.
MmioOr32 (MMCHS_SYSCTL, SRD);
while((MmioRead32 (MMCHS_SYSCTL) & SRD) != 0x0);
DisableDmaChannel (2, DMA4_CSR_BLOCK, DMA4_CSR_ERR);
DmaUnmap (BufferMap);
return EFI_DEVICE_ERROR;
}
}
RetryCount++;
}
DisableDmaChannel (2, DMA4_CSR_BLOCK, DMA4_CSR_ERR);
Status = DmaUnmap (BufferMap);
if (RetryCount == MAX_RETRY_COUNT) {
DEBUG ((EFI_D_ERROR, "TransferBlockData timed out.\n"));
return EFI_TIMEOUT;
}
return Status;
}
@ -1121,7 +1156,8 @@ SdReadWrite (
goto DoneRestoreTPL;
}
//BytesToBeTranferedThisPass = (BytesToBeTranferedThisPass >= MAX_MMCHS_TRANSFER_SIZE) ? MAX_MMCHS_TRANSFER_SIZE : BytesRemainingToBeTransfered;
// Turn OFF DMA path until it is debugged
// BytesToBeTranferedThisPass = (BytesToBeTranferedThisPass >= MAX_MMCHS_TRANSFER_SIZE) ? MAX_MMCHS_TRANSFER_SIZE : BytesRemainingToBeTransfered;
BytesToBeTranferedThisPass = This->Media->BlockSize;
BlockCount = BytesToBeTranferedThisPass/This->Media->BlockSize;