From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-x22f.google.com (mail-pg0-x22f.google.com [IPv6:2607:f8b0:400e:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 754E32194EB6C for ; Sat, 15 Apr 2017 06:44:56 -0700 (PDT) Received: by mail-pg0-x22f.google.com with SMTP id t187so1657919pgt.1 for ; Sat, 15 Apr 2017 06:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=jdY0Nb+9wa+wVZ6fztTJ4f3q368SUeRPzpEpYFah7hA=; b=iVq63TfYdPA8ppJabQuCdoqMftO+Q6i89cV04PdyxWXtpyfBEbRGLRtr/huU7di2EP RxXZY3U2Kp5FvdkqrcKOVpeE7WKqf2ontrdRb/LtVfzNZKZXgImkTC0WP+9CpITChH1T BqQR3xQj0e2zUDrhvkEQtyM6qK025oAWpevxs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jdY0Nb+9wa+wVZ6fztTJ4f3q368SUeRPzpEpYFah7hA=; b=VI3lhbIZAT9idqDjIyr1Hq1gBp6JzP/det+D+bYauE6QMfj0G4cxEizZb9z1fGFJf9 x63aTIpdQIYGxKZ1XZIAFPL/kINBhwtGmTukMOGXuHitMAggStrjfIUHwD2tspnxxqyg 949vVA8Q2K+x4F1cZFgW2YeHFaLpeYdqt5NHG64ztuVIQ4cy/3/m1L7YXi6eTBQlfRG+ mN/boMzoKUXe3M+gozyPURcEMtovqaJopyeRgs1sfBLteAzDv1WRjiteR1q976SMcgaa t7n+TtpS/IfMI9QCjXh4Zs0LTO/yJvrgR1VVecyuSU51u5aNCoUqvmJpXBhmR4f6sENP UBew== X-Gm-Message-State: AN3rC/4vzoBumyhd2Ydv0qrgE4YuNvaqZlFGfbmt95i1KL8VIEwB0i+d thQ0LB7X5egOJeEw X-Received: by 10.99.111.138 with SMTP id k132mr2854834pgc.138.1492263896119; Sat, 15 Apr 2017 06:44:56 -0700 (PDT) Received: from localhost.localdomain ([45.41.135.58]) by smtp.gmail.com with ESMTPSA id f6sm8815876pfe.57.2017.04.15.06.44.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Apr 2017 06:44:55 -0700 (PDT) From: Haojian Zhuang To: hao.a.wu@intel.com, feng.tian@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org Cc: Haojian Zhuang Date: Sat, 15 Apr 2017 21:44:46 +0800 Message-Id: <1492263886-17209-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [PATCH] MdeModulePkg: ScsiDiskDxe: fix to support EFI_ERASE_BLOCK_PROTOCOL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Apr 2017 13:44:56 -0000 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 --- 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