EmbeddedPkg/MmcDxe: Fix the indexes in the response array

The indexes have been reversed compare to the specification which
created confusions in some MMC responses.



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12132 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2011-08-15 16:20:55 +00:00
parent 36aa561136
commit bb0f9e9ba3
3 changed files with 13 additions and 14 deletions

View File

@ -210,8 +210,7 @@ MciReceiveResponse (
(Type == MMC_RESPONSE_TYPE_R3) || (Type == MMC_RESPONSE_TYPE_R6) || (Type == MMC_RESPONSE_TYPE_R3) || (Type == MMC_RESPONSE_TYPE_R6) ||
(Type == MMC_RESPONSE_TYPE_R7)) (Type == MMC_RESPONSE_TYPE_R7))
{ {
Buffer[0] = MmioRead32(MCI_RESPONSE0_REG); Buffer[0] = MmioRead32(MCI_RESPONSE3_REG);
Buffer[1] = MmioRead32(MCI_RESPONSE1_REG);
} else if (Type == MMC_RESPONSE_TYPE_R2) { } else if (Type == MMC_RESPONSE_TYPE_R2) {
Buffer[0] = MmioRead32(MCI_RESPONSE0_REG); Buffer[0] = MmioRead32(MCI_RESPONSE0_REG);
Buffer[1] = MmioRead32(MCI_RESPONSE1_REG); Buffer[1] = MmioRead32(MCI_RESPONSE1_REG);

View File

@ -36,10 +36,10 @@
#define MCI_ARGUMENT_REG (MCI_SYSCTL+0x008) #define MCI_ARGUMENT_REG (MCI_SYSCTL+0x008)
#define MCI_COMMAND_REG (MCI_SYSCTL+0x00C) #define MCI_COMMAND_REG (MCI_SYSCTL+0x00C)
#define MCI_RESPCMD_REG (MCI_SYSCTL+0x010) #define MCI_RESPCMD_REG (MCI_SYSCTL+0x010)
#define MCI_RESPONSE0_REG (MCI_SYSCTL+0x014) #define MCI_RESPONSE3_REG (MCI_SYSCTL+0x014)
#define MCI_RESPONSE1_REG (MCI_SYSCTL+0x018) #define MCI_RESPONSE2_REG (MCI_SYSCTL+0x018)
#define MCI_RESPONSE2_REG (MCI_SYSCTL+0x01C) #define MCI_RESPONSE1_REG (MCI_SYSCTL+0x01C)
#define MCI_RESPONSE3_REG (MCI_SYSCTL+0x020) #define MCI_RESPONSE0_REG (MCI_SYSCTL+0x020)
#define MCI_DATA_TIMER_REG (MCI_SYSCTL+0x024) #define MCI_DATA_TIMER_REG (MCI_SYSCTL+0x024)
#define MCI_DATA_LENGTH_REG (MCI_SYSCTL+0x028) #define MCI_DATA_LENGTH_REG (MCI_SYSCTL+0x028)
#define MCI_DATA_CTL_REG (MCI_SYSCTL+0x02C) #define MCI_DATA_CTL_REG (MCI_SYSCTL+0x02C)

View File

@ -32,15 +32,15 @@
#define MMC_OCR_POWERUP 0x80000000 #define MMC_OCR_POWERUP 0x80000000
#define MMC_CSD_GET_CCC(Response) (Response[1] >> 20) #define MMC_CSD_GET_CCC(Response) (Response[2] >> 20)
#define MMC_CSD_GET_TRANSPEED(Response) (Response[0] & 0xFF) #define MMC_CSD_GET_TRANSPEED(Response) (Response[3] & 0xFF)
#define MMC_CSD_GET_READBLLEN(Response) ((Response[1] >> 16) & 0xF) #define MMC_CSD_GET_READBLLEN(Response) ((Response[2] >> 16) & 0xF)
#define MMC_CSD_GET_WRITEBLLEN(Response) ((Response[3] >> 22) & 0xF) #define MMC_CSD_GET_WRITEBLLEN(Response) ((Response[0] >> 22) & 0xF)
#define MMC_CSD_GET_FILEFORMAT(Response) ((Response[3] >> 10) & 0x3) #define MMC_CSD_GET_FILEFORMAT(Response) ((Response[0] >> 10) & 0x3)
#define MMC_CSD_GET_FILEFORMATGRP(Response) ((Response[3] >> 15) & 0x1) #define MMC_CSD_GET_FILEFORMATGRP(Response) ((Response[0] >> 15) & 0x1)
#define MMC_CSD_GET_DEVICESIZE(csd) (((Response[2] >> 30) & 0x3) | ((Response[1] & 0x3FF) << 2)) #define MMC_CSD_GET_DEVICESIZE(csd) (((Response[1] >> 30) & 0x3) | ((Response[2] & 0x3FF) << 2))
#define HC_MMC_CSD_GET_DEVICESIZE(Response) ((Response[1] >> 16) | ((Response[2] & 0x40) << 16)); #define HC_MMC_CSD_GET_DEVICESIZE(Response) ((Response[1] >> 16) | ((Response[2] & 0x40) << 16));
#define MMC_CSD_GET_DEVICESIZEMULT(csd) ((Response[2] >> 15) & 0x7) #define MMC_CSD_GET_DEVICESIZEMULT(csd) ((Response[1] >> 15) & 0x7)
#define MMC_R0_READY_FOR_DATA (1 << 8) #define MMC_R0_READY_FOR_DATA (1 << 8)