[coreboot] [RFC] Adding struct flashchip * to all chip functions

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Jun 8 12:43:26 CEST 2009


Short summary: We need to add struct flashchip * to all chip functions
to avoid a big mess once we support multiprotocol capable external
programmers.

Flashrom has really nice generic routines like probe_jedec. They work
perfectly as long as flashrom does not have to care about the bus
protocol it should use to talk to the chip.
Even current external flashers (nic3com, satasii) work fine because
flashrom does not have to care about the bus protocol there either.
However, any external flasher supporting multiple bus protocols (and
such flashers are being worked on) really wants to know which protocol
to use. Unfortunately, chip_read* and chip_write* don't know about the
bus protocol.

Adding struct flashchip * as parameter to chip_read* and chip_write*
would solve the issue quite nicely and improve our abstraction at the
same time.
Of course, this means every function calling chip_read* and chip_write*
has to pass struct flashchip * to them. Ergo, we need struct flashchip *
as parameter in the whole call chain.

An alternative would be using global variables for current flash chip
properties, but that is madness during probe where we want to check for
multiple chips.

Opinions? Thoughts? Want explanations? Tell me!


Regards,
Carl-Daniel

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





More information about the coreboot mailing list