From patchwork Sat Apr 15 13:44:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 97460 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp675643qgf; Sat, 15 Apr 2017 06:44:58 -0700 (PDT) X-Received: by 10.84.231.204 with SMTP id g12mr2030599pln.145.1492263898884; Sat, 15 Apr 2017 06:44:58 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 73si5579483ple.186.2017.04.15.06.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Apr 2017 06:44:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B86982194EB6D; Sat, 15 Apr 2017 06:44:57 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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",