According to UFS Host Controller Spec(JESD223), the bits 1:0 of this DataByteCount field shall be 11b to indicate Dword granularity.
But the size of UFS Request Sense Data Response defined in UFS Spec (JESD220C) is 18 which is not Dword aligned, we would have to round down to the multiple of 4 to fill the DBC field to avoid bring issue on some UFS HCs. Cc: Hao Wu <hao.a...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.t...@intel.com> --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index 26986cb..a854264 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -399,6 +399,11 @@ UfsInitUtpPrdt ( UINT32 RemainingLen; UINT8 *Remaining; UINTN PrdtNumber; + + if ((BufferSize & (BIT0 | BIT1)) != 0) { + BufferSize &= ~(BIT0 | BIT1); + DEBUG ((EFI_D_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dword-aligned!\n", BufferSize)); + } if (BufferSize == 0) { return EFI_SUCCESS; -- 2.7.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel