From nobody Sat May 4 05:44:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1647047088743254.64029236445424; Fri, 11 Mar 2022 17:04:48 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 17B1C16E3D29; Sat, 12 Mar 2022 01:04:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 6C50716E36D1 for ; Sat, 12 Mar 2022 01:04:26 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Fri, 11 Mar 2022 17:04:26 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id y16-20020a37e310000000b00648c706dda1sm4659537qki.6.2022.03.11.17.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 17:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rFaNukm6e0ay8t7LEleMYyh7Np8XSGQqI7/Nhb+Lk7o=; b=c8q5T908u//B3Wx72D2oCmXKNCWdFo3qxriDyjsNqiiPp2BO28kLeTFMhY3whP6r2X 0+zxFki1ovDv6QkWmJIq8oyAh1BvWn4v/WwL5b1vLQryVjYnvtQOGdi7EcQgsOFkSaNQ HAPFtwE/sWKP3kGfEZO72iRn3GevlDYK/aiFrBj8Fham/mjhqfvpbqn1v68DN6gLQlwQ IUz6NzwsxMOXLWnqCgz5VUVeFAZfybJCioERKd2IIccC2htuQuZQstypKW9Us7hHnq3O YwoG+iy1LQS40Hv/zxteRHB0C/0x98SxyydFE7c44lxGDxum2+BoLmMTy4OPNBL29jHy L3Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rFaNukm6e0ay8t7LEleMYyh7Np8XSGQqI7/Nhb+Lk7o=; b=0Bm41h9f50CppeJDzFS5UHcStNBoDOtrr+gwP5ewy/cjZozoix5WE5FHOQPZsipZlT 8vCGktJAaDXcpT50Zki1PRw3Rn4kGTTfhyF1QR5GNx7SgOZbZAyKGqPBe6JKz9kLnjUG EE3Lu7pLV8egFPmEtCT3EltURPoKFO408c8fv/42CswqziWql1dvWXvUVCWdAhS0j45D +EcRuJu5Zhsj1htFJxH6zrtrnHf44SDKaRucnUr3NSIMWLYFZga6wP/PJRb/2zy2EsjT CW8X6D8CLfRzfpGZU6LBSBPKXujQdPT5dS5Z2ChAEsm2dJs+lHDyuMQtEMW7nExV9dwy yKnQ== X-Gm-Message-State: AOAM532V6okKzexNz3jrcIM3jfBgW4Sa6U+0r+h+JoN4k5Chn3AqJITH BQ+z9rwTI+XN7DueYns7nD2FwkdahH8= X-Google-Smtp-Source: ABdhPJzusTXAmslPFcczyO5Q13Xi+kOogflT1zrdO5QppI0lun4pECE6GKlu/A4P3bPTfBudoxyqvQ== X-Received: by 2002:a05:6214:5285:b0:432:e468:a212 with SMTP id kj5-20020a056214528500b00432e468a212mr10132898qvb.51.1647047065100; Fri, 11 Mar 2022 17:04:25 -0800 (PST) From: Karl Semich <0xloem@gmail.com> To: seabios@seabios.org Date: Fri, 11 Mar 2022 20:04:06 -0500 Message-Id: <20220312010406.15116-1-0xloem@gmail.com> MIME-Version: 1.0 X-Spam-Level: * Message-ID-Hash: F2ZYVENCFSCLBAKGA7BXNO337MHUHHLJ X-Message-ID-Hash: F2ZYVENCFSCLBAKGA7BXNO337MHUHHLJ X-MailFrom: 0xloem@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Karl Semich <0xloem@gmail.com> X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH] Add an option for debug output on the vga console. List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1647047091156100001 Content-Type: text/plain; charset="utf-8" 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). =20 + config DEBUG_VGA_CONSOLE + depends on DEBUG_LEVEL !=3D 0 && !THREADS + bool "VGA console debugging" + default y + help + Send debugging information to vga console. This is only displa= yed + after the VGA console has loaded, and only in 32 bit flat regi= ons + of code. Requires that threads are disabled. + config DEBUG_IO depends on QEMU_HARDWARE && DEBUG_LEVEL !=3D 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 ****************************************************************/ =20 +static int VgaConsoleActive =3D 0; + void enable_vga_console(void) { @@ -47,11 +49,18 @@ enable_vga_console(void) br.ax =3D 0x0003; call16_int10(&br); =20 + VgaConsoleActive =3D 1; + // Write to screen. printf("SeaBIOS (version %s)\n", VERSION); display_uuid(); } =20 +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 =20 struct putcinfo { void (*func)(struct putcinfo *info, char c); }; =20 +static void __debug_putc(char c); +static void __screen_putc(char c); + =20 /**************************************************************** * Debug output @@ -35,9 +38,8 @@ debug_banner(void) dprintf(1, "BUILD: %s\n", BUILDINFO); } =20 -// 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); } =20 +// 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); } =20 -// 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 =3D=3D '\n') screenc('\r'); screenc(c); } =20 +// 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 =3D { screen_putc }; =20 =20 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, =20 // bootsplash.c void enable_vga_console(void); +int vga_console_active(void); void enable_bootsplash(void); void disable_bootsplash(void); =20 --=20 2.32.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org