summaryrefslogtreecommitdiffstats
path: root/src/console
Commit message (Collapse)AuthorAgeFilesLines
* Allow to build romstage sources inside the bootblockArthur Heymans2023-11-092-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Having a separate romstage is only desirable: - with advanced setups like vboot or normal/fallback - boot medium is slow at startup (some ARM SOCs) - bootblock is limited in size (Intel APL 32K) When this is not the case there is no need for the extra complexity that romstage brings. Including the romstage sources inside the bootblock substantially reduces the total code footprint. Often the resulting code is 10-20k smaller. This is controlled via a Kconfig option. TESTED: works on qemu x86, arm and aarch64 with and without VBOOT. Change-Id: Id68390edc1ba228b121cca89b80c64a92553e284 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55068 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* console.c: Enable gdb support in bootblockArthur Heymans2023-11-071-1/+1
| | | | | | | | | | | | | This code was written in a romcc bootblock time. There is no reason why it would not work in bootblock now. Untested but expected to work. Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Change-Id: I34812fbcd1222eceeb9870b9cbb7431ead63ce6a Reviewed-on: https://review.coreboot.org/c/coreboot/+/78936 Reviewed-by: Martin L Roth <gaumless@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* commonlib,console,nb,sb,security: Add SPDX licenses to MakefilesMartin Roth2023-08-141-0/+2
| | | | | | | | | | | | | | | | | | | | | To help identify the licenses of the various files contained in the coreboot source, we've added SPDX headers to the top of all of the .c and .h files. This extends that practice to Makefiles. Any file in the coreboot project without a specific license is bound to the license of the overall coreboot project, GPL Version 2. This patch adds the GPL V2 license identifier to the top of all makefiles in the commonlib, console, northbridge, security, and southbridge directories that don't already have an SPDX license line at the top. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I02804a10d0b0355e41271a035613d9f3dfb122f8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68985 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
* console: Deselect using ANSI escape characters when SimNow is usedZheng Bao2023-03-301-1/+1
| | | | | | | | | | | To remove the annoying "ESC [1m" at SimNow console window. Change-Id: I300aee946f342f41b94288b75b843956de9d3e88 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74072 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* console: Add SimNow console loggingFred Reitberger2023-02-092-0/+11
| | | | | | | | | | | | | | The AMD SimNow tool supports fast logging through an IO port. Add a new console to support SimNow logging through port 80. TEST=observe significant speed improvements on SimNow console log Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com> Change-Id: I42a431f48ea14ba4adacbd4a32e15abe7c5e4951 Reviewed-on: https://review.coreboot.org/c/coreboot/+/72751 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* console: Print architecturePatrick Rudolph2023-01-311-1/+1
| | | | | | | | | | Useful to see which architecture x86_32 or x86_64 coreboot was built for. Change-Id: I34eec64ac32254c270dcbb97e20a7e6be0f478fc Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/59761 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* lib: Hook up libhwbase in romstageJeremy Compostella2022-12-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's hidden behind the configuration option `CONFIG_ROMSTAGE_LIBHWBASE'. This also adds some glue code to use the coreboot console for debug output and our monotonic timer framework as timer backend. Running Ada code in romstage and more particular libhwbase brings a few challenges as global initialized variables are not supported in Cache-As-Ram mode. 1. The libhwbase dynamic mmio driver implementation makes the Gnat compiler generate some global initialized variables. For this reason, when compiled for romstage or for romstage and ramstage the static mmio driver is enforced (`HWBASE_STATIC_MMIO'). 2. The Gnat compiler generates elaboration functions to initialize program data at runtime. These elaboration functions are called by the romstage_adainit() function. The data references symbols suffixed by `_E'. Even though these symbols, at compilation time, do not contain any data and are filled with zeros, the Gnat compiler installs them in the .data section. Since these symbols are actually filled with zeros, it is safe to install them in the .bss section. cf. https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/elaboration_order_handling_in_gnat.html#elaboration-code This patch requires the libhwbase https://review.coreboot.org/c/libhwbase/+/69854 CL. BUG=b:252792591 BRANCH=firmware-brya-14505.B TEST=libhwbae compiles for romstage and loads successfully Change-Id: I670249d33506e886a683e55d1589cb2bf9b16aa3 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70275 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-by: Tarun Tuli <taruntuli@google.com> Reviewed-by: Zhixing Ma <zhixing.ma@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* console/post.c: Sort includesElyes Haouas2022-10-271-1/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I3faa1baf41ff8f0447d18b131a9c9c225e9fc8a4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68202 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
* console: Add an SoC-specific post-code callMartin Roth2022-10-251-0/+3
| | | | | | | | | | | Add a post-code call that SoCs can hook to output or save in any way that is specific to that SoC. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I0369e4362840d7506d301105d8e1e2fd865919f4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68545 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* console/vtxprintf.c: Add <stdarg.h>Elyes Haouas2022-10-061-0/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I221a2bdb19cc7d17265c69d3fe3e1dfb490e7186 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68039 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
* console/printk.c: Add <types.h>Elyes Haouas2022-10-061-0/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I55412395071f0fccb839c40fefda998befaddebb Reviewed-on: https://review.coreboot.org/c/coreboot/+/68037 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
* console/die.c: Add <stdarg.h>Elyes Haouas2022-10-061-0/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I2ee8ef017d8a3409cbf47f1ed252a512dead224e Reviewed-on: https://review.coreboot.org/c/coreboot/+/68036 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
* console/console.c: Sort includes and add <types.h>Elyes Haouas2022-10-061-4/+5
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I1d2d85ff8cfca58295117b5cb625cadfc9008311 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68035 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
* console/vsprintf.c: Add <stdarg.h>Elyes Haouas2022-10-061-0/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I8c61f2a033f9630d3fa3eb5e364e6f38de5c7064 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68038 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
* drivers/smbus: initialize SC16IS7XX I2C to UART converter chipHusni Faiz2022-10-031-0/+15
| | | | | | | | | | | | | This patch adds the functionality to initialize the sc16is750 i2c to uart converter chip with a 14.7MHz input clock to support 115200 baud rate. Change-Id: Ib31188b8c0f9b0ce9454da984e630eca9101d145 Signed-off-by: Husni Faiz <ahamedhusni73@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67342 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: attach smbus console driverHusni Faiz2022-09-161-0/+4
| | | | | | | | | | | This patch attaches the smbus console functions to the high level console interface. Change-Id: I3a9bf64e59d529253bfdcdfa565bb2bb92975728 Signed-off-by: Husni Faiz <ahamedhusni73@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67341 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* drivers/smbus: add smbus console driverHusni Faiz2022-09-161-0/+24
| | | | | | | | | | | This patch adds a new smbus console driver and Kconfig options to enable the driver. Change-Id: Ife77fb2c3e1cc77678a4972701317d50624ceb95 Signed-off-by: Husni Faiz <ahamedhusni73@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67339 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* console/vtxprintf.c: Use | operator for bit operation instead of +Elyes Haouas2022-09-141-1/+1
| | | | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I478265dcd070dcf3fb2cf2c535b6ca1d86b9a3f2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67564 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
* src/console: Reformat codeElyes Haouas2022-09-132-26/+23
| | | | | | | | | | | Most of these changes are suggested by clang-format(13.0-54) tool on Debian testing. Change-Id: I68a288b3f7e911331e7324bf13cf9bde259a29de Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64781 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* console: Make CONSOLE_SPI_FLASH depend on BOOT_DEVICE_SPI_FLASHArthur Heymans2022-04-271-0/+1
| | | | | | | | | | Change-Id: Ibfdbca02259a723029260dfea9f36b325414b7d3 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52793 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Christian Walter <christian.walter@9elements.com>
* src/console/Kconfig: Add option to disable loglevel prefixIgor Bagnucki2022-03-302-1/+11
| | | | | | | | | | | | | | | | | | | | | | | This patch adds an option to disable loglevel prefixes. This patch helps to achieve clear messages when low loglevel is used and very few messages are displayed on a terminal. This option also allows to maintain compatibility with log readers and continuous integration systems that depend on fixed log content. If the code contains: printk(BIOS_DEBUG, "This is a debug message!\n") it will show as: [DEBUG] This is a debug message! but if the Kconfig contains: CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX=n the same message will show up as This is a debug message! Signed-off-by: Igor Bagnucki <igor.bagnucki@3mdeb.com> Change-Id: I911bb601cf1933a4c6498b2ae1e4cb4d4bc85621 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63144 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* console: Fix LOG_FAST macroMario Scheithauer2022-02-221-1/+1
| | | | | | | | | | | | | | | | | | | In the LOG_FAST macro, the comparison was incorrectly made with 'level' value. Correct is the comparison with 'speed'. With the wrong comparison you cannot set a lower level for console log, the highest level is always output. TEST: - Boot mc_ehl2 with console log level 5 and check output Change-Id: Ib5b4537ae2cbf01c51c3568d312b5242c4bee7bb Signed-off-by: Mario Scheithauer <mario.scheithauer@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/62261 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Patrick Georgi <patrick@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
* Use the fallthrough statement in switch loopsArthur Heymans2022-02-161-1/+2
| | | | | | | | | | | Clang does not seem to work with 'fall through' in comments. Change-Id: Idcbe373be33ef7247548f856bfaba7ceb7f749b5 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/51498 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* console: Add missing va_end() in wrap_interactive_printf()Julius Werner2022-02-091-0/+1
| | | | | | | | | | | I think this doesn't do anything on most architectures, but it should still be there just in case. Found by Coverity. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I845a784d90f65610fd1e0d751ea13e9af5b970fd Reviewed-on: https://review.coreboot.org/c/coreboot/+/61724 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console/post: Lower post code loglevel to BIOS_INFOJulius Werner2022-02-091-1/+1
| | | | | | | | | | | | | | Post codes don't signify an emergency error, so they shouldn't be classified as BIOS_EMERG. Now that loglevels are more visible, this misclassification looks pretty glaring. This patch changes them to BIOS_INFO which seems more appropriate for an informational code that is expected to occur in the normal boot flow. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I85c8768232ae0cbf65669a7ee6abd538a3b2d5e1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61692 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: Add compile-time fast path when only CBMEM console is usedJulius Werner2022-02-072-4/+8
| | | | | | | | | | | | | | | | | A common use case when running coreboot on production systems is that only the CBMEM console (the one with the least impact on boot speed) is enabled. In this case, some of the code in the console subsystem has no effect. Due to the way it's all genericized over multiple consoles and tied together with function pointers, not all of this can be compile-time eliminated automatically, so this patch adds a little helper to facilitate that. This results in roughly 200 (compressed) bytes of savings per stage on an arm64 system. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I1d5b8bda80d02a13ee0b7835e0805c4319fd21d8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61613 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: Add loglevel marker codes to stored consolesJulius Werner2022-02-071-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to provide the same loglevel prefixes and highlighting that were recently introduced for "interactive" consoles (e.g. UART) to "stored" consoles (e.g. CBMEM) but minimize the amont of extra storage space wasted on this info, this patch will write a 1-byte control character marker indicating the loglevel to the start of every line logged in those consoles. The `cbmem` utility will then interpret those markers and translate them back into loglevel prefixes and escape sequences as needed. Since coreboot and userspace log readers aren't always in sync, occasionally an older reader may come across these markers and not know how to interpret them... but that should usually be fine, as the range chosen contains non-printable ASCII characters that normally have no effect on the terminal. At worst the outdated reader would display one garbled character at the start of every line which isn't that bad. (Older versions of the `cbmem` utility will translate non-printable characters into `?` question marks.) Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I86073f48aaf1e0a58e97676fb80e2475ec418ffc Reviewed-on: https://review.coreboot.org/c/coreboot/+/61308 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: Add ANSI escape sequences for highlightingJulius Werner2022-02-072-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds ANSI escape sequences to highlight a log line based on its loglevel to the output of "interactive" consoles that are meant to be displayed on a terminal (e.g. UART). This should help make errors and warnings stand out better among the usual spew of debug messages. For users whose terminal or use case doesn't support these sequences for some reason (or who simply don't like them), they can be disabled with a Kconfig. While ANSI escape sequences can be used to add color, minicom (the presumably most common terminal emulator for UART endpoints?) doesn't support color output unless explicitly enabled (via -c command line flag), and other terminal emulators may have similar restrictions, so in an effort to make this as widely useful by default as possible I have chosen not to use color codes and implement this highlighting via bolding, underlining and inverting alone (which seem to go through in all cases). If desired, support for separate color highlighting could be added via Kconfig later. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I868f4026918bc0e967c32e14bcf3ac05816415e8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61307 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: Add loglevel prefix to interactive consolesJulius Werner2022-02-072-9/+42
| | | | | | | | | | | | | | | | | | | | | In an attempt to make loglevels more visible (and therefore useful, hopefully), this patch adds a prefix indicating the log level to every line sent to an "interactive" console (such as a UART). If the code contains a `printk(BIOS_DEBUG, "This is a debug message!\n"), it will now show up as [DEBUG] This is a debug message! on the UART output. "Stored" consoles (such as in CBMEM) will get a similar but more space-efficient feature in a later CL. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic83413475400821f8097ef1819a293ee8926bb0b Reviewed-on: https://review.coreboot.org/c/coreboot/+/61306 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* console: Pass log_state to vtxprintf()Julius Werner2022-02-041-13/+19
| | | | | | | | | | | | | | | This patch makes a slight change in the way CONSOLE_LOG_FAST and CONSOLE_LOG_ALL are differentiated, by no longer passing a different tx_byte() function pointer and instead using the `data` argument to vtxprintf() to encode the difference. It also passes the message log level through to the tx_byte() function this way, which will be needed in the next patch. Change-Id: I0bba134cd3e70c2032689abac83ff53d7cdf2d7f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61580 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
* lib/cbmem_console,console: Resurrect CONSOLE_CBMEM_DUMP_TO_UARTRaul E Rangel2022-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chromebooks normally run with non-serial enabled firmware because writing to the UART console is very slow. This unfortunately makes debugging boot errors more difficult. We tend to rely on port 80s and/or the vboot recovery code. When CONSOLE_CBMEM_DUMP_TO_UART is selected it will dump the entire cbmem console to the UART whenever `vboot_reboot()` is called. We don't incur any boot time penalty in the happy path, but still retain the ability to access the logs when an error occurs. The previous implementation was using a hard coded UART index and `get_uart_baudrate` was always returning 0 since `CONFIG_TTYS0_BAUD` wasn't defined. This change makes it so the UART console properties are available when CONSOLE_CBMEM_DUMP_TO_UART is set. This results in the following .config diff: +CONFIG_UART_FOR_CONSOLE=0 +CONFIG_TTYS0_BASE=0x3f8 +CONFIG_TTYS0_LCS=3 +CONFIG_CONSOLE_SERIAL_115200=y +CONFIG_TTYS0_BAUD=115200 This functionality is especially helpful on Guybrush. PSP Verstage is run on S0i3 resume. Today, if there is an error, the cbmem console is lost since it lives in the PSP SRAM. BUG=b:213828947, b:215599230 TEST=Build non-serial guybrush FW and verify no serial output happens in happy path. Inject a vboot error and perform an S0i3 suspend/resume. Verify CBMEM console gets dumped to the correct UART. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I997942204603362e51876a9ae25e493fe527437b Reviewed-on: https://review.coreboot.org/c/coreboot/+/61305 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* console: Add Kconfig to dump pre-bootblock cbmem contentsRaul E Rangel2022-01-172-0/+12
| | | | | | | | | | | | | | | | | | | | | | | Pre-bootblock stages (i.e., VBOOT_STARTS_BEFORE_BOOTBLOCK) might not have the ability to log to the UART, so their console messages are inaccessible until the boot processes gets into the payload or OS. This makes it difficult to debug verstage. This feature will dump the pre-bootblock CBMEM console immediately after the bootblock console is initialized. I chose to do this in console_init instead of bootblock_soc_init because I wanted to have the pre-bootblock contents dumped before the coreboot bootblock starting message is printed. BUG=b:213828947 TEST=Boot guybrush with PSP verstage and verify verstage logs are dumped to the UART. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I363c93ef3ee6c5c303a6a68f88a622e2aa62594c Reviewed-on: https://review.coreboot.org/c/coreboot/+/61012 Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* console: Make get_log_level a public functionSubrata Banik2022-01-031-1/+1
| | | | | | | | | | | | Other drivers may need to know the coreboot log level hence, export this function rather than marking it static. Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: I56349f22c71c9db757b2be8eeb2dbfe959f80397 Reviewed-on: https://review.coreboot.org/c/coreboot/+/60470 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* src/acpi to src/lib: Fix spelling errorsMartin Roth2021-10-051-1/+1
| | | | | | | | | | | | These issues were found and fixed by codespell, a useful tool for finding spelling errors. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I5b8ecdfe75d99028fee820a2034466a8ad1c5e63 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58080 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* console: Remove asmlinkage from console_initRaul E Rangel2021-09-171-1/+1
| | | | | | | | | | | | | | | We never call console_init from asm, so we don't need the asmlinkage. This allows us to remove the arch/cpu.h include since we only needed it for the asmlinkage #define. BUG=b:179699789 TEST=build guybrush Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I9a7895d4f5cba59f6b05915fa4d6c6fd6ab85773 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57568 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* console/hw-debug_sink: Update for fast/slow console distinctionNico Huber2021-08-041-4/+28
| | | | | | | | Change-Id: I9ac110c7b812f912f0f87cbe4aa218d4a78e6aaf Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56665 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Asm code: Use NO_EARLY_BOOTBLOCK_POSTCODES to remove Asm port80sMartin Roth2021-06-251-4/+6
| | | | | | | | | | | | | | | | | Expand NO_EARLY_BOOTBLOCK_POSTCODES to all of the early assembly code in bootblock. BUG=b:191370340 TEST: Build with & without the option enabled Signed-off-by: Martin Roth <martinroth@chromium.org> Change-Id: Idb4a96820d5c391fc17a0f0dcccd519d4881b78c Reviewed-on: https://review.coreboot.org/c/coreboot/+/55731 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
* src/console/init.c: Make get_log_level static inline againJakub Czapiga2021-06-151-2/+1
| | | | | | | | | | | | | CB:55356 removed static inline declarations from get_log_level(). This commit puts them back. It also changes the method of accessing static symbols in tests/console/routing-test to source file inclusion like in CB:46458 to avoid changing tested source file. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Iaa5dcbccb327f819374967be51ef642b1fb25e7b Reviewed-on: https://review.coreboot.org/c/coreboot/+/55473 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/console: Add tests for log message routing behaviorPatrick Georgi2021-06-101-1/+2
| | | | | | | | Change-Id: Id978cfe4fa45fef9edbc3d3b55606ff6973521c5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55356 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
* src: Retype option API to use unsigned integersAngel Pons2021-05-061-1/+1
| | | | | | | | | | | | | The CMOS option system does not support negative integers. Thus, retype and rename the option API functions to reflect this. Change-Id: Id3480e5cfc0ec90674def7ef0919e0b7ac5b19b3 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52672 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* src: Replace remaining {get,set}_option() instancesAngel Pons2021-04-231-1/+1
| | | | | | | | | | | | With this change, the type-unsafe {get,set}_option() API functions are no longer used directly. The old API gets dropped in a follow-up. Change-Id: Id3f3e172c850d50a7d2f348b1c3736969c73837d Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52512 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Rename do_printk() to printk()Nico Huber2021-04-141-3/+3
| | | | | | | | | | | | | The indirection seems unnecessary. The macros throw features like `-Wmisleading-indentation` off, though. Default build for QEMU/Q35 is unchanged. Change-Id: Ie4eab935a367b5ad6b38225c4973d41d9f70ef10 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/51887 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* console/vtxprintf.c: Add missing <types.h>Elyes HAOUAS2021-02-161-1/+1
| | | | | | | | Change-Id: Icc2b99f9125e9059dbf3de42a1b5ca9727888166 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50565 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
* lib/trace: Remove TRACE supportKyösti Mälkki2020-12-022-8/+0
| | | | | | | | | | | | | | | | | | | | | Looks like the option is generally not compatible with garbage collections. Nothing gets inlined, for example is_smp_boot() no longer evaluates to constant false and thus the symbols from secondary.S would need to be present for the build to pass even if we set SMP=n. Also the addresses of relocatable ramstage are currently not normalised on the logs, so util/genprof would be unable dress those. Change-Id: I0b6f310e15e6f4992cd054d288903fea8390e5cf Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45757 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* console: Override uart base addressBryant Ou2020-11-091-0/+10
| | | | | | | | | | | | | Add a new CONFIG_OVERRIDE_UART_FOR_CONSOLE token to override the index of uart port, platform use a get_uart_for_console routine to decide what index value should be used for console. Signed-off-by: Bryant Ou <Bryant.Ou.Q@gmail.com> Change-Id: I2079bd1e5ffa209553383b6aafe3b8724849ba2a Reviewed-on: https://review.coreboot.org/c/coreboot/+/45405 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marc Jones <marc@marcjonesconsulting.com> Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
* console/init: Drop CONSOLE_LEVEL_CONSTNico Huber2020-10-261-20/+5
| | | | | | | | | | | | | | | | | | | | | | We limited the configurability of the debug level to stages that have a `.data` section. This is not really a requirement, because a `.bss` section should suffice and we always have that now. We want to make the debug level configurable early but also want to avoid calling get_option() early, as an error therein could result in no console output at all. Hence, we compromise and start using get_option() from the second console init on. TEST=Booted QEMU once with `debug_level=Debug` and once with `debug_level=Notice`. On the second boot, most messages vanished for all stages but the bootblock. Change-Id: I11484fc32dcbba8d31772bd0b82785f17b2fba11 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45765 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Marc Jones <marc@marcjonesconsulting.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* src: Rename EM100Pro-specific SPI console Kconfig optionAngel Pons2020-10-131-3/+3
| | | | | | | | | | | | To avoid confusion with `flashconsole` (CONSOLE_SPI_FLASH), prefix this option with `EM100Pro`. Looks like it is not build-tested, however. Change-Id: I4868fa52250fbbf43e328dfd12e0e48fc58c4234 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45973 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
* src/console: Drop unneeded empty linesElyes HAOUAS2020-09-212-2/+0
| | | | | | | | Change-Id: I94f92ba4385285496ede0c33fc25addd6c4bfeae Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44607 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
* ec/system76: Add console supportJeremy Soller2020-09-072-0/+11
| | | | | | | | | | | | | | | | | | | This adds support for line-buffered console output to System76 EC firmware. Once the print command is received, the EC firmware multiplexes the output to any enabled console on the EC. This can be a memory ringbuffer, a parallel port (using the keyboard connector), or i2c (using the battery connector). Once the entire buffer is sent, it sets the command register to 0, indicating completion. For more information, please see: https://github.com/system76/ec/blob/master/doc/debugging.md Tested on system76/lemp9 with CONSOLE_SYSTEM76_EC enabled. Signed-off-by: Jeremy Soller <jeremy@system76.com> Change-Id: I861bf3e22f40dd6c3ec7ba1d73711b399358e332 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43718 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner
* src: Remove unused 'include <stddef.h>Elyes HAOUAS2020-08-181-1/+0
| | | | | | | | Change-Id: Iae1e875b466f8a195653d897efa1b297c61ad0a5 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41912 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>