diff options
author | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-25 09:31:57 +0000 |
---|---|---|
committer | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-25 09:31:57 +0000 |
commit | fcf5e49dc912f27b77b50ddea3c6b7a4ba28717c (patch) | |
tree | 47f3a2fd009765e02994120776ef9d0598961830 /MdeModulePkg/Bus/Scsi | |
parent | fd776d390d63926dad53fb8addcfdbfc76f793b0 (diff) | |
download | edk2-fcf5e49dc912f27b77b50ddea3c6b7a4ba28717c.zip edk2-fcf5e49dc912f27b77b50ddea3c6b7a4ba28717c.tar.gz edk2-fcf5e49dc912f27b77b50ddea3c6b7a4ba28717c.tar.bz2 |
Change BlockIo drivers to return EFI_NO_MEDIA or EFI_MEDIA_CHANGED even the Buffer/BufferSize/Lba is invalid so that caller can probe the media status easier.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11584 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi')
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 3f6963e..fd63857 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -1,7 +1,7 @@ /** @file
SCSI disk driver that layers on every SCSI IO protocol in the system.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, 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
@@ -454,17 +454,8 @@ ScsiDiskReadBlocks ( BOOLEAN MediaChange;
EFI_TPL OldTpl;
- MediaChange = FALSE;
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
+ MediaChange = FALSE;
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {
@@ -502,6 +493,16 @@ ScsiDiskReadBlocks ( goto Done;
}
+ if (Buffer == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ if (BufferSize == 0) {
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+
if (BufferSize % BlockSize != 0) {
Status = EFI_BAD_BUFFER_SIZE;
goto Done;
@@ -569,17 +570,8 @@ ScsiDiskWriteBlocks ( BOOLEAN MediaChange;
EFI_TPL OldTpl;
- MediaChange = FALSE;
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
+ MediaChange = FALSE;
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {
@@ -617,6 +609,16 @@ ScsiDiskWriteBlocks ( goto Done;
}
+ if (BufferSize == 0) {
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+
+ if (Buffer == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
if (BufferSize % BlockSize != 0) {
Status = EFI_BAD_BUFFER_SIZE;
goto Done;
|