Edward O'Callaghan submitted this change.

View Change



1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved
jedec.c: Fold up mask param into func

Change-Id: Iee4b1d5bc850cbeec0de9a1603fe04a3a1855330
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/72631
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M jedec.c
1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/jedec.c b/jedec.c
index 7f72e53..1ba7b63 100644
--- a/jedec.c
+++ b/jedec.c
@@ -110,10 +110,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));
@@ -345,7 +346,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;

@@ -357,7 +358,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);
@@ -378,11 +379,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);
@@ -401,11 +401,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++) {

To view, visit change 72631. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iee4b1d5bc850cbeec0de9a1603fe04a3a1855330
Gerrit-Change-Number: 72631
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged