summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Bus
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-25 09:32:25 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-25 09:32:25 +0000
commit5d7ca12492d5ffb8380fcbe22b1082e8253c13ac (patch)
tree7a8399d19e51a4b969050df19d24491fda175371 /IntelFrameworkModulePkg/Bus
parentfcf5e49dc912f27b77b50ddea3c6b7a4ba28717c (diff)
downloadedk2-platforms-5d7ca12492d5ffb8380fcbe22b1082e8253c13ac.tar.xz
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@11585 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus')
-rw-r--r--IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c
index 4076f53965..39f0ba0191 100644
--- a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c
+++ b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyBlock.c
@@ -225,16 +225,7 @@ FddReadWriteBlocks (
FdcFreeCache (FdcDev);
}
}
- //
- // Check the Parameter is valid
- //
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
//
// Set the drive motor on
//
@@ -268,6 +259,11 @@ FddReadWriteBlocks (
return EFI_MEDIA_CHANGED;
}
+ if (BufferSize == 0) {
+ MotorOff (FdcDev);
+ return EFI_SUCCESS;
+ }
+
if (Operation == WRITE) {
if (Media->ReadOnly) {
MotorOff (FdcDev);
@@ -277,6 +273,11 @@ FddReadWriteBlocks (
//
// Check the parameters for this read/write operation
//
+ if (Buffer == NULL) {
+ MotorOff (FdcDev);
+ return EFI_INVALID_PARAMETER;
+ }
+
if (BufferSize % BlockSize != 0) {
MotorOff (FdcDev);
return EFI_BAD_BUFFER_SIZE;