Module Name:    src
Committed By:   riastradh
Date:           Thu Nov 15 06:53:58 UTC 2018

Modified Files:
        src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
Don't try to interpret the second half of a 64-bit BAR as another one.

>From msaitoh@.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/external/bsd/drm2/pci/drm_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/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.31 src/sys/external/bsd/drm2/pci/drm_pci.c:1.32
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.31	Tue Aug 28 03:41:39 2018
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Thu Nov 15 06:53:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci.c,v 1.31 2018/08/28 03:41:39 riastradh Exp $	*/
+/*	$NetBSD: drm_pci.c,v 1.32 2018/11/15 06:53:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.31 2018/08/28 03:41:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.32 2018/11/15 06:53:58 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -106,6 +106,14 @@ drm_pci_attach(device_t self, const stru
 			continue;
 		}
 
+		/*
+		 * If it's a 64-bit mapping, don't interpret the second
+		 * half of it as another BAR in the next iteration of
+		 * the loop -- move on to the next unit.
+		 */
+		if (PCI_MAPREG_MEM_TYPE(type) == PCI_MAPREG_MEM_TYPE_64BIT)
+			unit++;
+
 		/* Inquire about it.  We'll map it in drm_legacy_ioremap.  */
 		if (pci_mapreg_info(pa->pa_pc, pa->pa_tag, reg, type,
 			&bm->bm_base, &bm->bm_size, &bm->bm_flags) != 0) {

Reply via email to