]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
drm/nv84: move PCRYPT ISR out of nouveau_irq.c
authorBen Skeggs <bskeggs@redhat.com>
Wed, 3 Nov 2010 00:06:43 +0000 (10:06 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 3 Dec 2010 05:11:30 +0000 (15:11 +1000)
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/nouveau_irq.c
drivers/gpu/drm/nouveau/nouveau_util.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nouveau_util.h [new file with mode: 0644]
drivers/gpu/drm/nouveau/nv84_crypt.c

index c8c8de0bbc7793cdee4e9bdd7c30226c0ef3a94f..7ea9a1154ca8aa8ffa46a9f3b9b4f7eb63f11f12 100644 (file)
@@ -5,7 +5,7 @@
 ccflags-y := -Iinclude/drm
 nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
              nouveau_object.o nouveau_irq.o nouveau_notifier.o \
-             nouveau_sgdma.o nouveau_dma.o \
+             nouveau_sgdma.o nouveau_dma.o nouveau_util.o \
              nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \
              nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \
              nouveau_display.o nouveau_connector.o nouveau_fbcon.o \
index 819bc3dd89e092c5dd7eeea8b69ea3a093bf60b0..bdaf8ae4447638615af4bd06d80b3ad6862e1dc9 100644 (file)
 #include "nouveau_drv.h"
 #include "nouveau_reg.h"
 #include "nouveau_ramht.h"
-#include <linux/ratelimit.h>
+#include "nouveau_util.h"
 
 /* needed for hotplug irq */
 #include "nouveau_connector.h"
 #include "nv50_display.h"
 
-static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
-
-static int nouveau_ratelimit(void)
-{
-       return __ratelimit(&nouveau_ratelimit_state);
-}
-
 void
 nouveau_irq_preinstall(struct drm_device *dev)
 {
@@ -1240,22 +1233,6 @@ nouveau_irq_handler(DRM_IRQ_ARGS)
                status &= ~NV_PMC_INTR_0_PGRAPH_PENDING;
        }
 
-       if (status & 0x00004000) {
-               u32 stat = nv_rd32(dev, 0x102130);
-               u32 mthd = nv_rd32(dev, 0x102190);
-               u32 data = nv_rd32(dev, 0x102194);
-               u32 inst = nv_rd32(dev, 0x102188) & 0x7fffffff;
-
-               NV_INFO(dev, "PCRYPT_INTR: 0x%08x 0x%08x 0x%08x 0x%08x\n",
-                       stat, mthd, data, inst);
-               nv_wr32(dev, 0x102130, stat);
-               nv_wr32(dev, 0x10200c, 0x10);
-
-               nv50_fb_vm_trap(dev, nouveau_ratelimit(), "PCRYPT");
-               status &= ~0x00004000;
-
-       }
-
        if (status & NV_PMC_INTR_0_CRTCn_PENDING) {
                nouveau_crtc_irq_handler(dev, (status>>24)&3);
                status &= ~NV_PMC_INTR_0_CRTCn_PENDING;
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.c b/drivers/gpu/drm/nouveau/nouveau_util.c
new file mode 100644 (file)
index 0000000..e8b1eaa
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Nouveau Project
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <linux/ratelimit.h>
+
+static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
+
+int
+nouveau_ratelimit(void)
+{
+       return __ratelimit(&nouveau_ratelimit_state);
+}
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.h b/drivers/gpu/drm/nouveau/nouveau_util.h
new file mode 100644 (file)
index 0000000..9a7a7c1
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Nouveau Project
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __NOUVEAU_UTIL_H__
+#define __NOUVEAU_UTIL_H__
+
+int nouveau_ratelimit(void);
+
+#endif
index f988b1a9d1d753cc164bbde940172cc306a16d63..1cda0240f55d24ee6eafbc8c30c579f1168e4b49 100644 (file)
@@ -24,6 +24,9 @@
 
 #include "drmP.h"
 #include "nouveau_drv.h"
+#include "nouveau_util.h"
+
+static void nv84_crypt_isr(struct drm_device *);
 
 int
 nv84_crypt_create_context(struct nouveau_channel *chan)
@@ -97,8 +100,11 @@ nv84_crypt_init(struct drm_device *dev)
 
        nv_mask(dev, 0x000200, 0x00004000, 0x00000000);
        nv_mask(dev, 0x000200, 0x00004000, 0x00004000);
+
+       nouveau_irq_register(dev, 14, nv84_crypt_isr);
        nv_wr32(dev, 0x102130, 0xffffffff);
        nv_wr32(dev, 0x102140, 0xffffffbf);
+
        nv_wr32(dev, 0x10200c, 0x00000010);
        return 0;
 }
@@ -107,4 +113,25 @@ void
 nv84_crypt_fini(struct drm_device *dev)
 {
        nv_wr32(dev, 0x102140, 0x00000000);
+       nouveau_irq_unregister(dev, 14);
+}
+
+static void
+nv84_crypt_isr(struct drm_device *dev)
+{
+       u32 stat = nv_rd32(dev, 0x102130);
+       u32 mthd = nv_rd32(dev, 0x102190);
+       u32 data = nv_rd32(dev, 0x102194);
+       u32 inst = nv_rd32(dev, 0x102188) & 0x7fffffff;
+       int show = nouveau_ratelimit();
+
+       if (show) {
+               NV_INFO(dev, "PCRYPT_INTR: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+                            stat, mthd, data, inst);
+       }
+
+       nv_wr32(dev, 0x102130, stat);
+       nv_wr32(dev, 0x10200c, 0x10);
+
+       nv50_fb_vm_trap(dev, show, "PCRYPT");
 }