diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index 7860a413ce..fefafb87e1 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -359,7 +359,15 @@ struct lb_spi_flash { uint32_t size; uint32_t flash_size; uint32_t sector_size; - uint32_t erase_cmd; + /* + * Note: `erase_cmd` was previously a uint32_t. It's now uint8_t because only + * the lowest byte was used, ensuring backward compatibility with older coreboot + * tables and allowing reuse of the remaining bytes. + */ + uint8_t erase_cmd; +#define LB_SPI_FLASH_FLAG_IN_4BYTE_ADDR_MODE (1 << 0) + uint8_t flags; + uint16_t reserved; /* * Number of mmap windows used by the platform to decode addresses between SPI flash * space and host address space. This determines the number of entries in mmap_table. diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index 88ed2abda2..dda089e917 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -768,6 +768,10 @@ void lb_spi_flash(struct lb_header *header) flash->mmap_count = spi_flash_get_mmap_windows(table); flash->size += flash->mmap_count * sizeof(*table); } + + /* Pass 4-byte address mode information to payload */ + if (CONFIG(SPI_FLASH_FORCE_4_BYTE_ADDR_MODE)) + flash->flags = LB_SPI_FLASH_FLAG_IN_4BYTE_ADDR_MODE; } int spi_flash_ctrlr_protect_region(const struct spi_flash *flash,