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

@@ -32,11 +32,11 @@ EDKII_IOMMU_PPI *mIoMmu;
**/
EFI_STATUS
IoMmuMap (
IN EDKII_IOMMU_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
IN EDKII_IOMMU_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
)
{
EFI_STATUS Status;
@@ -54,23 +54,25 @@ IoMmuMap (
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
switch (Operation) {
case EdkiiIoMmuOperationBusMasterRead:
case EdkiiIoMmuOperationBusMasterRead64:
Attribute = EDKII_IOMMU_ACCESS_READ;
break;
case EdkiiIoMmuOperationBusMasterWrite:
case EdkiiIoMmuOperationBusMasterWrite64:
Attribute = EDKII_IOMMU_ACCESS_WRITE;
break;
case EdkiiIoMmuOperationBusMasterCommonBuffer:
case EdkiiIoMmuOperationBusMasterCommonBuffer64:
Attribute = EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE;
break;
default:
ASSERT(FALSE);
return EFI_INVALID_PARAMETER;
case EdkiiIoMmuOperationBusMasterRead:
case EdkiiIoMmuOperationBusMasterRead64:
Attribute = EDKII_IOMMU_ACCESS_READ;
break;
case EdkiiIoMmuOperationBusMasterWrite:
case EdkiiIoMmuOperationBusMasterWrite64:
Attribute = EDKII_IOMMU_ACCESS_WRITE;
break;
case EdkiiIoMmuOperationBusMasterCommonBuffer:
case EdkiiIoMmuOperationBusMasterCommonBuffer64:
Attribute = EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE;
break;
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
}
Status = mIoMmu->SetAttribute (
mIoMmu,
*Mapping,
@@ -81,9 +83,10 @@ IoMmuMap (
}
} else {
*DeviceAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress;
*Mapping = NULL;
Status = EFI_SUCCESS;
*Mapping = NULL;
Status = EFI_SUCCESS;
}
return Status;
}
@@ -98,7 +101,7 @@ IoMmuMap (
**/
EFI_STATUS
IoMmuUnmap (
IN VOID *Mapping
IN VOID *Mapping
)
{
EFI_STATUS Status;
@@ -109,6 +112,7 @@ IoMmuUnmap (
} else {
Status = EFI_SUCCESS;
}
return Status;
}
@@ -142,7 +146,7 @@ IoMmuAllocateBuffer (
UINTN NumberOfBytes;
EFI_PHYSICAL_ADDRESS HostPhyAddress;
*HostAddress = NULL;
*HostAddress = NULL;
*DeviceAddress = 0;
if (mIoMmu != NULL) {
@@ -157,18 +161,19 @@ IoMmuAllocateBuffer (
return EFI_OUT_OF_RESOURCES;
}
NumberOfBytes = EFI_PAGES_TO_SIZE(Pages);
Status = mIoMmu->Map (
mIoMmu,
EdkiiIoMmuOperationBusMasterCommonBuffer,
*HostAddress,
&NumberOfBytes,
DeviceAddress,
Mapping
);
NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
Status = mIoMmu->Map (
mIoMmu,
EdkiiIoMmuOperationBusMasterCommonBuffer,
*HostAddress,
&NumberOfBytes,
DeviceAddress,
Mapping
);
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
Status = mIoMmu->SetAttribute (
mIoMmu,
*Mapping,
@@ -186,10 +191,12 @@ IoMmuAllocateBuffer (
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
*HostAddress = (VOID *)(UINTN)HostPhyAddress;
*HostAddress = (VOID *)(UINTN)HostPhyAddress;
*DeviceAddress = HostPhyAddress;
*Mapping = NULL;
*Mapping = NULL;
}
return Status;
}
@@ -207,9 +214,9 @@ IoMmuAllocateBuffer (
**/
EFI_STATUS
IoMmuFreeBuffer (
IN UINTN Pages,
IN VOID *HostAddress,
IN VOID *Mapping
IN UINTN Pages,
IN VOID *HostAddress,
IN VOID *Mapping
)
{
EFI_STATUS Status;
@@ -221,6 +228,7 @@ IoMmuFreeBuffer (
} else {
Status = EFI_SUCCESS;
}
return Status;
}
@@ -239,4 +247,3 @@ IoMmuInit (
(VOID **)&mIoMmu
);
}

View File

@@ -10,7 +10,7 @@
//
// Template for EMMC HC Slot Data.
//
EMMC_PEIM_HC_SLOT gEmmcHcSlotTemplate = {
EMMC_PEIM_HC_SLOT gEmmcHcSlotTemplate = {
EMMC_PEIM_SLOT_SIG, // Signature
{ // Media
{
@@ -97,7 +97,7 @@ EMMC_PEIM_HC_SLOT gEmmcHcSlotTemplate = {
0,
},
{ // ExtCsd
{0},
{ 0 },
},
TRUE, // SectorAddressing
NULL // Private
@@ -106,7 +106,7 @@ EMMC_PEIM_HC_SLOT gEmmcHcSlotTemplate = {
//
// Template for EMMC HC Private Data.
//
EMMC_PEIM_HC_PRIVATE_DATA gEmmcHcPrivateTemplate = {
EMMC_PEIM_HC_PRIVATE_DATA gEmmcHcPrivateTemplate = {
EMMC_PEIM_SIG, // Signature
NULL, // Pool
{ // BlkIoPpi
@@ -158,6 +158,7 @@ EMMC_PEIM_HC_PRIVATE_DATA gEmmcHcPrivateTemplate = {
0, // SlotNum
0 // TotalBlkIoDevices
};
/**
Gets the count of block I/O devices that one specific block driver detects.
@@ -185,9 +186,9 @@ EmmcBlockIoPeimGetDeviceNo (
OUT UINTN *NumberBlockDevices
)
{
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
*NumberBlockDevices = Private->TotalBlkIoDevices;
return EFI_SUCCESS;
}
@@ -242,11 +243,11 @@ EmmcBlockIoPeimGetMediaInfo (
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
)
{
EMMC_PEIM_HC_PRIVATE_DATA *Private;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
BOOLEAN Found;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
BOOLEAN Found;
Found = FALSE;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
@@ -259,12 +260,13 @@ EmmcBlockIoPeimGetMediaInfo (
MediaNum = 0;
for (SlotNum = 0; SlotNum < Private->SlotNum; SlotNum++) {
for (MediaNum = 0; MediaNum < Private->Slot[SlotNum].MediaNum; MediaNum++) {
Location ++;
Location++;
if (Location == DeviceIndex) {
Found = TRUE;
break;
}
}
if (Found) {
break;
}
@@ -323,17 +325,17 @@ EmmcBlockIoPeimReadBlocks (
OUT VOID *Buffer
)
{
EFI_STATUS Status;
UINT32 BlockSize;
UINTN NumberOfBlocks;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
UINT8 PartitionConfig;
UINTN Remaining;
UINT32 MaxBlock;
BOOLEAN Found;
EFI_STATUS Status;
UINT32 BlockSize;
UINTN NumberOfBlocks;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
UINT8 PartitionConfig;
UINTN Remaining;
UINT32 MaxBlock;
BOOLEAN Found;
Status = EFI_SUCCESS;
Found = FALSE;
@@ -358,12 +360,13 @@ EmmcBlockIoPeimReadBlocks (
MediaNum = 0;
for (SlotNum = 0; SlotNum < Private->SlotNum; SlotNum++) {
for (MediaNum = 0; MediaNum < Private->Slot[SlotNum].MediaNum; MediaNum++) {
Location ++;
Location++;
if (Location == DeviceIndex) {
Found = TRUE;
break;
}
}
if (Found) {
break;
}
@@ -385,20 +388,22 @@ EmmcBlockIoPeimReadBlocks (
//
PartitionConfig = Private->Slot[SlotNum].ExtCsd.PartitionConfig;
if ((PartitionConfig & 0x7) != Private->Slot[SlotNum].PartitionType[MediaNum]) {
PartitionConfig &= (UINT8)~0x7;
PartitionConfig &= (UINT8) ~0x7;
PartitionConfig |= Private->Slot[SlotNum].PartitionType[MediaNum];
Status = EmmcPeimSwitch (
&Private->Slot[SlotNum],
0x3,
OFFSET_OF (EMMC_EXT_CSD, PartitionConfig),
PartitionConfig,
0x0
);
Status = EmmcPeimSwitch (
&Private->Slot[SlotNum],
0x3,
OFFSET_OF (EMMC_EXT_CSD, PartitionConfig),
PartitionConfig,
0x0
);
if (EFI_ERROR (Status)) {
return Status;
}
Private->Slot[SlotNum].ExtCsd.PartitionConfig = PartitionConfig;
}
//
// Start to execute data transfer. The max block number in single cmd is 65535 blocks.
//
@@ -418,15 +423,16 @@ EmmcBlockIoPeimReadBlocks (
}
BufferSize = NumberOfBlocks * BlockSize;
Status = EmmcPeimRwMultiBlocks (&Private->Slot[SlotNum], StartLBA, BlockSize, Buffer, BufferSize, TRUE);
Status = EmmcPeimRwMultiBlocks (&Private->Slot[SlotNum], StartLBA, BlockSize, Buffer, BufferSize, TRUE);
if (EFI_ERROR (Status)) {
return Status;
}
StartLBA += NumberOfBlocks;
Buffer = (UINT8*)Buffer + BufferSize;
Buffer = (UINT8 *)Buffer + BufferSize;
Remaining -= NumberOfBlocks;
}
return Status;
}
@@ -452,14 +458,14 @@ EmmcBlockIoPeimReadBlocks (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimGetDeviceNo2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
)
{
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
*NumberBlockDevices = Private->TotalBlkIoDevices;
return EFI_SUCCESS;
@@ -509,29 +515,29 @@ EmmcBlockIoPeimGetDeviceNo2 (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimGetMediaInfo2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
)
{
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EFI_PEI_BLOCK_IO_MEDIA Media;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
BOOLEAN Found;
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EFI_PEI_BLOCK_IO_MEDIA Media;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Location;
BOOLEAN Found;
Found = FALSE;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Status = EmmcBlockIoPeimGetMediaInfo (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
&Media
);
Status = EmmcBlockIoPeimGetMediaInfo (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
&Media
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -540,12 +546,13 @@ EmmcBlockIoPeimGetMediaInfo2 (
MediaNum = 0;
for (SlotNum = 0; SlotNum < Private->SlotNum; SlotNum++) {
for (MediaNum = 0; MediaNum < Private->Slot[SlotNum].MediaNum; MediaNum++) {
Location ++;
Location++;
if (Location == DeviceIndex) {
Found = TRUE;
break;
}
}
if (Found) {
break;
}
@@ -592,28 +599,28 @@ EmmcBlockIoPeimGetMediaInfo2 (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimReadBlocks2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
Status = EFI_SUCCESS;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Status = EFI_SUCCESS;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Status = EmmcBlockIoPeimReadBlocks (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
StartLBA,
BufferSize,
Buffer
);
Status = EmmcBlockIoPeimReadBlocks (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
StartLBA,
BufferSize,
Buffer
);
return Status;
}
@@ -636,7 +643,7 @@ EmmcBlockIoPeimEndOfPei (
IN VOID *Ppi
)
{
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (NotifyDescriptor);
@@ -660,26 +667,26 @@ EmmcBlockIoPeimEndOfPei (
EFI_STATUS
EFIAPI
InitializeEmmcBlockIoPeim (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EDKII_SD_MMC_HOST_CONTROLLER_PPI *SdMmcHcPpi;
UINT32 Index;
UINT32 PartitionIndex;
UINTN *MmioBase;
UINT8 BarNum;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Controller;
UINT64 Capacity;
EMMC_EXT_CSD *ExtCsd;
EMMC_HC_SLOT_CAP Capability;
EMMC_PEIM_HC_SLOT *Slot;
UINT32 SecCount;
UINT32 GpSizeMult;
EFI_STATUS Status;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
EDKII_SD_MMC_HOST_CONTROLLER_PPI *SdMmcHcPpi;
UINT32 Index;
UINT32 PartitionIndex;
UINTN *MmioBase;
UINT8 BarNum;
UINT8 SlotNum;
UINT8 MediaNum;
UINT8 Controller;
UINT64 Capacity;
EMMC_EXT_CSD *ExtCsd;
EMMC_HC_SLOT_CAP Capability;
EMMC_PEIM_HC_SLOT *Slot;
UINT32 SecCount;
UINT32 GpSizeMult;
//
// Shadow this PEIM to run from memory
@@ -695,7 +702,7 @@ InitializeEmmcBlockIoPeim (
&gEdkiiPeiSdMmcHostControllerPpiGuid,
0,
NULL,
(VOID **) &SdMmcHcPpi
(VOID **)&SdMmcHcPpi
);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
@@ -724,8 +731,9 @@ InitializeEmmcBlockIoPeim (
Status = EFI_OUT_OF_RESOURCES;
break;
}
Private->BlkIoPpiList.Ppi = (VOID*)&Private->BlkIoPpi;
Private->BlkIo2PpiList.Ppi = (VOID*)&Private->BlkIo2Ppi;
Private->BlkIoPpiList.Ppi = (VOID *)&Private->BlkIoPpi;
Private->BlkIo2PpiList.Ppi = (VOID *)&Private->BlkIo2Ppi;
//
// Initialize the memory pool which will be used in all transactions.
//
@@ -740,6 +748,7 @@ InitializeEmmcBlockIoPeim (
if (EFI_ERROR (Status)) {
continue;
}
if (Capability.SlotType != 0x1) {
DEBUG ((DEBUG_INFO, "The slot at 0x%x is not embedded slot type\n", MmioBase[Index]));
Status = EFI_UNSUPPORTED;
@@ -750,10 +759,12 @@ InitializeEmmcBlockIoPeim (
if (EFI_ERROR (Status)) {
continue;
}
Status = EmmcPeimHcCardDetect (MmioBase[Index]);
if (EFI_ERROR (Status)) {
continue;
}
Status = EmmcPeimHcInitHost (MmioBase[Index]);
if (EFI_ERROR (Status)) {
continue;
@@ -777,6 +788,7 @@ InitializeEmmcBlockIoPeim (
Status = EFI_UNSUPPORTED;
continue;
}
if ((ExtCsd->PartitioningSupport & BIT0) != BIT0) {
DEBUG ((DEBUG_ERROR, "The EMMC device doesn't support Partition Feature!!!\n"));
Status = EFI_UNSUPPORTED;
@@ -786,7 +798,7 @@ InitializeEmmcBlockIoPeim (
for (PartitionIndex = 0; PartitionIndex < EMMC_PEIM_MAX_PARTITIONS; PartitionIndex++) {
switch (PartitionIndex) {
case EmmcPartitionUserData:
SecCount = *(UINT32*)&ExtCsd->SecCount;
SecCount = *(UINT32 *)&ExtCsd->SecCount;
Capacity = MultU64x32 ((UINT64)SecCount, 0x200);
break;
case EmmcPartitionBoot1:
@@ -798,19 +810,19 @@ InitializeEmmcBlockIoPeim (
break;
case EmmcPartitionGP1:
GpSizeMult = (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 = (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 = (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 = (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);
@@ -820,13 +832,15 @@ InitializeEmmcBlockIoPeim (
MediaNum = Slot->MediaNum;
if (Capacity != 0) {
Slot->Media[MediaNum].LastBlock = DivU64x32 (Capacity, Slot->Media[MediaNum].BlockSize) - 1;
Slot->PartitionType[MediaNum] = PartitionIndex;
Slot->PartitionType[MediaNum] = PartitionIndex;
Private->TotalBlkIoDevices++;
Slot->MediaNum++;
}
}
Private->SlotNum++;
}
Controller++;
if (!EFI_ERROR (Status)) {

View File

@@ -26,31 +26,31 @@
#include <IndustryStandard/Emmc.h>
typedef struct _EMMC_PEIM_HC_PRIVATE_DATA EMMC_PEIM_HC_PRIVATE_DATA;
typedef struct _EMMC_PEIM_HC_SLOT EMMC_PEIM_HC_SLOT;
typedef struct _EMMC_TRB EMMC_TRB;
typedef struct _EMMC_PEIM_HC_PRIVATE_DATA EMMC_PEIM_HC_PRIVATE_DATA;
typedef struct _EMMC_PEIM_HC_SLOT EMMC_PEIM_HC_SLOT;
typedef struct _EMMC_TRB EMMC_TRB;
#include "EmmcHci.h"
#include "EmmcHcMem.h"
#define EMMC_PEIM_SIG SIGNATURE_32 ('E', 'M', 'C', 'P')
#define EMMC_PEIM_SLOT_SIG SIGNATURE_32 ('E', 'M', 'C', 'S')
#define EMMC_PEIM_SIG SIGNATURE_32 ('E', 'M', 'C', 'P')
#define EMMC_PEIM_SLOT_SIG SIGNATURE_32 ('E', 'M', 'C', 'S')
#define EMMC_PEIM_MAX_SLOTS 6
#define EMMC_PEIM_MAX_PARTITIONS 8
#define EMMC_PEIM_MAX_SLOTS 6
#define EMMC_PEIM_MAX_PARTITIONS 8
struct _EMMC_PEIM_HC_SLOT {
UINT32 Signature;
EFI_PEI_BLOCK_IO2_MEDIA Media[EMMC_PEIM_MAX_PARTITIONS];
UINT8 MediaNum;
EMMC_PARTITION_TYPE PartitionType[EMMC_PEIM_MAX_PARTITIONS];
UINT32 Signature;
EFI_PEI_BLOCK_IO2_MEDIA Media[EMMC_PEIM_MAX_PARTITIONS];
UINT8 MediaNum;
EMMC_PARTITION_TYPE PartitionType[EMMC_PEIM_MAX_PARTITIONS];
UINTN EmmcHcBase;
EMMC_HC_SLOT_CAP Capability;
EMMC_CSD Csd;
EMMC_EXT_CSD ExtCsd;
BOOLEAN SectorAddressing;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
UINTN EmmcHcBase;
EMMC_HC_SLOT_CAP Capability;
EMMC_CSD Csd;
EMMC_EXT_CSD ExtCsd;
BOOLEAN SectorAddressing;
EMMC_PEIM_HC_PRIVATE_DATA *Private;
};
struct _EMMC_PEIM_HC_PRIVATE_DATA {
@@ -71,27 +71,27 @@ struct _EMMC_PEIM_HC_PRIVATE_DATA {
UINT8 TotalBlkIoDevices;
};
#define EMMC_TIMEOUT MultU64x32((UINT64)(3), 1000000)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, BlkIoPpi, EMMC_PEIM_SIG)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, EMMC_PEIM_SIG)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, EMMC_PEIM_SIG)
#define EMMC_TIMEOUT MultU64x32((UINT64)(3), 1000000)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, BlkIoPpi, EMMC_PEIM_SIG)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, EMMC_PEIM_SIG)
#define GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, EMMC_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, EMMC_PEIM_SIG)
struct _EMMC_TRB {
EMMC_PEIM_HC_SLOT *Slot;
UINT16 BlockSize;
EMMC_PEIM_HC_SLOT *Slot;
UINT16 BlockSize;
EMMC_COMMAND_PACKET *Packet;
VOID *Data;
UINT32 DataLen;
BOOLEAN Read;
EFI_PHYSICAL_ADDRESS DataPhy;
VOID *DataMap;
EMMC_HC_TRANSFER_MODE Mode;
EMMC_COMMAND_PACKET *Packet;
VOID *Data;
UINT32 DataLen;
BOOLEAN Read;
EFI_PHYSICAL_ADDRESS DataPhy;
VOID *DataMap;
EMMC_HC_TRANSFER_MODE Mode;
UINT64 Timeout;
UINT64 Timeout;
EMMC_HC_ADMA_DESC_LINE *AdmaDesc;
UINTN AdmaDescSize;
EMMC_HC_ADMA_DESC_LINE *AdmaDesc;
UINTN AdmaDescSize;
};
/**
@@ -238,9 +238,9 @@ EmmcBlockIoPeimReadBlocks (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimGetDeviceNo2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
);
/**
@@ -287,10 +287,10 @@ EmmcBlockIoPeimGetDeviceNo2 (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimGetMediaInfo2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
);
/**
@@ -330,12 +330,12 @@ EmmcBlockIoPeimGetMediaInfo2 (
EFI_STATUS
EFIAPI
EmmcBlockIoPeimReadBlocks2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
);
/**
@@ -349,7 +349,7 @@ EmmcBlockIoPeimReadBlocks2 (
**/
EFI_STATUS
EmmcPeimInitMemPool (
IN EMMC_PEIM_HC_PRIVATE_DATA *Private
IN EMMC_PEIM_HC_PRIVATE_DATA *Private
);
/**
@@ -363,7 +363,7 @@ EmmcPeimInitMemPool (
**/
EFI_STATUS
EmmcPeimFreeMemPool (
IN EMMC_PEIM_MEM_POOL *Pool
IN EMMC_PEIM_MEM_POOL *Pool
);
/**
@@ -378,8 +378,8 @@ EmmcPeimFreeMemPool (
**/
VOID *
EmmcPeimAllocateMem (
IN EMMC_PEIM_MEM_POOL *Pool,
IN UINTN Size
IN EMMC_PEIM_MEM_POOL *Pool,
IN UINTN Size
);
/**
@@ -392,9 +392,9 @@ EmmcPeimAllocateMem (
**/
VOID
EmmcPeimFreeMem (
IN EMMC_PEIM_MEM_POOL *Pool,
IN VOID *Mem,
IN UINTN Size
IN EMMC_PEIM_MEM_POOL *Pool,
IN VOID *Mem,
IN UINTN Size
);
/**
@@ -426,11 +426,11 @@ IoMmuInit (
**/
EFI_STATUS
IoMmuMap (
IN EDKII_IOMMU_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
IN EDKII_IOMMU_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
/**
@@ -444,7 +444,7 @@ IoMmuMap (
**/
EFI_STATUS
IoMmuUnmap (
IN VOID *Mapping
IN VOID *Mapping
);
/**
@@ -487,9 +487,9 @@ IoMmuAllocateBuffer (
**/
EFI_STATUS
IoMmuFreeBuffer (
IN UINTN Pages,
IN VOID *HostAddress,
IN VOID *Mapping
IN UINTN Pages,
IN VOID *HostAddress,
IN VOID *Mapping
);
/**

View File

@@ -18,25 +18,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EMMC_PEIM_MEM_BLOCK *
EmmcPeimAllocMemBlock (
IN UINTN Pages
IN UINTN Pages
)
{
EMMC_PEIM_MEM_BLOCK *Block;
VOID *BufHost;
VOID *Mapping;
EFI_PHYSICAL_ADDRESS MappedAddr;
EFI_STATUS Status;
VOID *TempPtr;
EMMC_PEIM_MEM_BLOCK *Block;
VOID *BufHost;
VOID *Mapping;
EFI_PHYSICAL_ADDRESS MappedAddr;
EFI_STATUS Status;
VOID *TempPtr;
TempPtr = NULL;
Block = NULL;
Status = PeiServicesAllocatePool (sizeof(EMMC_PEIM_MEM_BLOCK), &TempPtr);
Status = PeiServicesAllocatePool (sizeof (EMMC_PEIM_MEM_BLOCK), &TempPtr);
if (EFI_ERROR (Status)) {
return NULL;
}
ZeroMem ((VOID*)(UINTN)TempPtr, sizeof(EMMC_PEIM_MEM_BLOCK));
ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (EMMC_PEIM_MEM_BLOCK));
//
// each bit in the bit array represents EMMC_PEIM_MEM_UNIT
@@ -44,18 +44,18 @@ EmmcPeimAllocMemBlock (
//
ASSERT (EMMC_PEIM_MEM_UNIT * 8 <= EFI_PAGE_SIZE);
Block = (EMMC_PEIM_MEM_BLOCK*)(UINTN)TempPtr;
Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
Block->BitsLen = Block->BufLen / (EMMC_PEIM_MEM_UNIT * 8);
Block = (EMMC_PEIM_MEM_BLOCK *)(UINTN)TempPtr;
Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
Block->BitsLen = Block->BufLen / (EMMC_PEIM_MEM_UNIT * 8);
Status = PeiServicesAllocatePool (Block->BitsLen, &TempPtr);
if (EFI_ERROR (Status)) {
return NULL;
}
ZeroMem ((VOID*)(UINTN)TempPtr, Block->BitsLen);
ZeroMem ((VOID *)(UINTN)TempPtr, Block->BitsLen);
Block->Bits = (UINT8*)(UINTN)TempPtr;
Block->Bits = (UINT8 *)(UINTN)TempPtr;
Status = IoMmuAllocateBuffer (
Pages,
@@ -67,10 +67,10 @@ EmmcPeimAllocMemBlock (
return NULL;
}
ZeroMem ((VOID*)(UINTN)BufHost, EFI_PAGES_TO_SIZE (Pages));
ZeroMem ((VOID *)(UINTN)BufHost, EFI_PAGES_TO_SIZE (Pages));
Block->BufHost = (UINT8 *) (UINTN) BufHost;
Block->Buf = (UINT8 *) (UINTN) MappedAddr;
Block->BufHost = (UINT8 *)(UINTN)BufHost;
Block->Buf = (UINT8 *)(UINTN)MappedAddr;
Block->Mapping = Mapping;
Block->Next = NULL;
@@ -86,8 +86,8 @@ EmmcPeimAllocMemBlock (
**/
VOID
EmmcPeimFreeMemBlock (
IN EMMC_PEIM_MEM_POOL *Pool,
IN EMMC_PEIM_MEM_BLOCK *Block
IN EMMC_PEIM_MEM_POOL *Pool,
IN EMMC_PEIM_MEM_BLOCK *Block
)
{
ASSERT ((Pool != NULL) && (Block != NULL));
@@ -107,22 +107,22 @@ EmmcPeimFreeMemBlock (
**/
VOID *
EmmcPeimAllocMemFromBlock (
IN EMMC_PEIM_MEM_BLOCK *Block,
IN UINTN Units
IN EMMC_PEIM_MEM_BLOCK *Block,
IN UINTN Units
)
{
UINTN Byte;
UINT8 Bit;
UINTN StartByte;
UINT8 StartBit;
UINTN Available;
UINTN Count;
UINTN Byte;
UINT8 Bit;
UINTN StartByte;
UINT8 StartBit;
UINTN Available;
UINTN Count;
ASSERT ((Block != 0) && (Units != 0));
StartByte = 0;
StartBit = 0;
Available = 0;
StartByte = 0;
StartBit = 0;
Available = 0;
for (Byte = 0, Bit = 0; Byte < Block->BitsLen;) {
//
@@ -138,13 +138,12 @@ EmmcPeimAllocMemFromBlock (
}
EMMC_PEIM_NEXT_BIT (Byte, Bit);
} else {
EMMC_PEIM_NEXT_BIT (Byte, Bit);
Available = 0;
StartByte = Byte;
StartBit = Bit;
Available = 0;
StartByte = Byte;
StartBit = Bit;
}
}
@@ -155,13 +154,13 @@ EmmcPeimAllocMemFromBlock (
//
// Mark the memory as allocated
//
Byte = StartByte;
Bit = StartBit;
Byte = StartByte;
Bit = StartBit;
for (Count = 0; Count < Units; Count++) {
ASSERT (!EMMC_PEIM_MEM_BIT_IS_SET (Block->Bits[Byte], Bit));
Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] | (UINT8) EMMC_PEIM_MEM_BIT (Bit));
Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] | (UINT8)EMMC_PEIM_MEM_BIT (Bit));
EMMC_PEIM_NEXT_BIT (Byte, Bit);
}
@@ -177,8 +176,8 @@ EmmcPeimAllocMemFromBlock (
**/
VOID
EmmcPeimInsertMemBlockToPool (
IN EMMC_PEIM_MEM_BLOCK *Head,
IN EMMC_PEIM_MEM_BLOCK *Block
IN EMMC_PEIM_MEM_BLOCK *Head,
IN EMMC_PEIM_MEM_BLOCK *Block
)
{
ASSERT ((Head != NULL) && (Block != NULL));
@@ -197,11 +196,10 @@ EmmcPeimInsertMemBlockToPool (
**/
BOOLEAN
EmmcPeimIsMemBlockEmpty (
IN EMMC_PEIM_MEM_BLOCK *Block
IN EMMC_PEIM_MEM_BLOCK *Block
)
{
UINTN Index;
UINTN Index;
for (Index = 0; Index < Block->BitsLen; Index++) {
if (Block->Bits[Index] != 0) {
@@ -212,8 +210,6 @@ EmmcPeimIsMemBlockEmpty (
return TRUE;
}
/**
Initialize the memory management pool for the host controller.
@@ -228,9 +224,9 @@ EmmcPeimInitMemPool (
IN EMMC_PEIM_HC_PRIVATE_DATA *Private
)
{
EMMC_PEIM_MEM_POOL *Pool;
EFI_STATUS Status;
VOID *TempPtr;
EMMC_PEIM_MEM_POOL *Pool;
EFI_STATUS Status;
VOID *TempPtr;
TempPtr = NULL;
Pool = NULL;
@@ -240,7 +236,7 @@ EmmcPeimInitMemPool (
return EFI_OUT_OF_RESOURCES;
}
ZeroMem ((VOID*)(UINTN)TempPtr, sizeof (EMMC_PEIM_MEM_POOL));
ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (EMMC_PEIM_MEM_POOL));
Pool = (EMMC_PEIM_MEM_POOL *)((UINTN)TempPtr);
@@ -265,10 +261,10 @@ EmmcPeimInitMemPool (
**/
EFI_STATUS
EmmcPeimFreeMemPool (
IN EMMC_PEIM_MEM_POOL *Pool
IN EMMC_PEIM_MEM_POOL *Pool
)
{
EMMC_PEIM_MEM_BLOCK *Block;
EMMC_PEIM_MEM_BLOCK *Block;
ASSERT (Pool->Head != NULL);
@@ -296,16 +292,16 @@ EmmcPeimFreeMemPool (
**/
VOID *
EmmcPeimAllocateMem (
IN EMMC_PEIM_MEM_POOL *Pool,
IN UINTN Size
IN EMMC_PEIM_MEM_POOL *Pool,
IN UINTN Size
)
{
EMMC_PEIM_MEM_BLOCK *Head;
EMMC_PEIM_MEM_BLOCK *Block;
EMMC_PEIM_MEM_BLOCK *NewBlock;
VOID *Mem;
UINTN AllocSize;
UINTN Pages;
EMMC_PEIM_MEM_BLOCK *Head;
EMMC_PEIM_MEM_BLOCK *Block;
EMMC_PEIM_MEM_BLOCK *NewBlock;
VOID *Mem;
UINTN AllocSize;
UINTN Pages;
Mem = NULL;
AllocSize = EMMC_PEIM_MEM_ROUND (Size);
@@ -368,22 +364,22 @@ EmmcPeimAllocateMem (
**/
VOID
EmmcPeimFreeMem (
IN EMMC_PEIM_MEM_POOL *Pool,
IN VOID *Mem,
IN UINTN Size
IN EMMC_PEIM_MEM_POOL *Pool,
IN VOID *Mem,
IN UINTN Size
)
{
EMMC_PEIM_MEM_BLOCK *Head;
EMMC_PEIM_MEM_BLOCK *Block;
UINT8 *ToFree;
UINTN AllocSize;
UINTN Byte;
UINTN Bit;
UINTN Count;
EMMC_PEIM_MEM_BLOCK *Head;
EMMC_PEIM_MEM_BLOCK *Block;
UINT8 *ToFree;
UINTN AllocSize;
UINTN Byte;
UINTN Bit;
UINTN Count;
Head = Pool->Head;
AllocSize = EMMC_PEIM_MEM_ROUND (Size);
ToFree = (UINT8 *) Mem;
ToFree = (UINT8 *)Mem;
for (Block = Head; Block != NULL; Block = Block->Next) {
//
@@ -394,8 +390,8 @@ EmmcPeimFreeMem (
//
// compute the start byte and bit in the bit array
//
Byte = ((ToFree - Block->Buf) / EMMC_PEIM_MEM_UNIT) / 8;
Bit = ((ToFree - Block->Buf) / EMMC_PEIM_MEM_UNIT) % 8;
Byte = ((ToFree - Block->Buf) / EMMC_PEIM_MEM_UNIT) / 8;
Bit = ((ToFree - Block->Buf) / EMMC_PEIM_MEM_UNIT) % 8;
//
// reset associated bits in bit array
@@ -403,7 +399,7 @@ EmmcPeimFreeMem (
for (Count = 0; Count < (AllocSize / EMMC_PEIM_MEM_UNIT); Count++) {
ASSERT (EMMC_PEIM_MEM_BIT_IS_SET (Block->Bits[Byte], Bit));
Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] ^ EMMC_PEIM_MEM_BIT (Bit));
Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] ^ EMMC_PEIM_MEM_BIT (Bit));
EMMC_PEIM_NEXT_BIT (Byte, Bit);
}
@@ -425,5 +421,5 @@ EmmcPeimFreeMem (
EmmcPeimFreeMemBlock (Pool, Block);
}
return ;
return;
}

View File

@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _EMMC_PEIM_MEM_H_
#define _EMMC_PEIM_MEM_H_
#define EMMC_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))
#define EMMC_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))
#define EMMC_PEIM_MEM_BIT_IS_SET(Data, Bit) \
((BOOLEAN)(((Data) & EMMC_PEIM_MEM_BIT(Bit)) == EMMC_PEIM_MEM_BIT(Bit)))
@@ -17,28 +17,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
typedef struct _EMMC_PEIM_MEM_BLOCK EMMC_PEIM_MEM_BLOCK;
struct _EMMC_PEIM_MEM_BLOCK {
UINT8 *Bits; // Bit array to record which unit is allocated
UINTN BitsLen;
UINT8 *Buf;
UINT8 *BufHost;
UINTN BufLen; // Memory size in bytes
VOID *Mapping;
EMMC_PEIM_MEM_BLOCK *Next;
UINT8 *Bits; // Bit array to record which unit is allocated
UINTN BitsLen;
UINT8 *Buf;
UINT8 *BufHost;
UINTN BufLen; // Memory size in bytes
VOID *Mapping;
EMMC_PEIM_MEM_BLOCK *Next;
};
typedef struct _EMMC_PEIM_MEM_POOL {
EMMC_PEIM_MEM_BLOCK *Head;
EMMC_PEIM_MEM_BLOCK *Head;
} EMMC_PEIM_MEM_POOL;
//
// Memory allocation unit, note that the value must meet EMMC spec alignment requirement.
//
#define EMMC_PEIM_MEM_UNIT 128
#define EMMC_PEIM_MEM_UNIT 128
#define EMMC_PEIM_MEM_UNIT_MASK (EMMC_PEIM_MEM_UNIT - 1)
#define EMMC_PEIM_MEM_DEFAULT_PAGES 16
#define EMMC_PEIM_MEM_ROUND(Len) (((Len) + EMMC_PEIM_MEM_UNIT_MASK) & (~EMMC_PEIM_MEM_UNIT_MASK))
#define EMMC_PEIM_MEM_ROUND(Len) (((Len) + EMMC_PEIM_MEM_UNIT_MASK) & (~EMMC_PEIM_MEM_UNIT_MASK))
//
// Advance the byte and bit to the next bit, adjust byte accordingly.
@@ -53,4 +53,3 @@ typedef struct _EMMC_PEIM_MEM_POOL {
} while (0)
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -61,9 +61,9 @@ typedef enum {
//
// The maximum data length of each descriptor line
//
#define ADMA_MAX_DATA_PER_LINE 0x10000
#define EMMC_SDMA_BOUNDARY 512 * 1024
#define EMMC_SDMA_ROUND_UP(x, n) (((x) + n) & ~(n - 1))
#define ADMA_MAX_DATA_PER_LINE 0x10000
#define EMMC_SDMA_BOUNDARY 512 * 1024
#define EMMC_SDMA_ROUND_UP(x, n) (((x) + n) & ~(n - 1))
typedef enum {
EmmcCommandTypeBc, // Broadcast commands, no response
@@ -85,76 +85,76 @@ typedef enum {
} EMMC_RESPONSE_TYPE;
typedef struct _EMMC_COMMAND_BLOCK {
UINT16 CommandIndex;
UINT32 CommandArgument;
UINT32 CommandType; // One of the EMMC_COMMAND_TYPE values
UINT32 ResponseType; // One of the EMMC_RESPONSE_TYPE values
UINT16 CommandIndex;
UINT32 CommandArgument;
UINT32 CommandType; // One of the EMMC_COMMAND_TYPE values
UINT32 ResponseType; // One of the EMMC_RESPONSE_TYPE values
} EMMC_COMMAND_BLOCK;
typedef struct _EMMC_STATUS_BLOCK {
UINT32 Resp0;
UINT32 Resp1;
UINT32 Resp2;
UINT32 Resp3;
UINT32 Resp0;
UINT32 Resp1;
UINT32 Resp2;
UINT32 Resp3;
} EMMC_STATUS_BLOCK;
typedef struct _EMMC_COMMAND_PACKET {
UINT64 Timeout;
EMMC_COMMAND_BLOCK *EmmcCmdBlk;
EMMC_STATUS_BLOCK *EmmcStatusBlk;
VOID *InDataBuffer;
VOID *OutDataBuffer;
UINT32 InTransferLength;
UINT32 OutTransferLength;
UINT64 Timeout;
EMMC_COMMAND_BLOCK *EmmcCmdBlk;
EMMC_STATUS_BLOCK *EmmcStatusBlk;
VOID *InDataBuffer;
VOID *OutDataBuffer;
UINT32 InTransferLength;
UINT32 OutTransferLength;
} EMMC_COMMAND_PACKET;
#pragma pack(1)
typedef struct {
UINT32 Valid:1;
UINT32 End:1;
UINT32 Int:1;
UINT32 Reserved:1;
UINT32 Act:2;
UINT32 Reserved1:10;
UINT32 Length:16;
UINT32 Address;
UINT32 Valid : 1;
UINT32 End : 1;
UINT32 Int : 1;
UINT32 Reserved : 1;
UINT32 Act : 2;
UINT32 Reserved1 : 10;
UINT32 Length : 16;
UINT32 Address;
} EMMC_HC_ADMA_DESC_LINE;
typedef struct {
UINT32 TimeoutFreq:6; // bit 0:5
UINT32 Reserved:1; // bit 6
UINT32 TimeoutUnit:1; // bit 7
UINT32 BaseClkFreq:8; // bit 8:15
UINT32 MaxBlkLen:2; // bit 16:17
UINT32 BusWidth8:1; // bit 18
UINT32 Adma2:1; // bit 19
UINT32 Reserved2:1; // bit 20
UINT32 HighSpeed:1; // bit 21
UINT32 Sdma:1; // bit 22
UINT32 SuspRes:1; // bit 23
UINT32 Voltage33:1; // bit 24
UINT32 Voltage30:1; // bit 25
UINT32 Voltage18:1; // bit 26
UINT32 Reserved3:1; // bit 27
UINT32 SysBus64:1; // bit 28
UINT32 AsyncInt:1; // bit 29
UINT32 SlotType:2; // bit 30:31
UINT32 Sdr50:1; // bit 32
UINT32 Sdr104:1; // bit 33
UINT32 Ddr50:1; // bit 34
UINT32 Reserved4:1; // bit 35
UINT32 DriverTypeA:1; // bit 36
UINT32 DriverTypeC:1; // bit 37
UINT32 DriverTypeD:1; // bit 38
UINT32 DriverType4:1; // bit 39
UINT32 TimerCount:4; // bit 40:43
UINT32 Reserved5:1; // bit 44
UINT32 TuningSDR50:1; // bit 45
UINT32 RetuningMod:2; // bit 46:47
UINT32 ClkMultiplier:8; // bit 48:55
UINT32 Reserved6:7; // bit 56:62
UINT32 Hs400:1; // bit 63
UINT32 TimeoutFreq : 6; // bit 0:5
UINT32 Reserved : 1; // bit 6
UINT32 TimeoutUnit : 1; // bit 7
UINT32 BaseClkFreq : 8; // bit 8:15
UINT32 MaxBlkLen : 2; // bit 16:17
UINT32 BusWidth8 : 1; // bit 18
UINT32 Adma2 : 1; // bit 19
UINT32 Reserved2 : 1; // bit 20
UINT32 HighSpeed : 1; // bit 21
UINT32 Sdma : 1; // bit 22
UINT32 SuspRes : 1; // bit 23
UINT32 Voltage33 : 1; // bit 24
UINT32 Voltage30 : 1; // bit 25
UINT32 Voltage18 : 1; // bit 26
UINT32 Reserved3 : 1; // bit 27
UINT32 SysBus64 : 1; // bit 28
UINT32 AsyncInt : 1; // bit 29
UINT32 SlotType : 2; // bit 30:31
UINT32 Sdr50 : 1; // bit 32
UINT32 Sdr104 : 1; // bit 33
UINT32 Ddr50 : 1; // bit 34
UINT32 Reserved4 : 1; // bit 35
UINT32 DriverTypeA : 1; // bit 36
UINT32 DriverTypeC : 1; // bit 37
UINT32 DriverTypeD : 1; // bit 38
UINT32 DriverType4 : 1; // bit 39
UINT32 TimerCount : 4; // bit 40:43
UINT32 Reserved5 : 1; // bit 44
UINT32 TuningSDR50 : 1; // bit 45
UINT32 RetuningMod : 2; // bit 46:47
UINT32 ClkMultiplier : 8; // bit 48:55
UINT32 Reserved6 : 7; // bit 56:62
UINT32 Hs400 : 1; // bit 63
} EMMC_HC_SLOT_CAP;
#pragma pack()
@@ -170,7 +170,7 @@ typedef struct {
**/
EFI_STATUS
EmmcPeimHcReset (
IN UINTN Bar
IN UINTN Bar
);
/**
@@ -185,7 +185,7 @@ EmmcPeimHcReset (
**/
EFI_STATUS
EmmcPeimHcEnableInterrupt (
IN UINTN Bar
IN UINTN Bar
);
/**
@@ -200,8 +200,8 @@ EmmcPeimHcEnableInterrupt (
**/
EFI_STATUS
EmmcPeimHcGetCapability (
IN UINTN Bar,
OUT EMMC_HC_SLOT_CAP *Capability
IN UINTN Bar,
OUT EMMC_HC_SLOT_CAP *Capability
);
/**
@@ -219,7 +219,7 @@ EmmcPeimHcGetCapability (
**/
EFI_STATUS
EmmcPeimHcCardDetect (
IN UINTN Bar
IN UINTN Bar
);
/**
@@ -234,7 +234,7 @@ EmmcPeimHcCardDetect (
**/
EFI_STATUS
EmmcPeimHcInitHost (
IN UINTN Bar
IN UINTN Bar
);
/**
@@ -255,11 +255,11 @@ EmmcPeimHcInitHost (
**/
EFI_STATUS
EmmcPeimSwitch (
IN EMMC_PEIM_HC_SLOT *Slot,
IN UINT8 Access,
IN UINT8 Index,
IN UINT8 Value,
IN UINT8 CmdSet
IN EMMC_PEIM_HC_SLOT *Slot,
IN UINT8 Access,
IN UINT8 Index,
IN UINT8 Value,
IN UINT8 CmdSet
);
/**
@@ -277,8 +277,8 @@ EmmcPeimSwitch (
**/
EFI_STATUS
EmmcPeimSetBlkCount (
IN EMMC_PEIM_HC_SLOT *Slot,
IN UINT16 BlockCount
IN EMMC_PEIM_HC_SLOT *Slot,
IN UINT16 BlockCount
);
/**
@@ -300,12 +300,12 @@ EmmcPeimSetBlkCount (
**/
EFI_STATUS
EmmcPeimRwMultiBlocks (
IN EMMC_PEIM_HC_SLOT *Slot,
IN EFI_LBA Lba,
IN UINT32 BlockSize,
IN VOID *Buffer,
IN UINTN BufferSize,
IN BOOLEAN IsRead
IN EMMC_PEIM_HC_SLOT *Slot,
IN EFI_LBA Lba,
IN UINT32 BlockSize,
IN VOID *Buffer,
IN UINTN BufferSize,
IN BOOLEAN IsRead
);
/**
@@ -321,7 +321,7 @@ EmmcPeimRwMultiBlocks (
**/
EFI_STATUS
EmmcPeimIdentification (
IN EMMC_PEIM_HC_SLOT *Slot
IN EMMC_PEIM_HC_SLOT *Slot
);
/**
@@ -332,8 +332,7 @@ EmmcPeimIdentification (
**/
VOID
EmmcPeimFreeTrb (
IN EMMC_TRB *Trb
IN EMMC_TRB *Trb
);
#endif