Attention is currently required from: Anastasia Klimchuk, David Hendricks, Matt DeVillier.
Anton Samsonov has posted comments on this change by Matt DeVillier. ( https://review.coreboot.org/c/flashrom/+/85160?usp=email )
Change subject: cli_classic: Add option to use first detected chip if multiple found ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
There are certainly cases where there is no harm in selecting the first chip of multiple.
There may be a couple of options here.
1. Automatic disambiguation through advanced fingerprinting
Did you examined Device ID combinations from different identification methods, such as RDID + RES/REMS in cases when no extended RDID is available? (I did not dug deep, but noticed that 8-bit Device ID from REMS not necessarily copies the least significant 8-bit Device ID from RDID, creating a possibility of distinct 24-bit combinations compared to regular 16-bit RDID duplicates.)
As proposed by Anastasia, some parts of SFDP data may become another source of identification, when compared among similar models relevant to your case.
2. Automatic parameter tuning
If you are absolutely sure that several chip models that share single Device ID constitute a mutually interchangeable group of device profiles, then why not create "compatibility domains" in flashchips database? Or, better yet, why not create them automatically on-the-fly? That is, create a "meta-device" which acts like greatest common denominator for all compatible chips in question. Like, first AND all feature bits, then OR them, and compare those after masking relevant bits.
For example, the aforementioned Spansion "twins" have these flags:
S25FL512S = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_4BA_NATIVE | FEATURE_4BA_ENTER_EAR7 | FEATURE_4BA_EAR_1716
S25FS512S = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI | FEATURE_4BA_NATIVE | FEATURE_4BA_ENTER
Of our interest, we see FEATURE_WRSR_WREN and FEATURE_4BA_NATIVE in common, but no universally supported method of entering 4-byte addressing. So, those chips cannot be actually treated interchangeably, which is proven by practice. But there may be plenty of other chips that possibly can, if you are right.