console: Plumb in the pager

Send all console output via the pager. If it is disabled, it will do
nothing.

The pager is only supported if CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are
enabled. This is the common case for more richly featured boards, i.e.
those that can cope with the extra code size of this feature.

Series-changes: 2
- Drop an unnecessary direct call to the pager
- Repeat the old code in console_puts_pager() to avoid 16-byte growth

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-21 18:30:52 -06:00
parent 149fe34151
commit d3d493c8a3
3 changed files with 76 additions and 6 deletions

View File

@@ -24,6 +24,7 @@
#include <event_internal.h>
#include <fdtdec.h>
#include <membuf.h>
#include <pager.h>
#include <linux/list.h>
#include <linux/build_bug.h>
#include <asm-offsets.h>
@@ -477,6 +478,14 @@ struct global_data {
*/
struct upl *upl;
#endif
#if CONFIG_IS_ENABLED(CONSOLE_PAGER)
/**
* @pager: Pointer to the pager settings, or NULL if none
*
* This is set up in console_init_r()
*/
struct pager *pager;
#endif
};
#ifndef DO_DEPS_ONLY
static_assert(sizeof(struct global_data) == GD_SIZE);
@@ -618,6 +627,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_passage_dtb() 0
#endif
#if CONFIG_IS_ENABLED(CONSOLE_PAGER)
#define gd_pager() gd->pager
#define gd_pagerp() &gd->pager
#else
#define gd_pager() NULL
#define gd_pagerp() NULL
#endif
/**
* enum gd_flags - global data flags
*