diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-01 17:08:41 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-01 17:08:41 +0000 |
commit | 16d88c2d20ccd9f8ea52967b578ece82174ea762 (patch) | |
tree | 396c179773cb020167359aee051b6831a03d2f47 | |
parent | 66f47f9fc00e3770d0502305387389c91e2025de (diff) | |
download | edk2-16d88c2d20ccd9f8ea52967b578ece82174ea762.tar.gz edk2-16d88c2d20ccd9f8ea52967b578ece82174ea762.tar.bz2 edk2-16d88c2d20ccd9f8ea52967b578ece82174ea762.zip |
EmbeddedPkg/MmcDxe: Add 'This' pointer attribute to protocol function
This attribute allows the EFI_MMC_HOST_PROTOCOL interface to manage
multiple instances in one driver.
EmbeddedPkg/MmcDxe: Add Revision attribute to the EFI_MMC_HOST_PROTOCOL
Note: The ARM PL180 and Omap35xx MMC host drivers has been updated.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12255 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c | 45 | ||||
-rw-r--r-- | EmbeddedPkg/Include/Protocol/MmcHost.h | 81 | ||||
-rw-r--r-- | EmbeddedPkg/Universal/MmcDxe/Mmc.c | 8 | ||||
-rw-r--r-- | EmbeddedPkg/Universal/MmcDxe/Mmc.h | 2 | ||||
-rw-r--r-- | EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 68 | ||||
-rwxr-xr-x | Omap35xxPkg/MmcHostDxe/MmcHostDxe.c | 35 |
6 files changed, 146 insertions, 93 deletions
diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c index 03500af88c..b79845dccb 100644 --- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c +++ b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c @@ -46,7 +46,7 @@ MciInitialize ( BOOLEAN
MciIsCardPresent (
- VOID
+ IN EFI_MMC_HOST_PROTOCOL *This
)
{
return (MmioRead32(FixedPcdGet32(PcdPL180SysMciRegAddress)) & 1);
@@ -54,7 +54,7 @@ MciIsCardPresent ( BOOLEAN
MciIsReadOnly (
- VOID
+ IN EFI_MMC_HOST_PROTOCOL *This
)
{
return (MmioRead32(FixedPcdGet32(PcdPL180SysMciRegAddress)) & 2);
@@ -92,22 +92,23 @@ MciPrepareDataPath ( )
{
// Set Data Length & Data Timer
- MmioWrite32(MCI_DATA_TIMER_REG,0xFFFFFFF);
- MmioWrite32(MCI_DATA_LENGTH_REG,MMCI0_BLOCKLEN);
+ MmioWrite32 (MCI_DATA_TIMER_REG,0xFFFFFFF);
+ MmioWrite32 (MCI_DATA_LENGTH_REG,MMCI0_BLOCKLEN);
#ifndef USE_STREAM
//Note: we are using a hardcoded BlockLen (=512). If we decide to use a variable size, we could
// compute the pow2 of BlockLen with the above function GetPow2BlockLen()
- MmioWrite32(MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | (MMCI0_POW2_BLOCKLEN << 4));
+ MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | (MMCI0_POW2_BLOCKLEN << 4));
#else
- MmioWrite32(MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | MCI_DATACTL_STREAM_TRANS);
+ MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | MCI_DATACTL_STREAM_TRANS);
#endif
}
EFI_STATUS
MciSendCommand (
- IN MMC_CMD MmcCmd,
- IN UINT32 Argument
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_CMD MmcCmd,
+ IN UINT32 Argument
)
{
UINT32 Status;
@@ -190,7 +191,7 @@ MciSendCommand ( }
Exit:
- //Disable Command Path
+ // Disable Command Path
CmdCtrlReg = MmioRead32(MCI_COMMAND_REG);
MmioWrite32(MCI_COMMAND_REG, (CmdCtrlReg & ~MCI_CPSM_ENABLED));
return RetVal;
@@ -198,8 +199,9 @@ Exit: EFI_STATUS
MciReceiveResponse (
- IN MMC_RESPONSE_TYPE Type,
- IN UINT32* Buffer
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_RESPONSE_TYPE Type,
+ IN UINT32* Buffer
)
{
if (Buffer == NULL) {
@@ -223,9 +225,10 @@ MciReceiveResponse ( EFI_STATUS
MciReadBlockData (
- IN EFI_LBA Lba,
- IN UINTN Length,
- IN UINT32* Buffer
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ IN UINT32* Buffer
)
{
UINTN Loop;
@@ -298,9 +301,10 @@ MciReadBlockData ( EFI_STATUS
MciWriteBlockData (
- IN EFI_LBA Lba,
- IN UINTN Length,
- IN UINT32* Buffer
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ IN UINT32* Buffer
)
{
UINTN Loop;
@@ -396,7 +400,8 @@ Exit: EFI_STATUS
MciNotifyState (
- IN MMC_STATE State
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_STATE State
)
{
UINT32 Data32;
@@ -490,7 +495,8 @@ EFI_GUID mPL180MciDevicePathGuid = EFI_CALLER_ID_GUID; EFI_STATUS
MciBuildDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
@@ -503,6 +509,7 @@ MciBuildDevicePath ( }
EFI_MMC_HOST_PROTOCOL gMciHost = {
+ MMC_HOST_PROTOCOL_REVISION,
MciIsCardPresent,
MciIsReadOnly,
MciBuildDevicePath,
diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h b/EmbeddedPkg/Include/Protocol/MmcHost.h index 0196aad2ae..21112cc3dd 100644 --- a/EmbeddedPkg/Include/Protocol/MmcHost.h +++ b/EmbeddedPkg/Include/Protocol/MmcHost.h @@ -78,36 +78,75 @@ typedef enum _MMC_STATE { MmcDisconnectState,
} MMC_STATE;
-typedef BOOLEAN (*MMC_ISCARDPRESENT)();
-
-typedef BOOLEAN (*MMC_ISREADONLY)();
-
-typedef EFI_STATUS (*MMC_BUILDDEVICEPATH)(EFI_DEVICE_PATH_PROTOCOL **DevicePath);
-
-typedef EFI_STATUS (*MMC_NOTIFYSTATE)(MMC_STATE State);
-
-typedef EFI_STATUS (*MMC_SENDCOMMAND)(MMC_CMD Cmd, UINT32 Argument);
+///
+/// Forward declaration for EFI_MMC_HOST_PROTOCOL
+///
+typedef struct _EFI_MMC_HOST_PROTOCOL EFI_MMC_HOST_PROTOCOL;
+
+typedef BOOLEAN (EFIAPI *MMC_ISCARDPRESENT) (
+ IN EFI_MMC_HOST_PROTOCOL *This
+ );
+
+typedef BOOLEAN (EFIAPI *MMC_ISREADONLY) (
+ IN EFI_MMC_HOST_PROTOCOL *This
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_BUILDDEVICEPATH) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_NOTIFYSTATE) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_STATE State
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_SENDCOMMAND) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_CMD Cmd,
+ IN UINT32 Argument
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_RECEIVERESPONSE) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_RESPONSE_TYPE Type,
+ IN UINT32 *Buffer
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_READBLOCKDATA) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_WRITEBLOCKDATA) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ IN UINT32 *Buffer
+ );
-typedef EFI_STATUS (*MMC_RECEIVERESPONSE)(MMC_RESPONSE_TYPE Type, UINT32* Buffer);
-typedef EFI_STATUS (*MMC_READBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);
+typedef struct _EFI_MMC_HOST_PROTOCOL {
-typedef EFI_STATUS (*MMC_WRITEBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);
+ UINT32 Revision;
+ MMC_ISCARDPRESENT IsCardPresent;
+ MMC_ISREADONLY IsReadOnly;
+ MMC_BUILDDEVICEPATH BuildDevicePath;
-typedef struct _EFI_MMC_HOST_PROTOCOL {
- MMC_ISCARDPRESENT IsCardPresent;
- MMC_ISREADONLY IsReadOnly;
- MMC_BUILDDEVICEPATH BuildDevicePath;
+ MMC_NOTIFYSTATE NotifyState;
- MMC_NOTIFYSTATE NotifyState;
+ MMC_SENDCOMMAND SendCommand;
+ MMC_RECEIVERESPONSE ReceiveResponse;
- MMC_SENDCOMMAND SendCommand;
- MMC_RECEIVERESPONSE ReceiveResponse;
+ MMC_READBLOCKDATA ReadBlockData;
+ MMC_WRITEBLOCKDATA WriteBlockData;
- MMC_READBLOCKDATA ReadBlockData;
- MMC_WRITEBLOCKDATA WriteBlockData;
} EFI_MMC_HOST_PROTOCOL;
+#define MMC_HOST_PROTOCOL_REVISION 0x00010001 // 1.1
+
extern EFI_GUID gEfiMmcHostProtocolGuid;
#endif
diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.c b/EmbeddedPkg/Universal/MmcDxe/Mmc.c index 48d32513d4..b4f7a78a55 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.c +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.c @@ -116,7 +116,7 @@ MMC_HOST_INSTANCE* CreateMmcHostInstance ( MmcHostInstance->MmcHost = MmcHost;
// Create DevicePath for the new MMC Host
- Status = MmcHost->BuildDevicePath(&NewDevicePathNode);
+ Status = MmcHost->BuildDevicePath (MmcHost, &NewDevicePathNode);
if (EFI_ERROR (Status)) {
goto FREE_MEDIA;
}
@@ -364,13 +364,13 @@ CheckCardsCallback ( MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);
ASSERT(MmcHostInstance != NULL);
- if (MmcHostInstance->MmcHost->IsCardPresent() == !MmcHostInstance->Initialized) {
+ if (MmcHostInstance->MmcHost->IsCardPresent (MmcHostInstance->MmcHost) == !MmcHostInstance->Initialized) {
MmcHostInstance->State = MmcHwInitializationState;
MmcHostInstance->BlockIo.Media->MediaPresent = !MmcHostInstance->Initialized;
MmcHostInstance->Initialized = !MmcHostInstance->Initialized;
- if(MmcHostInstance->BlockIo.Media->MediaPresent) {
- InitializeMmcDevice(MmcHostInstance);
+ if (MmcHostInstance->BlockIo.Media->MediaPresent) {
+ InitializeMmcDevice (MmcHostInstance);
}
Status = gBS->ReinstallProtocolInterface (
diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h index f3b9029573..c7e8c7e9fa 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h @@ -288,7 +288,7 @@ MmcFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This
);
-EFI_STATUS InitializeMmcDevice(
+EFI_STATUS InitializeMmcDevice (
IN MMC_HOST_INSTANCE *MmcHost
);
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c index c12411c152..47f4aebcdf 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c @@ -32,7 +32,7 @@ MmcNotifyState ( )
{
MmcHostInstance->State = State;
- return MmcHostInstance->MmcHost->NotifyState(State);
+ return MmcHostInstance->MmcHost->NotifyState (MmcHostInstance->MmcHost, State);
}
VOID
@@ -169,14 +169,14 @@ MmcGetCardStatus( if(MmcHostInstance->State != MmcHwInitializationState){
//Get the Status of the card.
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
- Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
PrintResponseR1(Response[0]);
}
@@ -214,7 +214,7 @@ MmcIdentificationMode ( }
} else {
//Note: Could even be used in all cases. But it looks this command could put the state machine into inactive for some cards
- Status = MmcHost->SendCommand(MMC_CMD0, 0);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD0, 0);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));
return Status;
@@ -228,7 +228,7 @@ MmcIdentificationMode ( }
// Are we using SDIO ?
- Status = MmcHost->SendCommand(MMC_CMD5, 0);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD5, 0);
if (Status == EFI_SUCCESS) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));
return EFI_UNSUPPORTED;
@@ -236,11 +236,11 @@ MmcIdentificationMode ( // Check which kind of card we are using. Ver2.00 or later SD Memory Card (PL180 is SD v1.1)
CmdArg = (0x0UL << 12 | BIT8 | 0xCEUL << 0);
- Status = MmcHost->SendCommand(MMC_CMD8, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD8, CmdArg);
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));
IsHCS = TRUE;
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R7,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7,Response);
PrintResponseR1(Response[0]);
//check if it is valid response
if(Response[0] != CmdArg){
@@ -255,7 +255,7 @@ MmcIdentificationMode ( Timeout = MAX_RETRY_COUNT;
while (Timeout > 0) {
// SD Card or MMC Card ? CMD55 indicates to the card that the next command is an application specific command
- Status = MmcHost->SendCommand(MMC_CMD55, 0);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD55, 0);
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_INFO, "Card should be SD\n"));
if (IsHCS) {
@@ -269,18 +269,18 @@ MmcIdentificationMode ( if (IsHCS) {
CmdArg |= BIT30;
}
- Status = MmcHost->SendCommand(MMC_ACMD41, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_ACMD41, CmdArg);
if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
} else {
DEBUG ((EFI_D_INFO, "Card should be MMC\n"));
MmcHostInstance->CardInfo.CardType = MMC_CARD;
- Status = MmcHost->SendCommand(MMC_CMD1, 0x800000);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 0x800000);
if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
}
@@ -315,12 +315,12 @@ MmcIdentificationMode ( return Status;
}
- Status = MmcHost->SendCommand(MMC_CMD2, 0);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD2, 0);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CID,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID,Response);
PrintCID(Response);
Status = MmcNotifyState (MmcHostInstance, MmcIdentificationState);
@@ -335,13 +335,13 @@ MmcIdentificationMode ( // The status returned for this CMD3 will be 2 - identification
//
CmdArg = 1;
- Status = MmcHost->SendCommand(MMC_CMD3, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD3, CmdArg);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA,Response);
PrintRCA(Response[0]);
// For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card
@@ -360,7 +360,7 @@ MmcIdentificationMode ( return EFI_SUCCESS;
}
-EFI_STATUS InitializeMmcDevice(
+EFI_STATUS InitializeMmcDevice (
IN MMC_HOST_INSTANCE *MmcHostInstance
)
{
@@ -376,13 +376,13 @@ EFI_STATUS InitializeMmcDevice( //Send a command to get Card specific data
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
- Status = MmcHost->SendCommand(MMC_CMD9, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD9, CmdArg);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CSD,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD,Response);
PrintCSD(Response);
if (MmcHostInstance->CardInfo.CardType == SD_CARD_2_HIGH) {
@@ -403,12 +403,12 @@ EFI_STATUS InitializeMmcDevice( MmcHostInstance->BlockIo.Media->LastBlock = (NumBlocks - 1);
MmcHostInstance->BlockIo.Media->BlockSize = BlockSize;
- MmcHostInstance->BlockIo.Media->ReadOnly = MmcHost->IsReadOnly();
+ MmcHostInstance->BlockIo.Media->ReadOnly = MmcHost->IsReadOnly (MmcHost);
MmcHostInstance->BlockIo.Media->MediaPresent = TRUE;
MmcHostInstance->BlockIo.Media->MediaId++;
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
- Status = MmcHost->SendCommand(MMC_CMD7, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));
return Status;
@@ -421,7 +421,7 @@ EFI_STATUS InitializeMmcDevice( }
// Set Block Length
- Status = MmcHost->SendCommand(MMC_CMD16, MmcHostInstance->BlockIo.Media->BlockSize);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD16, MmcHostInstance->BlockIo.Media->BlockSize);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n",MmcHostInstance->BlockIo.Media->BlockSize, Status));
return Status;
@@ -429,7 +429,7 @@ EFI_STATUS InitializeMmcDevice( // Block Count (not used). Could return an error for SD card
if (MmcHostInstance->CardInfo.CardType == MMC_CARD) {
- MmcHost->SendCommand(MMC_CMD23, BlockCount);
+ MmcHost->SendCommand (MmcHost, MMC_CMD23, BlockCount);
}
return EFI_SUCCESS;
@@ -452,7 +452,7 @@ MmcReset ( }
// If a card is not present then clear all media settings
- if (!MmcHostInstance->MmcHost->IsCardPresent()) {
+ if (!MmcHostInstance->MmcHost->IsCardPresent (MmcHostInstance->MmcHost)) {
MmcHostInstance->BlockIo.Media->MediaPresent = FALSE;
MmcHostInstance->BlockIo.Media->LastBlock = 0;
MmcHostInstance->BlockIo.Media->BlockSize = 512; // Should be zero but there is a bug in DiskIo
@@ -474,7 +474,7 @@ MmcDetectCard ( EFI_MMC_HOST_PROTOCOL *MmcHost
)
{
- if (!MmcHost->IsCardPresent()) {
+ if (!MmcHost->IsCardPresent (MmcHost)) {
return EFI_NO_MEDIA;
} else {
return EFI_SUCCESS;
@@ -544,9 +544,9 @@ MmcIoBlocks ( Response[0] = 0;
Timeout = 20;
while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {
- Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
}
}
@@ -577,7 +577,7 @@ MmcIoBlocks ( //TODO: Should we support write stream (MMC_CMD20)
#endif
}
- Status = MmcHost->SendCommand(Cmd, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD%d): Error %r\n",Cmd, Status));
return Status;
@@ -586,7 +586,7 @@ MmcIoBlocks ( if (Transfer == MMC_IOBLOCKS_READ) {
#ifndef USE_STREAM
// Read one block of Data
- Status = MmcHost->ReadBlockData(Lba,This->Media->BlockSize,Buffer);
+ Status = MmcHost->ReadBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Read Block Data and Status = %r\n", Status));
return Status;
@@ -603,7 +603,7 @@ MmcIoBlocks ( } else {
#ifndef USE_STREAM
// Write one block of Data
- Status = MmcHost->WriteBlockData(Lba,This->Media->BlockSize,Buffer);
+ Status = MmcHost->WriteBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Write Block Data and Status = %r\n", Status));
return Status;
@@ -615,9 +615,9 @@ MmcIoBlocks ( }
// Command 12 - Stop transmission (ends read)
- Status = MmcHost->SendCommand(MMC_CMD12, 0);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1b,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b,Response);
}
// Command 13 - Read status and wait for programming to complete (return to tran)
@@ -625,9 +625,9 @@ MmcIoBlocks ( CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Response[0] = 0;
while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {
- Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);
+ Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
}
NanoSecondDelay(100);
Timeout--;
diff --git a/Omap35xxPkg/MmcHostDxe/MmcHostDxe.c b/Omap35xxPkg/MmcHostDxe/MmcHostDxe.c index 1435c95163..17ebf8d708 100755 --- a/Omap35xxPkg/MmcHostDxe/MmcHostDxe.c +++ b/Omap35xxPkg/MmcHostDxe/MmcHostDxe.c @@ -280,7 +280,7 @@ InitializeMMCHS ( BOOLEAN MMCIsCardPresent ( - VOID + IN EFI_MMC_HOST_PROTOCOL *This ) { EFI_STATUS Status; @@ -299,7 +299,7 @@ MMCIsCardPresent ( BOOLEAN MMCIsReadOnly ( - VOID + IN EFI_MMC_HOST_PROTOCOL *This ) { /* Note: @@ -318,7 +318,8 @@ EFI_GUID mPL180MciDevicePathGuid = EFI_CALLER_ID_GUID; EFI_STATUS MMCBuildDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL **DevicePath + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL **DevicePath ) { EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode; @@ -331,8 +332,9 @@ MMCBuildDevicePath ( EFI_STATUS MMCSendCommand ( - IN MMC_CMD MmcCmd, - IN UINT32 Argument + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_CMD MmcCmd, + IN UINT32 Argument ) { UINTN MmcStatus; @@ -403,7 +405,8 @@ MMCSendCommand ( EFI_STATUS MMCNotifyState ( - IN MMC_STATE State + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_STATE State ) { EFI_STATUS Status; @@ -526,8 +529,9 @@ MMCNotifyState ( EFI_STATUS MMCReceiveResponse ( - IN MMC_RESPONSE_TYPE Type, - IN UINT32* Buffer + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_RESPONSE_TYPE Type, + IN UINT32* Buffer ) { if (Buffer == NULL) { @@ -554,9 +558,10 @@ MMCReceiveResponse ( EFI_STATUS MMCReadBlockData ( - IN EFI_LBA Lba, - IN UINTN Length, - IN UINT32* Buffer + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Length, + IN UINT32* Buffer ) { UINTN MmcStatus; @@ -595,9 +600,10 @@ MMCReadBlockData ( EFI_STATUS MMCWriteBlockData ( - IN EFI_LBA Lba, - IN UINTN Length, - IN UINT32* Buffer + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Length, + IN UINT32* Buffer ) { UINTN MmcStatus; @@ -635,6 +641,7 @@ MMCWriteBlockData ( } EFI_MMC_HOST_PROTOCOL gMMCHost = { + MMC_HOST_PROTOCOL_REVISION, MMCIsCardPresent, MMCIsReadOnly, MMCBuildDevicePath, |