MdeModulePkg/UfsPassThruDxe: Fix unaligned data transfer handling

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

Since UFS specification requires the data buffer specified
in PRDT to be DWORD aligned in size we had a code in
UfsInitUtpPrdt that aligned the data buffer by rounding down
the buffer size to DWORD boundary. This meant that for SCSI
commands that wanted to perform unaligned data transfer(such as
SENSE command) we specified to small buffer for the data to fit
and transfer was aborted. This change introduces code that allocates
auxiliary DWORD aligned data buffer for unaligned transfer. Device
transfers data to aligned buffer and when data transfer is over driver
copies data from aligned buffer to data buffer passed by user.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Albecki, Mateusz
2019-06-25 17:44:28 +08:00
committed by Hao A Wu
parent ffe048a080
commit a37e18f6fc
2 changed files with 150 additions and 54 deletions

View File

@@ -92,6 +92,8 @@ typedef struct {
UINT32 CmdDescSize;
VOID *CmdDescHost;
VOID *CmdDescMapping;
VOID *AlignedDataBuf;
UINTN AlignedDataBufSize;
VOID *DataBufMapping;
EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet;