From 5feebcef70a383b3fd50416cd968409b62bbbb6d Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Wed, 23 Dec 2015 01:37:00 +0000 Subject: MdeModulePkg ScsiDiskDxe: Fix async request retry times info lost issue (Sync patch r19450 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19471 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 24 ++++++++++++++++++++++++ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 8 ++++++++ 2 files changed, 32 insertions(+) (limited to 'MdeModulePkg/Bus/Scsi') diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 033be23963..70d1306ef3 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -2651,6 +2651,7 @@ ScsiDiskAsyncReadSectors ( Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, (UINT32) Lba, @@ -2662,6 +2663,7 @@ ScsiDiskAsyncReadSectors ( Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, Lba, @@ -2812,6 +2814,7 @@ ScsiDiskAsyncWriteSectors ( Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, (UINT32) Lba, @@ -2823,6 +2826,7 @@ ScsiDiskAsyncWriteSectors ( Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, Lba, @@ -3486,6 +3490,7 @@ Retry: Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->InBuffer, Request->DataLength, (UINT32) Request->StartLba, @@ -3497,6 +3502,7 @@ Retry: Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->InBuffer, Request->DataLength, Request->StartLba, @@ -3518,6 +3524,7 @@ Retry: Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Request->Timeout, + 0, Request->InBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, (UINT32) Request->StartLba + Request->SectorCount, @@ -3529,6 +3536,7 @@ Retry: Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Request->Timeout, + 0, Request->InBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, Request->StartLba + Request->SectorCount, @@ -3550,6 +3558,7 @@ Retry: Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->OutBuffer, Request->DataLength, (UINT32) Request->StartLba, @@ -3561,6 +3570,7 @@ Retry: Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->OutBuffer, Request->DataLength, Request->StartLba, @@ -3582,6 +3592,7 @@ Retry: Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Request->Timeout, + 0, Request->OutBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, (UINT32) Request->StartLba + Request->SectorCount, @@ -3593,6 +3604,7 @@ Retry: Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Request->Timeout, + 0, Request->OutBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, Request->StartLba + Request->SectorCount, @@ -3629,6 +3641,7 @@ Exit: @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer to fill with the read out data. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -3647,6 +3660,7 @@ EFI_STATUS ScsiDiskAsyncRead10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -3676,6 +3690,7 @@ ScsiDiskAsyncRead10 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->InBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3738,6 +3753,7 @@ ErrorExit: @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer contains the data to write. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -3756,6 +3772,7 @@ EFI_STATUS ScsiDiskAsyncWrite10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -3785,6 +3802,7 @@ ScsiDiskAsyncWrite10 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->OutBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3847,6 +3865,7 @@ ErrorExit: @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer to fill with the read out data. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -3865,6 +3884,7 @@ EFI_STATUS ScsiDiskAsyncRead16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, @@ -3894,6 +3914,7 @@ ScsiDiskAsyncRead16 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->InBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3956,6 +3977,7 @@ ErrorExit: @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer contains the data to write. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -3974,6 +3996,7 @@ EFI_STATUS ScsiDiskAsyncWrite16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, @@ -4003,6 +4026,7 @@ ScsiDiskAsyncWrite16 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->OutBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h index b6f801d92a..7a287d3bb3 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h @@ -1029,6 +1029,7 @@ ScsiDiskWrite16 ( @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer to fill with the read out data. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -1047,6 +1048,7 @@ EFI_STATUS ScsiDiskAsyncRead10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -1060,6 +1062,7 @@ ScsiDiskAsyncRead10 ( @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer contains the data to write. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -1078,6 +1081,7 @@ EFI_STATUS ScsiDiskAsyncWrite10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -1091,6 +1095,7 @@ ScsiDiskAsyncWrite10 ( @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer to fill with the read out data. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -1109,6 +1114,7 @@ EFI_STATUS ScsiDiskAsyncRead16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, @@ -1122,6 +1128,7 @@ ScsiDiskAsyncRead16 ( @param ScsiDiskDevice The pointer of ScsiDiskDevice. @param Timeout The time to complete the command. + @param TimesRetry The number of times the command has been retried. @param DataBuffer The buffer contains the data to write. @param DataLength The length of buffer. @param StartLba The start logic block address. @@ -1140,6 +1147,7 @@ EFI_STATUS ScsiDiskAsyncWrite16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, -- cgit v1.2.3