Module Name:    src
Committed By:   mrg
Date:           Mon May 21 08:58:47 UTC 2018

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

Log Message:
disable drm2 on modern nouveau cards (Pascal-based).

our older drm doesn't have any support for modern Pascal or
the second version of Maxwell (but not disabled here yet)
but the driver tries to attach on any nvidia gpu.

this should workaround PR#53258, and other issues reported
with modern nvidia chipsets.

XXX: pullup-7, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.9
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8	Tue Apr 19 06:57:37 2016
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Mon May 21 08:58:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.8 2016/04/19 06:57:37 mrg Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.9 2018/05/21 08:58:47 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.8 2016/04/19 06:57:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.9 2018/05/21 08:58:47 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/device.h>
@@ -91,6 +91,30 @@ 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-based cards:
+	 *   0x1580-0x15ff 	GP100
+	 *   0x1b00-0x1b7f 	GP102
+	 *   0x1b80-0x1bff 	GP104
+	 *   0x1c00-0x1c7f 	GP106
+	 *   0x1c80-0x1cff 	GP107
+	 *   0x1d00-0x1d7f 	GP108
+	 *   0x1d80-0x1dff 	GV100
+	 */
+	
+	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))
+		return 0;
+#undef IS_BETWEEN
+
 	return 6;		/* XXX Beat genfb_pci...  */
 }
 

Reply via email to