diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index 5b19ca8422..b43a558b49 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -306,7 +306,15 @@ struct cb_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 CB_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/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index 2eb0da32dd..2db306eba9 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -135,7 +135,14 @@ struct sysinfo_t { struct { uint32_t 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; + uint8_t flags; + uint16_t reserved; uint32_t mmap_window_count; struct flash_mmap_window mmap_table[SYSINFO_MAX_MMAP_WINDOWS]; } spi_flash; diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 7a9f997054..2788f870be 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -177,6 +177,7 @@ static void cb_parse_spi_flash(void *ptr, struct sysinfo_t *info) info->spi_flash.size = flash->flash_size; info->spi_flash.sector_size = flash->sector_size; info->spi_flash.erase_cmd = flash->erase_cmd; + info->spi_flash.flags = flash->flags; if (flash->mmap_count == 0) return;