Attention is currently required from: Angel Pons, Arthur Heymans, Elyes Haouas, Felix Held, Nico Huber.
Julius Werner has posted comments on this change by Arthur Heymans. ( https://review.coreboot.org/c/coreboot/+/84059?usp=email )
Change subject: drivers/spi: Stop using a variable-length array, 2nd try ......................................................................
Patch Set 6:
(2 comments)
File src/drivers/spi/spi_flash.c:
https://review.coreboot.org/c/coreboot/+/84059/comment/141b6caf_29192240?usp... : PS1, Line 317: chunk_len = MIN(MAX_FLASH_CMD_DATA_SIZE, chunk_len);
Why is this line still necessary when we've already checked that no page_size can be larger than 2 […]
Sorry, not quite sure I understand the problem. What I'm suggesting is a macro like ``` #define DECLARE_SPI_FLASH_VENDOR_INFO(_name, _initializers) \ const struct spi_flash_vendor_info _name = { _initializers }; \ _Static_assert(1 << _name.page_size_shift <= MAX_FLASH_CMD_DATA_SIZE, \ "SPI flash vendor " #_name " uses a flash size that is too large, increase MAX_FLASH_CMD_DATA_SIZE!"); ``` which would be used like this ``` DECLARE_SPI_FLASH_VENDOR_INFO(spi_flash_winbond_vi, .id = VENDOR_ID_WINBOND, .page_size_shift = 8, ... ) ``` I think(?) that should work, and we just need to enforce through review that everyone defining such a struct actually uses it.
File src/drivers/spi/spi_flash.c:
https://review.coreboot.org/c/coreboot/+/84059/comment/8f66d14f_2743af6b?usp... : PS6, Line 141: #endif This should probably go in stddef.h or some other catchall header (like wherever we used to keep MAYBE_STATIC)?