Attention is currently required from: Furquan Shaikh, Hung-Te Lin, Julius Werner.

Hung-Te Lin uploaded patch set #13 to this change.

View Change

util: cbfstool: Add '%<alignment>' in flashmap descriptor

Most FMAP sections that need to be updated independently should be
aligned to the erase block size. Otherwise a power failure during update
may corrupt other sections (because we have to erase across multiple
sections before writing).

Flashmap descriptor (FMD) allows implicit offset and size, so sometimes
the sections may not be properly aligned. To prevent that, we want to
add an alignment argument to the descriptor.

Because most sections (especially in chromeos.fmd) do need alignment,
the patch is assuming "aligned to 4k blocks" as default. 4k is chosen
because that's what most flash chipsets support. For individual non-4k
SPI flash chipsets they may need more runtime checks and that is not
covered by this patch.

For sections that don't need to be aligned (or aligned to different
values), use the '%<num>' after section name (or offset) explicitly to
change the alignment. For example '%0' means unaligned and '%512' aligns
to 512 bytes. For example:

FMAP@0x1000 %0 0x800

Declared an FMAP section to be in offset 0x1000, size 0x800, and no need
to be aligned.

COREBOOT(CBFS)%0

Declared a CBFS section to be not aligned, using auto offset/size.

Most boards already have CBFS and FMAP being unaligned, so the patch
only warns when seeing unaligned sections. Follow up patches will fix
FMD files, and eventually change warnings to errors.

TEST=make -j # pass

Change-Id: I26b394590c28667a4afcd521c7caa2009b5b98a9
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
---
M Documentation/lib/flashmap.md
M util/cbfstool/default-x86.fmd
M util/cbfstool/default.fmd
M util/cbfstool/fmap_from_fmd.c
M util/cbfstool/fmd.h
M util/cbfstool/fmd_parser.c_shipped
M util/cbfstool/fmd_parser.h_shipped
M util/cbfstool/fmd_parser.y
M util/cbfstool/fmd_scanner.c_shipped
M util/cbfstool/fmd_scanner.h_shipped
M util/cbfstool/fmd_scanner.l
11 files changed, 616 insertions(+), 407 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/37262/13

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I26b394590c28667a4afcd521c7caa2009b5b98a9
Gerrit-Change-Number: 37262
Gerrit-PatchSet: 13
Gerrit-Owner: Hung-Te Lin <hungte@chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Furquan Shaikh <furquan.m.shaikh@gmail.com>
Gerrit-Reviewer: Hung-Te Lin <hungte@chromium.org>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Yu-Ping Wu <yupingso@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Aaron Durbin <adurbin@chromium.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-CC: Wim Vervoorn <wvervoorn@eltan.com>
Gerrit-Attention: Hung-Te Lin <hungte@chromium.org>
Gerrit-Attention: Furquan Shaikh <furquan.m.shaikh@gmail.com>
Gerrit-Attention: Julius Werner <jwerner@chromium.org>
Gerrit-MessageType: newpatchset