MdeModulePkg/ScsiDisk: Using back-off algorithm to dynamically adjust transfer length in a single SCSI/ATAPI transfer to reach best device compatibility.
Besides this, the patch also fixed: 1) Wrong return value in SenseDataLength field of packet field of EFI_EXT_SCSI_PASS_THRU protocol, it should reflect real sense data length we got. 2) Wrong logic in ScsiDiskRequestSenseKeys that the logic makes SenseData pointer unaligned compared with BlockIo.Media.IoAlign field. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tian, Feng <feng.tian@intel.com> Reviewed-by: Zeng, Star <star.zeng@intel.com> Reviewed-by: Fu, Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15491 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Header file for SCSI Disk Driver.
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -90,9 +90,10 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;
|
||||
//
|
||||
// action code used in detect media process
|
||||
//
|
||||
#define ACTION_NO_ACTION 0x00
|
||||
#define ACTION_READ_CAPACITY 0x01
|
||||
#define ACTION_RETRY_COMMAND_LATER 0x02
|
||||
#define ACTION_NO_ACTION 0x00
|
||||
#define ACTION_READ_CAPACITY 0x01
|
||||
#define ACTION_RETRY_COMMAND_LATER 0x02
|
||||
#define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03
|
||||
|
||||
#define SCSI_COMMAND_VERSION_1 0x01
|
||||
#define SCSI_COMMAND_VERSION_2 0x02
|
||||
@@ -717,17 +718,15 @@ ScsiDiskWriteSectors (
|
||||
);
|
||||
|
||||
/**
|
||||
Submit Read command.
|
||||
Submit Read(10) command.
|
||||
|
||||
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
||||
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
||||
@param SenseDataArray NOT used yet in this function
|
||||
@param NumberOfSenseKeys The number of sense key
|
||||
@param Timeout The time to complete the command
|
||||
@param DataBuffer The buffer to fill with the read out data
|
||||
@param DataLength The length of buffer
|
||||
@param StartLba The start logic block address
|
||||
@param SectorSize The size of sector
|
||||
@param SectorCount The number of blocks to read
|
||||
|
||||
@return EFI_STATUS is returned by calling ScsiRead10Command().
|
||||
**/
|
||||
@@ -735,27 +734,23 @@ EFI_STATUS
|
||||
ScsiDiskRead10 (
|
||||
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
||||
OUT BOOLEAN *NeedRetry,
|
||||
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
||||
OUT UINTN *NumberOfSenseKeys,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINT8 *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT32 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
IN UINT32 SectorCount
|
||||
);
|
||||
|
||||
/**
|
||||
Submit Write Command.
|
||||
Submit Write(10) Command.
|
||||
|
||||
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
||||
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
||||
@param SenseDataArray NOT used yet in this function
|
||||
@param NumberOfSenseKeys The number of sense key
|
||||
@param Timeout The time to complete the command
|
||||
@param DataBuffer The buffer to fill with the read out data
|
||||
@param DataLength The length of buffer
|
||||
@param StartLba The start logic block address
|
||||
@param SectorSize The size of sector
|
||||
@param SectorCount The number of blocks to write
|
||||
|
||||
@return EFI_STATUS is returned by calling ScsiWrite10Command().
|
||||
|
||||
@@ -764,13 +759,11 @@ EFI_STATUS
|
||||
ScsiDiskWrite10 (
|
||||
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
||||
OUT BOOLEAN *NeedRetry,
|
||||
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
||||
OUT UINTN *NumberOfSenseKeys,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT32 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
IN UINT32 SectorCount
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -778,27 +771,23 @@ ScsiDiskWrite10 (
|
||||
|
||||
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
||||
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
||||
@param SenseDataArray NOT used yet in this function
|
||||
@param NumberOfSenseKeys The number of sense key
|
||||
@param Timeout The time to complete the command
|
||||
@param DataBuffer The buffer to fill with the read out data
|
||||
@param DataLength The length of buffer
|
||||
@param StartLba The start logic block address
|
||||
@param SectorSize The size of sector
|
||||
@param SectorCount The number of blocks to read
|
||||
|
||||
@return EFI_STATUS is returned by calling ScsiRead10Command().
|
||||
@return EFI_STATUS is returned by calling ScsiRead16Command().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScsiDiskRead16 (
|
||||
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
||||
OUT BOOLEAN *NeedRetry,
|
||||
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
||||
OUT UINTN *NumberOfSenseKeys,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINT8 *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT64 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
IN UINT32 SectorCount
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -806,28 +795,24 @@ ScsiDiskRead16 (
|
||||
|
||||
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
||||
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
||||
@param SenseDataArray NOT used yet in this function
|
||||
@param NumberOfSenseKeys The number of sense key
|
||||
@param Timeout The time to complete the command
|
||||
@param DataBuffer The buffer to fill with the read out data
|
||||
@param DataLength The length of buffer
|
||||
@param StartLba The start logic block address
|
||||
@param SectorSize The size of sector
|
||||
@param SectorCount The number of blocks to write
|
||||
|
||||
@return EFI_STATUS is returned by calling ScsiWrite10Command().
|
||||
@return EFI_STATUS is returned by calling ScsiWrite16Command().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ScsiDiskWrite16 (
|
||||
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
||||
OUT BOOLEAN *NeedRetry,
|
||||
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
||||
OUT UINTN *NumberOfSenseKeys,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 *DataBuffer,
|
||||
IN OUT UINT32 *DataLength,
|
||||
IN UINT64 StartLba,
|
||||
IN UINT32 SectorSize
|
||||
IN UINT32 SectorCount
|
||||
);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user