mirror of https://github.com/acidanthera/audk.git
MdeModulePkg: fix some issues in ScsiDisk to co-work with UFS stack
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
This commit is contained in:
parent
0591696eff
commit
2bf87d82e9
|
@ -1150,7 +1150,7 @@ ScsiDiskTestUnitReady (
|
|||
UINT8 Index;
|
||||
UINT8 MaxRetry;
|
||||
|
||||
SenseDataLength = 0;
|
||||
SenseDataLength = (UINT8) (ScsiDiskDevice->SenseDataNumber * sizeof (EFI_SCSI_SENSE_DATA));
|
||||
*NumberOfSenseKeys = 0;
|
||||
|
||||
//
|
||||
|
@ -1159,7 +1159,7 @@ ScsiDiskTestUnitReady (
|
|||
Status = ScsiTestUnitReadyCommand (
|
||||
ScsiDiskDevice->ScsiIo,
|
||||
SCSI_DISK_TIMEOUT,
|
||||
NULL,
|
||||
ScsiDiskDevice->SenseData,
|
||||
&SenseDataLength,
|
||||
&HostAdapterStatus,
|
||||
&TargetStatus
|
||||
|
@ -1207,6 +1207,12 @@ ScsiDiskTestUnitReady (
|
|||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (SenseDataLength != 0) {
|
||||
*NumberOfSenseKeys = SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA);
|
||||
*SenseDataArray = ScsiDiskDevice->SenseData;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
MaxRetry = 3;
|
||||
for (Index = 0; Index < MaxRetry; Index++) {
|
||||
Status = ScsiDiskRequestSenseKeys (
|
||||
|
@ -1740,14 +1746,6 @@ GetMediaInfo (
|
|||
}
|
||||
|
||||
ScsiDiskDevice->BlkIo.Media->MediaPresent = TRUE;
|
||||
|
||||
if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_DISK) {
|
||||
ScsiDiskDevice->BlkIo.Media->BlockSize = 0x200;
|
||||
}
|
||||
|
||||
if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_CDROM) {
|
||||
ScsiDiskDevice->BlkIo.Media->BlockSize = 0x800;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3102,7 +3100,7 @@ ScsiDiskInfoIdentify (
|
|||
EFI_STATUS Status;
|
||||
SCSI_DISK_DEV *ScsiDiskDevice;
|
||||
|
||||
if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
|
||||
if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) {
|
||||
//
|
||||
// Physical SCSI bus does not support this data class.
|
||||
//
|
||||
|
@ -3171,7 +3169,7 @@ ScsiDiskInfoWhichIde (
|
|||
{
|
||||
SCSI_DISK_DEV *ScsiDiskDevice;
|
||||
|
||||
if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
|
||||
if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) {
|
||||
//
|
||||
// This is not an IDE physical device.
|
||||
//
|
||||
|
@ -3301,6 +3299,10 @@ InitializeInstallDiskInfo (
|
|||
return;
|
||||
}
|
||||
} while (--IdentifyRetry > 0);
|
||||
} else if ((DevicePathType (ChildDevicePathNode) == MESSAGING_DEVICE_PATH) &&
|
||||
(DevicePathSubType (ChildDevicePathNode) == MSG_UFS_DP)) {
|
||||
CopyGuid (&ScsiDiskDevice->DiskInfo.Interface, &gEfiDiskInfoUfsInterfaceGuid);
|
||||
break;
|
||||
}
|
||||
DevicePathNode = ChildDevicePathNode;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
gEfiDiskInfoScsiInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED
|
||||
gEfiDiskInfoIdeInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED
|
||||
gEfiDiskInfoAhciInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED
|
||||
gEfiDiskInfoUfsInterfaceGuid ## SOMETIMES_PRODUCES ## UNDEFINED
|
||||
|
||||
# [Event]
|
||||
# EVENT_TYPE_RELATIVE_TIMER ## CONSUMES
|
||||
|
|
Loading…
Reference in New Issue