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

Urja Rannikko urjaman at gmail.com
Mon Jun 8 19:07:35 CEST 2009


> 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.

If you're referring to my work, yes the protocol is designed so to be
able to support
many bustypes, but i have no real hardware for anything else than parallel.

And then, i realized a missing feature in my protocol, it cannot tell
the flasher of the bustype to
be used. It's only an optional command away though.

> 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.

 I think that having a simple global current_flashchip pointer would
be simpler in many ways:
- it would only need a single assign to operation to the loop at
probe_flash to support it
- it wouldnt be necessary to pass unnecessary parameters to chip_*
functions ( most dont need this info - atleast atm ;P ),
making for a smaller binary

-- 
urjaman




More information about the coreboot mailing list