Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42831 )
Change subject: soc/amd/picasso: Use cbfs to locate the AMD firmware ......................................................................
Patch Set 6: Code-Review+2
(2 comments)
https://review.coreboot.org/c/coreboot/+/42831/6/src/soc/amd/picasso/psp_ver... File src/soc/amd/picasso/psp_verstage/psp_verstage.c:
https://review.coreboot.org/c/coreboot/+/42831/6/src/soc/amd/picasso/psp_ver... PS6, Line 94: psp_dir_addr = ef_table->psp_table; I think a comment here would go a long way for indicating the point of the math below.
https://review.coreboot.org/c/coreboot/+/42831/6/src/soc/amd/picasso/psp_ver... PS6, Line 98: bios_dir_in_spi = (uint32_t *)((bios_dir_addr & SPI_ADDR_MASK) + Not for this patch, but we really should have used the offsets calculated w/ SPI_ADDR_MASK.
static void *x86_spi_addrspace_to_psp(uintptr_t base, size_t size) { const struct region_device *bootdev = boot_device_ro();
return rdev_mmap(bootdev, base & SPI_ADDR_MASK, size); }
That would perform all the necessary math for the magic field sanity check.
That or just rdev_readat():
static bool x86_spi_addrspace_magic_check(uintptr_t base, uint32_t match) { const struct region_device *bootdev = boot_device_ro(); uint32_t value.
if (rdev_readat(bootdev, &value, base & SPI_ADDR_MASK, sizeof(match)) != sizeof(match) { // fail return false; } return value == match; }