diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2021-08-21 00:07:25 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-08-27 02:32:11 +0000 |
commit | 8d268e9bda1f3b9fe787c9d8592c68958c6ff480 (patch) | |
tree | 3776c0e0ef4c0a02795b3112402663796d2574d6 /src/lib/gcov-io.c | |
parent | 2e0b5c40073a38080e7ee5ebc7e67cbf5d1f475a (diff) |
soc/amd/common/fsp/fsp_validate: add runtime check for FSP-M binary size
When modules are added to the FSP and they won't fit into the FSP binary
any more, the size can be increased in the FSP build. Especially in the
case of debug builds the increased size might not fit into the memory
region it gets decompressed into which starts at FSP_M_ADDR and has a
size of FSP_M_SIZE. SoCs can implement the soc_validate_fspm_header
function that ends up being called by the FSP driver in romstage to do
some additional checks on the FSP binary's header that includes the
version number and the image size. We can use the image size field to
check if it fits into the reserved region. Since the FSP-M memory region
is located after romstage loading it won't clobber the romstage code
where we do the check.
This runtime check is added in addition to the build-time check to also
cover the case when the FSP binaries in CBFS get replaced with ones that
don't fit into the reserved memory region after the coreboot build.
BUG=b:186149011
TEST=Mandolin still boots fine with the patch applied. When as a test
the FSP_M_SIZE Kconfig option in soc/amd/picasso is decreased to 0x10000
which is by far not enough for the decompressed FSP-M binary to fit into
it prints the newly added error message on the console and then stops.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I9b74a2d03993ba50b166eb6e87d4e57b93afc069
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57068
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/lib/gcov-io.c')
0 files changed, 0 insertions, 0 deletions