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<star.z...@intel.com>
Cc: Ruiyu Ni<ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu<hao.a...@intel.com>

Reviewed-by: Jun Nie <jun....@linaro.org>
edk2-devel mailing list

Reply via email to