[flashrom] [RFC] Chip ID #defines

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Jul 22 14:51:46 CEST 2010


Parts of flashrom codebase are really old any nobody ever got around to
cleaning them up. flashchips.h is one of those places with organic
growth on top of historic cruft.

Right now, most chip ID #defines have underscores somewhere in the first
few characters of the name. For a sizable portion of flash chips this
underscore does not make any sense if you look at the original chip
name. My best guess is that someone originally thought that having a
vendor name as part of the chip ID #define.

For chips which have the vendor name as part of the chip name anyway
this might make sense. A prominent example is SST_49LF080A. OTOH, stuff
like W_25X10 is just really ugly. Besides that, grepping for those
identifiers requires a lot of guesswork if you only know the chip name
as printed on the chip. I am not sure if we really want to have
underscores in random places in all those IDs. Nobody ever bothered to
make those #defines look sane or consistent.

Should we kill the underscore inside the chip name completely and
instead use
$VENDORNAME_$CHIPNAME for the #defines? IMHO that looks more natural and
makes grepping easier.

We'd still have to decide whether we should use the vendor name as it is
used in $VENDOR_ID or a different form. For SST (and a few other
manufacturers) this is not a problem because the vendor ID #define is
SST_ID. However, for Winbond it gets a bit more difficult because we
have WINBOND_ID and WINBOND_NEX_ID. W_25X10 would become either
WINBOND_NEX_W25X10 or WINBOND_W25X10. I think the former variant makes
it easier to visually cross-check if the vendor and chip ID combination
makes sense.

Sometimes multiple chips have the same ID. That's not a problem if the
chips have identical characteristics and if they share one common entry
in flashchips.c. We could add .alias_vendor and .alias_name fields (or
any similar solution) to struct flashchip to accommodate chips where the
vendor and chip name changed a few times in a way that can't be
expressed easily with "oldname/newname".
We also should definitely talk about evil twins. Those are chips with
identical IDs but distinct/incompatible programming strategies. I sent a
patch to mark some of them as evil twins, but we still have to decide if
those evil twins should use the same #define for the ID or if they
should use different #defines.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list