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
This commit is contained in:
niruiyu
2011-04-25 09:31:57 +00:00
parent fd776d390d
commit fcf5e49dc9
4 changed files with 106 additions and 67 deletions

View File

@ -842,6 +842,11 @@ BlockIoReadWrite (
//
// Check parameters.
//
Media = This->Media;
if (MediaId != Media->MediaId) {
return EFI_MEDIA_CHANGED;
}
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
@ -850,11 +855,6 @@ BlockIoReadWrite (
return EFI_SUCCESS;
}
Media = This->Media;
if (MediaId != Media->MediaId) {
return EFI_MEDIA_CHANGED;
}
BlockSize = Media->BlockSize;
if ((BufferSize % BlockSize) != 0) {
return EFI_BAD_BUFFER_SIZE;