Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 x86: Fix interaction between consinit, device_p...
details: https://anonhg.NetBSD.org/src/rev/5f26ade676d0
branches: trunk
changeset: 369877:5f26ade676d0
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Sep 05 14:18:51 2022 +0000
description:
x86: Fix interaction between consinit, device_pci_register, and drm.
Leave an essay on what's going on here in both places with
cross-references.
PR kern/56996
diffstat:
sys/arch/x86/pci/pci_machdep.c | 35 +++++++++++++++++++++++++----------
sys/arch/x86/x86/consinit.c | 13 +++++++++++--
2 files changed, 36 insertions(+), 12 deletions(-)
diffs (90 lines):
diff -r b4b8e5fa1ef9 -r 5f26ade676d0 sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c Mon Sep 05 14:14:42 2022 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c Mon Sep 05 14:18:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.91 2022/05/24 14:00:23 bouyer Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.92 2022/09/05 14:18:51 riastradh Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.91 2022/05/24 14:00:23 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.92 2022/09/05 14:18:51 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -1228,14 +1228,29 @@
*/
populate_fbinfo(dev, dict);
-#if 1 && NWSDISPLAY > 0 && NGENFB > 0
- /* XXX */
- if (device_is_a(dev, "genfb")) {
- prop_dictionary_set_bool(dict, "is_console",
- genfb_is_console());
- } else
-#endif
- prop_dictionary_set_bool(dict, "is_console", true);
+ /*
+ * If the bootloader requested console=pc and
+ * specified a framebuffer, and if
+ * x86_genfb_cnattach succeeded in setting it
+ * up during consinit, then consinit will call
+ * genfb_cnattach which makes genfb_is_console
+ * return true. In this case, if it's the
+ * first genfb we've seen, we will instruct the
+ * genfb driver via the is_console property
+ * that it has been selected as the console.
+ *
+ * If not all of that happened, then consinit
+ * can't have selected a genfb console, so this
+ * device is definitely not the console.
+ *
+ * XXX What happens if there's more than one
+ * PCI display device, and the bootloader picks
+ * the second one's framebuffer as the console
+ * framebuffer address? Tough...but this has
+ * probably never worked.
+ */
+ prop_dictionary_set_bool(dict, "is_console",
+ genfb_is_console());
prop_dictionary_set_bool(dict, "clear-screen", false);
#if NWSDISPLAY > 0 && NGENFB > 0
diff -r b4b8e5fa1ef9 -r 5f26ade676d0 sys/arch/x86/x86/consinit.c
--- a/sys/arch/x86/x86/consinit.c Mon Sep 05 14:14:42 2022 +0000
+++ b/sys/arch/x86/x86/consinit.c Mon Sep 05 14:18:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: consinit.c,v 1.34 2021/10/07 12:52:27 msaitoh Exp $ */
+/* $NetBSD: consinit.c,v 1.35 2022/09/05 14:18:51 riastradh Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.34 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.35 2022/09/05 14:18:51 riastradh Exp $");
#include "opt_kgdb.h"
#include "opt_puc.h"
@@ -195,6 +195,15 @@
int error;
#if (NGENFB > 0)
if (fbinfo && fbinfo->physaddr > 0) {
+ /*
+ * If we have a framebuffer address, and
+ * x86_genfb_cnattach can map it, then
+ * genfb_cnattach causes genfb_is_console to
+ * later return true. device_pci_register will
+ * use this to set up the device properties for
+ * a PCI display-class device to notify it that
+ * it has been selected as the console.
+ */
if (x86_genfb_cnattach() == -1) {
initted = 0; /* defer */
return;
Home |
Main Index |
Thread Index |
Old Index