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
This commit is contained in:
niruiyu 2011-04-25 09:32:25 +00:00
parent fcf5e49dc9
commit 5d7ca12492
1 changed files with 10 additions and 9 deletions

View File

@ -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;