Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2 Simplify drm shenanigans with irreleva...



details:   https://anonhg.NetBSD.org/src/rev/d9da5b32d926
branches:  trunk
changeset: 336570:d9da5b32d926
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Mar 06 13:44:18 2015 +0000

description:
Simplify drm shenanigans with irrelevant irq numbers.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c |  21 +------
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h                      |   2 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c         |  29 +++++----
 sys/external/bsd/drm2/pci/drm_pci.c                                                    |  19 +----
 4 files changed, 25 insertions(+), 46 deletions(-)

diffs (165 lines):

diff -r 831e96c1283e -r d9da5b32d926 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Fri Mar 06 12:41:05 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Fri Mar 06 13:44:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */
+/*     $NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $ */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -599,33 +599,18 @@
                pci_unmap_page(device->pdev, addr, PAGE_SIZE,
                               PCI_DMA_BIDIRECTIONAL);
 }
-#endif
 
 int
 nv_device_get_irq(struct nouveau_device *device, bool stall)
 {
        if (nv_device_is_pci(device)) {
-#ifdef __NetBSD__
-               pci_intr_handle_t ih;
-
-               CTASSERT(sizeof ih <= sizeof(int)); /* XXX */
-               if (pci_intr_map(&device->pdev->pd_pa, &ih))
-                       panic("unable to map nouveau interrupt"); /* XXX */
-
-               return ih;
-#else
                return device->pdev->irq;
-#endif
        } else {
-#ifdef __NetBSD__
-               /* XXX nouveau platform device */
-               panic("can't handle non-PCI nouveau devices");
-#else
                return platform_get_irq_byname(device->platformdev,
                                               stall ? "stall" : "nonstall");
-#endif
        }
 }
+#endif
 
 static struct nouveau_oclass
 nouveau_device_oclass = {
diff -r 831e96c1283e -r d9da5b32d926 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Fri Mar 06 12:41:05 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Fri Mar 06 13:44:18 2015 +0000
@@ -173,9 +173,9 @@
 
 void
 nv_device_unmap_page(struct nouveau_device *device, dma_addr_t addr);
-#endif
 
 int
 nv_device_get_irq(struct nouveau_device *device, bool stall);
+#endif
 
 #endif
diff -r 831e96c1283e -r d9da5b32d926 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c    Fri Mar 06 12:41:05 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c    Fri Mar 06 13:44:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $     */
+/*     $NetBSD: nouveau_subdev_mc_base.c,v 1.3 2015/03/06 13:44:18 riastradh Exp $     */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.3 2015/03/06 13:44:18 riastradh Exp $");
 
 #include <subdev/mc.h>
 #include <core/option.h>
@@ -162,22 +162,25 @@
                }
        }
 
+#ifdef __NetBSD__              /* XXX nouveau platform */
+       if (nv_device_is_pci(device)) {
+               const pci_chipset_tag_t pc = device->pdev->pd_pa.pa_pc;
+               pci_intr_handle_t ih;
+
+               if (pci_intr_map(&device->pdev->pd_pa, &ih))
+                       return -EIO;
+
+               pmc->irq_cookie = pci_intr_establish(pc, ih, IPL_VM,
+                   &nouveau_mc_intr, pmc);
+               if (pmc->irq_cookie == NULL)
+                       return -EIO;
+       }
+#else
        ret = nv_device_get_irq(device, true);
        if (ret < 0)
                return ret;
        pmc->irq = ret;
 
-#ifdef __NetBSD__
-       if (nv_device_is_pci(device)) {
-               const pci_chipset_tag_t pc = device->pdev->pd_pa.pa_pc;
-
-               __CTASSERT(sizeof(pci_intr_handle_t) <= sizeof pmc->irq);
-               pmc->irq_cookie = pci_intr_establish(pc, pmc->irq, IPL_VM,
-                   &nouveau_mc_intr, pmc);
-               if (pmc->irq_cookie == NULL)
-                       return -EIO;
-       }
-#else
        ret = request_irq(pmc->irq, nouveau_mc_intr, IRQF_SHARED, "nouveau",
                          pmc);
 
diff -r 831e96c1283e -r d9da5b32d926 sys/external/bsd/drm2/pci/drm_pci.c
--- a/sys/external/bsd/drm2/pci/drm_pci.c       Fri Mar 06 12:41:05 2015 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci.c       Fri Mar 06 13:44:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_pci.c,v 1.11 2015/03/06 01:43:07 riastradh Exp $   */
+/*     $NetBSD: drm_pci.c,v 1.12 2015/03/06 13:44:18 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.11 2015/03/06 01:43:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.12 2015/03/06 13:44:18 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -218,21 +218,12 @@
 static int
 drm_pci_get_irq(struct drm_device *dev)
 {
-       pci_intr_handle_t ih_pih;
-       int ih_int;
 
        /*
-        * This is a compile-time assertion that the types match.  If
-        * this fails, we have to change a bunch of drm code that uses
-        * int for intr handles.
+        * Caller expects a nonzero int, and doesn't really use it for
+        * anything, so no need to pci_intr_map here.
         */
-       KASSERT(&ih_pih != &ih_int);
-
-       if (pci_intr_map(drm_pci_attach_args(dev), &ih_pih))
-               return -1;      /* XXX Hope -1 is an invalid intr handle.  */
-
-       ih_int = ih_pih;
-       return ih_int;
+       return dev->pdev->pd_pa.pa_intrpin;
 }
 
 static int



Home | Main Index | Thread Index | Old Index