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

View Change

util: cbfstool: Add new flag 'ALIGNED' for checking alignment at build time

Some FMAP sections (for example MRC_VAR_CACHE, RW_DDR_TRAINING, ...) are
accessed directly by raw block I/O and must be aligned at SPI flash
erase block size (see spi_flash.c#spi_flash_erase_cmd, error "SF: Erase
offset/length not multiple of erase size").

If we don't add explicit offset to these sections in FMD files, changing
size of other sections may unexpectedly cause them to be unaligned.

This patch adds a new flag "ALIGNED" so we can declare an FMAP section
as:

RW_DDR_TRAINING(ALIGNED) 8k

to ensure the offset and size (8k) of section RW_DDR_TRAINING will be both
aligned to 4k.

Note: in current implementation the alignment is fixed at 4k, which is
supported on almost all SPI chipsets today.

With the new ALIGNED flag, many sections may need to have multiple flags
so we also now support having flags separated by space or comma ',' to
increase readability, e.g.:

RW_DDR_TRAINING(PRESERVE, ALIGNED) 8k

TEST=Change bootblock from default.fmd to BOOTBLOCK(ALIGNED) 127k and build,
seeing error message:
"E: Section 'BOOTBLOCK'@0[0x1fc00] must be aligned to 0x1000"

Change-Id: I26b394590c28667a4afcd521c7caa2009b5b98a9
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
---
M Documentation/lib/flashmap.md
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
9 files changed, 639 insertions(+), 427 deletions(-)

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

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: 5
Gerrit-Owner: Hung-Te Lin <hungte@chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
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: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: newpatchset