Only available if threads are disabled. Only displays after the console has been loaded and from within 32bit flat regions of code.
Signed-off-by: Karl Semich 0xloem@gmail.com --- src/Kconfig | 9 +++++++++ src/bootsplash.c | 9 +++++++++ src/output.c | 32 +++++++++++++++++++++++++------- src/util.h | 1 + 4 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/src/Kconfig b/src/Kconfig index 3a8ffa1..5d2c7ab 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -571,6 +571,15 @@ menu "Debugging" provide the 32 bit address. E.g. 0xFEDC6000 for the AMD Kern (a.k.a Hudson UART).
+ config DEBUG_VGA_CONSOLE + depends on DEBUG_LEVEL != 0 && !THREADS + bool "VGA console debugging" + default y + help + Send debugging information to vga console. This is only displayed + after the VGA console has loaded, and only in 32 bit flat regions + of code. Requires that threads are disabled. + config DEBUG_IO depends on QEMU_HARDWARE && DEBUG_LEVEL != 0 bool "Special IO port debugging" diff --git a/src/bootsplash.c b/src/bootsplash.c index 538b316..2a93c8a 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -36,6 +36,8 @@ call16_int10(struct bregs *br) * VGA text / graphics console ****************************************************************/
+static int VgaConsoleActive = 0; + void enable_vga_console(void) { @@ -47,11 +49,18 @@ enable_vga_console(void) br.ax = 0x0003; call16_int10(&br);
+ VgaConsoleActive = 1; + // Write to screen. printf("SeaBIOS (version %s)\n", VERSION); display_uuid(); }
+int vga_console_active(void) +{ + return VgaConsoleActive; +} + static int find_videomode(struct vbe_info *vesa_info, struct vbe_mode_info *mode_info , int width, int height, int bpp_req) diff --git a/src/output.c b/src/output.c index 0184444..27935bc 100644 --- a/src/output.c +++ b/src/output.c @@ -17,12 +17,15 @@ #include "output.h" // dprintf #include "stacks.h" // call16_int #include "string.h" // memset -#include "util.h" // ScreenAndDebug +#include "util.h" // ScreenAndDebug vga_console_active
struct putcinfo { void (*func)(struct putcinfo *info, char c); };
+static void __debug_putc(char c); +static void __screen_putc(char c); +
/**************************************************************** * Debug output @@ -35,9 +38,8 @@ debug_banner(void) dprintf(1, "BUILD: %s\n", BUILDINFO); }
-// Write a character to debug port(s). static void -debug_putc(struct putcinfo *action, char c) +__debug_putc(char c) { if (! CONFIG_DEBUG_LEVEL) return; @@ -47,6 +49,16 @@ debug_putc(struct putcinfo *action, char c) serial_debug_putc(c); }
+// Write a character to debug port(s). +static void +debug_putc(struct putcinfo *action, char c) +{ + __debug_putc(c); + if (CONFIG_DEBUG_LEVEL && CONFIG_DEBUG_VGA_CONSOLE && !MODESEGMENT + && vga_console_active()) + __screen_putc(c); +} + // Flush any pending output to debug port(s). static void debug_flush(void) @@ -86,17 +98,23 @@ screenc(char c) call16_int(0x10, &br); }
-// Handle a character from a printf request. static void -screen_putc(struct putcinfo *action, char c) +__screen_putc(char c) { - if (ScreenAndDebug) - debug_putc(&debuginfo, c); if (c == '\n') screenc('\r'); screenc(c); }
+// Handle a character from a printf request. +static void +screen_putc(struct putcinfo *action, char c) +{ + if (ScreenAndDebug) + __debug_putc(c); + __screen_putc(c); +} + static struct putcinfo screeninfo = { screen_putc };
diff --git a/src/util.h b/src/util.h index aff8e88..8219e0c 100644 --- a/src/util.h +++ b/src/util.h @@ -50,6 +50,7 @@ int boot_lchs_find_ata_device(struct pci_device *pci, int chanid, int slave,
// bootsplash.c void enable_vga_console(void); +int vga_console_active(void); void enable_bootsplash(void); void disable_bootsplash(void);