Julius Werner has posted comments on this change. ( https://review.coreboot.org/19849 )
Change subject: console/flashsconsole: Adding a spi flash console for debugging ......................................................................
Patch Set 2:
(9 comments)
https://review.coreboot.org/#/c/19849/2/src/console/Kconfig File src/console/Kconfig:
PS2, Line 242: region It's called "file" in CBFS (and I think "section" is more common for FMAP).
Line 258: region in the CBFS. Why define two mechanisms? The FMAP seems like a more appropriate place to put this, and all boards use FMAPs these days, so why not just standardize on that? (You can still have a Kconfig for the size to be used in the default FMAP.)
Line 260: if CONSOLE_SPI_FLASH Just use depends on instead of this block.
https://review.coreboot.org/#/c/19849/2/src/drivers/spi/flashconsole.c File src/drivers/spi/flashconsole.c:
Line 41: if (cbfs_boot_locate(&file, "console", NULL) == 0) { nit: probably looks better with
if (thing_that_can_have_errors()) { printk(...error...); return; }
It might also help you not go over the 80 char limit, which you do a lot in this function (or is that my Gerrit being weird?).
Line 55: boot_device_init(); Already part of prepare_program_locate
Line 60: * the end of a previous log write. You're banking on the fact that console output can never have legitimate 0xFFs. I think it would be safer to read back from the end of the buffer and find the first byte that's not 0xFF.
Line 121: for (i = 0; i < LINE_BUFFER_SIZE - 1; i++) { Why not just store the current index in a global as well, rather than searching for it all the time?
Line 129: if (len >= LINE_BUFFER_SIZE - 1 || Why not tie this to tx_flush instead?
https://review.coreboot.org/#/c/19849/2/src/include/console/flash.h File src/include/console/flash.h:
Line 25: #define __CONSOLE_FLASH_ENABLE__ IS_ENABLED(CONFIG_CONSOLE_SPI_FLASH) Why are you redefining this? Makes it harder to see that it's governed by a Kconfig.