summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2017-01-16 20:22:58 +0800
committerFeng Tian <feng.tian@intel.com>2017-01-20 09:11:26 +0800
commit4d580428a38be8ea6cb38d860f9093d98cf23583 (patch)
treeddb6585808c3a3ccd5ae03e4190098b230081735
parent86bd34ca3ce595510dc315570cdc79385ff5b4a0 (diff)
downloadedk2-4d580428a38be8ea6cb38d860f9093d98cf23583.zip
edk2-4d580428a38be8ea6cb38d860f9093d98cf23583.tar.gz
edk2-4d580428a38be8ea6cb38d860f9093d98cf23583.tar.bz2
MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
The OCS value should be initiliazed as 0x0F according to UFS spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Reviewed-by: Feng Tian <feng.tian@intel.com>
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c4
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h6
2 files changed, 9 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
index cccacce..332ce7e 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
@@ -480,6 +480,7 @@ UfsCreateScsiCommandDesc (
Trd->Int = UFS_INTERRUPT_COMMAND;
Trd->Dd = DataDirection;
Trd->Ct = UFS_STORAGE_COMMAND_TYPE;
+ Trd->Ocs = UFS_HC_TRD_OCS_INIT_VALUE;
Trd->UcdBa = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 7);
Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 32);
Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
@@ -583,7 +584,7 @@ UfsCreateDMCommandDesc (
Trd->Int = UFS_INTERRUPT_COMMAND;
Trd->Dd = DataDirection;
Trd->Ct = UFS_STORAGE_COMMAND_TYPE;
- Trd->Ocs = 0x0F;
+ Trd->Ocs = UFS_HC_TRD_OCS_INIT_VALUE;
Trd->UcdBa = (UINT32)RShiftU64 ((UINT64)(UINTN)QueryReqUpiu, 7);
Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)QueryReqUpiu, 32);
if (Opcode == UtpQueryFuncOpcodeWrDesc) {
@@ -637,6 +638,7 @@ UfsCreateNopCommandDesc (
Trd->Int = UFS_INTERRUPT_COMMAND;
Trd->Dd = 0x00;
Trd->Ct = UFS_STORAGE_COMMAND_TYPE;
+ Trd->Ocs = UFS_HC_TRD_OCS_INIT_VALUE;
Trd->UcdBa = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 7);
Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 32);
Trd->RuL = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h
index a423a92..0a0cf71 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.h
@@ -77,6 +77,12 @@
#define UFS_HC_UTRLRSR BIT0
//
+// The initial value of the OCS field of UTP TRD or TMRD descriptor
+// defined in JEDEC JESD223 specification
+//
+#define UFS_HC_TRD_OCS_INIT_VALUE 0x0F
+
+//
// A maximum of length of 256KB is supported by PRDT entry
//
#define UFS_MAX_DATA_LEN_PER_PRD 0x40000