Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys nouveau: Kick out genfb on firmware framebuffer before i...
details: https://anonhg.NetBSD.org/src/rev/eb9c9f782f2b
branches: trunk
changeset: 373795:eb9c9f782f2b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Mar 01 08:42:33 2023 +0000
description:
nouveau: Kick out genfb on firmware framebuffer before initializing.
PR kern/53126
diffstat:
sys/dev/wscons/wsdisplay.c | 13 +++++++++++--
sys/dev/wscons/wsdisplayvar.h | 3 ++-
sys/external/bsd/drm2/nouveau/nouveau_pci.c | 28 ++++++++++++++++++++++++++--
3 files changed, 39 insertions(+), 5 deletions(-)
diffs (109 lines):
diff -r 76744682b320 -r eb9c9f782f2b sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c Wed Mar 01 08:38:50 2023 +0000
+++ b/sys/dev/wscons/wsdisplay.c Wed Mar 01 08:42:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.166 2023/03/01 08:42:33 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.166 2023/03/01 08:42:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_wsdisplay_compat.h"
@@ -982,6 +982,15 @@
}
void
+wsdisplay_predetach(void)
+{
+ KASSERT(wsdisplay_console_initted == 1);
+
+ cn_tab = wsdisplay_ocn;
+ wsdisplay_console_initted = 0;
+}
+
+void
wsdisplay_cndetach(void)
{
KASSERT(wsdisplay_console_initted == 2);
diff -r 76744682b320 -r eb9c9f782f2b sys/dev/wscons/wsdisplayvar.h
--- a/sys/dev/wscons/wsdisplayvar.h Wed Mar 01 08:38:50 2023 +0000
+++ b/sys/dev/wscons/wsdisplayvar.h Wed Mar 01 08:42:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.56 2022/01/29 01:19:30 uwe Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.57 2023/03/01 08:42:33 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -172,6 +172,7 @@
long);
void wsdisplay_preattach(const struct wsscreen_descr *, void *, int, int,
long);
+void wsdisplay_predetach(void);
void wsdisplay_cndetach(void);
void wsdisplay_multicons_suspend(bool);
diff -r 76744682b320 -r eb9c9f782f2b sys/external/bsd/drm2/nouveau/nouveau_pci.c
--- a/sys/external/bsd/drm2/nouveau/nouveau_pci.c Wed Mar 01 08:38:50 2023 +0000
+++ b/sys/external/bsd/drm2/nouveau/nouveau_pci.c Wed Mar 01 08:42:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_pci.c,v 1.36 2022/07/18 23:34:02 riastradh Exp $ */
+/* $NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $");
#ifdef _KERNEL_OPT
+#include "genfb.h"
#if defined(__arm__) || defined(__aarch64__)
#include "opt_fdt.h"
#endif
@@ -49,6 +50,11 @@
#include <dev/fdt/fdtvar.h>
#endif
+#if NGENFB > 0
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wsfb/genfbvar.h>
+#endif
+
#include <drm/drm_pci.h>
#include <core/device.h>
@@ -220,6 +226,24 @@
}
sc->sc_pci_attached = true;
+#if NGENFB > 0
+ /*
+ * If MD initialization has selected this as the console device
+ * with a firmware-provided framebuffer address, we may have to
+ * turn it off early, before we are ready to switch the console
+ * over -- something goes wrong if we're still writing to the
+ * firmware-provided framebuffer during nouveau initialization.
+ */
+ {
+ bool is_console;
+ if (prop_dictionary_get_bool(device_properties(self), "is_console",
+ &is_console) &&
+ is_console &&
+ genfb_is_console())
+ wsdisplay_predetach();
+ }
+#endif
+
/* XXX errno Linux->NetBSD */
error = -nouveau_drm_device_init(sc->sc_drm_dev);
if (error) {
Home |
Main Index |
Thread Index |
Old Index