summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorFeng Tian <feng.tian@intel.com>2015-04-29 02:44:42 +0000
committererictian <erictian@Edk2>2015-04-29 02:44:42 +0000
commit2bf87d82e95ed812504783468da26ea425b2a58b (patch)
tree93fc022850492cb6c7572ce17c650899863268a7 /MdeModulePkg
parent0591696eff9962b52b3b0137e865198096353573 (diff)
downloadedk2-platforms-2bf87d82e95ed812504783468da26ea425b2a58b.tar.xz
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c26
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf1
2 files changed, 15 insertions, 12 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 21da985dd4..e7abe544df 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -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;
}
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
index b3e40fd981..ec96aa6f92 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
@@ -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