The changes in ScsiDisk include:
1. Add UFS disk info support.
2. Remove the wrong block size calculation.
3. Get sense data for TEST_UNIT_READY cmd immediately rather than sending a REQUEST_SENSE cmd again.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17247
6f19259b-4bc3-4df7-8a09-
765794883524
UINT8 Index;\r
UINT8 MaxRetry;\r
\r
UINT8 Index;\r
UINT8 MaxRetry;\r
\r
+ SenseDataLength = (UINT8) (ScsiDiskDevice->SenseDataNumber * sizeof (EFI_SCSI_SENSE_DATA));\r
*NumberOfSenseKeys = 0;\r
\r
//\r
*NumberOfSenseKeys = 0;\r
\r
//\r
Status = ScsiTestUnitReadyCommand (\r
ScsiDiskDevice->ScsiIo,\r
SCSI_DISK_TIMEOUT,\r
Status = ScsiTestUnitReadyCommand (\r
ScsiDiskDevice->ScsiIo,\r
SCSI_DISK_TIMEOUT,\r
+ ScsiDiskDevice->SenseData,\r
&SenseDataLength,\r
&HostAdapterStatus,\r
&TargetStatus\r
&SenseDataLength,\r
&HostAdapterStatus,\r
&TargetStatus\r
return EFI_DEVICE_ERROR;\r
}\r
\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ if (SenseDataLength != 0) {\r
+ *NumberOfSenseKeys = SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA);\r
+ *SenseDataArray = ScsiDiskDevice->SenseData;\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
MaxRetry = 3;\r
for (Index = 0; Index < MaxRetry; Index++) {\r
Status = ScsiDiskRequestSenseKeys (\r
MaxRetry = 3;\r
for (Index = 0; Index < MaxRetry; Index++) {\r
Status = ScsiDiskRequestSenseKeys (\r
}\r
\r
ScsiDiskDevice->BlkIo.Media->MediaPresent = TRUE;\r
}\r
\r
ScsiDiskDevice->BlkIo.Media->MediaPresent = TRUE;\r
- \r
- if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_DISK) {\r
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x200;\r
- }\r
-\r
- if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_CDROM) {\r
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x800;\r
- }\r
EFI_STATUS Status;\r
SCSI_DISK_DEV *ScsiDiskDevice;\r
\r
EFI_STATUS Status;\r
SCSI_DISK_DEV *ScsiDiskDevice;\r
\r
- if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {\r
+ if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) {\r
//\r
// Physical SCSI bus does not support this data class. \r
//\r
//\r
// Physical SCSI bus does not support this data class. \r
//\r
{\r
SCSI_DISK_DEV *ScsiDiskDevice;\r
\r
{\r
SCSI_DISK_DEV *ScsiDiskDevice;\r
\r
- if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {\r
+ if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) {\r
//\r
// This is not an IDE physical device.\r
//\r
//\r
// This is not an IDE physical device.\r
//\r
return;\r
}\r
} while (--IdentifyRetry > 0);\r
return;\r
}\r
} while (--IdentifyRetry > 0);\r
+ } else if ((DevicePathType (ChildDevicePathNode) == MESSAGING_DEVICE_PATH) &&\r
+ (DevicePathSubType (ChildDevicePathNode) == MSG_UFS_DP)) {\r
+ CopyGuid (&ScsiDiskDevice->DiskInfo.Interface, &gEfiDiskInfoUfsInterfaceGuid);\r
+ break;\r
}\r
DevicePathNode = ChildDevicePathNode;\r
}\r
}\r
DevicePathNode = ChildDevicePathNode;\r
}\r
gEfiDiskInfoScsiInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
gEfiDiskInfoIdeInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
gEfiDiskInfoAhciInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
gEfiDiskInfoScsiInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
gEfiDiskInfoIdeInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
gEfiDiskInfoAhciInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
+ gEfiDiskInfoUfsInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED\r
\r
# [Event]\r
# EVENT_TYPE_RELATIVE_TIMER ## CONSUMES\r
\r
# [Event]\r
# EVENT_TYPE_RELATIVE_TIMER ## CONSUMES\r