audk/MdeModulePkg/Bus
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
..
Ata MdeModulePkg/AtaAtapiPassThru: relax PHY detect timeout 2017-06-28 12:47:13 +00:00
I2c/I2cDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Isa MdeModulePkg: Update comments in SimpleTextInEx according to UEFI 2.7 2017-06-20 09:29:42 +08:00
Pci MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens 2017-08-09 15:59:13 +08:00
Scsi MdeModulePkg/ScsiDiskDxe: Fix undefined behavior in signed left shift 2017-04-13 08:58:45 +08:00
Sd MdeModulePkg/EmmcDxe: Make sure no extra data is erased by EraseBlocks 2017-08-14 08:45:10 +08:00
Ufs MdeModulePkg/Ufs: Set 'Data Segment Length' field for Write Descriptor 2017-08-02 20:56:53 +08:00
Usb MdeModulePkg: Update comments in SimpleTextInEx according to UEFI 2.7 2017-06-20 09:29:42 +08:00