-
Notifications
You must be signed in to change notification settings - Fork 158
feat: add scsi mode sense operation to detect write protection #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/202502
Are you sure you want to change the base?
feat: add scsi mode sense operation to detect write protection #1524
Conversation
ff10435
to
67cde81
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/202502 #1524 +/- ##
=================================================
Coverage ? 2.22%
=================================================
Files ? 1461
Lines ? 380847
Branches ? 4583
=================================================
Hits ? 8477
Misses ? 372297
Partials ? 73
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
edk2 PR opened in parallel: tianocore/edk2#11603 |
67cde81
to
3588692
Compare
3588692
to
c7c3faa
Compare
|
||
// Mode Sense 6 Byte Command returns the Write Protection status in the 3rd byte | ||
// Bit 7 of the 3rd byte indicates the Write Protection status | ||
*WriteProtectionEnabled = (DataBuffer[2] & 0x80) != 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do you find this definition? I did a quick search and couldn't find it defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spbrogan the SCSI stuff is not easily searchable, but copilot does a good job finding the write docs :). https://www.t10.org/ftp/t10/document.05/05-344r0.pdf see section 6.3.1.
Description
We encountered some errors where on attaching a ReadOnly disk led to write failures. We RCA'd the failure to the Volume protocol not being set to be write protected. We are proposing this change to update the blockIo protocol's media property to set Write protections based on performing a MODE SENSE operation.
For details on how to complete these options and their meaning refer to CONTRIBUTING.md.
How This Was Tested
We tested the change while booting a VM with VHD attached as read only mode and then without read-only mode. We don't encounter any errors which we were hitting earlier.
Integration Instructions
NA