From 994de3ae946820dd6e03eb600e2e623e917845a4 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Mon, 25 Jul 2022 00:23:25 +0300 Subject: writeprotect_ranges.c: add more range functions Not all chips follow the same pattern. There are differences in how CMP bit is treated or in block size used. Change-Id: Ied7b27be2ee2426af8f473432e2b01a290de2365 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/flashrom/+/66212 Reviewed-by: Nikolai Artemiev Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) --- include/chipdrivers.h | 3 +++ include/flash.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/chipdrivers.h b/include/chipdrivers.h index 3b07afe3..34e3af8d 100644 --- a/include/chipdrivers.h +++ b/include/chipdrivers.h @@ -216,5 +216,8 @@ int spi_block_erase_emulation(struct flashctx *flash, unsigned int addr, unsigne /* writeprotect_ranges.c */ void decode_range_spi25(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len); +void decode_range_spi25_64k_block(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len); +void decode_range_spi25_bit_cmp(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len); +void decode_range_spi25_2x_block(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len); #endif /* !__CHIPDRIVERS_H__ */ diff --git a/include/flash.h b/include/flash.h index 23222c72..b4b56fe0 100644 --- a/include/flash.h +++ b/include/flash.h @@ -224,8 +224,11 @@ struct reg_bit_info { struct wp_bits; enum decode_range_func { - NO_DECODE_RANGE_FUNC = 0, /* 0 indicates no range decode funciton is set. */ + NO_DECODE_RANGE_FUNC = 0, /* 0 indicates no range decode function is set. */ DECODE_RANGE_SPI25 = 1, + DECODE_RANGE_SPI25_64K_BLOCK = 2, + DECODE_RANGE_SPI25_BIT_CMP = 3, + DECODE_RANGE_SPI25_2X_BLOCK = 4, }; typedef void (decode_range_func_t)(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len); -- cgit v1.2.3