> I'll cook a diff to make glass console less eager in case no frame
> buffer device is found.

This is what I had in mind.

Index: arch/amd64/amd64/efifb.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/amd64/amd64/efifb.c,v
retrieving revision 1.34
diff -u -p -r1.34 efifb.c
--- arch/amd64/amd64/efifb.c    15 Jul 2022 17:57:25 -0000      1.34
+++ arch/amd64/amd64/efifb.c    9 Oct 2024 18:59:13 -0000
@@ -349,6 +349,15 @@ efifb_alloc_screen(void *v, const struct
 }
 
 int
+efifb_cnprobe(void)
+{
+       if (bios_efiinfo == NULL || bios_efiinfo->fb_addr == 0)
+               return (-1);
+
+       return (0);
+}
+
+int
 efifb_cnattach(void)
 {
        if (bios_efiinfo == NULL || bios_efiinfo->fb_addr == 0)
Index: arch/amd64/amd64/wscons_machdep.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/amd64/amd64/wscons_machdep.c,v
retrieving revision 1.14
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   9 Oct 2024 18:59:13 -0000
@@ -82,6 +82,25 @@ void
 wscnprobe(struct consdev *cp)
 {
        int maj;
+       int display = 0;
+
+#if (NEFIFB > 0)
+       if (efifb_cnprobe() == 0)
+               display = 1;
+#endif
+#if (NVGA > 0)
+       if (!display && vga_cnprobe(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM) == 0)
+               display = 1;
+#endif
+#if (NPCDISPLAY > 0)
+       if (!display &&
+           pcdisplay_cnprobe(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM) == 0)
+               display = 1;
+#endif
+       if (!display) {
+               cp->cn_pri = CN_DEAD;
+               return;
+       }
 
        /* locate the major number */
        for (maj = 0; maj < nchrdev; maj++) {
Index: arch/amd64/include/efifbvar.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/amd64/include/efifbvar.h,v
retrieving revision 1.10
diff -u -p -r1.10 efifbvar.h
--- arch/amd64/include/efifbvar.h       4 May 2019 11:34:47 -0000       1.10
+++ arch/amd64/include/efifbvar.h       9 Oct 2024 18:59:13 -0000
@@ -25,6 +25,7 @@ struct efifb_attach_args {
 
 struct pci_attach_args;
 
+int efifb_cnprobe(void);
 int efifb_cnattach(void);
 void efifb_cnremap(void);
 int efifb_is_console(struct pci_attach_args *);
Index: dev/ic/vga.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/ic/vga.c,v
retrieving revision 1.74
diff -u -p -r1.74 vga.c
--- dev/ic/vga.c        27 May 2021 23:24:40 -0000      1.74
+++ dev/ic/vga.c        9 Oct 2024 18:59:13 -0000
@@ -571,6 +571,15 @@ vga_extended_attach(struct device *self,
 }
 
 int
+vga_cnprobe(bus_space_tag_t iot, bus_space_tag_t memt)
+{
+       if (!vga_common_probe(iot, memt))
+               return (ENXIO);
+
+       return (0);
+}
+
+int
 vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
 {
        uint32_t defattr;
Index: dev/ic/vgavar.h
===================================================================
RCS file: /OpenBSD/src/sys/dev/ic/vgavar.h,v
retrieving revision 1.13
diff -u -p -r1.13 vgavar.h
--- dev/ic/vgavar.h     26 Jul 2015 03:17:07 -0000      1.13
+++ dev/ic/vgavar.h     9 Oct 2024 18:59:13 -0000
@@ -187,6 +187,7 @@ struct vga_config *
        vga_extended_attach(struct device *, bus_space_tag_t, bus_space_tag_t,
            int, paddr_t (*)(void *, off_t, int));
 int    vga_is_console(bus_space_tag_t, int);
+int    vga_cnprobe(bus_space_tag_t, bus_space_tag_t);
 int    vga_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
 
 struct wsscreen_descr;
Index: dev/isa/pcdisplay.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/isa/pcdisplay.c,v
retrieving revision 1.15
diff -u -p -r1.15 pcdisplay.c
--- dev/isa/pcdisplay.c 6 Apr 2022 18:59:28 -0000       1.15
+++ dev/isa/pcdisplay.c 9 Oct 2024 18:59:13 -0000
@@ -286,6 +286,16 @@ pcdisplay_attach(struct device *parent, 
 
 
 int
+pcdisplay_cnprobe(bus_space_tag_t iot, bus_space_tag_t memt)
+{
+       if (pcdisplay_probe_col(iot, memt))
+               return (0);
+       if (pcdisplay_probe_mono(iot, memt))
+               return (0);
+       return (ENXIO);
+}
+
+int
 pcdisplay_cnattach(bus_space_tag_t iot, bus_space_tag_t memt)
 {
        int mono;
Index: dev/isa/pcdisplayvar.h
===================================================================
RCS file: /OpenBSD/src/sys/dev/isa/pcdisplayvar.h,v
retrieving revision 1.4
diff -u -p -r1.4 pcdisplayvar.h
--- dev/isa/pcdisplayvar.h      2 Apr 2004 04:39:51 -0000       1.4
+++ dev/isa/pcdisplayvar.h      9 Oct 2024 18:59:13 -0000
@@ -27,4 +27,5 @@
  *
  */
 
+int pcdisplay_cnprobe(bus_space_tag_t, bus_space_tag_t);
 int pcdisplay_cnattach(bus_space_tag_t, bus_space_tag_t);

Reply via email to