[coreboot] [RFC] flashrom: Add feature bitfield

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sun May 11 17:28:30 CEST 2008


Hi,

SPI flash on some chipsets (ICH9 and others) poses a real challenge:
There are multiple write and erase commands, but each flash chip may
support only a subset of them and each chipset may also only support a
subset due to in-chipset command filtering. With our current approach
(hardcoding erase commands etc.) a command may fail because it is not in
the common subset although there would be an equivalent command in the
common subset.

I'd like to introduce another field into struct flashchip: u32 flags.
flags would hold a bit for every supported (and important) opcode and
one bit for every variant of a supported opcode. Example follows:

#define SPIFLAG_CHIP_ERASE_60 (1<<0)
#define SPIFLAG_CHIP_ERASE_C7 (1<<1)
#define SPIFLAG_BLOCK_ERASE_52 (1<<2)
#define SPIFLAG_BLOCK_ERASE_D8 (1<<3)
#define SPIFLAG_SECTOR_ERASE_20 (1<<4)
#define SPIFLAG_BYTE_PROGRAM_BYTE (1<<16) //only one byte per command
#define SPIFLAG_BYTE_PROGRAM_PAGE (1<<17) //256 bytes per command

We could fill in this bitfield for chipset drivers as well and use only
those commands/variants which are set in the bitwise AND of supported
chip+chipset commands.

Regards,
Carl-Daniel




More information about the coreboot mailing list