summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2015-12-23 01:35:01 +0000
committerhwu1225 <hwu1225@Edk2>2015-12-23 01:35:01 +0000
commit1c53b2387cd6a6edb2bea804040127d6e98dded0 (patch)
tree90f24623912b4368893e9efebcc46e424efa9aa7
parent7794116bcdf6066b6f5483f116efb00fe69cb25e (diff)
downloadedk2-platforms-1c53b2387cd6a6edb2bea804040127d6e98dded0.tar.xz
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. (Sync patch r19445 from main trunk.) 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/branches/UDK2015@19466 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 4f58254c3b..238718501c 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -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;