Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
sys/amd64: fallback to VGA text mode on headless systems
To:
OpenBSD tech <tech@openbsd.org>
Date:
Tue, 27 Jan 2026 03:21:36 +0100

Download raw body.

Thread
tech@,

Some amd64 UEFI systems hide GOP when no display is connected, so efifb
can’t attach and wscons has no early console. The system still boots
once a real video driver attaches and provides wsdisplay, but without
that driver it appears stuck until a display is connected.

The fallback forces VGA text mode even when the VGA probe fails, that
guaranteeing an early console, so boot can proceed even if GOP is absent
and no GPU driver is available.

This was tested on machine where I had discovered:
https://marc.info/?t=176200344600002&r=1&w=2

Feedback? Tests? Ok?


Index: arch/amd64/amd64/wscons_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/arch/amd64/amd64/wscons_machdep.c,v
diff -u -p -r1.14 wscons_machdep.c
--- arch/amd64/amd64/wscons_machdep.c	14 Oct 2017 04:44:43 -0000	1.14
+++ arch/amd64/amd64/wscons_machdep.c	27 Jan 2026 01:52:15 -0000
@@ -152,6 +152,14 @@ wscn_video_init(void)
 	if (pcdisplay_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM) == 0)
 		return (0);
 #endif
+#if (NVGA > 0)
+	/*
+	 * If VGA probe fails (e.g. headless firmware disabling VGA decode),
+	 * we still need a console to boot. Fall back to VGA text mode.
+	 */
+	if (vga_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM, -1, 0) == 0)
+		return (0);
+#endif
 	return (-1);
 }
 

-- 
wbr, Kirill