Attention is currently required from: Aarya, Alexander Goncharov, Nikolai Artemiev, Peter Marheine.

Anastasia Klimchuk uploaded patch set #16 to the change originally created by Peter Marheine.

View Change

The following approvals got outdated and were removed: Verified+1 by build bot (Jenkins)

erasure_layout: Fix get_flash_region bug

When flash regions are protected, erase could incorrectly erase regions
which were meant to be protected by requesting the correct size but
using an erase opcode with coarser granularity than desired (for
instance using a 16-byte erase command while attempting to erase only 8
bytes).

This fixes that by exchanging the nesting of the loops over erase blocks
and flash regions.

Old:
- Select erasefns
- Loop over blocks to erase for each selected erasefn
- Loop over programmer flash regions within erase block
- Erase regions (may fail since selected erasefn will be
too big if flash region is smaller than erase block)

New:
- Loop over programmer flash regions within erase block
- Select erasefns within programer flash region
- Loop over blocks to erase for each selected erasefn
- Erase regions

Eraser selection and erasing has also been factored out into a helper
function to manage nesting depth.

TEST=New test cases pass, whereas some of them fail without the changes
to erasure_layout.c
BUG=https://ticket.coreboot.org/issues/525

Change-Id: Ic5bf9d0f0e4a94c48d6f6e74e3cb9cccdc7adec9
Co-authored-by: Nikolai Artemiev <nartemiev@google.com>
Co-authored-by: Anastasia Klimchuk <aklm@flashrom.org>
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
---
M erasure_layout.c
M tests/erase_func_algo.c
M tests/tests.c
M tests/tests.h
4 files changed, 602 insertions(+), 96 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/93/82393/16

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

Gerrit-MessageType: newpatchset
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ic5bf9d0f0e4a94c48d6f6e74e3cb9cccdc7adec9
Gerrit-Change-Number: 82393
Gerrit-PatchSet: 16
Gerrit-Owner: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: Aarya <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Alexander Goncharov <chat@joursoir.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Aarya <aarya.chaumal@gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Attention: Peter Marheine <pmarheine@chromium.org>
Gerrit-Attention: Alexander Goncharov <chat@joursoir.net>