diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2018-01-15 01:06:09 +0300 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2018-02-11 16:52:48 +0000 |
commit | 995f755ff569cbf6ed8d4eec5920b41628aa8ac9 (patch) | |
tree | 8bf525250f29a35eac59e1140da8c039790842cd /flash.h | |
parent | 31b5e3bfe6c01180d9a079813ecd199b4808315d (diff) | |
download | flashrom-995f755ff569cbf6ed8d4eec5920b41628aa8ac9.tar.gz flashrom-995f755ff569cbf6ed8d4eec5920b41628aa8ac9.tar.bz2 flashrom-995f755ff569cbf6ed8d4eec5920b41628aa8ac9.zip |
Add support for selecting the erased bit value with a flag
Most flash chips are erased to ones and programmed to zeros. However, some
other chips, such as the ENE KB9012 internal flash, work the opposite way.
Change-Id: Ia7b0de8568e31f9bf263ba0ad6b051e837477b6b
Signed-off-by: Mike Banon <mikebdp2@gmail.com>
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-on: https://review.coreboot.org/23258
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'flash.h')
-rw-r--r-- | flash.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -130,6 +130,13 @@ enum write_granularity { #define FEATURE_4BA_NATIVE (FEATURE_4BA_READ | FEATURE_4BA_FAST_READ | FEATURE_4BA_WRITE) #define FEATURE_4BA (FEATURE_4BA_ENTER | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE) #define FEATURE_4BA_WREN (FEATURE_4BA_ENTER_WREN | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE) +/* + * Most flash chips are erased to ones and programmed to zeros. However, some + * other flash chips, such as the ENE KB9012 internal flash, work the opposite way. + */ +#define FEATURE_ERASED_ZERO (1 << 16) + +#define ERASED_VALUE(flash) (((flash)->chip->feature_bits & FEATURE_ERASED_ZERO) ? 0x00 : 0xff) enum test_state { OK = 0, @@ -309,7 +316,7 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f int read_flash_to_file(struct flashctx *flash, const char *filename); char *extract_param(const char *const *haystack, const char *needle, const char *delim); int verify_range(struct flashctx *flash, const uint8_t *cmpbuf, unsigned int start, unsigned int len); -int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran); +int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran, const uint8_t erased_value); void print_version(void); void print_buildinfo(void); void print_banner(void); |