From c0a823c737d984cd212b2018a71b37fbf9146111 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 11 Aug 2016 14:51:38 -0500 Subject: drivers/spi: ensure SPI flash is boot device for coreboot tables The spi_flash_probe() routine was setting a global varible unconditonally regardless if the probe was for the boot device or even if the boot devcie was flash. Moreover, there's no need to report the SPI information if the boot device isn't even SPI. Lastly, it's possible that the boot device is a SPI flash, but the platform may never probe (selecting SPI_FLASH) for the actual device connected. In that situation don't fill anything in as no correct information is known. BUG=chrome-os-partner:56151 Change-Id: Ib0eba601df4d77bede313c358c92b0536355bbd0 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/16197 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/lib/coreboot_table.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 44ae733e9d..f8da6580cb 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -419,6 +419,14 @@ static void lb_record_version_timestamp(struct lb_header *header) void __attribute__((weak)) lb_board(struct lb_header *header) { /* NOOP */ } +/* + * It's possible that the system is using a SPI flash as the boot device, + * however it is not probing for devices to fill in specifics. In that + * case don't provide any information as the correct information is + * not known. + */ +void __attribute__((weak)) lb_spi_flash(struct lb_header *header) { /* NOOP */ } + static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header *next_header) { struct lb_record *rec; @@ -532,10 +540,9 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end) /* Add RAM config if available */ lb_ram_code(head); -#if IS_ENABLED(CONFIG_SPI_FLASH) /* Add SPI flash description if available */ - lb_spi_flash(head); -#endif + if (IS_ENABLED(CONFIG_BOOT_DEVICE_SPI_FLASH)) + lb_spi_flash(head); add_cbmem_pointers(head); -- cgit v1.2.3