Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32327 )
Change subject: payload/seabios: Fix CBFS location on APL platform ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/32327/3/payloads/external/SeaBIOS/Makefile File payloads/external/SeaBIOS/Makefile:
https://review.coreboot.org/#/c/32327/3/payloads/external/SeaBIOS/Makefile@4... PS3, Line 43: echo "CONFIG_CBFS_LOCATION=0xfffc0000" >> seabios/.config
There is no relationship to the memory address 0xfffc0000. […]
Sorry, I should think before submitting. Disregard the above.
What libpayload does (I think), is always read 0xfffffffc for a master header pointer, but only use that pointer to determine romsize. Then it uses that romsize together with the offset encoded in boot media params to get the actual CBFS offset. This works on big core (e.g. Skylake) devices because the boot CBFS ("COREBOOT" FMAP region) is always at the very end of the flash and its romsize field always counts the whole flash, so this works even if boot media params actually points to a different region (e.g. vboot RW CBFS). I am not sure whether that works on APL though... (the COREBOOT section isn't at the end of the APL flash, but maybe there's some automagic mapping for the bootblock going on?)
However, boot_media_params also includes a romsize field already, so I'm not actually sure why libpayload makes it so complicated. It should already work if you just do
struct cbfs_file *fhdr = (void *)(uintptr_t)((u32)0 - (u32)bmp->boot_media_size + (u32)bmp->cbfs_offset);