diff options
Diffstat (limited to 'MdeModulePkg/Bus/Sd/EmmcDxe')
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c | 33 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c | 615 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h | 101 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c | 6 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c | 483 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h | 163 |
6 files changed, 733 insertions, 668 deletions
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c index 6a4d18d4d6..b66bbff824 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c @@ -11,17 +11,17 @@ //
// Driver name table
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmmcDxeDriverNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmmcDxeDriverNameTable[] = {
{ "eng;en", L"Edkii Emmc Device Driver" },
- { NULL , NULL }
+ { NULL, NULL }
};
//
// Controller name table
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmmcDxeControllerNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmmcDxeControllerNameTable[] = {
{ "eng;en", L"Edkii Emmc Host Controller" },
- { NULL , NULL }
+ { NULL, NULL }
};
//
@@ -36,9 +36,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmmcDxeComponentName //
// EFI Component Name 2 Protocol
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmmcDxeComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmmcDxeComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmmcDxeComponentNameGetControllerName,
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmmcDxeComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmmcDxeComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmmcDxeComponentNameGetControllerName,
"en"
};
@@ -96,7 +96,6 @@ EmmcDxeComponentNameGetDriverName ( DriverName,
(BOOLEAN)(This == &gEmmcDxeComponentName)
);
-
}
/**
@@ -170,11 +169,11 @@ EmmcDxeComponentNameGetDriverName ( EFI_STATUS
EFIAPI
EmmcDxeComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
@@ -205,13 +204,14 @@ EmmcDxeComponentNameGetControllerName ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Get the child context
//
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
+ (VOID **)&BlockIo,
gEmmcDxeDriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -220,8 +220,8 @@ EmmcDxeComponentNameGetControllerName ( return EFI_UNSUPPORTED;
}
- Partition = EMMC_PARTITION_DATA_FROM_BLKIO (BlockIo);
- Device = Partition->Device;
+ Partition = EMMC_PARTITION_DATA_FROM_BLKIO (BlockIo);
+ Device = Partition->Device;
ControllerNameTable = Device->ControllerNameTable;
}
@@ -233,4 +233,3 @@ EmmcDxeComponentNameGetControllerName ( (BOOLEAN)(This == &gEmmcDxeComponentName)
);
}
-
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c index 63d77a22fe..39b7c7ce6e 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c @@ -19,24 +19,28 @@ VOID
EFIAPI
AsyncIoCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EMMC_REQUEST *Request;
- EFI_STATUS Status;
+ EMMC_REQUEST *Request;
+ EFI_STATUS Status;
Status = gBS->CloseEvent (Event);
if (EFI_ERROR (Status)) {
return;
}
- Request = (EMMC_REQUEST *) Context;
+ Request = (EMMC_REQUEST *)Context;
DEBUG_CODE_BEGIN ();
- DEBUG ((DEBUG_INFO, "Emmc Async Request: CmdIndex[%d] Arg[%08x] %r\n",
- Request->SdMmcCmdBlk.CommandIndex, Request->SdMmcCmdBlk.CommandArgument,
- Request->Packet.TransactionStatus));
+ DEBUG ((
+ DEBUG_INFO,
+ "Emmc Async Request: CmdIndex[%d] Arg[%08x] %r\n",
+ Request->SdMmcCmdBlk.CommandIndex,
+ Request->SdMmcCmdBlk.CommandArgument,
+ Request->Packet.TransactionStatus
+ ));
DEBUG_CODE_END ();
if (EFI_ERROR (Request->Packet.TransactionStatus)) {
@@ -65,15 +69,15 @@ AsyncIoCallback ( **/
EFI_STATUS
EmmcSelect (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
PassThru = Device->Private->PassThru;
@@ -84,9 +88,9 @@ EmmcSelect ( Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SdMmcCmdBlk.CommandIndex = EMMC_SELECT_DESELECT_CARD;
- SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
- SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
+ SdMmcCmdBlk.CommandIndex = EMMC_SELECT_DESELECT_CARD;
+ SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
+ SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL);
@@ -108,16 +112,16 @@ EmmcSelect ( **/
EFI_STATUS
EmmcSendStatus (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT UINT32 *DevStatus
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT UINT32 *DevStatus
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
PassThru = Device->Private->PassThru;
@@ -128,9 +132,9 @@ EmmcSendStatus ( Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SdMmcCmdBlk.CommandIndex = EMMC_SEND_STATUS;
- SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
- SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
+ SdMmcCmdBlk.CommandIndex = EMMC_SEND_STATUS;
+ SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
+ SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL);
@@ -155,16 +159,16 @@ EmmcSendStatus ( **/
EFI_STATUS
EmmcGetCsd (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT EMMC_CSD *Csd
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT EMMC_CSD *Csd
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
PassThru = Device->Private->PassThru;
@@ -177,9 +181,9 @@ EmmcGetCsd ( Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SdMmcCmdBlk.CommandIndex = EMMC_SEND_CSD;
- SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
- SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
+ SdMmcCmdBlk.CommandIndex = EMMC_SEND_CSD;
+ SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
+ SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL);
@@ -187,7 +191,7 @@ EmmcGetCsd ( //
// For details, refer to SD Host Controller Simplified Spec 3.0 Table 2-12.
//
- CopyMem (((UINT8*)Csd) + 1, &SdMmcStatusBlk.Resp0, sizeof (EMMC_CSD) - 1);
+ CopyMem (((UINT8 *)Csd) + 1, &SdMmcStatusBlk.Resp0, sizeof (EMMC_CSD) - 1);
}
return Status;
@@ -207,16 +211,16 @@ EmmcGetCsd ( **/
EFI_STATUS
EmmcGetCid (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT EMMC_CID *Cid
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT EMMC_CID *Cid
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
PassThru = Device->Private->PassThru;
@@ -229,9 +233,9 @@ EmmcGetCid ( Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SdMmcCmdBlk.CommandIndex = EMMC_SEND_CID;
- SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
- SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
+ SdMmcCmdBlk.CommandIndex = EMMC_SEND_CID;
+ SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
+ SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL);
@@ -239,7 +243,7 @@ EmmcGetCid ( //
// For details, refer to SD Host Controller Simplified Spec 3.0 Table 2-12.
//
- CopyMem (((UINT8*)Cid) + 1, &SdMmcStatusBlk.Resp0, sizeof (EMMC_CID) - 1);
+ CopyMem (((UINT8 *)Cid) + 1, &SdMmcStatusBlk.Resp0, sizeof (EMMC_CID) - 1);
}
return Status;
@@ -258,15 +262,15 @@ EmmcGetCid ( **/
EFI_STATUS
EmmcGetExtCsd (
- IN EMMC_DEVICE *Device,
- OUT EMMC_EXT_CSD *ExtCsd
+ IN EMMC_DEVICE *Device,
+ OUT EMMC_EXT_CSD *ExtCsd
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
PassThru = Device->Private->PassThru;
@@ -278,12 +282,12 @@ EmmcGetExtCsd ( Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SdMmcCmdBlk.CommandIndex = EMMC_SEND_EXT_CSD;
- SdMmcCmdBlk.CommandType = SdMmcCommandTypeAdtc;
- SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
+ SdMmcCmdBlk.CommandIndex = EMMC_SEND_EXT_CSD;
+ SdMmcCmdBlk.CommandType = SdMmcCommandTypeAdtc;
+ SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
SdMmcCmdBlk.CommandArgument = 0x00000000;
- Packet.InDataBuffer = ExtCsd;
- Packet.InTransferLength = sizeof (EMMC_EXT_CSD);
+ Packet.InDataBuffer = ExtCsd;
+ Packet.InTransferLength = sizeof (EMMC_EXT_CSD);
Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL);
@@ -307,19 +311,19 @@ EmmcGetExtCsd ( **/
EFI_STATUS
EmmcSetExtCsd (
- IN EMMC_PARTITION *Partition,
- IN UINT8 Offset,
- IN UINT8 Value,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN UINT8 Offset,
+ IN UINT8 Value,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *SetExtCsdReq;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- UINT32 CommandArgument;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *SetExtCsdReq;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ UINT32 CommandArgument;
+ EFI_TPL OldTpl;
SetExtCsdReq = NULL;
@@ -333,7 +337,7 @@ EmmcSetExtCsd ( }
SetExtCsdReq->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &SetExtCsdReq->Link);
gBS->RestoreTPL (OldTpl);
SetExtCsdReq->Packet.SdMmcCmdBlk = &SetExtCsdReq->SdMmcCmdBlk;
@@ -346,7 +350,7 @@ EmmcSetExtCsd ( //
// Write the Value to the field specified by Offset.
//
- CommandArgument = (Value << 8) | (Offset << 16) | BIT24 | BIT25;
+ CommandArgument = (Value << 8) | (Offset << 16) | BIT24 | BIT25;
SetExtCsdReq->SdMmcCmdBlk.CommandArgument = CommandArgument;
SetExtCsdReq->IsEnd = IsEnd;
@@ -382,6 +386,7 @@ Error: if (SetExtCsdReq->Event != NULL) {
gBS->CloseEvent (SetExtCsdReq->Event);
}
+
FreePool (SetExtCsdReq);
}
} else {
@@ -415,17 +420,17 @@ Error: **/
EFI_STATUS
EmmcSetBlkCount (
- IN EMMC_PARTITION *Partition,
- IN UINT16 BlockNum,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN UINT16 BlockNum,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *SetBlkCntReq;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *SetBlkCntReq;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_TPL OldTpl;
SetBlkCntReq = NULL;
@@ -439,16 +444,16 @@ EmmcSetBlkCount ( }
SetBlkCntReq->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &SetBlkCntReq->Link);
gBS->RestoreTPL (OldTpl);
SetBlkCntReq->Packet.SdMmcCmdBlk = &SetBlkCntReq->SdMmcCmdBlk;
SetBlkCntReq->Packet.SdMmcStatusBlk = &SetBlkCntReq->SdMmcStatusBlk;
SetBlkCntReq->Packet.Timeout = EMMC_GENERIC_TIMEOUT;
- SetBlkCntReq->SdMmcCmdBlk.CommandIndex = EMMC_SET_BLOCK_COUNT;
- SetBlkCntReq->SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
- SetBlkCntReq->SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
+ SetBlkCntReq->SdMmcCmdBlk.CommandIndex = EMMC_SET_BLOCK_COUNT;
+ SetBlkCntReq->SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
+ SetBlkCntReq->SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
SetBlkCntReq->SdMmcCmdBlk.CommandArgument = BlockNum;
SetBlkCntReq->IsEnd = IsEnd;
@@ -484,6 +489,7 @@ Error: if (SetBlkCntReq->Event != NULL) {
gBS->CloseEvent (SetBlkCntReq->Event);
}
+
FreePool (SetBlkCntReq);
}
} else {
@@ -527,22 +533,22 @@ Error: **/
EFI_STATUS
EmmcProtocolInOut (
- IN EMMC_PARTITION *Partition,
- IN UINT8 SecurityProtocol,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- IN BOOLEAN IsRead,
- IN UINT64 Timeout,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN UINT8 SecurityProtocol,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ OUT VOID *PayloadBuffer,
+ IN BOOLEAN IsRead,
+ IN UINT64 Timeout,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *ProtocolReq;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *ProtocolReq;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_TPL OldTpl;
ProtocolReq = NULL;
@@ -556,7 +562,7 @@ EmmcProtocolInOut ( }
ProtocolReq->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &ProtocolReq->Link);
gBS->RestoreTPL (OldTpl);
ProtocolReq->Packet.SdMmcCmdBlk = &ProtocolReq->SdMmcCmdBlk;
@@ -617,6 +623,7 @@ Error: if (ProtocolReq->Event != NULL) {
gBS->CloseEvent (ProtocolReq->Event);
}
+
FreePool (ProtocolReq);
}
} else {
@@ -655,20 +662,20 @@ Error: **/
EFI_STATUS
EmmcRwMultiBlocks (
- IN EMMC_PARTITION *Partition,
- IN EFI_LBA Lba,
- IN VOID *Buffer,
- IN UINTN BufferSize,
- IN BOOLEAN IsRead,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN EFI_LBA Lba,
+ IN VOID *Buffer,
+ IN UINTN BufferSize,
+ IN BOOLEAN IsRead,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *RwMultiBlkReq;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *RwMultiBlkReq;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_TPL OldTpl;
RwMultiBlkReq = NULL;
@@ -682,7 +689,7 @@ EmmcRwMultiBlocks ( }
RwMultiBlkReq->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &RwMultiBlkReq->Link);
gBS->RestoreTPL (OldTpl);
RwMultiBlkReq->Packet.SdMmcCmdBlk = &RwMultiBlkReq->SdMmcCmdBlk;
@@ -751,6 +758,7 @@ Error: if (RwMultiBlkReq->Event != NULL) {
gBS->CloseEvent (RwMultiBlkReq->Event);
}
+
FreePool (RwMultiBlkReq);
}
} else {
@@ -793,25 +801,25 @@ Error: **/
EFI_STATUS
EmmcReadWrite (
- IN EMMC_PARTITION *Partition,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT VOID *Buffer,
- IN UINTN BufferSize,
- IN BOOLEAN IsRead,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token
+ IN EMMC_PARTITION *Partition,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT VOID *Buffer,
+ IN UINTN BufferSize,
+ IN BOOLEAN IsRead,
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN BlockNum;
- UINTN IoAlign;
- UINT8 PartitionConfig;
- UINTN Remaining;
- UINT32 MaxBlock;
- BOOLEAN LastRw;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EFI_BLOCK_IO_MEDIA *Media;
+ UINTN BlockSize;
+ UINTN BlockNum;
+ UINTN IoAlign;
+ UINT8 PartitionConfig;
+ UINTN Remaining;
+ UINT32 MaxBlock;
+ BOOLEAN LastRw;
Status = EFI_SUCCESS;
Device = Partition->Device;
@@ -838,6 +846,7 @@ EmmcReadWrite ( Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
+
return EFI_SUCCESS;
}
@@ -846,32 +855,35 @@ EmmcReadWrite ( return EFI_BAD_BUFFER_SIZE;
}
- BlockNum = BufferSize / BlockSize;
+ BlockNum = BufferSize / BlockSize;
if ((Lba + BlockNum - 1) > Media->LastBlock) {
return EFI_INVALID_PARAMETER;
}
IoAlign = Media->IoAlign;
- if (IoAlign > 0 && (((UINTN) Buffer & (IoAlign - 1)) != 0)) {
+ if ((IoAlign > 0) && (((UINTN)Buffer & (IoAlign - 1)) != 0)) {
return EFI_INVALID_PARAMETER;
}
if ((Token != NULL) && (Token->Event != NULL)) {
Token->TransactionStatus = EFI_SUCCESS;
}
+
//
// Check if needs to switch partition access.
//
PartitionConfig = Device->ExtCsd.PartitionConfig;
if ((PartitionConfig & 0x7) != Partition->PartitionType) {
- PartitionConfig &= (UINT8)~0x7;
+ PartitionConfig &= (UINT8) ~0x7;
PartitionConfig |= Partition->PartitionType;
- Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, Token, FALSE);
+ Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, Token, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
+
Device->ExtCsd.PartitionConfig = PartitionConfig;
}
+
//
// Start to execute data transfer. The max block number in single cmd is 65535 blocks.
//
@@ -885,23 +897,31 @@ EmmcReadWrite ( } else {
BlockNum = MaxBlock;
}
+
Status = EmmcSetBlkCount (Partition, (UINT16)BlockNum, Token, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
BufferSize = BlockNum * BlockSize;
- Status = EmmcRwMultiBlocks (Partition, Lba, Buffer, BufferSize, IsRead, Token, LastRw);
+ Status = EmmcRwMultiBlocks (Partition, Lba, Buffer, BufferSize, IsRead, Token, LastRw);
if (EFI_ERROR (Status)) {
return Status;
}
- DEBUG ((DEBUG_BLKIO,
- "Emmc%a(): Part %d Lba 0x%x BlkNo 0x%x Event %p with %r\n",
- IsRead ? "Read " : "Write", Partition->PartitionType, Lba, BlockNum,
- (Token != NULL) ? Token->Event : NULL, Status));
- Lba += BlockNum;
- Buffer = (UINT8*)Buffer + BufferSize;
+ DEBUG ((
+ DEBUG_BLKIO,
+ "Emmc%a(): Part %d Lba 0x%x BlkNo 0x%x Event %p with %r\n",
+ IsRead ? "Read " : "Write",
+ Partition->PartitionType,
+ Lba,
+ BlockNum,
+ (Token != NULL) ? Token->Event : NULL,
+ Status
+ ));
+
+ Lba += BlockNum;
+ Buffer = (UINT8 *)Buffer + BufferSize;
Remaining -= BlockNum;
}
@@ -922,13 +942,13 @@ EmmcReadWrite ( EFI_STATUS
EFIAPI
EmmcReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+ IN EFI_BLOCK_IO_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO (This);
@@ -967,11 +987,11 @@ EmmcReadBlocks ( IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
- OUT VOID *Buffer
+ OUT VOID *Buffer
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO (This);
@@ -1002,15 +1022,15 @@ EmmcReadBlocks ( EFI_STATUS
EFIAPI
EmmcWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_BLOCK_IO_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO (This);
@@ -1031,7 +1051,7 @@ EmmcWriteBlocks ( EFI_STATUS
EFIAPI
EmmcFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
+ IN EFI_BLOCK_IO_PROTOCOL *This
)
{
//
@@ -1058,18 +1078,19 @@ EmmcResetEx ( IN BOOLEAN ExtendedVerification
)
{
- EMMC_PARTITION *Partition;
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
- EMMC_REQUEST *Request;
- EFI_TPL OldTpl;
+ EMMC_PARTITION *Partition;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NextLink;
+ EMMC_REQUEST *Request;
+ EFI_TPL OldTpl;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO2 (This);
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
for (Link = GetFirstNode (&Partition->Queue);
!IsNull (&Partition->Queue, Link);
- Link = NextLink) {
+ Link = NextLink)
+ {
NextLink = GetNextNode (&Partition->Queue, Link);
RemoveEntryList (Link);
@@ -1084,6 +1105,7 @@ EmmcResetEx ( FreePool (Request);
}
+
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
@@ -1118,16 +1140,16 @@ EmmcResetEx ( EFI_STATUS
EFIAPI
EmmcReadBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
+ IN EFI_BLOCK_IO2_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,
+ IN UINTN BufferSize,
+ OUT VOID *Buffer
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO2 (This);
@@ -1160,16 +1182,16 @@ EmmcReadBlocksEx ( EFI_STATUS
EFIAPI
EmmcWriteBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_BLOCK_IO2_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
Partition = EMMC_PARTITION_DATA_FROM_BLKIO2 (This);
@@ -1198,7 +1220,7 @@ EmmcFlushBlocksEx ( //
// Signal event and return directly.
//
- if (Token != NULL && Token->Event != NULL) {
+ if ((Token != NULL) && (Token->Event != NULL)) {
Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
@@ -1282,27 +1304,27 @@ EmmcFlushBlocksEx ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolInOut (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- OUT UINTN *PayloadTransferSize,
- IN BOOLEAN IsRead
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ OUT VOID *PayloadBuffer,
+ OUT UINTN *PayloadTransferSize,
+ IN BOOLEAN IsRead
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
- EMMC_DEVICE *Device;
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN BlockNum;
- UINTN IoAlign;
- UINTN Remaining;
- UINT32 MaxBlock;
- UINT8 PartitionConfig;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
+ EMMC_DEVICE *Device;
+ EFI_BLOCK_IO_MEDIA *Media;
+ UINTN BlockSize;
+ UINTN BlockNum;
+ UINTN IoAlign;
+ UINTN Remaining;
+ UINT32 MaxBlock;
+ UINT8 PartitionConfig;
Status = EFI_SUCCESS;
Partition = EMMC_PARTITION_DATA_FROM_SSP (This);
@@ -1330,10 +1352,10 @@ EmmcSecurityProtocolInOut ( return EFI_BAD_BUFFER_SIZE;
}
- BlockNum = PayloadBufferSize / BlockSize;
+ BlockNum = PayloadBufferSize / BlockSize;
IoAlign = Media->IoAlign;
- if (IoAlign > 0 && (((UINTN) PayloadBuffer & (IoAlign - 1)) != 0)) {
+ if ((IoAlign > 0) && (((UINTN)PayloadBuffer & (IoAlign - 1)) != 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -1341,21 +1363,24 @@ EmmcSecurityProtocolInOut ( // Security protocol interface is synchronous transfer.
// Waiting for async I/O list to be empty before any operation.
//
- while (!IsListEmpty (&Partition->Queue));
+ while (!IsListEmpty (&Partition->Queue)) {
+ }
//
// Check if needs to switch partition access.
//
PartitionConfig = Device->ExtCsd.PartitionConfig;
if ((PartitionConfig & 0x7) != Partition->PartitionType) {
- PartitionConfig &= (UINT8)~0x7;
+ PartitionConfig &= (UINT8) ~0x7;
PartitionConfig |= Partition->PartitionType;
- Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, NULL, FALSE);
+ Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, NULL, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
+
Device->ExtCsd.PartitionConfig = PartitionConfig;
}
+
//
// Start to execute data transfer. The max block number in single cmd is 65535 blocks.
//
@@ -1375,12 +1400,12 @@ EmmcSecurityProtocolInOut ( }
PayloadBufferSize = BlockNum * BlockSize;
- Status = EmmcProtocolInOut (Partition, SecurityProtocolId, SecurityProtocolSpecificData, PayloadBufferSize, PayloadBuffer, IsRead, Timeout, NULL, FALSE);
+ Status = EmmcProtocolInOut (Partition, SecurityProtocolId, SecurityProtocolSpecificData, PayloadBufferSize, PayloadBuffer, IsRead, Timeout, NULL, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
- PayloadBuffer = (UINT8*)PayloadBuffer + PayloadBufferSize;
+ PayloadBuffer = (UINT8 *)PayloadBuffer + PayloadBufferSize;
Remaining -= BlockNum;
if (PayloadTransferSize != NULL) {
*PayloadTransferSize += PayloadBufferSize;
@@ -1465,19 +1490,19 @@ EmmcSecurityProtocolInOut ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolIn (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- OUT UINTN *PayloadTransferSize
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ OUT VOID *PayloadBuffer,
+ OUT UINTN *PayloadTransferSize
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- if ((PayloadTransferSize == NULL) && PayloadBufferSize != 0) {
+ if ((PayloadTransferSize == NULL) && (PayloadBufferSize != 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -1560,16 +1585,16 @@ EmmcSecurityProtocolIn ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolOut (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- IN VOID *PayloadBuffer
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ IN VOID *PayloadBuffer
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = EmmcSecurityProtocolInOut (
This,
@@ -1602,17 +1627,17 @@ EmmcSecurityProtocolOut ( **/
EFI_STATUS
EmmcEraseBlockStart (
- IN EMMC_PARTITION *Partition,
- IN EFI_LBA StartLba,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN EFI_LBA StartLba,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *EraseBlockStart;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *EraseBlockStart;
+ EFI_TPL OldTpl;
EraseBlockStart = NULL;
@@ -1626,7 +1651,7 @@ EmmcEraseBlockStart ( }
EraseBlockStart->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &EraseBlockStart->Link);
gBS->RestoreTPL (OldTpl);
EraseBlockStart->Packet.SdMmcCmdBlk = &EraseBlockStart->SdMmcCmdBlk;
@@ -1676,6 +1701,7 @@ Error: if (EraseBlockStart->Event != NULL) {
gBS->CloseEvent (EraseBlockStart->Event);
}
+
FreePool (EraseBlockStart);
}
} else {
@@ -1709,17 +1735,17 @@ Error: **/
EFI_STATUS
EmmcEraseBlockEnd (
- IN EMMC_PARTITION *Partition,
- IN EFI_LBA EndLba,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN EFI_LBA EndLba,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *EraseBlockEnd;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *EraseBlockEnd;
+ EFI_TPL OldTpl;
EraseBlockEnd = NULL;
@@ -1733,7 +1759,7 @@ EmmcEraseBlockEnd ( }
EraseBlockEnd->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &EraseBlockEnd->Link);
gBS->RestoreTPL (OldTpl);
EraseBlockEnd->Packet.SdMmcCmdBlk = &EraseBlockEnd->SdMmcCmdBlk;
@@ -1783,6 +1809,7 @@ Error: if (EraseBlockEnd->Event != NULL) {
gBS->CloseEvent (EraseBlockEnd->Event);
}
+
FreePool (EraseBlockEnd);
}
} else {
@@ -1815,16 +1842,16 @@ Error: **/
EFI_STATUS
EmmcEraseBlock (
- IN EMMC_PARTITION *Partition,
- IN EFI_BLOCK_IO2_TOKEN *Token,
- IN BOOLEAN IsEnd
+ IN EMMC_PARTITION *Partition,
+ IN EFI_BLOCK_IO2_TOKEN *Token,
+ IN BOOLEAN IsEnd
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EMMC_DEVICE *Device;
- EMMC_REQUEST *EraseBlock;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EMMC_DEVICE *Device;
+ EMMC_REQUEST *EraseBlock;
+ EFI_TPL OldTpl;
EraseBlock = NULL;
@@ -1838,7 +1865,7 @@ EmmcEraseBlock ( }
EraseBlock->Signature = EMMC_REQUEST_SIGNATURE;
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
InsertTailList (&Partition->Queue, &EraseBlock->Link);
gBS->RestoreTPL (OldTpl);
EraseBlock->Packet.SdMmcCmdBlk = &EraseBlock->SdMmcCmdBlk;
@@ -1890,6 +1917,7 @@ Error: if (EraseBlock->Event != NULL) {
gBS->CloseEvent (EraseBlock->Event);
}
+
FreePool (EraseBlock);
}
} else {
@@ -1922,14 +1950,14 @@ Error: **/
EFI_STATUS
EmmcWriteZeros (
- IN EMMC_PARTITION *Partition,
- IN EFI_LBA StartLba,
- IN UINTN Size
+ IN EMMC_PARTITION *Partition,
+ IN EFI_LBA StartLba,
+ IN UINTN Size
)
{
- EFI_STATUS Status;
- UINT8 *Buffer;
- UINT32 MediaId;
+ EFI_STATUS Status;
+ UINT8 *Buffer;
+ UINT32 MediaId;
Buffer = AllocateZeroPool (Size);
if (Buffer == NULL) {
@@ -1974,27 +2002,27 @@ EmmcWriteZeros ( EFI_STATUS
EFIAPI
EmmcEraseBlocks (
- IN EFI_ERASE_BLOCK_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_ERASE_BLOCK_TOKEN *Token,
- IN UINTN Size
+ IN EFI_ERASE_BLOCK_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_ERASE_BLOCK_TOKEN *Token,
+ IN UINTN Size
)
{
- EFI_STATUS Status;
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN BlockNum;
- EFI_LBA FirstLba;
- EFI_LBA LastLba;
- EFI_LBA StartGroupLba;
- EFI_LBA EndGroupLba;
- UINT32 EraseGroupSize;
- UINT32 Remainder;
- UINTN WriteZeroSize;
- UINT8 PartitionConfig;
- EMMC_PARTITION *Partition;
- EMMC_DEVICE *Device;
+ EFI_STATUS Status;
+ EFI_BLOCK_IO_MEDIA *Media;
+ UINTN BlockSize;
+ UINTN BlockNum;
+ EFI_LBA FirstLba;
+ EFI_LBA LastLba;
+ EFI_LBA StartGroupLba;
+ EFI_LBA EndGroupLba;
+ UINT32 EraseGroupSize;
+ UINT32 Remainder;
+ UINTN WriteZeroSize;
+ UINT8 PartitionConfig;
+ EMMC_PARTITION *Partition;
+ EMMC_DEVICE *Device;
Status = EFI_SUCCESS;
Partition = EMMC_PARTITION_DATA_FROM_ERASEBLK (This);
@@ -2017,7 +2045,7 @@ EmmcEraseBlocks ( return EFI_INVALID_PARAMETER;
}
- BlockNum = Size / BlockSize;
+ BlockNum = Size / BlockSize;
if ((Lba + BlockNum - 1) > Media->LastBlock) {
return EFI_INVALID_PARAMETER;
}
@@ -2034,12 +2062,13 @@ EmmcEraseBlocks ( //
PartitionConfig = Device->ExtCsd.PartitionConfig;
if ((PartitionConfig & 0x7) != Partition->PartitionType) {
- PartitionConfig &= (UINT8)~0x7;
+ PartitionConfig &= (UINT8) ~0x7;
PartitionConfig |= Partition->PartitionType;
- Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, (EFI_BLOCK_IO2_TOKEN*)Token, FALSE);
+ Status = EmmcSetExtCsd (Partition, OFFSET_OF (EMMC_EXT_CSD, PartitionConfig), PartitionConfig, (EFI_BLOCK_IO2_TOKEN *)Token, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
+
Device->ExtCsd.PartitionConfig = PartitionConfig;
}
@@ -2079,6 +2108,7 @@ EmmcEraseBlocks ( Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
+
return EFI_SUCCESS;
}
@@ -2089,7 +2119,7 @@ EmmcEraseBlocks ( //
if (StartGroupLba > FirstLba) {
WriteZeroSize = (UINTN)(StartGroupLba - FirstLba) * BlockSize;
- Status = EmmcWriteZeros (Partition, FirstLba, WriteZeroSize);
+ Status = EmmcWriteZeros (Partition, FirstLba, WriteZeroSize);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -2102,7 +2132,7 @@ EmmcEraseBlocks ( //
if (EndGroupLba <= LastLba) {
WriteZeroSize = (UINTN)(LastLba + 1 - EndGroupLba) * BlockSize;
- Status = EmmcWriteZeros (Partition, EndGroupLba, WriteZeroSize);
+ Status = EmmcWriteZeros (Partition, EndGroupLba, WriteZeroSize);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -2125,6 +2155,7 @@ EmmcEraseBlocks ( Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
+
return EFI_SUCCESS;
}
@@ -2132,17 +2163,17 @@ EmmcEraseBlocks ( LastLba = EndGroupLba - 1;
}
- Status = EmmcEraseBlockStart (Partition, FirstLba, (EFI_BLOCK_IO2_TOKEN*)Token, FALSE);
+ Status = EmmcEraseBlockStart (Partition, FirstLba, (EFI_BLOCK_IO2_TOKEN *)Token, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = EmmcEraseBlockEnd (Partition, LastLba, (EFI_BLOCK_IO2_TOKEN*)Token, FALSE);
+ Status = EmmcEraseBlockEnd (Partition, LastLba, (EFI_BLOCK_IO2_TOKEN *)Token, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = EmmcEraseBlock (Partition, (EFI_BLOCK_IO2_TOKEN*)Token, TRUE);
+ Status = EmmcEraseBlock (Partition, (EFI_BLOCK_IO2_TOKEN *)Token, TRUE);
if (EFI_ERROR (Status)) {
return Status;
}
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h index 62e70ae912..2568f0359d 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h @@ -26,8 +26,8 @@ EFI_STATUS
EFIAPI
EmmcReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+ IN EFI_BLOCK_IO_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
);
/**
@@ -56,7 +56,7 @@ EmmcReadBlocks ( IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
- OUT VOID *Buffer
+ OUT VOID *Buffer
);
/**
@@ -82,11 +82,11 @@ EmmcReadBlocks ( EFI_STATUS
EFIAPI
EmmcWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_BLOCK_IO_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
);
/**
@@ -102,7 +102,7 @@ EmmcWriteBlocks ( EFI_STATUS
EFIAPI
EmmcFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
+ IN EFI_BLOCK_IO_PROTOCOL *This
);
/**
@@ -152,12 +152,12 @@ EmmcResetEx ( EFI_STATUS
EFIAPI
EmmcReadBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
+ IN EFI_BLOCK_IO2_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,
+ IN UINTN BufferSize,
+ OUT VOID *Buffer
);
/**
@@ -185,12 +185,12 @@ EmmcReadBlocksEx ( EFI_STATUS
EFIAPI
EmmcWriteBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_BLOCK_IO2_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
);
/**
@@ -287,15 +287,15 @@ EmmcFlushBlocksEx ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolInOut (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- OUT UINTN *PayloadTransferSize,
- IN BOOLEAN IsRead
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ OUT VOID *PayloadBuffer,
+ OUT UINTN *PayloadTransferSize,
+ IN BOOLEAN IsRead
);
/**
@@ -373,14 +373,14 @@ EmmcSecurityProtocolInOut ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolIn (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- OUT UINTN *PayloadTransferSize
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ OUT VOID *PayloadBuffer,
+ OUT UINTN *PayloadTransferSize
);
/**
@@ -447,13 +447,13 @@ EmmcSecurityProtocolIn ( EFI_STATUS
EFIAPI
EmmcSecurityProtocolOut (
- IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- IN VOID *PayloadBuffer
+ IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN UINT64 Timeout,
+ IN UINT8 SecurityProtocolId,
+ IN UINT16 SecurityProtocolSpecificData,
+ IN UINTN PayloadBufferSize,
+ IN VOID *PayloadBuffer
);
/**
@@ -486,12 +486,11 @@ EmmcSecurityProtocolOut ( EFI_STATUS
EFIAPI
EmmcEraseBlocks (
- IN EFI_ERASE_BLOCK_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN OUT EFI_ERASE_BLOCK_TOKEN *Token,
- IN UINTN Size
+ IN EFI_ERASE_BLOCK_PROTOCOL *This,
+ IN UINT32 MediaId,
+ IN EFI_LBA Lba,
+ IN OUT EFI_ERASE_BLOCK_TOKEN *Token,
+ IN UINTN Size
);
#endif
-
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c index e9e31aa2c1..1f3ab05db9 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c @@ -32,9 +32,9 @@ EmmcDiskInfoInquiry ( IN OUT UINT32 *InquiryDataSize
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
- EMMC_DEVICE *Device;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
+ EMMC_DEVICE *Device;
Partition = EMMC_PARTITION_DATA_FROM_DISKINFO (This);
Device = Partition->Device;
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c index 8dca9a6ee1..c780c396e1 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c @@ -14,7 +14,7 @@ //
// EmmcDxe Driver Binding Protocol Instance
//
-EFI_DRIVER_BINDING_PROTOCOL gEmmcDxeDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gEmmcDxeDriverBinding = {
EmmcDxeDriverBindingSupported,
EmmcDxeDriverBindingStart,
EmmcDxeDriverBindingStop,
@@ -26,7 +26,7 @@ EFI_DRIVER_BINDING_PROTOCOL gEmmcDxeDriverBinding = { //
// Template for Emmc Partitions.
//
-EMMC_PARTITION mEmmcPartitionTemplate = {
+EMMC_PARTITION mEmmcPartitionTemplate = {
EMMC_PARTITION_SIGNATURE, // Signature
FALSE, // Enable
EmmcPartitionUnknown, // PartitionType
@@ -93,39 +93,39 @@ DumpCsd ( IN EMMC_CSD *Csd
)
{
- DEBUG((DEBUG_INFO, "== Dump Emmc Csd Register==\n"));
- DEBUG((DEBUG_INFO, " CSD structure 0x%x\n", Csd->CsdStructure));
- DEBUG((DEBUG_INFO, " System specification version 0x%x\n", Csd->SpecVers));
- DEBUG((DEBUG_INFO, " Data read access-time 1 0x%x\n", Csd->Taac));
- DEBUG((DEBUG_INFO, " Data read access-time 2 0x%x\n", Csd->Nsac));
- DEBUG((DEBUG_INFO, " Max. bus clock frequency 0x%x\n", Csd->TranSpeed));
- DEBUG((DEBUG_INFO, " Device command classes 0x%x\n", Csd->Ccc));
- DEBUG((DEBUG_INFO, " Max. read data block length 0x%x\n", Csd->ReadBlLen));
- DEBUG((DEBUG_INFO, " Partial blocks for read allowed 0x%x\n", Csd->ReadBlPartial));
- DEBUG((DEBUG_INFO, " Write block misalignment 0x%x\n", Csd->WriteBlkMisalign));
- DEBUG((DEBUG_INFO, " Read block misalignment 0x%x\n", Csd->ReadBlkMisalign));
- DEBUG((DEBUG_INFO, " DSR implemented 0x%x\n", Csd->DsrImp));
- DEBUG((DEBUG_INFO, " Device size 0x%x\n", Csd->CSizeLow | (Csd->CSizeHigh << 2)));
- DEBUG((DEBUG_INFO, " Max. read current @ VDD min 0x%x\n", Csd->VddRCurrMin));
- DEBUG((DEBUG_INFO, " Max. read current @ VDD max 0x%x\n", Csd->VddRCurrMax));
- DEBUG((DEBUG_INFO, " Max. write current @ VDD min 0x%x\n", Csd->VddWCurrMin));
- DEBUG((DEBUG_INFO, " Max. write current @ VDD max 0x%x\n", Csd->VddWCurrMax));
- DEBUG((DEBUG_INFO, " Device size multiplier 0x%x\n", Csd->CSizeMult));
- DEBUG((DEBUG_INFO, " Erase group size 0x%x\n", Csd->EraseGrpSize));
- DEBUG((DEBUG_INFO, " Erase group size multiplier 0x%x\n", Csd->EraseGrpMult));
- DEBUG((DEBUG_INFO, " Write protect group size 0x%x\n", Csd->WpGrpSize));
- DEBUG((DEBUG_INFO, " Write protect group enable 0x%x\n", Csd->WpGrpEnable));
- DEBUG((DEBUG_INFO, " Manufacturer default ECC 0x%x\n", Csd->DefaultEcc));
- DEBUG((DEBUG_INFO, " Write speed factor 0x%x\n", Csd->R2WFactor));
- DEBUG((DEBUG_INFO, " Max. write data block length 0x%x\n", Csd->WriteBlLen));
- DEBUG((DEBUG_INFO, " Partial blocks for write allowed 0x%x\n", Csd->WriteBlPartial));
- DEBUG((DEBUG_INFO, " Content protection application 0x%x\n", Csd->ContentProtApp));
- DEBUG((DEBUG_INFO, " File format group 0x%x\n", Csd->FileFormatGrp));
- DEBUG((DEBUG_INFO, " Copy flag (OTP) 0x%x\n", Csd->Copy));
- DEBUG((DEBUG_INFO, " Permanent write protection 0x%x\n", Csd->PermWriteProtect));
- DEBUG((DEBUG_INFO, " Temporary write protection 0x%x\n", Csd->TmpWriteProtect));
- DEBUG((DEBUG_INFO, " File format 0x%x\n", Csd->FileFormat));
- DEBUG((DEBUG_INFO, " ECC code 0x%x\n", Csd->Ecc));
+ DEBUG ((DEBUG_INFO, "== Dump Emmc Csd Register==\n"));
+ DEBUG ((DEBUG_INFO, " CSD structure 0x%x\n", Csd->CsdStructure));
+ DEBUG ((DEBUG_INFO, " System specification version 0x%x\n", Csd->SpecVers));
+ DEBUG ((DEBUG_INFO, " Data read access-time 1 0x%x\n", Csd->Taac));
+ DEBUG ((DEBUG_INFO, " Data read access-time 2 0x%x\n", Csd->Nsac));
+ DEBUG ((DEBUG_INFO, " Max. bus clock frequency 0x%x\n", Csd->TranSpeed));
+ DEBUG ((DEBUG_INFO, " Device command classes 0x%x\n", Csd->Ccc));
+ DEBUG ((DEBUG_INFO, " Max. read data block length 0x%x\n", Csd->ReadBlLen));
+ DEBUG ((DEBUG_INFO, " Partial blocks for read allowed 0x%x\n", Csd->ReadBlPartial));
+ DEBUG ((DEBUG_INFO, " Write block misalignment 0x%x\n", Csd->WriteBlkMisalign));
+ DEBUG ((DEBUG_INFO, " Read block misalignment 0x%x\n", Csd->ReadBlkMisalign));
+ DEBUG ((DEBUG_INFO, " DSR implemented 0x%x\n", Csd->DsrImp));
+ DEBUG ((DEBUG_INFO, " Device size 0x%x\n", Csd->CSizeLow | (Csd->CSizeHigh << 2)));
+ DEBUG ((DEBUG_INFO, " Max. read current @ VDD min 0x%x\n", Csd->VddRCurrMin));
+ DEBUG ((DEBUG_INFO, " Max. read current @ VDD max 0x%x\n", Csd->VddRCurrMax));
+ DEBUG ((DEBUG_INFO, " Max. write current @ VDD min 0x%x\n", Csd->VddWCurrMin));
+ DEBUG ((DEBUG_INFO, " Max. write current @ VDD max 0x%x\n", Csd->VddWCurrMax));
+ DEBUG ((DEBUG_INFO, " Device size multiplier 0x%x\n", Csd->CSizeMult));
+ DEBUG ((DEBUG_INFO, " Erase group size 0x%x\n", Csd->EraseGrpSize));
+ DEBUG ((DEBUG_INFO, " Erase group size multiplier 0x%x\n", Csd->EraseGrpMult));
+ DEBUG ((DEBUG_INFO, " Write protect group size 0x%x\n", Csd->WpGrpSize));
+ DEBUG ((DEBUG_INFO, " Write protect group enable 0x%x\n", Csd->WpGrpEnable));
+ DEBUG ((DEBUG_INFO, " Manufacturer default ECC 0x%x\n", Csd->DefaultEcc));
+ DEBUG ((DEBUG_INFO, " Write speed factor 0x%x\n", Csd->R2WFactor));
+ DEBUG ((DEBUG_INFO, " Max. write data block length 0x%x\n", Csd->WriteBlLen));
+ DEBUG ((DEBUG_INFO, " Partial blocks for write allowed 0x%x\n", Csd->WriteBlPartial));
+ DEBUG ((DEBUG_INFO, " Content protection application 0x%x\n", Csd->ContentProtApp));
+ DEBUG ((DEBUG_INFO, " File format group 0x%x\n", Csd->FileFormatGrp));
+ DEBUG ((DEBUG_INFO, " Copy flag (OTP) 0x%x\n", Csd->Copy));
+ DEBUG ((DEBUG_INFO, " Permanent write protection 0x%x\n", Csd->PermWriteProtect));
+ DEBUG ((DEBUG_INFO, " Temporary write protection 0x%x\n", Csd->TmpWriteProtect));
+ DEBUG ((DEBUG_INFO, " File format 0x%x\n", Csd->FileFormat));
+ DEBUG ((DEBUG_INFO, " ECC code 0x%x\n", Csd->Ecc));
return EFI_SUCCESS;
}
@@ -142,68 +142,98 @@ DumpExtCsd ( IN EMMC_EXT_CSD *ExtCsd
)
{
- DEBUG((DEBUG_INFO, "==Dump Emmc ExtCsd Register==\n"));
- DEBUG((DEBUG_INFO, " Supported Command Sets 0x%x\n", ExtCsd->CmdSet));
- DEBUG((DEBUG_INFO, " HPI features 0x%x\n", ExtCsd->HpiFeatures));
- DEBUG((DEBUG_INFO, " Background operations support 0x%x\n", ExtCsd->BkOpsSupport));
- DEBUG((DEBUG_INFO, " Background operations status 0x%x\n", ExtCsd->BkopsStatus));
- DEBUG((DEBUG_INFO, " Number of correctly programmed sectors 0x%x\n", *((UINT32*)&ExtCsd->CorrectlyPrgSectorsNum[0])));
- DEBUG((DEBUG_INFO, " Initialization time after partitioning 0x%x\n", ExtCsd->IniTimeoutAp));
- DEBUG((DEBUG_INFO, " TRIM Multiplier 0x%x\n", ExtCsd->TrimMult));
- DEBUG((DEBUG_INFO, " Secure Feature support 0x%x\n", ExtCsd->SecFeatureSupport));
- DEBUG((DEBUG_INFO, " Secure Erase Multiplier 0x%x\n", ExtCsd->SecEraseMult));
- DEBUG((DEBUG_INFO, " Secure TRIM Multiplier 0x%x\n", ExtCsd->SecTrimMult));
- DEBUG((DEBUG_INFO, " Boot information 0x%x\n", ExtCsd->BootInfo));
- DEBUG((DEBUG_INFO, " Boot partition size 0x%x\n", ExtCsd->BootSizeMult));
- DEBUG((DEBUG_INFO, " Access size 0x%x\n", ExtCsd->AccSize));
- DEBUG((DEBUG_INFO, " High-capacity erase unit size 0x%x\n", ExtCsd->HcEraseGrpSize));
- DEBUG((DEBUG_INFO, " High-capacity erase timeout 0x%x\n", ExtCsd->EraseTimeoutMult));
- DEBUG((DEBUG_INFO, " Reliable write sector count 0x%x\n", ExtCsd->RelWrSecC));
- DEBUG((DEBUG_INFO, " High-capacity write protect group size 0x%x\n", ExtCsd->HcWpGrpSize));
- DEBUG((DEBUG_INFO, " Sleep/awake timeout 0x%x\n", ExtCsd->SATimeout));
- DEBUG((DEBUG_INFO, " Sector Count 0x%x\n", *((UINT32*)&ExtCsd->SecCount[0])));
- DEBUG((DEBUG_INFO, " Partition switching timing 0x%x\n", ExtCsd->PartitionSwitchTime));
- DEBUG((DEBUG_INFO, " Out-of-interrupt busy timing 0x%x\n", ExtCsd->OutOfInterruptTime));
- DEBUG((DEBUG_INFO, " I/O Driver Strength 0x%x\n", ExtCsd->DriverStrength));
- DEBUG((DEBUG_INFO, " Device type 0x%x\n", ExtCsd->DeviceType));
- DEBUG((DEBUG_INFO, " CSD STRUCTURE 0x%x\n", ExtCsd->CsdStructure));
- DEBUG((DEBUG_INFO, " Extended CSD revision 0x%x\n", ExtCsd->ExtCsdRev));
- DEBUG((DEBUG_INFO, " Command set 0x%x\n", ExtCsd->CmdSet));
- DEBUG((DEBUG_INFO, " Command set revision 0x%x\n", ExtCsd->CmdSetRev));
- DEBUG((DEBUG_INFO, " Power class 0x%x\n", ExtCsd->PowerClass));
- DEBUG((DEBUG_INFO, " High-speed interface timing 0x%x\n", ExtCsd->HsTiming));
- DEBUG((DEBUG_INFO, " Bus width mode 0x%x\n", ExtCsd->BusWidth));
- DEBUG((DEBUG_INFO, " Erased memory content 0x%x\n", ExtCsd->ErasedMemCont));
- DEBUG((DEBUG_INFO, " Partition configuration 0x%x\n", ExtCsd->PartitionConfig));
- DEBUG((DEBUG_INFO, " Boot config protection 0x%x\n", ExtCsd->BootConfigProt));
- DEBUG((DEBUG_INFO, " Boot bus Conditions 0x%x\n", ExtCsd->BootBusConditions));
- DEBUG((DEBUG_INFO, " High-density erase group definition 0x%x\n", ExtCsd->EraseGroupDef));
- DEBUG((DEBUG_INFO, " Boot write protection status register 0x%x\n", ExtCsd->BootWpStatus));
- DEBUG((DEBUG_INFO, " Boot area write protection register 0x%x\n", ExtCsd->BootWp));
- DEBUG((DEBUG_INFO, " User area write protection register 0x%x\n", ExtCsd->UserWp));
- DEBUG((DEBUG_INFO, " FW configuration 0x%x\n", ExtCsd->FwConfig));
- DEBUG((DEBUG_INFO, " RPMB Size 0x%x\n", ExtCsd->RpmbSizeMult));
- DEBUG((DEBUG_INFO, " H/W reset function 0x%x\n", ExtCsd->RstFunction));
- DEBUG((DEBUG_INFO, " Partitioning Support 0x%x\n", ExtCsd->PartitioningSupport));
- DEBUG((DEBUG_INFO, " Max Enhanced Area Size 0x%02x%02x%02x\n", \
- ExtCsd->MaxEnhSizeMult[2], ExtCsd->MaxEnhSizeMult[1], ExtCsd->MaxEnhSizeMult[0]));
- DEBUG((DEBUG_INFO, " Partitions attribute 0x%x\n", ExtCsd->PartitionsAttribute));
- DEBUG((DEBUG_INFO, " Partitioning Setting 0x%x\n", ExtCsd->PartitionSettingCompleted));
- DEBUG((DEBUG_INFO, " General Purpose Partition 1 Size 0x%02x%02x%02x\n", \
- ExtCsd->GpSizeMult[2], ExtCsd->GpSizeMult[1], ExtCsd->GpSizeMult[0]));
- DEBUG((DEBUG_INFO, " General Purpose Partition 2 Size 0x%02x%02x%02x\n", \
- ExtCsd->GpSizeMult[5], ExtCsd->GpSizeMult[4], ExtCsd->GpSizeMult[3]));
- DEBUG((DEBUG_INFO, " General Purpose Partition 3 Size 0x%02x%02x%02x\n", \
- ExtCsd->GpSizeMult[8], ExtCsd->GpSizeMult[7], ExtCsd->GpSizeMult[6]));
- DEBUG((DEBUG_INFO, " General Purpose Partition 4 Size 0x%02x%02x%02x\n", \
- ExtCsd->GpSizeMult[11], ExtCsd->GpSizeMult[10], ExtCsd->GpSizeMult[9]));
- DEBUG((DEBUG_INFO, " Enhanced User Data Area Size 0x%02x%02x%02x\n", \
- ExtCsd->EnhSizeMult[2], ExtCsd->EnhSizeMult[1], ExtCsd->EnhSizeMult[0]));
- DEBUG((DEBUG_INFO, " Enhanced User Data Start Address 0x%x\n", *((UINT32*)&ExtCsd->EnhStartAddr[0])));
- DEBUG((DEBUG_INFO, " Bad Block Management mode 0x%x\n", ExtCsd->SecBadBlkMgmnt));
- DEBUG((DEBUG_INFO, " Native sector size 0x%x\n", ExtCsd->NativeSectorSize));
- DEBUG((DEBUG_INFO, " Sector size emulation 0x%x\n", ExtCsd->UseNativeSector));
- DEBUG((DEBUG_INFO, " Sector size 0x%x\n", ExtCsd->DataSectorSize));
+ DEBUG ((DEBUG_INFO, "==Dump Emmc ExtCsd Register==\n"));
+ DEBUG ((DEBUG_INFO, " Supported Command Sets 0x%x\n", ExtCsd->CmdSet));
+ DEBUG ((DEBUG_INFO, " HPI features 0x%x\n", ExtCsd->HpiFeatures));
+ DEBUG ((DEBUG_INFO, " Background operations support 0x%x\n", ExtCsd->BkOpsSupport));
+ DEBUG ((DEBUG_INFO, " Background operations status 0x%x\n", ExtCsd->BkopsStatus));
+ DEBUG ((DEBUG_INFO, " Number of correctly programmed sectors 0x%x\n", *((UINT32 *)&ExtCsd->CorrectlyPrgSectorsNum[0])));
+ DEBUG ((DEBUG_INFO, " Initialization time after partitioning 0x%x\n", ExtCsd->IniTimeoutAp));
+ DEBUG ((DEBUG_INFO, " TRIM Multiplier 0x%x\n", ExtCsd->TrimMult));
+ DEBUG ((DEBUG_INFO, " Secure Feature support 0x%x\n", ExtCsd->SecFeatureSupport));
+ DEBUG ((DEBUG_INFO, " Secure Erase Multiplier 0x%x\n", ExtCsd->SecEraseMult));
+ DEBUG ((DEBUG_INFO, " Secure TRIM Multiplier 0x%x\n", ExtCsd->SecTrimMult));
+ DEBUG ((DEBUG_INFO, " Boot information 0x%x\n", ExtCsd->BootInfo));
+ DEBUG ((DEBUG_INFO, " Boot partition size 0x%x\n", ExtCsd->BootSizeMult));
+ DEBUG ((DEBUG_INFO, " Access size 0x%x\n", ExtCsd->AccSize));
+ DEBUG ((DEBUG_INFO, " High-capacity erase unit size 0x%x\n", ExtCsd->HcEraseGrpSize));
+ DEBUG ((DEBUG_INFO, " High-capacity erase timeout 0x%x\n", ExtCsd->EraseTimeoutMult));
+ DEBUG ((DEBUG_INFO, " Reliable write sector count 0x%x\n", ExtCsd->RelWrSecC));
+ DEBUG ((DEBUG_INFO, " High-capacity write protect group size 0x%x\n", ExtCsd->HcWpGrpSize));
+ DEBUG ((DEBUG_INFO, " Sleep/awake timeout 0x%x\n", ExtCsd->SATimeout));
+ DEBUG ((DEBUG_INFO, " Sector Count 0x%x\n", *((UINT32 *)&ExtCsd->SecCount[0])));
+ DEBUG ((DEBUG_INFO, " Partition switching timing 0x%x\n", ExtCsd->PartitionSwitchTime));
+ DEBUG ((DEBUG_INFO, " Out-of-interrupt busy timing 0x%x\n", ExtCsd->OutOfInterruptTime));
+ DEBUG ((DEBUG_INFO, " I/O Driver Strength 0x%x\n", ExtCsd->DriverStrength));
+ DEBUG ((DEBUG_INFO, " Device type 0x%x\n", ExtCsd->DeviceType));
+ DEBUG ((DEBUG_INFO, " CSD STRUCTURE 0x%x\n", ExtCsd->CsdStructure));
+ DEBUG ((DEBUG_INFO, " Extended CSD revision 0x%x\n", ExtCsd->ExtCsdRev));
+ DEBUG ((DEBUG_INFO, " Command set 0x%x\n", ExtCsd->CmdSet));
+ DEBUG ((DEBUG_INFO, " Command set revision 0x%x\n", ExtCsd->CmdSetRev));
+ DEBUG ((DEBUG_INFO, " Power class 0x%x\n", ExtCsd->PowerClass));
+ DEBUG ((DEBUG_INFO, " High-speed interface timing 0x%x\n", ExtCsd->HsTiming));
+ DEBUG ((DEBUG_INFO, " Bus width mode 0x%x\n", ExtCsd->BusWidth));
+ DEBUG ((DEBUG_INFO, " Erased memory content 0x%x\n", ExtCsd->ErasedMemCont));
+ DEBUG ((DEBUG_INFO, " Partition configuration 0x%x\n", ExtCsd->PartitionConfig));
+ DEBUG ((DEBUG_INFO, " Boot config protection 0x%x\n", ExtCsd->BootConfigProt));
+ DEBUG ((DEBUG_INFO, " Boot bus Conditions 0x%x\n", ExtCsd->BootBusConditions));
+ DEBUG ((DEBUG_INFO, " High-density erase group definition 0x%x\n", ExtCsd->EraseGroupDef));
+ DEBUG ((DEBUG_INFO, " Boot write protection status register 0x%x\n", ExtCsd->BootWpStatus));
+ DEBUG ((DEBUG_INFO, " Boot area write protection register 0x%x\n", ExtCsd->BootWp));
+ DEBUG ((DEBUG_INFO, " User area write protection register 0x%x\n", ExtCsd->UserWp));
+ DEBUG ((DEBUG_INFO, " FW configuration 0x%x\n", ExtCsd->FwConfig));
+ DEBUG ((DEBUG_INFO, " RPMB Size 0x%x\n", ExtCsd->RpmbSizeMult));
+ DEBUG ((DEBUG_INFO, " H/W reset function 0x%x\n", ExtCsd->RstFunction));
+ DEBUG ((DEBUG_INFO, " Partitioning Support 0x%x\n", ExtCsd->PartitioningSupport));
+ DEBUG ((
+ DEBUG_INFO,
+ " Max Enhanced Area Size 0x%02x%02x%02x\n", \
+ ExtCsd->MaxEnhSizeMult[2],
+ ExtCsd->MaxEnhSizeMult[1],
+ ExtCsd->MaxEnhSizeMult[0]
+ ));
+ DEBUG ((DEBUG_INFO, " Partitions attribute 0x%x\n", ExtCsd->PartitionsAttribute));
+ DEBUG ((DEBUG_INFO, " Partitioning Setting 0x%x\n", ExtCsd->PartitionSettingCompleted));
+ DEBUG ((
+ DEBUG_INFO,
+ " General Purpose Partition 1 Size 0x%02x%02x%02x\n", \
+ ExtCsd->GpSizeMult[2],
+ ExtCsd->GpSizeMult[1],
+ ExtCsd->GpSizeMult[0]
+ ));
+ DEBUG ((
+ DEBUG_INFO,
+ " General Purpose Partition 2 Size 0x%02x%02x%02x\n", \
+ ExtCsd->GpSizeMult[5],
+ ExtCsd->GpSizeMult[4],
+ ExtCsd->GpSizeMult[3]
+ ));
+ DEBUG ((
+ DEBUG_INFO,
+ " General Purpose Partition 3 Size 0x%02x%02x%02x\n", \
+ ExtCsd->GpSizeMult[8],
+ ExtCsd->GpSizeMult[7],
+ ExtCsd->GpSizeMult[6]
+ ));
+ DEBUG ((
+ DEBUG_INFO,
+ " General Purpose Partition 4 Size 0x%02x%02x%02x\n", \
+ ExtCsd->GpSizeMult[11],
+ ExtCsd->GpSizeMult[10],
+ ExtCsd->GpSizeMult[9]
+ ));
+ DEBUG ((
+ DEBUG_INFO,
+ " Enhanced User Data Area Size 0x%02x%02x%02x\n", \
+ ExtCsd->EnhSizeMult[2],
+ ExtCsd->EnhSizeMult[1],
+ ExtCsd->EnhSizeMult[0]
+ ));
+ DEBUG ((DEBUG_INFO, " Enhanced User Data Start Address 0x%x\n", *((UINT32 *)&ExtCsd->EnhStartAddr[0])));
+ DEBUG ((DEBUG_INFO, " Bad Block Management mode 0x%x\n", ExtCsd->SecBadBlkMgmnt));
+ DEBUG ((DEBUG_INFO, " Native sector size 0x%x\n", ExtCsd->NativeSectorSize));
+ DEBUG ((DEBUG_INFO, " Sector size emulation 0x%x\n", ExtCsd->UseNativeSector));
+ DEBUG ((DEBUG_INFO, " Sector size 0x%x\n", ExtCsd->DataSectorSize));
return EFI_SUCCESS;
}
@@ -219,8 +249,8 @@ DumpExtCsd ( **/
EFI_STATUS
GetEmmcModelName (
- IN OUT EMMC_DEVICE *Device,
- IN EMMC_CID *Cid
+ IN OUT EMMC_DEVICE *Device,
+ IN EMMC_CID *Cid
)
{
CHAR8 String[EMMC_MODEL_NAME_MAX_LEN];
@@ -248,27 +278,28 @@ GetEmmcModelName ( **/
EFI_STATUS
DiscoverAllPartitions (
- IN EMMC_DEVICE *Device
+ IN EMMC_DEVICE *Device
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
- EMMC_CSD *Csd;
- EMMC_CID *Cid;
- EMMC_EXT_CSD *ExtCsd;
- UINT8 Slot;
- UINT64 Capacity;
- UINT32 DevStatus;
- UINT8 Index;
- UINT32 SecCount;
- UINT32 GpSizeMult;
-
- Slot = Device->Slot;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
+ EMMC_CSD *Csd;
+ EMMC_CID *Cid;
+ EMMC_EXT_CSD *ExtCsd;
+ UINT8 Slot;
+ UINT64 Capacity;
+ UINT32 DevStatus;
+ UINT8 Index;
+ UINT32 SecCount;
+ UINT32 GpSizeMult;
+
+ Slot = Device->Slot;
Status = EmmcSendStatus (Device, Slot + 1, &DevStatus);
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Deselect the device to force it enter stby mode before getting CSD
// register content.
@@ -287,6 +318,7 @@ DiscoverAllPartitions ( if (EFI_ERROR (Status)) {
return Status;
}
+
DumpCsd (Csd);
if ((Csd->CSizeLow | Csd->CSizeHigh << 2) == 0xFFF) {
@@ -311,6 +343,7 @@ DiscoverAllPartitions ( if (EFI_ERROR (Status)) {
return Status;
}
+
DumpExtCsd (ExtCsd);
if (ExtCsd->ExtCsdRev < 5) {
@@ -326,22 +359,22 @@ DiscoverAllPartitions ( for (Index = 0; Index < EMMC_MAX_PARTITIONS; Index++) {
Partition = &Device->Partition[Index];
CopyMem (Partition, &mEmmcPartitionTemplate, sizeof (EMMC_PARTITION));
- Partition->Device = Device;
+ Partition->Device = Device;
InitializeListHead (&Partition->Queue);
- Partition->BlockIo.Media = &Partition->BlockMedia;
- Partition->BlockIo2.Media = &Partition->BlockMedia;
- Partition->PartitionType = Index;
- Partition->BlockMedia.IoAlign = Device->Private->PassThru->IoAlign;
- Partition->BlockMedia.BlockSize = 0x200;
- Partition->BlockMedia.LastBlock = 0x00;
- Partition->BlockMedia.RemovableMedia = FALSE;
+ Partition->BlockIo.Media = &Partition->BlockMedia;
+ Partition->BlockIo2.Media = &Partition->BlockMedia;
+ Partition->PartitionType = Index;
+ Partition->BlockMedia.IoAlign = Device->Private->PassThru->IoAlign;
+ Partition->BlockMedia.BlockSize = 0x200;
+ Partition->BlockMedia.LastBlock = 0x00;
+ Partition->BlockMedia.RemovableMedia = FALSE;
Partition->BlockMedia.MediaPresent = TRUE;
Partition->BlockMedia.LogicalPartition = FALSE;
switch (Index) {
case EmmcPartitionUserData:
- SecCount = *(UINT32*)&ExtCsd->SecCount;
- Capacity = MultU64x32 ((UINT64) SecCount, 0x200);
+ SecCount = *(UINT32 *)&ExtCsd->SecCount;
+ Capacity = MultU64x32 ((UINT64)SecCount, 0x200);
break;
case EmmcPartitionBoot1:
case EmmcPartitionBoot2:
@@ -352,19 +385,19 @@ DiscoverAllPartitions ( break;
case EmmcPartitionGP1:
GpSizeMult = (UINT32)(ExtCsd->GpSizeMult[0] | (ExtCsd->GpSizeMult[1] << 8) | (ExtCsd->GpSizeMult[2] << 16));
- Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
+ Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
break;
case EmmcPartitionGP2:
GpSizeMult = (UINT32)(ExtCsd->GpSizeMult[3] | (ExtCsd->GpSizeMult[4] << 8) | (ExtCsd->GpSizeMult[5] << 16));
- Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
+ Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
break;
case EmmcPartitionGP3:
GpSizeMult = (UINT32)(ExtCsd->GpSizeMult[6] | (ExtCsd->GpSizeMult[7] << 8) | (ExtCsd->GpSizeMult[8] << 16));
- Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
+ Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
break;
case EmmcPartitionGP4:
GpSizeMult = (UINT32)(ExtCsd->GpSizeMult[9] | (ExtCsd->GpSizeMult[10] << 8) | (ExtCsd->GpSizeMult[11] << 16));
- Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
+ Capacity = MultU64x32 (MultU64x32 (MultU64x32 ((UINT64)GpSizeMult, ExtCsd->HcWpGrpSize), ExtCsd->HcEraseGrpSize), SIZE_512KB);
break;
default:
ASSERT (FALSE);
@@ -372,7 +405,7 @@ DiscoverAllPartitions ( }
if (Capacity != 0) {
- Partition->Enable = TRUE;
+ Partition->Enable = TRUE;
Partition->BlockMedia.LastBlock = DivU64x32 (Capacity, Partition->BlockMedia.BlockSize) - 1;
}
@@ -402,17 +435,17 @@ DiscoverAllPartitions ( **/
EFI_STATUS
InstallProtocolOnPartition (
- IN EMMC_DEVICE *Device,
- IN UINT8 Index
+ IN EMMC_DEVICE *Device,
+ IN UINT8 Index
)
{
- EFI_STATUS Status;
- EMMC_PARTITION *Partition;
- CONTROLLER_DEVICE_PATH ControlNode;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
- EFI_HANDLE DeviceHandle;
+ EFI_STATUS Status;
+ EMMC_PARTITION *Partition;
+ CONTROLLER_DEVICE_PATH ControlNode;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
+ EFI_HANDLE DeviceHandle;
//
// Build device path
@@ -424,21 +457,21 @@ InstallProtocolOnPartition ( SetDevicePathNodeLength (&ControlNode.Header, sizeof (CONTROLLER_DEVICE_PATH));
ControlNode.ControllerNumber = Index;
- DevicePath = AppendDevicePathNode (ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*)&ControlNode);
+ DevicePath = AppendDevicePathNode (ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&ControlNode);
if (DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
- DeviceHandle = NULL;
+ DeviceHandle = NULL;
RemainingDevicePath = DevicePath;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
- if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
+ if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd (RemainingDevicePath)) {
Status = EFI_ALREADY_STARTED;
goto Error;
}
- Partition = &Device->Partition[Index];
+ Partition = &Device->Partition[Index];
Partition->DevicePath = DevicePath;
if (Partition->Enable) {
//
@@ -464,9 +497,10 @@ InstallProtocolOnPartition ( }
if (((Partition->PartitionType == EmmcPartitionUserData) ||
- (Partition->PartitionType == EmmcPartitionBoot1) ||
- (Partition->PartitionType == EmmcPartitionBoot2)) &&
- ((Device->Csd.Ccc & BIT10) != 0)) {
+ (Partition->PartitionType == EmmcPartitionBoot1) ||
+ (Partition->PartitionType == EmmcPartitionBoot2)) &&
+ ((Device->Csd.Ccc & BIT10) != 0))
+ {
Status = gBS->InstallProtocolInterface (
&Partition->Handle,
&gEfiStorageSecurityCommandProtocolGuid,
@@ -495,13 +529,12 @@ InstallProtocolOnPartition ( gBS->OpenProtocol (
Device->Private->Controller,
&gEfiSdMmcPassThruProtocolGuid,
- (VOID **) &(Device->Private->PassThru),
+ (VOID **)&(Device->Private->PassThru),
Device->Private->DriverBindingHandle,
Partition->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
}
-
} else {
Status = EFI_INVALID_PARAMETER;
}
@@ -532,27 +565,27 @@ Error: EFI_STATUS
EFIAPI
DiscoverEmmcDevice (
- IN EMMC_DRIVER_PRIVATE_DATA *Private,
- IN UINT8 Slot,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EMMC_DRIVER_PRIVATE_DATA *Private,
+ IN UINT8 Slot,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EMMC_DEVICE *Device;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *RemainingEmmcDevPath;
- EFI_DEV_PATH *Node;
- EFI_HANDLE DeviceHandle;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- UINT8 Index;
+ EFI_STATUS Status;
+ EMMC_DEVICE *Device;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *RemainingEmmcDevPath;
+ EFI_DEV_PATH *Node;
+ EFI_HANDLE DeviceHandle;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ UINT8 Index;
Device = NULL;
DevicePath = NULL;
NewDevicePath = NULL;
RemainingDevicePath = NULL;
- PassThru = Private->PassThru;
- Device = &Private->Device[Slot];
+ PassThru = Private->PassThru;
+ Device = &Private->Device[Slot];
//
// Build Device Path to check if the EMMC device present at the slot.
@@ -562,7 +595,7 @@ DiscoverEmmcDevice ( Slot,
&DevicePath
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -582,7 +615,7 @@ DiscoverEmmcDevice ( DeviceHandle = NULL;
RemainingEmmcDevPath = NewDevicePath;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingEmmcDevPath, &DeviceHandle);
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingEmmcDevPath, &DeviceHandle);
//
// The device path to the EMMC device doesn't exist. It means the corresponding device private data hasn't been initialized.
//
@@ -594,7 +627,7 @@ DiscoverEmmcDevice ( // Expose user area in the Sd memory card to upper layer.
//
Status = DiscoverAllPartitions (Device);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
FreePool (NewDevicePath);
goto Error;
}
@@ -605,7 +638,7 @@ DiscoverEmmcDevice ( EFI_NATIVE_INTERFACE,
Device->DevicePath
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
FreePool (NewDevicePath);
goto Error;
}
@@ -639,10 +672,11 @@ DiscoverEmmcDevice ( //
// Enumerate the specified partition
//
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
+ Node = (EFI_DEV_PATH *)RemainingDevicePath;
if ((DevicePathType (&Node->DevPath) != HARDWARE_DEVICE_PATH) ||
(DevicePathSubType (&Node->DevPath) != HW_CONTROLLER_DP) ||
- (DevicePathNodeLength (&Node->DevPath) != sizeof (CONTROLLER_DEVICE_PATH))) {
+ (DevicePathNodeLength (&Node->DevPath) != sizeof (CONTROLLER_DEVICE_PATH)))
+ {
Status = EFI_INVALID_PARAMETER;
goto Error;
}
@@ -707,15 +741,15 @@ Error: EFI_STATUS
EFIAPI
EmmcDxeDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- UINT8 Slot;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ UINT8 Slot;
//
// Test EFI_SD_MMC_PASS_THRU_PROTOCOL on the controller handle.
@@ -723,7 +757,7 @@ EmmcDxeDriverBindingSupported ( Status = gBS->OpenProtocol (
Controller,
&gEfiSdMmcPassThruProtocolGuid,
- (VOID**) &PassThru,
+ (VOID **)&PassThru,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -772,7 +806,7 @@ EmmcDxeDriverBindingSupported ( Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ (VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -818,27 +852,27 @@ EmmcDxeDriverBindingSupported ( EFI_STATUS
EFIAPI
EmmcDxeDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EMMC_DRIVER_PRIVATE_DATA *Private;
- UINT8 Slot;
+ EFI_STATUS Status;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EMMC_DRIVER_PRIVATE_DATA *Private;
+ UINT8 Slot;
Private = NULL;
PassThru = NULL;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSdMmcPassThruProtocolGuid,
- (VOID **) &PassThru,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiSdMmcPassThruProtocolGuid,
+ (VOID **)&PassThru,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if ((EFI_ERROR (Status)) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
@@ -856,7 +890,7 @@ EmmcDxeDriverBindingStart ( Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ (VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -880,7 +914,7 @@ EmmcDxeDriverBindingStart ( Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
- (VOID **) &Private,
+ (VOID **)&Private,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -933,6 +967,7 @@ Error: FreePool (Private);
}
}
+
return Status;
}
@@ -965,10 +1000,10 @@ Error: EFI_STATUS
EFIAPI
EmmcDxeDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -991,7 +1026,7 @@ EmmcDxeDriverBindingStop ( Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
- (VOID **) &Private,
+ (VOID **)&Private,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1005,7 +1040,7 @@ EmmcDxeDriverBindingStop ( Status = gBS->OpenProtocol (
Device->Handle,
&gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
+ (VOID **)&DevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1013,6 +1048,7 @@ EmmcDxeDriverBindingStop ( if (EFI_ERROR (Status)) {
continue;
}
+
ASSERT (DevicePath == Device->DevicePath);
gBS->UninstallProtocolInterface (
Device->Handle,
@@ -1023,16 +1059,16 @@ EmmcDxeDriverBindingStop ( }
gBS->UninstallProtocolInterface (
- Controller,
- &gEfiCallerIdGuid,
- Private
- );
+ Controller,
+ &gEfiCallerIdGuid,
+ Private
+ );
gBS->CloseProtocol (
- Controller,
- &gEfiSdMmcPassThruProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiSdMmcPassThruProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
FreePool (Private);
return EFI_SUCCESS;
@@ -1044,7 +1080,7 @@ EmmcDxeDriverBindingStop ( Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
+ (VOID **)&BlockIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1053,7 +1089,7 @@ EmmcDxeDriverBindingStop ( Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIo2ProtocolGuid,
- (VOID **) &BlockIo2,
+ (VOID **)&BlockIo2,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1073,7 +1109,8 @@ EmmcDxeDriverBindingStop ( for (Link = GetFirstNode (&Partition->Queue);
!IsNull (&Partition->Queue, Link);
- Link = NextLink) {
+ Link = NextLink)
+ {
NextLink = GetNextNode (&Partition->Queue, Link);
RemoveEntryList (Link);
@@ -1132,7 +1169,7 @@ EmmcDxeDriverBindingStop ( Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiStorageSecurityCommandProtocolGuid,
- (VOID **) &StorageSecurity,
+ (VOID **)&StorageSecurity,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1146,13 +1183,13 @@ EmmcDxeDriverBindingStop ( );
if (EFI_ERROR (Status)) {
gBS->OpenProtocol (
- Controller,
- &gEfiSdMmcPassThruProtocolGuid,
- (VOID **) &Partition->Device->Private->PassThru,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
+ Controller,
+ &gEfiSdMmcPassThruProtocolGuid,
+ (VOID **)&Partition->Device->Private->PassThru,
+ This->DriverBindingHandle,
+ ChildHandleBuffer[Index],
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
AllChildrenStopped = FALSE;
continue;
}
@@ -1181,11 +1218,11 @@ EmmcDxeDriverBindingStop ( EFI_STATUS
EFIAPI
InitializeEmmcDxe (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Install driver model protocol(s).
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h index 5ecce41dee..a83d4ec1df 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h @@ -40,11 +40,11 @@ //
// Global Variables
//
-extern EFI_DRIVER_BINDING_PROTOCOL gEmmcDxeDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmmcDxeComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmmcDxeComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gEmmcDxeDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gEmmcDxeComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gEmmcDxeComponentName2;
-#define EMMC_PARTITION_SIGNATURE SIGNATURE_32 ('E', 'm', 'm', 'P')
+#define EMMC_PARTITION_SIGNATURE SIGNATURE_32 ('E', 'm', 'm', 'P')
#define EMMC_PARTITION_DATA_FROM_BLKIO(a) \
CR(a, EMMC_PARTITION, BlockIo, EMMC_PARTITION_SIGNATURE)
@@ -64,72 +64,72 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gEmmcDxeComponentName2; //
// Take 2.5 seconds as generic time out value, 1 microsecond as unit.
//
-#define EMMC_GENERIC_TIMEOUT 2500 * 1000
+#define EMMC_GENERIC_TIMEOUT 2500 * 1000
-#define EMMC_REQUEST_SIGNATURE SIGNATURE_32 ('E', 'm', 'R', 'e')
+#define EMMC_REQUEST_SIGNATURE SIGNATURE_32 ('E', 'm', 'R', 'e')
-typedef struct _EMMC_DEVICE EMMC_DEVICE;
-typedef struct _EMMC_DRIVER_PRIVATE_DATA EMMC_DRIVER_PRIVATE_DATA;
+typedef struct _EMMC_DEVICE EMMC_DEVICE;
+typedef struct _EMMC_DRIVER_PRIVATE_DATA EMMC_DRIVER_PRIVATE_DATA;
//
// Asynchronous I/O request.
//
typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
+ UINT32 Signature;
+ LIST_ENTRY Link;
- EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
- EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
- EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
+ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk;
+ EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk;
+ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet;
- BOOLEAN IsEnd;
+ BOOLEAN IsEnd;
- EFI_BLOCK_IO2_TOKEN *Token;
- EFI_EVENT Event;
+ EFI_BLOCK_IO2_TOKEN *Token;
+ EFI_EVENT Event;
} EMMC_REQUEST;
#define EMMC_REQUEST_FROM_LINK(a) \
CR(a, EMMC_REQUEST, Link, EMMC_REQUEST_SIGNATURE)
typedef struct {
- UINT32 Signature;
- BOOLEAN Enable;
- EMMC_PARTITION_TYPE PartitionType;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_BLOCK_IO_PROTOCOL BlockIo;
- EFI_BLOCK_IO2_PROTOCOL BlockIo2;
- EFI_BLOCK_IO_MEDIA BlockMedia;
- EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;
- EFI_ERASE_BLOCK_PROTOCOL EraseBlock;
- EFI_DISK_INFO_PROTOCOL DiskInfo;
-
- LIST_ENTRY Queue;
-
- EMMC_DEVICE *Device;
+ UINT32 Signature;
+ BOOLEAN Enable;
+ EMMC_PARTITION_TYPE PartitionType;
+ EFI_HANDLE Handle;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_BLOCK_IO_PROTOCOL BlockIo;
+ EFI_BLOCK_IO2_PROTOCOL BlockIo2;
+ EFI_BLOCK_IO_MEDIA BlockMedia;
+ EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;
+ EFI_ERASE_BLOCK_PROTOCOL EraseBlock;
+ EFI_DISK_INFO_PROTOCOL DiskInfo;
+
+ LIST_ENTRY Queue;
+
+ EMMC_DEVICE *Device;
} EMMC_PARTITION;
//
// Up to 6 slots per EMMC PCI host controller
//
-#define EMMC_MAX_DEVICES 6
+#define EMMC_MAX_DEVICES 6
//
// Up to 8 partitions per EMMC device.
//
-#define EMMC_MAX_PARTITIONS 8
-#define EMMC_MODEL_NAME_MAX_LEN 32
+#define EMMC_MAX_PARTITIONS 8
+#define EMMC_MODEL_NAME_MAX_LEN 32
struct _EMMC_DEVICE {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT8 Slot;
- BOOLEAN SectorAddressing;
-
- EMMC_PARTITION Partition[EMMC_MAX_PARTITIONS];
- EMMC_CSD Csd;
- EMMC_CID Cid;
- EMMC_EXT_CSD ExtCsd;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
+ EFI_HANDLE Handle;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINT8 Slot;
+ BOOLEAN SectorAddressing;
+
+ EMMC_PARTITION Partition[EMMC_MAX_PARTITIONS];
+ EMMC_CSD Csd;
+ EMMC_CID Cid;
+ EMMC_EXT_CSD ExtCsd;
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;
//
// The model name consists of three fields in CID register
// 1) OEM/Application ID (2 bytes)
@@ -137,21 +137,21 @@ struct _EMMC_DEVICE { // 3) Product Serial Number (4 bytes)
// The delimiters of these fields are whitespace.
//
- CHAR16 ModelName[EMMC_MODEL_NAME_MAX_LEN];
- EMMC_DRIVER_PRIVATE_DATA *Private;
-} ;
+ CHAR16 ModelName[EMMC_MODEL_NAME_MAX_LEN];
+ EMMC_DRIVER_PRIVATE_DATA *Private;
+};
//
// EMMC DXE driver private data structure
//
struct _EMMC_DRIVER_PRIVATE_DATA {
- EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
- EFI_HANDLE Controller;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_HANDLE DriverBindingHandle;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru;
+ EFI_HANDLE Controller;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_HANDLE DriverBindingHandle;
- EMMC_DEVICE Device[EMMC_MAX_DEVICES];
-} ;
+ EMMC_DEVICE Device[EMMC_MAX_DEVICES];
+};
/**
Tests to see if this driver supports a given controller. If a child device is provided,
@@ -198,9 +198,9 @@ struct _EMMC_DRIVER_PRIVATE_DATA { EFI_STATUS
EFIAPI
EmmcDxeDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -241,9 +241,9 @@ EmmcDxeDriverBindingSupported ( EFI_STATUS
EFIAPI
EmmcDxeDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -275,10 +275,10 @@ EmmcDxeDriverBindingStart ( EFI_STATUS
EFIAPI
EmmcDxeDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -399,11 +399,11 @@ EmmcDxeComponentNameGetDriverName ( EFI_STATUS
EFIAPI
EmmcDxeComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
/**
@@ -419,8 +419,8 @@ EmmcDxeComponentNameGetControllerName ( **/
EFI_STATUS
EmmcSelect (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca
);
/**
@@ -437,9 +437,9 @@ EmmcSelect ( **/
EFI_STATUS
EmmcSendStatus (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT UINT32 *DevStatus
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT UINT32 *DevStatus
);
/**
@@ -456,9 +456,9 @@ EmmcSendStatus ( **/
EFI_STATUS
EmmcGetCsd (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT EMMC_CSD *Csd
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT EMMC_CSD *Csd
);
/**
@@ -475,9 +475,9 @@ EmmcGetCsd ( **/
EFI_STATUS
EmmcGetCid (
- IN EMMC_DEVICE *Device,
- IN UINT16 Rca,
- OUT EMMC_CID *Cid
+ IN EMMC_DEVICE *Device,
+ IN UINT16 Rca,
+ OUT EMMC_CID *Cid
);
/**
@@ -493,9 +493,8 @@ EmmcGetCid ( **/
EFI_STATUS
EmmcGetExtCsd (
- IN EMMC_DEVICE *Device,
- OUT EMMC_EXT_CSD *ExtCsd
+ IN EMMC_DEVICE *Device,
+ OUT EMMC_EXT_CSD *ExtCsd
);
#endif
-
|