summaryrefslogtreecommitdiffstats
path: root/ichspi.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-06-17 21:53:08 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2022-08-15 12:45:39 +0000
commit456be2ad7af086c52e86a698b0d463e3f1589027 (patch)
tree9a843c8e735f0524414b709465b09d986a27bdf7 /ichspi.c
parent61f02066443e2d255e0dc56b68db433a02a4f790 (diff)
downloadflashrom-456be2ad7af086c52e86a698b0d463e3f1589027.tar.gz
flashrom-456be2ad7af086c52e86a698b0d463e3f1589027.tar.bz2
flashrom-456be2ad7af086c52e86a698b0d463e3f1589027.zip
ichspi.c: Fix ich_hwseq_get_erase_block_size() type signature
Move towards functions depending less on globals. BUG=b:237839418 TEST=builds Change-Id: Id1de6eb184340b3cac8a6bdbb94c22c8e37d8d2c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65203 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Alexander Goncharov <chat@joursoir.net>
Diffstat (limited to 'ichspi.c')
-rw-r--r--ichspi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ichspi.c b/ichspi.c
index 57350089b..ddd95354e 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1276,7 +1276,7 @@ static void ich_hwseq_set_addr(uint32_t addr, uint32_t mask)
* by UVSCC and LVSCC respectively. An alternative to implement this method
* would be by querying FPB and the respective VSCC register directly.
*/
-static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr)
+static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr, uint32_t addr_mask, bool only_4k)
{
uint8_t enc_berase;
static const uint32_t dec_berase[4] = {
@@ -1286,11 +1286,11 @@ static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr)
64 * 1024
};
- if (hwseq_data.only_4k) {
+ if (only_4k) {
return 4 * 1024;
}
- ich_hwseq_set_addr(addr, hwseq_data.addr_mask);
+ ich_hwseq_set_addr(addr, addr_mask);
enc_berase = (REGREAD16(ICH9_REG_HSFS) & HSFS_BERASE) >> HSFS_BERASE_OFF;
return dec_berase[enc_berase];
}
@@ -1432,7 +1432,7 @@ static int ich_hwseq_probe(struct flashctx *flash)
else
boundary = 0;
size_high = total_size - boundary;
- erase_size_high = ich_hwseq_get_erase_block_size(boundary);
+ erase_size_high = ich_hwseq_get_erase_block_size(boundary, hwseq_data.addr_mask, hwseq_data.only_4k);
if (boundary == 0) {
msg_cdbg2("There is only one partition containing the whole "
@@ -1446,7 +1446,7 @@ static int ich_hwseq_probe(struct flashctx *flash)
"at address 0x%06x in two partitions.\n",
0, total_size-1, boundary);
size_low = total_size - size_high;
- erase_size_low = ich_hwseq_get_erase_block_size(0);
+ erase_size_low = ich_hwseq_get_erase_block_size(0, hwseq_data.addr_mask, hwseq_data.only_4k);
eraser->eraseblocks[0].size = erase_size_low;
eraser->eraseblocks[0].count = size_low / erase_size_low;
@@ -1471,7 +1471,7 @@ static int ich_hwseq_block_erase(struct flashctx *flash, unsigned int addr,
uint32_t erase_block;
uint16_t hsfc;
- erase_block = ich_hwseq_get_erase_block_size(addr);
+ erase_block = ich_hwseq_get_erase_block_size(addr, hwseq_data.addr_mask, hwseq_data.only_4k);
if (len != erase_block) {
msg_cerr("Erase block size for address 0x%06x is %d B, "
"but requested erase block size is %d B. "