public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg: ScsiDiskDxe: fix to support EFI_ERASE_BLOCK_PROTOCOL
@ 2017-04-15 13:44 Haojian Zhuang
  2017-04-17  1:58 ` Wu, Hao A
  2017-04-18 15:03 ` Paolo Bonzini
  0 siblings, 2 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-04-15 13:44 UTC (permalink / raw)
  To: hao.a.wu, feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel
  Cc: Haojian Zhuang

If bit TPZ and bit TPRZ are set, the erase feature is implemented.
If bit TPZ is set and bit TPRZ is clear, the discard feature is
implemented. And discard is a non-secure variant of the erase
functionality.

So the detecting operation of EFI_ERASE_BLOCK_PROTOCOL, we should
consider to support both functionality. Since discard functionality is
only supported in some UFS devices.

And both of these two features are relied on UNMAP command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index b5eff25..6e12e4f 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -5400,11 +5400,11 @@ DetermineInstallEraseBlock (
   if (CommandStatus == EFI_SUCCESS) {
     //
     // Universal Flash Storage (UFS) Version 2.0
-    // Section 11.3.9.2
+    // Section 11.3.9.2 & Section 12.2.3
     // Bits TPE and TPRZ should both be set to enable the erase feature on UFS.
+    // Setting bit TPE and clearing bit TPRZ to enable the discard feature on UFS.
     //
-    if (((CapacityData16->LowestAlignLogic2 & BIT7) == 0) ||
-        ((CapacityData16->LowestAlignLogic2 & BIT6) == 0)) {
+    if ((CapacityData16->LowestAlignLogic2 & BIT7) == 0) {
       DEBUG ((
         EFI_D_VERBOSE,
         "ScsiDisk EraseBlock: Either TPE or TPRZ is not set: 0x%x.\n",
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-18 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-15 13:44 [PATCH] MdeModulePkg: ScsiDiskDxe: fix to support EFI_ERASE_BLOCK_PROTOCOL Haojian Zhuang
2017-04-17  1:58 ` Wu, Hao A
2017-04-17 14:03   ` Haojian Zhuang
2017-04-18 13:06     ` Wu, Hao A
2017-04-18 13:17       ` Haojian Zhuang
2017-04-18 15:03 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox