From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (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 5CD3C21954060 for ; Tue, 18 Apr 2017 08:03:08 -0700 (PDT) Received: by mail-wr0-x235.google.com with SMTP id l28so104412529wre.0 for ; Tue, 18 Apr 2017 08:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=wSz+esZD4C07dbJ0GbtAIWKuWgo58R1AXs5OqVpl08c=; b=DHoW1K6NTfkICfAAKV5LzSONiTx6kufG8Lido3fLZhWg6WJIK4KsvBC49PFpsuLapg zuvtB89kGoceGxDINYlFlQUgpHQnGm1KiQIBdDiIzSrntLqWn0fzW+AeGy6+B/Q+XbOM FAfyaq5Ub8cTB+OmQkUCtf8ZaVCF3vsJse8sWSWnhg+M/jXk9+qMKuPVT0zli3wBui/Q 1zgQy63JqYn9pwO6puKI6CzsD9FxB2pPDdEjmuYpOaUKIiITgU6cdL8YzE+6gvwuLFJz SZVew02vXCctxrCGlk5MvD255qjB/mQkvj0OuBjeNKZSw7HU/bM7DoL0gS1EJMIHDV9b 2Ypw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=wSz+esZD4C07dbJ0GbtAIWKuWgo58R1AXs5OqVpl08c=; b=ESUEACND5XSxrMVSXWtbz/UlcQmT4OHweIYUcu7b2oFUt9W9GvTpXcQYx1ByVl60EO bhYHTWMwYc3f7uMbsbiAUP2rzNiftzS/RZJpk8YbCF3sTzPUbnljPRsEdTUmuMMMKvww LJL3rSJsHOnwLlrN6SHVmMSXa8XQj6Nyltgdz6C01LYZpOOpNvkbRSmbaKWsv5AotM9s wGxRLcHE75gEBsPkIcmXYHNQu9iR3fTIBld8NW4S8yr0HU4n4eu5QQagXUy5745MGiXo Mb1Ev1BbpzccdcVqJGsvrykUhZWt3lFXo+VUelm+iIKdfZWyn1RI7ooG9xs905Lw1mHS kReA== X-Gm-Message-State: AN3rC/4N81y1mc0/0vjkU3t00S4GK34XUP+miprOKuZUTPbLwg371pMK SuSCQIYn4j8G7A== X-Received: by 10.223.165.138 with SMTP id g10mr22354569wrc.19.1492527786462; Tue, 18 Apr 2017 08:03:06 -0700 (PDT) Received: from [192.168.10.165] (94-39-149-222.adsl-ull.clienti.tiscali.it. [94.39.149.222]) by smtp.googlemail.com with ESMTPSA id m83sm15363367wmc.7.2017.04.18.08.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 08:03:05 -0700 (PDT) Sender: Paolo Bonzini To: Haojian Zhuang , hao.a.wu@intel.com, feng.tian@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org References: <1492263886-17209-1-git-send-email-haojian.zhuang@linaro.org> From: Paolo Bonzini Message-ID: Date: Tue, 18 Apr 2017 17:03:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1492263886-17209-1-git-send-email-haojian.zhuang@linaro.org> Subject: Re: [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: Tue, 18 Apr 2017 15:03:08 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 15/04/2017 15:44, Haojian Zhuang wrote: > 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. Hi, you need to use WRITE SAME, with a zero payload and the UNMAP bit set in the command descriptor, in order to achieve a "secure" erase functionality. UNMAP is only an advisory command, and does not guarantee that the blocks are unmapped. Discard can use either WRITE SAME or UNMAP. Also, > // 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", The debug message is now wrong. Paolo