Module Name: src
Committed By: martin
Date: Mon Mar 20 17:24:15 UTC 2023
Modified Files:
src/sys/dev/wscons [netbsd-10]: wsdisplay.c wsdisplayvar.h
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu [netbsd-10]:
amdgpu_gart.c
src/sys/external/bsd/drm2/nouveau [netbsd-10]: nouveau_pci.c
src/sys/external/bsd/drm2/radeon [netbsd-10]: radeon_pci.c
Log Message:
Pull up following revision(s) (requested by mrg in ticket #122):
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c: revision 1.11
sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.37
sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.22
sys/dev/wscons/wsdisplay.c: revision 1.166
sys/dev/wscons/wsdisplayvar.h: revision 1.57
amdgpu: Fix bogus loop invariant assertions in amdgpu_gart_map.
nouveau: Kick out genfb on firmware framebuffer before initializing.
PR kern/53126
radeon: Kick out genfb on firmware framebuffer before initializing.
this is the same change as nouveau_pci.c:1.37, and should fix at
least PR#56714 and i thought at least another PR i can't find right
now. it fixes at least 2 different radeon cards for me on UEFI
booted system.
To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.165.4.1 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.56 -r1.56.4.1 src/sys/dev/wscons/wsdisplayvar.h
cvs rdiff -u -r1.10 -r1.10.4.1 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
cvs rdiff -u -r1.36 -r1.36.4.1 \
src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
cvs rdiff -u -r1.21 -r1.21.4.1 src/sys/external/bsd/drm2/radeon/radeon_pci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.165 src/sys/dev/wscons/wsdisplay.c:1.165.4.1
--- src/sys/dev/wscons/wsdisplay.c:1.165 Sun Jul 17 11:43:39 2022
+++ src/sys/dev/wscons/wsdisplay.c Mon Mar 20 17:24:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.165.4.1 2023/03/20 17:24:15 martin 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.165.4.1 2023/03/20 17:24:15 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_wsdisplay_compat.h"
@@ -982,6 +982,15 @@ wsdisplay_preattach(const struct wsscree
}
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);
Index: src/sys/dev/wscons/wsdisplayvar.h
diff -u src/sys/dev/wscons/wsdisplayvar.h:1.56 src/sys/dev/wscons/wsdisplayvar.h:1.56.4.1
--- src/sys/dev/wscons/wsdisplayvar.h:1.56 Sat Jan 29 01:19:30 2022
+++ src/sys/dev/wscons/wsdisplayvar.h Mon Mar 20 17:24:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.56 2022/01/29 01:19:30 uwe Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.56.4.1 2023/03/20 17:24:15 martin Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -172,6 +172,7 @@ void wsdisplay_cnattach(const struct wss
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);
Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.10 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.10.4.1
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.10 Sat Jul 30 17:12:39 2022
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c Mon Mar 20 17:24:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $ */
+/* $NetBSD: amdgpu_gart.c,v 1.10.4.1 2023/03/20 17:24:14 martin Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.10.4.1 2023/03/20 17:24:14 martin Exp $");
#include <linux/pci.h>
#include <linux/vmalloc.h>
@@ -440,8 +440,9 @@ int amdgpu_gart_map(struct amdgpu_device
t = gpu_start / AMDGPU_GPU_PAGE_SIZE;
for (i = 0; npages --> 0;) {
- KASSERT(i < dmamap->dm_nsegs);
for (j = 0; j < AMDGPU_GPU_PAGES_IN_CPU_PAGE; j++) {
+ KASSERT(i < dmamap->dm_nsegs);
+ KASSERT(seg_off < dmamap->dm_segs[i].ds_len);
amdgpu_gmc_set_pte_pde(adev, dst, t,
dmamap->dm_segs[i].ds_addr + seg_off, flags);
seg_off += AMDGPU_GPU_PAGE_SIZE;
@@ -449,7 +450,6 @@ int amdgpu_gart_map(struct amdgpu_device
i++;
seg_off = 0;
}
- KASSERT(seg_off < dmamap->dm_segs[i].ds_len);
}
}
Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36.4.1
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36 Mon Jul 18 23:34:02 2022
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c Mon Mar 20 17:24:15 2023
@@ -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.36.4.1 2023/03/20 17:24:15 martin 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.36.4.1 2023/03/20 17:24:15 martin Exp $");
#ifdef _KERNEL_OPT
+#include "genfb.h"
#if defined(__arm__) || defined(__aarch64__)
#include "opt_fdt.h"
#endif
@@ -49,6 +50,11 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
#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 @@ nouveau_pci_attach_real(device_t self)
}
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) {
Index: src/sys/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21.4.1
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21 Mon Jul 18 23:34:03 2022
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c Mon Mar 20 17:24:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $ */
+/* $NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $");
#ifdef _KERNEL_OPT
+#include "genfb.h"
#include "vga.h"
#if defined(__arm__) || defined(__aarch64__)
#include "opt_fdt.h"
@@ -73,6 +74,11 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_pci.c
#include <drm/drm_fb_helper.h>
#include <drm/drm_pci.h>
+#if NGENFB > 0
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wsfb/genfbvar.h>
+#endif
+
#include <radeon.h>
#include "radeon_drv.h"
#include "radeon_task.h"
@@ -273,6 +279,24 @@ radeon_attach_real(device_t self)
}
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 = -drm_dev_register(sc->sc_drm_dev, flags);
if (error) {