From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com [IPv6:2607:f8b0:400e:c05::230]) (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 E9AAD21E1DB44 for ; Wed, 9 Aug 2017 20:36:21 -0700 (PDT) Received: by mail-pg0-x230.google.com with SMTP id v189so36027412pgd.2 for ; Wed, 09 Aug 2017 20:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8ow6viEqbhI2Wn5Bh2P4EtuSM1eYCi7n4VFrXF4A4Oc=; b=OsQR7KCgGQII0nm19MZNcVJ5/zFJlPZyhxcilzgb9ZZynBjGZRhzTtvniu/9gSPfVV jmC1TWJXw0v/YMH5Gt0hc6cfcctioIicrEIgV5VvEvKyfue06fYCyc65revP7tHlWC4Y ZZynbInaC4mKdPe45LzhcNwyTnst2/qNNX/6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8ow6viEqbhI2Wn5Bh2P4EtuSM1eYCi7n4VFrXF4A4Oc=; b=r6xzSjn7sXOJ/5+GCeaHd3zjmUklxC0Yzjg5e5HirvaEVAptBT5n/pmwup5pkqBLHp HfevgYdVBNh+658hxVCGIV260eR/EqyS7imVkkuS1dZuytgBp9wYxS2Tleiotx3TViX0 Hau+/HBvoAcVE/g/zmhjKK11PQsYovBsrVcVSLQlhOXqL6y5XtgRSgs229y+R16pHEqt rFlelEen+Ak777ERFwCDDvR0c2wUSug4ay/ZEnfEQGMdAitGHgyrBAX823+Wu6euqKu/ YHk/dYCRzPlThWyyhyTrfgUN9D92XXwTZUaGhgyJ99zYtIxYSxvAy8QPa27xdPDxFInz ZgpA== X-Gm-Message-State: AHYfb5g2bZ5r3nxrejU9xam/WxgTQaS10XMT1Z0YWRFewhxOBIDkG9Cs hhkpUK3Zv2JctoJ/ X-Received: by 10.98.204.22 with SMTP id a22mr10330295pfg.59.1502336320547; Wed, 09 Aug 2017 20:38:40 -0700 (PDT) Received: from [10.56.6.22] ([113.53.228.63]) by smtp.googlemail.com with ESMTPSA id a86sm11375743pfe.181.2017.08.09.20.38.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Aug 2017 20:38:39 -0700 (PDT) To: Hao Wu , edk2-devel@lists.01.org Cc: Ruiyu Ni , Star Zeng References: <20170808020438.14540-1-hao.a.wu@intel.com> From: Jun Nie Message-ID: <6f76e319-ebdb-9300-8224-3b5417e6cc6d@linaro.org> Date: Thu, 10 Aug 2017 11:38:31 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170808020438.14540-1-hao.a.wu@intel.com> Subject: Re: [PATCH] MdeModulePkg/EmmcDxe: Use Trim instead of Erase for EraseBlocks 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: Thu, 10 Aug 2017 03:36:22 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit On 2017年08月08日 10:04, Hao Wu wrote: > The current implementation of the Erase Block Protocol service > EraseBlocks() uses the erase command. According to spec eMMC Electrical > Standard 5.1, Section 6.6.9: > > The erasable unit of the eMMC is the "Erase Group"; Erase group is > measured in write blocks that are the basic writable units of the Device. > > However, code logic in function EmmcEraseBlocks() does not check whether > the starting logical block address to be erased and/or the size in bytes > to be erased is aligned with the erase group. Missing such checks will > erase the data on additional blocks on an eMMC device. > > This commit will use the Trim command instead to perform the block erase > for eMMC devices. Unlike the Erase command, according to spec eMMC > Electrical Standard 5.1, Section 6.6.10: > > The Trim operation is similar to the default erase operation described in > 6.6.9. The Trim function applies the erase operation to write blocks > instead of erase groups. > > Also, the Trim operation is mandatory for eMMC devices according to spec > eMMC Electrical Standard 5.1, Chapter 11, Table 220. > > Cc: Star Zeng > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu Reviewed-by: Jun Nie