diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-11-02 20:06:43 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-12-03 00:11:30 -0500 |
commit | d7facf9dc50acff69de9688088caa78b3cf69ebb (patch) | |
tree | c2ca30472f0ab46daa367ec798dd0dffe43fb6a1 /drivers/gpu/drm/nouveau | |
parent | 8f8a54482b008714ccfad15f4592b3802b80d479 (diff) |
drm/nv84: move PCRYPT ISR out of nouveau_irq.c
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_irq.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_util.c | 36 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_util.h | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv84_crypt.c | 27 |
5 files changed, 98 insertions, 25 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index c8c8de0bbc77..7ea9a1154ca8 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | ccflags-y := -Iinclude/drm | 5 | ccflags-y := -Iinclude/drm |
6 | nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | 6 | nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ |
7 | nouveau_object.o nouveau_irq.o nouveau_notifier.o \ | 7 | nouveau_object.o nouveau_irq.o nouveau_notifier.o \ |
8 | nouveau_sgdma.o nouveau_dma.o \ | 8 | nouveau_sgdma.o nouveau_dma.o nouveau_util.o \ |
9 | nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \ | 9 | nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \ |
10 | nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \ | 10 | nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \ |
11 | nouveau_display.o nouveau_connector.o nouveau_fbcon.o \ | 11 | nouveau_display.o nouveau_connector.o nouveau_fbcon.o \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 819bc3dd89e0..bdaf8ae44476 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -36,19 +36,12 @@ | |||
36 | #include "nouveau_drv.h" | 36 | #include "nouveau_drv.h" |
37 | #include "nouveau_reg.h" | 37 | #include "nouveau_reg.h" |
38 | #include "nouveau_ramht.h" | 38 | #include "nouveau_ramht.h" |
39 | #include <linux/ratelimit.h> | 39 | #include "nouveau_util.h" |
40 | 40 | ||
41 | /* needed for hotplug irq */ | 41 | /* needed for hotplug irq */ |
42 | #include "nouveau_connector.h" | 42 | #include "nouveau_connector.h" |
43 | #include "nv50_display.h" | 43 | #include "nv50_display.h" |
44 | 44 | ||
45 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
46 | |||
47 | static int nouveau_ratelimit(void) | ||
48 | { | ||
49 | return __ratelimit(&nouveau_ratelimit_state); | ||
50 | } | ||
51 | |||
52 | void | 45 | void |
53 | nouveau_irq_preinstall(struct drm_device *dev) | 46 | nouveau_irq_preinstall(struct drm_device *dev) |
54 | { | 47 | { |
@@ -1240,22 +1233,6 @@ nouveau_irq_handler(DRM_IRQ_ARGS) | |||
1240 | status &= ~NV_PMC_INTR_0_PGRAPH_PENDING; | 1233 | status &= ~NV_PMC_INTR_0_PGRAPH_PENDING; |
1241 | } | 1234 | } |
1242 | 1235 | ||
1243 | if (status & 0x00004000) { | ||
1244 | u32 stat = nv_rd32(dev, 0x102130); | ||
1245 | u32 mthd = nv_rd32(dev, 0x102190); | ||
1246 | u32 data = nv_rd32(dev, 0x102194); | ||
1247 | u32 inst = nv_rd32(dev, 0x102188) & 0x7fffffff; | ||
1248 | |||
1249 | NV_INFO(dev, "PCRYPT_INTR: 0x%08x 0x%08x 0x%08x 0x%08x\n", | ||
1250 | stat, mthd, data, inst); | ||
1251 | nv_wr32(dev, 0x102130, stat); | ||
1252 | nv_wr32(dev, 0x10200c, 0x10); | ||
1253 | |||
1254 | nv50_fb_vm_trap(dev, nouveau_ratelimit(), "PCRYPT"); | ||
1255 | status &= ~0x00004000; | ||
1256 | |||
1257 | } | ||
1258 | |||
1259 | if (status & NV_PMC_INTR_0_CRTCn_PENDING) { | 1236 | if (status & NV_PMC_INTR_0_CRTCn_PENDING) { |
1260 | nouveau_crtc_irq_handler(dev, (status>>24)&3); | 1237 | nouveau_crtc_irq_handler(dev, (status>>24)&3); |
1261 | status &= ~NV_PMC_INTR_0_CRTCn_PENDING; | 1238 | 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 index 000000000000..e8b1eaaa212b --- /dev/null +++ b/drivers/gpu/drm/nouveau/nouveau_util.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Nouveau Project | ||
3 | * | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining | ||
7 | * a copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial | ||
16 | * portions of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
21 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
22 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
23 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
24 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #include <linux/ratelimit.h> | ||
29 | |||
30 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
31 | |||
32 | int | ||
33 | nouveau_ratelimit(void) | ||
34 | { | ||
35 | return __ratelimit(&nouveau_ratelimit_state); | ||
36 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.h b/drivers/gpu/drm/nouveau/nouveau_util.h new file mode 100644 index 000000000000..9a7a7c18c99a --- /dev/null +++ b/drivers/gpu/drm/nouveau/nouveau_util.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Nouveau Project | ||
3 | * | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining | ||
7 | * a copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial | ||
16 | * portions of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
21 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
22 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
23 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
24 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #ifndef __NOUVEAU_UTIL_H__ | ||
29 | #define __NOUVEAU_UTIL_H__ | ||
30 | |||
31 | int nouveau_ratelimit(void); | ||
32 | |||
33 | #endif | ||
diff --git a/drivers/gpu/drm/nouveau/nv84_crypt.c b/drivers/gpu/drm/nouveau/nv84_crypt.c index f988b1a9d1d7..1cda0240f55d 100644 --- a/drivers/gpu/drm/nouveau/nv84_crypt.c +++ b/drivers/gpu/drm/nouveau/nv84_crypt.c | |||
@@ -24,6 +24,9 @@ | |||
24 | 24 | ||
25 | #include "drmP.h" | 25 | #include "drmP.h" |
26 | #include "nouveau_drv.h" | 26 | #include "nouveau_drv.h" |
27 | #include "nouveau_util.h" | ||
28 | |||
29 | static void nv84_crypt_isr(struct drm_device *); | ||
27 | 30 | ||
28 | int | 31 | int |
29 | nv84_crypt_create_context(struct nouveau_channel *chan) | 32 | nv84_crypt_create_context(struct nouveau_channel *chan) |
@@ -97,8 +100,11 @@ nv84_crypt_init(struct drm_device *dev) | |||
97 | 100 | ||
98 | nv_mask(dev, 0x000200, 0x00004000, 0x00000000); | 101 | nv_mask(dev, 0x000200, 0x00004000, 0x00000000); |
99 | nv_mask(dev, 0x000200, 0x00004000, 0x00004000); | 102 | nv_mask(dev, 0x000200, 0x00004000, 0x00004000); |
103 | |||
104 | nouveau_irq_register(dev, 14, nv84_crypt_isr); | ||
100 | nv_wr32(dev, 0x102130, 0xffffffff); | 105 | nv_wr32(dev, 0x102130, 0xffffffff); |
101 | nv_wr32(dev, 0x102140, 0xffffffbf); | 106 | nv_wr32(dev, 0x102140, 0xffffffbf); |
107 | |||
102 | nv_wr32(dev, 0x10200c, 0x00000010); | 108 | nv_wr32(dev, 0x10200c, 0x00000010); |
103 | return 0; | 109 | return 0; |
104 | } | 110 | } |
@@ -107,4 +113,25 @@ void | |||
107 | nv84_crypt_fini(struct drm_device *dev) | 113 | nv84_crypt_fini(struct drm_device *dev) |
108 | { | 114 | { |
109 | nv_wr32(dev, 0x102140, 0x00000000); | 115 | nv_wr32(dev, 0x102140, 0x00000000); |
116 | nouveau_irq_unregister(dev, 14); | ||
117 | } | ||
118 | |||
119 | static void | ||
120 | nv84_crypt_isr(struct drm_device *dev) | ||
121 | { | ||
122 | u32 stat = nv_rd32(dev, 0x102130); | ||
123 | u32 mthd = nv_rd32(dev, 0x102190); | ||
124 | u32 data = nv_rd32(dev, 0x102194); | ||
125 | u32 inst = nv_rd32(dev, 0x102188) & 0x7fffffff; | ||
126 | int show = nouveau_ratelimit(); | ||
127 | |||
128 | if (show) { | ||
129 | NV_INFO(dev, "PCRYPT_INTR: 0x%08x 0x%08x 0x%08x 0x%08x\n", | ||
130 | stat, mthd, data, inst); | ||
131 | } | ||
132 | |||
133 | nv_wr32(dev, 0x102130, stat); | ||
134 | nv_wr32(dev, 0x10200c, 0x10); | ||
135 | |||
136 | nv50_fb_vm_trap(dev, show, "PCRYPT"); | ||
110 | } | 137 | } |