From 0c9a239b9e2e95343ae00c5b53acb8572d32bf4d Mon Sep 17 00:00:00 2001 From: ouyangxiangzhen Date: Thu, 13 Feb 2025 14:15:03 +0800 Subject: [PATCH] arch/x86_64: Initialize framebuffer early-print. This commit initialized framebuffer early-print if `CONFIG_MULTBOOT2_FB_TERM` is defined. This enabled `early_kprintf` to output debug information using framebuffer. Signed-off-by: ouyangxiangzhen --- arch/x86_64/src/intel64/intel64_serial.c | 14 ++++++++------ arch/x86_64/src/intel64/intel64_start.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/x86_64/src/intel64/intel64_serial.c b/arch/x86_64/src/intel64/intel64_serial.c index e1fa0a1555..5205308d5d 100644 --- a/arch/x86_64/src/intel64/intel64_serial.c +++ b/arch/x86_64/src/intel64/intel64_serial.c @@ -85,17 +85,19 @@ void uart_putreg(struct u16550_s *priv, unsigned int offset, * ****************************************************************************/ -void up_lowputc(char ch) +void up_putc(int ch) { fb_putc(ch); } - -void up_putc(int ch) -{ - up_lowputc(ch); -} #endif +void up_lowputc(int ch) +{ +#ifdef CONFIG_MULTBOOT2_FB_TERM + fb_putc(ch); +#endif +} + #ifdef USE_EARLYSERIALINIT void x86_64_earlyserialinit(void) { diff --git a/arch/x86_64/src/intel64/intel64_start.c b/arch/x86_64/src/intel64/intel64_start.c index f870b6e855..e9471d47d0 100644 --- a/arch/x86_64/src/intel64/intel64_start.c +++ b/arch/x86_64/src/intel64/intel64_start.c @@ -33,6 +33,8 @@ #include +#include + #include "x86_64_internal.h" #include "intel64_cpu.h" @@ -158,15 +160,21 @@ void __nxstart(void) *dest++ = 0; } + /* Low-level, pre-OS initialization */ + + intel64_lowsetup(); + #ifdef CONFIG_ARCH_MULTIBOOT2 /* Handle multiboot2 info */ x86_64_mb2_config(); #endif - /* Low-level, pre-OS initialization */ +#if defined(CONFIG_MULTBOOT2_FB_TERM) + x86_64_mb2_fbinitialize(g_mb_fb_tag); - intel64_lowsetup(); + lowsyslog("framebuffer initialized\n"); +#endif #ifdef CONFIG_ARCH_X86_64_ACPI /* Initialize ACPI */