audk/MdeModulePkg/Bus/Sd
Hao Wu b92efc9fe5 MdeModulePkg/EmmcDxe: Make sure no extra data is erased by EraseBlocks
V3 changes:
Add debug messages for new return path when successfully erase the
specified blocks. Refine logic for calculating the size for writing
zeros to device.

V2 changes:

The Trim command is not supported on all eMMC devices. For those devices
that do not support such command, add codes to handle the scenario.

Commit message:

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.
...
When the Erase is executed it will apply to all write blocks within an
erase group.

However, code logic in function EmmcEraseBlocks() does not check whether
the blocks to be erased form complete erase groups. Missing such checks
will lead to erasing extra data on the device.

This commit will:
a. If the device support the Trim command, use the Trim command to
perform the erase operations for eMMC devices.

According to the spec:
Unlike the Erase command, the Trim function applies the erase operation to
write blocks instead of erase groups.

b. If the device does not support the Trim command, use the Erase command
to erase the data in the erase groups. And write zeros to those blocks
that cannot form a complete erase group.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-08-14 08:45:10 +08:00
..
EmmcBlockIoPei MdeModulePkg/SdMmc: Add break to avoid dead loop when polling OCR Reg 2017-03-13 21:41:46 +08:00
EmmcDxe MdeModulePkg/EmmcDxe: Make sure no extra data is erased by EraseBlocks 2017-08-14 08:45:10 +08:00
SdBlockIoPei MdeModulePkg/SdMmc: Add break to avoid dead loop when polling OCR Reg 2017-03-13 21:41:46 +08:00
SdDxe MdeModulePkg/SdDxe: Implementation of Disk Information Protocol 2017-07-06 12:55:38 +08:00