diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-08-11 00:58:06 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-12-21 04:01:10 -0500 |
commit | 8f27c54342dffbfbafbddd6e43f011e6cb16d285 (patch) | |
tree | cc8e98935b7d9f070585defb128800edc5f5d51a | |
parent | 771e1035b9bfdb0c3f0e34bd281d73b721a10adb (diff) |
drm/nouveau/vdec: implement stub modules for the known engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/Makefile | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv84_bsp.c | 83 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv84_vp.c | 83 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv98_crypt.c | 78 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv98_ppp.c | 78 |
7 files changed, 363 insertions, 6 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 35ef5b1e3566..75ef7664f12a 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -19,9 +19,12 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | |||
19 | nv04_graph.o nv10_graph.o nv20_graph.o \ | 19 | nv04_graph.o nv10_graph.o nv20_graph.o \ |
20 | nv40_graph.o nv50_graph.o nvc0_graph.o \ | 20 | nv40_graph.o nv50_graph.o nvc0_graph.o \ |
21 | nv40_grctx.o nv50_grctx.o nvc0_grctx.o \ | 21 | nv40_grctx.o nv50_grctx.o nvc0_grctx.o \ |
22 | nv84_crypt.o \ | 22 | nv84_crypt.o nv98_crypt.o \ |
23 | nva3_copy.o nvc0_copy.o \ | 23 | nva3_copy.o nvc0_copy.o \ |
24 | nv31_mpeg.o nv50_mpeg.o \ | 24 | nv31_mpeg.o nv50_mpeg.o \ |
25 | nv84_bsp.o \ | ||
26 | nv84_vp.o \ | ||
27 | nv98_ppp.o \ | ||
25 | nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ | 28 | nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ |
26 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ | 29 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ |
27 | nv04_crtc.o nv04_display.o nv04_cursor.o \ | 30 | nv04_crtc.o nv04_display.o nv04_cursor.o \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 999bcb6a20b8..2c8ebf6248a0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -163,6 +163,9 @@ enum nouveau_flags { | |||
163 | #define NVOBJ_ENGINE_COPY0 3 | 163 | #define NVOBJ_ENGINE_COPY0 3 |
164 | #define NVOBJ_ENGINE_COPY1 4 | 164 | #define NVOBJ_ENGINE_COPY1 4 |
165 | #define NVOBJ_ENGINE_MPEG 5 | 165 | #define NVOBJ_ENGINE_MPEG 5 |
166 | #define NVOBJ_ENGINE_PPP NVOBJ_ENGINE_MPEG | ||
167 | #define NVOBJ_ENGINE_BSP 6 | ||
168 | #define NVOBJ_ENGINE_VP 7 | ||
166 | #define NVOBJ_ENGINE_DISPLAY 15 | 169 | #define NVOBJ_ENGINE_DISPLAY 15 |
167 | #define NVOBJ_ENGINE_NR 16 | 170 | #define NVOBJ_ENGINE_NR 16 |
168 | 171 | ||
@@ -1226,6 +1229,9 @@ extern int nvc0_graph_isr_chid(struct drm_device *dev, u64 inst); | |||
1226 | /* nv84_crypt.c */ | 1229 | /* nv84_crypt.c */ |
1227 | extern int nv84_crypt_create(struct drm_device *); | 1230 | extern int nv84_crypt_create(struct drm_device *); |
1228 | 1231 | ||
1232 | /* nv98_crypt.c */ | ||
1233 | extern int nv98_crypt_create(struct drm_device *dev); | ||
1234 | |||
1229 | /* nva3_copy.c */ | 1235 | /* nva3_copy.c */ |
1230 | extern int nva3_copy_create(struct drm_device *dev); | 1236 | extern int nva3_copy_create(struct drm_device *dev); |
1231 | 1237 | ||
@@ -1238,6 +1244,17 @@ extern int nv31_mpeg_create(struct drm_device *dev); | |||
1238 | /* nv50_mpeg.c */ | 1244 | /* nv50_mpeg.c */ |
1239 | extern int nv50_mpeg_create(struct drm_device *dev); | 1245 | extern int nv50_mpeg_create(struct drm_device *dev); |
1240 | 1246 | ||
1247 | /* nv84_bsp.c */ | ||
1248 | /* nv98_bsp.c */ | ||
1249 | extern int nv84_bsp_create(struct drm_device *dev); | ||
1250 | |||
1251 | /* nv84_vp.c */ | ||
1252 | /* nv98_vp.c */ | ||
1253 | extern int nv84_vp_create(struct drm_device *dev); | ||
1254 | |||
1255 | /* nv98_ppp.c */ | ||
1256 | extern int nv98_ppp_create(struct drm_device *dev); | ||
1257 | |||
1241 | /* nv04_instmem.c */ | 1258 | /* nv04_instmem.c */ |
1242 | extern int nv04_instmem_init(struct drm_device *); | 1259 | extern int nv04_instmem_init(struct drm_device *); |
1243 | extern void nv04_instmem_takedown(struct drm_device *); | 1260 | extern void nv04_instmem_takedown(struct drm_device *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 0806d017d86b..e7ba6e7c0938 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -679,6 +679,11 @@ nouveau_card_init(struct drm_device *dev) | |||
679 | case 0xa0: | 679 | case 0xa0: |
680 | nv84_crypt_create(dev); | 680 | nv84_crypt_create(dev); |
681 | break; | 681 | break; |
682 | case 0x98: | ||
683 | case 0xaa: | ||
684 | case 0xac: | ||
685 | nv98_crypt_create(dev); | ||
686 | break; | ||
682 | } | 687 | } |
683 | 688 | ||
684 | switch (dev_priv->card_type) { | 689 | switch (dev_priv->card_type) { |
@@ -700,15 +705,25 @@ nouveau_card_init(struct drm_device *dev) | |||
700 | break; | 705 | break; |
701 | } | 706 | } |
702 | 707 | ||
708 | if (dev_priv->chipset >= 0xa3 || dev_priv->chipset == 0x98) { | ||
709 | nv84_bsp_create(dev); | ||
710 | nv84_vp_create(dev); | ||
711 | nv98_ppp_create(dev); | ||
712 | } else | ||
713 | if (dev_priv->chipset >= 0x84) { | ||
714 | nv50_mpeg_create(dev); | ||
715 | nv84_bsp_create(dev); | ||
716 | nv84_vp_create(dev); | ||
717 | } else | ||
718 | if (dev_priv->chipset >= 0x50) { | ||
719 | nv50_mpeg_create(dev); | ||
720 | } else | ||
703 | if (dev_priv->card_type == NV_40 || | 721 | if (dev_priv->card_type == NV_40 || |
704 | dev_priv->chipset == 0x31 || | 722 | dev_priv->chipset == 0x31 || |
705 | dev_priv->chipset == 0x34 || | 723 | dev_priv->chipset == 0x34 || |
706 | dev_priv->chipset == 0x36) | 724 | dev_priv->chipset == 0x36) { |
707 | nv31_mpeg_create(dev); | 725 | nv31_mpeg_create(dev); |
708 | else | 726 | } |
709 | if (dev_priv->card_type == NV_50 && | ||
710 | (dev_priv->chipset < 0x98 || dev_priv->chipset == 0xa0)) | ||
711 | nv50_mpeg_create(dev); | ||
712 | 727 | ||
713 | for (e = 0; e < NVOBJ_ENGINE_NR; e++) { | 728 | for (e = 0; e < NVOBJ_ENGINE_NR; e++) { |
714 | if (dev_priv->eng[e]) { | 729 | if (dev_priv->eng[e]) { |
diff --git a/drivers/gpu/drm/nouveau/nv84_bsp.c b/drivers/gpu/drm/nouveau/nv84_bsp.c new file mode 100644 index 000000000000..74875739bcc0 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv84_bsp.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "drmP.h" | ||
26 | #include "nouveau_drv.h" | ||
27 | #include "nouveau_util.h" | ||
28 | #include "nouveau_vm.h" | ||
29 | #include "nouveau_ramht.h" | ||
30 | |||
31 | /*XXX: This stub is currently used on NV98+ also, as soon as this becomes | ||
32 | * more than just an enable/disable stub this needs to be split out to | ||
33 | * nv98_bsp.c... | ||
34 | */ | ||
35 | |||
36 | struct nv84_bsp_engine { | ||
37 | struct nouveau_exec_engine base; | ||
38 | }; | ||
39 | |||
40 | static int | ||
41 | nv84_bsp_fini(struct drm_device *dev, int engine, bool suspend) | ||
42 | { | ||
43 | if (!(nv_rd32(dev, 0x000200) & 0x00008000)) | ||
44 | return 0; | ||
45 | |||
46 | nv_mask(dev, 0x000200, 0x00008000, 0x00000000); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static int | ||
51 | nv84_bsp_init(struct drm_device *dev, int engine) | ||
52 | { | ||
53 | nv_mask(dev, 0x000200, 0x00008000, 0x00000000); | ||
54 | nv_mask(dev, 0x000200, 0x00008000, 0x00008000); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static void | ||
59 | nv84_bsp_destroy(struct drm_device *dev, int engine) | ||
60 | { | ||
61 | struct nv84_bsp_engine *pbsp = nv_engine(dev, engine); | ||
62 | |||
63 | NVOBJ_ENGINE_DEL(dev, BSP); | ||
64 | |||
65 | kfree(pbsp); | ||
66 | } | ||
67 | |||
68 | int | ||
69 | nv84_bsp_create(struct drm_device *dev) | ||
70 | { | ||
71 | struct nv84_bsp_engine *pbsp; | ||
72 | |||
73 | pbsp = kzalloc(sizeof(*pbsp), GFP_KERNEL); | ||
74 | if (!pbsp) | ||
75 | return -ENOMEM; | ||
76 | |||
77 | pbsp->base.destroy = nv84_bsp_destroy; | ||
78 | pbsp->base.init = nv84_bsp_init; | ||
79 | pbsp->base.fini = nv84_bsp_fini; | ||
80 | |||
81 | NVOBJ_ENGINE_ADD(dev, BSP, &pbsp->base); | ||
82 | return 0; | ||
83 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv84_vp.c b/drivers/gpu/drm/nouveau/nv84_vp.c new file mode 100644 index 000000000000..6570d300ab85 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv84_vp.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "drmP.h" | ||
26 | #include "nouveau_drv.h" | ||
27 | #include "nouveau_util.h" | ||
28 | #include "nouveau_vm.h" | ||
29 | #include "nouveau_ramht.h" | ||
30 | |||
31 | /*XXX: This stub is currently used on NV98+ also, as soon as this becomes | ||
32 | * more than just an enable/disable stub this needs to be split out to | ||
33 | * nv98_vp.c... | ||
34 | */ | ||
35 | |||
36 | struct nv84_vp_engine { | ||
37 | struct nouveau_exec_engine base; | ||
38 | }; | ||
39 | |||
40 | static int | ||
41 | nv84_vp_fini(struct drm_device *dev, int engine, bool suspend) | ||
42 | { | ||
43 | if (!(nv_rd32(dev, 0x000200) & 0x00020000)) | ||
44 | return 0; | ||
45 | |||
46 | nv_mask(dev, 0x000200, 0x00020000, 0x00000000); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static int | ||
51 | nv84_vp_init(struct drm_device *dev, int engine) | ||
52 | { | ||
53 | nv_mask(dev, 0x000200, 0x00020000, 0x00000000); | ||
54 | nv_mask(dev, 0x000200, 0x00020000, 0x00020000); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static void | ||
59 | nv84_vp_destroy(struct drm_device *dev, int engine) | ||
60 | { | ||
61 | struct nv84_vp_engine *pvp = nv_engine(dev, engine); | ||
62 | |||
63 | NVOBJ_ENGINE_DEL(dev, VP); | ||
64 | |||
65 | kfree(pvp); | ||
66 | } | ||
67 | |||
68 | int | ||
69 | nv84_vp_create(struct drm_device *dev) | ||
70 | { | ||
71 | struct nv84_vp_engine *pvp; | ||
72 | |||
73 | pvp = kzalloc(sizeof(*pvp), GFP_KERNEL); | ||
74 | if (!pvp) | ||
75 | return -ENOMEM; | ||
76 | |||
77 | pvp->base.destroy = nv84_vp_destroy; | ||
78 | pvp->base.init = nv84_vp_init; | ||
79 | pvp->base.fini = nv84_vp_fini; | ||
80 | |||
81 | NVOBJ_ENGINE_ADD(dev, VP, &pvp->base); | ||
82 | return 0; | ||
83 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv98_crypt.c b/drivers/gpu/drm/nouveau/nv98_crypt.c new file mode 100644 index 000000000000..db94ff0a9fab --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv98_crypt.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "drmP.h" | ||
26 | #include "nouveau_drv.h" | ||
27 | #include "nouveau_util.h" | ||
28 | #include "nouveau_vm.h" | ||
29 | #include "nouveau_ramht.h" | ||
30 | |||
31 | struct nv98_crypt_engine { | ||
32 | struct nouveau_exec_engine base; | ||
33 | }; | ||
34 | |||
35 | static int | ||
36 | nv98_crypt_fini(struct drm_device *dev, int engine, bool suspend) | ||
37 | { | ||
38 | if (!(nv_rd32(dev, 0x000200) & 0x00004000)) | ||
39 | return 0; | ||
40 | |||
41 | nv_mask(dev, 0x000200, 0x00004000, 0x00000000); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int | ||
46 | nv98_crypt_init(struct drm_device *dev, int engine) | ||
47 | { | ||
48 | nv_mask(dev, 0x000200, 0x00004000, 0x00000000); | ||
49 | nv_mask(dev, 0x000200, 0x00004000, 0x00004000); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static void | ||
54 | nv98_crypt_destroy(struct drm_device *dev, int engine) | ||
55 | { | ||
56 | struct nv98_crypt_engine *pcrypt = nv_engine(dev, engine); | ||
57 | |||
58 | NVOBJ_ENGINE_DEL(dev, CRYPT); | ||
59 | |||
60 | kfree(pcrypt); | ||
61 | } | ||
62 | |||
63 | int | ||
64 | nv98_crypt_create(struct drm_device *dev) | ||
65 | { | ||
66 | struct nv98_crypt_engine *pcrypt; | ||
67 | |||
68 | pcrypt = kzalloc(sizeof(*pcrypt), GFP_KERNEL); | ||
69 | if (!pcrypt) | ||
70 | return -ENOMEM; | ||
71 | |||
72 | pcrypt->base.destroy = nv98_crypt_destroy; | ||
73 | pcrypt->base.init = nv98_crypt_init; | ||
74 | pcrypt->base.fini = nv98_crypt_fini; | ||
75 | |||
76 | NVOBJ_ENGINE_ADD(dev, CRYPT, &pcrypt->base); | ||
77 | return 0; | ||
78 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv98_ppp.c b/drivers/gpu/drm/nouveau/nv98_ppp.c new file mode 100644 index 000000000000..a987dd6e0036 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv98_ppp.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "drmP.h" | ||
26 | #include "nouveau_drv.h" | ||
27 | #include "nouveau_util.h" | ||
28 | #include "nouveau_vm.h" | ||
29 | #include "nouveau_ramht.h" | ||
30 | |||
31 | struct nv98_ppp_engine { | ||
32 | struct nouveau_exec_engine base; | ||
33 | }; | ||
34 | |||
35 | static int | ||
36 | nv98_ppp_fini(struct drm_device *dev, int engine, bool suspend) | ||
37 | { | ||
38 | if (!(nv_rd32(dev, 0x000200) & 0x00000002)) | ||
39 | return 0; | ||
40 | |||
41 | nv_mask(dev, 0x000200, 0x00000002, 0x00000000); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int | ||
46 | nv98_ppp_init(struct drm_device *dev, int engine) | ||
47 | { | ||
48 | nv_mask(dev, 0x000200, 0x00000002, 0x00000000); | ||
49 | nv_mask(dev, 0x000200, 0x00000002, 0x00000002); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static void | ||
54 | nv98_ppp_destroy(struct drm_device *dev, int engine) | ||
55 | { | ||
56 | struct nv98_ppp_engine *pppp = nv_engine(dev, engine); | ||
57 | |||
58 | NVOBJ_ENGINE_DEL(dev, PPP); | ||
59 | |||
60 | kfree(pppp); | ||
61 | } | ||
62 | |||
63 | int | ||
64 | nv98_ppp_create(struct drm_device *dev) | ||
65 | { | ||
66 | struct nv98_ppp_engine *pppp; | ||
67 | |||
68 | pppp = kzalloc(sizeof(*pppp), GFP_KERNEL); | ||
69 | if (!pppp) | ||
70 | return -ENOMEM; | ||
71 | |||
72 | pppp->base.destroy = nv98_ppp_destroy; | ||
73 | pppp->base.init = nv98_ppp_init; | ||
74 | pppp->base.fini = nv98_ppp_fini; | ||
75 | |||
76 | NVOBJ_ENGINE_ADD(dev, PPP, &pppp->base); | ||
77 | return 0; | ||
78 | } | ||