Repository navigation
Conversation
…eMMC/UFS Commit b2b0982 (PR bkerler#745, for NAND issue bkerler#522) updated cmd_erase() to send XML <erase> whenever 'erase' is in supported_functions. However, many Qualcomm eMMC/UFS Firehose loaders (244+ loaders in Loaders/, including MSM8917/8937/8940/8953/8996/SDM450) ignore start_sector and num_partition_sectors in handleErase and wipe the entire physical_partition_number (LUN). Restrict the XML <erase> path to MemoryName == 'nand' so NAND block erases continue to work while eMMC/UFS/spinor safely zero-write only the requested sector range via <program>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restricts the XML
<erase>branch infirehose.cmd_erase()toself.cfg.MemoryName.lower() == "nand"so thate,es, andepcontinue using safe zero-writing via<program>on eMMC/UFS/spinor devices.Problem / Root Cause
Commit
b2b0982(PR #745, addressing NAND issue #522) added:inside
cmd_erase(), sending<erase SECTOR_SIZE_IN_BYTES=... num_partition_sectors=... physical_partition_number=... start_sector=.../>.However, on many Qualcomm eMMC and UFS Firehose loaders, the
<erase>handler only parsesphysical_partition_numberand ignoresstart_sector/num_partition_sectors, silently wiping the entire physical partition (LUN) — including GPT,sbl1,aboot,modemst1/modemst2,persist, andsystem— and returningACK.PD1628F, MSM8917, eMMC) usingLoaders/vivo/000560e100000000_60ba997fef6da9f0_fhprg_peek.bin. Runningedl.py es 7605248 64 --memory=emmc(oredl.py e userdata --memory=emmc) wiped the entire 16 GB eMMC LUN 0 to0x00.Loaders/: Scanning the 878 loader binaries inLoaders/shows at least 244 loaders with whole-LUN-only<erase>handlers:physical_partition_number-only handler (No physical_partition_number, covering MSM8917, MSM8937, MSM8940, MSM8953, SDM450, etc.)In handleErase Calling storage_device_erase()withoutstart_sector/num_partition_sectorssupport (e.g., MSM8996)get_supported_functions()falls back to a generic list that includes'erase', causing the<erase>path to trigger even when supported functions are not reported.Fix
Gate the XML
<erase>path onself.cfg.MemoryName.lower() == "nand"(matchingnand_pages_attr()andconfigure()fromb2b0982), keeping NAND block erases working for #522 while restoring the safe<program>zero-write path for eMMC/UFS/spinor.Testing
xmlsend/cdcacrossemmc/eMMC,ufs/UFS,spinor, andnand/NAND(with and without'erase'insupported_functions):emmc/ufs/spinor: sends<program>+ exactnum_partition_sectors * SECTOR_SIZE_IN_BYTESzero bytes; never sends<erase>.nandwith'erase': sends<erase>withPAGES_PER_BLOCKwhen configured.nandwithout'erase': falls back to<program>.python -m py_compile edlclient/Library/firehose.py.