NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53126: uefi boot breaks graphics



The following reply was made to PR port-amd64/53126; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: prlw1%cam.ac.uk@localhost, tnn%NetBSD.org@localhost, snj%NetBSD.org@localhost
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/53126: uefi boot breaks graphics
Date: Fri, 24 Feb 2023 10:29:02 +0000

 This is a multi-part message in MIME format.
 --=_cEFiPfdk98xHDMxf5dg4ZFdv6SEdn8RA
 
 New patch to try -- barking up a different tree now.  This one is more
 committable as-is, and also corresponds to a change jmcneill@ made on
 fdt platforms a couple years ago.
 
 --=_cEFiPfdk98xHDMxf5dg4ZFdv6SEdn8RA
 Content-Type: text/plain; charset="ISO-8859-1"; name="nvgenfb"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="nvgenfb.patch"
 
 From 2224ba18a1fec7f7c26cae6543526ac163135d78 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Fri, 24 Feb 2023 10:25:57 +0000
 Subject: [PATCH] nouveau: Kick out genfb on firmware framebuffer before
  initializing.
 
 XXX Should maybe kick out FDT at this point too, rather than earlier
 on.
 
 PR kern/53126
 ---
  sys/dev/wscons/wsdisplay.c                  |  9 ++++++++
  sys/dev/wscons/wsdisplayvar.h               |  1 +
  sys/external/bsd/drm2/nouveau/nouveau_pci.c | 23 +++++++++++++++++++++
  3 files changed, 33 insertions(+)
 
 diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
 index dc4c526625db..c7c89f3ce980 100644
 --- a/sys/dev/wscons/wsdisplay.c
 +++ b/sys/dev/wscons/wsdisplay.c
 @@ -981,6 +981,15 @@ wsdisplay_preattach(const struct wsscreen_descr *type,=
  void *cookie,
  	wsdisplay_console_initted =3D 1;
  }
 =20
 +void
 +wsdisplay_predetach(void)
 +{
 +	KASSERT(wsdisplay_console_initted =3D=3D 1);
 +
 +	cn_tab =3D wsdisplay_ocn;
 +	wsdisplay_console_initted =3D 0;
 +}
 +
  void
  wsdisplay_cndetach(void)
  {
 diff --git a/sys/dev/wscons/wsdisplayvar.h b/sys/dev/wscons/wsdisplayvar.h
 index 281991e7d2b1..8305ca877fb6 100644
 --- a/sys/dev/wscons/wsdisplayvar.h
 +++ b/sys/dev/wscons/wsdisplayvar.h
 @@ -172,6 +172,7 @@ void	wsdisplay_cnattach(const struct wsscreen_descr *, =
 void *, int, int,
              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);
 =20
 diff --git a/sys/external/bsd/drm2/nouveau/nouveau_pci.c b/sys/external/bsd=
 /drm2/nouveau/nouveau_pci.c
 index 220119b45d99..881608f32c57 100644
 --- a/sys/external/bsd/drm2/nouveau/nouveau_pci.c
 +++ b/sys/external/bsd/drm2/nouveau/nouveau_pci.c
 @@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36 2022/07/=
 18 23:34:02 riastradh E
  #if defined(__arm__) || defined(__aarch64__)
  #include "opt_fdt.h"
  #endif
 +#include "opt_genfb.h"
  #endif
 =20
  #include <sys/types.h>
 @@ -49,6 +50,10 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36 2022/07=
 /18 23:34:02 riastradh E
  #include <dev/fdt/fdtvar.h>
  #endif
 =20
 +#if NGENFB > 0
 +#include <dev/wscons/wsdisplayvar.h>
 +#endif
 +
  #include <drm/drm_pci.h>
 =20
  #include <core/device.h>
 @@ -220,6 +225,24 @@ nouveau_pci_attach_real(device_t self)
  	}
  	sc->sc_pci_attached =3D true;
 =20
 +#if NGENFB > 0
 +	/*
 +	 * If MD initialization has selected this as a genfb console
 +	 * 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 =3D -nouveau_drm_device_init(sc->sc_drm_dev);
  	if (error) {
 
 --=_cEFiPfdk98xHDMxf5dg4ZFdv6SEdn8RA--
 


Home | Main Index | Thread Index | Old Index