diff options
Diffstat (limited to 'MdeModulePkg/Bus/Ufs/UfsBlockIoPei')
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/DmaMem.c | 85 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c | 285 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h | 152 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c | 138 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h | 21 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 512 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h | 1137 |
7 files changed, 1164 insertions, 1166 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/DmaMem.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/DmaMem.c index 61378a6..62aeaf8 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/DmaMem.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/DmaMem.c @@ -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
);
}
-
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c index 4664187..b331c0f 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c @@ -10,7 +10,7 @@ //
// Template for UFS HC Peim Private Data.
//
-UFS_PEIM_HC_PRIVATE_DATA gUfsHcPeimTemplate = {
+UFS_PEIM_HC_PRIVATE_DATA gUfsHcPeimTemplate = {
UFS_PEIM_HC_SIG, // Signature
NULL, // Controller
NULL, // Pool
@@ -131,8 +131,6 @@ UFS_PEIM_HC_PRIVATE_DATA gUfsHcPeimTemplate = { }
};
-
-
/**
Execute TEST UNITY READY SCSI command on a specific UFS device.
@@ -148,20 +146,20 @@ UFS_PEIM_HC_PRIVATE_DATA gUfsHcPeimTemplate = { **/
EFI_STATUS
UfsPeimTestUnitReady (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINTN Lun,
- OUT VOID *SenseData OPTIONAL,
- OUT UINT8 *SenseDataLength
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINTN Lun,
+ OUT VOID *SenseData OPTIONAL,
+ OUT UINT8 *SenseDataLength
)
{
- UFS_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIX];
- EFI_STATUS Status;
+ UFS_SCSI_REQUEST_PACKET Packet;
+ UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIX];
+ EFI_STATUS Status;
ZeroMem (&Packet, sizeof (UFS_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, sizeof (Cdb));
- Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;
+ Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;
Packet.Timeout = UFS_TIMEOUT;
Packet.Cdb = Cdb;
@@ -170,7 +168,7 @@ UfsPeimTestUnitReady ( Packet.SenseData = SenseData;
Packet.SenseDataLength = *SenseDataLength;
- Status = UfsExecScsiCmds (Private,(UINT8)Lun, &Packet);
+ Status = UfsExecScsiCmds (Private, (UINT8)Lun, &Packet);
if (*SenseDataLength != 0) {
*SenseDataLength = Packet.SenseDataLength;
@@ -179,8 +177,6 @@ UfsPeimTestUnitReady ( return Status;
}
-
-
/**
Execute READ CAPACITY(10) SCSI command on a specific UFS device.
@@ -198,17 +194,17 @@ UfsPeimTestUnitReady ( **/
EFI_STATUS
UfsPeimReadCapacity (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINTN Lun,
- OUT VOID *DataBuffer,
- OUT UINT32 *DataLength,
- OUT VOID *SenseData OPTIONAL,
- OUT UINT8 *SenseDataLength
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINTN Lun,
+ OUT VOID *DataBuffer,
+ OUT UINT32 *DataLength,
+ OUT VOID *SenseData OPTIONAL,
+ OUT UINT8 *SenseDataLength
)
{
- UFS_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[UFS_SCSI_OP_LENGTH_TEN];
- EFI_STATUS Status;
+ UFS_SCSI_REQUEST_PACKET Packet;
+ UINT8 Cdb[UFS_SCSI_OP_LENGTH_TEN];
+ EFI_STATUS Status;
ZeroMem (&Packet, sizeof (UFS_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, sizeof (Cdb));
@@ -254,17 +250,17 @@ UfsPeimReadCapacity ( **/
EFI_STATUS
UfsPeimReadCapacity16 (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINTN Lun,
- OUT VOID *DataBuffer,
- OUT UINT32 *DataLength,
- OUT VOID *SenseData OPTIONAL,
- OUT UINT8 *SenseDataLength
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINTN Lun,
+ OUT VOID *DataBuffer,
+ OUT UINT32 *DataLength,
+ OUT VOID *SenseData OPTIONAL,
+ OUT UINT8 *SenseDataLength
)
{
- UFS_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];
- EFI_STATUS Status;
+ UFS_SCSI_REQUEST_PACKET Packet;
+ UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];
+ EFI_STATUS Status;
ZeroMem (&Packet, sizeof (UFS_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, sizeof (Cdb));
@@ -314,26 +310,26 @@ UfsPeimReadCapacity16 ( **/
EFI_STATUS
UfsPeimRead10 (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINTN Lun,
- IN UINTN StartLba,
- IN UINT32 SectorNum,
- OUT VOID *DataBuffer,
- OUT UINT32 *DataLength,
- OUT VOID *SenseData OPTIONAL,
- OUT UINT8 *SenseDataLength
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINTN Lun,
+ IN UINTN StartLba,
+ IN UINT32 SectorNum,
+ OUT VOID *DataBuffer,
+ OUT UINT32 *DataLength,
+ OUT VOID *SenseData OPTIONAL,
+ OUT UINT8 *SenseDataLength
)
{
- UFS_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[UFS_SCSI_OP_LENGTH_TEN];
- EFI_STATUS Status;
+ UFS_SCSI_REQUEST_PACKET Packet;
+ UINT8 Cdb[UFS_SCSI_OP_LENGTH_TEN];
+ EFI_STATUS Status;
ZeroMem (&Packet, sizeof (UFS_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, sizeof (Cdb));
Cdb[0] = EFI_SCSI_OP_READ10;
- WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 ((UINT32) StartLba));
- WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorNum));
+ WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 ((UINT32)StartLba));
+ WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorNum));
Packet.Timeout = UFS_TIMEOUT;
Packet.Cdb = Cdb;
@@ -376,19 +372,19 @@ UfsPeimRead10 ( **/
EFI_STATUS
UfsPeimRead16 (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINTN Lun,
- IN UINTN StartLba,
- IN UINT32 SectorNum,
- OUT VOID *DataBuffer,
- OUT UINT32 *DataLength,
- OUT VOID *SenseData OPTIONAL,
- OUT UINT8 *SenseDataLength
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINTN Lun,
+ IN UINTN StartLba,
+ IN UINT32 SectorNum,
+ OUT VOID *DataBuffer,
+ OUT UINT32 *DataLength,
+ OUT VOID *SenseData OPTIONAL,
+ OUT UINT8 *SenseDataLength
)
{
- UFS_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];
- EFI_STATUS Status;
+ UFS_SCSI_REQUEST_PACKET Packet;
+ UINT8 Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];
+ EFI_STATUS Status;
ZeroMem (&Packet, sizeof (UFS_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, sizeof (Cdb));
@@ -432,28 +428,31 @@ UfsPeimRead16 ( **/
EFI_STATUS
UfsPeimParsingSenseKeys (
- IN EFI_PEI_BLOCK_IO2_MEDIA *Media,
- IN EFI_SCSI_SENSE_DATA *SenseData,
- OUT BOOLEAN *NeedRetry
+ IN EFI_PEI_BLOCK_IO2_MEDIA *Media,
+ IN EFI_SCSI_SENSE_DATA *SenseData,
+ OUT BOOLEAN *NeedRetry
)
{
if ((SenseData->Sense_Key == EFI_SCSI_SK_NOT_READY) &&
- (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_NO_MEDIA)) {
+ (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_NO_MEDIA))
+ {
Media->MediaPresent = FALSE;
- *NeedRetry = FALSE;
+ *NeedRetry = FALSE;
DEBUG ((DEBUG_VERBOSE, "UfsBlockIoPei: Is No Media\n"));
return EFI_DEVICE_ERROR;
}
if ((SenseData->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) &&
- (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_MEDIA_CHANGE)) {
+ (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_MEDIA_CHANGE))
+ {
*NeedRetry = TRUE;
DEBUG ((DEBUG_VERBOSE, "UfsBlockIoPei: Is Media Change\n"));
return EFI_SUCCESS;
}
if ((SenseData->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) &&
- (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_RESET)) {
+ (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_RESET))
+ {
*NeedRetry = TRUE;
DEBUG ((DEBUG_VERBOSE, "UfsBlockIoPei: Was Reset Before\n"));
return EFI_SUCCESS;
@@ -461,7 +460,8 @@ UfsPeimParsingSenseKeys ( if ((SenseData->Sense_Key == EFI_SCSI_SK_MEDIUM_ERROR) ||
((SenseData->Sense_Key == EFI_SCSI_SK_NOT_READY) &&
- (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_MEDIA_UPSIDE_DOWN))) {
+ (SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_MEDIA_UPSIDE_DOWN)))
+ {
*NeedRetry = FALSE;
DEBUG ((DEBUG_VERBOSE, "UfsBlockIoPei: Media Error\n"));
return EFI_DEVICE_ERROR;
@@ -475,7 +475,8 @@ UfsPeimParsingSenseKeys ( if ((SenseData->Sense_Key == EFI_SCSI_SK_NOT_READY) &&
(SenseData->Addnl_Sense_Code == EFI_SCSI_ASC_NOT_READY) &&
- (SenseData->Addnl_Sense_Code_Qualifier == EFI_SCSI_ASCQ_IN_PROGRESS)) {
+ (SenseData->Addnl_Sense_Code_Qualifier == EFI_SCSI_ASCQ_IN_PROGRESS))
+ {
*NeedRetry = TRUE;
DEBUG ((DEBUG_VERBOSE, "UfsBlockIoPei: Was Reset Before\n"));
return EFI_SUCCESS;
@@ -486,7 +487,6 @@ UfsPeimParsingSenseKeys ( return EFI_DEVICE_ERROR;
}
-
/**
Gets the count of block I/O devices that one specific block driver detects.
@@ -573,15 +573,15 @@ UfsBlockIoPeimGetMediaInfo ( OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
)
{
- EFI_STATUS Status;
- UFS_PEIM_HC_PRIVATE_DATA *Private;
- EFI_SCSI_SENSE_DATA SenseData;
- UINT8 SenseDataLength;
- EFI_SCSI_DISK_CAPACITY_DATA Capacity;
- EFI_SCSI_DISK_CAPACITY_DATA16 Capacity16;
- UINTN DataLength;
- BOOLEAN NeedRetry;
- UINTN Lun;
+ EFI_STATUS Status;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
+ EFI_SCSI_SENSE_DATA SenseData;
+ UINT8 SenseDataLength;
+ EFI_SCSI_DISK_CAPACITY_DATA Capacity;
+ EFI_SCSI_DISK_CAPACITY_DATA16 Capacity16;
+ UINTN DataLength;
+ BOOLEAN NeedRetry;
+ UINTN Lun;
Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
NeedRetry = TRUE;
@@ -621,30 +621,31 @@ UfsBlockIoPeimGetMediaInfo ( if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
-
} while (NeedRetry);
DataLength = sizeof (EFI_SCSI_DISK_CAPACITY_DATA);
SenseDataLength = 0;
- Status = UfsPeimReadCapacity (Private, Lun, &Capacity, (UINT32 *)&DataLength, NULL, &SenseDataLength);
+ Status = UfsPeimReadCapacity (Private, Lun, &Capacity, (UINT32 *)&DataLength, NULL, &SenseDataLength);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
if ((Capacity.LastLba3 == 0xff) && (Capacity.LastLba2 == 0xff) &&
- (Capacity.LastLba1 == 0xff) && (Capacity.LastLba0 == 0xff)) {
+ (Capacity.LastLba1 == 0xff) && (Capacity.LastLba0 == 0xff))
+ {
DataLength = sizeof (EFI_SCSI_DISK_CAPACITY_DATA16);
SenseDataLength = 0;
- Status = UfsPeimReadCapacity16 (Private, Lun, &Capacity16, (UINT32 *)&DataLength, NULL, &SenseDataLength);
+ Status = UfsPeimReadCapacity16 (Private, Lun, &Capacity16, (UINT32 *)&DataLength, NULL, &SenseDataLength);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
+
Private->Media[Lun].LastBlock = ((UINT32)Capacity16.LastLba3 << 24) | (Capacity16.LastLba2 << 16) | (Capacity16.LastLba1 << 8) | Capacity16.LastLba0;
- Private->Media[Lun].LastBlock |= LShiftU64 ((UINT64)Capacity16.LastLba7, 56) | LShiftU64((UINT64)Capacity16.LastLba6, 48) | LShiftU64 ((UINT64)Capacity16.LastLba5, 40) | LShiftU64 ((UINT64)Capacity16.LastLba4, 32);
+ Private->Media[Lun].LastBlock |= LShiftU64 ((UINT64)Capacity16.LastLba7, 56) | LShiftU64 ((UINT64)Capacity16.LastLba6, 48) | LShiftU64 ((UINT64)Capacity16.LastLba5, 40) | LShiftU64 ((UINT64)Capacity16.LastLba4, 32);
Private->Media[Lun].BlockSize = (Capacity16.BlockSize3 << 24) | (Capacity16.BlockSize2 << 16) | (Capacity16.BlockSize1 << 8) | Capacity16.BlockSize0;
} else {
- Private->Media[Lun].LastBlock = ((UINT32)Capacity.LastLba3 << 24) | (Capacity.LastLba2 << 16) | (Capacity.LastLba1 << 8) | Capacity.LastLba0;
- Private->Media[Lun].BlockSize = (Capacity.BlockSize3 << 24) | (Capacity.BlockSize2 << 16) | (Capacity.BlockSize1 << 8) | Capacity.BlockSize0;
+ Private->Media[Lun].LastBlock = ((UINT32)Capacity.LastLba3 << 24) | (Capacity.LastLba2 << 16) | (Capacity.LastLba1 << 8) | Capacity.LastLba0;
+ Private->Media[Lun].BlockSize = (Capacity.BlockSize3 << 24) | (Capacity.BlockSize2 << 16) | (Capacity.BlockSize1 << 8) | Capacity.BlockSize0;
}
MediaInfo->DeviceType = UfsDevice;
@@ -700,14 +701,14 @@ UfsBlockIoPeimReadBlocks ( OUT VOID *Buffer
)
{
- EFI_STATUS Status;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- UFS_PEIM_HC_PRIVATE_DATA *Private;
- EFI_SCSI_SENSE_DATA SenseData;
- UINT8 SenseDataLength;
- BOOLEAN NeedRetry;
- UINTN Lun;
+ EFI_STATUS Status;
+ UINTN BlockSize;
+ UINTN NumberOfBlocks;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
+ EFI_SCSI_SENSE_DATA SenseData;
+ UINT8 SenseDataLength;
+ BOOLEAN NeedRetry;
+ UINTN Lun;
Status = EFI_SUCCESS;
NeedRetry = TRUE;
@@ -767,7 +768,6 @@ UfsBlockIoPeimReadBlocks ( if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
-
} while (NeedRetry);
SenseDataLength = 0;
@@ -794,6 +794,7 @@ UfsBlockIoPeimReadBlocks ( &SenseDataLength
);
}
+
return Status;
}
@@ -819,9 +820,9 @@ UfsBlockIoPeimReadBlocks ( EFI_STATUS
EFIAPI
UfsBlockIoPeimGetDeviceNo2 (
- 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
)
{
//
@@ -877,25 +878,25 @@ UfsBlockIoPeimGetDeviceNo2 ( EFI_STATUS
EFIAPI
UfsBlockIoPeimGetMediaInfo2 (
- 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;
- UFS_PEIM_HC_PRIVATE_DATA *Private;
- EFI_PEI_BLOCK_IO_MEDIA Media;
- UINTN Lun;
-
- Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
-
- Status = UfsBlockIoPeimGetMediaInfo (
- PeiServices,
- &Private->BlkIoPpi,
- DeviceIndex,
- &Media
- );
+ EFI_STATUS Status;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
+ EFI_PEI_BLOCK_IO_MEDIA Media;
+ UINTN Lun;
+
+ Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
+
+ Status = UfsBlockIoPeimGetMediaInfo (
+ PeiServices,
+ &Private->BlkIoPpi,
+ DeviceIndex,
+ &Media
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -942,28 +943,28 @@ UfsBlockIoPeimGetMediaInfo2 ( EFI_STATUS
EFIAPI
UfsBlockIoPeimReadBlocks2 (
- 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;
- UFS_PEIM_HC_PRIVATE_DATA *Private;
-
- Status = EFI_SUCCESS;
- Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
-
- Status = UfsBlockIoPeimReadBlocks (
- PeiServices,
- &Private->BlkIoPpi,
- DeviceIndex,
- StartLBA,
- BufferSize,
- Buffer
- );
+ EFI_STATUS Status;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
+
+ Status = EFI_SUCCESS;
+ Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
+
+ Status = UfsBlockIoPeimReadBlocks (
+ PeiServices,
+ &Private->BlkIoPpi,
+ DeviceIndex,
+ StartLBA,
+ BufferSize,
+ Buffer
+ );
return Status;
}
@@ -986,7 +987,7 @@ UfsEndOfPei ( IN VOID *Ppi
)
{
- UFS_PEIM_HC_PRIVATE_DATA *Private;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (NotifyDescriptor);
@@ -1028,17 +1029,17 @@ UfsEndOfPei ( EFI_STATUS
EFIAPI
InitializeUfsBlockIoPeim (
- 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;
- UFS_PEIM_HC_PRIVATE_DATA *Private;
- EDKII_UFS_HOST_CONTROLLER_PPI *UfsHcPpi;
- UINT32 Index;
- UFS_CONFIG_DESC Config;
- UINTN MmioBase;
- UINT8 Controller;
+ EFI_STATUS Status;
+ UFS_PEIM_HC_PRIVATE_DATA *Private;
+ EDKII_UFS_HOST_CONTROLLER_PPI *UfsHcPpi;
+ UINT32 Index;
+ UFS_CONFIG_DESC Config;
+ UINTN MmioBase;
+ UINT8 Controller;
//
// Shadow this PEIM to run from memory
@@ -1054,7 +1055,7 @@ InitializeUfsBlockIoPeim ( &gEdkiiPeiUfsHostControllerPpiGuid,
0,
NULL,
- (VOID **) &UfsHcPpi
+ (VOID **)&UfsHcPpi
);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h index 6e2305a..a0b615b 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h @@ -29,14 +29,14 @@ #include "UfsHci.h"
#include "UfsHcMem.h"
-#define UFS_PEIM_HC_SIG SIGNATURE_32 ('U', 'F', 'S', 'H')
+#define UFS_PEIM_HC_SIG SIGNATURE_32 ('U', 'F', 'S', 'H')
-#define UFS_PEIM_MAX_LUNS 8
+#define UFS_PEIM_MAX_LUNS 8
typedef struct {
- UINT8 Lun[UFS_PEIM_MAX_LUNS];
- UINT16 BitMask:12; // Bit 0~7 is for common luns. Bit 8~11 is reserved for those well known luns
- UINT16 Rsvd:4;
+ UINT8 Lun[UFS_PEIM_MAX_LUNS];
+ UINT16 BitMask : 12; // Bit 0~7 is for common luns. Bit 8~11 is reserved for those well known luns
+ UINT16 Rsvd : 4;
} UFS_PEIM_EXPOSED_LUNS;
typedef struct {
@@ -48,52 +48,52 @@ typedef struct { /// EFI_TIMEOUT if the time required to execute the SCSI
/// Request Packet is greater than Timeout.
///
- UINT64 Timeout;
+ UINT64 Timeout;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for read and bidirectional commands.
///
- VOID *InDataBuffer;
+ VOID *InDataBuffer;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for write or bidirectional commands.
///
- VOID *OutDataBuffer;
+ VOID *OutDataBuffer;
///
/// A pointer to the sense data that was generated by the execution of
/// the SCSI Request Packet.
///
- VOID *SenseData;
+ VOID *SenseData;
///
/// A pointer to buffer that contains the Command Data Block to
/// send to the SCSI device specified by Target and Lun.
///
- VOID *Cdb;
+ VOID *Cdb;
///
/// On Input, the size, in bytes, of InDataBuffer. On output, the
/// number of bytes transferred between the SCSI controller and the SCSI device.
///
- UINT32 InTransferLength;
+ UINT32 InTransferLength;
///
/// On Input, the size, in bytes of OutDataBuffer. On Output, the
/// Number of bytes transferred between SCSI Controller and the SCSI device.
///
- UINT32 OutTransferLength;
+ UINT32 OutTransferLength;
///
/// The length, in bytes, of the buffer Cdb. The standard values are 6,
/// 10, 12, and 16, but other values are possible if a variable length CDB is used.
///
- UINT8 CdbLength;
+ UINT8 CdbLength;
///
/// The direction of the data transfer. 0 for reads, 1 for writes. A
/// value of 2 is Reserved for Bi-Directional SCSI commands.
///
- UINT8 DataDirection;
+ UINT8 DataDirection;
///
/// On input, the length in bytes of the SenseData buffer. On
/// output, the number of bytes written to the SenseData buffer.
///
- UINT8 SenseDataLength;
+ UINT8 SenseDataLength;
} UFS_SCSI_REQUEST_PACKET;
typedef struct _UFS_PEIM_HC_PRIVATE_DATA {
@@ -129,32 +129,32 @@ typedef struct _UFS_PEIM_HC_PRIVATE_DATA { UFS_PEIM_EXPOSED_LUNS Luns;
} UFS_PEIM_HC_PRIVATE_DATA;
-#define UFS_TIMEOUT MultU64x32((UINT64)(3), 10000000)
+#define UFS_TIMEOUT MultU64x32((UINT64)(3), 10000000)
-#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
+#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
+#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
-#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
-#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
-#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
+#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
+#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
+#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
#define UFS_SCSI_OP_LENGTH_SIX 0x6
#define UFS_SCSI_OP_LENGTH_TEN 0xa
#define UFS_SCSI_OP_LENGTH_SIXTEEN 0x10
typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET {
- UINT64 Timeout;
- VOID *InDataBuffer;
- VOID *OutDataBuffer;
- UINT8 Opcode;
- UINT8 DescId;
- UINT8 Index;
- UINT8 Selector;
- UINT32 InTransferLength;
- UINT32 OutTransferLength;
- UINT8 DataDirection;
- UINT8 Ocs;
+ UINT64 Timeout;
+ VOID *InDataBuffer;
+ VOID *OutDataBuffer;
+ UINT8 Opcode;
+ UINT8 DescId;
+ UINT8 Index;
+ UINT8 Selector;
+ UINT32 InTransferLength;
+ UINT32 OutTransferLength;
+ UINT8 DataDirection;
+ UINT8 Ocs;
} UFS_DEVICE_MANAGEMENT_REQUEST_PACKET;
/**
@@ -178,9 +178,9 @@ typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET { **/
EFI_STATUS
UfsExecScsiCmds (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 Lun,
- IN OUT UFS_SCSI_REQUEST_PACKET *Packet
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 Lun,
+ IN OUT UFS_SCSI_REQUEST_PACKET *Packet
);
/**
@@ -194,7 +194,7 @@ UfsExecScsiCmds ( **/
EFI_STATUS
UfsControllerInit (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
);
/**
@@ -208,7 +208,7 @@ UfsControllerInit ( **/
EFI_STATUS
UfsControllerStop (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
);
/**
@@ -224,8 +224,8 @@ UfsControllerStop ( **/
EFI_STATUS
UfsSetFlag (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 FlagId
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 FlagId
);
/**
@@ -246,13 +246,13 @@ UfsSetFlag ( **/
EFI_STATUS
UfsRwDeviceDesc (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN BOOLEAN Read,
- IN UINT8 DescId,
- IN UINT8 Index,
- IN UINT8 Selector,
- IN OUT VOID *Descriptor,
- IN UINT32 DescSize
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN BOOLEAN Read,
+ IN UINT8 DescId,
+ IN UINT8 Index,
+ IN UINT8 Selector,
+ IN OUT VOID *Descriptor,
+ IN UINT32 DescSize
);
/**
@@ -270,7 +270,7 @@ UfsRwDeviceDesc ( **/
EFI_STATUS
UfsExecNopCmds (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
);
/**
@@ -417,9 +417,9 @@ UfsBlockIoPeimReadBlocks ( EFI_STATUS
EFIAPI
UfsBlockIoPeimGetDeviceNo2 (
- 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
);
/**
@@ -466,10 +466,10 @@ UfsBlockIoPeimGetDeviceNo2 ( EFI_STATUS
EFIAPI
UfsBlockIoPeimGetMediaInfo2 (
- 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
);
/**
@@ -509,12 +509,12 @@ UfsBlockIoPeimGetMediaInfo2 ( EFI_STATUS
EFIAPI
UfsBlockIoPeimReadBlocks2 (
- 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
);
/**
@@ -528,7 +528,7 @@ UfsBlockIoPeimReadBlocks2 ( **/
EFI_STATUS
UfsPeimInitMemPool (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
);
/**
@@ -542,7 +542,7 @@ UfsPeimInitMemPool ( **/
EFI_STATUS
UfsPeimFreeMemPool (
- IN UFS_PEIM_MEM_POOL *Pool
+ IN UFS_PEIM_MEM_POOL *Pool
);
/**
@@ -557,8 +557,8 @@ UfsPeimFreeMemPool ( **/
VOID *
UfsPeimAllocateMem (
- IN UFS_PEIM_MEM_POOL *Pool,
- IN UINTN Size
+ IN UFS_PEIM_MEM_POOL *Pool,
+ IN UINTN Size
);
/**
@@ -571,9 +571,9 @@ UfsPeimAllocateMem ( **/
VOID
UfsPeimFreeMem (
- IN UFS_PEIM_MEM_POOL *Pool,
- IN VOID *Mem,
- IN UINTN Size
+ IN UFS_PEIM_MEM_POOL *Pool,
+ IN VOID *Mem,
+ IN UINTN Size
);
/**
@@ -605,11 +605,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
);
/**
@@ -623,7 +623,7 @@ IoMmuMap ( **/
EFI_STATUS
IoMmuUnmap (
- IN VOID *Mapping
+ IN VOID *Mapping
);
/**
@@ -666,9 +666,9 @@ IoMmuAllocateBuffer ( **/
EFI_STATUS
IoMmuFreeBuffer (
- IN UINTN Pages,
- IN VOID *HostAddress,
- IN VOID *Mapping
+ IN UINTN Pages,
+ IN VOID *HostAddress,
+ IN VOID *Mapping
);
/**
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c index a4e7316..b7dd9b6 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c @@ -18,25 +18,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
UFS_PEIM_MEM_BLOCK *
UfsPeimAllocMemBlock (
- IN UINTN Pages
+ IN UINTN Pages
)
{
- UFS_PEIM_MEM_BLOCK *Block;
- VOID *BufHost;
- VOID *Mapping;
- EFI_PHYSICAL_ADDRESS MappedAddr;
- EFI_STATUS Status;
- VOID *TempPtr;
+ UFS_PEIM_MEM_BLOCK *Block;
+ VOID *BufHost;
+ VOID *Mapping;
+ EFI_PHYSICAL_ADDRESS MappedAddr;
+ EFI_STATUS Status;
+ VOID *TempPtr;
TempPtr = NULL;
Block = NULL;
- Status = PeiServicesAllocatePool (sizeof(UFS_PEIM_MEM_BLOCK), &TempPtr);
+ Status = PeiServicesAllocatePool (sizeof (UFS_PEIM_MEM_BLOCK), &TempPtr);
if (EFI_ERROR (Status)) {
return NULL;
}
- ZeroMem ((VOID*)(UINTN)TempPtr, sizeof(UFS_PEIM_MEM_BLOCK));
+ ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (UFS_PEIM_MEM_BLOCK));
//
// each bit in the bit array represents UFS_PEIM_MEM_UNIT
@@ -44,18 +44,18 @@ UfsPeimAllocMemBlock ( //
ASSERT (UFS_PEIM_MEM_UNIT * 8 <= EFI_PAGE_SIZE);
- Block = (UFS_PEIM_MEM_BLOCK*)(UINTN)TempPtr;
- Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
- Block->BitsLen = Block->BufLen / (UFS_PEIM_MEM_UNIT * 8);
+ Block = (UFS_PEIM_MEM_BLOCK *)(UINTN)TempPtr;
+ Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
+ Block->BitsLen = Block->BufLen / (UFS_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 @@ UfsPeimAllocMemBlock ( 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 @@ UfsPeimAllocMemBlock ( **/
VOID
UfsPeimFreeMemBlock (
- IN UFS_PEIM_MEM_POOL *Pool,
- IN UFS_PEIM_MEM_BLOCK *Block
+ IN UFS_PEIM_MEM_POOL *Pool,
+ IN UFS_PEIM_MEM_BLOCK *Block
)
{
ASSERT ((Pool != NULL) && (Block != NULL));
@@ -111,18 +111,18 @@ UfsPeimAllocMemFromBlock ( 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 @@ UfsPeimAllocMemFromBlock ( }
UFS_PEIM_NEXT_BIT (Byte, Bit);
-
} else {
UFS_PEIM_NEXT_BIT (Byte, Bit);
- Available = 0;
- StartByte = Byte;
- StartBit = Bit;
+ Available = 0;
+ StartByte = Byte;
+ StartBit = Bit;
}
}
@@ -155,13 +154,13 @@ UfsPeimAllocMemFromBlock ( //
// Mark the memory as allocated
//
- Byte = StartByte;
- Bit = StartBit;
+ Byte = StartByte;
+ Bit = StartBit;
for (Count = 0; Count < Units; Count++) {
ASSERT (!UFS_PEIM_MEM_BIT_IS_SET (Block->Bits[Byte], Bit));
- Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] | (UINT8) UFS_PEIM_MEM_BIT (Bit));
+ Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] | (UINT8)UFS_PEIM_MEM_BIT (Bit));
UFS_PEIM_NEXT_BIT (Byte, Bit);
}
@@ -177,8 +176,8 @@ UfsPeimAllocMemFromBlock ( **/
VOID
UfsPeimInsertMemBlockToPool (
- IN UFS_PEIM_MEM_BLOCK *Head,
- IN UFS_PEIM_MEM_BLOCK *Block
+ IN UFS_PEIM_MEM_BLOCK *Head,
+ IN UFS_PEIM_MEM_BLOCK *Block
)
{
ASSERT ((Head != NULL) && (Block != NULL));
@@ -197,11 +196,10 @@ UfsPeimInsertMemBlockToPool ( **/
BOOLEAN
UfsPeimIsMemBlockEmpty (
- IN UFS_PEIM_MEM_BLOCK *Block
+ IN UFS_PEIM_MEM_BLOCK *Block
)
{
- UINTN Index;
-
+ UINTN Index;
for (Index = 0; Index < Block->BitsLen; Index++) {
if (Block->Bits[Index] != 0) {
@@ -212,8 +210,6 @@ UfsPeimIsMemBlockEmpty ( return TRUE;
}
-
-
/**
Initialize the memory management pool for the host controller.
@@ -228,9 +224,9 @@ UfsPeimInitMemPool ( IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- UFS_PEIM_MEM_POOL *Pool;
- EFI_STATUS Status;
- VOID *TempPtr;
+ UFS_PEIM_MEM_POOL *Pool;
+ EFI_STATUS Status;
+ VOID *TempPtr;
TempPtr = NULL;
Pool = NULL;
@@ -240,7 +236,7 @@ UfsPeimInitMemPool ( return EFI_OUT_OF_RESOURCES;
}
- ZeroMem ((VOID*)(UINTN)TempPtr, sizeof (UFS_PEIM_MEM_POOL));
+ ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (UFS_PEIM_MEM_POOL));
Pool = (UFS_PEIM_MEM_POOL *)((UINTN)TempPtr);
@@ -265,10 +261,10 @@ UfsPeimInitMemPool ( **/
EFI_STATUS
UfsPeimFreeMemPool (
- IN UFS_PEIM_MEM_POOL *Pool
+ IN UFS_PEIM_MEM_POOL *Pool
)
{
- UFS_PEIM_MEM_BLOCK *Block;
+ UFS_PEIM_MEM_BLOCK *Block;
ASSERT (Pool->Head != NULL);
@@ -296,16 +292,16 @@ UfsPeimFreeMemPool ( **/
VOID *
UfsPeimAllocateMem (
- IN UFS_PEIM_MEM_POOL *Pool,
- IN UINTN Size
+ IN UFS_PEIM_MEM_POOL *Pool,
+ IN UINTN Size
)
{
- UFS_PEIM_MEM_BLOCK *Head;
- UFS_PEIM_MEM_BLOCK *Block;
- UFS_PEIM_MEM_BLOCK *NewBlock;
- VOID *Mem;
- UINTN AllocSize;
- UINTN Pages;
+ UFS_PEIM_MEM_BLOCK *Head;
+ UFS_PEIM_MEM_BLOCK *Block;
+ UFS_PEIM_MEM_BLOCK *NewBlock;
+ VOID *Mem;
+ UINTN AllocSize;
+ UINTN Pages;
Mem = NULL;
AllocSize = UFS_PEIM_MEM_ROUND (Size);
@@ -368,22 +364,22 @@ UfsPeimAllocateMem ( **/
VOID
UfsPeimFreeMem (
- IN UFS_PEIM_MEM_POOL *Pool,
- IN VOID *Mem,
- IN UINTN Size
+ IN UFS_PEIM_MEM_POOL *Pool,
+ IN VOID *Mem,
+ IN UINTN Size
)
{
- UFS_PEIM_MEM_BLOCK *Head;
- UFS_PEIM_MEM_BLOCK *Block;
- UINT8 *ToFree;
- UINTN AllocSize;
- UINTN Byte;
- UINTN Bit;
- UINTN Count;
+ UFS_PEIM_MEM_BLOCK *Head;
+ UFS_PEIM_MEM_BLOCK *Block;
+ UINT8 *ToFree;
+ UINTN AllocSize;
+ UINTN Byte;
+ UINTN Bit;
+ UINTN Count;
Head = Pool->Head;
AllocSize = UFS_PEIM_MEM_ROUND (Size);
- ToFree = (UINT8 *) Mem;
+ ToFree = (UINT8 *)Mem;
for (Block = Head; Block != NULL; Block = Block->Next) {
//
@@ -394,8 +390,8 @@ UfsPeimFreeMem ( //
// compute the start byte and bit in the bit array
//
- Byte = ((ToFree - Block->Buf) / UFS_PEIM_MEM_UNIT) / 8;
- Bit = ((ToFree - Block->Buf) / UFS_PEIM_MEM_UNIT) % 8;
+ Byte = ((ToFree - Block->Buf) / UFS_PEIM_MEM_UNIT) / 8;
+ Bit = ((ToFree - Block->Buf) / UFS_PEIM_MEM_UNIT) % 8;
//
// reset associated bits in bit array
@@ -403,7 +399,7 @@ UfsPeimFreeMem ( for (Count = 0; Count < (AllocSize / UFS_PEIM_MEM_UNIT); Count++) {
ASSERT (UFS_PEIM_MEM_BIT_IS_SET (Block->Bits[Byte], Bit));
- Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] ^ UFS_PEIM_MEM_BIT (Bit));
+ Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] ^ UFS_PEIM_MEM_BIT (Bit));
UFS_PEIM_NEXT_BIT (Byte, Bit);
}
@@ -425,5 +421,5 @@ UfsPeimFreeMem ( UfsPeimFreeMemBlock (Pool, Block);
}
- return ;
+ return;
}
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h index b47d05a..6bde937 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h @@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _UFS_PEIM_MEM_H_
#define _UFS_PEIM_MEM_H_
-#define UFS_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))
+#define UFS_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))
#define UFS_PEIM_MEM_BIT_IS_SET(Data, Bit) \
((BOOLEAN)(((Data) & UFS_PEIM_MEM_BIT(Bit)) == UFS_PEIM_MEM_BIT(Bit)))
@@ -17,23 +17,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent typedef struct _UFS_PEIM_MEM_BLOCK UFS_PEIM_MEM_BLOCK;
struct _UFS_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;
- UFS_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;
+ UFS_PEIM_MEM_BLOCK *Next;
};
typedef struct _UFS_PEIM_MEM_POOL {
- UFS_PEIM_MEM_BLOCK *Head;
+ UFS_PEIM_MEM_BLOCK *Head;
} UFS_PEIM_MEM_POOL;
//
// Memory allocation unit, note that the value must meet UFS spec alignment requirement.
//
-#define UFS_PEIM_MEM_UNIT 128
+#define UFS_PEIM_MEM_UNIT 128
#define UFS_PEIM_MEM_UNIT_MASK (UFS_PEIM_MEM_UNIT - 1)
#define UFS_PEIM_MEM_DEFAULT_PAGES 16
@@ -53,4 +53,3 @@ typedef struct _UFS_PEIM_MEM_POOL { } while (0)
#endif
-
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c index 1e47eb7..2baa575 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c @@ -22,15 +22,15 @@ EFI_STATUS
EFIAPI
UfsWaitMemSet (
- IN UINTN Address,
- IN UINT32 MaskValue,
- IN UINT32 TestValue,
- IN UINT64 Timeout
+ IN UINTN Address,
+ IN UINT32 MaskValue,
+ IN UINT32 TestValue,
+ IN UINT64 Timeout
)
{
- UINT32 Value;
- UINT64 Delay;
- BOOLEAN InfiniteWait;
+ UINT32 Value;
+ UINT64 Delay;
+ BOOLEAN InfiniteWait;
if (Timeout == 0) {
InfiniteWait = TRUE;
@@ -56,7 +56,6 @@ UfsWaitMemSet ( MicroSecondDelay (1);
Delay--;
-
} while (InfiniteWait || (Delay > 0));
return EFI_TIMEOUT;
@@ -71,8 +70,8 @@ UfsWaitMemSet ( **/
VOID
DumpUicCmdExecResult (
- IN UINT8 UicOpcode,
- IN UINT8 Result
+ IN UINT8 UicOpcode,
+ IN UINT8 Result
)
{
if (UicOpcode <= UfsUicDmePeerSet) {
@@ -109,7 +108,7 @@ DumpUicCmdExecResult ( case 0x0A:
DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - DME_FAILURE\n"));
break;
- default :
+ default:
ASSERT (FALSE);
break;
}
@@ -120,7 +119,7 @@ DumpUicCmdExecResult ( case 0x01:
DEBUG ((DEBUG_VERBOSE, "UIC control command fails - FAILURE\n"));
break;
- default :
+ default:
ASSERT (FALSE);
break;
}
@@ -135,7 +134,7 @@ DumpUicCmdExecResult ( **/
VOID
DumpQueryResponseResult (
- IN UINT8 Result
+ IN UINT8 Result
)
{
switch (Result) {
@@ -169,7 +168,7 @@ DumpQueryResponseResult ( case 0xFF:
DEBUG ((DEBUG_VERBOSE, "Query Response with General Failure\n"));
break;
- default :
+ default:
ASSERT (FALSE);
break;
}
@@ -185,18 +184,18 @@ DumpQueryResponseResult ( **/
VOID
SwapLittleEndianToBigEndian (
- IN OUT UINT8 *Buffer,
- IN UINT32 BufferSize
+ IN OUT UINT8 *Buffer,
+ IN UINT32 BufferSize
)
{
- UINT32 Index;
- UINT8 Temp;
- UINT32 SwapCount;
+ UINT32 Index;
+ UINT8 Temp;
+ UINT32 SwapCount;
SwapCount = BufferSize / 2;
for (Index = 0; Index < SwapCount; Index++) {
- Temp = Buffer[Index];
- Buffer[Index] = Buffer[BufferSize - 1 - Index];
+ Temp = Buffer[Index];
+ Buffer[Index] = Buffer[BufferSize - 1 - Index];
Buffer[BufferSize - 1 - Index] = Temp;
}
}
@@ -215,32 +214,32 @@ SwapLittleEndianToBigEndian ( **/
VOID
UfsFillTsfOfQueryReqUpiu (
- IN OUT UTP_UPIU_TSF *TsfBase,
- IN UINT8 Opcode,
- IN UINT8 DescId OPTIONAL,
- IN UINT8 Index OPTIONAL,
- IN UINT8 Selector OPTIONAL,
- IN UINT16 Length OPTIONAL,
- IN UINT32 Value OPTIONAL
+ IN OUT UTP_UPIU_TSF *TsfBase,
+ IN UINT8 Opcode,
+ IN UINT8 DescId OPTIONAL,
+ IN UINT8 Index OPTIONAL,
+ IN UINT8 Selector OPTIONAL,
+ IN UINT16 Length OPTIONAL,
+ IN UINT32 Value OPTIONAL
)
{
ASSERT (TsfBase != NULL);
ASSERT (Opcode <= UtpQueryFuncOpcodeTogFlag);
- TsfBase->Opcode = Opcode;
+ TsfBase->Opcode = Opcode;
if (Opcode != UtpQueryFuncOpcodeNop) {
TsfBase->DescId = DescId;
TsfBase->Index = Index;
TsfBase->Selector = Selector;
if ((Opcode == UtpQueryFuncOpcodeRdDesc) || (Opcode == UtpQueryFuncOpcodeWrDesc)) {
- SwapLittleEndianToBigEndian ((UINT8*)&Length, sizeof (Length));
+ SwapLittleEndianToBigEndian ((UINT8 *)&Length, sizeof (Length));
TsfBase->Length = Length;
}
if (Opcode == UtpQueryFuncOpcodeWrAttr) {
- SwapLittleEndianToBigEndian ((UINT8*)&Value, sizeof (Value));
- TsfBase->Value = Value;
+ SwapLittleEndianToBigEndian ((UINT8 *)&Value, sizeof (Value));
+ TsfBase->Value = Value;
}
}
}
@@ -261,16 +260,16 @@ UfsFillTsfOfQueryReqUpiu ( **/
EFI_STATUS
UfsInitCommandUpiu (
- IN OUT UTP_COMMAND_UPIU *Command,
- IN UINT8 Lun,
- IN UINT8 TaskTag,
- IN UINT8 *Cdb,
- IN UINT8 CdbLength,
- IN UFS_DATA_DIRECTION DataDirection,
- IN UINT32 ExpDataTranLen
+ IN OUT UTP_COMMAND_UPIU *Command,
+ IN UINT8 Lun,
+ IN UINT8 TaskTag,
+ IN UINT8 *Cdb,
+ IN UINT8 CdbLength,
+ IN UFS_DATA_DIRECTION DataDirection,
+ IN UINT32 ExpDataTranLen
)
{
- UINT8 Flags;
+ UINT8 Flags;
ASSERT ((Command != NULL) && (Cdb != NULL));
@@ -293,7 +292,7 @@ UfsInitCommandUpiu ( Command->Lun = Lun;
Command->TaskTag = TaskTag;
Command->CmdSet = 0x00;
- SwapLittleEndianToBigEndian ((UINT8*)&ExpDataTranLen, sizeof (ExpDataTranLen));
+ SwapLittleEndianToBigEndian ((UINT8 *)&ExpDataTranLen, sizeof (ExpDataTranLen));
Command->ExpDataTranLen = ExpDataTranLen;
CopyMem (Command->Cdb, Cdb, CdbLength);
@@ -313,15 +312,15 @@ UfsInitCommandUpiu ( **/
EFI_STATUS
UfsInitUtpPrdt (
- IN UTP_TR_PRD *Prdt,
- IN VOID *Buffer,
- IN UINT32 BufferSize
+ IN UTP_TR_PRD *Prdt,
+ IN VOID *Buffer,
+ IN UINT32 BufferSize
)
{
- UINT32 PrdtIndex;
- UINT32 RemainingLen;
- UINT8 *Remaining;
- UINTN PrdtNumber;
+ UINT32 PrdtIndex;
+ UINT32 RemainingLen;
+ UINT8 *Remaining;
+ UINTN PrdtNumber;
if ((BufferSize & (BIT0 | BIT1)) != 0) {
BufferSize &= ~(BIT0 | BIT1);
@@ -347,8 +346,8 @@ UfsInitUtpPrdt ( Prdt[PrdtIndex].DbAddr = (UINT32)RShiftU64 ((UINT64)(UINTN)Remaining, 2);
Prdt[PrdtIndex].DbAddrU = (UINT32)RShiftU64 ((UINT64)(UINTN)Remaining, 32);
- RemainingLen -= UFS_MAX_DATA_LEN_PER_PRD;
- Remaining += UFS_MAX_DATA_LEN_PER_PRD;
+ RemainingLen -= UFS_MAX_DATA_LEN_PER_PRD;
+ Remaining += UFS_MAX_DATA_LEN_PER_PRD;
}
return EFI_SUCCESS;
@@ -371,14 +370,14 @@ UfsInitUtpPrdt ( **/
EFI_STATUS
UfsInitQueryRequestUpiu (
- IN OUT UTP_QUERY_REQ_UPIU *QueryReq,
- IN UINT8 TaskTag,
- IN UINT8 Opcode,
- IN UINT8 DescId,
- IN UINT8 Index,
- IN UINT8 Selector,
- IN UINTN DataSize OPTIONAL,
- IN UINT8 *Data OPTIONAL
+ IN OUT UTP_QUERY_REQ_UPIU *QueryReq,
+ IN UINT8 TaskTag,
+ IN UINT8 Opcode,
+ IN UINT8 DescId,
+ IN UINT8 Index,
+ IN UINT8 Selector,
+ IN UINTN DataSize OPTIONAL,
+ IN UINT8 *Data OPTIONAL
)
{
ASSERT (QueryReq != NULL);
@@ -392,7 +391,7 @@ UfsInitQueryRequestUpiu ( }
if (Opcode == UtpQueryFuncOpcodeWrAttr) {
- UfsFillTsfOfQueryReqUpiu (&QueryReq->Tsf, Opcode, DescId, Index, Selector, 0, *(UINT32*)Data);
+ UfsFillTsfOfQueryReqUpiu (&QueryReq->Tsf, Opcode, DescId, Index, Selector, 0, *(UINT32 *)Data);
} else if ((Opcode == UtpQueryFuncOpcodeRdDesc) || (Opcode == UtpQueryFuncOpcodeWrDesc)) {
UfsFillTsfOfQueryReqUpiu (&QueryReq->Tsf, Opcode, DescId, Index, Selector, (UINT16)DataSize, 0);
} else {
@@ -402,7 +401,7 @@ UfsInitQueryRequestUpiu ( if (Opcode == UtpQueryFuncOpcodeWrDesc) {
CopyMem (QueryReq + 1, Data, DataSize);
- SwapLittleEndianToBigEndian ((UINT8*)&DataSize, sizeof (UINT16));
+ SwapLittleEndianToBigEndian ((UINT8 *)&DataSize, sizeof (UINT16));
QueryReq->DataSegLen = (UINT16)DataSize;
}
@@ -425,25 +424,25 @@ UfsInitQueryRequestUpiu ( **/
EFI_STATUS
UfsCreateScsiCommandDesc (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 Lun,
- IN UFS_SCSI_REQUEST_PACKET *Packet,
- IN UTP_TRD *Trd,
- OUT VOID **BufferMap
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 Lun,
+ IN UFS_SCSI_REQUEST_PACKET *Packet,
+ IN UTP_TRD *Trd,
+ OUT VOID **BufferMap
)
{
- UINT8 *CommandDesc;
- UINTN TotalLen;
- UINTN PrdtNumber;
- VOID *Buffer;
- UINT32 Length;
- UTP_COMMAND_UPIU *CommandUpiu;
- UTP_TR_PRD *PrdtBase;
- UFS_DATA_DIRECTION DataDirection;
- EFI_STATUS Status;
- EDKII_IOMMU_OPERATION MapOp;
- UINTN MapLength;
- EFI_PHYSICAL_ADDRESS BufferPhyAddr;
+ UINT8 *CommandDesc;
+ UINTN TotalLen;
+ UINTN PrdtNumber;
+ VOID *Buffer;
+ UINT32 Length;
+ UTP_COMMAND_UPIU *CommandUpiu;
+ UTP_TR_PRD *PrdtBase;
+ UFS_DATA_DIRECTION DataDirection;
+ EFI_STATUS Status;
+ EDKII_IOMMU_OPERATION MapOp;
+ UINTN MapLength;
+ EFI_PHYSICAL_ADDRESS BufferPhyAddr;
ASSERT ((Private != NULL) && (Packet != NULL) && (Trd != NULL));
@@ -455,8 +454,8 @@ UfsCreateScsiCommandDesc ( DataDirection = UfsDataIn;
MapOp = EdkiiIoMmuOperationBusMasterWrite;
} else {
- Buffer = Packet->OutDataBuffer;
- Length = Packet->OutTransferLength;
+ Buffer = Packet->OutDataBuffer;
+ Length = Packet->OutTransferLength;
DataDirection = UfsDataOut;
MapOp = EdkiiIoMmuOperationBusMasterRead;
}
@@ -465,7 +464,7 @@ UfsCreateScsiCommandDesc ( DataDirection = UfsNoData;
} else {
MapLength = Length;
- Status = IoMmuMap (MapOp, Buffer, &MapLength, &BufferPhyAddr, BufferMap);
+ Status = IoMmuMap (MapOp, Buffer, &MapLength, &BufferPhyAddr, BufferMap);
if (EFI_ERROR (Status) || (MapLength != Length)) {
DEBUG ((DEBUG_ERROR, "UfsCreateScsiCommandDesc: Fail to map data buffer.\n"));
@@ -481,11 +480,11 @@ UfsCreateScsiCommandDesc ( return EFI_OUT_OF_RESOURCES;
}
- CommandUpiu = (UTP_COMMAND_UPIU*)CommandDesc;
- PrdtBase = (UTP_TR_PRD*)(CommandDesc + ROUNDUP8 (sizeof (UTP_COMMAND_UPIU)) + ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)));
+ CommandUpiu = (UTP_COMMAND_UPIU *)CommandDesc;
+ PrdtBase = (UTP_TR_PRD *)(CommandDesc + ROUNDUP8 (sizeof (UTP_COMMAND_UPIU)) + ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)));
UfsInitCommandUpiu (CommandUpiu, Lun, Private->TaskTag++, Packet->Cdb, Packet->CdbLength, DataDirection, Length);
- UfsInitUtpPrdt (PrdtBase, (VOID*)(UINTN)BufferPhyAddr, Length);
+ UfsInitUtpPrdt (PrdtBase, (VOID *)(UINTN)BufferPhyAddr, Length);
//
// Fill UTP_TRD associated fields
@@ -525,13 +524,13 @@ UfsCreateDMCommandDesc ( IN UTP_TRD *Trd
)
{
- UINT8 *CommandDesc;
- UINTN TotalLen;
- UTP_QUERY_REQ_UPIU *QueryReqUpiu;
- UINT8 Opcode;
- UINT32 DataSize;
- UINT8 *Data;
- UINT8 DataDirection;
+ UINT8 *CommandDesc;
+ UINTN TotalLen;
+ UTP_QUERY_REQ_UPIU *QueryReqUpiu;
+ UINT8 Opcode;
+ UINT32 DataSize;
+ UINT8 *Data;
+ UINT8 DataDirection;
ASSERT ((Private != NULL) && (Packet != NULL) && (Trd != NULL));
@@ -552,13 +551,15 @@ UfsCreateDMCommandDesc ( Data = NULL;
}
- if (((Opcode != UtpQueryFuncOpcodeSetFlag) && (Opcode != UtpQueryFuncOpcodeClrFlag) && (Opcode != UtpQueryFuncOpcodeTogFlag))
- && ((DataSize == 0) || (Data == NULL))) {
+ if ( ((Opcode != UtpQueryFuncOpcodeSetFlag) && (Opcode != UtpQueryFuncOpcodeClrFlag) && (Opcode != UtpQueryFuncOpcodeTogFlag))
+ && ((DataSize == 0) || (Data == NULL)))
+ {
return EFI_INVALID_PARAMETER;
}
- if (((Opcode == UtpQueryFuncOpcodeSetFlag) || (Opcode == UtpQueryFuncOpcodeClrFlag) || (Opcode == UtpQueryFuncOpcodeTogFlag))
- && ((DataSize != 0) || (Data != NULL))) {
+ if ( ((Opcode == UtpQueryFuncOpcodeSetFlag) || (Opcode == UtpQueryFuncOpcodeClrFlag) || (Opcode == UtpQueryFuncOpcodeTogFlag))
+ && ((DataSize != 0) || (Data != NULL)))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -580,7 +581,7 @@ UfsCreateDMCommandDesc ( //
// Initialize UTP QUERY REQUEST UPIU
//
- QueryReqUpiu = (UTP_QUERY_REQ_UPIU*)CommandDesc;
+ QueryReqUpiu = (UTP_QUERY_REQ_UPIU *)CommandDesc;
UfsInitQueryRequestUpiu (
QueryReqUpiu,
Private->TaskTag++,
@@ -603,11 +604,11 @@ UfsCreateDMCommandDesc ( Trd->UcdBa = (UINT32)RShiftU64 ((UINT64)(UINTN)QueryReqUpiu, 7);
Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)QueryReqUpiu, 32);
if (Opcode == UtpQueryFuncOpcodeWrDesc) {
- Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)), sizeof (UINT32));
- Trd->RuO = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (DataSize), sizeof (UINT32));
+ Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)), sizeof (UINT32));
+ Trd->RuO = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (DataSize), sizeof (UINT32));
} else {
- Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)) + ROUNDUP8 (DataSize), sizeof (UINT32));
- Trd->RuO = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)), sizeof (UINT32));
+ Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)) + ROUNDUP8 (DataSize), sizeof (UINT32));
+ Trd->RuO = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)), sizeof (UINT32));
}
return EFI_SUCCESS;
@@ -626,13 +627,13 @@ UfsCreateDMCommandDesc ( **/
EFI_STATUS
UfsCreateNopCommandDesc (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UTP_TRD *Trd
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UTP_TRD *Trd
)
{
- UINT8 *CommandDesc;
- UINTN TotalLen;
- UTP_NOP_OUT_UPIU *NopOutUpiu;
+ UINT8 *CommandDesc;
+ UINTN TotalLen;
+ UTP_NOP_OUT_UPIU *NopOutUpiu;
ASSERT ((Private != NULL) && (Trd != NULL));
@@ -642,7 +643,7 @@ UfsCreateNopCommandDesc ( return EFI_OUT_OF_RESOURCES;
}
- NopOutUpiu = (UTP_NOP_OUT_UPIU*)CommandDesc;
+ NopOutUpiu = (UTP_NOP_OUT_UPIU *)CommandDesc;
NopOutUpiu->TaskTag = Private->TaskTag++;
@@ -673,8 +674,8 @@ UfsCreateNopCommandDesc ( **/
EFI_STATUS
UfsFindAvailableSlotInTrl (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- OUT UINT8 *Slot
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ OUT UINT8 *Slot
)
{
ASSERT ((Private != NULL) && (Slot != NULL));
@@ -688,8 +689,6 @@ UfsFindAvailableSlotInTrl ( return EFI_SUCCESS;
}
-
-
/**
Start specified slot in transfer list of a UFS device.
@@ -699,13 +698,13 @@ UfsFindAvailableSlotInTrl ( **/
VOID
UfsStartExecCmd (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
)
{
- UINTN UfsHcBase;
- UINTN Address;
- UINT32 Data;
+ UINTN UfsHcBase;
+ UINTN Address;
+ UINT32 Data;
UfsHcBase = Private->UfsHcBase;
@@ -728,13 +727,13 @@ UfsStartExecCmd ( **/
VOID
UfsStopExecCmd (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
)
{
- UINTN UfsHcBase;
- UINTN Address;
- UINT32 Data;
+ UINTN UfsHcBase;
+ UINTN Address;
+ UINT32 Data;
UfsHcBase = Private->UfsHcBase;
@@ -765,42 +764,43 @@ UfsStopExecCmd ( **/
EFI_STATUS
UfsRwDeviceDesc (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN BOOLEAN Read,
- IN UINT8 DescId,
- IN UINT8 Index,
- IN UINT8 Selector,
- IN OUT VOID *Descriptor,
- IN UINT32 DescSize
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN BOOLEAN Read,
+ IN UINT8 DescId,
+ IN UINT8 Index,
+ IN UINT8 Selector,
+ IN OUT VOID *Descriptor,
+ IN UINT32 DescSize
)
{
- EFI_STATUS Status;
- UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
- UINT8 Slot;
- UTP_TRD *Trd;
- UINTN Address;
- UTP_QUERY_RESP_UPIU *QueryResp;
- UINT8 *CmdDescBase;
- UINT32 CmdDescSize;
- UINT16 ReturnDataSize;
+ EFI_STATUS Status;
+ UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
+ UINT8 Slot;
+ UTP_TRD *Trd;
+ UINTN Address;
+ UTP_QUERY_RESP_UPIU *QueryResp;
+ UINT8 *CmdDescBase;
+ UINT32 CmdDescSize;
+ UINT16 ReturnDataSize;
ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET));
if (Read) {
- Packet.DataDirection = UfsDataIn;
- Packet.InDataBuffer = Descriptor;
- Packet.InTransferLength = DescSize;
- Packet.Opcode = UtpQueryFuncOpcodeRdDesc;
+ Packet.DataDirection = UfsDataIn;
+ Packet.InDataBuffer = Descriptor;
+ Packet.InTransferLength = DescSize;
+ Packet.Opcode = UtpQueryFuncOpcodeRdDesc;
} else {
Packet.DataDirection = UfsDataOut;
Packet.OutDataBuffer = Descriptor;
Packet.OutTransferLength = DescSize;
Packet.Opcode = UtpQueryFuncOpcodeWrDesc;
}
- Packet.DescId = DescId;
- Packet.Index = Index;
- Packet.Selector = Selector;
- Packet.Timeout = UFS_TIMEOUT;
+
+ Packet.DescId = DescId;
+ Packet.Index = Index;
+ Packet.Selector = Selector;
+ Packet.Timeout = UFS_TIMEOUT;
//
// Find out which slot of transfer request list is available.
@@ -810,7 +810,7 @@ UfsRwDeviceDesc ( return Status;
}
- Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
+ Trd = ((UTP_TRD *)Private->UtpTrlBase) + Slot;
//
// Fill transfer request descriptor to this slot.
//
@@ -823,7 +823,7 @@ UfsRwDeviceDesc ( // Check the transfer request result.
//
CmdDescBase = (UINT8 *)(UINTN)(LShiftU64 ((UINT64)Trd->UcdBaU, 32) | LShiftU64 ((UINT64)Trd->UcdBa, 7));
- QueryResp = (UTP_QUERY_RESP_UPIU*)(CmdDescBase + Trd->RuO * sizeof (UINT32));
+ QueryResp = (UTP_QUERY_RESP_UPIU *)(CmdDescBase + Trd->RuO * sizeof (UINT32));
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
@@ -835,7 +835,7 @@ UfsRwDeviceDesc ( // Wait for the completion of the transfer request.
//
Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
- Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
+ Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -848,7 +848,7 @@ UfsRwDeviceDesc ( if (Trd->Ocs == 0) {
ReturnDataSize = QueryResp->Tsf.Length;
- SwapLittleEndianToBigEndian ((UINT8*)&ReturnDataSize, sizeof (UINT16));
+ SwapLittleEndianToBigEndian ((UINT8 *)&ReturnDataSize, sizeof (UINT16));
if (Read) {
//
@@ -875,8 +875,6 @@ Exit: return Status;
}
-
-
/**
Read or write specified flag of a UFS device.
@@ -892,20 +890,20 @@ Exit: **/
EFI_STATUS
UfsRwFlags (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN BOOLEAN Read,
- IN UINT8 FlagId,
- IN OUT UINT8 *Value
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN BOOLEAN Read,
+ IN UINT8 FlagId,
+ IN OUT UINT8 *Value
)
{
- EFI_STATUS Status;
- UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
- UINT8 Slot;
- UTP_TRD *Trd;
- UINTN Address;
- UTP_QUERY_RESP_UPIU *QueryResp;
- UINT8 *CmdDescBase;
- UINT32 CmdDescSize;
+ EFI_STATUS Status;
+ UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
+ UINT8 Slot;
+ UTP_TRD *Trd;
+ UINTN Address;
+ UTP_QUERY_RESP_UPIU *QueryResp;
+ UINT8 *CmdDescBase;
+ UINT32 CmdDescSize;
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
@@ -915,22 +913,23 @@ UfsRwFlags ( if (Read) {
ASSERT (Value != NULL);
- Packet.DataDirection = UfsDataIn;
- Packet.Opcode = UtpQueryFuncOpcodeRdFlag;
+ Packet.DataDirection = UfsDataIn;
+ Packet.Opcode = UtpQueryFuncOpcodeRdFlag;
} else {
- Packet.DataDirection = UfsDataOut;
+ Packet.DataDirection = UfsDataOut;
if (*Value == 1) {
- Packet.Opcode = UtpQueryFuncOpcodeSetFlag;
+ Packet.Opcode = UtpQueryFuncOpcodeSetFlag;
} else if (*Value == 0) {
- Packet.Opcode = UtpQueryFuncOpcodeClrFlag;
+ Packet.Opcode = UtpQueryFuncOpcodeClrFlag;
} else {
return EFI_INVALID_PARAMETER;
}
}
- Packet.DescId = FlagId;
- Packet.Index = 0;
- Packet.Selector = 0;
- Packet.Timeout = UFS_TIMEOUT;
+
+ Packet.DescId = FlagId;
+ Packet.Index = 0;
+ Packet.Selector = 0;
+ Packet.Timeout = UFS_TIMEOUT;
//
// Find out which slot of transfer request list is available.
@@ -943,7 +942,7 @@ UfsRwFlags ( //
// Fill transfer request descriptor to this slot.
//
- Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
+ Trd = ((UTP_TRD *)Private->UtpTrlBase) + Slot;
Status = UfsCreateDMCommandDesc (Private, &Packet, Trd);
if (EFI_ERROR (Status)) {
return Status;
@@ -953,7 +952,7 @@ UfsRwFlags ( // Check the transfer request result.
//
CmdDescBase = (UINT8 *)(UINTN)(LShiftU64 ((UINT64)Trd->UcdBaU, 32) | LShiftU64 ((UINT64)Trd->UcdBa, 7));
- QueryResp = (UTP_QUERY_RESP_UPIU*)(CmdDescBase + Trd->RuO * sizeof (UINT32));
+ QueryResp = (UTP_QUERY_RESP_UPIU *)(CmdDescBase + Trd->RuO * sizeof (UINT32));
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
@@ -965,7 +964,7 @@ UfsRwFlags ( // Wait for the completion of the transfer request.
//
Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
- Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
+ Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -980,7 +979,7 @@ UfsRwFlags ( //
// The 'FLAG VALUE' field is at byte offset 3 of QueryResp->Tsf.Value
//
- *Value = *((UINT8*)&(QueryResp->Tsf.Value) + 3);
+ *Value = *((UINT8 *)&(QueryResp->Tsf.Value) + 3);
} else {
Status = EFI_DEVICE_ERROR;
}
@@ -1005,12 +1004,12 @@ Exit: **/
EFI_STATUS
UfsSetFlag (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 FlagId
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 FlagId
)
{
- EFI_STATUS Status;
- UINT8 Value;
+ EFI_STATUS Status;
+ UINT8 Value;
Value = 1;
Status = UfsRwFlags (Private, FALSE, FlagId, &Value);
@@ -1018,8 +1017,6 @@ UfsSetFlag ( return Status;
}
-
-
/**
Sends NOP IN cmd to a UFS device for initialization process request.
For more details, please refer to UFS 2.0 spec Figure 13.3.
@@ -1035,16 +1032,16 @@ UfsSetFlag ( **/
EFI_STATUS
UfsExecNopCmds (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- UINT8 Slot;
- UTP_TRD *Trd;
- UTP_NOP_IN_UPIU *NopInUpiu;
- UINT8 *CmdDescBase;
- UINT32 CmdDescSize;
- UINTN Address;
+ EFI_STATUS Status;
+ UINT8 Slot;
+ UTP_TRD *Trd;
+ UTP_NOP_IN_UPIU *NopInUpiu;
+ UINT8 *CmdDescBase;
+ UINT32 CmdDescSize;
+ UINTN Address;
//
// Find out which slot of transfer request list is available.
@@ -1054,7 +1051,7 @@ UfsExecNopCmds ( return Status;
}
- Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
+ Trd = ((UTP_TRD *)Private->UtpTrlBase) + Slot;
Status = UfsCreateNopCommandDesc (Private, Trd);
if (EFI_ERROR (Status)) {
return Status;
@@ -1064,7 +1061,7 @@ UfsExecNopCmds ( // Check the transfer request result.
//
CmdDescBase = (UINT8 *)(UINTN)(LShiftU64 ((UINT64)Trd->UcdBaU, 32) | LShiftU64 ((UINT64)Trd->UcdBa, 7));
- NopInUpiu = (UTP_NOP_IN_UPIU*)(CmdDescBase + Trd->RuO * sizeof (UINT32));
+ NopInUpiu = (UTP_NOP_IN_UPIU *)(CmdDescBase + Trd->RuO * sizeof (UINT32));
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
@@ -1076,7 +1073,7 @@ UfsExecNopCmds ( // Wait for the completion of the transfer request.
//
Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
- Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, UFS_TIMEOUT);
+ Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, UFS_TIMEOUT);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -1115,21 +1112,21 @@ Exit: **/
EFI_STATUS
UfsExecScsiCmds (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 Lun,
- IN OUT UFS_SCSI_REQUEST_PACKET *Packet
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 Lun,
+ IN OUT UFS_SCSI_REQUEST_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 Slot;
- UTP_TRD *Trd;
- UINTN Address;
- UINT8 *CmdDescBase;
- UINT32 CmdDescSize;
- UTP_RESPONSE_UPIU *Response;
- UINT16 SenseDataLen;
- UINT32 ResTranCount;
- VOID *PacketBufferMap;
+ EFI_STATUS Status;
+ UINT8 Slot;
+ UTP_TRD *Trd;
+ UINTN Address;
+ UINT8 *CmdDescBase;
+ UINT32 CmdDescSize;
+ UTP_RESPONSE_UPIU *Response;
+ UINT16 SenseDataLen;
+ UINT32 ResTranCount;
+ VOID *PacketBufferMap;
//
// Find out which slot of transfer request list is available.
@@ -1139,7 +1136,7 @@ UfsExecScsiCmds ( return Status;
}
- Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
+ Trd = ((UTP_TRD *)Private->UtpTrlBase) + Slot;
PacketBufferMap = NULL;
//
@@ -1150,7 +1147,7 @@ UfsExecScsiCmds ( return Status;
}
- CmdDescBase = (UINT8*)(UINTN)(LShiftU64 ((UINT64)Trd->UcdBaU, 32) | LShiftU64 ((UINT64)Trd->UcdBa, 7));
+ CmdDescBase = (UINT8 *)(UINTN)(LShiftU64 ((UINT64)Trd->UcdBaU, 32) | LShiftU64 ((UINT64)Trd->UcdBa, 7));
CmdDescSize = Trd->PrdtO * sizeof (UINT32) + Trd->PrdtL * sizeof (UTP_TR_PRD);
//
@@ -1162,7 +1159,7 @@ UfsExecScsiCmds ( // Wait for the completion of the transfer request.
//
Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
- Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet->Timeout);
+ Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet->Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -1170,9 +1167,9 @@ UfsExecScsiCmds ( //
// Get sense data if exists
//
- Response = (UTP_RESPONSE_UPIU*)(CmdDescBase + Trd->RuO * sizeof (UINT32));
+ Response = (UTP_RESPONSE_UPIU *)(CmdDescBase + Trd->RuO * sizeof (UINT32));
SenseDataLen = Response->SenseDataLen;
- SwapLittleEndianToBigEndian ((UINT8*)&SenseDataLen, sizeof (UINT16));
+ SwapLittleEndianToBigEndian ((UINT8 *)&SenseDataLen, sizeof (UINT16));
if ((Packet->SenseDataLength != 0) && (Packet->SenseData != NULL)) {
//
@@ -1199,13 +1196,13 @@ UfsExecScsiCmds ( if (Packet->DataDirection == UfsDataIn) {
if ((Response->Flags & BIT5) == BIT5) {
ResTranCount = Response->ResTranCount;
- SwapLittleEndianToBigEndian ((UINT8*)&ResTranCount, sizeof (UINT32));
+ SwapLittleEndianToBigEndian ((UINT8 *)&ResTranCount, sizeof (UINT32));
Packet->InTransferLength -= ResTranCount;
}
} else if (Packet->DataDirection == UfsDataOut) {
if ((Response->Flags & BIT5) == BIT5) {
ResTranCount = Response->ResTranCount;
- SwapLittleEndianToBigEndian ((UINT8*)&ResTranCount, sizeof (UINT32));
+ SwapLittleEndianToBigEndian ((UINT8 *)&ResTranCount, sizeof (UINT32));
Packet->OutTransferLength -= ResTranCount;
}
}
@@ -1217,13 +1214,13 @@ Exit: if (PacketBufferMap != NULL) {
IoMmuUnmap (PacketBufferMap);
}
+
UfsStopExecCmd (Private, Slot);
UfsPeimFreeMem (Private->Pool, CmdDescBase, CmdDescSize);
return Status;
}
-
/**
Sent UIC DME_LINKSTARTUP command to start the link startup procedure.
@@ -1240,11 +1237,11 @@ Exit: **/
EFI_STATUS
UfsExecUicCommands (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private,
- IN UINT8 UicOpcode,
- IN UINT32 Arg1,
- IN UINT32 Arg2,
- IN UINT32 Arg3
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private,
+ IN UINT8 UicOpcode,
+ IN UINT32 Arg1,
+ IN UINT32 Arg2,
+ IN UINT32 Arg3
)
{
EFI_STATUS Status;
@@ -1280,7 +1277,7 @@ UfsExecUicCommands ( // Host software shall only set the UICCMD if HCS.UCRDY is set to 1.
//
Address = Private->UfsHcBase + UFS_HC_STATUS_OFFSET;
- Status = UfsWaitMemSet (Address, UFS_HC_HCS_UCRDY, UFS_HC_HCS_UCRDY, UFS_TIMEOUT);
+ Status = UfsWaitMemSet (Address, UFS_HC_HCS_UCRDY, UFS_HC_HCS_UCRDY, UFS_TIMEOUT);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1303,9 +1300,9 @@ UfsExecUicCommands ( Address = UfsHcBase + UFS_HC_UCMD_ARG2_OFFSET;
Data = MmioRead32 (Address);
if ((Data & 0xFF) != 0) {
- DEBUG_CODE_BEGIN();
- DumpUicCmdExecResult (UicOpcode, (UINT8)(Data & 0xFF));
- DEBUG_CODE_END();
+ DEBUG_CODE_BEGIN ();
+ DumpUicCmdExecResult (UicOpcode, (UINT8)(Data & 0xFF));
+ DEBUG_CODE_END ();
return EFI_DEVICE_ERROR;
}
}
@@ -1321,6 +1318,7 @@ UfsExecUicCommands ( if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
+
return EFI_NOT_FOUND;
}
@@ -1340,12 +1338,12 @@ UfsExecUicCommands ( **/
EFI_STATUS
UfsEnableHostController (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- UINTN Address;
- UINT32 Data;
+ EFI_STATUS Status;
+ UINTN Address;
+ UINT32 Data;
//
// UFS 2.0 spec section 7.1.1 - Host Controller Initialization
@@ -1395,11 +1393,11 @@ UfsEnableHostController ( **/
EFI_STATUS
UfsDeviceDetection (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- UINTN Retry;
- EFI_STATUS Status;
+ UINTN Retry;
+ EFI_STATUS Status;
//
// Start UFS device detection.
@@ -1436,28 +1434,28 @@ UfsDeviceDetection ( **/
EFI_STATUS
UfsInitTaskManagementRequestList (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- UINTN Address;
- UINT32 Data;
- UINT8 Nutmrs;
- VOID *CmdDescHost;
- EFI_PHYSICAL_ADDRESS CmdDescPhyAddr;
- VOID *CmdDescMapping;
- EFI_STATUS Status;
+ UINTN Address;
+ UINT32 Data;
+ UINT8 Nutmrs;
+ VOID *CmdDescHost;
+ EFI_PHYSICAL_ADDRESS CmdDescPhyAddr;
+ VOID *CmdDescMapping;
+ EFI_STATUS Status;
//
// Initial h/w and s/w context for future operations.
//
- Address = Private->UfsHcBase + UFS_HC_CAP_OFFSET;
- Data = MmioRead32 (Address);
+ Address = Private->UfsHcBase + UFS_HC_CAP_OFFSET;
+ Data = MmioRead32 (Address);
Private->Capabilities = Data;
//
// Allocate and initialize UTP Task Management Request List.
//
- Nutmrs = (UINT8) (RShiftU64 ((Private->Capabilities & UFS_HC_CAP_NUTMRS), 16) + 1);
+ Nutmrs = (UINT8)(RShiftU64 ((Private->Capabilities & UFS_HC_CAP_NUTMRS), 16) + 1);
Status = IoMmuAllocateBuffer (
EFI_SIZE_TO_PAGES (Nutmrs * sizeof (UTP_TMRD)),
&CmdDescHost,
@@ -1478,7 +1476,7 @@ UfsInitTaskManagementRequestList ( MmioWrite32 (Address, (UINT32)(UINTN)CmdDescPhyAddr);
Address = Private->UfsHcBase + UFS_HC_UTMRLBAU_OFFSET;
MmioWrite32 (Address, (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 32));
- Private->UtpTmrlBase = (VOID*)(UINTN)CmdDescHost;
+ Private->UtpTmrlBase = (VOID *)(UINTN)CmdDescHost;
Private->Nutmrs = Nutmrs;
Private->TmrlMapping = CmdDescMapping;
@@ -1503,22 +1501,22 @@ UfsInitTaskManagementRequestList ( **/
EFI_STATUS
UfsInitTransferRequestList (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- UINTN Address;
- UINT32 Data;
- UINT8 Nutrs;
- VOID *CmdDescHost;
- EFI_PHYSICAL_ADDRESS CmdDescPhyAddr;
- VOID *CmdDescMapping;
- EFI_STATUS Status;
+ UINTN Address;
+ UINT32 Data;
+ UINT8 Nutrs;
+ VOID *CmdDescHost;
+ EFI_PHYSICAL_ADDRESS CmdDescPhyAddr;
+ VOID *CmdDescMapping;
+ EFI_STATUS Status;
//
// Initial h/w and s/w context for future operations.
//
- Address = Private->UfsHcBase + UFS_HC_CAP_OFFSET;
- Data = MmioRead32 (Address);
+ Address = Private->UfsHcBase + UFS_HC_CAP_OFFSET;
+ Data = MmioRead32 (Address);
Private->Capabilities = Data;
//
@@ -1545,7 +1543,7 @@ UfsInitTransferRequestList ( MmioWrite32 (Address, (UINT32)(UINTN)CmdDescPhyAddr);
Address = Private->UfsHcBase + UFS_HC_UTRLBAU_OFFSET;
MmioWrite32 (Address, (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 32));
- Private->UtpTrlBase = (VOID*)(UINTN)CmdDescHost;
+ Private->UtpTrlBase = (VOID *)(UINTN)CmdDescHost;
Private->Nutrs = Nutrs;
Private->TrlMapping = CmdDescMapping;
@@ -1570,10 +1568,10 @@ UfsInitTransferRequestList ( **/
EFI_STATUS
UfsControllerInit (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = UfsEnableHostController (Private);
if (EFI_ERROR (Status)) {
@@ -1624,12 +1622,12 @@ UfsControllerInit ( **/
EFI_STATUS
UfsControllerStop (
- IN UFS_PEIM_HC_PRIVATE_DATA *Private
+ IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- UINTN Address;
- UINT32 Data;
+ EFI_STATUS Status;
+ UINTN Address;
+ UINT32 Data;
//
// Enable the UTP Task Management Request List by setting the UTP Task Management
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h index e8b5aae..f19b653 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h @@ -13,62 +13,62 @@ //
// Host Capabilities Register Offsets
//
-#define UFS_HC_CAP_OFFSET 0x0000 // Controller Capabilities
-#define UFS_HC_VER_OFFSET 0x0008 // Version
-#define UFS_HC_DDID_OFFSET 0x0010 // Device ID and Device Class
-#define UFS_HC_PMID_OFFSET 0x0014 // Product ID and Manufacturer ID
-#define UFS_HC_AHIT_OFFSET 0x0018 // Auto-Hibernate Idle Timer
+#define UFS_HC_CAP_OFFSET 0x0000 // Controller Capabilities
+#define UFS_HC_VER_OFFSET 0x0008 // Version
+#define UFS_HC_DDID_OFFSET 0x0010 // Device ID and Device Class
+#define UFS_HC_PMID_OFFSET 0x0014 // Product ID and Manufacturer ID
+#define UFS_HC_AHIT_OFFSET 0x0018 // Auto-Hibernate Idle Timer
//
// Operation and Runtime Register Offsets
//
-#define UFS_HC_IS_OFFSET 0x0020 // Interrupt Status
-#define UFS_HC_IE_OFFSET 0x0024 // Interrupt Enable
-#define UFS_HC_STATUS_OFFSET 0x0030 // Host Controller Status
-#define UFS_HC_ENABLE_OFFSET 0x0034 // Host Controller Enable
-#define UFS_HC_UECPA_OFFSET 0x0038 // Host UIC Error Code PHY Adapter Layer
-#define UFS_HC_UECDL_OFFSET 0x003c // Host UIC Error Code Data Link Layer
-#define UFS_HC_UECN_OFFSET 0x0040 // Host UIC Error Code Network Layer
-#define UFS_HC_UECT_OFFSET 0x0044 // Host UIC Error Code Transport Layer
-#define UFS_HC_UECDME_OFFSET 0x0048 // Host UIC Error Code DME
-#define UFS_HC_UTRIACR_OFFSET 0x004c // UTP Transfer Request Interrupt Aggregation Control Register
+#define UFS_HC_IS_OFFSET 0x0020 // Interrupt Status
+#define UFS_HC_IE_OFFSET 0x0024 // Interrupt Enable
+#define UFS_HC_STATUS_OFFSET 0x0030 // Host Controller Status
+#define UFS_HC_ENABLE_OFFSET 0x0034 // Host Controller Enable
+#define UFS_HC_UECPA_OFFSET 0x0038 // Host UIC Error Code PHY Adapter Layer
+#define UFS_HC_UECDL_OFFSET 0x003c // Host UIC Error Code Data Link Layer
+#define UFS_HC_UECN_OFFSET 0x0040 // Host UIC Error Code Network Layer
+#define UFS_HC_UECT_OFFSET 0x0044 // Host UIC Error Code Transport Layer
+#define UFS_HC_UECDME_OFFSET 0x0048 // Host UIC Error Code DME
+#define UFS_HC_UTRIACR_OFFSET 0x004c // UTP Transfer Request Interrupt Aggregation Control Register
//
// UTP Transfer Register Offsets
//
-#define UFS_HC_UTRLBA_OFFSET 0x0050 // UTP Transfer Request List Base Address
-#define UFS_HC_UTRLBAU_OFFSET 0x0054 // UTP Transfer Request List Base Address Upper 32-Bits
-#define UFS_HC_UTRLDBR_OFFSET 0x0058 // UTP Transfer Request List Door Bell Register
-#define UFS_HC_UTRLCLR_OFFSET 0x005c // UTP Transfer Request List CLear Register
-#define UFS_HC_UTRLRSR_OFFSET 0x0060 // UTP Transfer Request Run-Stop Register
+#define UFS_HC_UTRLBA_OFFSET 0x0050 // UTP Transfer Request List Base Address
+#define UFS_HC_UTRLBAU_OFFSET 0x0054 // UTP Transfer Request List Base Address Upper 32-Bits
+#define UFS_HC_UTRLDBR_OFFSET 0x0058 // UTP Transfer Request List Door Bell Register
+#define UFS_HC_UTRLCLR_OFFSET 0x005c // UTP Transfer Request List CLear Register
+#define UFS_HC_UTRLRSR_OFFSET 0x0060 // UTP Transfer Request Run-Stop Register
//
// UTP Task Management Register Offsets
//
-#define UFS_HC_UTMRLBA_OFFSET 0x0070 // UTP Task Management Request List Base Address
-#define UFS_HC_UTMRLBAU_OFFSET 0x0074 // UTP Task Management Request List Base Address Upper 32-Bits
-#define UFS_HC_UTMRLDBR_OFFSET 0x0078 // UTP Task Management Request List Door Bell Register
-#define UFS_HC_UTMRLCLR_OFFSET 0x007c // UTP Task Management Request List CLear Register
-#define UFS_HC_UTMRLRSR_OFFSET 0x0080 // UTP Task Management Run-Stop Register
+#define UFS_HC_UTMRLBA_OFFSET 0x0070 // UTP Task Management Request List Base Address
+#define UFS_HC_UTMRLBAU_OFFSET 0x0074 // UTP Task Management Request List Base Address Upper 32-Bits
+#define UFS_HC_UTMRLDBR_OFFSET 0x0078 // UTP Task Management Request List Door Bell Register
+#define UFS_HC_UTMRLCLR_OFFSET 0x007c // UTP Task Management Request List CLear Register
+#define UFS_HC_UTMRLRSR_OFFSET 0x0080 // UTP Task Management Run-Stop Register
//
// UIC Command Register Offsets
//
-#define UFS_HC_UIC_CMD_OFFSET 0x0090 // UIC Command Register
-#define UFS_HC_UCMD_ARG1_OFFSET 0x0094 // UIC Command Argument 1
-#define UFS_HC_UCMD_ARG2_OFFSET 0x0098 // UIC Command Argument 2
-#define UFS_HC_UCMD_ARG3_OFFSET 0x009c // UIC Command Argument 3
+#define UFS_HC_UIC_CMD_OFFSET 0x0090 // UIC Command Register
+#define UFS_HC_UCMD_ARG1_OFFSET 0x0094 // UIC Command Argument 1
+#define UFS_HC_UCMD_ARG2_OFFSET 0x0098 // UIC Command Argument 2
+#define UFS_HC_UCMD_ARG3_OFFSET 0x009c // UIC Command Argument 3
//
// UMA Register Offsets
//
-#define UFS_HC_UMA_OFFSET 0x00b0 // Reserved for Unified Memory Extension
+#define UFS_HC_UMA_OFFSET 0x00b0 // Reserved for Unified Memory Extension
-#define UFS_HC_HCE_EN BIT0
-#define UFS_HC_HCS_DP BIT0
-#define UFS_HC_HCS_UCRDY BIT3
-#define UFS_HC_IS_ULSS BIT8
-#define UFS_HC_IS_UCCS BIT10
-#define UFS_HC_CAP_64ADDR BIT24
-#define UFS_HC_CAP_NUTMRS (BIT16 | BIT17 | BIT18)
-#define UFS_HC_CAP_NUTRS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4)
-#define UFS_HC_UTMRLRSR BIT0
-#define UFS_HC_UTRLRSR BIT0
+#define UFS_HC_HCE_EN BIT0
+#define UFS_HC_HCS_DP BIT0
+#define UFS_HC_HCS_UCRDY BIT3
+#define UFS_HC_IS_ULSS BIT8
+#define UFS_HC_IS_UCCS BIT10
+#define UFS_HC_CAP_64ADDR BIT24
+#define UFS_HC_CAP_NUTMRS (BIT16 | BIT17 | BIT18)
+#define UFS_HC_CAP_NUTRS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4)
+#define UFS_HC_UTMRLRSR BIT0
+#define UFS_HC_UTRLRSR BIT0
//
// The initial value of the OCS field of UTP TRD or TMRD descriptor
@@ -79,25 +79,25 @@ //
// A maximum of length of 256KB is supported by PRDT entry
//
-#define UFS_MAX_DATA_LEN_PER_PRD 0x40000
+#define UFS_MAX_DATA_LEN_PER_PRD 0x40000
-#define UFS_STORAGE_COMMAND_TYPE 0x01
+#define UFS_STORAGE_COMMAND_TYPE 0x01
-#define UFS_REGULAR_COMMAND 0x00
-#define UFS_INTERRUPT_COMMAND 0x01
+#define UFS_REGULAR_COMMAND 0x00
+#define UFS_INTERRUPT_COMMAND 0x01
-#define UFS_LUN_0 0x00
-#define UFS_LUN_1 0x01
-#define UFS_LUN_2 0x02
-#define UFS_LUN_3 0x03
-#define UFS_LUN_4 0x04
-#define UFS_LUN_5 0x05
-#define UFS_LUN_6 0x06
-#define UFS_LUN_7 0x07
-#define UFS_WLUN_REPORT_LUNS 0x81
-#define UFS_WLUN_UFS_DEV 0xD0
-#define UFS_WLUN_BOOT 0xB0
-#define UFS_WLUN_RPMB 0xC4
+#define UFS_LUN_0 0x00
+#define UFS_LUN_1 0x01
+#define UFS_LUN_2 0x02
+#define UFS_LUN_3 0x03
+#define UFS_LUN_4 0x04
+#define UFS_LUN_5 0x05
+#define UFS_LUN_6 0x06
+#define UFS_LUN_7 0x07
+#define UFS_WLUN_REPORT_LUNS 0x81
+#define UFS_WLUN_UFS_DEV 0xD0
+#define UFS_WLUN_BOOT 0xB0
+#define UFS_WLUN_RPMB 0xC4
#pragma pack(1)
@@ -105,227 +105,227 @@ // UFSHCI 2.0 Spec Section 5.2.1 Offset 00h: CAP - Controller Capabilities
//
typedef struct {
- UINT8 Nutrs:4; // Number of UTP Transfer Request Slots
- UINT8 Rsvd1:4;
+ UINT8 Nutrs : 4; // Number of UTP Transfer Request Slots
+ UINT8 Rsvd1 : 4;
- UINT8 NoRtt; // Number of outstanding READY TO TRANSFER (RTT) requests supported
+ UINT8 NoRtt; // Number of outstanding READY TO TRANSFER (RTT) requests supported
- UINT8 Nutmrs:3; // Number of UTP Task Management Request Slots
- UINT8 Rsvd2:4;
- UINT8 AutoHs:1; // Auto-Hibernation Support
+ UINT8 Nutmrs : 3; // Number of UTP Task Management Request Slots
+ UINT8 Rsvd2 : 4;
+ UINT8 AutoHs : 1; // Auto-Hibernation Support
- UINT8 As64:1; // 64-bit addressing supported
- UINT8 Oodds:1; // Out of order data delivery supported
- UINT8 UicDmetms:1; // UIC DME_TEST_MODE command supported
- UINT8 Ume:1; // Reserved for Unified Memory Extension
- UINT8 Rsvd4:4;
+ UINT8 As64 : 1; // 64-bit addressing supported
+ UINT8 Oodds : 1; // Out of order data delivery supported
+ UINT8 UicDmetms : 1; // UIC DME_TEST_MODE command supported
+ UINT8 Ume : 1; // Reserved for Unified Memory Extension
+ UINT8 Rsvd4 : 4;
} UFS_HC_CAP;
//
// UFSHCI 2.0 Spec Section 5.2.2 Offset 08h: VER - UFS Version
//
typedef struct {
- UINT8 Vs:4; // Version Suffix
- UINT8 Mnr:4; // Minor version number
+ UINT8 Vs : 4; // Version Suffix
+ UINT8 Mnr : 4; // Minor version number
- UINT8 Mjr; // Major version number
+ UINT8 Mjr; // Major version number
- UINT16 Rsvd1;
+ UINT16 Rsvd1;
} UFS_HC_VER;
//
// UFSHCI 2.0 Spec Section 5.2.3 Offset 10h: HCPID - Host Controller Product ID
//
-#define UFS_HC_PID UINT32
+#define UFS_HC_PID UINT32
//
// UFSHCI 2.0 Spec Section 5.2.4 Offset 14h: HCMID - Host Controller Manufacturer ID
//
-#define UFS_HC_MID UINT32
+#define UFS_HC_MID UINT32
//
// UFSHCI 2.0 Spec Section 5.2.5 Offset 18h: AHIT - Auto-Hibernate Idle Timer
//
typedef struct {
- UINT32 Ahitv:10; // Auto-Hibernate Idle Timer Value
- UINT32 Ts:3; // Timer scale
- UINT32 Rsvd1:19;
+ UINT32 Ahitv : 10; // Auto-Hibernate Idle Timer Value
+ UINT32 Ts : 3; // Timer scale
+ UINT32 Rsvd1 : 19;
} UFS_HC_AHIT;
//
// UFSHCI 2.0 Spec Section 5.3.1 Offset 20h: IS - Interrupt Status
//
typedef struct {
- UINT16 Utrcs:1; // UTP Transfer Request Completion Status
- UINT16 Udepri:1; // UIC DME_ENDPOINT_RESET Indication
- UINT16 Ue:1; // UIC Error
- UINT16 Utms:1; // UIC Test Mode Status
-
- UINT16 Upms:1; // UIC Power Mode Status
- UINT16 Uhxs:1; // UIC Hibernate Exit Status
- UINT16 Uhes:1; // UIC Hibernate Enter Status
- UINT16 Ulls:1; // UIC Link Lost Status
-
- UINT16 Ulss:1; // UIC Link Startup Status
- UINT16 Utmrcs:1; // UTP Task Management Request Completion Status
- UINT16 Uccs:1; // UIC Command Completion Status
- UINT16 Dfes:1; // Device Fatal Error Status
-
- UINT16 Utpes:1; // UTP Error Status
- UINT16 Rsvd1:3;
-
- UINT16 Hcfes:1; // Host Controller Fatal Error Status
- UINT16 Sbfes:1; // System Bus Fatal Error Status
- UINT16 Rsvd2:14;
+ UINT16 Utrcs : 1; // UTP Transfer Request Completion Status
+ UINT16 Udepri : 1; // UIC DME_ENDPOINT_RESET Indication
+ UINT16 Ue : 1; // UIC Error
+ UINT16 Utms : 1; // UIC Test Mode Status
+
+ UINT16 Upms : 1; // UIC Power Mode Status
+ UINT16 Uhxs : 1; // UIC Hibernate Exit Status
+ UINT16 Uhes : 1; // UIC Hibernate Enter Status
+ UINT16 Ulls : 1; // UIC Link Lost Status
+
+ UINT16 Ulss : 1; // UIC Link Startup Status
+ UINT16 Utmrcs : 1; // UTP Task Management Request Completion Status
+ UINT16 Uccs : 1; // UIC Command Completion Status
+ UINT16 Dfes : 1; // Device Fatal Error Status
+
+ UINT16 Utpes : 1; // UTP Error Status
+ UINT16 Rsvd1 : 3;
+
+ UINT16 Hcfes : 1; // Host Controller Fatal Error Status
+ UINT16 Sbfes : 1; // System Bus Fatal Error Status
+ UINT16 Rsvd2 : 14;
} UFS_HC_IS;
//
// UFSHCI 2.0 Spec Section 5.3.2 Offset 24h: IE - Interrupt Enable
//
typedef struct {
- UINT16 Utrce:1; // UTP Transfer Request Completion Enable
- UINT16 Udeprie:1; // UIC DME_ENDPOINT_RESET Enable
- UINT16 Uee:1; // UIC Error Enable
- UINT16 Utmse:1; // UIC Test Mode Status Enable
-
- UINT16 Upmse:1; // UIC Power Mode Status Enable
- UINT16 Uhxse:1; // UIC Hibernate Exit Status Enable
- UINT16 Uhese:1; // UIC Hibernate Enter Status Enable
- UINT16 Ullse:1; // UIC Link Lost Status Enable
-
- UINT16 Ulsse:1; // UIC Link Startup Status Enable
- UINT16 Utmrce:1; // UTP Task Management Request Completion Enable
- UINT16 Ucce:1; // UIC Command Completion Enable
- UINT16 Dfee:1; // Device Fatal Error Enable
-
- UINT16 Utpee:1; // UTP Error Enable
- UINT16 Rsvd1:3;
-
- UINT16 Hcfee:1; // Host Controller Fatal Error Enable
- UINT16 Sbfee:1; // System Bus Fatal Error Enable
- UINT16 Rsvd2:14;
+ UINT16 Utrce : 1; // UTP Transfer Request Completion Enable
+ UINT16 Udeprie : 1; // UIC DME_ENDPOINT_RESET Enable
+ UINT16 Uee : 1; // UIC Error Enable
+ UINT16 Utmse : 1; // UIC Test Mode Status Enable
+
+ UINT16 Upmse : 1; // UIC Power Mode Status Enable
+ UINT16 Uhxse : 1; // UIC Hibernate Exit Status Enable
+ UINT16 Uhese : 1; // UIC Hibernate Enter Status Enable
+ UINT16 Ullse : 1; // UIC Link Lost Status Enable
+
+ UINT16 Ulsse : 1; // UIC Link Startup Status Enable
+ UINT16 Utmrce : 1; // UTP Task Management Request Completion Enable
+ UINT16 Ucce : 1; // UIC Command Completion Enable
+ UINT16 Dfee : 1; // Device Fatal Error Enable
+
+ UINT16 Utpee : 1; // UTP Error Enable
+ UINT16 Rsvd1 : 3;
+
+ UINT16 Hcfee : 1; // Host Controller Fatal Error Enable
+ UINT16 Sbfee : 1; // System Bus Fatal Error Enable
+ UINT16 Rsvd2 : 14;
} UFS_HC_IE;
//
// UFSHCI 2.0 Spec Section 5.3.3 Offset 30h: HCS - Host Controller Status
//
typedef struct {
- UINT8 Dp:1; // Device Present
- UINT8 UtrlRdy:1; // UTP Transfer Request List Ready
- UINT8 UtmrlRdy:1; // UTP Task Management Request List Ready
- UINT8 UcRdy:1; // UIC COMMAND Ready
- UINT8 Rsvd1:4;
-
- UINT8 Upmcrs:3; // UIC Power Mode Change Request Status
- UINT8 Rsvd2:1; // UIC Hibernate Exit Status Enable
- UINT8 Utpec:4; // UTP Error Code
-
- UINT8 TtagUtpE; // Task Tag of UTP error
- UINT8 TlunUtpE; // Target LUN of UTP error
+ UINT8 Dp : 1; // Device Present
+ UINT8 UtrlRdy : 1; // UTP Transfer Request List Ready
+ UINT8 UtmrlRdy : 1; // UTP Task Management Request List Ready
+ UINT8 UcRdy : 1; // UIC COMMAND Ready
+ UINT8 Rsvd1 : 4;
+
+ UINT8 Upmcrs : 3; // UIC Power Mode Change Request Status
+ UINT8 Rsvd2 : 1; // UIC Hibernate Exit Status Enable
+ UINT8 Utpec : 4; // UTP Error Code
+
+ UINT8 TtagUtpE; // Task Tag of UTP error
+ UINT8 TlunUtpE; // Target LUN of UTP error
} UFS_HC_STATUS;
//
// UFSHCI 2.0 Spec Section 5.3.4 Offset 34h: HCE - Host Controller Enable
//
typedef struct {
- UINT32 Hce:1; // Host Controller Enable
- UINT32 Rsvd1:31;
+ UINT32 Hce : 1; // Host Controller Enable
+ UINT32 Rsvd1 : 31;
} UFS_HC_ENABLE;
//
// UFSHCI 2.0 Spec Section 5.3.5 Offset 38h: UECPA - Host UIC Error Code PHY Adapter Layer
//
typedef struct {
- UINT32 Ec:5; // UIC PHY Adapter Layer Error Code
- UINT32 Rsvd1:26;
- UINT32 Err:1; // UIC PHY Adapter Layer Error
+ UINT32 Ec : 5; // UIC PHY Adapter Layer Error Code
+ UINT32 Rsvd1 : 26;
+ UINT32 Err : 1; // UIC PHY Adapter Layer Error
} UFS_HC_UECPA;
//
// UFSHCI 2.0 Spec Section 5.3.6 Offset 3ch: UECDL - Host UIC Error Code Data Link Layer
//
typedef struct {
- UINT32 Ec:15; // UIC Data Link Layer Error Code
- UINT32 Rsvd1:16;
- UINT32 Err:1; // UIC Data Link Layer Error
+ UINT32 Ec : 15; // UIC Data Link Layer Error Code
+ UINT32 Rsvd1 : 16;
+ UINT32 Err : 1; // UIC Data Link Layer Error
} UFS_HC_UECDL;
//
// UFSHCI 2.0 Spec Section 5.3.7 Offset 40h: UECN - Host UIC Error Code Network Layer
//
typedef struct {
- UINT32 Ec:3; // UIC Network Layer Error Code
- UINT32 Rsvd1:28;
- UINT32 Err:1; // UIC Network Layer Error
+ UINT32 Ec : 3; // UIC Network Layer Error Code
+ UINT32 Rsvd1 : 28;
+ UINT32 Err : 1; // UIC Network Layer Error
} UFS_HC_UECN;
//
// UFSHCI 2.0 Spec Section 5.3.8 Offset 44h: UECT - Host UIC Error Code Transport Layer
//
typedef struct {
- UINT32 Ec:7; // UIC Transport Layer Error Code
- UINT32 Rsvd1:24;
- UINT32 Err:1; // UIC Transport Layer Error
+ UINT32 Ec : 7; // UIC Transport Layer Error Code
+ UINT32 Rsvd1 : 24;
+ UINT32 Err : 1; // UIC Transport Layer Error
} UFS_HC_UECT;
//
// UFSHCI 2.0 Spec Section 5.3.9 Offset 48h: UECDME - Host UIC Error Code
//
typedef struct {
- UINT32 Ec:1; // UIC DME Error Code
- UINT32 Rsvd1:30;
- UINT32 Err:1; // UIC DME Error
+ UINT32 Ec : 1; // UIC DME Error Code
+ UINT32 Rsvd1 : 30;
+ UINT32 Err : 1; // UIC DME Error
} UFS_HC_UECDME;
//
// UFSHCI 2.0 Spec Section 5.3.10 Offset 4Ch: UTRIACR - UTP Transfer Request Interrupt Aggregation Control Register
//
typedef struct {
- UINT8 IaToVal; // Interrupt aggregation timeout value
+ UINT8 IaToVal; // Interrupt aggregation timeout value
- UINT8 IacTh:5; // Interrupt aggregation counter threshold
- UINT8 Rsvd1:3;
+ UINT8 IacTh : 5; // Interrupt aggregation counter threshold
+ UINT8 Rsvd1 : 3;
- UINT8 Ctr:1; // Counter and Timer Reset
- UINT8 Rsvd2:3;
- UINT8 Iasb:1; // Interrupt aggregation status bit
- UINT8 Rsvd3:3;
+ UINT8 Ctr : 1; // Counter and Timer Reset
+ UINT8 Rsvd2 : 3;
+ UINT8 Iasb : 1; // Interrupt aggregation status bit
+ UINT8 Rsvd3 : 3;
- UINT8 IapwEn:1; // Interrupt aggregation parameter write enable
- UINT8 Rsvd4:6;
- UINT8 IaEn:1; // Interrupt Aggregation Enable/Disable
+ UINT8 IapwEn : 1; // Interrupt aggregation parameter write enable
+ UINT8 Rsvd4 : 6;
+ UINT8 IaEn : 1; // Interrupt Aggregation Enable/Disable
} UFS_HC_UTRIACR;
//
// UFSHCI 2.0 Spec Section 5.4.1 Offset 50h: UTRLBA - UTP Transfer Request List Base Address
//
typedef struct {
- UINT32 Rsvd1:10;
- UINT32 UtrlBa:22; // UTP Transfer Request List Base Address
+ UINT32 Rsvd1 : 10;
+ UINT32 UtrlBa : 22; // UTP Transfer Request List Base Address
} UFS_HC_UTRLBA;
//
// UFSHCI 2.0 Spec Section 5.4.2 Offset 54h: UTRLBAU - UTP Transfer Request List Base Address Upper 32-bits
//
-#define UFS_HC_UTRLBAU UINT32
+#define UFS_HC_UTRLBAU UINT32
//
// UFSHCI 2.0 Spec Section 5.4.3 Offset 58h: UTRLDBR - UTP Transfer Request List Door Bell Register
//
-#define UFS_HC_UTRLDBR UINT32
+#define UFS_HC_UTRLDBR UINT32
//
// UFSHCI 2.0 Spec Section 5.4.4 Offset 5Ch: UTRLCLR - UTP Transfer Request List CLear Register
//
-#define UFS_HC_UTRLCLR UINT32
+#define UFS_HC_UTRLCLR UINT32
#if 0
//
// UFSHCI 2.0 Spec Section 5.4.5 Offset 60h: UTRLRSR - UTP Transfer Request List Run Stop Register
//
typedef struct {
- UINT32 UtrlRsr:1; // UTP Transfer Request List Run-Stop Register
- UINT32 Rsvd1:31;
+ UINT32 UtrlRsr : 1; // UTP Transfer Request List Run-Stop Register
+ UINT32 Rsvd1 : 31;
} UFS_HC_UTRLRSR;
#endif
@@ -333,29 +333,29 @@ typedef struct { // UFSHCI 2.0 Spec Section 5.5.1 Offset 70h: UTMRLBA - UTP Task Management Request List Base Address
//
typedef struct {
- UINT32 Rsvd1:10;
- UINT32 UtmrlBa:22; // UTP Task Management Request List Base Address
+ UINT32 Rsvd1 : 10;
+ UINT32 UtmrlBa : 22; // UTP Task Management Request List Base Address
} UFS_HC_UTMRLBA;
//
// UFSHCI 2.0 Spec Section 5.5.2 Offset 74h: UTMRLBAU - UTP Task Management Request List Base Address Upper 32-bits
//
-#define UFS_HC_UTMRLBAU UINT32
+#define UFS_HC_UTMRLBAU UINT32
//
// UFSHCI 2.0 Spec Section 5.5.3 Offset 78h: UTMRLDBR - UTP Task Management Request List Door Bell Register
//
typedef struct {
- UINT32 UtmrlDbr:8; // UTP Task Management Request List Door bell Register
- UINT32 Rsvd1:24;
+ UINT32 UtmrlDbr : 8; // UTP Task Management Request List Door bell Register
+ UINT32 Rsvd1 : 24;
} UFS_HC_UTMRLDBR;
//
// UFSHCI 2.0 Spec Section 5.5.4 Offset 7Ch: UTMRLCLR - UTP Task Management Request List CLear Register
//
typedef struct {
- UINT32 UtmrlClr:8; // UTP Task Management List Clear Register
- UINT32 Rsvd1:24;
+ UINT32 UtmrlClr : 8; // UTP Task Management List Clear Register
+ UINT32 Rsvd1 : 24;
} UFS_HC_UTMRLCLR;
#if 0
@@ -363,8 +363,8 @@ typedef struct { // UFSHCI 2.0 Spec Section 5.5.5 Offset 80h: UTMRLRSR - UTP Task Management Request List Run Stop Register
//
typedef struct {
- UINT32 UtmrlRsr:1; // UTP Task Management Request List Run-Stop Register
- UINT32 Rsvd1:31;
+ UINT32 UtmrlRsr : 1; // UTP Task Management Request List Run-Stop Register
+ UINT32 Rsvd1 : 31;
} UFS_HC_UTMRLRSR;
#endif
@@ -372,24 +372,24 @@ typedef struct { // UFSHCI 2.0 Spec Section 5.6.1 Offset 90h: UICCMD - UIC Command
//
typedef struct {
- UINT32 CmdOp:8; // Command Opcode
- UINT32 Rsvd1:24;
+ UINT32 CmdOp : 8; // Command Opcode
+ UINT32 Rsvd1 : 24;
} UFS_HC_UICCMD;
//
// UFSHCI 2.0 Spec Section 5.6.2 Offset 94h: UICCMDARG1 - UIC Command Argument 1
//
-#define UFS_HC_UICCMD_ARG1 UINT32
+#define UFS_HC_UICCMD_ARG1 UINT32
//
// UFSHCI 2.0 Spec Section 5.6.2 Offset 98h: UICCMDARG2 - UIC Command Argument 2
//
-#define UFS_HC_UICCMD_ARG2 UINT32
+#define UFS_HC_UICCMD_ARG2 UINT32
//
// UFSHCI 2.0 Spec Section 5.6.2 Offset 9ch: UICCMDARG3 - UIC Command Argument 3
//
-#define UFS_HC_UICCMD_ARG3 UINT32
+#define UFS_HC_UICCMD_ARG3 UINT32
//
// UIC command opcodes
@@ -417,74 +417,74 @@ typedef struct { //
// DW0
//
- UINT32 Rsvd1:24;
- UINT32 Int:1; /* Interrupt */
- UINT32 Dd:2; /* Data Direction */
- UINT32 Rsvd2:1;
- UINT32 Ct:4; /* Command Type */
+ UINT32 Rsvd1 : 24;
+ UINT32 Int : 1; /* Interrupt */
+ UINT32 Dd : 2; /* Data Direction */
+ UINT32 Rsvd2 : 1;
+ UINT32 Ct : 4; /* Command Type */
//
// DW1
//
- UINT32 Rsvd3;
+ UINT32 Rsvd3;
//
// DW2
//
- UINT32 Ocs:8; /* Overall Command Status */
- UINT32 Rsvd4:24;
+ UINT32 Ocs : 8; /* Overall Command Status */
+ UINT32 Rsvd4 : 24;
//
// DW3
//
- UINT32 Rsvd5;
+ UINT32 Rsvd5;
//
// DW4
//
- UINT32 Rsvd6:7;
- UINT32 UcdBa:25; /* UTP Command Descriptor Base Address */
+ UINT32 Rsvd6 : 7;
+ UINT32 UcdBa : 25; /* UTP Command Descriptor Base Address */
//
// DW5
//
- UINT32 UcdBaU; /* UTP Command Descriptor Base Address Upper 32-bits */
+ UINT32 UcdBaU; /* UTP Command Descriptor Base Address Upper 32-bits */
//
// DW6
//
- UINT16 RuL; /* Response UPIU Length */
- UINT16 RuO; /* Response UPIU Offset */
+ UINT16 RuL; /* Response UPIU Length */
+ UINT16 RuO; /* Response UPIU Offset */
//
// DW7
//
- UINT16 PrdtL; /* PRDT Length */
- UINT16 PrdtO; /* PRDT Offset */
+ UINT16 PrdtL; /* PRDT Length */
+ UINT16 PrdtO; /* PRDT Offset */
} UTP_TRD;
typedef struct {
//
// DW0
//
- UINT32 Rsvd1:2;
- UINT32 DbAddr:30; /* Data Base Address */
+ UINT32 Rsvd1 : 2;
+ UINT32 DbAddr : 30; /* Data Base Address */
//
// DW1
//
- UINT32 DbAddrU; /* Data Base Address Upper 32-bits */
+ UINT32 DbAddrU; /* Data Base Address Upper 32-bits */
//
// DW2
//
- UINT32 Rsvd2;
+ UINT32 Rsvd2;
//
// DW3
//
- UINT32 DbCount:18; /* Data Byte Count */
- UINT32 Rsvd3:14;
+ UINT32 DbCount : 18; /* Data Byte Count */
+ UINT32 Rsvd3 : 14;
} UTP_TR_PRD;
//
@@ -494,38 +494,38 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x01*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x01*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 CmdSet:4; /* Command Set Type */
- UINT8 Rsvd1:4;
- UINT8 Rsvd2;
- UINT8 Rsvd3;
- UINT8 Rsvd4;
+ UINT8 CmdSet : 4; /* Command Set Type */
+ UINT8 Rsvd1 : 4;
+ UINT8 Rsvd2;
+ UINT8 Rsvd3;
+ UINT8 Rsvd4;
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd5;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd5;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3
//
- UINT32 ExpDataTranLen; /* Expected Data Transfer Length - Big Endian */
+ UINT32 ExpDataTranLen; /* Expected Data Transfer Length - Big Endian */
//
// DW4 - DW7
//
- UINT8 Cdb[16];
+ UINT8 Cdb[16];
} UTP_COMMAND_UPIU;
//
@@ -535,44 +535,44 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x21*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x21*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 CmdSet:4; /* Command Set Type */
- UINT8 Rsvd1:4;
- UINT8 Rsvd2;
- UINT8 Response; /* Response */
- UINT8 Status; /* Status */
+ UINT8 CmdSet : 4; /* Command Set Type */
+ UINT8 Rsvd1 : 4;
+ UINT8 Rsvd2;
+ UINT8 Response; /* Response */
+ UINT8 Status; /* Status */
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 DevInfo; /* Device Information */
- UINT16 DataSegLen; /* Data Segment Length - Big Endian */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 DevInfo; /* Device Information */
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian */
//
// DW3
//
- UINT32 ResTranCount; /* Residual Transfer Count - Big Endian */
+ UINT32 ResTranCount; /* Residual Transfer Count - Big Endian */
//
// DW4 - DW7
//
- UINT8 Rsvd3[16];
+ UINT8 Rsvd3[16];
//
// Data Segment - Sense Data
//
- UINT16 SenseDataLen; /* Sense Data Length - Big Endian */
- UINT8 SenseData[18]; /* Sense Data */
+ UINT16 SenseDataLen; /* Sense Data Length - Big Endian */
+ UINT8 SenseData[18]; /* Sense Data */
} UTP_RESPONSE_UPIU;
//
@@ -582,44 +582,44 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x02*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x02*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1[4];
+ UINT8 Rsvd1[4];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd2;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd2;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian */
//
// DW3
//
- UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
+ UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
//
// DW4
//
- UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
+ UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
//
// DW5 - DW7
//
- UINT8 Rsvd3[12];
+ UINT8 Rsvd3[12];
//
// Data Segment - Data to be sent out
//
- //UINT8 Data[]; /* Data to be sent out, maximum is 65535 bytes */
+ // UINT8 Data[]; /* Data to be sent out, maximum is 65535 bytes */
} UTP_DATA_OUT_UPIU;
//
@@ -629,44 +629,44 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x22*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x22*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1[4];
+ UINT8 Rsvd1[4];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd2;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd2;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian */
//
// DW3
//
- UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
+ UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
//
// DW4
//
- UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
+ UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
//
// DW5 - DW7
//
- UINT8 Rsvd3[12];
+ UINT8 Rsvd3[12];
//
// Data Segment - Data to be read
//
- //UINT8 Data[]; /* Data to be read, maximum is 65535 bytes */
+ // UINT8 Data[]; /* Data to be read, maximum is 65535 bytes */
} UTP_DATA_IN_UPIU;
//
@@ -676,44 +676,44 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x31*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x31*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1[4];
+ UINT8 Rsvd1[4];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd2;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd2;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3
//
- UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
+ UINT32 DataBufOffset; /* Data Buffer Offset - Big Endian */
//
// DW4
//
- UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
+ UINT32 DataTranCount; /* Data Transfer Count - Big Endian */
//
// DW5 - DW7
//
- UINT8 Rsvd3[12];
+ UINT8 Rsvd3[12];
//
// Data Segment - Data to be read
//
- //UINT8 Data[]; /* Data to be read, maximum is 65535 bytes */
+ // UINT8 Data[]; /* Data to be read, maximum is 65535 bytes */
} UTP_RDY_TO_TRAN_UPIU;
//
@@ -723,46 +723,46 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x04*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x04*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1;
- UINT8 TskManFunc; /* Task Management Function */
- UINT8 Rsvd2[2];
+ UINT8 Rsvd1;
+ UINT8 TskManFunc; /* Task Management Function */
+ UINT8 Rsvd2[2];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd3;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd3;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3
//
- UINT32 InputParam1; /* Input Parameter 1 - Big Endian */
+ UINT32 InputParam1; /* Input Parameter 1 - Big Endian */
//
// DW4
//
- UINT32 InputParam2; /* Input Parameter 2 - Big Endian */
+ UINT32 InputParam2; /* Input Parameter 2 - Big Endian */
//
// DW5
//
- UINT32 InputParam3; /* Input Parameter 3 - Big Endian */
+ UINT32 InputParam3; /* Input Parameter 3 - Big Endian */
//
// DW6 - DW7
//
- UINT8 Rsvd4[8];
+ UINT8 Rsvd4[8];
} UTP_TM_REQ_UPIU;
//
@@ -772,41 +772,41 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x24*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x24*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1[2];
- UINT8 Resp; /* Response */
- UINT8 Rsvd2;
+ UINT8 Rsvd1[2];
+ UINT8 Resp; /* Response */
+ UINT8 Rsvd2;
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd3;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd3;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3
//
- UINT32 OutputParam1; /* Output Parameter 1 - Big Endian */
+ UINT32 OutputParam1; /* Output Parameter 1 - Big Endian */
//
// DW4
//
- UINT32 OutputParam2; /* Output Parameter 2 - Big Endian */
+ UINT32 OutputParam2; /* Output Parameter 2 - Big Endian */
//
// DW5 - DW7
//
- UINT8 Rsvd4[12];
+ UINT8 Rsvd4[12];
} UTP_TM_RESP_UPIU;
//
@@ -816,47 +816,46 @@ typedef struct { //
// DW0
//
- UINT32 Rsvd1:24;
- UINT32 Int:1; /* Interrupt */
- UINT32 Rsvd2:7;
+ UINT32 Rsvd1 : 24;
+ UINT32 Int : 1; /* Interrupt */
+ UINT32 Rsvd2 : 7;
//
// DW1
//
- UINT32 Rsvd3;
+ UINT32 Rsvd3;
//
// DW2
//
- UINT32 Ocs:8; /* Overall Command Status */
- UINT32 Rsvd4:24;
+ UINT32 Ocs : 8; /* Overall Command Status */
+ UINT32 Rsvd4 : 24;
//
// DW3
//
- UINT32 Rsvd5;
+ UINT32 Rsvd5;
//
// DW4 - DW11
//
- UTP_TM_REQ_UPIU TmReq; /* Task Management Request UPIU */
+ UTP_TM_REQ_UPIU TmReq; /* Task Management Request UPIU */
//
// DW12 - DW19
//
- UTP_TM_RESP_UPIU TmResp; /* Task Management Response UPIU */
+ UTP_TM_RESP_UPIU TmResp; /* Task Management Response UPIU */
} UTP_TMRD;
-
typedef struct {
- UINT8 Opcode;
- UINT8 DescId;
- UINT8 Index;
- UINT8 Selector;
- UINT16 Rsvd1;
- UINT16 Length;
- UINT32 Value;
- UINT32 Rsvd2;
+ UINT8 Opcode;
+ UINT8 DescId;
+ UINT8 Index;
+ UINT8 Selector;
+ UINT16 Rsvd1;
+ UINT16 Length;
+ UINT32 Value;
+ UINT32 Rsvd2;
} UTP_UPIU_TSF;
//
@@ -866,56 +865,56 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x16*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Rsvd1;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x16*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Rsvd1;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd2;
- UINT8 QueryFunc; /* Query Function */
- UINT8 Rsvd3[2];
+ UINT8 Rsvd2;
+ UINT8 QueryFunc; /* Query Function */
+ UINT8 Rsvd3[2];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd4;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd4;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian */
//
// DW3 - 6
//
- UTP_UPIU_TSF Tsf; /* Transaction Specific Fields */
+ UTP_UPIU_TSF Tsf; /* Transaction Specific Fields */
//
// DW7
//
- UINT8 Rsvd5[4];
+ UINT8 Rsvd5[4];
//
// Data Segment - Data to be transferred
//
- //UINT8 Data[]; /* Data to be transferred, maximum is 65535 bytes */
+ // UINT8 Data[]; /* Data to be transferred, maximum is 65535 bytes */
} UTP_QUERY_REQ_UPIU;
-#define QUERY_FUNC_STD_READ_REQ 0x01
-#define QUERY_FUNC_STD_WRITE_REQ 0x81
+#define QUERY_FUNC_STD_READ_REQ 0x01
+#define QUERY_FUNC_STD_WRITE_REQ 0x81
typedef enum {
- UtpQueryFuncOpcodeNop = 0x00,
- UtpQueryFuncOpcodeRdDesc = 0x01,
- UtpQueryFuncOpcodeWrDesc = 0x02,
- UtpQueryFuncOpcodeRdAttr = 0x03,
- UtpQueryFuncOpcodeWrAttr = 0x04,
- UtpQueryFuncOpcodeRdFlag = 0x05,
- UtpQueryFuncOpcodeSetFlag = 0x06,
- UtpQueryFuncOpcodeClrFlag = 0x07,
- UtpQueryFuncOpcodeTogFlag = 0x08
+ UtpQueryFuncOpcodeNop = 0x00,
+ UtpQueryFuncOpcodeRdDesc = 0x01,
+ UtpQueryFuncOpcodeWrDesc = 0x02,
+ UtpQueryFuncOpcodeRdAttr = 0x03,
+ UtpQueryFuncOpcodeWrAttr = 0x04,
+ UtpQueryFuncOpcodeRdFlag = 0x05,
+ UtpQueryFuncOpcodeSetFlag = 0x06,
+ UtpQueryFuncOpcodeClrFlag = 0x07,
+ UtpQueryFuncOpcodeTogFlag = 0x08
} UTP_QUERY_FUNC_OPCODE;
//
@@ -925,42 +924,42 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x36*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Rsvd1;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x36*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Rsvd1;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd2;
- UINT8 QueryFunc; /* Query Function */
- UINT8 QueryResp; /* Query Response */
- UINT8 Rsvd3;
+ UINT8 Rsvd2;
+ UINT8 QueryFunc; /* Query Function */
+ UINT8 QueryResp; /* Query Response */
+ UINT8 Rsvd3;
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 DevInfo; /* Device Information */
- UINT16 DataSegLen; /* Data Segment Length - Big Endian */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 DevInfo; /* Device Information */
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian */
//
// DW3 - 6
//
- UTP_UPIU_TSF Tsf; /* Transaction Specific Fields */
+ UTP_UPIU_TSF Tsf; /* Transaction Specific Fields */
//
// DW7
//
- UINT8 Rsvd4[4];
+ UINT8 Rsvd4[4];
//
// Data Segment - Data to be transferred
//
- //UINT8 Data[]; /* Data to be transferred, maximum is 65535 bytes */
+ // UINT8 Data[]; /* Data to be transferred, maximum is 65535 bytes */
} UTP_QUERY_RESP_UPIU;
typedef enum {
@@ -984,39 +983,39 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x3F*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Lun;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x3F*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Lun;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd1[2];
- UINT8 Response; /* Response - 0x01 */
- UINT8 Rsvd2;
+ UINT8 Rsvd1[2];
+ UINT8 Response; /* Response - 0x01 */
+ UINT8 Rsvd2;
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 DevInfo; /* Device Information - 0x00 */
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 DevInfo; /* Device Information - 0x00 */
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3
//
- UINT8 HdrSts; /* Basic Header Status */
- UINT8 Rsvd3;
- UINT8 E2ESts; /* End-to-End Status */
- UINT8 Rsvd4;
+ UINT8 HdrSts; /* Basic Header Status */
+ UINT8 Rsvd3;
+ UINT8 E2ESts; /* End-to-End Status */
+ UINT8 Rsvd4;
//
// DW4 - DW7
//
- UINT8 Rsvd5[16];
+ UINT8 Rsvd5[16];
} UTP_REJ_UPIU;
//
@@ -1026,29 +1025,29 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x00*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Rsvd1;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x00*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Rsvd1;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd2[4];
+ UINT8 Rsvd2[4];
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 Rsvd3;
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 Rsvd3;
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3 - DW7
//
- UINT8 Rsvd4[20];
+ UINT8 Rsvd4[20];
} UTP_NOP_OUT_UPIU;
//
@@ -1058,234 +1057,234 @@ typedef struct { //
// DW0
//
- UINT8 TransCode:6; /* Transaction Type - 0x20*/
- UINT8 Dd:1;
- UINT8 Hd:1;
- UINT8 Flags;
- UINT8 Rsvd1;
- UINT8 TaskTag; /* Task Tag */
+ UINT8 TransCode : 6; /* Transaction Type - 0x20*/
+ UINT8 Dd : 1;
+ UINT8 Hd : 1;
+ UINT8 Flags;
+ UINT8 Rsvd1;
+ UINT8 TaskTag; /* Task Tag */
//
// DW1
//
- UINT8 Rsvd2[2];
- UINT8 Resp; /* Response - 0x00 */
- UINT8 Rsvd3;
+ UINT8 Rsvd2[2];
+ UINT8 Resp; /* Response - 0x00 */
+ UINT8 Rsvd3;
//
// DW2
//
- UINT8 EhsLen; /* Total EHS Length - 0x00 */
- UINT8 DevInfo; /* Device Information - 0x00 */
- UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
+ UINT8 EhsLen; /* Total EHS Length - 0x00 */
+ UINT8 DevInfo; /* Device Information - 0x00 */
+ UINT16 DataSegLen; /* Data Segment Length - Big Endian - 0x0000 */
//
// DW3 - DW7
//
- UINT8 Rsvd4[20];
+ UINT8 Rsvd4[20];
} UTP_NOP_IN_UPIU;
//
// UFS Descriptors
//
typedef enum {
- UfsDeviceDesc = 0x00,
- UfsConfigDesc = 0x01,
- UfsUnitDesc = 0x02,
- UfsInterConnDesc = 0x04,
- UfsStringDesc = 0x05,
- UfsGeometryDesc = 0x07,
- UfsPowerDesc = 0x08
+ UfsDeviceDesc = 0x00,
+ UfsConfigDesc = 0x01,
+ UfsUnitDesc = 0x02,
+ UfsInterConnDesc = 0x04,
+ UfsStringDesc = 0x05,
+ UfsGeometryDesc = 0x07,
+ UfsPowerDesc = 0x08
} UFS_DESC_IDN;
//
// UFS 2.0 Spec Section 14.1.6.2 - Device Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT8 Device;
- UINT8 DevClass;
- UINT8 DevSubClass;
- UINT8 Protocol;
- UINT8 NumLun;
- UINT8 NumWLun;
- UINT8 BootEn;
- UINT8 DescAccessEn;
- UINT8 InitPowerMode;
- UINT8 HighPriorityLun;
- UINT8 SecureRemovalType;
- UINT8 SecurityLun;
- UINT8 BgOpsTermLat;
- UINT8 InitActiveIccLevel;
- UINT16 SpecVersion;
- UINT16 ManufactureDate;
- UINT8 ManufacturerName;
- UINT8 ProductName;
- UINT8 SerialName;
- UINT8 OemId;
- UINT16 ManufacturerId;
- UINT8 Ud0BaseOffset;
- UINT8 Ud0ConfParamLen;
- UINT8 DevRttCap;
- UINT16 PeriodicRtcUpdate;
- UINT8 Rsvd1[17];
- UINT8 Rsvd2[16];
+ UINT8 Length;
+ UINT8 DescType;
+ UINT8 Device;
+ UINT8 DevClass;
+ UINT8 DevSubClass;
+ UINT8 Protocol;
+ UINT8 NumLun;
+ UINT8 NumWLun;
+ UINT8 BootEn;
+ UINT8 DescAccessEn;
+ UINT8 InitPowerMode;
+ UINT8 HighPriorityLun;
+ UINT8 SecureRemovalType;
+ UINT8 SecurityLun;
+ UINT8 BgOpsTermLat;
+ UINT8 InitActiveIccLevel;
+ UINT16 SpecVersion;
+ UINT16 ManufactureDate;
+ UINT8 ManufacturerName;
+ UINT8 ProductName;
+ UINT8 SerialName;
+ UINT8 OemId;
+ UINT16 ManufacturerId;
+ UINT8 Ud0BaseOffset;
+ UINT8 Ud0ConfParamLen;
+ UINT8 DevRttCap;
+ UINT16 PeriodicRtcUpdate;
+ UINT8 Rsvd1[17];
+ UINT8 Rsvd2[16];
} UFS_DEV_DESC;
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT8 Rsvd1;
- UINT8 BootEn;
- UINT8 DescAccessEn;
- UINT8 InitPowerMode;
- UINT8 HighPriorityLun;
- UINT8 SecureRemovalType;
- UINT8 InitActiveIccLevel;
- UINT16 PeriodicRtcUpdate;
- UINT8 Rsvd2[5];
+ UINT8 Length;
+ UINT8 DescType;
+ UINT8 Rsvd1;
+ UINT8 BootEn;
+ UINT8 DescAccessEn;
+ UINT8 InitPowerMode;
+ UINT8 HighPriorityLun;
+ UINT8 SecureRemovalType;
+ UINT8 InitActiveIccLevel;
+ UINT16 PeriodicRtcUpdate;
+ UINT8 Rsvd2[5];
} UFS_CONFIG_DESC_GEN_HEADER;
typedef struct {
- UINT8 LunEn;
- UINT8 BootLunId;
- UINT8 LunWriteProt;
- UINT8 MemType;
- UINT32 NumAllocUnits;
- UINT8 DataReliability;
- UINT8 LogicBlkSize;
- UINT8 ProvisionType;
- UINT16 CtxCap;
- UINT8 Rsvd1[3];
+ UINT8 LunEn;
+ UINT8 BootLunId;
+ UINT8 LunWriteProt;
+ UINT8 MemType;
+ UINT32 NumAllocUnits;
+ UINT8 DataReliability;
+ UINT8 LogicBlkSize;
+ UINT8 ProvisionType;
+ UINT16 CtxCap;
+ UINT8 Rsvd1[3];
} UFS_UNIT_DESC_CONFIG_PARAMS;
//
// UFS 2.0 Spec Section 14.1.6.3 - Configuration Descriptor
//
typedef struct {
- UFS_CONFIG_DESC_GEN_HEADER Header;
- UFS_UNIT_DESC_CONFIG_PARAMS UnitDescConfParams[8];
+ UFS_CONFIG_DESC_GEN_HEADER Header;
+ UFS_UNIT_DESC_CONFIG_PARAMS UnitDescConfParams[8];
} UFS_CONFIG_DESC;
//
// UFS 2.0 Spec Section 14.1.6.4 - Geometry Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT8 MediaTech;
- UINT8 Rsvd1;
- UINT64 TotalRawDevCapacity;
- UINT8 Rsvd2;
- UINT32 SegSize;
- UINT8 AllocUnitSize;
- UINT8 MinAddrBlkSize;
- UINT8 OptReadBlkSize;
- UINT8 OptWriteBlkSize;
- UINT8 MaxInBufSize;
- UINT8 MaxOutBufSize;
- UINT8 RpmbRwSize;
- UINT8 Rsvd3;
- UINT8 DataOrder;
- UINT8 MaxCtxIdNum;
- UINT8 SysDataTagUnitSize;
- UINT8 SysDataResUnitSize;
- UINT8 SupSecRemovalTypes;
- UINT16 SupMemTypes;
- UINT32 SysCodeMaxNumAllocUnits;
- UINT16 SupCodeCapAdjFac;
- UINT32 NonPersMaxNumAllocUnits;
- UINT16 NonPersCapAdjFac;
- UINT32 Enhance1MaxNumAllocUnits;
- UINT16 Enhance1CapAdjFac;
- UINT32 Enhance2MaxNumAllocUnits;
- UINT16 Enhance2CapAdjFac;
- UINT32 Enhance3MaxNumAllocUnits;
- UINT16 Enhance3CapAdjFac;
- UINT32 Enhance4MaxNumAllocUnits;
- UINT16 Enhance4CapAdjFac;
+ UINT8 Length;
+ UINT8 DescType;
+ UINT8 MediaTech;
+ UINT8 Rsvd1;
+ UINT64 TotalRawDevCapacity;
+ UINT8 Rsvd2;
+ UINT32 SegSize;
+ UINT8 AllocUnitSize;
+ UINT8 MinAddrBlkSize;
+ UINT8 OptReadBlkSize;
+ UINT8 OptWriteBlkSize;
+ UINT8 MaxInBufSize;
+ UINT8 MaxOutBufSize;
+ UINT8 RpmbRwSize;
+ UINT8 Rsvd3;
+ UINT8 DataOrder;
+ UINT8 MaxCtxIdNum;
+ UINT8 SysDataTagUnitSize;
+ UINT8 SysDataResUnitSize;
+ UINT8 SupSecRemovalTypes;
+ UINT16 SupMemTypes;
+ UINT32 SysCodeMaxNumAllocUnits;
+ UINT16 SupCodeCapAdjFac;
+ UINT32 NonPersMaxNumAllocUnits;
+ UINT16 NonPersCapAdjFac;
+ UINT32 Enhance1MaxNumAllocUnits;
+ UINT16 Enhance1CapAdjFac;
+ UINT32 Enhance2MaxNumAllocUnits;
+ UINT16 Enhance2CapAdjFac;
+ UINT32 Enhance3MaxNumAllocUnits;
+ UINT16 Enhance3CapAdjFac;
+ UINT32 Enhance4MaxNumAllocUnits;
+ UINT16 Enhance4CapAdjFac;
} UFS_GEOMETRY_DESC;
//
// UFS 2.0 Spec Section 14.1.6.5 - Unit Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT8 UnitIdx;
- UINT8 LunEn;
- UINT8 BootLunId;
- UINT8 LunWriteProt;
- UINT8 LunQueueDep;
- UINT8 Rsvd1;
- UINT8 MemType;
- UINT8 DataReliability;
- UINT8 LogicBlkSize;
- UINT64 LogicBlkCount;
- UINT32 EraseBlkSize;
- UINT8 ProvisionType;
- UINT64 PhyMemResCount;
- UINT16 CtxCap;
- UINT8 LargeUnitGranularity;
+ UINT8 Length;
+ UINT8 DescType;
+ UINT8 UnitIdx;
+ UINT8 LunEn;
+ UINT8 BootLunId;
+ UINT8 LunWriteProt;
+ UINT8 LunQueueDep;
+ UINT8 Rsvd1;
+ UINT8 MemType;
+ UINT8 DataReliability;
+ UINT8 LogicBlkSize;
+ UINT64 LogicBlkCount;
+ UINT32 EraseBlkSize;
+ UINT8 ProvisionType;
+ UINT64 PhyMemResCount;
+ UINT16 CtxCap;
+ UINT8 LargeUnitGranularity;
} UFS_UNIT_DESC;
//
// UFS 2.0 Spec Section 14.1.6.6 - RPMB Unit Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT8 UnitIdx;
- UINT8 LunEn;
- UINT8 BootLunId;
- UINT8 LunWriteProt;
- UINT8 LunQueueDep;
- UINT8 Rsvd1;
- UINT8 MemType;
- UINT8 Rsvd2;
- UINT8 LogicBlkSize;
- UINT64 LogicBlkCount;
- UINT32 EraseBlkSize;
- UINT8 ProvisionType;
- UINT64 PhyMemResCount;
- UINT8 Rsvd3[3];
+ UINT8 Length;
+ UINT8 DescType;
+ UINT8 UnitIdx;
+ UINT8 LunEn;
+ UINT8 BootLunId;
+ UINT8 LunWriteProt;
+ UINT8 LunQueueDep;
+ UINT8 Rsvd1;
+ UINT8 MemType;
+ UINT8 Rsvd2;
+ UINT8 LogicBlkSize;
+ UINT64 LogicBlkCount;
+ UINT32 EraseBlkSize;
+ UINT8 ProvisionType;
+ UINT64 PhyMemResCount;
+ UINT8 Rsvd3[3];
} UFS_RPMB_UNIT_DESC;
typedef struct {
- UINT16 Value:10;
- UINT16 Rsvd1:4;
- UINT16 Unit:2;
+ UINT16 Value : 10;
+ UINT16 Rsvd1 : 4;
+ UINT16 Unit : 2;
} UFS_POWER_PARAM_ELEMENT;
//
// UFS 2.0 Spec Section 14.1.6.7 - Power Parameter Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UFS_POWER_PARAM_ELEMENT ActiveIccLevelVcc[16];
- UFS_POWER_PARAM_ELEMENT ActiveIccLevelVccQ[16];
- UFS_POWER_PARAM_ELEMENT ActiveIccLevelVccQ2[16];
+ UINT8 Length;
+ UINT8 DescType;
+ UFS_POWER_PARAM_ELEMENT ActiveIccLevelVcc[16];
+ UFS_POWER_PARAM_ELEMENT ActiveIccLevelVccQ[16];
+ UFS_POWER_PARAM_ELEMENT ActiveIccLevelVccQ2[16];
} UFS_POWER_DESC;
//
// UFS 2.0 Spec Section 14.1.6.8 - InterConnect Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- UINT16 UniProVer;
- UINT16 MphyVer;
+ UINT8 Length;
+ UINT8 DescType;
+ UINT16 UniProVer;
+ UINT16 MphyVer;
} UFS_INTER_CONNECT_DESC;
//
// UFS 2.0 Spec Section 14.1.6.9 - 14.1.6.12 - String Descriptor
//
typedef struct {
- UINT8 Length;
- UINT8 DescType;
- CHAR16 Unicode[126];
+ UINT8 Length;
+ UINT8 DescType;
+ CHAR16 Unicode[126];
} UFS_STRING_DESC;
//
@@ -1306,34 +1305,32 @@ typedef enum { // UFS 2.0 Spec Section 14.2 - Attributes
//
typedef enum {
- UfsAttrBootLunEn = 0x00,
- UfsAttrCurPowerMode = 0x02,
- UfsAttrActiveIccLevel = 0x03,
- UfsAttrOutOfOrderDataEn = 0x04,
- UfsAttrBgOpStatus = 0x05,
- UfsAttrPurgeStatus = 0x06,
- UfsAttrMaxDataInSize = 0x07,
- UfsAttrMaxDataOutSize = 0x08,
- UfsAttrDynCapNeeded = 0x09,
- UfsAttrRefClkFreq = 0x0a,
- UfsAttrConfigDescLock = 0x0b,
- UfsAttrMaxNumOfRtt = 0x0c,
- UfsAttrExceptionEvtCtrl = 0x0d,
- UfsAttrExceptionEvtSts = 0x0e,
- UfsAttrSecondsPassed = 0x0f,
- UfsAttrContextConf = 0x10,
- UfsAttrCorrPrgBlkNum = 0x11
+ UfsAttrBootLunEn = 0x00,
+ UfsAttrCurPowerMode = 0x02,
+ UfsAttrActiveIccLevel = 0x03,
+ UfsAttrOutOfOrderDataEn = 0x04,
+ UfsAttrBgOpStatus = 0x05,
+ UfsAttrPurgeStatus = 0x06,
+ UfsAttrMaxDataInSize = 0x07,
+ UfsAttrMaxDataOutSize = 0x08,
+ UfsAttrDynCapNeeded = 0x09,
+ UfsAttrRefClkFreq = 0x0a,
+ UfsAttrConfigDescLock = 0x0b,
+ UfsAttrMaxNumOfRtt = 0x0c,
+ UfsAttrExceptionEvtCtrl = 0x0d,
+ UfsAttrExceptionEvtSts = 0x0e,
+ UfsAttrSecondsPassed = 0x0f,
+ UfsAttrContextConf = 0x10,
+ UfsAttrCorrPrgBlkNum = 0x11
} UFS_ATTR_IDN;
typedef enum {
- UfsNoData = 0,
- UfsDataOut = 1,
- UfsDataIn = 2,
+ UfsNoData = 0,
+ UfsDataOut = 1,
+ UfsDataIn = 2,
UfsDdReserved
} UFS_DATA_DIRECTION;
-
#pragma pack()
#endif
-
|