From 032800eccab02bd4fa7dd2afe529ad8b9a712c41 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 22 Dec 2015 13:56:54 +0000 Subject: MdeModulePkg ScsiDiskDxe: Fix async request retry times info lost issue 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/trunk/edk2@19450 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 24 ++++++++++++++++++++++++ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index ba7f5a5f77..4725cf4538 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -2692,6 +2692,7 @@ ScsiDiskAsyncReadSectors ( Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, (UINT32) Lba, @@ -2703,6 +2704,7 @@ ScsiDiskAsyncReadSectors ( Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, Lba, @@ -2853,6 +2855,7 @@ ScsiDiskAsyncWriteSectors ( Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, (UINT32) Lba, @@ -2864,6 +2867,7 @@ ScsiDiskAsyncWriteSectors ( Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Timeout, + 0, PtrBuffer, ByteCount, Lba, @@ -3527,6 +3531,7 @@ Retry: Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->InBuffer, Request->DataLength, (UINT32) Request->StartLba, @@ -3538,6 +3543,7 @@ Retry: Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->InBuffer, Request->DataLength, Request->StartLba, @@ -3559,6 +3565,7 @@ Retry: Status = ScsiDiskAsyncRead10 ( ScsiDiskDevice, Request->Timeout, + 0, Request->InBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, (UINT32) Request->StartLba + Request->SectorCount, @@ -3570,6 +3577,7 @@ Retry: Status = ScsiDiskAsyncRead16 ( ScsiDiskDevice, Request->Timeout, + 0, Request->InBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, Request->StartLba + Request->SectorCount, @@ -3591,6 +3599,7 @@ Retry: Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->OutBuffer, Request->DataLength, (UINT32) Request->StartLba, @@ -3602,6 +3611,7 @@ Retry: Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Request->Timeout, + Request->TimesRetry, Request->OutBuffer, Request->DataLength, Request->StartLba, @@ -3623,6 +3633,7 @@ Retry: Status = ScsiDiskAsyncWrite10 ( ScsiDiskDevice, Request->Timeout, + 0, Request->OutBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, (UINT32) Request->StartLba + Request->SectorCount, @@ -3634,6 +3645,7 @@ Retry: Status = ScsiDiskAsyncWrite16 ( ScsiDiskDevice, Request->Timeout, + 0, Request->OutBuffer + Request->SectorCount * ScsiDiskDevice->BlkIo.Media->BlockSize, OldDataLength - Request->DataLength, Request->StartLba + Request->SectorCount, @@ -3670,6 +3682,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. @@ -3688,6 +3701,7 @@ EFI_STATUS ScsiDiskAsyncRead10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -3717,6 +3731,7 @@ ScsiDiskAsyncRead10 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->InBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3779,6 +3794,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. @@ -3797,6 +3813,7 @@ EFI_STATUS ScsiDiskAsyncWrite10 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT32 StartLba, @@ -3826,6 +3843,7 @@ ScsiDiskAsyncWrite10 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->OutBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3888,6 +3906,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. @@ -3906,6 +3925,7 @@ EFI_STATUS ScsiDiskAsyncRead16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, OUT UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, @@ -3935,6 +3955,7 @@ ScsiDiskAsyncRead16 ( Request->ScsiDiskDevice = ScsiDiskDevice; Request->Timeout = Timeout; + Request->TimesRetry = TimesRetry; Request->InBuffer = DataBuffer; Request->DataLength = DataLength; Request->StartLba = StartLba; @@ -3997,6 +4018,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. @@ -4015,6 +4037,7 @@ EFI_STATUS ScsiDiskAsyncWrite16 ( IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINT64 Timeout, + IN UINT8 TimesRetry, IN UINT8 *DataBuffer, IN UINT32 DataLength, IN UINT64 StartLba, @@ -4044,6 +4067,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