Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/72631 )
Change subject: jedec.c: Fold up mask param into func ......................................................................
jedec.c: Fold up mask param into func
Change-Id: Iee4b1d5bc850cbeec0de9a1603fe04a3a1855330 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M jedec.c 1 file changed, 18 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/31/72631/1
diff --git a/jedec.c b/jedec.c index 3df9cf2..e13053f 100644 --- a/jedec.c +++ b/jedec.c @@ -109,10 +109,11 @@ } }
-static void start_program_jedec_common(const struct flashctx *flash, unsigned int mask) +static void start_program_jedec_common(const struct flashctx *flash) { - chipaddr bios = flash->virtual_memory; - bool shifted = (flash->chip->feature_bits & FEATURE_ADDR_SHIFTED); + const chipaddr bios = flash->virtual_memory; + const bool shifted = (flash->chip->feature_bits & FEATURE_ADDR_SHIFTED); + const unsigned int mask = getaddrmask(flash->chip);
chip_writeb(flash, 0xAA, bios + ((shifted ? 0x2AAA : 0x5555) & mask)); chip_writeb(flash, 0x55, bios + ((shifted ? 0x5555 : 0x2AAA) & mask)); @@ -350,7 +351,7 @@ }
static int write_byte_program_jedec_common(const struct flashctx *flash, const uint8_t *src, - chipaddr dst, unsigned int mask) + chipaddr dst) { int tries = 0;
@@ -362,7 +363,7 @@ for (; tries < MAX_REFLASH_TRIES; tries++) { const chipaddr bios = flash->virtual_memory; /* Issue JEDEC Byte Program command */ - start_program_jedec_common(flash, mask); + start_program_jedec_common(flash);
/* transfer data from source to destination */ chip_writeb(flash, *src, dst); @@ -383,11 +384,10 @@ int failed = 0; chipaddr dst = flash->virtual_memory + start; chipaddr olddst; - const unsigned int mask = getaddrmask(flash->chip);
olddst = dst; for (i = 0; i < len; i++) { - if (write_byte_program_jedec_common(flash, src, dst, mask)) + if (write_byte_program_jedec_common(flash, src, dst)) failed = 1; dst++, src++; update_progress(flash, FLASHROM_PROGRESS_WRITE, i + 1, len); @@ -406,11 +406,10 @@ const chipaddr bios = flash->virtual_memory; chipaddr dst = bios + start; chipaddr d = dst; - const unsigned int mask = getaddrmask(flash->chip);
for (; tries < MAX_REFLASH_TRIES; tries++) { /* Issue JEDEC Start Program command */ - start_program_jedec_common(flash, mask); + start_program_jedec_common(flash);
/* transfer data from source to destination */ for (unsigned int i = 0; i < page_size; i++) {