blobutil/inject: use x86 top-aligned mrc offset

the old code was specifing an absolute offset for
insertion of mrc.bin - cbfstool interprets anything
above 0x80000000 as top-aligned memory address in
x86, and anything below as an obsolute offset in
the flash, like with the old number

where a top-aligned address is provided to cbfstool,
the absolute position is calculated for the flash,
and cbfstool inserts it in the correct rom location

the benefit of this change is that the absolute
offset is now calculated automatically, which means
that the code will be correct even if the flash
size changes. for example, if 16MB flash is used
whereas 12MB is currently the default an support
haswell hardware

coreboot does not provide anything readably like
Kconfig, for extracting this value. it's baked
into the source code of coreboot, so you have to
find it. the correct location is hardcoded for
each platform, and always the same on each platform,
regardless of mainboard
fsdg20230625
Leah Rowe 2023-05-14 08:16:12 +01:00
parent 1742978858
commit 70e337afd0
1 changed files with 19 additions and 2 deletions

View File

@ -233,9 +233,26 @@ inject_blob_intel_mrc()
printf 'adding mrc\n'
# TODO: use offset defined in coreboot configs (don't hardcode)
# mrc.bin must be inserted at a specific offset. the only
# libreboot platform that needs it, at present, is haswell
# in cbfstool, -b values above 0x80000000 are interpreted as
# top-aligned x86 memory locations. this is converted into an
# absolute offset within the flash, and inserted accordingly
# at that offset into the ROM image file
# coreboot's own build system hardcodes the mrc.bin offset
# because there is only one correct location in memory, but
# it would be useful for lbmk if it could be easily scanned
# from Kconfig, with the option to change it where in practise
# it is not changed
# the hardcoded offset below is based upon reading of the coreboot
# source code, and it is *always* correct for haswell platform.
# TODO: this logic should be tweaked to handle more platforms
${cbfstool} ${rom} add -f mrc/haswell/mrc.bin -n mrc.bin -t mrc \
-b 0x78fe00 || exit 1
-b 0xfffa0000 || exit 1
}
inject_blob_intel_me()