summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2023-01-29 12:32:51 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2023-02-02 02:07:32 +0000
commitd0fbe5344abdf161074181bce452f9d90cff993b (patch)
treeda59d241186035d0e068e0b7d4b19dd0b041c2a3 /jedec.c
parent3edef2f3a680a57d060c8c787de23c88152d4ef4 (diff)
downloadflashrom-d0fbe5344abdf161074181bce452f9d90cff993b.tar.gz
flashrom-d0fbe5344abdf161074181bce452f9d90cff993b.tar.bz2
flashrom-d0fbe5344abdf161074181bce452f9d90cff993b.zip
jedec.c: Collapse erase_chip_block_jedec() indirection
Change-Id: I6e4a63e4935d4b69b66cbd1888f62b6af066a2ac Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/72503 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/jedec.c b/jedec.c
index 43ec0dffe..697a239f3 100644
--- a/jedec.c
+++ b/jedec.c
@@ -345,12 +345,20 @@ int erase_block_jedec(struct flashctx *flash, unsigned int block, unsigned int s
return 0;
}
-static int erase_chip_jedec_common(struct flashctx *flash, unsigned int mask)
+/* erase chip with block_erase() prototype */
+int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr, unsigned int blocksize)
{
- chipaddr bios = flash->virtual_memory;
- bool shifted = (flash->chip->feature_bits & FEATURE_ADDR_SHIFTED);
+ const unsigned int mask = getaddrmask(flash->chip);
+ const chipaddr bios = flash->virtual_memory;
+ const bool shifted = (flash->chip->feature_bits & FEATURE_ADDR_SHIFTED);
unsigned int delay_us = 0;
+ if ((addr != 0) || (blocksize != flash->chip->total_size * 1024)) {
+ msg_cerr("%s called with incorrect arguments\n",
+ __func__);
+ return -1;
+ }
+
if(flash->chip->probe_timing != TIMING_ZERO)
delay_us = 10;
@@ -510,19 +518,6 @@ int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start,
return 0;
}
-/* erase chip with block_erase() prototype */
-int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr,
- unsigned int blocksize)
-{
- const unsigned int mask = getaddrmask(flash->chip);
- if ((addr != 0) || (blocksize != flash->chip->total_size * 1024)) {
- msg_cerr("%s called with incorrect arguments\n",
- __func__);
- return -1;
- }
- return erase_chip_jedec_common(flash, mask);
-}
-
int probe_jedec(struct flashctx *flash)
{
const unsigned int mask = getaddrmask(flash->chip);