From 950332b6e4c736bf948d2ebe8721bde568f5dfc0 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Sun, 11 Feb 2018 19:41:05 +0100 Subject: driver/spi: Warn when probed SF size differs from CONFIG_ROM_SIZE Some assumptions are made with respect to CONFIG_ROM_SIZE being the actual size of the boot medium, e.g. when automatically creating an fmap with and RW_MRC_CACHE region. With this patch the user is warned when this is detected. Change-Id: Ib5d6cc61ea29214d338d4c52ff799d6620a9cac7 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/23695 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/spi/spi_flash.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index 93335de24a..f0f119addb 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -374,6 +374,12 @@ int spi_flash_probe(unsigned int bus, unsigned int cs, struct spi_flash *flash) printk(BIOS_INFO, "SF: Detected %s with sector size 0x%x, total 0x%x\n", flash->name, flash->sector_size, flash->size); + if (bus == CONFIG_BOOT_DEVICE_SPI_FLASH_BUS + && flash->size != CONFIG_ROM_SIZE) { + printk(BIOS_ERR, "SF size 0x%x does not correspond to" + " CONFIG_ROM_SIZE 0x%x!!\n", flash->size, + CONFIG_ROM_SIZE); + } return 0; } -- cgit v1.2.3