From nobody Fri Apr 19 00:43:12 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 1647087834521826.3322000958553; Sat, 12 Mar 2022 04:23:54 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 3E67D16E3D2C; Sat, 12 Mar 2022 12:23:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id D54F516E3671 for ; Sat, 12 Mar 2022 12:23:35 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Sat, 12 Mar 2022 04:23:35 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id u13-20020a05622a14cd00b002d5e213eb93sm7259894qtx.14.2022.03.12.04.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Mar 2022 04:23:34 -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=Fg2CH9LB0qXaTePBXSXQIdpVRIDs+wWyy8OtAKrQUGQ=; b=pqI7ORT/YmQowYNLAElOrDFI+qYaSR1eFoVAAFgpYWgwJklOUKNvh26nFoQj+CHaJW uPWVsbbMd8Od0L+xOJ0TKmLHvsLOCnH4Wvim3cna1yq1XQvF05g5q6wguv/+Dxt7AaOX 34P60klsWn1S5hM20u1NwUMuDmbOKsIkarNSXmSbYI93+BGOwb99rPnDs69NBlL+ssXQ JtFHc/25DKUDEhYa/QE7MvDw0ybNXyEfpExWHZKX7tnVM8hDyFqw+Dndrkd+4zFL/4De j9OYCRtDxDYsRitPbnpxLSc+KSJnRKFzmPYqmhkKKCtcHCfmvJnP+ntLMe99E7VYNT0z l2wQ== 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=Fg2CH9LB0qXaTePBXSXQIdpVRIDs+wWyy8OtAKrQUGQ=; b=2yjBHEPOVIIjIc+cfw0A1OdWxja+iHkMXoV2+QCrVxuuvjhRxgzbqpMx7rpgt9kpba whT+FR+BCopwJveSRxXBkmjq5Z2IKbGss+9bYofpGcEeiIOaRvfx7VhU0S2M8Z1dAOWK tLzViU9xtvE08eb8dn+0orQAWrOTEU6miSIURs936egx1ryAKdSHftSWU4YRKil95WLz YvAilQhFzH5Fz334RZ1kUM3tktFbs0FDUFsYRNNjQ12GjaDynu6RiON6i0Y36CGqDPaJ HxEu/iCE10TM+sTZQTMBGpJSdKUVIAqu7LAVhLAwCVciqkACwM2Rx+Q/yx2VdKIIEAXY GqRA== X-Gm-Message-State: AOAM532EVZCVRWAru8si3xidTHjqtK4wwUn1rupCNP8O6utQxNP4LIyR Sk7lv5YkUjYo7VU0wMkvPYKckVthpck= X-Google-Smtp-Source: ABdhPJz3MdtaKZRW68LaqcEIKn5gtiyAami54P1co+56y/4asDBug/1FjvO7PG5t2EydNITB5aS6nA== X-Received: by 2002:a37:53c6:0:b0:663:82b8:eb with SMTP id h189-20020a3753c6000000b0066382b800ebmr9136657qkb.122.1647087814530; Sat, 12 Mar 2022 04:23:34 -0800 (PST) From: Karl Semich <0xloem@gmail.com> To: 0xloem@gmail.com, seabios@seabios.org Date: Sat, 12 Mar 2022 07:23:33 -0500 Message-Id: <20220312122333.33147-1-0xloem@gmail.com> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: X55G2DUH572AHUSABQU3BNSHZHNVJ3BK X-Message-ID-Hash: X55G2DUH572AHUSABQU3BNSHZHNVJ3BK 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: Paul Menzel X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH v2] 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: 1647087835825100001 Content-Type: text/plain; charset="utf-8" Only available if threads are disabled, to prevent an undiagnosed call16 pa= nic. A new vga_console_active() utility function is added, and debugging output = is only forwarded to the vga console if the vga console has been enabled. Only debugging output from 32bit flat regions is emitted, as vga console ou= tput is only supported from within such code. This is detected with a !MODESEGME= NT check inside the debugging output code, and a new ASSERT32FLAT() check with= in the vga output code. This change has been briefly tested on a kfsn4-dre and in qemu, using serial debugging in the latter to verify that 16bit output appears over serial that does not appear on the vga console. Signed-off-by: Karl Semich <0xloem@gmail.com> --- src/Kconfig | 9 +++++++++ src/bootsplash.c | 9 +++++++++ src/output.c | 33 ++++++++++++++++++++++++++------- src/util.h | 1 + 4 files changed, 45 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..6fbf4f5 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,24 @@ 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); + ASSERT32FLAT(); 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