diff options
author | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-14 02:11:34 +0000 |
---|---|---|
committer | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-14 02:11:34 +0000 |
commit | cbd2a4b3628d3242620bb5353e4b466bc435ca87 (patch) | |
tree | d8fc4d6f4d7d16b5ab7a179e8eef7a41cca71f44 /MdeModulePkg/Bus/Scsi/ScsiDiskDxe | |
parent | e118a40b9d1c1f06c96eda16fbb96a0d000f8a11 (diff) | |
download | edk2-cbd2a4b3628d3242620bb5353e4b466bc435ca87.zip edk2-cbd2a4b3628d3242620bb5353e4b466bc435ca87.tar.gz edk2-cbd2a4b3628d3242620bb5353e4b466bc435ca87.tar.bz2 |
ScsiBus/ScsiDisk enhancement for no_media state.
Ahci enumeration logic tuning for boot performance.
Signed-off-by:erictian
Reviewed-by:qianouyang, hhuan13
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11820 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi/ScsiDiskDxe')
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index f0e1099..e9a7788 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -166,6 +166,9 @@ ScsiDiskDriverBindingStart ( UINT8 Index;
UINT8 MaxRetry;
BOOLEAN NeedRetry;
+ BOOLEAN MustReadCapacity;
+
+ MustReadCapacity = TRUE;
ScsiDiskDevice = (SCSI_DISK_DEV *) AllocateZeroPool (sizeof (SCSI_DISK_DEV));
if (ScsiDiskDevice == NULL) {
@@ -199,10 +202,12 @@ ScsiDiskDriverBindingStart ( switch (ScsiDiskDevice->DeviceType) {
case EFI_SCSI_TYPE_DISK:
ScsiDiskDevice->BlkIo.Media->BlockSize = 0x200;
+ MustReadCapacity = TRUE;
break;
case EFI_SCSI_TYPE_CDROM:
ScsiDiskDevice->BlkIo.Media->BlockSize = 0x800;
+ MustReadCapacity = FALSE;
break;
}
//
@@ -249,7 +254,7 @@ ScsiDiskDriverBindingStart ( // The second parameter "TRUE" means must
// retrieve media capacity
//
- Status = ScsiDiskDetectMedia (ScsiDiskDevice, TRUE, &Temp);
+ Status = ScsiDiskDetectMedia (ScsiDiskDevice, MustReadCapacity, &Temp);
if (!EFI_ERROR (Status)) {
//
// Determine if Block IO should be produced on this controller handle
@@ -710,6 +715,7 @@ ScsiDiskDetectMedia ( CopyMem (&OldMedia, ScsiDiskDevice->BlkIo.Media, sizeof (OldMedia));
*MediaChange = FALSE;
MaxRetry = 3;
+ Action = ACTION_NO_ACTION;
for (Index = 0; Index < MaxRetry; Index++) {
Status = ScsiDiskTestUnitReady (
@@ -719,7 +725,19 @@ ScsiDiskDetectMedia ( &NumberOfSenseKeys
);
if (!EFI_ERROR (Status)) {
- break;
+ Status = DetectMediaParsingSenseKeys (
+ ScsiDiskDevice,
+ SenseData,
+ NumberOfSenseKeys,
+ &Action
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ } else if (Action == ACTION_RETRY_COMMAND_LATER) {
+ continue;
+ } else {
+ break;
+ }
}
if (!NeedRetry) {
@@ -731,22 +749,11 @@ ScsiDiskDetectMedia ( return EFI_DEVICE_ERROR;
}
- Status = DetectMediaParsingSenseKeys (
- ScsiDiskDevice,
- SenseData,
- NumberOfSenseKeys,
- &Action
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
//
// ACTION_NO_ACTION: need not read capacity
// other action code: need read capacity
//
- if (Action == ACTION_NO_ACTION) {
- NeedReadCapacity = FALSE;
- } else {
+ if (Action == ACTION_READ_CAPACITY) {
NeedReadCapacity = TRUE;
}
@@ -1205,6 +1212,11 @@ DetectMediaParsingSenseKeys ( return EFI_SUCCESS;
}
+ if (ScsiDiskIsResetBefore (SenseData, NumberOfSenseKeys)) {
+ *Action = ACTION_RETRY_COMMAND_LATER;
+ return EFI_SUCCESS;
+ }
+
if (ScsiDiskIsMediaError (SenseData, NumberOfSenseKeys)) {
ScsiDiskDevice->BlkIo.Media->MediaPresent = FALSE;
ScsiDiskDevice->BlkIo.Media->LastBlock = 0;
|