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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89185
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2025-09-15 20:48:52 +00:00
commit bf83dd9927

View file

@ -9,6 +9,7 @@
#include <console/console.h>
#include <fmap.h>
#include <mrc_cache.h>
#include <option.h>
#include <reset.h>
#include <security/vboot/misc.h>
#include <soc/mmu.h>
@ -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;