MdeModulePkg ScsiDiskDxe: Modify WriteBlocks(Ex)() to follow UEFI spec

The functions ScsiDiskWriteBlocks(Ex) in ScsiDiskDxe/ScsiDisk.c do not
check whether the device is allow to be written originally.

This commit will add read-only check to follow the UEFI spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19445 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hao Wu 2015-12-22 13:54:47 +00:00 committed by hwu1225
parent 7013e0885c
commit 40b0f96fd2
1 changed files with 10 additions and 0 deletions

View File

@ -692,6 +692,11 @@ ScsiDiskWriteBlocks (
goto Done;
}
if (Media->ReadOnly) {
Status = EFI_WRITE_PROTECTED;
goto Done;
}
if (BufferSize == 0) {
Status = EFI_SUCCESS;
goto Done;
@ -1048,6 +1053,11 @@ ScsiDiskWriteBlocksEx (
goto Done;
}
if (Media->ReadOnly) {
Status = EFI_WRITE_PROTECTED;
goto Done;
}
if (BufferSize == 0) {
if ((Token != NULL) && (Token->Event != NULL)) {
Token->TransactionStatus = EFI_SUCCESS;