MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -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;
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;
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).