Module Name: src
Committed By: riastradh
Date: Fri Mar 6 13:44:19 UTC 2015
Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc:
nouveau_subdev_mc_base.c
src/sys/external/bsd/drm2/pci: drm_pci.c
Log Message:
Simplify drm shenanigans with irrelevant irq numbers.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
cvs rdiff -u -r1.11 -r1.12 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/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.3 Sat Aug 23 08:03:33 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c Fri Mar 6 13:44:18 2015
@@ -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 @@ nv_device_unmap_page(struct nouveau_devi
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 = {
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.3 Sat Aug 23 08:03:34 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Fri Mar 6 13:44:18 2015
@@ -173,9 +173,9 @@ nv_device_map_page(struct nouveau_device
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
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.2 Wed Feb 25 17:29:43 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c Fri Mar 6 13:44:18 2015
@@ -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 @@ nouveau_mc_create_(struct nouveau_object
}
}
- ret = nv_device_get_irq(device, true);
- if (ret < 0)
- return ret;
- pmc->irq = ret;
-
-#ifdef __NetBSD__
+#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;
- __CTASSERT(sizeof(pci_intr_handle_t) <= sizeof pmc->irq);
- pmc->irq_cookie = pci_intr_establish(pc, pmc->irq, IPL_VM,
+ 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;
+
ret = request_irq(pmc->irq, nouveau_mc_intr, IRQF_SHARED, "nouveau",
pmc);
Index: src/sys/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.11 src/sys/external/bsd/drm2/pci/drm_pci.c:1.12
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.11 Fri Mar 6 01:43:07 2015
+++ src/sys/external/bsd/drm2/pci/drm_pci.c Fri Mar 6 13:44:18 2015
@@ -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 @@ drm_pci_agp_destroy(struct drm_device *d
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