diff options
author | Hao Wu <hao.a.wu@intel.com> | 2015-12-22 13:54:47 +0000 |
---|---|---|
committer | hwu1225 <hwu1225@Edk2> | 2015-12-22 13:54:47 +0000 |
commit | 40b0f96fd2af67575f60299fba157cc35839eb7d (patch) | |
tree | de8e7bb75e51730321ebbaa43cc62792a016d5c3 /MdeModulePkg/Bus/Scsi | |
parent | 7013e0885c471fc9457a6f43a8d5125bfa4eec3d (diff) | |
download | edk2-platforms-40b0f96fd2af67575f60299fba157cc35839eb7d.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.
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
Diffstat (limited to 'MdeModulePkg/Bus/Scsi')
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index a85cc94ae6..3e19fad064 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;
|