From bf83dd99270dbaa4f0ed9c7134cef5b44b0f7013 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 15 Sep 2025 20:48:52 +0000 Subject: [PATCH] soc/qualcomm/common/qclib: Introduce runtime debug log level control Introduce a new static function, `qclib_debug_log_level`, that checks a runtime-configurable option, "qclib_debug_level", to control whether QCLib enables serial logging. This allows for dynamic control of QCLib's verbose output via a coreboot option instead of relying solely on the static `CONFIG(CONSOLE_SERIAL)` Kconfig option. This is necessary because while the serial console might be enabled for general coreboot logging, the user may want to suppress the often extensive and low-level output from QCLib to keep the console clean during normal operations. The check for enabling QCLib's serial output is updated from `if (CONFIG(CONSOLE_SERIAL))` to `if (CONFIG(CONSOLE_SERIAL) && qclib_debug_log_level())` The option value is read using `get_uint_option("qclib_debug_level", 1)`, meaning the default behavior is to enable QCLib logging if `CONSOLE_SERIAL` is set, maintaining backward compatibility unless the option is explicitly set to 0 at runtime. BUG=b:445211186 TEST=Build and boot a Qualcomm platform with CONFIG_CONSOLE_SERIAL enabled. Confirmed QCLib logs are present by default. Set option "qclib_debug_level" to 0 via CBFS option and confirmed QCLib logs are suppressed while coreboot serial output remains active. Change-Id: I2c7326fae889508f09e1eb5e3863456cf54f5c29 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/89185 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- src/soc/qualcomm/common/qclib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c index cb694e356d..1daa14b328 100644 --- a/src/soc/qualcomm/common/qclib.c +++ b/src/soc/qualcomm/common/qclib.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -182,6 +183,11 @@ static void dump_te_table(void) __weak int qclib_soc_override(struct qclib_cb_if_table *table) { return 0; } +static bool qclib_debug_log_level(void) +{ + return get_uint_option("qclib_debug_level", 1); +} + struct prog qclib; /* This will be re-used by qclib_rerun() */ static void qclib_prepare_and_run(void) @@ -195,8 +201,8 @@ static void qclib_prepare_and_run(void) _qclib_serial_log, REGION_SIZE(qclib_serial_log), 0); - /* Enable QCLib serial output, based on Kconfig */ - if (CONFIG(CONSOLE_SERIAL)) + /* Enable QCLib serial output, if below condition is met */ + if (CONFIG(CONSOLE_SERIAL) && qclib_debug_log_level()) qclib_cb_if_table.global_attributes = QCLIB_GA_ENABLE_UART_LOGGING;