CVS commit: src/sys/external/bsd/drm2/nouveau

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:26:53 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau2netbsd

Log Message:
nouveau: Rework nouveau2netbsd hack to get ACPI stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/nouveau2netbsd
diff -u src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.5 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.6
--- src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.5	Mon Aug 27 00:46:21 2018
+++ src/sys/external/bsd/drm2/nouveau/nouveau2netbsd	Tue Apr 16 14:26:53 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#	$NetBSD: nouveau2netbsd,v 1.5 2018/08/27 00:46:21 riastradh Exp $
+#	$NetBSD: nouveau2netbsd,v 1.6 2024/04/16 14:26:53 riastradh Exp $
 #
 # $ /path/to/nouveau2netbsd > /path/to/files.nouveau.new
 #
@@ -32,9 +32,13 @@ filemap="$(mktemp -t ${0##*/})"
 
 cat Kbuild\
 | sed -e 's,^include \(.*\)$,.include "\1",'\
-| sed -e 's,^ifdef \(.*\)$,.if !empty(\1:M[yY][eE][sS]),'		\
+| sed -e 's,^ifdef \(.*\)$,.if !empty(\1:M[yY]),'			\
 | sed -e 's,^endif$,.endif,'		\
-| make -f /dev/stdin -V '$(nouveau-y)' src=.\
+| env	\
+	env CONFIG_ACPI=y		\
+	env CONFIG_X86=y		\
+	env src=.			\
+	make -f /dev/stdin -V '$(nouveau-y)'\
 | tr ' ' '\n'\
 | sed -e 's,^$,,'			\
 | sort -u\



CVS commit: src/sys/external/bsd/drm2/nouveau

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:26:53 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau2netbsd

Log Message:
nouveau: Rework nouveau2netbsd hack to get ACPI stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/nouveau/nouveau_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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.38
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37	Wed Mar  1 08:42:34 2023
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Mon Aug  7 16:34:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 #include 
 #endif
 
+#include 
 #include 
 
 #include 
@@ -316,16 +317,31 @@ static bool
 nouveau_pci_suspend(device_t self, const pmf_qual_t *qual __unused)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	drm_suspend_ioctl(dev);
+
+	ret = nouveau_pmops_suspend(dev);
+	if (ret)
+		return false;
 
-	return nouveau_pmops_suspend(sc->sc_drm_dev) == 0;
+	return true;
 }
 
 static bool
 nouveau_pci_resume(device_t self, const pmf_qual_t *qual)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	ret = nouveau_pmops_resume(sc->sc_drm_dev);
+	if (ret)
+		goto out;
 
-	return nouveau_pmops_resume(sc->sc_drm_dev) == 0;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void



CVS commit: src/sys/external/bsd/drm2/nouveau

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:51 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_module.c

Log Message:
nouveau: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/nouveau/nouveau_module.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/external/bsd/drm2/nouveau/nouveau_module.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.10 src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.11
--- src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.10	Sun Dec 19 10:32:59 2021
+++ src/sys/external/bsd/drm2/nouveau/nouveau_module.c	Sun Jul 17 15:36:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_module.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $	*/
+/*	$NetBSD: nouveau_module.c,v 1.11 2022/07/17 15:36:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.11 2022/07/17 15:36:51 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_modu
 
 #include 
 
-MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms"); /* XXX drmkms_i2c, drmkms_ttm */
+MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



CVS commit: src/sys/external/bsd/drm2/nouveau

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:51 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_module.c

Log Message:
nouveau: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/nouveau/nouveau_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:35 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: adjust the list of PCI devices to match

linux 5.6 drm supports all the cards previously listed as unsupported.
make those supported, and, add the newer list of unsupported (the
supported list goes to GTX 20 series.)

Author: phone 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/external/bsd/drm2/nouveau/nouveau_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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.34 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.35
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.34	Sun Dec 19 12:28:12 2021
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sun Dec 19 12:45:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.34 2021/12/19 12:28:12 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.35 2021/12/19 12:45:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.34 2021/12/19 12:28:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.35 2021/12/19 12:45:35 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #if defined(__arm__) || defined(__aarch64__)
@@ -109,26 +109,19 @@ nouveau_pci_match(device_t parent, cfdat
 		return 0;
 
 	/*
-	 * NetBSD drm2 doesn't support Pascal, Volta or Turing based cards:
-	 *   0x1580-0x15ff 	GP100
-	 *   0x1b00-0x1b7f 	GP102
-	 *   0x1b80-0x1bff 	GP104
-	 *   0x1c00-0x1c7f 	GP106
-	 *   0x1c80-0x1cff 	GP107
-	 *   0x1d00-0x1d7f 	GP108
-	 *   0x1d80-0x1dff 	GV100
-	 *   0x1e00-0x1e7f 	TU102
-	 *   0x1e80-0x1eff 	TU104
-	 *   0x1f00-0x1f7f 	TU106
-	 *   0x1f80-0x1fff 	TU117
-	 *   0x2180-0x21ff 	TU116
+	 * NetBSD drm2/5.6 doesn't support Ampere (GTX 30 series) based cards:
+	 *   0x2080-0x20ff 	GA100
+	 *   0x2200-0x227f 	GA102
+	 *   0x2300-0x237f 	GA103
+	 *   0x2480-0x24ff 	GA104
+	 *   0x2500-0x257f 	GA106
+	 *   0x2580-0x25ff 	GA107
 	 *
-	 * reduce this to >= 1580, so that new chipsets not explictly
-	 * listed above will be picked up.
-	 *
-	 * XXX perhaps switch this to explicitly match known list.
+	 * TU116 (GTX 16xx) occupies the space from 0x2180-0x21ff.
 	 */
-	if (PCI_PRODUCT(pa->pa_id) >= 0x1580)
+	if (PCI_PRODUCT(pa->pa_id) >= 0x1fff && PCI_PRODUCT(pa->pa_id) < 0x2180)
+		return 0;
+	if (PCI_PRODUCT(pa->pa_id) >= 0x21ff)
 		return 0;
 
 	linux_pci_dev_init(, parent /* XXX bogus */, parent, pa, 0);



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:35 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: adjust the list of PCI devices to match

linux 5.6 drm supports all the cards previously listed as unsupported.
make those supported, and, add the newer list of unsupported (the
supported list goes to GTX 20 series.)

Author: phone 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 11:05:20 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Call nouveau_drm_device_init.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/nouveau/nouveau_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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.30 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.31
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.30	Sun Dec 19 11:05:13 2021
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sun Dec 19 11:05:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.30 2021/12/19 11:05:13 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.31 2021/12/19 11:05:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.30 2021/12/19 11:05:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.31 2021/12/19 11:05:20 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #if defined(__arm__) || defined(__aarch64__)
@@ -223,6 +223,13 @@ nouveau_pci_attach_real(device_t self)
 	sc->sc_pci_attached = true;
 
 	/* XXX errno Linux->NetBSD */
+	error = -nouveau_drm_device_init(sc->sc_drm_dev);
+	if (error) {
+		aprint_error_dev(self, "unable to init nouveau: %d\n", error);
+		return;
+	}
+
+	/* XXX errno Linux->NetBSD */
 	error = -drm_dev_register(sc->sc_drm_dev, 0);
 	if (error) {
 		aprint_error_dev(self, "unable to register drm: %d\n", error);



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 11:05:20 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Call nouveau_drm_device_init.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 10:48:22 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Compile all of nouveau with -Wno-pointer-arith.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/external/bsd/drm2/nouveau/files.nouveau

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.32 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.33
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.32	Sun Dec 19 00:32:03 2021
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Sun Dec 19 10:48:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.nouveau,v 1.32 2021/12/19 00:32:03 riastradh Exp $
+#	$NetBSD: files.nouveau,v 1.33 2021/12/19 10:48:22 riastradh Exp $
 
 version	20180827
 
@@ -29,14 +29,12 @@ makeoptions	nouveau	CPPFLAGS+="-DCONFIG_
 makeoptions	nouveau	CPPFLAGS+="-DCONFIG_NOUVEAU_DEBUG_DEFAULT=3"
 
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau"+="-Wno-pointer-arith"
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="-Wno-shadow"
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="${${ACTIVE_CC} == clang:? -Wno-error=gnu-variable-sized-type-not-at-end :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_bios_timing.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_clk_gt215.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
-makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_instmem_base.c"+="-Wno-pointer-arith"
-makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_bios_shadowpci.c"+="-Wno-pointer-arith"
-makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_instmem_nv40.c"+="-Wno-pointer-arith"
 
 file	external/bsd/drm2/nouveau/nouveau_module.c	nouveau
 



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 10:48:22 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Compile all of nouveau with -Wno-pointer-arith.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/external/bsd/drm2/nouveau/files.nouveau

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 00:32:11 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c nouveaufb.c

Log Message:
nouveau_drm.h was renamed upstream to nouveau_drv.h.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/nouveau/nouveaufb.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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.26 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.27
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.26	Mon Feb  3 16:52:13 2020
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sun Dec 19 00:32:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.26 2020/02/03 16:52:13 jmcneill Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.27 2021/12/19 00:32:11 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.26 2020/02/03 16:52:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.27 2021/12/19 00:32:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #if defined(__arm__) || defined(__aarch64__)
@@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 #include 
 #endif
 
-#include "nouveau_drm.h"
+#include "nouveau_drv.h"
 #include "nouveau_pci.h"
 
 MODULE(MODULE_CLASS_DRIVER, nouveau_pci, "nouveau,drmkms_pci");

Index: src/sys/external/bsd/drm2/nouveau/nouveaufb.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.4 src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.5
--- src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.4	Mon Dec 12 19:45:56 2016
+++ src/sys/external/bsd/drm2/nouveau/nouveaufb.c	Sun Dec 19 00:32:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveaufb.c,v 1.4 2016/12/12 19:45:56 maya Exp $	*/
+/*	$NetBSD: nouveaufb.c,v 1.5 2021/12/19 00:32:11 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.4 2016/12/12 19:45:56 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.5 2021/12/19 00:32:11 riastradh Exp $");
 
 #include 
 #include 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,
 #include 
 
 #include "nouveau_bo.h"
-#include "nouveau_drm.h"
+#include "nouveau_drv.h"
 #include "nouveau_fbcon.h"
 #include "nouveau_pci.h"
 #include "nouveaufb.h"



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 00:32:11 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c nouveaufb.c

Log Message:
nouveau_drm.h was renamed upstream to nouveau_drv.h.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/nouveau/nouveaufb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 00:32:03 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau
Removed Files:
src/sys/external/bsd/drm2/nouveau: nouveau_sysfs.c

Log Message:
Delete nouveau_sysfs.c, removed upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.1 -r0 src/sys/external/bsd/drm2/nouveau/nouveau_sysfs.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/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.31 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.32
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.31	Sun Dec 19 00:25:34 2021
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Sun Dec 19 00:32:03 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.nouveau,v 1.31 2021/12/19 00:25:34 riastradh Exp $
+#	$NetBSD: files.nouveau,v 1.32 2021/12/19 00:32:03 riastradh Exp $
 
 version	20180827
 
@@ -12,7 +12,6 @@ device	nouveaufb: nouveaufbbus, drmfb, d
 attach	nouveaufb at nouveaufbbus
 
 # Local additions.  External sources are listd below.
-file	external/bsd/drm2/nouveau/nouveau_sysfs.c		nouveau
 file	external/bsd/drm2/nouveau/nouveau_vga.c			nouveau
 file	external/bsd/drm2/nouveau/nouveaufb.c			nouveaufb
 



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 00:32:03 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau
Removed Files:
src/sys/external/bsd/drm2/nouveau: nouveau_sysfs.c

Log Message:
Delete nouveau_sysfs.c, removed upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.1 -r0 src/sys/external/bsd/drm2/nouveau/nouveau_sysfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2019-10-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 22:37:50 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
list the PCI ID range for new nvidia TU117 and TU116.
adjust the check to simply be >= 0x1580, which is the
first pciid not support.

should fix PR#54600.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2019-10-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 22:37:50 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
list the PCI ID range for new nvidia TU117 and TU116.
adjust the check to simply be >= 0x1580, which is the
first pciid not support.

should fix PR#54600.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/nouveau/nouveau_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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.24 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.25
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.24	Wed Jul  3 20:47:22 2019
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sat Oct  5 22:37:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.24 2019/07/03 20:47:22 wiz Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.25 2019/10/05 22:37:49 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.24 2019/07/03 20:47:22 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.25 2019/10/05 22:37:49 mrg Exp $");
 
 #include 
 #include 
@@ -97,8 +97,6 @@ nouveau_pci_match(device_t parent, cfdat
 	if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY)
 		return 0;
 
-#define IS_BETWEEN(x,y) \
-	(PCI_PRODUCT(pa->pa_id) >= (x) && PCI_PRODUCT(pa->pa_id) <= (y))
 	/*
 	 * NetBSD drm2 doesn't support Pascal, Volta or Turing based cards:
 	 *   0x1580-0x15ff 	GP100
@@ -111,20 +109,16 @@ nouveau_pci_match(device_t parent, cfdat
 	 *   0x1e00-0x1e7f 	TU102
 	 *   0x1e80-0x1eff 	TU104
 	 *   0x1f00-0x1f7f 	TU106
+	 *   0x1f80-0x1fff 	TU117
+	 *   0x2180-0x21ff 	TU116
+	 *
+	 * reduce this to >= 1580, so that new chipsets not explictly
+	 * listed above will be picked up.
+	 *
+	 * XXX perhaps switch this to explicitly match known list.
 	 */
-
-	if (IS_BETWEEN(0x1580, 0x15ff) ||
-	IS_BETWEEN(0x1b00, 0x1b7f) ||
-	IS_BETWEEN(0x1b80, 0x1bff) ||
-	IS_BETWEEN(0x1c00, 0x1c7f) ||
-	IS_BETWEEN(0x1c80, 0x1cff) ||
-	IS_BETWEEN(0x1d00, 0x1d7f) ||
-	IS_BETWEEN(0x1d80, 0x1dff) ||
-	IS_BETWEEN(0x1e00, 0x1e7f) ||
-	IS_BETWEEN(0x1e80, 0x1eff) ||
-	IS_BETWEEN(0x1f00, 0x1f7f))
+	if (PCI_PRODUCT(pa->pa_id) >= 0x1580)
 		return 0;
-#undef IS_BETWEEN
 
 	linux_pci_dev_init(, parent /* XXX bogus */, parent, pa, 0);
 	ret = nvkm_device_pci_new(, NULL, "error",



Re: CVS commit: src/sys/external/bsd/drm2/nouveau

2019-07-05 Thread maya
On Fri, Jul 05, 2019 at 10:25:50PM +0200, Thomas Klausner wrote:
> On Wed, Jul 03, 2019 at 10:56:09PM +, m...@netbsd.org wrote:
> > On Wed, Jul 03, 2019 at 08:47:22PM +, Thomas Klausner wrote:
> > > Module Name:  src
> > > Committed By: wiz
> > > Date: Wed Jul  3 20:47:22 UTC 2019
> > > 
> > > Modified Files:
> > >   src/sys/external/bsd/drm2/nouveau: nouveau_pci.c
> > > 
> > > Log Message:
> > > Improve nouveau pci attachment code so it waits for the availability of /
> > > before trying to load firmware.
> > > 
> > 
> > Which firmware is it loading? we should probably ship it...
> 
> I've tried to provide the nvidia firmware from Debian's
> firmware-nonfree_20161130.orig.tar.xz
> 
> Putting the files into
> 
> /usr/libdata/firmware/nvidia/gm206/gr
> 
> or
> 
> /usr/libdata/firmware/nouveau/gm206/gr
> 
> isn't enough, it still doesn't find them. Is the full searched path printed 
> somewhere?
>  Thomas

nouveau code doesn't make it super obvious, but try
/usr/libdata/firmware/nouveau/nvidia/gm206/gr/

If that fails, printf drvname and imgname in
sys/dev/firmload.c:firmware_open

This is our usual source for firmware,
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/


Re: CVS commit: src/sys/external/bsd/drm2/nouveau

2019-07-03 Thread maya
On Wed, Jul 03, 2019 at 08:47:22PM +, Thomas Klausner wrote:
> Module Name:  src
> Committed By: wiz
> Date: Wed Jul  3 20:47:22 UTC 2019
> 
> Modified Files:
>   src/sys/external/bsd/drm2/nouveau: nouveau_pci.c
> 
> Log Message:
> Improve nouveau pci attachment code so it waits for the availability of /
> before trying to load firmware.
> 

Which firmware is it loading? we should probably ship it...


CVS commit: src/sys/external/bsd/drm2/nouveau

2019-07-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jul  3 20:47:22 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
Improve nouveau pci attachment code so it waits for the availability of /
before trying to load firmware.

Fixes my PR 54274.

LGTM mrg


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/nouveau

2019-07-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jul  3 20:47:22 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
Improve nouveau pci attachment code so it waits for the availability of /
before trying to load firmware.

Fixes my PR 54274.

LGTM mrg


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/nouveau/nouveau_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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.23 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.24
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.23	Mon Dec 24 08:40:33 2018
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Wed Jul  3 20:47:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.23 2018/12/24 08:40:33 mrg Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.24 2019/07/03 20:47:22 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.23 2018/12/24 08:40:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.24 2019/07/03 20:47:22 wiz Exp $");
 
 #include 
 #include 
@@ -52,6 +52,7 @@ SIMPLEQ_HEAD(nouveau_pci_task_head, nouv
 
 struct nouveau_pci_softc {
 	device_t		sc_dev;
+	struct pci_attach_args	sc_pa;
 	enum {
 		NOUVEAU_TASK_ATTACH,
 		NOUVEAU_TASK_WORKQUEUE,
@@ -67,6 +68,7 @@ struct nouveau_pci_softc {
 
 static int	nouveau_pci_match(device_t, cfdata_t, void *);
 static void	nouveau_pci_attach(device_t, device_t, void *);
+static void	nouveau_pci_attach_real(device_t);
 static int	nouveau_pci_detach(device_t, int);
 
 static bool	nouveau_pci_suspend(device_t, const pmf_qual_t *);
@@ -110,7 +112,7 @@ nouveau_pci_match(device_t parent, cfdat
 	 *   0x1e80-0x1eff 	TU104
 	 *   0x1f00-0x1f7f 	TU106
 	 */
-	
+
 	if (IS_BETWEEN(0x1580, 0x15ff) ||
 	IS_BETWEEN(0x1b00, 0x1b7f) ||
 	IS_BETWEEN(0x1b80, 0x1bff) ||
@@ -144,22 +146,37 @@ nouveau_pci_attach(device_t parent, devi
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
 	const struct pci_attach_args *const pa = aux;
-	int error;
 
 	pci_aprint_devinfo(pa, NULL);
 
-	sc->sc_dev = self;
+	if (!pmf_device_register(self, _pci_suspend, _pci_resume))
+		aprint_error_dev(self, "unable to establish power handler\n");
 
-	/* Initialize the Linux PCI device descriptor.  */
-	linux_pci_dev_init(>sc_pci_dev, self, device_parent(self), pa, 0);
+	/*
+	 * Trivial initialization first; the rest will come after we
+	 * have mounted the root file system and can load firmware
+	 * images.
+	 */
+	sc->sc_dev = NULL;
+	sc->sc_pa = *pa;
 
-	if (!pmf_device_register(self, _pci_suspend,
-		_pci_resume))
-		aprint_error_dev(self, "unable to establish power handler\n");
+	config_mountroot(self, _pci_attach_real);
+}
 
+static void
+nouveau_pci_attach_real(device_t self)
+{
+	struct nouveau_pci_softc *const sc = device_private(self);
+	const struct pci_attach_args *const pa = >sc_pa;
+	int error;
+
+	sc->sc_dev = self;
 	sc->sc_task_state = NOUVEAU_TASK_ATTACH;
 	SIMPLEQ_INIT(>sc_task_u.attach);
 
+	/* Initialize the Linux PCI device descriptor.  */
+	linux_pci_dev_init(>sc_pci_dev, self, device_parent(self), pa, 0);
+
 	/* XXX errno Linux->NetBSD */
 	error = -nvkm_device_pci_new(>sc_pci_dev,
 	nouveau_config, nouveau_debug,
@@ -204,6 +221,10 @@ nouveau_pci_detach(device_t self, int fl
 	struct nouveau_pci_softc *const sc = device_private(self);
 	int error;
 
+	if (sc->sc_dev == NULL)
+		/* Not done attaching.  */
+		return EBUSY;
+
 	/* XXX Check for in-use before tearing it all down...  */
 	error = config_detach_children(self, flags);
 	if (error)



CVS commit: src/sys/external/bsd/drm2/nouveau

2019-06-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 24 13:36:07 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
nouveau uses firmload, add dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/nouveau/files.nouveau

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.26 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.27
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.26	Mon Feb  4 08:18:08 2019
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Mon Jun 24 13:36:07 2019
@@ -1,9 +1,9 @@
-#	$NetBSD: files.nouveau,v 1.26 2019/02/04 08:18:08 mrg Exp $
+#	$NetBSD: files.nouveau,v 1.27 2019/06/24 13:36:07 wiz Exp $
 
 version	20180827
 
 define	nouveaufbbus	{ }
-device	nouveau: drmkms, drmkms_ttm, nouveaufbbus
+device	nouveau: drmkms, drmkms_ttm, nouveaufbbus, firmload
 
 attach	nouveau at pci with nouveau_pci: drmkms_pci
 file	external/bsd/drm2/nouveau/nouveau_pci.c			nouveau_pci



CVS commit: src/sys/external/bsd/drm2/nouveau

2019-06-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 24 13:36:07 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
nouveau uses firmload, add dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/nouveau/files.nouveau

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.