summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Universal/MmcDxe
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-01 17:08:41 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-01 17:08:41 +0000
commit16d88c2d20ccd9f8ea52967b578ece82174ea762 (patch)
tree396c179773cb020167359aee051b6831a03d2f47 /EmbeddedPkg/Universal/MmcDxe
parent66f47f9fc00e3770d0502305387389c91e2025de (diff)
downloadedk2-platforms-16d88c2d20ccd9f8ea52967b578ece82174ea762.tar.xz
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
Diffstat (limited to 'EmbeddedPkg/Universal/MmcDxe')
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/Mmc.c8
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/Mmc.h2
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c68
3 files changed, 39 insertions, 39 deletions
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--;